mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-06 02:35:41 +08:00
增加 RealmeUI 的判断
This commit is contained in:
@@ -68,7 +68,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
}
|
||||
/** 设置文本 */
|
||||
binding.mainTextVersion.text = "模块版本:$moduleVersion"
|
||||
binding.mainTextColorOsVersion.text = "系统版本:$colorOSVersion"
|
||||
binding.mainTextColorOsVersion.text = "系统版本:$colorOSFullVersion"
|
||||
when {
|
||||
/** 判断是否为 ColorOS 系统 */
|
||||
isNotColorOS ->
|
||||
|
@@ -53,6 +53,7 @@ import com.highcapable.yukihookapi.hook.type.java.StringType
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
|
||||
/**
|
||||
* 系统深色模式是否开启
|
||||
* @return [Boolean] 是否开启
|
||||
@@ -102,6 +103,29 @@ val isColorOS by lazy { ("oppo.R").hasClass || ("com.color.os.ColorBuild").hasCl
|
||||
*/
|
||||
inline val isNotColorOS get() = !isColorOS
|
||||
|
||||
/**
|
||||
* 当前设备是否为 RealmeUI
|
||||
* @return [Boolean] 是否符合条件
|
||||
*/
|
||||
val isRealmeUI
|
||||
get() = safeOfFalse {
|
||||
val query = appContext.contentResolver.query(
|
||||
Uri.parse("content://com.oplus.customize.coreapp.configmanager.configprovider.AppFeatureProvider")
|
||||
.buildUpon()
|
||||
.appendPath("app_feature")
|
||||
.build(), null, "featurename=?", arrayOf("com.android.launcher.device_rm"), null
|
||||
)
|
||||
val isExist = query != null && query.count > 0
|
||||
query?.close()
|
||||
isExist
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 ColorOS 完整版本
|
||||
* @return [String]
|
||||
*/
|
||||
val colorOSFullVersion get() = "${if (isRealmeUI) "RealmeUI" else "ColorOS"} $colorOSVersion"
|
||||
|
||||
/**
|
||||
* 获取 ColorOS 版本
|
||||
* @return [String]
|
||||
|
Reference in New Issue
Block a user