From a5f5e94115eae08786dd3800016cc50e5b487661 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 11 May 2019 01:50:01 -0700 Subject: [PATCH] Always reload string from resource --- .../java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt | 8 ++++---- app/src/main/res/layout/fragment_magisk.xml | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt index c56830aaf..b7e329ad5 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt @@ -63,7 +63,7 @@ class HomeViewModel( "" } - val safetyNetTitle = KObservableField(R.string.safetyNet_check_text.res()) + val safetyNetTitle = KObservableField(R.string.safetyNet_check_text) val ctsState = KObservableField(SafetyNetState.IDLE) val basicIntegrityState = KObservableField(SafetyNetState.IDLE) val safetyNetState = Observer(ctsState, basicIntegrityState) { @@ -124,7 +124,7 @@ class HomeViewModel( fun safetyNetPressed() { ctsState.value = SafetyNetState.LOADING basicIntegrityState.value = SafetyNetState.LOADING - safetyNetTitle.value = R.string.checking_safetyNet_status.res() + safetyNetTitle.value = R.string.checking_safetyNet_status UpdateSafetyNetEvent().publish() } @@ -133,7 +133,7 @@ class HomeViewModel( response and 0x0F == 0 -> { val hasCtsPassed = response and ISafetyNetHelper.CTS_PASS != 0 val hasBasicIntegrityPassed = response and ISafetyNetHelper.BASIC_PASS != 0 - safetyNetTitle.value = R.string.safetyNet_check_success.res() + safetyNetTitle.value = R.string.safetyNet_check_success ctsState.value = if (hasCtsPassed) { SafetyNetState.PASS } else { @@ -155,7 +155,7 @@ class HomeViewModel( safetyNetTitle.value = when (response) { ISafetyNetHelper.RESPONSE_ERR -> R.string.safetyNet_res_invalid else -> R.string.safetyNet_api_error - }.res() + } } } diff --git a/app/src/main/res/layout/fragment_magisk.xml b/app/src/main/res/layout/fragment_magisk.xml index f46cf786f..0dfc0e192 100644 --- a/app/src/main/res/layout/fragment_magisk.xml +++ b/app/src/main/res/layout/fragment_magisk.xml @@ -15,6 +15,8 @@ + + @@ -225,7 +227,7 @@ android:layout_marginRight="@dimen/margin_generic" android:gravity="center" android:maxLines="1" - android:text="@{viewModel.safetyNetTitle}" + android:text="@{XStringKt.res(viewModel.safetyNetTitle)}" android:textStyle="bold" app:autoSizeMaxTextSize="14sp" app:autoSizeTextType="uniform"