This is only a concept, it displays the login page in a webview (looks ugly). After logging in, you get presented with a alert dialog that grabs some values from the page.
Using java Syntax Highlighting
- public class maLocker extends Activity {
- final maLocker theApp = this;
- int a = 0;
- String att1 = "class";
- String atv1 = "ptz_value";
- String atv2 = "friends";
- String atv3 = "check-in-active";
- //String atv4 = "completed check-in-notactive";
- String ptzValue;
- String friends;
- //String urla = "file:///android_asset/Lockerz.htm";
- String urla = "http://www.lockerz.com";
- public class MyJavaScriptInterface
- {
- public void showHTML(String html) throws IOException
- {
- String checkIn;
- String aVal;
- try{
- HtmlCleaner parser = new HtmlCleaner();
- TagNode node = parser.clean(html);
- TagNode node1 = node.findElementByAttValue(att1, atv1, true, true);
- TagNode node2 = node.findElementByAttValue(att1, atv2, true, true);
- ptzValue = node1.getText().toString();
- friends = node2.getText().toString();
- Pattern nPtt = Pattern.compile("[0-9]+");
- Matcher m = nPtt.matcher(friends);
- int numberFr = 0;
- if (m.find()){
- numberFr = Integer.parseInt(m.group(0));
- }
- try{
- TagNode node3 = node.findElementByAttValue(att1, atv3, true, true);
- aVal = node3.getText().toString();
- checkIn="No!";
- }catch (Exception e){
- checkIn="Yes!";
- }
- new AlertDialog.Builder(theApp)
- .setTitle("Report")
- .setMessage("Ptz: "+ptzValue+" Friends: "+numberFr+"\nChecked in? "+checkIn)
- .setPositiveButton(android.R.string.ok, null)
- .setCancelable(false)
- .create()
- .show();
- }catch (Exception e){
- new AlertDialog.Builder(theApp)
- .setTitle("Oh F#@K!")
- .setMessage("Failed to get your data! =[")
- .setPositiveButton(android.R.string.ok, null)
- .setCancelable(false)
- .create()
- .show();
- }
- }
- }
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.main);
- final TextView lul = (TextView) findViewById(R.id.lul);
- final WebView browser = (WebView) findViewById(R.id.webview);
- browser.getSettings().setJavaScriptEnabled(true);
- browser.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
- browser.setWebViewClient(new WebViewClient() {
- public void onPageFinished(WebView webview, String urla){
- String b = browser.getUrl();
- if(b.equals("http://www.lockerz.com/myLocker")){
- browser.loadUrl("javascript:window.HTMLOUT.showHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
- lul.setText("Your Locker!");
- }else{
- lul.setText("Login page?");
- }
- }
- });
- browser.loadUrl(urla);
- }
- }
Parsed in 0.042 seconds, using GeSHi 1.0.8.4
In the first proper functional release of 1.0; I am hoping it will contain the following:
> Multiple tabs, switchable at the top of the app
> A tab that has the values of the account (PTZ, friends added, checked in?, dailies)... A refresh button would be needed
> A tab which displays the dailies in an orderly fashion
> A tab to browse the redeemable prizes (possibly)
> Remembered login... Start app>get and login with saved credentials (do while progress bar is showing)>presented with account stats
> Notification of undone dailies and "check in" (possibly very later on; end of my list sort of thing)
> Very nice GUI, with the flowing purple theme and "Lockerz" styled icons
But this is all a little while off... My concept I have posted is practically a 0.1
Hope you all like =]


