修改刷新bug

main
chenweijie 4 months ago
parent f5762436fc
commit ae7bacc912

@ -3,6 +3,7 @@ package com.yinuo.safetywatcher.watcher.base
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.util.AttributeSet
import android.view.KeyEvent
import android.view.LayoutInflater
@ -37,6 +38,7 @@ import com.yinuo.safetywatcher.watcher.utils.VolumeUtil
import com.yinuo.safetywatcher.watcher.utils.trySetCommonBg
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Runnable
import kotlinx.coroutines.launch
@ -164,8 +166,10 @@ abstract class BaseActivity : AppCompatActivity() {
fun closeLoadingDialog() {
lifecycleScope.launchWhenResumed {
loadingDialog?.dismiss()
loadingDialog = null
Handler().postDelayed(Runnable {
loadingDialog?.dismiss()
loadingDialog = null
},1000L)
}
}

@ -39,6 +39,9 @@ class CommonTopBar : LinearLayout {
val root = LayoutInflater.from(context).inflate(R.layout.layout_topbar, this)
mBinding = LayoutTopbarBinding.bind(root)
mBinding?.fourG?.setImageLevel(0)
mBinding?.wifi?.setImageLevel(0)
// 初始化隐藏返回栏
mBinding?.backArea?.visibility = GONE
mBinding?.backArea?.setOnClickListener {
@ -47,10 +50,10 @@ class CommonTopBar : LinearLayout {
}
}
// 默认满信号
// // 默认满信号
mBinding?.battery?.setImageLevel(100)
mBinding?.wifi?.setImageLevel(100)
mBinding?.fourG?.setImageLevel(100)
// mBinding?.wifi?.setImageLevel(100)
// mBinding?.fourG?.setImageLevel(100)
post {
watchBattery()
@ -90,7 +93,7 @@ class CommonTopBar : LinearLayout {
override fun onLevel(level: Int) {
LogUtils.w("wifiCallback onLevel = $level")
mBinding?.root?.post {
mBinding?.wifi?.visibility = if (level > 0) VISIBLE else GONE
// mBinding?.wifi?.visibility = if (level > 0) VISIBLE else GONE
val showLevel = (level + 1) * 20
mBinding?.wifi?.setImageLevel(showLevel)
}

@ -97,6 +97,7 @@
android:layout_height="wrap_content"
android:textColor="@color/white"
android:text="exit"
android:visibility="gone"
android:id="@+id/tv_exit"
android:layout_marginBottom="@dimen/_20dp"
android:padding="@dimen/_20dp"

@ -82,12 +82,11 @@
android:layout_height="@dimen/_27dp"
android:layout_marginStart="@dimen/_40dp"
android:src="@drawable/wifi"
android:visibility="gone"/>
/>
<ImageView
android:id="@+id/four_g"
android:layout_width="@dimen/_33dp"
android:visibility="gone"
android:layout_height="@dimen/_33dp"
android:layout_marginStart="@dimen/_40dp"
android:src="@drawable/net"/>

Loading…
Cancel
Save