Always reload string from resource
This commit is contained in:
parent
67c3f40adb
commit
a5f5e94115
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
<import type="com.topjohnwu.magisk.R" />
|
||||
|
||||
<import type="com.topjohnwu.magisk.utils.XStringKt" />
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
|
||||
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user