mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Add a hint that both parties need to scan each other's QR codes.
This commit is contained in:
@@ -20,6 +20,7 @@ import org.briarproject.briar.android.contact.add.nearby.AddContactState.QrCodeS
|
||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||
import org.briarproject.briar.android.qrcode.CameraException;
|
||||
import org.briarproject.briar.android.qrcode.CameraView;
|
||||
import org.briarproject.briar.android.view.InfoView;
|
||||
import org.briarproject.briar.android.view.QrCodeView;
|
||||
import org.briarproject.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.nullsafety.ParametersNotNullByDefault;
|
||||
@@ -57,6 +58,7 @@ public class AddNearbyContactFragment extends BaseFragment
|
||||
private CameraView cameraView;
|
||||
private LinearLayout cameraOverlay;
|
||||
private View statusView;
|
||||
private InfoView infoView;
|
||||
private QrCodeView qrCodeView;
|
||||
private TextView status;
|
||||
|
||||
@@ -91,6 +93,9 @@ public class AddNearbyContactFragment extends BaseFragment
|
||||
cameraOverlay = view.findViewById(R.id.camera_overlay);
|
||||
statusView = view.findViewById(R.id.status_container);
|
||||
status = view.findViewById(R.id.connect_status);
|
||||
infoView = view.findViewById(R.id.info_view);
|
||||
TextView info = view.findViewById(R.id.info_text);
|
||||
info.setText(R.string.info_both_must_scan);
|
||||
qrCodeView = view.findViewById(R.id.qr_code_view);
|
||||
qrCodeView.setFullscreenListener(this);
|
||||
|
||||
@@ -160,6 +165,7 @@ public class AddNearbyContactFragment extends BaseFragment
|
||||
} else if (state instanceof KeyAgreementWaiting) {
|
||||
status.setText(R.string.waiting_for_contact_to_scan);
|
||||
} else if (state instanceof KeyAgreementStarted) {
|
||||
infoView.setVisibility(INVISIBLE);
|
||||
qrCodeView.setVisibility(INVISIBLE);
|
||||
status.setText(R.string.authenticating_with_device);
|
||||
} else if (state instanceof ContactExchangeStarted) {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.briarproject.briar.android.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.nullsafety.InterfaceNotNullByDefault;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.cardview.widget.CardView;
|
||||
|
||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||
|
||||
@InterfaceNotNullByDefault
|
||||
public class InfoView extends CardView {
|
||||
|
||||
public InfoView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public InfoView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public InfoView(Context context, @Nullable AttributeSet attrs,
|
||||
int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
LayoutInflater inflater = (LayoutInflater)
|
||||
context.getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.info_view, this, true);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -17,30 +18,48 @@
|
||||
android:baselineAligned="false"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/status_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/margin_medium"
|
||||
android:padding="@dimen/margin_large"
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/connect_progress"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@+id/connect_status"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/connect_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_large"
|
||||
android:gravity="center"
|
||||
android:paddingTop="@dimen/margin_large"
|
||||
app:layout_constraintBottom_toTopOf="@+id/info_view"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/connect_progress"
|
||||
tools:text="@string/waiting_for_contact_to_scan" />
|
||||
</LinearLayout>
|
||||
|
||||
<org.briarproject.briar.android.view.InfoView
|
||||
android:id="@+id/info_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_large"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<org.briarproject.briar.android.view.QrCodeView
|
||||
android:id="@+id/qr_code_view"
|
||||
|
||||
20
briar-android/src/main/res/layout/info_view.xml
Normal file
20
briar-android/src/main/res/layout/info_view.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:parentTag="androidx.cardview.widget.CardView">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_medium"
|
||||
android:contentDescription="@string/info"
|
||||
android:drawablePadding="@dimen/margin_medium"
|
||||
app:drawableLeftCompat="@drawable/ic_info_dark"
|
||||
app:drawableStartCompat="@drawable/ic_info_dark"
|
||||
tools:text="Did you know that if you took all the veins out of your body and laid them out end to end, you would die?" />
|
||||
|
||||
</merge>
|
||||
@@ -167,6 +167,7 @@
|
||||
<string name="error_start_activity">Unavailable on your system</string>
|
||||
<string name="status_heading">Status:</string>
|
||||
<string name="error">Error</string>
|
||||
<string name="info">Information</string>
|
||||
|
||||
<!-- Contacts and Private Conversations-->
|
||||
<string name="no_contacts">No contacts to show</string>
|
||||
@@ -257,6 +258,7 @@
|
||||
<string name="authenticating_with_device">Authenticating with device\u2026</string>
|
||||
<string name="connection_error_title">Could not connect to your contact</string>
|
||||
<string name="connection_error_feedback">If this problem persists, please <a href="feedback">send feedback</a> to help us improve the app.</string>
|
||||
<string name="info_both_must_scan">You must both scan each other\'s QR codes</string>
|
||||
|
||||
<!-- Adding Contacts Remotely -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user