|
@@ -33,9 +33,12 @@ import com.module.pay.common.OtherEnum
|
|
|
import com.quyunshuo.sbm10.base.utils.SpUtils
|
|
|
import com.quyunshuo.sbm10.base.utils.XLogUtil
|
|
|
import com.quyunshuo.sbm10.common.constant.MMKVName
|
|
|
+import com.quyunshuo.sbm10.common.constant.MqName
|
|
|
+import com.quyunshuo.sbm10.common.constant.event.ApiMessageEvent
|
|
|
import com.quyunshuo.sbm10.common.listener.AdapterClickListener
|
|
|
import com.quyunshuo.sbm10.common.util.ToastUtil
|
|
|
import com.quyunshuo.sbm10.common.util.UiUtil
|
|
|
+import org.greenrobot.eventbus.EventBus
|
|
|
|
|
|
|
|
|
class TestAdapter(var productList: MutableList<OtherEnum>) :
|
|
@@ -258,70 +261,82 @@ class TestAdapter(var productList: MutableList<OtherEnum>) :
|
|
|
}
|
|
|
|
|
|
override fun onBind(holder: SliderVH, position: Int, item: OtherEnum?) {
|
|
|
- // 绑定 item 数据
|
|
|
- val audioManager =
|
|
|
- context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
|
|
- itemListener?.onClickListener(holder.itemView, position, null)
|
|
|
- holder.viewBinding.run {
|
|
|
- tvName.text = UiUtil.getStringRes(item!!.nameId)
|
|
|
- when (item.mmkvName) {
|
|
|
- MMKVName.VOLUME -> {
|
|
|
- XLogUtil.d(
|
|
|
- "音量:" + audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC) + ":" + audioManager.getStreamVolume(
|
|
|
- AudioManager.STREAM_MUSIC
|
|
|
- )
|
|
|
+ // 绑定 item 数据
|
|
|
+ val audioManager =
|
|
|
+ context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
|
|
+ itemListener?.onClickListener(holder.itemView, position, null)
|
|
|
+ holder.viewBinding.run {
|
|
|
+ tvName.text = UiUtil.getStringRes(item!!.nameId)
|
|
|
+ when (item.mmkvName) {
|
|
|
+ MMKVName.VOLUME -> {
|
|
|
+ XLogUtil.d(
|
|
|
+ "音量:" + audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC) + ":" + audioManager.getStreamVolume(
|
|
|
+ AudioManager.STREAM_MUSIC
|
|
|
)
|
|
|
- sbLight.max =
|
|
|
- audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
|
|
|
- sbLight.progress =
|
|
|
- audioManager.getStreamVolume(AudioManager.STREAM_MUSIC)
|
|
|
- }
|
|
|
- MMKVName.LUMINANCE -> {
|
|
|
- sbLight.max =
|
|
|
- ZtlManager.GetInstance().systemMaxBrightness //maxBrightness 为 Android 系统最大亮度
|
|
|
+ )
|
|
|
+ sbLight.max =
|
|
|
+ audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
|
|
|
+ sbLight.progress =
|
|
|
+ audioManager.getStreamVolume(AudioManager.STREAM_MUSIC)
|
|
|
+ }
|
|
|
+
|
|
|
+ MMKVName.LUMINANCE -> {
|
|
|
+ sbLight.max =
|
|
|
+ ZtlManager.GetInstance().systemMaxBrightness //maxBrightness 为 Android 系统最大亮度
|
|
|
// if (Build.MODEL.equals("rk3566_r")) {
|
|
|
// val mManager =
|
|
|
// context.getSystemService("xzjh_server") as XzjhSystemManager
|
|
|
// sbLight.progress = mManager.xzjhGetBacklight()
|
|
|
// }else{
|
|
|
- sbLight.progress =
|
|
|
- Settings.System.getInt(context.contentResolver, Settings.System.SCREEN_BRIGHTNESS)
|
|
|
+ sbLight.progress =
|
|
|
+ Settings.System.getInt(
|
|
|
+ context.contentResolver,
|
|
|
+ Settings.System.SCREEN_BRIGHTNESS
|
|
|
+ )
|
|
|
// }
|
|
|
- XLogUtil.d("亮度:" + ZtlManager.GetInstance().systemMaxBrightness + ":" + sbLight.progress)
|
|
|
- }
|
|
|
+ XLogUtil.d("亮度:" + ZtlManager.GetInstance().systemMaxBrightness + ":" + sbLight.progress)
|
|
|
}
|
|
|
- sbLight.setOnSeekBarChangeListener(object :
|
|
|
- SeekBar.OnSeekBarChangeListener {
|
|
|
- override fun onProgressChanged(
|
|
|
- seekBar: SeekBar?,
|
|
|
- progress: Int,
|
|
|
- fromUser: Boolean,
|
|
|
- ) {
|
|
|
- //设置进度
|
|
|
- setPro(seekBar, progress);
|
|
|
- }
|
|
|
- private fun setPro(seekBar: SeekBar?, progress: Int) {
|
|
|
- when (item.mmkvName) {
|
|
|
- MMKVName.VOLUME -> {
|
|
|
- //设置 Android 系统媒体音量值为 10
|
|
|
- audioManager.setStreamVolume(
|
|
|
- AudioManager.STREAM_MUSIC,
|
|
|
- progress,
|
|
|
- AudioManager.FLAG_SHOW_UI
|
|
|
- )
|
|
|
- }
|
|
|
- MMKVName.LUMINANCE -> {
|
|
|
- //设置 Android 系统亮度为 200
|
|
|
- Settings.System.putInt(context.contentResolver, Settings.System.SCREEN_BRIGHTNESS, progress);
|
|
|
- }
|
|
|
+ }
|
|
|
+ sbLight.setOnSeekBarChangeListener(object :
|
|
|
+ SeekBar.OnSeekBarChangeListener {
|
|
|
+ override fun onProgressChanged(
|
|
|
+ seekBar: SeekBar?,
|
|
|
+ progress: Int,
|
|
|
+ fromUser: Boolean,
|
|
|
+ ) {
|
|
|
+ //设置进度
|
|
|
+ setPro(seekBar, progress);
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun setPro(seekBar: SeekBar?, progress: Int) {
|
|
|
+ when (item.mmkvName) {
|
|
|
+ MMKVName.VOLUME -> {
|
|
|
+ //设置 Android 系统媒体音量值为 10
|
|
|
+ audioManager.setStreamVolume(
|
|
|
+ AudioManager.STREAM_MUSIC,
|
|
|
+ progress,
|
|
|
+ AudioManager.FLAG_SHOW_UI
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ MMKVName.LUMINANCE -> {
|
|
|
+ //设置 Android 系统亮度为 200
|
|
|
+ Settings.System.putInt(
|
|
|
+ context.contentResolver,
|
|
|
+ Settings.System.SCREEN_BRIGHTNESS,
|
|
|
+ progress
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
- override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
|
|
- }
|
|
|
- override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onStartTrackingTouch(seekBar: SeekBar?) {
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun isFullSpanItem(itemType: Int): Boolean {
|
|
@@ -453,6 +468,17 @@ class TestAdapter(var productList: MutableList<OtherEnum>) :
|
|
|
return@setOnClickListener
|
|
|
}
|
|
|
SpUtils.putString(item.mmkvName, value)
|
|
|
+ when (item.mmkvName) {
|
|
|
+ MMKVName.CONTACT, MMKVName.CONTACT_WAY -> {
|
|
|
+ EventBus.getDefault()
|
|
|
+ .post(ApiMessageEvent(MMKVName.WAY, ""))
|
|
|
+ }
|
|
|
+ MMKVName.SLEEP_TEXT->{
|
|
|
+ EventBus.getDefault()
|
|
|
+ .post(ApiMessageEvent(MMKVName.SLEEP_TEXT, ""))
|
|
|
+ }
|
|
|
+ else -> {}
|
|
|
+ }
|
|
|
ToastUtil.switchToastStyleToSuccess(UiUtil.getStringRes(R.string.modific_success) + item.mmkvName)
|
|
|
}
|
|
|
}
|