|
@@ -8,15 +8,8 @@ import android.media.AudioManager
|
|
|
import android.os.Handler
|
|
|
import android.provider.Settings
|
|
|
import android.view.LayoutInflater
|
|
|
-import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
-import android.widget.AdapterView
|
|
|
-import android.widget.AdapterView.OnItemSelectedListener
|
|
|
-import android.widget.ArrayAdapter
|
|
|
-import android.widget.ListPopupWindow
|
|
|
import android.widget.SeekBar
|
|
|
-import android.widget.Spinner
|
|
|
-import androidx.appcompat.widget.AppCompatSpinner
|
|
|
import androidx.core.content.ContextCompat.startActivity
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import com.chad.library.adapter4.BaseMultiItemAdapter
|
|
@@ -32,14 +25,15 @@ import com.module.backstage.listener.UpdateClickListener
|
|
|
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.Heartbeat.deviceId
|
|
|
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.LongClickUtils
|
|
|
import com.quyunshuo.sbm10.common.util.ToastUtil
|
|
|
import com.quyunshuo.sbm10.common.util.UiUtil
|
|
|
import org.greenrobot.eventbus.EventBus
|
|
|
-import java.lang.reflect.Field
|
|
|
|
|
|
|
|
|
class TestAdapter(var productList: MutableList<OtherEnum>) :
|
|
@@ -147,6 +141,10 @@ class TestAdapter(var productList: MutableList<OtherEnum>) :
|
|
|
//关闭热点
|
|
|
ZtlManager.GetInstance().closeAp();
|
|
|
}
|
|
|
+ if (item.mmkvName == MMKVName.SLEEP) {
|
|
|
+ EventBus.getDefault()
|
|
|
+ .post(ApiMessageEvent(MqName.SLEEP, getHashMap("0","sleep")))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
R.id.rb_open -> {
|
|
@@ -158,6 +156,10 @@ class TestAdapter(var productList: MutableList<OtherEnum>) :
|
|
|
SpUtils.getString(MMKVName.PWD_HOTSPOT, "66666666")
|
|
|
)
|
|
|
}
|
|
|
+ if (item.mmkvName == MMKVName.SLEEP) {
|
|
|
+ EventBus.getDefault()
|
|
|
+ .post(ApiMessageEvent(MqName.SLEEP, getHashMap("1","sleep")))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
else -> {}
|
|
@@ -246,7 +248,7 @@ class TestAdapter(var productList: MutableList<OtherEnum>) :
|
|
|
// mBinding.spMultiple.adapter = language2ArrayAdapter
|
|
|
mBinding.spMultiple.setItems(item.default as ArrayList<String>)
|
|
|
mBinding.spMultiple.setOnItemSelectedListener { view, position, id, item ->
|
|
|
- this@TestAdapter.type3Position = position
|
|
|
+ this@TestAdapter.type3Position = position
|
|
|
}
|
|
|
// object : OnItemSelectedListener {
|
|
|
// override fun onItemSelected(
|
|
@@ -503,10 +505,12 @@ class TestAdapter(var productList: MutableList<OtherEnum>) :
|
|
|
EventBus.getDefault()
|
|
|
.post(ApiMessageEvent(MMKVName.WAY, ""))
|
|
|
}
|
|
|
- MMKVName.SLEEP_TEXT->{
|
|
|
+
|
|
|
+ MMKVName.SLEEP_TEXT -> {
|
|
|
EventBus.getDefault()
|
|
|
.post(ApiMessageEvent(MMKVName.SLEEP_TEXT, ""))
|
|
|
}
|
|
|
+
|
|
|
else -> {}
|
|
|
}
|
|
|
ToastUtil.switchToastStyleToSuccess(UiUtil.getStringRes(R.string.modific_success) + item.mmkvName)
|
|
@@ -572,4 +576,16 @@ class TestAdapter(var productList: MutableList<OtherEnum>) :
|
|
|
fun setData(productList: MutableList<OtherEnum>) {
|
|
|
this.productList = productList
|
|
|
}
|
|
|
+
|
|
|
+ private fun getHashMap(state: Any, operation: String): HashMap<String, Any?> {
|
|
|
+ val map = hashMapOf(
|
|
|
+ "responseContent" to state,
|
|
|
+ "statusCode" to 200,
|
|
|
+ "clientId" to deviceId,
|
|
|
+ "timestamp" to System.currentTimeMillis(),
|
|
|
+ "operation" to operation,
|
|
|
+ "direction" to 2
|
|
|
+ )
|
|
|
+ return map
|
|
|
+ }
|
|
|
}
|