6.6.4 - Alpha2 - API 变更: ui.(status/navigation)BarAppearanceLight[By] -> ui.(status/navigation)BarIconLight[By]
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
{
|
{
|
||||||
"$data": {
|
"$data": {
|
||||||
"v6.6.4": {
|
"v6.6.4": {
|
||||||
"released_date": "2025/05/29",
|
"released_date": "2025/05/30",
|
||||||
|
"hint": [
|
||||||
|
"API 变更: ui.(status/navigation)BarAppearanceLight[By] -> ui.(status/navigation)BarIconLight[By]"
|
||||||
|
],
|
||||||
"feature": [
|
"feature": [
|
||||||
"util.dpToPx/spToPx/pxToDp/pxToSp 方法, 用于像素单位转换"
|
"util.dpToPx/spToPx/pxToDp/pxToSp 方法, 用于像素单位转换"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ setTimeout(() => {
|
|||||||
ui.backgroundColor(themeColor);
|
ui.backgroundColor(themeColor);
|
||||||
|
|
||||||
ui.statusBarColor(themeColor);
|
ui.statusBarColor(themeColor);
|
||||||
ui.statusBarAppearanceLightBy(themeColor);
|
ui.statusBarIconLightBy(themeColor);
|
||||||
|
|
||||||
ui.navigationBarColor(themeColor);
|
ui.navigationBarColor(themeColor);
|
||||||
ui.navigationBarAppearanceLightBy(themeColor);
|
ui.navigationBarIconLightBy(themeColor);
|
||||||
|
|
||||||
/** @type {JsTextClock} */
|
/** @type {JsTextClock} */
|
||||||
let textClockView = ui['text_clock'];
|
let textClockView = ui['text_clock'];
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ class ScriptExecuteActivity : AppCompatActivity(), OnActivityResultDelegate.Dele
|
|||||||
if (windowBackground is ColorDrawable) windowBackground.color.let { backgroundColor ->
|
if (windowBackground is ColorDrawable) windowBackground.color.let { backgroundColor ->
|
||||||
val isLightColor = ViewUtils.isLuminanceDark(backgroundColor)
|
val isLightColor = ViewUtils.isLuminanceDark(backgroundColor)
|
||||||
ViewUtils.setStatusBarBackgroundColor(this, backgroundColor)
|
ViewUtils.setStatusBarBackgroundColor(this, backgroundColor)
|
||||||
ViewUtils.setStatusBarAppearanceLight(this, isLightColor)
|
ViewUtils.setStatusBarIconLight(this, isLightColor)
|
||||||
ViewUtils.setNavigationBarBackgroundColor(this, backgroundColor)
|
ViewUtils.setNavigationBarBackgroundColor(this, backgroundColor)
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
ViewUtils.setNavigationBarAppearanceLight(this, isLightColor)
|
ViewUtils.setNavigationBarIconLight(this, isLightColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,12 +114,12 @@ class UI(private val scriptRuntime: ScriptRuntime) : AugmentableProxy(scriptRunt
|
|||||||
::registerWidget.name,
|
::registerWidget.name,
|
||||||
::setContentView.name,
|
::setContentView.name,
|
||||||
::statusBarColor.name,
|
::statusBarColor.name,
|
||||||
::statusBarAppearanceLight.name,
|
::statusBarIconLight.name,
|
||||||
::statusBarAppearanceLightBy.name,
|
::statusBarIconLightBy.name,
|
||||||
::backgroundColor.name,
|
::backgroundColor.name,
|
||||||
::navigationBarColor.name,
|
::navigationBarColor.name,
|
||||||
::navigationBarAppearanceLight.name,
|
::navigationBarIconLight.name,
|
||||||
::navigationBarAppearanceLightBy.name,
|
::navigationBarIconLightBy.name,
|
||||||
::findById.name,
|
::findById.name,
|
||||||
::findByStringId.name,
|
::findByStringId.name,
|
||||||
::findView.name,
|
::findView.name,
|
||||||
@@ -539,11 +539,11 @@ class UI(private val scriptRuntime: ScriptRuntime) : AugmentableProxy(scriptRunt
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun statusBarAppearanceLight(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Undefined = ensureArgumentsAtMost(args, 1) { argList ->
|
fun statusBarIconLight(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Undefined = ensureArgumentsAtMost(args, 1) { argList ->
|
||||||
val (isLight) = argList
|
val (isLight) = argList
|
||||||
ensureActivity(scriptRuntime) { activity ->
|
ensureActivity(scriptRuntime) { activity ->
|
||||||
runRhinoRuntime(scriptRuntime, newBaseFunction("action", {
|
runRhinoRuntime(scriptRuntime, newBaseFunction("action", {
|
||||||
ViewUtils.setStatusBarAppearanceLight(activity, coerceBoolean(isLight, true))
|
ViewUtils.setStatusBarIconLight(activity, coerceBoolean(isLight, true))
|
||||||
}, NOT_CONSTRUCTABLE))
|
}, NOT_CONSTRUCTABLE))
|
||||||
}
|
}
|
||||||
UNDEFINED
|
UNDEFINED
|
||||||
@@ -551,10 +551,10 @@ class UI(private val scriptRuntime: ScriptRuntime) : AugmentableProxy(scriptRunt
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun statusBarAppearanceLightBy(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Undefined = ensureArgumentsOnlyOne(args) { refColor ->
|
fun statusBarIconLightBy(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Undefined = ensureArgumentsOnlyOne(args) { refColor ->
|
||||||
ensureActivity(scriptRuntime) { activity ->
|
ensureActivity(scriptRuntime) { activity ->
|
||||||
runRhinoRuntime(scriptRuntime, newBaseFunction("action", {
|
runRhinoRuntime(scriptRuntime, newBaseFunction("action", {
|
||||||
Colors.toIntRhino(refColor).also { ViewUtils.setStatusBarAppearanceLight(activity, ViewUtils.isLuminanceDark(it)) }
|
Colors.toIntRhino(refColor).also { ViewUtils.setStatusBarIconLight(activity, ViewUtils.isLuminanceDark(it)) }
|
||||||
}, NOT_CONSTRUCTABLE))
|
}, NOT_CONSTRUCTABLE))
|
||||||
}
|
}
|
||||||
UNDEFINED
|
UNDEFINED
|
||||||
@@ -586,14 +586,14 @@ class UI(private val scriptRuntime: ScriptRuntime) : AugmentableProxy(scriptRunt
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun navigationBarAppearanceLight(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Undefined = ensureArgumentsAtMost(args, 1) { argList ->
|
fun navigationBarIconLight(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Undefined = ensureArgumentsAtMost(args, 1) { argList ->
|
||||||
val (isLight) = argList
|
val (isLight) = argList
|
||||||
ensureActivity(scriptRuntime) { activity ->
|
ensureActivity(scriptRuntime) { activity ->
|
||||||
runRhinoRuntime(scriptRuntime, newBaseFunction("action", {
|
runRhinoRuntime(scriptRuntime, newBaseFunction("action", {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
ScriptRuntime.requiresApi(Build.VERSION_CODES.O)
|
ScriptRuntime.requiresApi(Build.VERSION_CODES.O)
|
||||||
} else {
|
} else {
|
||||||
ViewUtils.setNavigationBarAppearanceLight(activity, coerceBoolean(isLight, true))
|
ViewUtils.setNavigationBarIconLight(activity, coerceBoolean(isLight, true))
|
||||||
}
|
}
|
||||||
}, NOT_CONSTRUCTABLE))
|
}, NOT_CONSTRUCTABLE))
|
||||||
}
|
}
|
||||||
@@ -602,14 +602,14 @@ class UI(private val scriptRuntime: ScriptRuntime) : AugmentableProxy(scriptRunt
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@RhinoRuntimeFunctionInterface
|
@RhinoRuntimeFunctionInterface
|
||||||
fun navigationBarAppearanceLightBy(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Undefined = ensureArgumentsOnlyOne(args) { refColor ->
|
fun navigationBarIconLightBy(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Undefined = ensureArgumentsOnlyOne(args) { refColor ->
|
||||||
ensureActivity(scriptRuntime) { activity ->
|
ensureActivity(scriptRuntime) { activity ->
|
||||||
runRhinoRuntime(scriptRuntime, newBaseFunction("action", {
|
runRhinoRuntime(scriptRuntime, newBaseFunction("action", {
|
||||||
Colors.toIntRhino(refColor).also {
|
Colors.toIntRhino(refColor).also {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
ScriptRuntime.requiresApi(Build.VERSION_CODES.O)
|
ScriptRuntime.requiresApi(Build.VERSION_CODES.O)
|
||||||
} else {
|
} else {
|
||||||
ViewUtils.setNavigationBarAppearanceLight(activity, ViewUtils.isLuminanceDark(it))
|
ViewUtils.setNavigationBarIconLight(activity, ViewUtils.isLuminanceDark(it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, NOT_CONSTRUCTABLE))
|
}, NOT_CONSTRUCTABLE))
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ object ThemeColorManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun setStatusBarAppearanceLight(activity: Activity) {
|
fun setStatusBarIconLight(activity: Activity) {
|
||||||
ViewUtils.setStatusBarAppearanceLight(activity, isLuminanceDark())
|
ViewUtils.setStatusBarIconLight(activity, isLuminanceDark())
|
||||||
}
|
}
|
||||||
|
|
||||||
private object BackgroundColorManager {
|
private object BackgroundColorManager {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class ColorSearchHelpActivity : BaseActivity() {
|
|||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
setUpStatusBarAppearanceLightByNightMode()
|
setUpStatusBarIconLightByNightMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getContent(contentResourceId: Int) = runCatching {
|
private fun getContent(contentResourceId: Int) = runCatching {
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ abstract class ColorSelectBaseActivity : BaseActivity() {
|
|||||||
super.initThemeColors()
|
super.initThemeColors()
|
||||||
updateToolbarColors()
|
updateToolbarColors()
|
||||||
updateSearchViewColors()
|
updateSearchViewColors()
|
||||||
ViewUtils.setStatusBarAppearanceLightByColorLuminance(this, currentColor)
|
ViewUtils.setStatusBarIconLightByColorLuminance(this, currentColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ abstract class BaseActivity : AppCompatActivity() {
|
|||||||
initThemeColors()
|
initThemeColors()
|
||||||
if (handleStatusBarThemeColorAutomatically) {
|
if (handleStatusBarThemeColorAutomatically) {
|
||||||
ThemeColorManager.setStatusBarBackgroundColor(this)
|
ThemeColorManager.setStatusBarBackgroundColor(this)
|
||||||
setUpStatusBarAppearanceLightByThemeColor()
|
setUpStatusBarIconLightByThemeColor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ abstract class BaseActivity : AppCompatActivity() {
|
|||||||
initThemeColors()
|
initThemeColors()
|
||||||
if (handleStatusBarThemeColorAutomatically) {
|
if (handleStatusBarThemeColorAutomatically) {
|
||||||
ThemeColorManager.addActivityStatusBar(this)
|
ThemeColorManager.addActivityStatusBar(this)
|
||||||
setUpStatusBarAppearanceLightByThemeColor()
|
setUpStatusBarIconLightByThemeColor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,12 +92,12 @@ abstract class BaseActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
fun setToolbarAsBack(title: String?) = ViewUtils.setToolbarAsBack(this, title)
|
fun setToolbarAsBack(title: String?) = ViewUtils.setToolbarAsBack(this, title)
|
||||||
|
|
||||||
protected fun setUpStatusBarAppearanceLightByNightMode() {
|
protected fun setUpStatusBarIconLightByNightMode() {
|
||||||
ViewUtils.setStatusBarAppearanceLight(this, ViewUtils.isNightModeEnabled)
|
ViewUtils.setStatusBarIconLight(this, ViewUtils.isNightModeEnabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun setUpStatusBarAppearanceLightByThemeColor() {
|
protected fun setUpStatusBarIconLightByThemeColor() {
|
||||||
ThemeColorManager.setStatusBarAppearanceLight(this)
|
ThemeColorManager.setStatusBarIconLight(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ class DocumentationActivity : BaseActivity() {
|
|||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
setUpStatusBarAppearanceLightByNightMode()
|
setUpStatusBarIconLightByNightMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("MissingSuperCall")
|
@SuppressLint("MissingSuperCall")
|
||||||
|
|||||||
@@ -758,7 +758,7 @@ class EditorView : LinearLayout, OnHintClickListener, ClickCallback, ToolbarFrag
|
|||||||
|
|
||||||
private val TAG = EditorView::class.java.simpleName
|
private val TAG = EditorView::class.java.simpleName
|
||||||
|
|
||||||
private const val MIN_CONFIDENCE_TO_WRITE_FILE = 60
|
private const val MIN_CONFIDENCE_TO_WRITE_FILE = 90
|
||||||
private val DEFAULT_CHARSET_TO_WRITE_FILE = StandardCharsets.UTF_8
|
private val DEFAULT_CHARSET_TO_WRITE_FILE = StandardCharsets.UTF_8
|
||||||
|
|
||||||
const val EXTRA_PATH = "path"
|
const val EXTRA_PATH = "path"
|
||||||
|
|||||||
@@ -199,8 +199,8 @@ class MainActivity : BaseActivity(), DelegateHost, HostActivity {
|
|||||||
// ! zh-CN:
|
// ! zh-CN:
|
||||||
// ! 此处改为中间值 (如 `slideOffset < 0.5`) 会带来更好的通知栏亮暗色转换视觉体验,
|
// ! 此处改为中间值 (如 `slideOffset < 0.5`) 会带来更好的通知栏亮暗色转换视觉体验,
|
||||||
// ! 但会造成抽屉视图滑动时出现些微卡顿.
|
// ! 但会造成抽屉视图滑动时出现些微卡顿.
|
||||||
slideOffset < 1 -> setUpStatusBarAppearanceLightByThemeColor()
|
slideOffset < 1 -> setUpStatusBarIconLightByThemeColor()
|
||||||
else -> setUpStatusBarAppearanceLightByNightMode()
|
else -> setUpStatusBarIconLightByNightMode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,13 +258,13 @@ class MainActivity : BaseActivity(), DelegateHost, HostActivity {
|
|||||||
super.initThemeColors()
|
super.initThemeColors()
|
||||||
setUpToolbarColors()
|
setUpToolbarColors()
|
||||||
setUpTabLayoutColors()
|
setUpTabLayoutColors()
|
||||||
setUpStatusBarAppearanceLight()
|
setUpStatusBarIconLight()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||||
super.onWindowFocusChanged(hasFocus)
|
super.onWindowFocusChanged(hasFocus)
|
||||||
if (hasFocus) {
|
if (hasFocus) {
|
||||||
setUpStatusBarAppearanceLight()
|
setUpStatusBarIconLight()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,12 +294,12 @@ class MainActivity : BaseActivity(), DelegateHost, HostActivity {
|
|||||||
mTab.setSelectedTabIndicatorColor(tabSelectedIndicatorColor)
|
mTab.setSelectedTabIndicatorColor(tabSelectedIndicatorColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpStatusBarAppearanceLight() {
|
private fun setUpStatusBarIconLight() {
|
||||||
Handler(Looper.getMainLooper()).post {
|
Handler(Looper.getMainLooper()).post {
|
||||||
if (sIsActionBarDrawerOpened) {
|
if (sIsActionBarDrawerOpened) {
|
||||||
setUpStatusBarAppearanceLightByNightMode()
|
setUpStatusBarIconLightByNightMode()
|
||||||
} else {
|
} else {
|
||||||
setUpStatusBarAppearanceLightByThemeColor()
|
setUpStatusBarIconLightByThemeColor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ abstract class BaseDisplayContentActivity : BaseActivity() {
|
|||||||
internalFabView = binding.fab.apply {
|
internalFabView = binding.fab.apply {
|
||||||
if (internalMenuResource > 0) {
|
if (internalMenuResource > 0) {
|
||||||
setOnClickListener { view -> showPopupMenu(view, internalTextView) }
|
setOnClickListener { view -> showPopupMenu(view, internalTextView) }
|
||||||
ViewUtils.excludeFloatingActionButtonFromNavigationBar(this)
|
ViewUtils.excludeFloatingActionButtonFromBottomNavigationBar(this)
|
||||||
visibility = View.VISIBLE
|
visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,6 +76,7 @@ abstract class BaseDisplayContentActivity : BaseActivity() {
|
|||||||
val scaleGestureDetector = ScaleGestureDetector(this, ScaleListener(internalTextView))
|
val scaleGestureDetector = ScaleGestureDetector(this, ScaleListener(internalTextView))
|
||||||
|
|
||||||
val innerScrollView = binding.innerScrollView.also {
|
val innerScrollView = binding.innerScrollView.also {
|
||||||
|
ViewUtils.excludePaddingClippableViewFromBottomNavigationBar(it)
|
||||||
it.setOnTouchListener { view, event ->
|
it.setOnTouchListener { view, event ->
|
||||||
when (event.pointerCount) {
|
when (event.pointerCount) {
|
||||||
2 -> {
|
2 -> {
|
||||||
@@ -118,7 +119,6 @@ abstract class BaseDisplayContentActivity : BaseActivity() {
|
|||||||
else -> super.onTouchEvent(event)
|
else -> super.onTouchEvent(event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ViewUtils.excludePaddingClippableViewFromNavigationBar(it)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用协程加载内容
|
// 使用协程加载内容
|
||||||
@@ -148,12 +148,12 @@ abstract class BaseDisplayContentActivity : BaseActivity() {
|
|||||||
internalFabView.backgroundTintList = ColorStateList.valueOf(themeColorNight)
|
internalFabView.backgroundTintList = ColorStateList.valueOf(themeColorNight)
|
||||||
internalFabView.imageTintList = ColorStateList.valueOf(if (ViewUtils.isLuminanceDark(themeColorNight)) getColor(R.color.night) else getColor(R.color.day))
|
internalFabView.imageTintList = ColorStateList.valueOf(if (ViewUtils.isLuminanceDark(themeColorNight)) getColor(R.color.night) else getColor(R.color.day))
|
||||||
ViewUtils.setStatusBarBackgroundColor(this, themeColorNight)
|
ViewUtils.setStatusBarBackgroundColor(this, themeColorNight)
|
||||||
ViewUtils.setStatusBarAppearanceLight(this, ViewUtils.isLuminanceDark(themeColorNight))
|
ViewUtils.setStatusBarIconLight(this, ViewUtils.isLuminanceDark(themeColorNight))
|
||||||
} else {
|
} else {
|
||||||
internalFabView.backgroundTintList = ColorStateList.valueOf(themeColorDay)
|
internalFabView.backgroundTintList = ColorStateList.valueOf(themeColorDay)
|
||||||
internalFabView.imageTintList = ColorStateList.valueOf(if (ViewUtils.isLuminanceDark(themeColorDay)) getColor(R.color.night) else getColor(R.color.day))
|
internalFabView.imageTintList = ColorStateList.valueOf(if (ViewUtils.isLuminanceDark(themeColorDay)) getColor(R.color.night) else getColor(R.color.day))
|
||||||
ViewUtils.setStatusBarBackgroundColor(this, themeColorDay)
|
ViewUtils.setStatusBarBackgroundColor(this, themeColorDay)
|
||||||
ViewUtils.setStatusBarAppearanceLight(this, ViewUtils.isLuminanceDark(themeColorDay))
|
ViewUtils.setStatusBarIconLight(this, ViewUtils.isLuminanceDark(themeColorDay))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ object StringUtils {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun detectCharset(bytes: ByteArray): CharsetMatchWrapper {
|
fun detectCharset(bytes: ByteArray): CharsetMatchWrapper {
|
||||||
val matches = kotlin.runCatching {
|
val matches = kotlin.runCatching {
|
||||||
CharsetDetector().apply { setText(bytes) }.detectAll()
|
CharsetDetector().apply { setText(bytes).setDeclaredEncoding("UTF-8") }.detectAll()
|
||||||
}.getOrNull() ?: return CharsetMatchWrapper(null)
|
}.getOrNull() ?: return CharsetMatchWrapper(null)
|
||||||
|
|
||||||
matches.firstOrNull {
|
matches.firstOrNull {
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import android.widget.ImageView
|
|||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
@@ -215,28 +214,22 @@ object ViewUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isStatusBarAppearanceLight(activity: Activity): Boolean {
|
fun isStatusBarIconLight(activity: Activity): Boolean {
|
||||||
return !isStatusBarAppearanceDark(activity)
|
return !WindowInsetsControllerCompat(activity.window, activity.window.decorView).isAppearanceLightStatusBars
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isStatusBarAppearanceDark(activity: Activity): Boolean {
|
fun isStatusBarIconDark(activity: Activity): Boolean {
|
||||||
@Suppress("DEPRECATION")
|
return !isStatusBarIconLight(activity)
|
||||||
return hasSystemUiVisibility(activity, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setStatusBarAppearanceLight(activity: Activity, isLight: Boolean) {
|
fun setStatusBarIconLight(activity: Activity, isLight: Boolean) {
|
||||||
@Suppress("DEPRECATION")
|
WindowInsetsControllerCompat(activity.window, activity.window.decorView).isAppearanceLightStatusBars = !isLight
|
||||||
when {
|
|
||||||
isStatusBarAppearanceLight(activity) == isLight -> return
|
|
||||||
isLight -> removeSystemUiVisibility(activity, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
|
|
||||||
else -> appendSystemUiVisibility(activity, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setStatusBarAppearanceLightByColorLuminance(activity: Activity, @ColorInt aimColor: Int) {
|
fun setStatusBarIconLightByColorLuminance(activity: Activity, @ColorInt referenceBackgroundColor: Int) {
|
||||||
val shouldBeLight = isLuminanceDark(aimColor)
|
val shouldBeLight = isLuminanceDark(referenceBackgroundColor)
|
||||||
setStatusBarAppearanceLight(activity, shouldBeLight)
|
setStatusBarIconLight(activity, shouldBeLight)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@@ -276,27 +269,23 @@ object ViewUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isNavigationBarAppearanceLight(activity: Activity): Boolean {
|
fun isNavigationBarIconLight(activity: Activity): Boolean {
|
||||||
return !isNavigationBarAppearanceDark(activity)
|
return !WindowInsetsControllerCompat(activity.window, activity.window.decorView).isAppearanceLightNavigationBars
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isNavigationBarAppearanceDark(activity: Activity): Boolean {
|
fun isNavigationBarIconDark(activity: Activity): Boolean {
|
||||||
@Suppress("DEPRECATION")
|
return !isNavigationBarIconLight(activity)
|
||||||
return hasSystemUiVisibility(activity, View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
fun setNavigationBarIconLight(activity: Activity, isLight: Boolean) {
|
||||||
fun setNavigationBarAppearanceLight(activity: Activity, isLight: Boolean) {
|
WindowInsetsControllerCompat(activity.window, activity.window.decorView).isAppearanceLightNavigationBars = isLight
|
||||||
@Suppress("DEPRECATION")
|
}
|
||||||
when {
|
|
||||||
isNavigationBarAppearanceLight(activity) == isLight -> return
|
fun setNavigationBarIconLightByColorLuminance(activity: Activity, @ColorInt referenceBackgroundColor: Int) {
|
||||||
isLight -> removeSystemUiVisibility(activity, View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR)
|
val shouldBeLight = isLuminanceDark(referenceBackgroundColor)
|
||||||
else -> appendSystemUiVisibility(activity, View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR)
|
setNavigationBarIconLight(activity, shouldBeLight)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setNavigationBarBackgroundColor(activity: Activity, color: Int) {
|
fun setNavigationBarBackgroundColor(activity: Activity, color: Int) {
|
||||||
@@ -365,11 +354,10 @@ object ViewUtils {
|
|||||||
|
|
||||||
fun makeBarsAdaptToNightMode(activity: AppCompatActivity) {
|
fun makeBarsAdaptToNightMode(activity: AppCompatActivity) {
|
||||||
val isConfigDark = isNightModeYes(activity)
|
val isConfigDark = isNightModeYes(activity)
|
||||||
val isConfigTakenAsLight = !isConfigDark
|
|
||||||
|
|
||||||
getWindowInsetsController(activity).apply {
|
getWindowInsetsController(activity).apply {
|
||||||
isAppearanceLightStatusBars = isConfigTakenAsLight
|
isAppearanceLightStatusBars = isConfigDark
|
||||||
isAppearanceLightNavigationBars = isConfigTakenAsLight
|
isAppearanceLightNavigationBars = isConfigDark
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#Thu May 29 19:18:00 CST 2025
|
#Fri May 30 20:20:54 CST 2025
|
||||||
BUILD_TIME=1748517480683
|
BUILD_TIME=1748607654503
|
||||||
COMPILE_SDK_VERSION=35
|
COMPILE_SDK_VERSION=35
|
||||||
IMAGE_QUANT_CMAKE_VERSION=3.22.1
|
IMAGE_QUANT_CMAKE_VERSION=3.22.1
|
||||||
IMAGE_QUANT_NDK_VERSION=26.1.10909125
|
IMAGE_QUANT_NDK_VERSION=26.1.10909125
|
||||||
@@ -19,6 +19,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
|
|||||||
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
||||||
TARGET_SDK_VERSION=35
|
TARGET_SDK_VERSION=35
|
||||||
TARGET_SDK_VERSION_INRT=29
|
TARGET_SDK_VERSION_INRT=29
|
||||||
VERSION_BUILD=3271
|
VERSION_BUILD=3274
|
||||||
VERSION_NAME=6.6.4 Alpha
|
VERSION_NAME=6.6.4 Alpha2
|
||||||
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
||||||
|
|||||||
Reference in New Issue
Block a user