Implement QR code scanning

This commit is contained in:
Niels Andriesse
2019-08-23 11:46:28 +10:00
parent f3377fe384
commit 5d34314a00
6 changed files with 216 additions and 9 deletions

View File

@@ -28,6 +28,17 @@
android:layout_marginTop="24dp"
android:text="@string/activity_new_conversation_public_key_explanation" />
<Button
android:id="@+id/qrCodeButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:background="@color/transparent"
android:textColor="@color/signal_primary"
android:text="@string/activity_new_conversation_qr_code_button_title"
android:elevation="0dp"
android:stateListAnimator="@null" />
<com.dd.CircularProgressButton
android:id="@+id/nextButton"
android:layout_width="match_parent"
@@ -41,7 +52,7 @@
app:cpb_colorProgress="@color/textsecure_primary"
app:cpb_cornerRadius="4dp"
app:cpb_selectorIdle="@drawable/progress_button_state"
app:cpb_textIdle="@string/activity_new_conversation_button_title" />
app:cpb_textIdle="@string/activity_new_conversation_next_button_title" />
</LinearLayout>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<org.thoughtcrime.securesms.components.camera.CameraView
android:id="@+id/cameraView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:camera="0" />
<LinearLayout
android:id="@+id/overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="2" >
<org.thoughtcrime.securesms.components.ShapeScrim
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="32dp"
android:gravity="center"
android:background="@color/loki_darkest_gray"
android:text="@string/fragment_scan_qr_code_explanation"
android:textColor="?android:textColorPrimary" />
</LinearLayout>
</FrameLayout>

View File

@@ -1588,7 +1588,8 @@
<string name="activity_new_conversation_title">New Conversation</string>
<string name="activity_new_conversation_public_key_edit_text_label">Public Key</string>
<string name="activity_new_conversation_public_key_explanation">Enter the public key of the person you\'d like to securely message. They can share their public key with you by going into Loki Messenger\'s in-app settings and clicking \"Share Public Key\".</string>
<string name="activity_new_conversation_button_title">Next</string>
<string name="activity_new_conversation_qr_code_button_title">Scan a QR Code Instead</string>
<string name="activity_new_conversation_next_button_title">Next</string>
<string name="activity_new_conversation_invalid_public_key_message">Invalid Public Key</string>
<!-- Friend request view -->
<string name="view_friend_request_accept_button_title">Accept</string>
@@ -1606,5 +1607,10 @@
<!-- QR code fragment -->
<string name="fragment_qr_code_title">Your QR Code</string>
<string name="fragment_qr_code_explanation">This is your personal QR code. Other people can scan it to start a secure conversation with you.</string>
<string name="fragment_qr_code_camera_permission_dialog_message">Loki Messenger needs camera access to scan QR codes.</string>
<string name="fragment_qr_code_camera_permission_denied_message">Loki Messenger can\'t scan QR codes without camera access.</string>
<!-- Scan QR code fragment -->
<string name="fragment_scan_qr_code_title">Scan QR Code</string>
<string name="fragment_scan_qr_code_explanation">Scan the QR code of the person you\'d like to securely message. They can find their QR code by going into Loki Messenger\'s in-app settings and clicking \"Show QR Code\".</string>
</resources>