add the password protection toggle button
This commit is contained in:
parent
be72e3fa0d
commit
d9056ed057
4 changed files with 34 additions and 0 deletions
|
@ -36,6 +36,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
setupScrollHorizontally()
|
setupScrollHorizontally()
|
||||||
setupScreenRotation()
|
setupScreenRotation()
|
||||||
setupReplaceShare()
|
setupReplaceShare()
|
||||||
|
setupPasswordProtection()
|
||||||
setupShowMedia()
|
setupShowMedia()
|
||||||
setupHideSystemUI()
|
setupHideSystemUI()
|
||||||
updateTextColors(settings_holder)
|
updateTextColors(settings_holder)
|
||||||
|
@ -139,6 +140,14 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupPasswordProtection() {
|
||||||
|
settings_password_protection.isChecked = config.passwordProtection
|
||||||
|
settings_password_protection_holder.setOnClickListener {
|
||||||
|
settings_password_protection.toggle()
|
||||||
|
config.passwordProtection = settings_password_protection.isChecked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupScreenRotation() {
|
private fun setupScreenRotation() {
|
||||||
settings_screen_rotation.text = getScreenRotationText()
|
settings_screen_rotation.text = getScreenRotationText()
|
||||||
settings_screen_rotation_holder.setOnClickListener {
|
settings_screen_rotation_holder.setOnClickListener {
|
||||||
|
|
|
@ -232,4 +232,8 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
var replaceShare: Boolean
|
var replaceShare: Boolean
|
||||||
get() = prefs.getBoolean(REPLACE_SHARE_WITH_ROTATE, false)
|
get() = prefs.getBoolean(REPLACE_SHARE_WITH_ROTATE, false)
|
||||||
set(replaceShare) = prefs.edit().putBoolean(REPLACE_SHARE_WITH_ROTATE, replaceShare).apply()
|
set(replaceShare) = prefs.edit().putBoolean(REPLACE_SHARE_WITH_ROTATE, replaceShare).apply()
|
||||||
|
|
||||||
|
var passwordProtection: Boolean
|
||||||
|
get() = prefs.getBoolean(PASSWORD_PROTECTION, false)
|
||||||
|
set(passwordProtection) = prefs.edit().putBoolean(PASSWORD_PROTECTION, passwordProtection).apply()
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ val ALBUM_COVERS = "album_covers"
|
||||||
val SCROLL_HORIZONTALLY = "scroll_horizontally"
|
val SCROLL_HORIZONTALLY = "scroll_horizontally"
|
||||||
val HIDE_SYSTEM_UI = "hide_system_ui"
|
val HIDE_SYSTEM_UI = "hide_system_ui"
|
||||||
val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate"
|
val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate"
|
||||||
|
val PASSWORD_PROTECTION = "password_protection"
|
||||||
|
|
||||||
val NOMEDIA = ".nomedia"
|
val NOMEDIA = ".nomedia"
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,26 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_password_protection_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||||
|
android:id="@+id/settings_password_protection"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
|
android:paddingStart="@dimen/medium_margin"
|
||||||
|
android:text="@string/password_protect_hidden_folders"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/settings_screen_rotation_holder"
|
android:id="@+id/settings_screen_rotation_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue