aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-12-27 07:42:58 +0100
committerChristian Schneppe <christian@pix-art.de>2018-12-27 07:42:58 +0100
commit95d77acfa055c14cff874d77acbed00a1308d780 (patch)
tree8b28ac2874044502fc577b92ac49b825d85b54b4
parent323313b5b62b4333afe42cccaa0c89863968396b (diff)
code cleanup and rework show toast on update check
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationsActivity.java6
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java12
2 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
index 40cd5ee09..3384cbd0e 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
@@ -571,7 +571,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
return true;
case R.id.action_check_updates:
if (xmppConnectionService.hasInternetConnection()) {
- openInstallFromUnknownSourcesDialogIfNeeded();
+ openInstallFromUnknownSourcesDialogIfNeeded(true);
} else {
Toast.makeText(this, R.string.account_status_no_internet, Toast.LENGTH_LONG).show();
}
@@ -957,9 +957,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
Log.d(Config.LOGTAG, "AppUpdater: CurrentTime: " + lastUpdateTime);
if (Store == null) {
Log.d(Config.LOGTAG, "AppUpdater started");
- openInstallFromUnknownSourcesDialogIfNeeded();
- UpdateService task = new UpdateService(this, Store, xmppConnectionService);
- task.executeOnExecutor(UpdateService.THREAD_POOL_EXECUTOR, "false");
+ openInstallFromUnknownSourcesDialogIfNeeded(false);
}
} else {
Log.d(Config.LOGTAG, "AppUpdater stopped");
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index aded90a30..19319df18 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -1240,7 +1240,13 @@ public abstract class XmppActivity extends ActionBarActivity {
return installFromUnknownSource;
}
- protected void openInstallFromUnknownSourcesDialogIfNeeded() {
+ protected void openInstallFromUnknownSourcesDialogIfNeeded(boolean showToast) {
+ String ShowToast;
+ if (showToast == true) {
+ ShowToast = "true";
+ } else {
+ ShowToast = "false";
+ }
if (!installFromUnknownSourceAllowed() && xmppConnectionService.installedFrom() == null) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.install_from_unknown_sources_disabled);
@@ -1261,14 +1267,14 @@ public abstract class XmppActivity extends ActionBarActivity {
Toast.makeText(XmppActivity.this, R.string.device_does_not_support_unknown_source_op, Toast.LENGTH_SHORT).show();
} finally {
UpdateService task = new UpdateService(this, xmppConnectionService.installedFrom(), xmppConnectionService);
- task.executeOnExecutor(UpdateService.THREAD_POOL_EXECUTOR, "true");
+ task.executeOnExecutor(UpdateService.THREAD_POOL_EXECUTOR, ShowToast);
Log.d(Config.LOGTAG, "AppUpdater started");
}
});
builder.create().show();
} else {
UpdateService task = new UpdateService(this, xmppConnectionService.installedFrom(), xmppConnectionService);
- task.executeOnExecutor(UpdateService.THREAD_POOL_EXECUTOR, "true");
+ task.executeOnExecutor(UpdateService.THREAD_POOL_EXECUTOR, ShowToast);
Log.d(Config.LOGTAG, "AppUpdater started");
}
}