X-Git-Url: http://www.average.org/gitweb/?p=WhereAmI.git;a=blobdiff_plain;f=src%2Forg%2Faverage%2Fwhereami%2FWhereAmI.java;h=2fed78cbbada79d093932cee1959f7943ea85fa0;hp=591d831af1bcfe1747f02e4cad85467f84260b28;hb=c2cc66c629a5f00dc8b59a03be14cf346f075e52;hpb=5a1b41dd22020796d527c226012c5f37bfdc9a73;ds=sidebyside diff --git a/src/org/average/whereami/WhereAmI.java b/src/org/average/whereami/WhereAmI.java index 591d831..2fed78c 100644 --- a/src/org/average/whereami/WhereAmI.java +++ b/src/org/average/whereami/WhereAmI.java @@ -31,6 +31,8 @@ import android.widget.TextView; public class WhereAmI extends Activity { + final String TAG = getClass().getName(); + private WifiManager wifiman; private Boolean managewifi = false; private Long updatedelay = 60000L; @@ -45,18 +47,18 @@ public class WhereAmI extends Activity private class BgUpdate extends AsyncTask { @Override protected String doInBackground(Void... params) { - Log.w("WhereAmI", "BgUpdate " + updater + " starting"); + Log.w(TAG, "BgUpdate " + updater + " starting"); return updater.getResult(); } @Override protected void onPostExecute(String str) { - Log.w("WhereAmI", "BgUpdate callback executing"); + Log.w(TAG, "BgUpdate callback executing"); tv.setText(str); runningtasks--; if (runningtasks <= 0) { boolean wifion = wifiman.setWifiEnabled(false); - Log.w("WhereAmI", "disabling wifi result " + wifion); + Log.w(TAG, "disabling wifi result " + wifion); Time tm = new Time(); tm.setToNow(); tvs.setText(R.string.lasttry); @@ -66,7 +68,7 @@ public class WhereAmI extends Activity @Override protected void onCancelled() { - Log.w("WhereAmI", "BgUpdate callback cancelled"); + Log.w(TAG, "BgUpdate callback cancelled"); runningtasks--; } } @@ -129,14 +131,14 @@ public class WhereAmI extends Activity private Runnable updateInfo = new Runnable () { public void run() { - Log.w("WhereAmI", "updateInfo starting"); + Log.w(TAG, "updateInfo starting"); if (managewifi) { IntentFilter intentFilter = new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"); registerReceiver(connChanged,intentFilter); connChangedRegistered = true; boolean wifion = wifiman.setWifiEnabled(true); - Log.w("WhereAmI", "enabling wifi result " + wifion); + Log.w(TAG, "enabling wifi result " + wifion); } else { for (int i = 0; i < ut.length; i++) { runningtasks++; @@ -150,7 +152,7 @@ public class WhereAmI extends Activity private Runnable resetInfo = new Runnable () { public void run() { - Log.w("WhereAmI", "resetInfo starting"); + Log.w(TAG, "resetInfo starting"); if (connChangedRegistered) { unregisterReceiver(connChanged); connChangedRegistered = false; @@ -166,7 +168,7 @@ public class WhereAmI extends Activity } if (managewifi) { boolean wifion = wifiman.setWifiEnabled(false); - Log.w("WhereAmI", "disabling wifi result " + wifion); + Log.w(TAG, "disabling wifi result " + wifion); } } }; @@ -180,7 +182,7 @@ public class WhereAmI extends Activity NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); - Log.w("WhereAmI", "Connectivity changed to " + isConnected); + Log.w(TAG, "Connectivity changed to " + isConnected); if (isConnected) { for (int i = 0; i < ut.length; i++) { runningtasks++; @@ -210,11 +212,11 @@ public class WhereAmI extends Activity new UpdateTarget((TextView)findViewById(R.id.phonecall), new Location()) }; - Log.w("WhereAmI", "created UI, about to start update task"); + Log.w(TAG, "created UI, about to start update task"); mHandler.post(updateClock); mHandler.post(updateCal); mHandler.post(updateInfo); - Log.w("WhereAmI", "created UI, update task created"); + Log.w(TAG, "created UI, update task created"); } /** Called when reactivated */ @@ -241,14 +243,14 @@ public class WhereAmI extends Activity @Override public void onPause() { super.onPause(); - Log.w("WhereAmI", "going background"); + Log.w(TAG, "going background"); } /** Called when the activity is destroyed. */ @Override public void onDestroy() { super.onDestroy(); - Log.w("WhereAmI", "going down"); + Log.w(TAG, "going down"); mHandler.removeCallbacks(updateClock); mHandler.removeCallbacks(updateCal); mHandler.removeCallbacks(updateInfo); @@ -257,7 +259,7 @@ public class WhereAmI extends Activity connChangedRegistered = false; } boolean wifion = wifiman.setWifiEnabled(false); - Log.w("WhereAmI", "disabling wifi result " + wifion); + Log.w(TAG, "disabling wifi result " + wifion); } /** Called when the menu is activated. */ @@ -275,8 +277,12 @@ public class WhereAmI extends Activity case R.id.quit: finish(); return true; + case R.id.authorize: + Log.w(TAG, "authorize requested"); + startActivity(new Intent(this, Authorize.class)); + return true; case R.id.settings: - Log.w("WhereAmI", "settings requested"); + Log.w(TAG, "settings requested"); startActivity(new Intent(this, WhereAmIprefs.class)); return true; default: