Cherish: applock: early return in setChecked if backing field has the same value

Signed-off-by: jhonboy121 <alfredmathew05@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
jhonboy121
2022-10-04 18:14:44 +05:30
committed by Hưng Phan
parent a410b4c687
commit 7e9ea36502
4 changed files with 5 additions and 2 deletions

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.cherish.settings.fragment
package com.cherish.settings.fragments
import androidx.preference.Preference
@@ -31,4 +31,4 @@ abstract class CherishDashboardFragment: DashboardFragment() {
companion object {
const val REQUEST_KEY = "CherishDashboardFragment#RequestKey"
}
}
}

View File

@@ -63,6 +63,7 @@ class AppLockBiometricPreferenceController(
override fun isChecked() = isBiometricsAllowed
override fun setChecked(checked: Boolean): Boolean {
if (isBiometricsAllowed == checked) return false
isBiometricsAllowed = checked
coroutineScope.launch(Dispatchers.Default) {
appLockManager.setBiometricsAllowed(isBiometricsAllowed)

View File

@@ -59,6 +59,7 @@ class AppLockNotificationRedactionPC(
override fun isChecked() = shouldRedactNotification
override fun setChecked(checked: Boolean): Boolean {
if (shouldRedactNotification == checked) return false
shouldRedactNotification = checked
coroutineScope.launch(Dispatchers.Default) {
appLockManager.setShouldRedactNotification(packageName, checked)

View File

@@ -60,6 +60,7 @@ class AppLockPackageProtectionPC(
override fun isChecked() = isProtected
override fun setChecked(checked: Boolean): Boolean {
if (isProtected == checked) return false
isProtected = checked
coroutineScope.launch(Dispatchers.Default) {
if (isProtected) {