Update notifications on background thread.

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-08-12 10:44:27 -07:00
parent 3edda51379
commit d6179bc12b

View File

@ -88,7 +88,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
.execute(VersionTracker.getLastSeenVersion(this));
} else {
VersionTracker.updateLastSeenVersion(this);
MessageNotifier.updateNotification(DatabaseUpgradeActivity.this, masterSecret);
updateNotifications(this, masterSecret);
startActivity((Intent)getIntent().getParcelableExtra("next_intent"));
finish();
}
@ -123,6 +123,16 @@ public class DatabaseUpgradeActivity extends BaseActivity {
}
}
private void updateNotifications(final Context context, final MasterSecret masterSecret) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
MessageNotifier.updateNotification(context, masterSecret);
return null;
}
}.execute();
}
public interface DatabaseUpgradeListener {
public void setProgress(int progress, int total);
}
@ -230,7 +240,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
@Override
protected void onPostExecute(Void result) {
VersionTracker.updateLastSeenVersion(DatabaseUpgradeActivity.this);
MessageNotifier.updateNotification(DatabaseUpgradeActivity.this, masterSecret);
updateNotifications(DatabaseUpgradeActivity.this, masterSecret);
startActivity((Intent)getIntent().getParcelableExtra("next_intent"));
finish();