mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-30 05:20:18 +02:00
fix(core): material resources hook
This commit is contained in:
parent
f9f7042c1e
commit
d239655f04
@ -326,13 +326,8 @@ class SnapEnhance {
|
|||||||
|
|
||||||
Resources::class.java.getMethod("getString", Int::class.javaPrimitiveType).hook(HookStage.BEFORE) { param ->
|
Resources::class.java.getMethod("getString", Int::class.javaPrimitiveType).hook(HookStage.BEFORE) { param ->
|
||||||
val key = param.arg<Int>(0)
|
val key = param.arg<Int>(0)
|
||||||
val name = stringResources[key] ?: return@hook
|
val name = stringResources[key]?.replaceFirst("m3c_", "") ?: return@hook
|
||||||
// FIXME: prevent blank string in translations
|
param.setResult(appContext.translation.getOrNull("material3_strings.${name}") ?: "")
|
||||||
if (name == "date_range_input_title") {
|
|
||||||
param.setResult("")
|
|
||||||
return@hook
|
|
||||||
}
|
|
||||||
param.setResult(appContext.translation.getOrNull("material3_strings.$name") ?: return@hook)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user