mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Merge branch '348-add-hint-to-scan-both-qr-codes' into 'master'
Add hints that both users need to scan each other's QR codes/add each other's links See merge request briar/briar!1734
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.fragment.BaseFragment;
|
||||||
import org.briarproject.briar.android.qrcode.CameraException;
|
import org.briarproject.briar.android.qrcode.CameraException;
|
||||||
import org.briarproject.briar.android.qrcode.CameraView;
|
import org.briarproject.briar.android.qrcode.CameraView;
|
||||||
|
import org.briarproject.briar.android.view.InfoView;
|
||||||
import org.briarproject.briar.android.view.QrCodeView;
|
import org.briarproject.briar.android.view.QrCodeView;
|
||||||
import org.briarproject.nullsafety.MethodsNotNullByDefault;
|
import org.briarproject.nullsafety.MethodsNotNullByDefault;
|
||||||
import org.briarproject.nullsafety.ParametersNotNullByDefault;
|
import org.briarproject.nullsafety.ParametersNotNullByDefault;
|
||||||
@@ -57,6 +58,7 @@ public class AddNearbyContactFragment extends BaseFragment
|
|||||||
private CameraView cameraView;
|
private CameraView cameraView;
|
||||||
private LinearLayout cameraOverlay;
|
private LinearLayout cameraOverlay;
|
||||||
private View statusView;
|
private View statusView;
|
||||||
|
private InfoView infoView;
|
||||||
private QrCodeView qrCodeView;
|
private QrCodeView qrCodeView;
|
||||||
private TextView status;
|
private TextView status;
|
||||||
|
|
||||||
@@ -91,6 +93,8 @@ public class AddNearbyContactFragment extends BaseFragment
|
|||||||
cameraOverlay = view.findViewById(R.id.camera_overlay);
|
cameraOverlay = view.findViewById(R.id.camera_overlay);
|
||||||
statusView = view.findViewById(R.id.status_container);
|
statusView = view.findViewById(R.id.status_container);
|
||||||
status = view.findViewById(R.id.connect_status);
|
status = view.findViewById(R.id.connect_status);
|
||||||
|
infoView = view.findViewById(R.id.info_view);
|
||||||
|
infoView.setText(R.string.info_both_must_scan);
|
||||||
qrCodeView = view.findViewById(R.id.qr_code_view);
|
qrCodeView = view.findViewById(R.id.qr_code_view);
|
||||||
qrCodeView.setFullscreenListener(this);
|
qrCodeView.setFullscreenListener(this);
|
||||||
|
|
||||||
@@ -160,6 +164,7 @@ public class AddNearbyContactFragment extends BaseFragment
|
|||||||
} else if (state instanceof KeyAgreementWaiting) {
|
} else if (state instanceof KeyAgreementWaiting) {
|
||||||
status.setText(R.string.waiting_for_contact_to_scan);
|
status.setText(R.string.waiting_for_contact_to_scan);
|
||||||
} else if (state instanceof KeyAgreementStarted) {
|
} else if (state instanceof KeyAgreementStarted) {
|
||||||
|
infoView.setVisibility(INVISIBLE);
|
||||||
qrCodeView.setVisibility(INVISIBLE);
|
qrCodeView.setVisibility(INVISIBLE);
|
||||||
status.setText(R.string.authenticating_with_device);
|
status.setText(R.string.authenticating_with_device);
|
||||||
} else if (state instanceof ContactExchangeStarted) {
|
} else if (state instanceof ContactExchangeStarted) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.google.android.material.textfield.TextInputLayout;
|
|||||||
import org.briarproject.briar.R;
|
import org.briarproject.briar.R;
|
||||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||||
import org.briarproject.briar.android.fragment.BaseFragment;
|
import org.briarproject.briar.android.fragment.BaseFragment;
|
||||||
|
import org.briarproject.briar.android.view.InfoView;
|
||||||
import org.briarproject.nullsafety.MethodsNotNullByDefault;
|
import org.briarproject.nullsafety.MethodsNotNullByDefault;
|
||||||
import org.briarproject.nullsafety.ParametersNotNullByDefault;
|
import org.briarproject.nullsafety.ParametersNotNullByDefault;
|
||||||
|
|
||||||
@@ -122,6 +123,9 @@ public class LinkExchangeFragment extends BaseFragment {
|
|||||||
.startChooser());
|
.startChooser());
|
||||||
shareButton.setEnabled(true);
|
shareButton.setEnabled(true);
|
||||||
|
|
||||||
|
InfoView infoText = v.findViewById(R.id.infoView);
|
||||||
|
infoText.setText(R.string.info_both_must_enter_links);
|
||||||
|
|
||||||
Button continueButton = v.findViewById(R.id.addButton);
|
Button continueButton = v.findViewById(R.id.addButton);
|
||||||
continueButton.setOnClickListener(view -> onContinueButtonClicked());
|
continueButton.setOnClickListener(view -> onContinueButtonClicked());
|
||||||
continueButton.setEnabled(true);
|
continueButton.setEnabled(true);
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package org.briarproject.briar.android.view;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.briarproject.briar.R;
|
||||||
|
import org.briarproject.nullsafety.InterfaceNotNullByDefault;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.StringRes;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(@StringRes int resId) {
|
||||||
|
TextView infoText = findViewById(R.id.info_text);
|
||||||
|
infoText.setText(resId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -17,30 +18,48 @@
|
|||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/status_container"
|
android:id="@+id/status_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:padding="@dimen/margin_large"
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="@dimen/margin_medium"
|
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
|
android:id="@+id/connect_progress"
|
||||||
style="?android:attr/progressBarStyleLarge"
|
style="?android:attr/progressBarStyleLarge"
|
||||||
android:layout_width="wrap_content"
|
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
|
<TextView
|
||||||
android:id="@+id/connect_status"
|
android:id="@+id/connect_status"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/margin_large"
|
||||||
android:gravity="center"
|
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" />
|
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
|
<org.briarproject.briar.android.view.QrCodeView
|
||||||
android:id="@+id/qr_code_view"
|
android:id="@+id/qr_code_view"
|
||||||
|
|||||||
@@ -30,8 +30,7 @@
|
|||||||
app:layout_constraintBottom_toTopOf="@+id/stepOneText"
|
app:layout_constraintBottom_toTopOf="@+id/stepOneText"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
app:layout_constraintVertical_bias="0.0" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/stepOneText"
|
android:id="@+id/stepOneText"
|
||||||
@@ -64,7 +63,6 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@+id/guideline"
|
app:layout_constraintStart_toStartOf="@+id/guideline"
|
||||||
app:layout_constraintTop_toTopOf="@+id/stepOne"
|
app:layout_constraintTop_toTopOf="@+id/stepOne"
|
||||||
app:layout_constraintVertical_bias="0.0"
|
|
||||||
app:layout_constraintVertical_chainStyle="packed" />
|
app:layout_constraintVertical_chainStyle="packed" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -162,7 +160,6 @@
|
|||||||
app:drawableStartCompat="@drawable/social_share_blue"
|
app:drawableStartCompat="@drawable/social_share_blue"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/copyButton"
|
app:layout_constraintBottom_toBottomOf="@id/copyButton"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="1.0"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/copyButton"
|
app:layout_constraintStart_toEndOf="@id/copyButton"
|
||||||
app:layout_constraintTop_toTopOf="@id/copyButton" />
|
app:layout_constraintTop_toTopOf="@id/copyButton" />
|
||||||
|
|
||||||
@@ -226,8 +223,18 @@
|
|||||||
app:layout_constraintHorizontal_bias="1.0"
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/linkInputLayout"
|
app:layout_constraintTop_toBottomOf="@+id/linkInputLayout"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/infoView"
|
||||||
app:layout_constraintVertical_bias="0.0" />
|
app:layout_constraintVertical_bias="0.0" />
|
||||||
|
|
||||||
|
<org.briarproject.briar.android.view.InfoView
|
||||||
|
android:id="@+id/infoView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/pasteButton" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|||||||
22
briar-android/src/main/res/layout/info_view.xml
Normal file
22
briar-android/src/main/res/layout/info_view.xml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?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"
|
||||||
|
android:drawableTint="?attr/colorControlNormal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
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="error_start_activity">Unavailable on your system</string>
|
||||||
<string name="status_heading">Status:</string>
|
<string name="status_heading">Status:</string>
|
||||||
<string name="error">Error</string>
|
<string name="error">Error</string>
|
||||||
|
<string name="info">Information</string>
|
||||||
|
|
||||||
<!-- Contacts and Private Conversations-->
|
<!-- Contacts and Private Conversations-->
|
||||||
<string name="no_contacts">No contacts to show</string>
|
<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="authenticating_with_device">Authenticating with device\u2026</string>
|
||||||
<string name="connection_error_title">Could not connect to your contact</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="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 -->
|
<!-- Adding Contacts Remotely -->
|
||||||
|
|
||||||
@@ -316,6 +318,7 @@
|
|||||||
<string name="different_person_button">Different Person</string>
|
<string name="different_person_button">Different Person</string>
|
||||||
<string name="duplicate_link_dialog_text_3">%1$s and %2$s sent you the same link.\n\nOne of them may be trying to discover who your contacts are.\n\nDon\'t tell them you received the same link from someone else.</string>
|
<string name="duplicate_link_dialog_text_3">%1$s and %2$s sent you the same link.\n\nOne of them may be trying to discover who your contacts are.\n\nDon\'t tell them you received the same link from someone else.</string>
|
||||||
<string name="pending_contact_updated_toast">Pending contact updated</string>
|
<string name="pending_contact_updated_toast">Pending contact updated</string>
|
||||||
|
<string name="info_both_must_enter_links">You must both add each other\'s links</string>
|
||||||
|
|
||||||
<!-- Peer trust levels -->
|
<!-- Peer trust levels -->
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user