mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-07 03:05:44 +08:00
更换系统版本识别方案
This commit is contained in:
@@ -60,7 +60,7 @@ class MainActivity : BaseActivity() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
/** 设置文本 */
|
/** 设置文本 */
|
||||||
findViewById<TextView>(R.id.main_text_version).text = "当前版本:$moduleVersion"
|
findViewById<TextView>(R.id.main_text_version).text = "模块版本:$moduleVersion"
|
||||||
findViewById<TextView>(R.id.main_text_coloros_version).text = "系统版本:$colorOSVersion"
|
findViewById<TextView>(R.id.main_text_coloros_version).text = "系统版本:$colorOSVersion"
|
||||||
when {
|
when {
|
||||||
/** 判断是否为 ColorOS 系统 */
|
/** 判断是否为 ColorOS 系统 */
|
||||||
|
@@ -107,12 +107,12 @@ inline val isNotColorOS get() = !isColorOS
|
|||||||
*/
|
*/
|
||||||
val colorOSVersion
|
val colorOSVersion
|
||||||
get() = safeOf(default = "无法获取") {
|
get() = safeOf(default = "无法获取") {
|
||||||
classOf(name = "com.oplus.os.OplusBuild").let {
|
(classOf(name = "com.oplus.os.OplusBuild").let {
|
||||||
it.field { name = "VERSIONS" }.ignoredError().of<Array<String>>()
|
it.field { name = "VERSIONS" }.ignoredError().of<Array<String>>()
|
||||||
?.get((it.method { name = "getOplusOSVERSION" }.ignoredError().get().invoke<Int>() ?: 23) - 1)
|
?.get((it.method { name = "getOplusOSVERSION" }.ignoredError().get().invoke<Int>() ?: 23) - 1)
|
||||||
} ?: findPropString(key = "ro.system.build.fingerprint", default = "无法获取")
|
} ?: findPropString(key = "ro.system.build.fingerprint", default = "无法获取")
|
||||||
.split("ssi:")[1]
|
.split("ssi:")[1]
|
||||||
.split("/")[0].trim()
|
.split("/")[0].trim()) + " ${Build.DISPLAY}"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -86,7 +86,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:text="当前版本:%1"
|
android:text="模块版本:%1"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="13sp" />
|
android:textSize="13sp" />
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:text="ColorOS 版本:%1"
|
android:text="系统版本:%1"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="13sp" />
|
android:textSize="13sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Reference in New Issue
Block a user