mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 14:49:53 +01:00
Remove button from UnlockActivity
This commit is contained in:
@@ -10,7 +10,6 @@ import android.os.Bundle;
|
|||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.annotation.RequiresApi;
|
import android.support.annotation.RequiresApi;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||||
@@ -25,8 +24,6 @@ import java.util.logging.Logger;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import static android.hardware.biometrics.BiometricPrompt.BIOMETRIC_ERROR_CANCELED;
|
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.hardware.biometrics.BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED;
|
||||||
import static android.os.Build.VERSION.SDK_INT;
|
import static android.os.Build.VERSION.SDK_INT;
|
||||||
import static android.view.View.INVISIBLE;
|
import static android.view.View.INVISIBLE;
|
||||||
@@ -58,15 +55,10 @@ public class UnlockActivity extends BaseActivity {
|
|||||||
overridePendingTransition(0, 0);
|
overridePendingTransition(0, 0);
|
||||||
setContentView(R.layout.activity_unlock);
|
setContentView(R.layout.activity_unlock);
|
||||||
|
|
||||||
Button button = findViewById(R.id.unlock);
|
|
||||||
button.setOnClickListener(view -> requestUnlock());
|
|
||||||
|
|
||||||
if (!hasUsableFingerprint(this)) {
|
if (!hasUsableFingerprint(this)) {
|
||||||
getWindow().setBackgroundDrawable(null);
|
getWindow().setBackgroundDrawable(null);
|
||||||
button.setVisibility(INVISIBLE);
|
|
||||||
findViewById(R.id.image).setVisibility(INVISIBLE);
|
findViewById(R.id.image).setVisibility(INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
keyguardShown = state != null && state.getBoolean(KEYGUARD_SHOWN);
|
keyguardShown = state != null && state.getBoolean(KEYGUARD_SHOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,21 +134,19 @@ public class UnlockActivity extends BaseActivity {
|
|||||||
errorCode == BIOMETRIC_ERROR_USER_CANCELED) {
|
errorCode == BIOMETRIC_ERROR_USER_CANCELED) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
// locked out due to 5 failed attempts, lasts for 30 seconds
|
// e.g. 5 failed attempts
|
||||||
else if (errorCode == BIOMETRIC_ERROR_LOCKOUT ||
|
else {
|
||||||
errorCode == BIOMETRIC_ERROR_LOCKOUT_PERMANENT) {
|
|
||||||
if (hasKeyguardLock(UnlockActivity.this)) {
|
if (hasKeyguardLock(UnlockActivity.this)) {
|
||||||
requestKeyguardUnlock();
|
requestKeyguardUnlock();
|
||||||
} else if (errString != null) {
|
} else {
|
||||||
// normally fingerprints require a screen lock, but
|
// normally fingerprints require a screen lock, but
|
||||||
// who knows if that's true for all devices out there
|
// who knows if that's true for all devices out there
|
||||||
Toast.makeText(UnlockActivity.this, errString,
|
if (errString != null) {
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.makeText(UnlockActivity.this, errString,
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
} else if (errString != null) {
|
|
||||||
Toast.makeText(UnlockActivity.this, errString,
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,22 +14,11 @@
|
|||||||
android:layout_height="150dp"
|
android:layout_height="150dp"
|
||||||
android:layout_margin="@dimen/margin_large"
|
android:layout_margin="@dimen/margin_large"
|
||||||
android:src="@drawable/splash_screen"
|
android:src="@drawable/splash_screen"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/unlock"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
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.1"
|
app:layout_constraintVertical_bias="0.1"
|
||||||
app:tint="?attr/colorControlNormal"/>
|
app:tint="?attr/colorControlNormal"/>
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/unlock"
|
|
||||||
style="@style/BriarButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="@dimen/margin_large"
|
|
||||||
android:text="@string/lock_unlock"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"/>
|
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user