X-Git-Url: http://www.average.org/gitweb/?p=WhereAmI.git;a=blobdiff_plain;f=src%2Forg%2Faverage%2Fwhereami%2FWhereAmI.java;h=9731e099c75d717d95e9d496f0114850b09b8e29;hp=c08453a28057b4b665fc28df5863277451849347;hb=36b6777a469a0ab1a15016b2d34b9e2aa10a3c0a;hpb=e7ecf60a526f2f410d586895429e208370517bc9 diff --git a/src/org/average/whereami/WhereAmI.java b/src/org/average/whereami/WhereAmI.java index c08453a..9731e09 100644 --- a/src/org/average/whereami/WhereAmI.java +++ b/src/org/average/whereami/WhereAmI.java @@ -165,10 +165,11 @@ public class WhereAmI extends Activity for (int i = 0; i < ut.length; i++) { ut[i].cancel(); } + runningtasks = 0; Time tm = new Time(); tm.setToNow(); tvs.setText(R.string.failtry); - tvs.append(tm.format(" %d/%m/%Y %H:%M:%S")); + tvs.append(tm.format(" %d/%m/%Y %H:%M")); } if (managewifi) { boolean wifion = wifiman.setWifiEnabled(false); @@ -221,16 +222,11 @@ public class WhereAmI extends Activity tvd = (TextView)findViewById(R.id.date); tvs = (TextView)findViewById(R.id.timestamp); ut = new UpdateTarget[] { - new UpdateTarget((TextView)findViewById(R.id.location), - new PhoneLog(res, store)), new UpdateTarget((TextView)findViewById(R.id.phonecall), + new PhoneLog(res, store)), + new UpdateTarget((TextView)findViewById(R.id.location), new LastLocation(res, store)) }; - Log.v(TAG, "created UI, about to start update task"); - mHandler.post(updateClock); - mHandler.post(updateCal); - mHandler.post(updateInfo); - Log.v(TAG, "created UI, update task created"); } /** Called when reactivated */ @@ -250,6 +246,10 @@ public class WhereAmI extends Activity } else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } + mHandler.post(updateClock); + mHandler.post(updateCal); + mHandler.post(updateInfo); + Log.v(TAG, "update tasks scheduled"); } /** Called when put to background */ @@ -257,6 +257,10 @@ public class WhereAmI extends Activity public void onPause() { super.onPause(); Log.v(TAG, "going background"); + resetInfo.run(); + mHandler.removeCallbacks(updateClock); + mHandler.removeCallbacks(updateCal); + mHandler.removeCallbacks(updateInfo); } /** Called when the activity is destroyed. */ @@ -264,17 +268,6 @@ public class WhereAmI extends Activity public void onDestroy() { super.onDestroy(); Log.v(TAG, "going down"); - mHandler.removeCallbacks(updateClock); - mHandler.removeCallbacks(updateCal); - mHandler.removeCallbacks(updateInfo); - if (connChangedRegistered) { - unregisterReceiver(connChanged); - connChangedRegistered = false; - } - if (managewifi) { - boolean wifion = wifiman.setWifiEnabled(false); - Log.v(TAG, "disabling wifi result " + wifion); - } } /** Called when the menu is activated. */