diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-03-31 16:46:31 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-03-31 16:46:31 +0200 |
commit | a539271df66a6c519f995e693c3414516f600f66 (patch) | |
tree | a23118f83196c324e7b9cc2f83da1e9a03b2c9d2 | |
parent | ea7aa63bb951ce8680d28a131f4f7230076708ef (diff) |
some menu fixes
5 files changed, 31 insertions, 20 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 0f6994b21..b80469649 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -433,6 +433,19 @@ public class ConversationActivity extends XmppActivity implements OnConversation case R.id.action_scan_qr_code: UriHandlerActivity.scan(this); return true; + case R.id.action_check_updates: + if (xmppConnectionService.hasInternetConnection()) { + if (!installFromUnknownSourceAllowed() && !xmppConnectionService.installedFromPlayStore()) { + openInstallFromUnknownSourcesDialogIfNeeded(); + } else { + UpdateService task = new UpdateService(this, xmppConnectionService.installedFromPlayStore()); + task.executeOnExecutor(UpdateService.THREAD_POOL_EXECUTOR, "true"); + Log.d(Config.LOGTAG, "AppUpdater started"); + } + } else { + Toast.makeText(this, R.string.account_status_no_internet, Toast.LENGTH_LONG).show(); + } + break; } return super.onOptionsItemSelected(item); } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index dbf303cd5..338e899f4 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1056,12 +1056,25 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) { menuInflater.inflate(R.menu.fragment_conversation, menu); final MenuItem menuInviteContact = menu.findItem(R.id.action_invite); - final MenuItem menuUpdater = menu.findItem(R.id.action_check_updates); + final MenuItem menuNeedHelp = menu.findItem(R.id.action_create_issue); final MenuItem menuSearchHistory = menu.findItem(R.id.action_search_history); + final MenuItem menuSearchUpdates = menu.findItem(R.id.action_check_updates); if (conversation != null) { + if (conversation.getMode() == Conversation.MODE_MULTI) { + menuInviteContact.setVisible(true); + } else { + menuInviteContact.setVisible(false); + } + menuNeedHelp.setVisible(true); + menuSearchHistory.setVisible(true); + menuSearchUpdates.setVisible(false); ConversationMenuConfigurator.configureAttachmentMenu(conversation, menu); ConversationMenuConfigurator.configureEncryptionMenu(conversation, menu); + } else { + menuNeedHelp.setVisible(false); + menuSearchHistory.setVisible(false); + menuSearchUpdates.setVisible(true); } super.onCreateOptionsMenu(menu, menuInflater); } diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index a2a568b9d..c6f9a70ca 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -72,7 +72,6 @@ import de.pixart.messenger.entities.MucOptions; import de.pixart.messenger.entities.Presences; import de.pixart.messenger.services.AvatarService; import de.pixart.messenger.services.BarcodeProvider; -import de.pixart.messenger.services.UpdateService; import de.pixart.messenger.services.XmppConnectionService; import de.pixart.messenger.services.XmppConnectionService.XmppConnectionBinder; import de.pixart.messenger.ui.util.PresenceSelector; @@ -382,19 +381,6 @@ public abstract class XmppActivity extends AppCompatActivity { case R.id.action_settings: startActivity(new Intent(this, SettingsActivity.class)); break; - case R.id.action_check_updates: - if (xmppConnectionService.hasInternetConnection()) { - if (!installFromUnknownSourceAllowed() && !xmppConnectionService.installedFromPlayStore()) { - openInstallFromUnknownSourcesDialogIfNeeded(); - } else { - UpdateService task = new UpdateService(this, xmppConnectionService.installedFromPlayStore()); - task.executeOnExecutor(UpdateService.THREAD_POOL_EXECUTOR, "true"); - Log.d(Config.LOGTAG, "AppUpdater started"); - } - } else { - Toast.makeText(this, R.string.account_status_no_internet, Toast.LENGTH_LONG).show(); - } - break; case R.id.action_accounts: if (xmppConnectionService.getAccounts().size() == 1 && !xmppConnectionService.multipleAccounts()) { final Intent intent = new Intent(getApplicationContext(), EditAccountActivity.class); diff --git a/src/main/res/menu/activity_conversations.xml b/src/main/res/menu/activity_conversations.xml index 136dd8458..aa2d54919 100644 --- a/src/main/res/menu/activity_conversations.xml +++ b/src/main/res/menu/activity_conversations.xml @@ -8,6 +8,10 @@ android:visible="@bool/show_qr_code_scan" app:showAsAction="always" /> <item + android:id="@+id/action_check_updates" + app:showAsAction="never" + android:title="@string/action_check_update" /> + <item android:id="@+id/action_accounts" android:orderInCategory="90" android:title="@string/action_accounts" diff --git a/src/main/res/menu/fragment_conversation.xml b/src/main/res/menu/fragment_conversation.xml index a52b48888..0a34e4de1 100644 --- a/src/main/res/menu/fragment_conversation.xml +++ b/src/main/res/menu/fragment_conversation.xml @@ -98,11 +98,6 @@ app:showAsAction="never" android:title="@string/create_issue" /> <item - android:id="@+id/action_check_updates" - android:orderInCategory="100" - app:showAsAction="never" - android:title="@string/action_check_update" /> - <item android:id="@+id/action_search_history" android:icon="?attr/icon_search" app:showAsAction="ifRoom" |