diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-01-27 10:04:27 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-01-27 10:04:27 +0100 |
commit | 7b9ced9fb752ee485b657daf6d827f311ed6e8bc (patch) | |
tree | 54d04fa44cca9bcfce6e42044a1daa983ac17084 /src/main/java/de/pixart | |
parent | 975ee957b29f5ae41bf2cbb516b76fea1e42997e (diff) |
WelcomeActivity: Add QR code scanner button
picked from https://github.com/siacs/Conversations/pull/2920
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()); } |