1.宠物默认头像统一调整为一个爪子图标
2.In wifi zone时, 修改GPS 状态为 ”Off“
This commit is contained in:
@@ -36,6 +36,7 @@ import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.GetResultCallback
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.baidu.platform.comapi.util.NetworkUtil
|
||||
import com.hjq.toast.Toaster
|
||||
import com.qmuiteam.qmui.alpha.QMUIAlphaButton
|
||||
import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
|
||||
@@ -65,9 +66,6 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
//Activity是否在前台显示运行
|
||||
var isFrontRunning = false
|
||||
|
||||
//是否需要通知上个页面更新数据
|
||||
var isNotifyUpdate = false
|
||||
|
||||
//右边图标按钮
|
||||
var mRightImageButton: QMUIAlphaImageButton? = null
|
||||
|
||||
@@ -413,10 +411,7 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
}
|
||||
|
||||
fun isShowLoading(): Boolean {
|
||||
if (null != mLoadingDialog && mLoadingDialog!!.isShowing) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return null != mLoadingDialog && mLoadingDialog!!.isShowing
|
||||
}
|
||||
|
||||
fun showLoading(show: Boolean, tipsRes: Int, cancelable: Boolean = true) {
|
||||
@@ -575,7 +570,13 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
|
||||
val data = it.getOrNull()
|
||||
if (null == data) {
|
||||
if (isShowRequestErrorTip) showToast(errorTip)
|
||||
if (isShowRequestErrorTip) {
|
||||
if (NetworkUtil.isNetworkAvailable(mContext)) {
|
||||
showToast(errorTip)
|
||||
} else {
|
||||
showToast(R.string.txt_no_internet)
|
||||
}
|
||||
}
|
||||
if (mNetworkRequestsFailRetryCount < mNetworkRequestsFailMaxCount) {
|
||||
mNetworkRequestsFailRetryCount++
|
||||
getResultCallback.onRequestError(exceptionCode)
|
||||
|
||||
@@ -536,15 +536,16 @@ class HomeTrackFragment :
|
||||
}
|
||||
mTrackStateList[1].let {
|
||||
it.colorRedId = R.color.orange_color3
|
||||
it.menuValue =
|
||||
if (isTimeoutReport || gpsSignal == ConstantInt.NoSignal || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || inWifiZone == ConstantInt.Type1) {
|
||||
getString(R.string.txt_weak_signal)
|
||||
} else if (gpsSignal > ConstantInt.WeakSignal) {
|
||||
it.colorRedId = R.color.blue_color1
|
||||
getString(R.string.txt_strong_signal)
|
||||
} else {
|
||||
getString(R.string.txt_weak_signal)
|
||||
}
|
||||
it.menuValue = if (inWifiZone == ConstantInt.Type1) {
|
||||
getString(R.string.tracker_manage_set_led_off)
|
||||
} else if (isTimeoutReport || gpsSignal == ConstantInt.NoSignal || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2) {
|
||||
getString(R.string.txt_weak_signal)
|
||||
} else if (gpsSignal > ConstantInt.WeakSignal) {
|
||||
it.colorRedId = R.color.blue_color1
|
||||
getString(R.string.txt_strong_signal)
|
||||
} else {
|
||||
getString(R.string.txt_weak_signal)
|
||||
}
|
||||
}
|
||||
mTrackStateList[2].let {
|
||||
it.menuValue =
|
||||
|
||||
@@ -33,8 +33,8 @@ object GoogleBitmapHelper {
|
||||
context: Context, @DrawableRes id: Int, headUrl: String, petType: Int
|
||||
): Bitmap? {
|
||||
var headUrlBitmap = if (TextUtils.isEmpty(headUrl)) {
|
||||
var headResId = R.drawable.icon_dog_default_head_svg
|
||||
if (petType == ConstantInt.CatPetType) headResId = R.drawable.icon_cat_default_head_svg
|
||||
var headResId = R.drawable.icon_pet_default_head_svg
|
||||
if (petType == ConstantInt.CatPetType) headResId = R.drawable.icon_pet_default_head_svg
|
||||
ImageUtil.getBitmapFromDrawableAndSvg(context, headResId)
|
||||
} else {
|
||||
ImageUtil.getImageBitmapByUrl(context, headUrl)
|
||||
@@ -115,8 +115,9 @@ object GoogleBitmapHelper {
|
||||
typeface: Typeface = Typeface.DEFAULT
|
||||
): Bitmap {
|
||||
val bgBitmap = BitmapFactory.decodeResource(context.resources, id)
|
||||
val newmap = Bitmap.createBitmap(bgBitmap.width, bgBitmap.height, Bitmap.Config.ARGB_8888)
|
||||
val canvas = Canvas(newmap)
|
||||
val newBitmap =
|
||||
Bitmap.createBitmap(bgBitmap.width, bgBitmap.height, Bitmap.Config.ARGB_8888)
|
||||
val canvas = Canvas(newBitmap)
|
||||
canvas.drawBitmap(bgBitmap, 0f, 0f, null)
|
||||
val paint = Paint()
|
||||
paint.color = ContextCompat.getColor(context, R.color.txt_black_color)
|
||||
@@ -133,7 +134,7 @@ object GoogleBitmapHelper {
|
||||
canvas.drawText(text, x, y, paint)
|
||||
canvas.save()
|
||||
canvas.restore()
|
||||
return newmap
|
||||
return newBitmap
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -120,17 +120,20 @@ class HistoryDataGoogleMapFragment : BaseGoogleMapFragment() {
|
||||
}
|
||||
mPetBean = petBean
|
||||
// lifecycleScope.launch {
|
||||
//
|
||||
// }
|
||||
mPetBean?.apply {
|
||||
var bitmap = GoogleBitmapHelper.headToBitmap(
|
||||
mContext!!, R.drawable.pic_map_gps_avatar, imgurl, petType
|
||||
)
|
||||
if (null == bitmap) bitmap = BitmapFactory.decodeResource(
|
||||
mContext!!.resources, R.drawable.icon_location_svg
|
||||
)
|
||||
mPetIconDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap!!)
|
||||
mMarker?.setIcon(mPetIconDescriptor)
|
||||
try {
|
||||
mPetBean?.apply {
|
||||
var bitmap = GoogleBitmapHelper.headToBitmap(
|
||||
mContext!!, R.drawable.pic_map_gps_avatar, imgurl, petType
|
||||
)
|
||||
if (null == bitmap) bitmap = BitmapFactory.decodeResource(
|
||||
mContext!!.resources, R.drawable.icon_location_svg
|
||||
)
|
||||
mPetIconDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap!!)
|
||||
mMarker?.setIcon(mPetIconDescriptor)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
LogUtil.e("setPetBean 异常了$e")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,23 +69,25 @@ class PetV2Fragment : BaseFragment<FragmentPetV2Binding>(FragmentPetV2Binding::i
|
||||
}
|
||||
}
|
||||
|
||||
vp2SwitchPetTrack.let {
|
||||
it.adapter = ViewPagerAdapter(mFragments, requireActivity())
|
||||
ViewUtil.instance.setViewPager2Config(
|
||||
it, object : ViewPager2.OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
super.onPageSelected(position)
|
||||
when (position) {
|
||||
0 -> rgSwitchPetTrack.check(rbPetSwitch.id)
|
||||
1 -> rgSwitchPetTrack.check(rbTrackSwitch.id)
|
||||
getHomeV2Activity()?.let { ac ->
|
||||
vp2SwitchPetTrack.let {
|
||||
it.adapter = ViewPagerAdapter(mFragments, ac)
|
||||
ViewUtil.instance.setViewPager2Config(
|
||||
it, object : ViewPager2.OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
super.onPageSelected(position)
|
||||
when (position) {
|
||||
0 -> rgSwitchPetTrack.check(rbPetSwitch.id)
|
||||
1 -> rgSwitchPetTrack.check(rbTrackSwitch.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
setOnClickListenerViews(
|
||||
ilHomePetTopBar.homeDataPetNameSmall,
|
||||
ilHomePetTopBar.homeDataPetHeadSmall.root,
|
||||
ilHomePetTopBar.ivTopPetBtnSmall
|
||||
)
|
||||
})
|
||||
setOnClickListenerViews(
|
||||
ilHomePetTopBar.homeDataPetNameSmall,
|
||||
ilHomePetTopBar.homeDataPetHeadSmall.root,
|
||||
ilHomePetTopBar.ivTopPetBtnSmall
|
||||
)
|
||||
}
|
||||
}
|
||||
if (AppUtils.isDebug()) {
|
||||
ilHomePetTopBar.homeDataPetHeadSmall.appHeadImage.setOnLongClickListener {
|
||||
@@ -149,7 +151,7 @@ class PetV2Fragment : BaseFragment<FragmentPetV2Binding>(FragmentPetV2Binding::i
|
||||
}
|
||||
|
||||
private fun getMessageCount() {
|
||||
requireActivity().lifecycleScope.launch(Dispatchers.IO) {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
MyDatabase.messageDao().findAll(MyDatabase.MessageTableName)?.apply {
|
||||
var noReadNum = size
|
||||
LogUtil.e("消息数量:${size}")
|
||||
@@ -158,8 +160,10 @@ class PetV2Fragment : BaseFragment<FragmentPetV2Binding>(FragmentPetV2Binding::i
|
||||
}
|
||||
getHomeV2Activity()?.runOnUiThread {
|
||||
mViewBinding.homePetMessageCountText.let {
|
||||
if (noReadNum > 0) it.visibility = View.VISIBLE
|
||||
else it.visibility = View.GONE
|
||||
if (noReadNum > 0) {
|
||||
if (noReadNum > 99) noReadNum = 99
|
||||
it.visibility = View.VISIBLE
|
||||
} else it.visibility = View.GONE
|
||||
it.text = "$noReadNum"
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ object ImageUtil {
|
||||
//默认大小50dp
|
||||
.size(QMUIDisplayHelper.dpToPx(50)).allowHardware(false).build()
|
||||
val drawable = imageLoader.execute(request).drawable ?: return getBitmapFromDrawableAndSvg(
|
||||
context, R.drawable.icon_dog_default_head_svg
|
||||
context, R.drawable.icon_pet_default_head_svg
|
||||
) ?: BitmapFactory.decodeResource(
|
||||
context.resources, R.drawable.pic_avatar_df
|
||||
)
|
||||
|
||||
@@ -975,7 +975,7 @@ class ViewUtil private constructor() {
|
||||
) {
|
||||
if (petList.size == 0) {
|
||||
petName.text = context.getString(R.string.no_pet)
|
||||
petHead.load(R.drawable.icon_dog_default_head_svg)
|
||||
petHead.load(R.drawable.icon_pet_default_head_svg)
|
||||
return
|
||||
}
|
||||
val pet = petList[selectPos]
|
||||
@@ -1050,8 +1050,8 @@ class ViewUtil private constructor() {
|
||||
*/
|
||||
fun setPetTypeHead(imageView: ImageView, imageUrl: String, type: Int) {
|
||||
if (TextUtils.isEmpty(imageUrl)) {
|
||||
val defaultHead = if (type == 2) R.drawable.icon_cat_default_head_svg
|
||||
else R.drawable.icon_dog_default_head_svg
|
||||
val defaultHead = if (type == 2) R.drawable.icon_pet_default_head_svg
|
||||
else R.drawable.icon_pet_default_head_svg
|
||||
imageView.load(defaultHead)
|
||||
} else {
|
||||
imageLoadUrl(imageView, imageUrl)
|
||||
|
||||
@@ -312,15 +312,17 @@ class MapViewModel : ViewModel() {
|
||||
}
|
||||
deviceStateList[1].apply {
|
||||
menuType = ConstantInt.Open
|
||||
val gpsValue =
|
||||
if (isTimeoutReport || it.gpsSignal == ConstantInt.NoSignal || it.powerSwitch == ConstantInt.Type0 || it.powerSwitch == ConstantInt.Type2 || it.inWifiZone == ConstantInt.Type1) {
|
||||
menuType = ConstantInt.Close
|
||||
context.getString(R.string.txt_weak_signal)
|
||||
} else if (it.gpsSignal > ConstantInt.WeakSignal) {
|
||||
context.getString(R.string.txt_strong_signal)
|
||||
} else {
|
||||
context.getString(R.string.txt_weak_signal)
|
||||
}
|
||||
val gpsValue = if (it.inWifiZone == ConstantInt.Type1) {
|
||||
menuType = ConstantInt.Close
|
||||
context.getString(R.string.tracker_manage_set_led_off)
|
||||
} else if (isTimeoutReport || it.gpsSignal == ConstantInt.NoSignal || it.powerSwitch == ConstantInt.Type0 || it.powerSwitch == ConstantInt.Type2) {
|
||||
menuType = ConstantInt.Close
|
||||
context.getString(R.string.txt_weak_signal)
|
||||
} else if (it.gpsSignal > ConstantInt.WeakSignal) {
|
||||
context.getString(R.string.txt_strong_signal)
|
||||
} else {
|
||||
context.getString(R.string.txt_weak_signal)
|
||||
}
|
||||
value = context.getString(R.string.tracker_manage_set_gps) + ":$gpsValue"
|
||||
}
|
||||
deviceStateList[2].apply {
|
||||
|
||||
Reference in New Issue
Block a user