Minor cleanup
This commit is contained in:
parent
9cbe053e79
commit
fcde6c2b84
@ -28,24 +28,25 @@ class SecureActivityDelegate(private val activity: FragmentActivity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun onResume() {
|
fun onResume() {
|
||||||
val lockApp = preferences.useBiometricLock().get()
|
if (preferences.useBiometricLock().get()) {
|
||||||
if (lockApp && BiometricUtil.isSupported(activity)) {
|
if (BiometricUtil.isSupported(activity)) {
|
||||||
if (isAppLocked()) {
|
if (isAppLocked()) {
|
||||||
val intent = Intent(activity, BiometricUnlockActivity::class.java)
|
activity.startActivity(Intent(activity, BiometricUnlockActivity::class.java))
|
||||||
activity.startActivity(intent)
|
|
||||||
activity.overridePendingTransition(0, 0)
|
activity.overridePendingTransition(0, 0)
|
||||||
}
|
}
|
||||||
} else if (lockApp) {
|
} else {
|
||||||
preferences.useBiometricLock().set(false)
|
preferences.useBiometricLock().set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun isAppLocked(): Boolean {
|
private fun isAppLocked(): Boolean {
|
||||||
return locked &&
|
if (!locked) {
|
||||||
(
|
return false
|
||||||
preferences.lockAppAfter().get() <= 0 ||
|
}
|
||||||
|
|
||||||
|
return preferences.lockAppAfter().get() <= 0 ||
|
||||||
Date().time >= preferences.lastAppUnlock().get() + 60 * 1000 * preferences.lockAppAfter().get()
|
Date().time >= preferences.lastAppUnlock().get() + 60 * 1000 * preferences.lockAppAfter().get()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -295,7 +295,7 @@
|
|||||||
<string name="tapping_inverted_both">Both</string>
|
<string name="tapping_inverted_both">Both</string>
|
||||||
<string name="pref_reader_actions">Actions</string>
|
<string name="pref_reader_actions">Actions</string>
|
||||||
<string name="pref_read_with_long_tap">Show on long tap</string>
|
<string name="pref_read_with_long_tap">Show on long tap</string>
|
||||||
<string name="pref_create_folder_per_manga">Saves pages into separate folders</string>
|
<string name="pref_create_folder_per_manga">Save pages into separate folders</string>
|
||||||
<string name="pref_create_folder_per_manga_summary">Creates folders according to manga title</string>
|
<string name="pref_create_folder_per_manga_summary">Creates folders according to manga title</string>
|
||||||
<string name="pref_reader_theme">Background color</string>
|
<string name="pref_reader_theme">Background color</string>
|
||||||
<string name="white_background">White</string>
|
<string name="white_background">White</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user