「Change」

1、增加白天夜间模式切换
进入白天模式
 CallerMoGoUiSettingManager.stepInDayMode()
退出白天模式
 CallerMoGoUiSettingManager.stepOutDayMode()
监听换肤模式切换,需要实现IMoGoSkinModeChangeListener接口
CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this);
移除换肤模式切换
2、增加切换白天、黑夜模式变换状态栏文字颜色

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-04-13 21:30:51 +08:00
parent 517805220e
commit bb1baa023b
22 changed files with 353 additions and 180 deletions

View File

@@ -0,0 +1,43 @@
package com.mogo.eagle.core.function.call.setting
import com.mogo.eagle.core.function.api.setting.MoGoUiSettingProvider
/**
* UI 设置管理
*
* @author mogoauto
*/
object CallerMoGoUiSettingManager : MoGoUiSettingProvider {
// 0--默认夜间模式1-白天模式2-节日模式(待开发,加载节日图片包)
private var skinMode = 0
// 是否是VR模式true-VR模式false-2D模式
var vrMode = true
override fun stepInVrMode() {
}
override fun stepOutVrMode() {
}
override fun stepInDayMode() {
skinMode = 1
CallerSkinModeListenerManager.invokeListener(skinMode)
}
override fun stepOutDayMode() {
skinMode = 0
CallerSkinModeListenerManager.invokeListener(skinMode)
}
/**
* 0--默认夜间模式1-白天模式2-节日模式(待开发,加载节日图片包)
*/
override fun getDayMode(): Int {
return skinMode
}
}

View File

@@ -0,0 +1,75 @@
package com.mogo.eagle.core.function.call.setting
import androidx.annotation.Nullable
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.call.base.CallerBase
import java.util.concurrent.ConcurrentHashMap
/**
* @author xiaoyuzhou
* @date 2021/9/30 5:48 下午
* 肤色模式 设置监听监听管理
*/
object CallerSkinModeListenerManager : CallerBase() {
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mSkinModeListeners: ConcurrentHashMap<String, IMoGoSkinModeChangeListener> =
ConcurrentHashMap()
/**
* 添加 肤色模式 监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addListener(
@Nullable tag: String,
@Nullable listener: IMoGoSkinModeChangeListener
) {
if (mSkinModeListeners.containsKey(tag)) {
return
}
mSkinModeListeners[tag] = listener
listener.onSkinModeChange(CallerMoGoUiSettingManager.getDayMode())
}
/**
* 删除 肤色模式 监听
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
if (!mSkinModeListeners.containsKey(tag)) {
return
}
mSkinModeListeners.remove(tag)
}
/**
* 删除 肤色模式 监听
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoSkinModeChangeListener) {
if (!mSkinModeListeners.containsValue(listener)) {
return
}
mSkinModeListeners.forEach {
if (it.value == listener) {
mSkinModeListeners.remove(it.key)
}
}
}
/**
* 触发 肤色模式 监听
* @param skinMode 肤色模式
*/
fun invokeListener(skinMode: Int) {
mSkinModeListeners.forEach {
val tag = it.key
val listener = it.value
listener.onSkinModeChange(skinMode)
}
}
}