desc:体验优化

main
xiaowusky 1 year ago
parent 449ca7b28e
commit 3232f36ed0

@ -15,6 +15,7 @@ import android.widget.SeekBar
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.AppCompatRadioButton import androidx.appcompat.widget.AppCompatRadioButton
import androidx.lifecycle.lifecycleScope
import com.common.commonlib.utils.LogUtils import com.common.commonlib.utils.LogUtils
import com.loper7.date_time_picker.number_picker.NumberPicker import com.loper7.date_time_picker.number_picker.NumberPicker
import com.yinuo.safetywatcher.R import com.yinuo.safetywatcher.R
@ -85,10 +86,10 @@ abstract class BaseActivity : AppCompatActivity() {
} }
fun showLoadingDialog(resId: Int = R.string.sync_data_tip, cancelable: Boolean = true) { fun showLoadingDialog(resId: Int = R.string.sync_data_tip, cancelable: Boolean = true) {
loadingDialog?.dismiss() lifecycleScope.launchWhenResumed {
loadingDialog = CommonDialog(resId) loadingDialog?.dismiss()
loadingDialog!!.isCancelable = cancelable loadingDialog = CommonDialog(resId)
if (!this.isFinishing) { loadingDialog!!.isCancelable = cancelable
loadingDialog!!.show(supportFragmentManager, "loading") loadingDialog!!.show(supportFragmentManager, "loading")
} }
} }
@ -99,8 +100,10 @@ abstract class BaseActivity : AppCompatActivity() {
} }
fun closeLoadingDialog() { fun closeLoadingDialog() {
loadingDialog?.dismiss() lifecycleScope.launchWhenResumed {
loadingDialog = null loadingDialog?.dismiss()
loadingDialog = null
}
} }
open val isHome: Boolean = false open val isHome: Boolean = false

@ -47,19 +47,15 @@ object PlatformUtils {
CommonApplication.getContext()?.sendBroadcast(intent) CommonApplication.getContext()?.sendBroadcast(intent)
} }
fun hideStatusBar(hide: Boolean = true) { fun hideStatusBar() {
val action = val action = "android.ido.intent.action.statusbar.HIDE"
if (hide) "android.ido.intent.action.statusbar.HIDE"
else "android.ido.intent.action.statusbar.HIDE"
val intent = Intent(action) val intent = Intent(action)
intent.putExtra("save", true) //true,断电保存false断电不保存 intent.putExtra("save", true) //true,断电保存false断电不保存
CommonApplication.getContext()?.sendBroadcast(intent) CommonApplication.getContext()?.sendBroadcast(intent)
} }
fun hideNavigation(hide: Boolean = true) { fun hideNavigation() {
val action = val action ="android.ido.intent.action.navigation.HIDE"
if (hide) "android.ido.intent.action.navigation.HIDE"
else "android.ido.intent.action.navigation.SHOW"
val intent = Intent(action) val intent = Intent(action)
intent.putExtra("save", true) //true,断电保存false断电不保存 intent.putExtra("save", true) //true,断电保存false断电不保存
CommonApplication.getContext()?.sendBroadcast(intent) CommonApplication.getContext()?.sendBroadcast(intent)

@ -30,7 +30,7 @@ object StorageUtils {
val storageVolumeElement: StorageVolume = result[i] val storageVolumeElement: StorageVolume = result[i]
val userLabel = getUserLabel.invoke(storageVolumeElement) as String val userLabel = getUserLabel.invoke(storageVolumeElement) as String
val path = getPath.invoke(storageVolumeElement) as String val path = getPath.invoke(storageVolumeElement) as String
if (userLabel.contains(keyword)) { if (userLabel.contains(keyword) || userLabel.contains("U 盘")) {
targetpath = path targetpath = path
} }
} }

@ -81,11 +81,11 @@ class GlobalMonitorActivity : NoOptionsActivity() {
showInputDialog(wifiInfo, 0) showInputDialog(wifiInfo, 0)
} }
} else { } else {
showDelDialog(wifiInfo) // showDelDialog(wifiInfo)
} }
}, onItemLongClick = { info -> }, onItemLongClick = { info ->
if (null != info.configuration) { if (null != info.configuration) {
showDelDialog(info) // showDelDialog(info)
} }
}) })
mBinding.rvData.adapter = mAdapter mBinding.rvData.adapter = mAdapter
@ -133,7 +133,8 @@ class GlobalMonitorActivity : NoOptionsActivity() {
} }
override fun onWiFiConnected(SSID: String, isInit: Boolean) { override fun onWiFiConnected(SSID: String, isInit: Boolean) {
mBinding.tvStatus!!.text = isInit.toString() + " || " + SSID + "已连接" // mBinding.tvStatus!!.text = isInit.toString() + " || " + SSID + "已连接"
mBinding.tvStatus!!.text = SSID + "已连接"
refreshData(SSID, WiFiConnectType.CONNECTED) refreshData(SSID, WiFiConnectType.CONNECTED)
} }
@ -141,7 +142,8 @@ class GlobalMonitorActivity : NoOptionsActivity() {
if (TextUtils.isEmpty(SSID)) { if (TextUtils.isEmpty(SSID)) {
return return
} }
mBinding.tvStatus!!.text = SSID + "连接失败," + type.name // mBinding.tvStatus!!.text = SSID + "连接失败," + type.name
mBinding.tvStatus!!.text = SSID + "连接失败"
refreshData(SSID, WiFiConnectType.DISCONNECTED) refreshData(SSID, WiFiConnectType.DISCONNECTED)
if (type == WiFiConnectFailType.DIRECT_PASSWORD_ERROR) { if (type == WiFiConnectFailType.DIRECT_PASSWORD_ERROR) {
//直连密码错误,提示用户修改密码 //直连密码错误,提示用户修改密码

Loading…
Cancel
Save