diff options
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/WelcomeActivity.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java index 0ce07dda4..2ea4fc278 100644 --- a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java +++ b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java @@ -16,6 +16,8 @@ import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; @@ -40,6 +42,7 @@ import de.pixart.messenger.entities.Account; import de.pixart.messenger.persistance.DatabaseBackend; import de.pixart.messenger.persistance.FileBackend; import de.pixart.messenger.utils.EncryptDecryptFile; +import de.pixart.messenger.utils.MenuDoubleTabUtil; import de.pixart.messenger.utils.XmppUri; import static de.pixart.messenger.utils.PermissionUtils.allGranted; @@ -124,6 +127,27 @@ public class WelcomeActivity extends XmppActivity { } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.welcome, menu); + MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code); + qrCodeScanMenuItem.setVisible(isCameraFeatureAvailable()); + return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (MenuDoubleTabUtil.shouldIgnoreTap()) { + return false; + } + if (item.getItemId() == R.id.action_scan_qr_code) { + UriHandlerActivity.scan(this); + return true; + + } + return super.onOptionsItemSelected(item); + } + public void addInviteUri(Intent intent) { StartConversationActivity.addInviteUri(intent, getIntent()); } |