2013-05-14 Mark Holland <mark@mark-holland.me.uk>

* src/pandroid/agent/PandroidAgentListener.java: Moved the 
	loading	of the config values to an asynctask to force that updating 
	the values and then contacting the server and creating the 
	notification happens after all the config values have been loaded.

	* src/pandroid/agent/Status.java: On resuming the app
	the loading of the last values has been moved to an asynctask to force
	updating the ui to wait for all the values to be loaded.

	* src/pandroid/agent/*.java: Applied the Correct Indentation function
	of eclipse to all code.

	* res/layout/*.xml: Applied the Correct Indentation function
	of eclipse to all code.

	* Pandroid Agent v3.0_iso-8859-1.apk: Updated to latest version.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8127 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
markholland 2013-05-14 06:59:20 +00:00
parent 1c49e57a52
commit fe4bcdc14a
23 changed files with 2560 additions and 2571 deletions

View File

@ -35,25 +35,28 @@
<uses-feature android:name="android.hardware.sensor.light" />
<uses-feature android:name="android.hardware.location" />
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".PandroidAgent"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation"
android:theme="@style/MainTheme"
>
android:label="@string/app_name"
android:theme="@style/MainTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Status" />
<activity android:name=".Setup" />
<service android:enabled="true" android:name="pandroid.agent.PandroidAgentListener" />
<receiver android:name="pandroid.agent.EventReceiver" />
<service
android:name="pandroid.agent.PandroidAgentListener"
android:enabled="true" />
<receiver android:name="pandroid.agent.EventReceiver" />
<receiver
android:name="pandroid.agent.StartMyServiceAtBootReceiver"
android:enabled="true"
@ -64,29 +67,27 @@
</intent-filter>
</receiver>
<service android:enabled="true" android:name="pandroid.agent.MyStartService" />
<service
android:name="pandroid.agent.MyStartService"
android:enabled="true" />
<activity
android:name=".About"
android:label="@string/pandroid_agent_str"
android:theme="@android:style/Theme.Dialog"
/>
android:theme="@android:style/Theme.Dialog" />
<activity
android:name=".Help"
android:label="@string/help_str"
android:theme="@android:style/Theme.Dialog"
/>
android:theme="@android:style/Theme.Dialog" />
<receiver android:name=".SMSBroadcastReceiver" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
<action android:name="android.provider.Telephony.SMS_RECEIVED" >
</action>
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="8" />
</manifest>

View File

@ -1,3 +1,22 @@
2013-05-14 Mark Holland <mark@mark-holland.me.uk>
* src/pandroid/agent/PandroidAgentListener.java: Moved the
loading of the config values to an asynctask to force that updating
the values and then contacting the server and creating the
notification happens after all the config values have been loaded.
* src/pandroid/agent/Status.java: On resuming the app
the loading of the last values has been moved to an asynctask to force
updating the ui to wait for all the values to be loaded.
* src/pandroid/agent/*.java: Applied the Correct Indentation function
of eclipse to all code.
* res/layout/*.xml: Applied the Correct Indentation function
of eclipse to all code.
* Pandroid Agent v3.0_iso-8859-1.apk: Updated to latest version.
2013-05-01 Mark Holland <mark@mark-holland.me.uk>
* src/pandroid/agent/PandroidAgentListener.java: Changed gps module

View File

@ -32,24 +32,24 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pandroid_agent_copyright"
/>
android:text="@string/pandroid_agent_copyright" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/licensed_under_gpl_str"
android:gravity="center_horizontal"
/>
android:text="@string/licensed_under_gpl_str" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/develop_team_str"
android:gravity="left"
/>
android:text="@string/develop_team_str" />
<TextView
android:id="@+id/url_pandora"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
/>
android:gravity="center_horizontal" />
</LinearLayout>

View File

@ -14,14 +14,12 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
android:background="#000000"
>
android:orientation="vertical"
android:padding="10dip" >
<ScrollView
android:id="@+id/scrollView1"
@ -32,7 +30,6 @@
android:id="@+id/help_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</ScrollView>
</LinearLayout>

View File

@ -12,7 +12,8 @@
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.-->
// GNU General Public License for more details.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/p"
android:layout_width="fill_parent"
@ -28,7 +29,6 @@
android:layout_marginTop="50dp"
android:text="@string/yes" />
<Button
android:id="@+id/no_button"
style="?android:attr/buttonStyleSmall"

View File

@ -12,12 +12,12 @@
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. -->
// GNU General Public License for more details.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/setupnosim"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
@ -36,10 +36,10 @@
android:id="@+id/checkNotification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5sp"
android:text="@string/notificationCheck"
android:textColor="#bbbbbb"
android:textSize="14sp"
android:paddingTop="5sp"/>
android:textSize="14sp" />
<TextView
android:id="@+id/field1"
@ -228,7 +228,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/restartAgent" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -3,4 +3,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#00FF00" >
</TextView>

View File

@ -14,12 +14,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_height="fill_parent" >
<ScrollView
android:layout_width="fill_parent"
@ -29,8 +26,7 @@
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
android:orientation="vertical" >
<TextView
android:id="@+id/last_values_label_str"
@ -39,21 +35,18 @@
android:layout_gravity="center_horizontal"
android:text="@string/last_values"
android:textSize="18sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/lastContactInfo_label_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<ImageView
android:id="@+id/img_logo"
@ -61,8 +54,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:padding="5dp"
android:src="@drawable/logo"
/>
android:src="@drawable/logo" />
<TextView
android:id="@+id/latitude_label_str"
@ -71,15 +63,13 @@
android:layout_below="@id/lastContactInfo_label_str"
android:text="@string/latitude"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/latitude_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/latitude_label_str"
/>
android:layout_below="@id/latitude_label_str" />
<TextView
android:id="@+id/longitude_label_str"
@ -88,15 +78,13 @@
android:layout_below="@id/latitude_value_str"
android:text="@string/longitude"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/longitude_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/longitude_label_str"
/>
android:layout_below="@id/longitude_label_str" />
<TextView
android:id="@+id/battery_label_str"
@ -105,15 +93,13 @@
android:layout_below="@id/longitude_value_str"
android:text="@string/battery_level"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/battery_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/battery_label_str"
/>
android:layout_below="@id/battery_label_str" />
<!--
<TextView
@ -155,14 +141,12 @@
android:layout_height="wrap_content"
android:text="@string/task"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/task_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
<TextView
android:id="@+id/memory_label_str"
@ -170,45 +154,41 @@
android:layout_height="wrap_content"
android:text="@string/memory"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/memory_value_str"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.18"
>
android:layout_weight="1.18" >
<TableRow
android:id="@+id/tableRow0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/uptime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/uptime"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/uptime_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/sim_id"
@ -216,44 +196,38 @@
android:layout_height="wrap_content"
android:text="@string/sim_id"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/sim_id_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/network_operator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5dip"
android:text="@string/network_operator"
android:textSize="14sp"
android:textStyle="bold"
android:paddingRight="5dip"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/network_operator_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/network_type"
@ -261,22 +235,18 @@
android:layout_height="wrap_content"
android:text="@string/network_type"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/network_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/phone_type"
@ -284,21 +254,18 @@
android:layout_height="wrap_content"
android:text="@string/phone_type"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/phone_type_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/signal_strength"
@ -306,21 +273,18 @@
android:layout_height="wrap_content"
android:text="@string/signal_strength"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/signal_strength_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/sms_received"
@ -328,21 +292,18 @@
android:layout_height="wrap_content"
android:text="@string/sms_received"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/sms_received_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/sms_sent"
@ -350,21 +311,18 @@
android:layout_height="wrap_content"
android:text="@string/sms_sent"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/sms_sent_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/incoming_calls"
@ -372,21 +330,18 @@
android:layout_height="wrap_content"
android:text="@string/incoming_calls"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/incoming_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/missed_calls"
@ -394,21 +349,18 @@
android:layout_height="wrap_content"
android:text="@string/missed_calls"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/missed_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/outgoing_calls"
@ -416,21 +368,18 @@
android:layout_height="wrap_content"
android:text="@string/outgoing_calls"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/outgoing_calls_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/receive_bytes"
@ -438,21 +387,18 @@
android:layout_height="wrap_content"
android:text="@string/receive_bytes"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/receive_bytes_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/transmit_bytes"
@ -460,41 +406,36 @@
android:layout_height="wrap_content"
android:text="@string/transmit_bytes"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/transmit_bytes_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
android:layout_height="wrap_content" >
<TextView
android:id="@+id/roaming"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/roaming"
android:textSize="14sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/roaming_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<!-- for debugging
<!--
for debugging
<Button
android:id="@+id/start"
android:layout_width="fill_parent"
@ -529,6 +470,6 @@
android:text="Hide xml" />
-->
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -17,10 +17,6 @@
android:paddingTop="20dp"
android:src="@drawable/pandroid_large" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"

View File

@ -15,14 +15,14 @@
// GNU General Public License for more details.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/help_button_menu_options"
android:title="@string/help_label_str"
android:icon="@drawable/help"
/>
android:title="@string/help_label_str"/>
<item
android:id="@+id/about_button_menu_options"
android:title="@string/about_label_str"
android:icon="@drawable/about"
/>
android:title="@string/about_label_str"/>
</menu>

View File

@ -113,39 +113,11 @@ public class PandroidAgentListener extends Service {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakeLock");
wakeLock.acquire();
Core.loadConf(this);
updateValues();
contact();
try {
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon, getText(R.string.ticker_text),
System.currentTimeMillis());
Intent notificationIntent = new Intent(this,PandroidAgent.class);
notificationIntent.setAction("android.intent.action.MAIN");
notificationIntent.addCategory("android.intent.category.LAUNCHER");
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, Notification.FLAG_NO_CLEAR);
notification.setLatestEventInfo(this, getText(R.string.notification_title), getText(R.string.notification_message), pendingIntent);
notification.flags |= Notification.FLAG_ONGOING_EVENT;
new loadConfThenContinueAsyncTask().execute();
if(Core.NotificationCheck == "enabled"){
CancelNotification(getApplicationContext(),42);
notificationManager.notify(42, notification);
}
else{
CancelNotification(getApplicationContext(),42);
}
} catch (Exception e) {
Log.e("notification", e.toString());
}
finally{
wakeLock.release();
}
return START_NOT_STICKY;
}
@ -201,6 +173,53 @@ public class PandroidAgentListener extends Service {
// updateValues();
// }
/**
* To ensure that the Core values are loaded before continuing
* @author markholland
*
*/
public class loadConfThenContinueAsyncTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
Core.loadConf(getApplicationContext());
return null;
}
@Override
protected void onPostExecute(Void unused)
{
updateValues();
contact();
try {
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon, getText(R.string.ticker_text),
System.currentTimeMillis());
Intent notificationIntent = new Intent(getApplicationContext(),PandroidAgent.class);
notificationIntent.setAction("android.intent.action.MAIN");
notificationIntent.addCategory("android.intent.category.LAUNCHER");
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, Notification.FLAG_NO_CLEAR);
notification.setLatestEventInfo(getApplicationContext(), getText(R.string.notification_title), getText(R.string.notification_message), pendingIntent);
notification.flags |= Notification.FLAG_ONGOING_EVENT;
if(Core.NotificationCheck == "enabled"){
CancelNotification(getApplicationContext(),42);
notificationManager.notify(42, notification);
}
else{
CancelNotification(getApplicationContext(),42);
}
} catch (Exception e) {
Log.e("notification", e.toString());
}
}
}// end onPostExecute
private void contact(){
@ -1043,8 +1062,8 @@ public class PandroidAgentListener extends Service {
private void putSharedData(String preferenceName, String tokenName, String data, String type) {
SharedPreferences agentPreferences = this.getSharedPreferences(
this.getString(R.string.const_string_preferences),
SharedPreferences agentPreferences = getApplicationContext().getSharedPreferences(
getApplicationContext().getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
Editor editor = agentPreferences.edit();
@ -1075,8 +1094,8 @@ public class PandroidAgentListener extends Service {
private String getSharedData(String preferenceName, String tokenName, String defaultValue, String type) {
SharedPreferences agentPreferences = this.getSharedPreferences(
this.getString(R.string.const_string_preferences),
SharedPreferences agentPreferences = getApplicationContext().getSharedPreferences(
getApplicationContext().getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
if(type == "boolean") {

View File

@ -19,6 +19,7 @@ import java.util.Date;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
@ -55,9 +56,7 @@ public class Status extends Activity {
else
setContentView(R.layout.statusnosim);
Core.loadLastValues(getApplicationContext());
showLastValues();
new GetLastValuesAsyncTask().execute();
updateLastContactInfo();
@ -71,9 +70,7 @@ public class Status extends Activity {
@Override
public void run() {
Core.loadLastValues(getApplicationContext());
showLastValues();
new GetLastValuesAsyncTask().execute();
updateLastContactInfo();
@ -105,6 +102,25 @@ public class Status extends Activity {
return true;
}
public class GetLastValuesAsyncTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
Core.loadLastValues(getApplicationContext());
return null;
}
@Override
protected void onPostExecute(Void unused)
{
showLastValues();
}
}// end onPostExecute
private void updateLastContactInfo() {
long lastContact = Core.lastContact;