Password protection

This commit is contained in:
Koitharu
2020-10-11 16:45:29 +03:00
parent 55fc1aeadd
commit e9bce8ef15
25 changed files with 357 additions and 17 deletions

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
android:theme="@style/AppToolbarTheme">
<com.google.android.material.appbar.MaterialToolbar
android:id="@id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppPopupTheme" />
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dp"
app:boxBackgroundColor="@android:color/transparent"
app:boxBackgroundMode="filled"
app:endIconMode="password_toggle"
app:errorEnabled="true"
app:errorTextColor="@color/error">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/enter_password"
android:imeOptions="actionDone"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>

View File

@@ -21,7 +21,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:maxLines="1"
android:singleLine="true"
tools:text="@tools:sample/lorem[2]" />

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_done"
android:icon="@drawable/ic_done"
android:orderInCategory="0"
android:title="@string/done"
app:showAsAction="ifRoom|withText" />
</menu>

View File

@@ -147,4 +147,10 @@
<string name="feed_will_update_soon">Обновление скоро начнётся</string>
<string name="track_sources">Проверять обновления манги</string>
<string name="dont_check">Не проверять</string>
<string name="enter_password">Введите пароль</string>
<string name="wrong_password">Неверный пароль</string>
<string name="protect_application">Защитить приложение</string>
<string name="protect_application_summary">Запрашивать пароль при запуске приложения</string>
<string name="repeat_password">Повторите пароль</string>
<string name="passwords_mismatch">Пароли не совпадают</string>
</resources>

View File

@@ -23,6 +23,8 @@
<string name="key_notifications_vibrate">notifications_vibrate</string>
<string name="key_notifications_light">notifications_light</string>
<string name="key_reader_animation">reader_animation</string>
<string name="key_app_password">app_password</string>
<string name="key_protect_app">protect_app</string>
<string name="key_parser_domain">domain</string>
<string name="key_parser_ssl">ssl</string>

View File

@@ -148,4 +148,10 @@
<string name="feed_will_update_soon">Feed update will start soon</string>
<string name="track_sources">Check updates for manga</string>
<string name="dont_check">Don`t check</string>
<string name="enter_password">Enter password</string>
<string name="wrong_password">Wrong password</string>
<string name="protect_application">Protect application</string>
<string name="protect_application_summary">Ask for password on application start</string>
<string name="repeat_password">Repeat password</string>
<string name="passwords_mismatch">Passwords do not match</string>
</resources>

View File

@@ -48,6 +48,13 @@
android:title="@string/history_and_cache"
app:iconSpaceReserved="false" />
<SwitchPreference
android:key="@string/key_protect_app"
android:persistent="false"
android:summary="@string/protect_application_summary"
android:title="@string/protect_application"
app:iconSpaceReserved="false" />
<MultiSelectListPreference
android:defaultValue="@array/values_reader_switchers_default"
android:entries="@array/reader_switchers"
@@ -57,7 +64,7 @@
app:allowDividerAbove="true"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_reader_animation"
android:title="@string/pages_animation"