mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-05 18:25:23 +08:00
修复 MIUI 版本显示问题
This commit is contained in:
@@ -49,14 +49,6 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
/** 模块版本 */
|
||||
private const val moduleVersion = BuildConfig.VERSION_NAME
|
||||
|
||||
/** MIUI 版本 */
|
||||
private val miuiVersion by lazy {
|
||||
if (isMIUI)
|
||||
findPropString(key = "ro.miui.ui.version.code", default = "无法获取") +
|
||||
" " + findPropString(key = "ro.system.build.version.incremental")
|
||||
else "不是 MIUI 系统"
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@@ -90,6 +90,27 @@ val isMIUI by lazy {
|
||||
*/
|
||||
inline val isNotMIUI get() = !isMIUI
|
||||
|
||||
/**
|
||||
* 获取 MIUI 版本
|
||||
* @return [String]
|
||||
*/
|
||||
val miuiVersion
|
||||
get() =
|
||||
if (isMIUI)
|
||||
findPropString(key = "ro.miui.ui.version.name", default = "V无法获取").let {
|
||||
when (it) {
|
||||
"V110" -> "11"
|
||||
"V11" -> "11"
|
||||
"V120" -> "12"
|
||||
"V12" -> "12"
|
||||
"V125" -> "12.5"
|
||||
"V130" -> "13"
|
||||
"V13" -> "13"
|
||||
else -> it.replace(oldValue = "V", newValue = "")
|
||||
}
|
||||
} + " " + findPropString(key = "ro.system.build.version.incremental")
|
||||
else "不是 MIUI 系统"
|
||||
|
||||
/**
|
||||
* 得到安装包信息
|
||||
* @return [PackageInfo]
|
||||
|
Reference in New Issue
Block a user