From 24c030f06f78387da1c85d6b398c4ca1e67be2c5 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Tue, 4 Sep 2018 09:32:24 -0300 Subject: [PATCH] Remove button from UnlockActivity --- .../briar/android/login/UnlockActivity.java | 24 ++++++------------- .../src/main/res/layout/activity_unlock.xml | 13 +--------- 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/briar-android/src/main/java/org/briarproject/briar/android/login/UnlockActivity.java b/briar-android/src/main/java/org/briarproject/briar/android/login/UnlockActivity.java index 4bbd3d1d0..2842ecb3e 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/login/UnlockActivity.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/login/UnlockActivity.java @@ -10,7 +10,6 @@ import android.os.Bundle; import android.os.CancellationSignal; import android.support.annotation.Nullable; import android.support.annotation.RequiresApi; -import android.widget.Button; import android.widget.Toast; import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault; @@ -25,8 +24,6 @@ import java.util.logging.Logger; import javax.inject.Inject; import static android.hardware.biometrics.BiometricPrompt.BIOMETRIC_ERROR_CANCELED; -import static android.hardware.biometrics.BiometricPrompt.BIOMETRIC_ERROR_LOCKOUT; -import static android.hardware.biometrics.BiometricPrompt.BIOMETRIC_ERROR_LOCKOUT_PERMANENT; import static android.hardware.biometrics.BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED; import static android.os.Build.VERSION.SDK_INT; import static android.view.View.INVISIBLE; @@ -58,15 +55,10 @@ public class UnlockActivity extends BaseActivity { overridePendingTransition(0, 0); setContentView(R.layout.activity_unlock); - Button button = findViewById(R.id.unlock); - button.setOnClickListener(view -> requestUnlock()); - if (!hasUsableFingerprint(this)) { getWindow().setBackgroundDrawable(null); - button.setVisibility(INVISIBLE); findViewById(R.id.image).setVisibility(INVISIBLE); } - keyguardShown = state != null && state.getBoolean(KEYGUARD_SHOWN); } @@ -142,21 +134,19 @@ public class UnlockActivity extends BaseActivity { errorCode == BIOMETRIC_ERROR_USER_CANCELED) { finish(); } - // locked out due to 5 failed attempts, lasts for 30 seconds - else if (errorCode == BIOMETRIC_ERROR_LOCKOUT || - errorCode == BIOMETRIC_ERROR_LOCKOUT_PERMANENT) { + // e.g. 5 failed attempts + else { if (hasKeyguardLock(UnlockActivity.this)) { requestKeyguardUnlock(); - } else if (errString != null) { + } else { // normally fingerprints require a screen lock, but // who knows if that's true for all devices out there - Toast.makeText(UnlockActivity.this, errString, - Toast.LENGTH_LONG).show(); + if (errString != null) { + Toast.makeText(UnlockActivity.this, errString, + Toast.LENGTH_LONG).show(); + } finish(); } - } else if (errString != null) { - Toast.makeText(UnlockActivity.this, errString, - Toast.LENGTH_LONG).show(); } } diff --git a/briar-android/src/main/res/layout/activity_unlock.xml b/briar-android/src/main/res/layout/activity_unlock.xml index 32e87ad55..83c8d594b 100644 --- a/briar-android/src/main/res/layout/activity_unlock.xml +++ b/briar-android/src/main/res/layout/activity_unlock.xml @@ -14,22 +14,11 @@ android:layout_height="150dp" android:layout_margin="@dimen/margin_large" android:src="@drawable/splash_screen" - app:layout_constraintBottom_toTopOf="@+id/unlock" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.1" app:tint="?attr/colorControlNormal"/> -