mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 10:07:38 +00:00
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 ctsState = KObservableField(SafetyNetState.IDLE)
|
||||||
val basicIntegrityState = KObservableField(SafetyNetState.IDLE)
|
val basicIntegrityState = KObservableField(SafetyNetState.IDLE)
|
||||||
val safetyNetState = Observer(ctsState, basicIntegrityState) {
|
val safetyNetState = Observer(ctsState, basicIntegrityState) {
|
||||||
@ -124,7 +124,7 @@ class HomeViewModel(
|
|||||||
fun safetyNetPressed() {
|
fun safetyNetPressed() {
|
||||||
ctsState.value = SafetyNetState.LOADING
|
ctsState.value = SafetyNetState.LOADING
|
||||||
basicIntegrityState.value = SafetyNetState.LOADING
|
basicIntegrityState.value = SafetyNetState.LOADING
|
||||||
safetyNetTitle.value = R.string.checking_safetyNet_status.res()
|
safetyNetTitle.value = R.string.checking_safetyNet_status
|
||||||
|
|
||||||
UpdateSafetyNetEvent().publish()
|
UpdateSafetyNetEvent().publish()
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ class HomeViewModel(
|
|||||||
response and 0x0F == 0 -> {
|
response and 0x0F == 0 -> {
|
||||||
val hasCtsPassed = response and ISafetyNetHelper.CTS_PASS != 0
|
val hasCtsPassed = response and ISafetyNetHelper.CTS_PASS != 0
|
||||||
val hasBasicIntegrityPassed = response and ISafetyNetHelper.BASIC_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) {
|
ctsState.value = if (hasCtsPassed) {
|
||||||
SafetyNetState.PASS
|
SafetyNetState.PASS
|
||||||
} else {
|
} else {
|
||||||
@ -155,7 +155,7 @@ class HomeViewModel(
|
|||||||
safetyNetTitle.value = when (response) {
|
safetyNetTitle.value = when (response) {
|
||||||
ISafetyNetHelper.RESPONSE_ERR -> R.string.safetyNet_res_invalid
|
ISafetyNetHelper.RESPONSE_ERR -> R.string.safetyNet_res_invalid
|
||||||
else -> R.string.safetyNet_api_error
|
else -> R.string.safetyNet_api_error
|
||||||
}.res()
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
<import type="com.topjohnwu.magisk.R" />
|
<import type="com.topjohnwu.magisk.R" />
|
||||||
|
|
||||||
|
<import type="com.topjohnwu.magisk.utils.XStringKt" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="viewModel"
|
name="viewModel"
|
||||||
type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
|
type="com.topjohnwu.magisk.ui.home.HomeViewModel" />
|
||||||
@ -225,7 +227,7 @@
|
|||||||
android:layout_marginRight="@dimen/margin_generic"
|
android:layout_marginRight="@dimen/margin_generic"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:text="@{viewModel.safetyNetTitle}"
|
android:text="@{XStringKt.res(viewModel.safetyNetTitle)}"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:autoSizeMaxTextSize="14sp"
|
app:autoSizeMaxTextSize="14sp"
|
||||||
app:autoSizeTextType="uniform"
|
app:autoSizeTextType="uniform"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user