MVP of PIN lock feature

This only shows the settings if a screen lock is available.
If the setting is activated, it shows a drawer item for locking.
Once locked, the screen lock secret needs to be entered to enter the
app again.

First part of #1247
This commit is contained in:
Torsten Grote
2018-07-27 12:06:21 -03:00
parent af1ed292ae
commit fc86319e13
20 changed files with 292 additions and 8 deletions

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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"
android:orientation="vertical"
tools:context=".android.login.UnlockActivity">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="@dimen/margin_large"
android:src="@drawable/splash_screen"
app:layout_constraintBottom_toTopOf="@+id/is_locked"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread"
app:tint="?attr/colorControlNormal"/>
<TextView
android:id="@+id/is_locked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_large"
android:gravity="center"
android:text="@string/lock_is_locked"
android:textSize="@dimen/text_size_xlarge"
app:layout_constraintBottom_toTopOf="@+id/unlock"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/image"
app:layout_constraintVertical_chainStyle="spread"/>
<Button
android:id="@+id/unlock"
style="@style/BriarButton.Default"
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>

View File

@@ -26,6 +26,11 @@
android:id="@+id/nav_btn_settings"
android:icon="@drawable/ic_settings_black_24dp"
android:title="@string/settings_button"/>
<item
android:id="@+id/nav_btn_lock"
android:icon="@drawable/startup_lock"
android:title="@string/lock_button"
android:visible="false"/>
<item
android:id="@+id/nav_btn_signout"
android:icon="@drawable/ic_signout"

View File

@@ -62,6 +62,7 @@
<string name="groups_button">Private Groups</string>
<string name="forums_button">Forums</string>
<string name="blogs_button">Blogs</string>
<string name="lock_button">Lock App</string>
<string name="settings_button">Settings</string>
<string name="sign_out_button">Sign Out</string>
@@ -356,6 +357,8 @@
<!-- Settings Security and Panic -->
<string name="security_settings_title">Security</string>
<string name="pref_lock_title">Screen Lock</string>
<string name="pref_lock_summary">Lock app access with Android screen lock or fingerprint</string>
<string name="change_password">Change password</string>
<string name="current_password">Current password</string>
<string name="choose_new_password">New password</string>
@@ -444,4 +447,10 @@
<string name="permission_camera_denied_toast">Camera permission was not granted</string>
<string name="qr_code">QR code</string>
<string name="show_qr_code_fullscreen">Show QR code fullscreen</string>
<!-- App Locking -->
<string name="lock_unlock">Unlock Briar</string>
<string name="lock_is_locked">Briar is locked</string>
<string name="lock_tap_to_unlock">Tap to unlock</string>
</resources>

View File

@@ -56,6 +56,13 @@
android:layout="@layout/preferences_category"
android:title="@string/security_settings_title">
<CheckBoxPreference
android:key="pref_key_lock"
android:persistent="false"
android:summary="@string/pref_lock_summary"
android:title="@string/pref_lock_title"
android:visibility="gone"/>
<Preference
android:key="pref_key_change_password"
android:title="@string/change_password">