优化头像和map宠物显示速度
This commit is contained in:
@@ -28,9 +28,9 @@ android {
|
|||||||
applicationId "com.abbidot.tracker"
|
applicationId "com.abbidot.tracker"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 35
|
targetSdkVersion 35
|
||||||
versionCode 2205
|
versionCode 2206
|
||||||
// versionName "2.2.5"
|
// versionName "2.2.6"
|
||||||
versionName "2.2.5-Beta1"
|
versionName "2.2.6-Beta1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ class MyApplication : Application() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
lateinit var instance: Application
|
lateinit var instance: Application
|
||||||
|
|
||||||
|
//保存地图宠物头像对象在内存中,提高显示速度
|
||||||
|
val mapPetHeadHashMap = hashMapOf<String, Any>()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ class AssignOptionsAdapter(
|
|||||||
} else {
|
} else {
|
||||||
circleImageView.visibility = View.VISIBLE
|
circleImageView.visibility = View.VISIBLE
|
||||||
wrapImageView.visibility = View.GONE
|
wrapImageView.visibility = View.GONE
|
||||||
ViewUtil.instance.setPetTypeHead(circleImageView, item.value, item.menuType)
|
ViewUtil.instance.setPetTypeHead(
|
||||||
|
mContext, circleImageView, item.value, item.menuType
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class ChangePetListDialogAdapter(ctx: Context, list: MutableList<PetBean>?) :
|
|||||||
holder.setText(R.id.dialog_my_pet_name, item.petName)
|
holder.setText(R.id.dialog_my_pet_name, item.petName)
|
||||||
|
|
||||||
holder.getImageView(R.id.dialog_my_pet_head).apply {
|
holder.getImageView(R.id.dialog_my_pet_head).apply {
|
||||||
ViewUtil.instance.setPetTypeHead(this, item.imgurl, item.petType)
|
ViewUtil.instance.setPetTypeHead(mContext,this, item.imgurl, item.petType)
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
if (null != mOnChangeClickListener) {
|
if (null != mOnChangeClickListener) {
|
||||||
mOnChangeClickListener!!.onCurrentClick()
|
mOnChangeClickListener!!.onCurrentClick()
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class MyTrackerV2Adapter(
|
|||||||
petName.visibility = View.VISIBLE
|
petName.visibility = View.VISIBLE
|
||||||
item.pet?.let {
|
item.pet?.let {
|
||||||
petName.text = it.petName
|
petName.text = it.petName
|
||||||
ViewUtil.instance.setPetTypeHead(petHead, it.imgurl, it.petType)
|
ViewUtil.instance.setPetTypeHead(mContext, petHead, it.imgurl, it.petType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class HomeMapNavigationActivity :
|
|||||||
// val mGoogleApiClient = mGoogleSignInClient.asGoogleApiClient()
|
// val mGoogleApiClient = mGoogleSignInClient.asGoogleApiClient()
|
||||||
|
|
||||||
|
|
||||||
ViewUtil.instance.imageLoadUrl(
|
ViewUtil.instance.imageLoadUrl(mContext,
|
||||||
mViewBinding.homeMapNavigationPetHead.appHeadImage, pet!!.imgurl
|
mViewBinding.homeMapNavigationPetHead.appHeadImage, pet!!.imgurl
|
||||||
)
|
)
|
||||||
if (TextUtils.isEmpty(historyDataBean!!.address)) {
|
if (TextUtils.isEmpty(historyDataBean!!.address)) {
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class MapLiveActivity : BaseActivity<ActivityMapLiveBinding>(ActivityMapLiveBind
|
|||||||
|
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
mapLivePetLayout.mapPetName.text = historyDataBean.petName
|
mapLivePetLayout.mapPetName.text = historyDataBean.petName
|
||||||
ViewUtil.instance.imageLoadUrl(
|
ViewUtil.instance.imageLoadUrl(mContext,
|
||||||
mapLivePetLayout.mapPetHead.appHeadImage, historyDataBean.petImgurl
|
mapLivePetLayout.mapPetHead.appHeadImage, historyDataBean.petImgurl
|
||||||
)
|
)
|
||||||
val batteryString =
|
val batteryString =
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class RechargeDeviceDetailCNActivity : BaseActivity<ActivityRechargeDeviceDetail
|
|||||||
} else {
|
} else {
|
||||||
itemCardPetHead.appHeadImage.let {
|
itemCardPetHead.appHeadImage.let {
|
||||||
it.visibility = View.VISIBLE
|
it.visibility = View.VISIBLE
|
||||||
ViewUtil.instance.imageLoadUrl(it, rechargeDeviceBean.pet!!.imgurl)
|
ViewUtil.instance.imageLoadUrl(mContext,it, rechargeDeviceBean.pet!!.imgurl)
|
||||||
}
|
}
|
||||||
itemCardPetName.let {
|
itemCardPetName.let {
|
||||||
it.visibility = View.VISIBLE
|
it.visibility = View.VISIBLE
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class RechargeOrderDetailCNActivity : BaseActivity<ActivityRechargeOrderDetailCn
|
|||||||
it.itemCardPetHead.appHeadImage.visibility = View.VISIBLE
|
it.itemCardPetHead.appHeadImage.visibility = View.VISIBLE
|
||||||
it.itemCardPetName.visibility = View.VISIBLE
|
it.itemCardPetName.visibility = View.VISIBLE
|
||||||
it.itemCardPetName.text = pet!!.petName
|
it.itemCardPetName.text = pet!!.petName
|
||||||
ViewUtil.instance.imageLoadUrl(it.itemCardPetHead.appHeadImage, pet!!.imgurl)
|
ViewUtil.instance.imageLoadUrl(mContext,it.itemCardPetHead.appHeadImage, pet!!.imgurl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class DebugActivity : BaseActivity<ActivityDebugBinding>(ActivityDebugBinding::i
|
|||||||
private fun setPetData() {
|
private fun setPetData() {
|
||||||
val pet = mPetList!![mPetSelectPosition]
|
val pet = mPetList!![mPetSelectPosition]
|
||||||
mViewBinding.debugPetName.text = pet.petName
|
mViewBinding.debugPetName.text = pet.petName
|
||||||
ViewUtil.instance.setPetTypeHead(
|
ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
mViewBinding.debugPetHead.appHeadImage, pet.imgurl, pet.petType
|
mViewBinding.debugPetHead.appHeadImage, pet.imgurl, pet.petType
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class UserProfileActivity :
|
|||||||
)
|
)
|
||||||
|
|
||||||
// mUploadImageUrl = MMKVUtil.getString(MMKVKey.HeadUrl)
|
// mUploadImageUrl = MMKVUtil.getString(MMKVKey.HeadUrl)
|
||||||
ViewUtil.instance.imageLoadUrl(
|
ViewUtil.instance.imageLoadUrl(mContext,
|
||||||
ilUserProfileHeadLayout.ilPetProfileHead.appHeadImage, "", R.drawable.pic_avatar_df
|
ilUserProfileHeadLayout.ilPetProfileHead.appHeadImage, "", R.drawable.pic_avatar_df
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ class UserProfileActivity :
|
|||||||
mViewBinding.ilUserProfileNameLayout.etInputContent.setText(info.userName)
|
mViewBinding.ilUserProfileNameLayout.etInputContent.setText(info.userName)
|
||||||
mViewBinding.ilUserProfileEmailLayout.etInputContent.setText(info.email)
|
mViewBinding.ilUserProfileEmailLayout.etInputContent.setText(info.email)
|
||||||
mUploadImageUrl = info.imgurl
|
mUploadImageUrl = info.imgurl
|
||||||
ViewUtil.instance.imageLoadUrl(
|
ViewUtil.instance.imageLoadUrl(mContext,
|
||||||
mViewBinding.ilUserProfileHeadLayout.ilPetProfileHead.appHeadImage,
|
mViewBinding.ilUserProfileHeadLayout.ilPetProfileHead.appHeadImage,
|
||||||
mUploadImageUrl,
|
mUploadImageUrl,
|
||||||
R.drawable.pic_avatar_df
|
R.drawable.pic_avatar_df
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class DataBoardActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
mPetBean?.apply {
|
mPetBean?.apply {
|
||||||
ViewUtil.instance.setPetTypeHead(
|
ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
mViewBinding.ivDataBoardPetHead.appHeadImage, imgurl, petType
|
mViewBinding.ivDataBoardPetHead.appHeadImage, imgurl, petType
|
||||||
)
|
)
|
||||||
mDataDetailViewModel.getPetActivityDetailInfo(this@DataBoardActivity, petId, deviceId)
|
mDataDetailViewModel.getPetActivityDetailInfo(this@DataBoardActivity, petId, deviceId)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class MoreActivityActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
mPetBean?.let {
|
mPetBean?.let {
|
||||||
ViewUtil.instance.setPetTypeHead(
|
ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
ilMoreActivityPetHead.appHeadImage, it.imgurl, it.petType
|
ilMoreActivityPetHead.appHeadImage, it.imgurl, it.petType
|
||||||
)
|
)
|
||||||
tvMoreActivityPetName.text = it.petName
|
tvMoreActivityPetName.text = it.petName
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class MoreSleepActivity :
|
|||||||
// mRightImageButton = addRightImageButton(R.drawable.selector_share_icon_pressed2)
|
// mRightImageButton = addRightImageButton(R.drawable.selector_share_icon_pressed2)
|
||||||
|
|
||||||
mPetBean?.let {
|
mPetBean?.let {
|
||||||
ViewUtil.instance.setPetTypeHead(
|
ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
ilMoreSleepPetHead.appHeadImage, it.imgurl, it.petType
|
ilMoreSleepPetHead.appHeadImage, it.imgurl, it.petType
|
||||||
)
|
)
|
||||||
tvMoreSleepPetName.text = it.petName
|
tvMoreSleepPetName.text = it.petName
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import coil.load
|
|||||||
import com.abbidot.baselibrary.constant.ResultCode
|
import com.abbidot.baselibrary.constant.ResultCode
|
||||||
import com.abbidot.baselibrary.util.LogUtil
|
import com.abbidot.baselibrary.util.LogUtil
|
||||||
import com.abbidot.baselibrary.util.Utils
|
import com.abbidot.baselibrary.util.Utils
|
||||||
import com.abbidot.tracker.BuildConfig
|
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.base.BaseActivity
|
import com.abbidot.tracker.base.BaseActivity
|
||||||
import com.abbidot.tracker.bean.ActiveTimeBean
|
import com.abbidot.tracker.bean.ActiveTimeBean
|
||||||
@@ -52,7 +51,7 @@ class SharePetActivityActivity :
|
|||||||
|
|
||||||
intent.extras?.apply {
|
intent.extras?.apply {
|
||||||
Util.getParcelableAdaptive(intent, ConstantString.Pet, PetBean::class.java)?.let {
|
Util.getParcelableAdaptive(intent, ConstantString.Pet, PetBean::class.java)?.let {
|
||||||
ViewUtil.instance.setPetTypeHead(
|
ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
ilSharePetActivityPetHead.appHeadImage, it.imgurl, it.petType
|
ilSharePetActivityPetHead.appHeadImage, it.imgurl, it.petType
|
||||||
)
|
)
|
||||||
tvSharePetActivityPetName.text = it.petName
|
tvSharePetActivityPetName.text = it.petName
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class AddWifiPowerZone1Activity :
|
|||||||
|
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
mPetBean?.let {
|
mPetBean?.let {
|
||||||
ViewUtil.instance.setPetTypeHead(
|
ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
ivAddWifiZone1PetHead.appHeadImage, it.imgurl, it.petType
|
ivAddWifiZone1PetHead.appHeadImage, it.imgurl, it.petType
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -928,7 +928,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
it.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
|
it.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
|
||||||
}
|
}
|
||||||
mViewBinding.llLiveV2MapTopPet.homeDataPetHeadSmall.appHeadImage.let {
|
mViewBinding.llLiveV2MapTopPet.homeDataPetHeadSmall.appHeadImage.let {
|
||||||
ViewUtil.instance.setPetTypeHead(it, imgurl, petType)
|
ViewUtil.instance.setPetTypeHead(mContext,it, imgurl, petType)
|
||||||
ViewUtil.instance.viewAlphaAndRotationObjectAnimator(it)
|
ViewUtil.instance.viewAlphaAndRotationObjectAnimator(it)
|
||||||
}
|
}
|
||||||
//重新设置地图宠物头像
|
//重新设置地图宠物头像
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class FamilyMembersActivity :
|
|||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
|
|
||||||
mPetBean?.let {
|
mPetBean?.let {
|
||||||
ViewUtil.instance.setPetTypeHead(
|
ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
ilFamilyMembersPetHead.appHeadImage, it.imgurl, it.petType
|
ilFamilyMembersPetHead.appHeadImage, it.imgurl, it.petType
|
||||||
)
|
)
|
||||||
mFamilyViewModel.getFamilies(this@FamilyMembersActivity, it.deviceId)
|
mFamilyViewModel.getFamilies(this@FamilyMembersActivity, it.deviceId)
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class PetProfileActivity :
|
|||||||
root.setBackgroundResource(R.color.white)
|
root.setBackgroundResource(R.color.white)
|
||||||
ilPetProfileNameLayout.etInputContent.doAfterTextChanged {
|
ilPetProfileNameLayout.etInputContent.doAfterTextChanged {
|
||||||
it?.let { s ->
|
it?.let { s ->
|
||||||
val text = s.toString().limitLetterChinese(16)
|
val text = s.toString().limitLetterChinese(14)
|
||||||
if (text != s.toString()) {
|
if (text != s.toString()) {
|
||||||
s.replace(0, s.length, text)
|
s.replace(0, s.length, text)
|
||||||
}
|
}
|
||||||
@@ -266,7 +266,7 @@ class PetProfileActivity :
|
|||||||
private fun setPetData() {
|
private fun setPetData() {
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
mPetBean?.let {
|
mPetBean?.let {
|
||||||
ViewUtil.instance.setPetTypeHead(
|
ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
ilPetProfileHeadLayout.ilPetProfileHead.appHeadImage, it.imgurl, it.petType
|
ilPetProfileHeadLayout.ilPetProfileHead.appHeadImage, it.imgurl, it.petType
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ class PetProfileActivity :
|
|||||||
val dataBean = typeList[pos]
|
val dataBean = typeList[pos]
|
||||||
mPetBean?.apply {
|
mPetBean?.apply {
|
||||||
petType = dataBean.menuType
|
petType = dataBean.menuType
|
||||||
if (TextUtils.isEmpty(mSelectPetHeadPath) && TextUtils.isEmpty(imgurl)) ViewUtil.instance.setPetTypeHead(
|
if (TextUtils.isEmpty(mSelectPetHeadPath) && TextUtils.isEmpty(imgurl)) ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
mViewBinding.ilPetProfileHeadLayout.ilPetProfileHead.appHeadImage,
|
mViewBinding.ilPetProfileHeadLayout.ilPetProfileHead.appHeadImage,
|
||||||
imgurl,
|
imgurl,
|
||||||
petType
|
petType
|
||||||
|
|||||||
@@ -69,12 +69,12 @@ class FirstPetProfileActivity :
|
|||||||
|
|
||||||
mProfileCommon = PetProfileCommon(mContext, rvFirstPetProfileLabel, mPetBean)
|
mProfileCommon = PetProfileCommon(mContext, rvFirstPetProfileLabel, mPetBean)
|
||||||
|
|
||||||
ViewUtil.instance.setPetTypeHead(
|
ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
ilFirstPetProfileHeadLayout.ilPetProfileHead.appHeadImage, "", 1
|
ilFirstPetProfileHeadLayout.ilPetProfileHead.appHeadImage, "", 1
|
||||||
)
|
)
|
||||||
mPetBean?.apply {
|
mPetBean?.apply {
|
||||||
tvFirstPetProfilePetName.text = petName
|
tvFirstPetProfilePetName.text = petName
|
||||||
ViewUtil.instance.setPetTypeHead(
|
ViewUtil.instance.setPetTypeHead(mContext,
|
||||||
ilFirstPetProfileHeadLayout.ilPetProfileHead.appHeadImage, imgurl, petType
|
ilFirstPetProfileHeadLayout.ilPetProfileHead.appHeadImage, imgurl, petType
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class AccountV2Fragment :
|
|||||||
it.homeDataPetNameSmall.text =
|
it.homeDataPetNameSmall.text =
|
||||||
MMKVUtil.getString(MMKVKey.UserName, getString(R.string.app_name))
|
MMKVUtil.getString(MMKVKey.UserName, getString(R.string.app_name))
|
||||||
val imageUrl = MMKVUtil.getString(MMKVKey.HeadUrl)
|
val imageUrl = MMKVUtil.getString(MMKVKey.HeadUrl)
|
||||||
ViewUtil.instance.imageLoadUrl(
|
ViewUtil.instance.imageLoadUrl(mContext!!,
|
||||||
it.homeDataPetHeadSmall.appHeadImage, imageUrl, R.drawable.pic_avatar_df
|
it.homeDataPetHeadSmall.appHeadImage, imageUrl, R.drawable.pic_avatar_df
|
||||||
)
|
)
|
||||||
it.homeDataPetNameSmall.setCompoundDrawablesWithIntrinsicBounds(
|
it.homeDataPetNameSmall.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
@@ -187,7 +187,7 @@ class AccountV2Fragment :
|
|||||||
MMKVUtil.putString(MMKVKey.CountryCode, info.countryCode)
|
MMKVUtil.putString(MMKVKey.CountryCode, info.countryCode)
|
||||||
mViewBinding.llHomeAccountTopUser.let { view ->
|
mViewBinding.llHomeAccountTopUser.let { view ->
|
||||||
view.homeDataPetNameSmall.text = info.userName
|
view.homeDataPetNameSmall.text = info.userName
|
||||||
ViewUtil.instance.imageLoadUrl(
|
ViewUtil.instance.imageLoadUrl(mContext!!,
|
||||||
view.homeDataPetHeadSmall.appHeadImage,
|
view.homeDataPetHeadSmall.appHeadImage,
|
||||||
info.imgurl,
|
info.imgurl,
|
||||||
R.drawable.pic_avatar_df
|
R.drawable.pic_avatar_df
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.hardware.SensorEvent
|
|||||||
import android.hardware.SensorEventListener
|
import android.hardware.SensorEventListener
|
||||||
import android.hardware.SensorManager
|
import android.hardware.SensorManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.TextUtils
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -14,6 +15,7 @@ import androidx.core.content.ContextCompat
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.abbidot.baselibrary.util.AppUtils
|
import com.abbidot.baselibrary.util.AppUtils
|
||||||
import com.abbidot.baselibrary.util.LogUtil
|
import com.abbidot.baselibrary.util.LogUtil
|
||||||
|
import com.abbidot.tracker.MyApplication
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.base.BaseFragment
|
import com.abbidot.tracker.base.BaseFragment
|
||||||
import com.abbidot.tracker.bean.FencesBean
|
import com.abbidot.tracker.bean.FencesBean
|
||||||
@@ -29,6 +31,7 @@ import com.baidu.location.BDLocation
|
|||||||
import com.baidu.location.LocationClient
|
import com.baidu.location.LocationClient
|
||||||
import com.baidu.location.LocationClientOption
|
import com.baidu.location.LocationClientOption
|
||||||
import com.baidu.mapapi.map.BaiduMap
|
import com.baidu.mapapi.map.BaiduMap
|
||||||
|
import com.baidu.mapapi.map.BitmapDescriptor
|
||||||
import com.baidu.mapapi.map.BitmapDescriptorFactory
|
import com.baidu.mapapi.map.BitmapDescriptorFactory
|
||||||
import com.baidu.mapapi.map.Circle
|
import com.baidu.mapapi.map.Circle
|
||||||
import com.baidu.mapapi.map.CircleDottedStrokeType
|
import com.baidu.mapapi.map.CircleDottedStrokeType
|
||||||
@@ -243,21 +246,28 @@ abstract class BaseBaiduMapFragment :
|
|||||||
needConvertGCJ02: Boolean = true,
|
needConvertGCJ02: Boolean = true,
|
||||||
headBgResId: Int = R.drawable.pic_map_gps_avatar
|
headBgResId: Int = R.drawable.pic_map_gps_avatar
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
val mapKey = if (TextUtils.isEmpty(mPetHeadUrl)) "pet_default_head"
|
||||||
|
else mPetHeadUrl.substring(mPetHeadUrl.lastIndexOf("/") + 1, mPetHeadUrl.length)
|
||||||
|
var bitmapDescriptor = MyApplication.mapPetHeadHashMap[mapKey]
|
||||||
|
if (null == bitmapDescriptor || bitmapDescriptor !is BitmapDescriptor) {
|
||||||
if (null == mPetHeadIconBitmap) {
|
if (null == mPetHeadIconBitmap) {
|
||||||
//设置头像
|
//设置头像
|
||||||
mPetHeadIconBitmap =
|
mPetHeadIconBitmap =
|
||||||
GoogleBitmapHelper.headToBitmap(mContext!!, headBgResId, mPetHeadUrl, mPetType)
|
GoogleBitmapHelper.headToBitmap(mContext!!, headBgResId, mPetHeadUrl, mPetType)
|
||||||
}
|
}
|
||||||
|
bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(mPetHeadIconBitmap!!)
|
||||||
|
//保存在内存中,提高显示速度
|
||||||
|
MyApplication.mapPetHeadHashMap[mapKey] = bitmapDescriptor
|
||||||
|
}
|
||||||
|
|
||||||
mMarker?.remove()
|
mMarker?.remove()
|
||||||
|
|
||||||
val latLng = getBaiduMapLatLng(lat, lon, needConvertGCJ02)
|
val latLng = getBaiduMapLatLng(lat, lon, needConvertGCJ02)
|
||||||
|
|
||||||
mPetLatLng = latLng
|
mPetLatLng = latLng
|
||||||
|
|
||||||
//构建MarkerOption,用于在地图上添加Marker
|
//构建MarkerOption,用于在地图上添加Marker
|
||||||
val option =
|
val option =
|
||||||
MarkerOptions().position(latLng).animateType(MarkerOptions.MarkerAnimateType.grow)
|
MarkerOptions().position(latLng).animateType(MarkerOptions.MarkerAnimateType.grow)
|
||||||
.icon(BitmapDescriptorFactory.fromBitmap(mPetHeadIconBitmap))
|
.icon(bitmapDescriptor as BitmapDescriptor)
|
||||||
//在地图上添加Marker,并显示
|
//在地图上添加Marker,并显示
|
||||||
mMarker = mBaiduMap!!.addOverlay(option)
|
mMarker = mBaiduMap!!.addOverlay(option)
|
||||||
}
|
}
|
||||||
@@ -341,7 +351,10 @@ abstract class BaseBaiduMapFragment :
|
|||||||
* @param needConvertGCJ02 是否需要转换GCJ02坐标
|
* @param needConvertGCJ02 是否需要转换GCJ02坐标
|
||||||
*/
|
*/
|
||||||
fun moveCameraLocation(
|
fun moveCameraLocation(
|
||||||
lat: Double, lon: Double, needConvertGCJ02: Boolean = true, isAnimMoveCamera: Boolean = false
|
lat: Double,
|
||||||
|
lon: Double,
|
||||||
|
needConvertGCJ02: Boolean = true,
|
||||||
|
isAnimMoveCamera: Boolean = false
|
||||||
) {
|
) {
|
||||||
val latLng = getBaiduMapLatLng(lat, lon, needConvertGCJ02)
|
val latLng = getBaiduMapLatLng(lat, lon, needConvertGCJ02)
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.graphics.Bitmap
|
|||||||
import android.graphics.Point
|
import android.graphics.Point
|
||||||
import android.location.Location
|
import android.location.Location
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.TextUtils
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -18,6 +19,7 @@ import com.abbidot.baselibrary.constant.MMKVKey
|
|||||||
import com.abbidot.baselibrary.util.AppUtils
|
import com.abbidot.baselibrary.util.AppUtils
|
||||||
import com.abbidot.baselibrary.util.LogUtil
|
import com.abbidot.baselibrary.util.LogUtil
|
||||||
import com.abbidot.baselibrary.util.MMKVUtil
|
import com.abbidot.baselibrary.util.MMKVUtil
|
||||||
|
import com.abbidot.tracker.MyApplication
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.base.BaseFragment
|
import com.abbidot.tracker.base.BaseFragment
|
||||||
import com.abbidot.tracker.bean.FencesBean
|
import com.abbidot.tracker.bean.FencesBean
|
||||||
@@ -40,6 +42,7 @@ import com.google.android.gms.maps.GoogleMap
|
|||||||
import com.google.android.gms.maps.GoogleMapOptions
|
import com.google.android.gms.maps.GoogleMapOptions
|
||||||
import com.google.android.gms.maps.MapView
|
import com.google.android.gms.maps.MapView
|
||||||
import com.google.android.gms.maps.OnMapReadyCallback
|
import com.google.android.gms.maps.OnMapReadyCallback
|
||||||
|
import com.google.android.gms.maps.model.BitmapDescriptor
|
||||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory
|
||||||
import com.google.android.gms.maps.model.CameraPosition
|
import com.google.android.gms.maps.model.CameraPosition
|
||||||
import com.google.android.gms.maps.model.Circle
|
import com.google.android.gms.maps.model.Circle
|
||||||
@@ -387,14 +390,22 @@ abstract class BaseGoogleMapFragment :
|
|||||||
private suspend fun setPetHeadMarker(
|
private suspend fun setPetHeadMarker(
|
||||||
latLng: LatLng, headBgResId: Int = R.drawable.pic_map_gps_avatar
|
latLng: LatLng, headBgResId: Int = R.drawable.pic_map_gps_avatar
|
||||||
) {
|
) {
|
||||||
|
val mapKey = if (TextUtils.isEmpty(mPetHeadUrl)) "pet_default_head"
|
||||||
|
else mPetHeadUrl.substring(mPetHeadUrl.lastIndexOf("/") + 1, mPetHeadUrl.length)
|
||||||
|
var bitmapDescriptor = MyApplication.mapPetHeadHashMap[mapKey]
|
||||||
|
if (null == bitmapDescriptor || bitmapDescriptor !is BitmapDescriptor) {
|
||||||
if (null == mPetHeadIconBitmap) {
|
if (null == mPetHeadIconBitmap) {
|
||||||
//设置头像
|
//设置头像
|
||||||
mPetHeadIconBitmap =
|
mPetHeadIconBitmap =
|
||||||
GoogleBitmapHelper.headToBitmap(mContext!!, headBgResId, mPetHeadUrl, mPetType)
|
GoogleBitmapHelper.headToBitmap(mContext!!, headBgResId, mPetHeadUrl, mPetType)
|
||||||
}
|
}
|
||||||
|
bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(mPetHeadIconBitmap!!)
|
||||||
|
//保存在内存中,提高显示速度
|
||||||
|
MyApplication.mapPetHeadHashMap[mapKey] = bitmapDescriptor
|
||||||
|
}
|
||||||
val newLatLng = toGCJ02LatLon(latLng)
|
val newLatLng = toGCJ02LatLon(latLng)
|
||||||
val markerOptions = MarkerOptions().position(newLatLng)
|
val markerOptions = MarkerOptions().position(newLatLng)
|
||||||
markerOptions.icon(BitmapDescriptorFactory.fromBitmap(mPetHeadIconBitmap!!))
|
markerOptions.icon(bitmapDescriptor)
|
||||||
mMarker?.remove()
|
mMarker?.remove()
|
||||||
mGoogleMap?.apply {
|
mGoogleMap?.apply {
|
||||||
mMarker = addMarker(markerOptions)
|
mMarker = addMarker(markerOptions)
|
||||||
@@ -406,15 +417,15 @@ abstract class BaseGoogleMapFragment :
|
|||||||
if (MMKVUtil.getBoolean(MMKVKey.isGpsToGCJ02)) {
|
if (MMKVUtil.getBoolean(MMKVKey.isGpsToGCJ02)) {
|
||||||
mUserLatLng?.let {
|
mUserLatLng?.let {
|
||||||
if (null == mUserMarker) {
|
if (null == mUserMarker) {
|
||||||
mUserMarker = addImageMarker(it, R.drawable.icon_user_location_image,false)
|
mUserMarker = addImageMarker(it, R.drawable.icon_user_location_image, false)
|
||||||
} else {
|
} else {
|
||||||
if (it.latitude == mUserMarker!!.position.latitude && it.longitude == mUserMarker!!.position.longitude) {
|
if (it.latitude == mUserMarker!!.position.latitude && it.longitude == mUserMarker!!.position.longitude) {
|
||||||
} else {
|
} else {
|
||||||
mUserMarker?.remove()
|
mUserMarker?.remove()
|
||||||
mUserMarker = addImageMarker(it, R.drawable.icon_user_location_image,false)
|
mUserMarker = addImageMarker(it, R.drawable.icon_user_location_image, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mUserMarker?.setAnchor(0.5f,0.5f)
|
mUserMarker?.setAnchor(0.5f, 0.5f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else {
|
// else {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ object GoogleBitmapHelper {
|
|||||||
* @param headUrl 网络宠物的头像url
|
* @param headUrl 网络宠物的头像url
|
||||||
*/
|
*/
|
||||||
suspend fun headToBitmap(
|
suspend fun headToBitmap(
|
||||||
context: Context, @DrawableRes id: Int, headUrl: String, petType: Int
|
context: Context, @DrawableRes headBgResId: Int, headUrl: String, petType: Int
|
||||||
): Bitmap? {
|
): Bitmap? {
|
||||||
var headUrlBitmap = if (TextUtils.isEmpty(headUrl)) {
|
var headUrlBitmap = if (TextUtils.isEmpty(headUrl)) {
|
||||||
var headResId = R.drawable.icon_pet_default_head_svg
|
var headResId = R.drawable.icon_pet_default_head_svg
|
||||||
@@ -39,10 +39,14 @@ object GoogleBitmapHelper {
|
|||||||
} else {
|
} else {
|
||||||
ImageUtil.getImageBitmapByUrl(context, headUrl)
|
ImageUtil.getImageBitmapByUrl(context, headUrl)
|
||||||
}
|
}
|
||||||
if (null == headUrlBitmap) headUrlBitmap = BitmapFactory.decodeResource(
|
|
||||||
context.resources, R.drawable.pic_avatar_df
|
if (null == headUrlBitmap) {
|
||||||
|
headUrlBitmap =
|
||||||
|
BitmapFactory.decodeResource(context.resources, R.drawable.pic_avatar_df)
|
||||||
|
}
|
||||||
|
return combineBitmap(
|
||||||
|
ImageUtil.getBitmapFromDrawableAndSvg(context, headBgResId), headUrlBitmap!!
|
||||||
)
|
)
|
||||||
return combineBitmap(ImageUtil.getBitmapFromDrawableAndSvg(context, id), headUrlBitmap!!)
|
|
||||||
// return combineBitmap(BitmapFactory.decodeResource(context.resources, id), headUrlBitmap)
|
// return combineBitmap(BitmapFactory.decodeResource(context.resources, id), headUrlBitmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package com.abbidot.tracker.ui.fragment.map.googlemap
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
|
import android.text.TextUtils
|
||||||
import androidx.appcompat.widget.AppCompatSeekBar
|
import androidx.appcompat.widget.AppCompatSeekBar
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.abbidot.baselibrary.constant.MMKVKey
|
import com.abbidot.baselibrary.constant.MMKVKey
|
||||||
import com.abbidot.baselibrary.util.AppUtils
|
import com.abbidot.baselibrary.util.AppUtils
|
||||||
import com.abbidot.baselibrary.util.LogUtil
|
import com.abbidot.baselibrary.util.LogUtil
|
||||||
import com.abbidot.baselibrary.util.MMKVUtil
|
import com.abbidot.baselibrary.util.MMKVUtil
|
||||||
|
import com.abbidot.tracker.MyApplication
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.bean.HistoryDataBean
|
import com.abbidot.tracker.bean.HistoryDataBean
|
||||||
import com.abbidot.tracker.bean.PetBean
|
import com.abbidot.tracker.bean.PetBean
|
||||||
@@ -35,7 +37,7 @@ class HistoryDataGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
private lateinit var mVerticalTopToBottomSeekBar: AppCompatSeekBar
|
private lateinit var mVerticalTopToBottomSeekBar: AppCompatSeekBar
|
||||||
|
|
||||||
private val mMarkerOptions = MarkerOptions()
|
private val mMarkerOptions = MarkerOptions()
|
||||||
private lateinit var mPetIconDescriptor: BitmapDescriptor
|
private var mPetIconDescriptor: BitmapDescriptor? = null
|
||||||
|
|
||||||
private val mLatLngList = mutableListOf<LatLng>()
|
private val mLatLngList = mutableListOf<LatLng>()
|
||||||
|
|
||||||
@@ -132,17 +134,23 @@ class HistoryDataGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
mPetBean = petBean
|
mPetBean = petBean
|
||||||
// lifecycleScope.launch {
|
|
||||||
// }
|
|
||||||
try {
|
try {
|
||||||
mPetBean?.apply {
|
mPetBean?.apply {
|
||||||
|
val mapKey = if (TextUtils.isEmpty(imgurl)) "pet_default_head"
|
||||||
|
else imgurl.substring(imgurl.lastIndexOf("/") + 1, imgurl.length)
|
||||||
|
var bitmapDescriptor = MyApplication.mapPetHeadHashMap[mapKey]
|
||||||
|
if (null == bitmapDescriptor || bitmapDescriptor !is BitmapDescriptor) {
|
||||||
var bitmap = GoogleBitmapHelper.headToBitmap(
|
var bitmap = GoogleBitmapHelper.headToBitmap(
|
||||||
mContext!!, R.drawable.pic_map_gps_avatar, imgurl, petType
|
mContext!!, R.drawable.pic_map_gps_avatar, imgurl, petType
|
||||||
)
|
)
|
||||||
if (null == bitmap) bitmap = BitmapFactory.decodeResource(
|
if (null == bitmap) bitmap = BitmapFactory.decodeResource(
|
||||||
mContext!!.resources, R.drawable.icon_location_svg
|
mContext!!.resources, R.drawable.icon_location_svg
|
||||||
)
|
)
|
||||||
mPetIconDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap!!)
|
bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap!!)
|
||||||
|
//保存在内存中,提高显示速度
|
||||||
|
MyApplication.mapPetHeadHashMap[mapKey] = bitmapDescriptor
|
||||||
|
}
|
||||||
|
mPetIconDescriptor = bitmapDescriptor
|
||||||
mMarker?.setIcon(mPetIconDescriptor)
|
mMarker?.setIcon(mPetIconDescriptor)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -291,7 +299,7 @@ class HistoryDataGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
* 设置宠物Marker经纬度
|
* 设置宠物Marker经纬度
|
||||||
*/
|
*/
|
||||||
fun setPetMarkerLatLng(latLng: LatLng) {
|
fun setPetMarkerLatLng(latLng: LatLng) {
|
||||||
if (::mPetIconDescriptor.isInitialized) {
|
if (null != mPetIconDescriptor) {
|
||||||
mGoogleMap?.apply {
|
mGoogleMap?.apply {
|
||||||
val newLatLng = toGCJ02LatLon(latLng)
|
val newLatLng = toGCJ02LatLon(latLng)
|
||||||
mMarkerOptions.position(newLatLng).icon(mPetIconDescriptor)
|
mMarkerOptions.position(newLatLng).icon(mPetIconDescriptor)
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class FileUtil {
|
|||||||
* 保存头像目录名字
|
* 保存头像目录名字
|
||||||
*/
|
*/
|
||||||
const val HEAD_DIRECTORY_NAME = "headImage"
|
const val HEAD_DIRECTORY_NAME = "headImage"
|
||||||
|
const val TEMP_DIRECTORY_NAME = "temp"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* data首页截屏图片文件名字
|
* data首页截屏图片文件名字
|
||||||
@@ -105,7 +106,7 @@ class FileUtil {
|
|||||||
return finalSize
|
return finalSize
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getFormatSize(size: Long): String {
|
private fun getFormatSize(size: Long): String {
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
return "0.00\tKb"
|
return "0.00\tKb"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import androidx.viewpager2.widget.ViewPager2
|
import androidx.viewpager2.widget.ViewPager2
|
||||||
import coil.load
|
import coil.load
|
||||||
import coil.request.CachePolicy
|
import coil.request.CachePolicy
|
||||||
|
import coil.request.ImageRequest
|
||||||
|
import coil.request.ImageResult
|
||||||
import coil.transform.Transformation
|
import coil.transform.Transformation
|
||||||
import com.abbidot.baselibrary.constant.ConState
|
import com.abbidot.baselibrary.constant.ConState
|
||||||
import com.abbidot.baselibrary.constant.MMKVKey
|
import com.abbidot.baselibrary.constant.MMKVKey
|
||||||
@@ -87,7 +89,7 @@ import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
|
|||||||
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
||||||
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet.BottomListSheetBuilder
|
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet.BottomListSheetBuilder
|
||||||
import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
||||||
import okhttp3.internal.http2.Header
|
import java.io.File
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
|
|
||||||
@@ -631,28 +633,56 @@ class ViewUtil private constructor() {
|
|||||||
* 和圆角变换(RoundedCornersTransformation)
|
* 和圆角变换(RoundedCornersTransformation)
|
||||||
*/
|
*/
|
||||||
fun imageLoadUrl(
|
fun imageLoadUrl(
|
||||||
|
context: Context,
|
||||||
imageView: ImageView,
|
imageView: ImageView,
|
||||||
url: String,
|
url: String,
|
||||||
@DrawableRes errorImageResId: Int = R.drawable.icon_placeholder_image_svg,
|
@DrawableRes errorImageResId: Int = R.drawable.icon_placeholder_image_svg,
|
||||||
vararg transformations: Transformation
|
vararg transformations: Transformation
|
||||||
) {
|
) {
|
||||||
|
var isEnableNetCache = true
|
||||||
|
val fileName = url.substring(url.lastIndexOf("/") + 1, url.length) + ".temp"
|
||||||
|
var file: File? = null
|
||||||
|
if (!TextUtils.isEmpty(fileName)) {
|
||||||
|
file = File(
|
||||||
|
FileUtil.getDiskCacheDirectory(context, FileUtil.TEMP_DIRECTORY_NAME), fileName
|
||||||
|
)
|
||||||
|
if (file.exists()) isEnableNetCache = false
|
||||||
|
}
|
||||||
imageView.load(url) {
|
imageView.load(url) {
|
||||||
|
listener(object : ImageRequest.Listener {
|
||||||
|
override fun onStart(request: ImageRequest) {
|
||||||
|
super.onStart(request)
|
||||||
|
LogUtil.e("onStart")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(request: ImageRequest, throwable: Throwable) {
|
||||||
|
super.onError(request, throwable)
|
||||||
|
LogUtil.e("onError:${throwable.message}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSuccess(request: ImageRequest, metadata: ImageResult.Metadata) {
|
||||||
|
super.onSuccess(request, metadata)
|
||||||
|
LogUtil.e("onSuccess")
|
||||||
|
file?.let {
|
||||||
|
if (!it.exists()) it.createNewFile()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
//placeholder预置展位图
|
//placeholder预置展位图
|
||||||
placeholder(errorImageResId)
|
placeholder(errorImageResId)
|
||||||
//失败时的错误占位图片
|
//失败时的错误占位图片
|
||||||
error(errorImageResId)
|
error(errorImageResId)
|
||||||
//淡入淡出的动画时间
|
val netCachePolicy = if (isEnableNetCache) CachePolicy.ENABLED else CachePolicy.DISABLED
|
||||||
// crossfade(2000)
|
|
||||||
diskCachePolicy(CachePolicy.ENABLED)//设置磁盘的缓存策略
|
diskCachePolicy(CachePolicy.ENABLED)//设置磁盘的缓存策略
|
||||||
memoryCachePolicy(CachePolicy.ENABLED)//设置内存的缓存策略
|
memoryCachePolicy(netCachePolicy)//设置内存的缓存策略
|
||||||
networkCachePolicy(CachePolicy.ENABLED)//设置网络的缓存策略
|
networkCachePolicy(netCachePolicy)//设置网络的缓存策略
|
||||||
// val okHttpCache = Cache(
|
// val okHttpCache = Cache(
|
||||||
// context.cacheDir.resolve("okhttp_cache"), 50 * 1024 * 1024L
|
// context.cacheDir.resolve("okhttp_cache"), 50 * 1024 * 1024L
|
||||||
// )
|
// )
|
||||||
// OkHttpClient.Builder().cache(okHttpCache)
|
// OkHttpClient.Builder().cache(okHttpCache)
|
||||||
|
|
||||||
// 请求优先 WebP 更小更快
|
// 请求优先 WebP 更小更快
|
||||||
Header("Accept", "image/webp,image/jpeg;q=0.8")
|
addHeader("Accept", "image/webp,image/jpeg;q=0.8")
|
||||||
if (imageView.width > 0 && imageView.height > 0) {
|
if (imageView.width > 0 && imageView.height > 0) {
|
||||||
size(imageView.width, imageView.height)// 按View实际大小解码
|
size(imageView.width, imageView.height)// 按View实际大小解码
|
||||||
}
|
}
|
||||||
@@ -1051,7 +1081,7 @@ class ViewUtil private constructor() {
|
|||||||
val pet = petList[selectPos]
|
val pet = petList[selectPos]
|
||||||
savePetSP(pet, selectPos)
|
savePetSP(pet, selectPos)
|
||||||
petName.text = pet.petName
|
petName.text = pet.petName
|
||||||
setPetTypeHead(petHead, pet.imgurl, pet.petType)
|
setPetTypeHead(context, petHead, pet.imgurl, pet.petType)
|
||||||
viewAlphaAndRotationObjectAnimator(petHead)
|
viewAlphaAndRotationObjectAnimator(petHead)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1118,13 +1148,13 @@ class ViewUtil private constructor() {
|
|||||||
/**
|
/**
|
||||||
* 设置宠物头像
|
* 设置宠物头像
|
||||||
*/
|
*/
|
||||||
fun setPetTypeHead(imageView: ImageView, imageUrl: String, type: Int) {
|
fun setPetTypeHead(context: Context, imageView: ImageView, imageUrl: String, type: Int) {
|
||||||
if (TextUtils.isEmpty(imageUrl)) {
|
if (TextUtils.isEmpty(imageUrl)) {
|
||||||
val defaultHead = if (type == 2) R.drawable.icon_pet_default_head_svg
|
val defaultHead = if (type == 2) R.drawable.icon_pet_default_head_svg
|
||||||
else R.drawable.icon_pet_default_head_svg
|
else R.drawable.icon_pet_default_head_svg
|
||||||
imageView.load(defaultHead)
|
imageView.load(defaultHead)
|
||||||
} else {
|
} else {
|
||||||
imageLoadUrl(imageView, imageUrl)
|
imageLoadUrl(context, imageView, imageUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1037,7 +1037,7 @@
|
|||||||
<string name="txt_geofencing">Geofencing</string>
|
<string name="txt_geofencing">Geofencing</string>
|
||||||
<string name="txt_route_records">Route History Records</string>
|
<string name="txt_route_records">Route History Records</string>
|
||||||
<string name="txt_family_sharing">Family Members Sharing</string>
|
<string name="txt_family_sharing">Family Members Sharing</string>
|
||||||
<string name="txt_customer_support">30-days return guarantee</string>
|
<string name="txt_customer_support">30-days Return Guarantee</string>
|
||||||
<string name="txt_show_crash">The program has an exception and is about to exit</string>
|
<string name="txt_show_crash">The program has an exception and is about to exit</string>
|
||||||
<string name="txt_activate_subscribe">Activate Subscription</string>
|
<string name="txt_activate_subscribe">Activate Subscription</string>
|
||||||
<string name="txt_powered_off">Powered off</string>
|
<string name="txt_powered_off">Powered off</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user