Fingerprint unlock UX improvements

This commit is contained in:
art1fa 2018-03-09 18:03:43 +01:00 committed by Greyson Parrelli
parent 20c896413b
commit 8441ac4091
10 changed files with 52 additions and 28 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

View File

@ -6,32 +6,21 @@
android:id="@+id/prompt_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/login_top_background"
android:orientation="vertical">
<View android:id="@+id/shim"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_centerVertical="true"
android:visibility="invisible"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?login_top_background"
android:layout_above="@id/shim">
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:theme="?attr/actionBarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_marginTop="20dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="36dp"
android:layout_height="36dp"
android:src="@drawable/icon_transparent"
android:layout_centerVertical="true"
android:layout_gravity="center"/>
</android.support.v7.widget.Toolbar>
@ -39,7 +28,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="280dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:orientation="vertical"
@ -50,11 +39,20 @@
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
android:layout_marginBottom="2dp"
android:text="@string/prompt_passphrase_activity__signal_is_locked"
android:textColor="?android:textColorPrimary"
android:gravity="center_horizontal"
android:textSize="25sp"/>
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="@string/PassphrasePromptActivity_confirm_fingerprint"
android:textColor="?android:textColorSecondary"
android:gravity="center_horizontal"
android:textSize="16sp"/>
<ImageView android:id="@+id/fingerprint_auth_container"
android:src="@drawable/ic_fingerprint_white_48dp"
android:background="@drawable/circle_tintable"
@ -63,9 +61,17 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="60dp"
android:layout_marginBottom="25dp"
tools:visibility="visible"/>
<TextView android:id="@+id/fingerprint_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/PassphrasePromptActivity_touch_sensor"
android:textColor="@color/gray27"
android:gravity="center_horizontal"
android:textSize="16sp"/>
<TextView android:id="@+id/lock_screen_auth_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -464,6 +464,10 @@
<string name="PassphrasePromptActivity_watermark_content_description">Signal icon</string>
<string name="PassphrasePromptActivity_ok_button_content_description">Submit passphrase</string>
<string name="PassphrasePromptActivity_invalid_passphrase_exclamation">Invalid passphrase!</string>
<string name="PassphrasePromptActivity_confirm_fingerprint">Confirm fingerprint to unlock</string>
<string name="PassphrasePromptActivity_touch_sensor">Touch sensor</string>
<string name="PassphrasePromptActivity_fingerprint_not_recognized_try_again">Fingerprint not recognized. Try again.</string>
<string name="PassphrasePromptActivity_fingerprint_recognized">Fingerprint recognized</string>
<!-- PlayServicesProblemFragment -->
<string name="PlayServicesProblemFragment_the_version_of_google_play_services_you_have_installed_is_not_functioning">The version of Google Play Services you have installed is not functioning correctly. Please reinstall Google Play Services and try again.</string>

View File

@ -72,6 +72,11 @@
<item name="elevation">0dp</item>
</style>
<style name="TextSecure.FlatDarkActionBar"
parent="@style/TextSecure.DarkActionBar">
<item name="elevation">0dp</item>
</style>
<style name="TextSecure.DarkActionBar.TabBar"
parent="@style/Widget.AppCompat.ActionBar.TabBar">
<item name="background">@color/gray95</item>

View File

@ -58,6 +58,7 @@
</style>
<style name="TextSecure.LightIntroTheme" parent="@style/Theme.AppCompat.Light">
<item name="actionBarStyle">@style/TextSecure.FlatLightActionBar</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>
@ -77,6 +78,7 @@
</style>
<style name="TextSecure.DarkIntroTheme" parent="@style/Theme.AppCompat">
<item name="actionBarStyle">@style/TextSecure.FlatDarkActionBar</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionModeOverlay">true</item>

View File

@ -73,6 +73,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
private View passphraseAuthContainer;
private ImageView fingerprintPrompt;
private TextView lockScreenButton;
private TextView fingerprintStatusText;
private EditText passphraseText;
private ImageButton showButton;
@ -105,6 +106,9 @@ public class PassphrasePromptActivity extends PassphraseActivity {
dynamicTheme.onResume(this);
dynamicLanguage.onResume(this);
fingerprintStatusText.setText(getResources().getString(R.string.PassphrasePromptActivity_touch_sensor));
fingerprintStatusText.setTextColor(getResources().getColor(R.color.gray27));
setLockTypeVisibility();
if (TextSecurePreferences.isScreenLockEnabled(this) && !authenticated && !failure) {
@ -214,6 +218,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
passphraseAuthContainer = findViewById(R.id.password_auth_container);
fingerprintPrompt = findViewById(R.id.fingerprint_auth_container);
lockScreenButton = findViewById(R.id.lock_screen_auth_container);
fingerprintStatusText = findViewById(R.id.fingerprint_status_text);
fingerprintManager = FingerprintManagerCompat.from(this);
fingerprintCancellationSignal = new CancellationSignal();
fingerprintListener = new FingerprintListener();
@ -340,23 +345,22 @@ public class PassphrasePromptActivity extends PassphraseActivity {
@Override
public void onAuthenticationError(int errMsgId, CharSequence errString) {
Log.w(TAG, "Authentication error: " + errMsgId + " " + errString);
onAuthenticationFailed();
}
@Override
public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) {
Log.i(TAG, "onAuthenticationSucceeded");
fingerprintPrompt.setImageResource(R.drawable.ic_check_white_48dp);
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.green_500), PorterDuff.Mode.SRC_IN);
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.teal_500), PorterDuff.Mode.SRC_IN);
fingerprintPrompt.animate().setInterpolator(new BounceInterpolator()).scaleX(1.1f).scaleY(1.1f).setDuration(500).setListener(new AnimationCompleteListener() {
@Override
public void onAnimationEnd(Animator animation) {
handleAuthenticated();
fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp);
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN);
}
}).start();
fingerprintStatusText.setText(getResources().getString(R.string.PassphrasePromptActivity_fingerprint_recognized));
fingerprintStatusText.setTextColor(getResources().getColor(R.color.teal_500));
}
@Override
@ -364,12 +368,12 @@ public class PassphrasePromptActivity extends PassphraseActivity {
Log.w(TAG, "onAuthenticatoinFailed()");
FingerprintManagerCompat.AuthenticationCallback callback = this;
fingerprintPrompt.setImageResource(R.drawable.ic_close_white_48dp);
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.red_500), PorterDuff.Mode.SRC_IN);
fingerprintPrompt.setImageResource(R.drawable.ic_priority_high_white_48dp);
fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.deep_orange_600), PorterDuff.Mode.SRC_IN);
TranslateAnimation shake = new TranslateAnimation(0, 30, 0, 0);
TranslateAnimation shake = new TranslateAnimation(0, 20, 0, 0);
shake.setDuration(50);
shake.setRepeatCount(7);
shake.setRepeatCount(5);
shake.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@ -385,6 +389,9 @@ public class PassphrasePromptActivity extends PassphraseActivity {
});
fingerprintPrompt.startAnimation(shake);
fingerprintStatusText.setText(getResources().getString(R.string.PassphrasePromptActivity_fingerprint_not_recognized_try_again));
fingerprintStatusText.setTextColor(getResources().getColor(R.color.deep_orange_600));
}
}