first commit
This commit is contained in:
94
app/src/main/java/com/abbidot/tracker/MyApplication.kt
Normal file
94
app/src/main/java/com/abbidot/tracker/MyApplication.kt
Normal file
@@ -0,0 +1,94 @@
|
||||
package com.abbidot.tracker
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.app.Application
|
||||
import android.os.Build
|
||||
import android.os.Process
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import coil.Coil
|
||||
import coil.ImageLoader
|
||||
import coil.decode.GifDecoder
|
||||
import coil.decode.ImageDecoderDecoder
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.baselibrary.util.MMKVUtil
|
||||
import com.hjq.toast.Toaster
|
||||
import com.qmuiteam.qmui.arch.QMUISwipeBackActivityManager
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/11/2/002.
|
||||
* @link
|
||||
* @description:Application
|
||||
*/
|
||||
@HiltAndroidApp
|
||||
class MyApplication : Application() {
|
||||
|
||||
companion object {
|
||||
lateinit var instance: Application
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
//强制浅色模式,使用 AppCompatDelegate 或 MaterialComponents 动态切换主题
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
initInMainProcess {
|
||||
instance = this
|
||||
AppUtils.syncIsDebug(applicationContext)
|
||||
QMUISwipeBackActivityManager.init(this)
|
||||
MMKVUtil.init(this)
|
||||
|
||||
// 初始化 Toast 框架
|
||||
Toaster.init(this)
|
||||
Toaster.setView(R.layout.toast_my_layout)
|
||||
|
||||
// JPushInterface.setDebugMode(true)
|
||||
// JPushInterface.init(this)
|
||||
|
||||
// if (!AppUtils.isDebug()) {
|
||||
// //腾讯bugly初始化
|
||||
// CrashReport.initCrashReport(applicationContext, "06fc0a9cd1", AppUtils.isDebug())
|
||||
// }
|
||||
|
||||
// //同意协议
|
||||
// SDKInitializer.setAgreePrivacy(this, true)
|
||||
//// LocationClient.setAgreePrivacy(true);
|
||||
// //在使用SDK各组件之前初始化context信息,传入ApplicationContext
|
||||
// SDKInitializer.initialize(this)
|
||||
// //自4.3.0起,百度地图SDK所有接口均支持百度坐标和国测局坐标,用此方法设置您使用的坐标类型.
|
||||
// //包括BD09LL和GCJ02两种坐标,默认是BD09LL坐标。
|
||||
// SDKInitializer.setCoordType(CoordType.GCJ02)
|
||||
|
||||
// if (!AppUtils.isChina()) {
|
||||
// MapboxSearchSdk.initialize(application = this,
|
||||
// accessToken = getString(R.string.mapbox_access_token),
|
||||
// locationEngine = LocationEngineProvider.getBestLocationEngine(this))
|
||||
// }
|
||||
|
||||
//设置支持加载gif
|
||||
val imageLoader = ImageLoader.Builder(this).componentRegistry {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
add(ImageDecoderDecoder(this@MyApplication))
|
||||
} else {
|
||||
add(GifDecoder())
|
||||
}
|
||||
}.build()
|
||||
//设置全局唯一实例
|
||||
Coil.setImageLoader(imageLoader)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 主进程初始化
|
||||
*/
|
||||
private fun initInMainProcess(block: () -> Unit) {
|
||||
val activityManager = getSystemService(ACTIVITY_SERVICE) as ActivityManager
|
||||
val myPId = Process.myPid()
|
||||
val mainProcessName = packageName
|
||||
activityManager.runningAppProcesses.forEach {
|
||||
if (it.pid == myPId && it.processName == mainProcessName) {
|
||||
block()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import coil.load
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/5/30/030.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class AssignOptionsAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_bottom_sheet_add_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
val circleImageView = holder!!.getImageView(R.id.il_bottom_sheet_circle_image)
|
||||
val wrapImageView = holder.getImageView(R.id.il_bottom_sheet_wrap_image)
|
||||
val name = holder.getTextView(R.id.tv_bottom_sheet_name)
|
||||
|
||||
name.text = item.name
|
||||
if (position == 0) {
|
||||
circleImageView.visibility = View.GONE
|
||||
wrapImageView.visibility = View.GONE
|
||||
} else {
|
||||
//处理设备类型
|
||||
if (item.menuType == ConstantInt.SpecialType) {
|
||||
wrapImageView.visibility = View.VISIBLE
|
||||
circleImageView.visibility = View.GONE
|
||||
wrapImageView.load(R.drawable.icon_tracker_device_small)
|
||||
} else {
|
||||
circleImageView.visibility = View.VISIBLE
|
||||
wrapImageView.visibility = View.GONE
|
||||
ViewUtil.instance.setPetTypeHead(circleImageView, item.value, item.menuType)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.baidu.mapapi.search.core.PoiInfo
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/7/4/004.
|
||||
* @link
|
||||
* @description:百度地图搜索地址返回结果
|
||||
*/
|
||||
class BaiduMapPoiSearchResultAdapter(ctx: Context, list: MutableList<PoiInfo>?) :
|
||||
BaseRecyclerAdapter<PoiInfo>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_baidu_map_poi_result
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: PoiInfo) {
|
||||
holder!!.setText(R.id.baidu_map_poi_name, item.name)
|
||||
holder.setText(R.id.baidu_map_poi_address, item.address)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.PetBean
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.ui.activity.pet.PetProfileActivity
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.widget.TypefaceRoundButton
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/1/8/008.
|
||||
* @link
|
||||
* @description:切换宠物列表弹窗适配器
|
||||
*/
|
||||
class ChangePetListDialogAdapter(ctx: Context, list: MutableList<PetBean>?) :
|
||||
BaseRecyclerAdapter<PetBean>(ctx, list) {
|
||||
|
||||
private var mOnChangeClickListener: OnChangeClickListener? = null
|
||||
|
||||
//选中的宠物下标
|
||||
private var mSelectPetPos = 0
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_my_pet_dialog
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: PetBean) {
|
||||
val current =
|
||||
holder!!.itemView.findViewById<TypefaceRoundButton>(R.id.dialog_my_pet_current_btn)
|
||||
val change =
|
||||
holder.itemView.findViewById<TypefaceRoundButton>(R.id.dialog_my_pet_change_btn)
|
||||
|
||||
holder.setText(R.id.dialog_my_pet_name, item.petName)
|
||||
|
||||
holder.getImageView(R.id.dialog_my_pet_head).apply {
|
||||
ViewUtil.instance.setPetTypeHead(this, item.imgurl, item.petType)
|
||||
setOnClickListener {
|
||||
if (null != mOnChangeClickListener) {
|
||||
mOnChangeClickListener!!.onCurrentClick()
|
||||
}
|
||||
val intent = Intent(mContext, PetProfileActivity::class.java)
|
||||
intent.putExtra(ConstantString.Edit, true)
|
||||
intent.putExtra(ConstantString.Pet, item)
|
||||
mContext.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
if (position == mSelectPetPos) {
|
||||
current.visibility = View.VISIBLE
|
||||
change.visibility = View.GONE
|
||||
} else {
|
||||
current.visibility = View.GONE
|
||||
change.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
current.setChangeAlphaWhenPress(true)
|
||||
current.setOnClickListener {
|
||||
if (null != mOnChangeClickListener) {
|
||||
mOnChangeClickListener!!.onCurrentClick()
|
||||
}
|
||||
}
|
||||
|
||||
change.setChangeAlphaWhenPress(true)
|
||||
change.setOnClickListener {
|
||||
mSelectPetPos = position
|
||||
notifyItemRangeChanged(0, getData().size)
|
||||
if (null != mOnChangeClickListener) {
|
||||
mOnChangeClickListener!!.onChangeClick(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setSelectPetPos(position: Int) {
|
||||
mSelectPetPos = position
|
||||
}
|
||||
|
||||
fun setOnChangeClickListener(onChangeClickListener: OnChangeClickListener) {
|
||||
mOnChangeClickListener = onChangeClickListener
|
||||
}
|
||||
|
||||
interface OnChangeClickListener {
|
||||
fun onCurrentClick()
|
||||
fun onChangeClick(position: Int)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Paint
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.Utils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.PackageBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/8/6/006.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class ChoosePlanAdapter(
|
||||
ctx: Context, list: MutableList<PackageBean>?
|
||||
) : BaseRecyclerAdapter<PackageBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_choose_plan_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: PackageBean) {
|
||||
holder?.apply {
|
||||
getView(R.id.rl_choose_plan_shade_item).let {
|
||||
if (item.selected) it.setBackgroundResource(R.drawable.shape20_yellow_border_cyan_bg)
|
||||
else it.setBackgroundResource(0)
|
||||
}
|
||||
|
||||
setText(R.id.tv_choose_plan_item_name, item.planName)
|
||||
|
||||
val price = if (item.discountedPrice > 0) item.discountedPrice else item.planPrice
|
||||
getTextView(R.id.tv_choose_plan_item_money).apply {
|
||||
text = if (item.mealUnit == ConstantString.PackageUnitMonth) {
|
||||
String.format(
|
||||
mContext.getString(R.string.txt_money_unit), Utils.formatDecimal(price, 2)
|
||||
)
|
||||
} else {
|
||||
val monthPrice = Utils.formatDecimal(price / (item.period * 12), 2)
|
||||
String.format(mContext.getString(R.string.txt_money_unit), monthPrice)
|
||||
}
|
||||
}
|
||||
|
||||
getTextView(R.id.tv_choose_plan_item_year_money).let {
|
||||
it.text = String.format(
|
||||
mContext.getString(R.string.txt_money_unit),
|
||||
Utils.formatDecimal(item.discountedPrice, 2)
|
||||
)
|
||||
|
||||
it.visibility = if (item.discount > 0) View.VISIBLE
|
||||
else View.GONE
|
||||
}
|
||||
|
||||
getTextView(R.id.tv_choose_plan_item_discount_money).let {
|
||||
it.text = String.format(
|
||||
mContext.getString(R.string.txt_money_unit),
|
||||
Utils.formatDecimal(item.planPrice, 2)
|
||||
)
|
||||
it.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG
|
||||
it.visibility = if (item.discount > 0) View.VISIBLE
|
||||
else View.GONE
|
||||
}
|
||||
|
||||
|
||||
getView(R.id.ll_choose_plan_item_discount_percent).let {
|
||||
it.visibility = if (item.discount > 0) View.VISIBLE
|
||||
else View.GONE
|
||||
}
|
||||
getTextView(R.id.tv_choose_plan_item_discount_percent).let {
|
||||
it.text = "${item.discount}%"
|
||||
}
|
||||
|
||||
getView(R.id.cv_choose_plan_item_popular).let {
|
||||
if (item.popularType == ConstantInt.Type1) it.visibility = View.VISIBLE
|
||||
else it.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.CreditCardBean
|
||||
import com.abbidot.tracker.ui.activity.subscribe.PaymentMethodActivity
|
||||
import com.abbidot.tracker.ui.fragment.subscribe.CreditCardPaymentFragment
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.widget.TypefaceRoundButton
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/3/21/021.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class CreditCardAdapter(
|
||||
ctx: Context, list: MutableList<CreditCardBean>?
|
||||
) : BaseRecyclerAdapter<CreditCardBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = R.layout.layout_credit_card_no_data
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_credit_card_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: CreditCardBean) {
|
||||
val relativeLayout = holder!!.itemView as RelativeLayout
|
||||
val primary = holder.getView(R.id.rb_credit_card_primary_item) as TypefaceRoundButton
|
||||
if (item.checked) {
|
||||
relativeLayout.setBackgroundResource(R.drawable.shape8_dark_border_pale_yellow_bg)
|
||||
} else {
|
||||
relativeLayout.setBackgroundResource(R.drawable.shape8_dark_gray_border_white_yellow_bg)
|
||||
}
|
||||
primary.visibility = if (item.isPrimary) View.VISIBLE else View.GONE
|
||||
holder.getTextView(R.id.tv_credit_card_number_item).apply {
|
||||
val formatCardNumber = Util.formatCardNumber(item.cardNumber)
|
||||
val cardLogoImageId = Util.getCreditCardType(item.cardNumber)
|
||||
text = formatCardNumber
|
||||
if (cardLogoImageId == 0) setCompoundDrawablesWithIntrinsicBounds(
|
||||
0, 0, 0, 0
|
||||
)
|
||||
else setCompoundDrawablesWithIntrinsicBounds(
|
||||
cardLogoImageId, 0, 0, 0
|
||||
)
|
||||
}
|
||||
holder.getView(R.id.iv_credit_card_edit_btn).setOnClickListener {
|
||||
(((mContext as PaymentMethodActivity).mFragments[0]) as CreditCardPaymentFragment).goEditCard(
|
||||
item
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DFUStateBean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2023/4/17/017.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class DFUStateAdapter(
|
||||
ctx: Context, list: MutableList<DFUStateBean>?
|
||||
) : BaseRecyclerAdapter<DFUStateBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_tracker_dfu_state
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DFUStateBean) {
|
||||
val textView = holder!!.getTextView(R.id.item_dfu_state_name)
|
||||
val stateName = if (item.progress in 1..100) {
|
||||
"${item.stateName}${item.progress}%"
|
||||
} else {
|
||||
item.stateName
|
||||
}
|
||||
textView.text = stateName
|
||||
|
||||
if (position == getData().size - 1) {
|
||||
holder.getView(R.id.item_dfu_state_progress).visibility = View.VISIBLE
|
||||
holder.getView(R.id.item_dfu_state_ok).visibility = View.GONE
|
||||
} else {
|
||||
holder.getView(R.id.item_dfu_state_progress).visibility = View.GONE
|
||||
holder.getView(R.id.item_dfu_state_ok).visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import androidx.appcompat.widget.AppCompatCheckBox
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
import com.abbidot.tracker.ui.activity.device.set.LiveDurationSetActivity
|
||||
import com.abbidot.tracker.ui.activity.device.set.TrackingDurationSetActivity
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/6/7/007.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class DurationSetAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
|
||||
private var mTrackingDurationSetActivity: TrackingDurationSetActivity? = null
|
||||
private var mLiveDurationSetActivity: LiveDurationSetActivity? = null
|
||||
|
||||
init {
|
||||
if (ctx is TrackingDurationSetActivity) {
|
||||
mTrackingDurationSetActivity = ctx
|
||||
} else if (ctx is LiveDurationSetActivity) {
|
||||
mLiveDurationSetActivity = ctx
|
||||
}
|
||||
}
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_duration_set_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
holder!!.setText(R.id.tv_duration_name_item, item.name)
|
||||
val checkBox = holder.getView(R.id.cb_duration_set_check) as AppCompatCheckBox
|
||||
checkBox.apply {
|
||||
isChecked = item.selected
|
||||
setOnCheckedChangeListener(null)
|
||||
setOnClickListener {
|
||||
isChecked = item.selected
|
||||
if (mContext is TrackingDurationSetActivity) {
|
||||
mTrackingDurationSetActivity?.setTrackingDuration(position)
|
||||
} else if (mContext is LiveDurationSetActivity) {
|
||||
mLiveDurationSetActivity?.setLiveDuration(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
import com.qmuiteam.qmui.widget.QMUIRadiusImageView
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/2/22/022.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class FamilyAvatarAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_invite_family_avatar_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
val qMUIRadiusImageView =
|
||||
holder!!.getView(R.id.il_invite_family_avatar_layout) as QMUIRadiusImageView
|
||||
qMUIRadiusImageView.apply {
|
||||
setImageResource(item.imageId)
|
||||
borderColor = ContextCompat.getColor(mContext, R.color.select_color)
|
||||
borderWidth = if (item.selected) {
|
||||
AppUtils.dpToPx(2)
|
||||
} else {
|
||||
AppUtils.dpToPx(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.FamilyBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.ui.activity.pet.FamilyMembersActivity
|
||||
import com.qmuiteam.qmui.layout.QMUIButton
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/2/21/021.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class FamilyMembersAdapter(
|
||||
ctx: Context, list: MutableList<FamilyBean>?
|
||||
) : BaseRecyclerAdapter<FamilyBean>(ctx, list) {
|
||||
|
||||
private val mFamilyMembersActivity: FamilyMembersActivity
|
||||
|
||||
init {
|
||||
mFamilyMembersActivity = ctx as FamilyMembersActivity
|
||||
}
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_family_member_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: FamilyBean) {
|
||||
val activeState = holder!!.getView(R.id.tv_family_member_active_state)
|
||||
val pendingState = holder.getView(R.id.tv_family_member_pending_state)
|
||||
val resendBtn = holder.getView(R.id.btn_family_member_resend) as QMUIButton
|
||||
val avatarImageView = holder.getImageView(R.id.il_family_member_head)
|
||||
resendBtn.setChangeAlphaWhenPress(true)
|
||||
if (item.status == ConstantInt.Open) {
|
||||
activeState.visibility = View.VISIBLE
|
||||
pendingState.visibility = View.GONE
|
||||
resendBtn.visibility = View.GONE
|
||||
} else {
|
||||
activeState.visibility = View.INVISIBLE
|
||||
pendingState.visibility = View.VISIBLE
|
||||
resendBtn.visibility = View.VISIBLE
|
||||
}
|
||||
holder.setText(R.id.tv_family_member_email, item.acceptEmail)
|
||||
|
||||
val avatarImageResId = if (item.avatar == ConstantInt.Man) {
|
||||
R.drawable.icon_family_boy_avatar
|
||||
} else {
|
||||
R.drawable.icon_family_girl_avatar
|
||||
}
|
||||
avatarImageView.setImageResource(avatarImageResId)
|
||||
|
||||
holder.setClickListener(R.id.iv_delete_family_member_btn, View.OnClickListener {
|
||||
mFamilyMembersActivity.deleteFamily(item)
|
||||
})
|
||||
resendBtn.setOnClickListener {
|
||||
mFamilyMembersActivity.resendFamily(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/2/22/022.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class FamilyRelationAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_invite_family_relation_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
holder!!.setText(R.id.tv_invite_family_relation_text, item.name)
|
||||
holder.itemView.isSelected = item.selected
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import coil.load
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.MenuTxtBean
|
||||
import com.abbidot.tracker.ui.activity.help.FeedbackActivity
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/23/023.
|
||||
* @link
|
||||
* @description:反馈上传的图片
|
||||
*/
|
||||
class FeedbackImageAdapter(
|
||||
ctx: Context, activity: FragmentActivity, list: MutableList<MenuTxtBean>?
|
||||
) : BaseRecyclerAdapter<MenuTxtBean>(ctx, list) {
|
||||
|
||||
private val mActivity = activity as FeedbackActivity
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_feedback_image
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: MenuTxtBean) {
|
||||
val imageView = holder!!.getImageView(R.id.show_select_image)
|
||||
val deleteView = holder.getTextView(R.id.delete_image_cancel)
|
||||
if (TextUtils.isEmpty(item.imageUrl)) {
|
||||
imageView.load(R.drawable.ico_photo)
|
||||
deleteView.visibility = View.GONE
|
||||
imageView.setOnClickListener {
|
||||
// ViewUtil.instance.goSelectPhoto(
|
||||
// mActivity,
|
||||
// ResultCode.ResultCode_1,
|
||||
// count = mActivity.mLimitPhotoCount - (getData().size - 1)
|
||||
// )
|
||||
}
|
||||
} else {
|
||||
imageView.setOnClickListener(null)
|
||||
imageView.load(File(item.imageUrl))
|
||||
deleteView.visibility = View.VISIBLE
|
||||
deleteView.setOnClickListener {
|
||||
val list = getData()
|
||||
mActivity.deletePhoto(list, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.FencesBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.widget.TypefaceRoundButton
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class FencesZoneAdapter(
|
||||
ctx: Context, list: MutableList<FencesBean>?, isShowRightArrow: Boolean = true
|
||||
) : BaseRecyclerAdapter<FencesBean>(ctx, list) {
|
||||
|
||||
private var isShowRightArrow = true
|
||||
|
||||
init {
|
||||
this.isShowRightArrow = isShowRightArrow
|
||||
}
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = R.layout.layout_virtual_fences_empty_view
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_virtual_fences_layout
|
||||
|
||||
override fun noData(holder: RecyclerViewHolder?) {
|
||||
holder?.apply {
|
||||
getView(R.id.btn_empty_fences_add_safe_zone).visibility =
|
||||
if (isShowNoDataAddButton) View.VISIBLE
|
||||
else View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: FencesBean) {
|
||||
holder!!.getTextView(R.id.tv_virtual_fences_list_name).text = item.name
|
||||
holder.getTextView(R.id.tv_virtual_fences_list_address).text = item.address
|
||||
|
||||
val fenceNameTypeImage = ViewUtil.instance.getFenceNameImageType(item.fenceNameType)
|
||||
|
||||
holder.getImageView(R.id.iv_virtual_fences_list_type).setImageResource(fenceNameTypeImage)
|
||||
|
||||
val typefaceButton =
|
||||
holder.getView(R.id.tv_virtual_fences_list_switch_state) as TypefaceRoundButton
|
||||
val switchText: String
|
||||
val switchTextColor: Int
|
||||
val switchStrokeColor = if (item.isOn == ConstantInt.Open) {
|
||||
switchText = mContext.getString(R.string.txt_active)
|
||||
switchTextColor = ContextCompat.getColor(mContext, R.color.green_color100)
|
||||
ContextCompat.getColor(mContext, R.color.green_color100)
|
||||
} else {
|
||||
switchText = mContext.getString(R.string.txt_deactivate)
|
||||
switchTextColor = ContextCompat.getColor(mContext, R.color.block_color2)
|
||||
ContextCompat.getColor(mContext, R.color.white_gray_color1)
|
||||
}
|
||||
typefaceButton.apply {
|
||||
text = switchText
|
||||
setTextColor(switchTextColor)
|
||||
setStrokeColors(ColorStateList.valueOf(switchStrokeColor))
|
||||
}
|
||||
|
||||
if (isShowRightArrow) {
|
||||
holder.getView(R.id.iv_virtual_fences_list_arrow_right).visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.getView(R.id.iv_virtual_fences_list_arrow_right).visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.ui.activity.set.FirstPermissionsActivity
|
||||
import com.abbidot.tracker.widget.TypefaceButton
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/3/25/025.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class FirstPermissionsAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
|
||||
private val mPermissionsActivity = ctx as FirstPermissionsActivity
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_permission_state_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
val stateView = holder!!.getImageView(R.id.cb_permission_state_item)
|
||||
val typefaceTextView = holder.getTextView(R.id.tv_permission_tip_item)
|
||||
val btnLayout = holder.getView(R.id.ll_permission_set_layout)
|
||||
val btnSkip = holder.getView(R.id.btn_permission_skip_set) as TypefaceButton
|
||||
val btnEnable = holder.getView(R.id.btn_permission_enable_set) as TypefaceButton
|
||||
btnSkip.setChangeAlphaWhenPress(true)
|
||||
btnEnable.setChangeAlphaWhenPress(true)
|
||||
|
||||
if (item.selected) {
|
||||
typefaceTextView.visibility = View.VISIBLE
|
||||
holder.itemView.setBackgroundResource(R.drawable.shape16_white_color_bg)
|
||||
|
||||
if (item.state == ConstantInt.Type1) {
|
||||
btnLayout.visibility = View.GONE
|
||||
} else {
|
||||
btnLayout.visibility = View.VISIBLE
|
||||
}
|
||||
} else {
|
||||
btnLayout.visibility = View.GONE
|
||||
typefaceTextView.visibility = View.GONE
|
||||
holder.itemView.setBackgroundResource(R.drawable.shape10_white_bg)
|
||||
}
|
||||
|
||||
when (item.state) {
|
||||
ConstantInt.SpecialType -> stateView.setImageResource(R.drawable.icon_permission_error_check_svg)
|
||||
ConstantInt.Type0 -> stateView.setImageResource(R.drawable.icon_permission_no_check_svg)
|
||||
ConstantInt.Type1 -> stateView.setImageResource(R.drawable.icon_permission_check_svg)
|
||||
}
|
||||
|
||||
holder.setText(R.id.tv_permission_name_item, item.name)
|
||||
typefaceTextView.text = item.value
|
||||
|
||||
btnSkip.setOnClickListener {
|
||||
item.state = ConstantInt.SpecialType
|
||||
item.selected = false
|
||||
notifyItemChanged(position)
|
||||
// if (position + 1 < getData().size) {
|
||||
// getData()[position + 1].
|
||||
// }
|
||||
}
|
||||
btnEnable.setOnClickListener {
|
||||
when (position) {
|
||||
0 -> mPermissionsActivity.mPermissionsCommon.operateBluetooth()
|
||||
1 -> mPermissionsActivity.mPermissionsCommon.operateGPSLocation()
|
||||
2 -> mPermissionsActivity.mPermissionsCommon.operateNotifications(
|
||||
this, ConstantInt.SpecialType
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
mPermissionsActivity.updateNextBtnState()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
||||
|
||||
/**
|
||||
*Created by .
|
||||
* @link https://blog.csdn.net/Lee465357793/article/details/130830127
|
||||
* @description:RecyclerView GridLayoutManager item间距设置,两端对齐
|
||||
* @param offset 控件的外边距,不使用屏幕宽度来计算
|
||||
*/
|
||||
class GridItemDecoration(
|
||||
context: Context, spanCount: Int, private var itemWidth: Int, top: Int, bottom: Int, offset: Int
|
||||
) : RecyclerView.ItemDecoration() {
|
||||
|
||||
private var mSpanCount = spanCount
|
||||
private val mContext = context
|
||||
private var mColumnSpacing = 0
|
||||
private val mTop = top
|
||||
private val mBottom = bottom
|
||||
|
||||
private val rvWidth by lazy {
|
||||
QMUIDisplayHelper.getScreenWidth(mContext) - offset
|
||||
}
|
||||
|
||||
init {
|
||||
mColumnSpacing = (rvWidth - (itemWidth * mSpanCount)) / (mSpanCount - 1)
|
||||
}
|
||||
|
||||
fun updateSpaceCount(count: Int) {
|
||||
mSpanCount = count
|
||||
mColumnSpacing = (rvWidth - (itemWidth * mSpanCount)) / (mSpanCount - 1)
|
||||
}
|
||||
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State
|
||||
) {
|
||||
// 获取view 在adapter中的位置。
|
||||
val position = parent.getChildAdapterPosition(view)
|
||||
// view 所在的列
|
||||
val column = position % mSpanCount
|
||||
// column * (列间距 * (1f / 列数))
|
||||
outRect.left = (column * mColumnSpacing / mSpanCount)
|
||||
// 列间距 - (column + 1) * (列间距 * (1f /列数))
|
||||
outRect.right = (mColumnSpacing - (column + 1) * mColumnSpacing / mSpanCount)
|
||||
|
||||
if (mTop > 0) {
|
||||
outRect.top = mTop
|
||||
}
|
||||
if (mBottom > 0) {
|
||||
outRect.bottom = mBottom
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.MenuTxtBean
|
||||
import com.abbidot.tracker.constant.MultipleEntity
|
||||
import com.abbidot.tracker.widget.TypefaceTextView
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/8/12/012.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class HelpTextImageTypeAdapter(list: MutableList<MenuTxtBean>?) :
|
||||
BaseMultiItemQuickAdapter<MenuTxtBean, BaseViewHolder>(list) {
|
||||
|
||||
init {
|
||||
//加粗的标题文字
|
||||
addItemType(MultipleEntity.TEXT, R.layout.layout_help_title1)
|
||||
//只是图片的
|
||||
addItemType(MultipleEntity.IMG, R.layout.layout_help_image)
|
||||
//显示不同颜色的文字
|
||||
addItemType(MultipleEntity.IMG_TEXT, R.layout.layout_help_title1)
|
||||
//显示16sp大小的文字内容
|
||||
addItemType(MultipleEntity.IMG_IMG, R.layout.layout_help_title1)
|
||||
//显示14sp大小的文字内容
|
||||
addItemType(MultipleEntity.IMG_TEXT_IMG, R.layout.layout_help_title2)
|
||||
}
|
||||
|
||||
override fun convert(holder: BaseViewHolder, item: MenuTxtBean) {
|
||||
// val position = getItemPosition(item)
|
||||
when (item.itemType) {
|
||||
MultipleEntity.TEXT -> {
|
||||
// 创建一个Typeface对象,指定加粗字体
|
||||
val typefaceBold = Typeface.create(Typeface.DEFAULT, Typeface.BOLD)
|
||||
holder.getView<TypefaceTextView>(R.id.tv_help_title_one).apply {
|
||||
text = item.menuName
|
||||
typeface = typefaceBold
|
||||
}
|
||||
holder.itemView.setPadding(0, AppUtils.dpToPx(8), 0, 0)
|
||||
}
|
||||
|
||||
MultipleEntity.IMG_TEXT -> holder.getView<TypefaceTextView>(R.id.tv_help_title_one)
|
||||
.apply {
|
||||
text = item.menuName
|
||||
setTextColor(ContextCompat.getColor(context, item.colorRedId))
|
||||
}
|
||||
|
||||
MultipleEntity.IMG -> {
|
||||
holder.getView<AppCompatImageView>(R.id.iv_help_image_type)
|
||||
.setImageResource(item.imageId)
|
||||
}
|
||||
|
||||
MultipleEntity.IMG_IMG -> {
|
||||
holder.getView<TypefaceTextView>(R.id.tv_help_title_one).text = item.menuName
|
||||
holder.itemView.setPadding(0, AppUtils.dpToPx(20), 0, 0)
|
||||
}
|
||||
|
||||
MultipleEntity.IMG_TEXT_IMG -> {
|
||||
holder.getView<TypefaceTextView>(R.id.tv_help_title_two).text = item.menuName
|
||||
holder.itemView.setPadding(0, AppUtils.dpToPx(14), 0, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Intent
|
||||
import android.text.TextUtils
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.base.BaseDialog
|
||||
import com.abbidot.tracker.bean.MenuTxtBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.MultipleEntity
|
||||
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
||||
import com.abbidot.tracker.ui.activity.help.FeedbackActivity
|
||||
import com.abbidot.tracker.ui.activity.help.HowWorkActivity
|
||||
import com.abbidot.tracker.ui.activity.set.AboutActivity
|
||||
import com.abbidot.tracker.ui.activity.set.AdvancedSetActivity
|
||||
import com.abbidot.tracker.ui.activity.set.NotificationsSetActivity
|
||||
import com.abbidot.tracker.ui.activity.set.PermissionsSetActivity
|
||||
import com.abbidot.tracker.ui.common.UnitSelectDialog
|
||||
import com.abbidot.tracker.ui.fragment.account.AccountV2Fragment
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.widget.TypefaceTextView
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2023/12/27/027.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class HomeAccountMenuAdapter(
|
||||
accountV2Fragment: AccountV2Fragment, list: MutableList<MenuTxtBean>?
|
||||
) : BaseMultiItemQuickAdapter<MenuTxtBean, BaseViewHolder>(list) {
|
||||
|
||||
private val mLogOutTipsType = 0
|
||||
private val mClearCacheTipsType = 1
|
||||
private val mCloseAccountTipsType = 2
|
||||
private lateinit var mHomeV2Activity: HomeV2Activity
|
||||
private lateinit var mUnitSelectDialog: UnitSelectDialog
|
||||
private val mAccountV2Fragment = accountV2Fragment
|
||||
|
||||
init {
|
||||
addItemType(MultipleEntity.TEXT, R.layout.item_title_text_type)
|
||||
addItemType(MultipleEntity.IMG_TEXT, R.layout.item_qmui_common_item_view)
|
||||
}
|
||||
|
||||
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
|
||||
super.onAttachedToRecyclerView(recyclerView)
|
||||
mHomeV2Activity = context as HomeV2Activity
|
||||
mUnitSelectDialog = UnitSelectDialog(context)
|
||||
}
|
||||
|
||||
override fun convert(holder: BaseViewHolder, item: MenuTxtBean) {
|
||||
val position = getItemPosition(item)
|
||||
when (item.itemType) {
|
||||
MultipleEntity.TEXT -> {
|
||||
val typefaceTextView = holder.getView<TypefaceTextView>(R.id.tv_title_name)
|
||||
typefaceTextView.text = item.menuName
|
||||
}
|
||||
|
||||
MultipleEntity.IMG_TEXT -> {
|
||||
holder.getView<QMUICommonListItemView>(R.id.tracker_manage_setting_item).run {
|
||||
ViewUtil.instance.showQMUICommonListItemView(
|
||||
context, this, {
|
||||
// Toaster.show("$position")
|
||||
when (position) {
|
||||
1 -> mHomeV2Activity.startActivity(
|
||||
Intent(
|
||||
context, HowWorkActivity::class.java
|
||||
)
|
||||
)
|
||||
|
||||
2 -> mHomeV2Activity.startActivity(
|
||||
Intent(
|
||||
context, FeedbackActivity::class.java
|
||||
)
|
||||
)
|
||||
|
||||
4 -> mHomeV2Activity.startActivity(
|
||||
Intent(
|
||||
context, NotificationsSetActivity::class.java
|
||||
)
|
||||
)
|
||||
|
||||
5 -> mUnitSelectDialog.showUnitDialog(object :
|
||||
BaseDialog.OnDialogSelectListener {
|
||||
override fun onSelectClick(dialog: BaseDialog<*>, any: Any) {
|
||||
if (any is Int) {
|
||||
val unit = any
|
||||
val oldUnit = Util.getMeasureSpUnit()
|
||||
if (unit == oldUnit) {
|
||||
return
|
||||
}
|
||||
item.menuValue =
|
||||
if (unit == ConstantInt.Type1) context.getString(R.string.txt_imperial)
|
||||
else context.getString(R.string.txt_metric)
|
||||
mAccountV2Fragment.setMeasureUnit(unit)
|
||||
}
|
||||
}
|
||||
})
|
||||
// mHomeV2Activity.startActivity(
|
||||
// Intent(
|
||||
// context, FirstMeasurementUnitsActivity::class.java
|
||||
// )
|
||||
// )
|
||||
|
||||
|
||||
6 -> mHomeV2Activity.startActivity(
|
||||
Intent(
|
||||
context, PermissionsSetActivity::class.java
|
||||
)
|
||||
)
|
||||
|
||||
7 -> mHomeV2Activity.startActivity(
|
||||
Intent(
|
||||
context, AdvancedSetActivity::class.java
|
||||
)
|
||||
)
|
||||
|
||||
9 -> mHomeV2Activity.startActivity(
|
||||
Intent(
|
||||
context, AboutActivity::class.java
|
||||
)
|
||||
)
|
||||
|
||||
10 -> dialogShowType(
|
||||
mLogOutTipsType,
|
||||
mHomeV2Activity.getString(R.string.txt_log_out_tips),
|
||||
position
|
||||
)
|
||||
|
||||
}
|
||||
}, item.menuName
|
||||
)
|
||||
if (!TextUtils.isEmpty(item.menuValue)) {
|
||||
detailText = item.menuValue
|
||||
}
|
||||
setImageDrawable(ContextCompat.getDrawable(context, item.imageId))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun dialogShowType(type: Int, string: String, pos: Int) {
|
||||
ViewUtil.instance.showDialog(context, string, object : BaseDialog.OnDialogOkListener {
|
||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
dialog.dismiss()
|
||||
when {
|
||||
mLogOutTipsType == type -> {
|
||||
Util.logOut(mHomeV2Activity, mHomeV2Activity.lifecycleScope)
|
||||
}
|
||||
|
||||
mCloseAccountTipsType == type -> {
|
||||
// closeAccount()
|
||||
}
|
||||
|
||||
else -> {
|
||||
// mHomeV2Activity.clearCache(this@HomeAccountMenuAdapter, pos)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, okTextResId = R.string.txt_sure)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.widget.TypefaceButton
|
||||
|
||||
/**
|
||||
* 首页地图宠物警告适配器
|
||||
*/
|
||||
class HomeMapDeviceMsgAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_home_map_device_msg
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
val typefaceTextView = holder!!.getView(R.id.tv_device_msg_content) as TypefaceButton
|
||||
typefaceTextView.apply {
|
||||
text = item.value
|
||||
val colorId = if (item.state == ConstantInt.Type1) R.color.green_color10
|
||||
else R.color.device_msg_color1
|
||||
|
||||
setBackgroundColor(ContextCompat.getColor(context, colorId))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.widget.BatteryView
|
||||
import com.abbidot.tracker.widget.TypefaceTextView
|
||||
|
||||
/**
|
||||
* 首页地图宠物警告适配器
|
||||
*/
|
||||
class HomeMapDeviceStateAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_home_map_device_state
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
val typefaceTextView =
|
||||
holder!!.getView(R.id.tv_home_map_device_name_item) as TypefaceTextView
|
||||
val iv = holder.getView(R.id.iv_home_map_device_item) as AppCompatImageView
|
||||
val bv = holder.getView(R.id.bv_home_map_device_power) as BatteryView
|
||||
val ivState = holder.getView(R.id.iv_home_map_device_state_item) as AppCompatImageView
|
||||
val detailTextView =
|
||||
holder.getTextView(R.id.tv_map_device_state_detail_item) as TypefaceTextView
|
||||
|
||||
if (item.menuType == ConstantInt.Open) {
|
||||
ivState.setImageResource(R.drawable.icon_map_online)
|
||||
} else {
|
||||
ivState.setImageResource(R.drawable.icon_map_offline)
|
||||
}
|
||||
|
||||
if (item.imageId == 0) {
|
||||
iv.visibility = View.GONE
|
||||
bv.visibility = View.VISIBLE
|
||||
bv.setValue(item.state)
|
||||
} else {
|
||||
iv.visibility = View.VISIBLE
|
||||
bv.visibility = View.GONE
|
||||
iv.setImageResource(item.imageId)
|
||||
}
|
||||
|
||||
typefaceTextView.text = item.name
|
||||
detailTextView.text = item.value
|
||||
|
||||
if (item.selected) {
|
||||
detailTextView.visibility = View.VISIBLE
|
||||
typefaceTextView.visibility = View.GONE
|
||||
} else {
|
||||
detailTextView.visibility = View.GONE
|
||||
if (TextUtils.isEmpty(item.name)) {
|
||||
typefaceTextView.visibility = View.GONE
|
||||
} else {
|
||||
typefaceTextView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
item.selected = !item.selected
|
||||
notifyItemChanged(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.FamilyBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2023/12/25/025.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class HomePetFamilyAdapter(
|
||||
ctx: Context, list: MutableList<FamilyBean>?
|
||||
) : BaseRecyclerAdapter<FamilyBean>(ctx, list) {
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = R.layout.layout_family_empty_view
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_home_pet_family
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: FamilyBean) {
|
||||
holder!!.setText(R.id.item_home_pet_family_name, item.acceptEmail)
|
||||
val avatarImageView = holder.getImageView(R.id.item_home_pet_family_head)
|
||||
|
||||
val avatarImageResId = if (item.avatar == ConstantInt.Man) {
|
||||
R.drawable.icon_family_boy_avatar
|
||||
} else {
|
||||
R.drawable.icon_family_girl_avatar
|
||||
}
|
||||
avatarImageView.setImageResource(avatarImageResId)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.MenuTxtBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.MultipleEntity
|
||||
import com.abbidot.tracker.ui.activity.device.set.LedLightActivity
|
||||
import com.abbidot.tracker.ui.activity.device.set.LiveDurationSetActivity
|
||||
import com.abbidot.tracker.ui.activity.device.set.PowerOffActivity
|
||||
import com.abbidot.tracker.ui.activity.device.set.TrackingDurationSetActivity
|
||||
import com.abbidot.tracker.ui.fragment.device.HomeTrackFragment
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.widget.TypefaceTextView
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class HomePetTrackMenuAdapter(
|
||||
fragment: HomeTrackFragment, list: MutableList<MenuTxtBean>?
|
||||
) : BaseMultiItemQuickAdapter<MenuTxtBean, BaseViewHolder>(list) {
|
||||
|
||||
private var mTypeface: Typeface
|
||||
private var mHomeTrackFragment: HomeTrackFragment = fragment
|
||||
|
||||
init {
|
||||
addItemType(MultipleEntity.TEXT, R.layout.item_qmui_common_item_view)
|
||||
addItemType(MultipleEntity.IMG_TEXT, R.layout.item_qmui_common_item_view)
|
||||
addItemType(MultipleEntity.TEXT_NAME, R.layout.item_qmui_common_item_view)
|
||||
addItemType(MultipleEntity.IMG_TEXT_IMG, R.layout.item_qmui_common_item_view)
|
||||
mTypeface = Typeface.create(Typeface.DEFAULT, Typeface.BOLD)
|
||||
}
|
||||
|
||||
override fun convert(holder: BaseViewHolder, item: MenuTxtBean) {
|
||||
val position = getItemPosition(item)
|
||||
val qMUICommonItemView =
|
||||
holder.getView<QMUICommonListItemView>(R.id.tracker_manage_setting_item).apply {
|
||||
ViewUtil.instance.showQMUICommonListItemView(
|
||||
context, this, null, item.menuName
|
||||
)
|
||||
background =
|
||||
ContextCompat.getDrawable(context, R.drawable.selector_transparent_pressed)
|
||||
}
|
||||
qMUICommonItemView.textView.typeface = mTypeface
|
||||
qMUICommonItemView.setOnClickListener {
|
||||
when (position) {
|
||||
0 -> mHomeTrackFragment.goPetDataActivity(LedLightActivity::class.java)
|
||||
1 -> mHomeTrackFragment.goMapDeviceDataActivity(TrackingDurationSetActivity::class.java)
|
||||
2 -> mHomeTrackFragment.goMapDeviceDataActivity(LiveDurationSetActivity::class.java)
|
||||
3 -> mHomeTrackFragment.firmwareCheckUpdate()
|
||||
4 -> mHomeTrackFragment.goPetDataActivity(PowerOffActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
when (item.itemType) {
|
||||
MultipleEntity.TEXT -> qMUICommonItemView.detailText = item.menuValue
|
||||
|
||||
MultipleEntity.IMG_TEXT -> {
|
||||
}
|
||||
|
||||
MultipleEntity.TEXT_NAME -> {
|
||||
qMUICommonItemView.accessoryType = QMUICommonListItemView.ACCESSORY_TYPE_SWITCH
|
||||
qMUICommonItemView.detailText = ""
|
||||
qMUICommonItemView.switch.apply {
|
||||
isChecked = item.menuValue == ConstantInt.Open.toString()
|
||||
isEnabled = isChecked
|
||||
setOnClickListener {
|
||||
if (!isChecked) {
|
||||
//turnOff
|
||||
mHomeTrackFragment.operateDeviceTips(R.string.txt_turnoff_tips, 0)
|
||||
}
|
||||
//屏蔽点击就变状态
|
||||
isChecked = !isChecked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MultipleEntity.IMG_TEXT_IMG -> setQMUICommonItemViewHead(qMUICommonItemView, item)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置QMUICommonItemView 自定义布局
|
||||
*/
|
||||
private fun setQMUICommonItemViewHead(
|
||||
qMUICommonItemView: QMUICommonListItemView, item: MenuTxtBean
|
||||
) {
|
||||
qMUICommonItemView.detailText = ""
|
||||
qMUICommonItemView.accessoryType = QMUICommonListItemView.ACCESSORY_TYPE_CUSTOM
|
||||
val view =
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_dfu_custom_qmui_group_right, null)
|
||||
qMUICommonItemView.addAccessoryCustomView(view)
|
||||
|
||||
view.findViewById<AppCompatImageView>(R.id.iv_dfu_red_dot).visibility =
|
||||
if (item.isSwitch) View.VISIBLE else View.GONE
|
||||
val firmwareName = view.findViewById<TypefaceTextView>(R.id.tv_custom_group_dfu_detail_text)
|
||||
firmwareName.text = item.menuValue
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.MenuTxtBean
|
||||
import com.abbidot.tracker.constant.MultipleEntity
|
||||
import com.abbidot.tracker.widget.BatteryView
|
||||
import com.abbidot.tracker.widget.MyBluetoothAnimView
|
||||
import com.abbidot.tracker.widget.TypefaceTextView
|
||||
|
||||
/**
|
||||
* 首页宠物设备状态
|
||||
*/
|
||||
class HomePetTrackStateAdapter(
|
||||
ctx: Context, list: MutableList<MenuTxtBean>?
|
||||
) : BaseRecyclerAdapter<MenuTxtBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_home_pet_device_state
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: MenuTxtBean) {
|
||||
val stateTextView = holder!!.getView(R.id.tv_home_pet_device_state_item) as TypefaceTextView
|
||||
stateTextView.text = item.menuName
|
||||
|
||||
holder.getTextView(R.id.tv_home_pet_device_state_name_item).apply {
|
||||
text = item.menuValue
|
||||
setTextColor(ContextCompat.getColor(mContext, item.colorRedId))
|
||||
}
|
||||
|
||||
val bv = holder.getView(R.id.bv_home_pet_device_power) as BatteryView
|
||||
val bluetoothAnimView =
|
||||
holder.getView(R.id.mba_home_pet_device_search_anim_item) as MyBluetoothAnimView
|
||||
when (item.menuType) {
|
||||
MultipleEntity.IMG_TEXT_IMG -> {
|
||||
bluetoothAnimView.visibility = View.GONE
|
||||
bv.visibility = View.VISIBLE
|
||||
bv.setValue(item.imageId)
|
||||
bluetoothAnimView.setBluetoothAnimStartAndStop(item.isSwitch)
|
||||
stateTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
|
||||
}
|
||||
|
||||
MultipleEntity.TEXT_TEXT_IMG -> {
|
||||
bluetoothAnimView.visibility = View.VISIBLE
|
||||
bv.visibility = View.GONE
|
||||
bluetoothAnimView.setBluetoothAnimStartAndStop(item.isSwitch)
|
||||
stateTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
|
||||
}
|
||||
|
||||
else -> {
|
||||
bv.visibility = View.GONE
|
||||
bluetoothAnimView.visibility = View.GONE
|
||||
stateTextView.setCompoundDrawablesWithIntrinsicBounds(0, item.imageId, 0, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.MenuTxtBean
|
||||
import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/22/022.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class HowWorkAdapter(ctx: Context, list: MutableList<MenuTxtBean>?) :
|
||||
BaseRecyclerAdapter<MenuTxtBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_qmui_common_item_view
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: MenuTxtBean) {
|
||||
val qMUICommonListItemView =
|
||||
holder!!.getView(R.id.tracker_manage_setting_item) as QMUICommonListItemView
|
||||
qMUICommonListItemView.detailText = item.menuValue
|
||||
qMUICommonListItemView.text = item.menuName
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.qmuiteam.qmui.widget.QMUIRadiusImageView
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/12/30/030.
|
||||
* @link
|
||||
* @description:LedLight默认可以选择颜色适配器
|
||||
*/
|
||||
class LedLightColorAdapter(ctx: Context, list: MutableList<Int>?) :
|
||||
BaseRecyclerAdapter<Int>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_led_color_select
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: Int) {
|
||||
val radiusImageView =
|
||||
holder!!.itemView.findViewById<QMUIRadiusImageView>(R.id.show_current_color_select)
|
||||
radiusImageView.setImageResource(item)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.constant.MMKVKey
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.baselibrary.util.MMKVUtil
|
||||
import com.abbidot.baselibrary.util.Utils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.SubscriptionsOrderBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.ui.activity.subscribe.ChoosePlanActivity
|
||||
import com.abbidot.tracker.ui.activity.subscribe.MySubscriptionActivity
|
||||
import com.abbidot.tracker.ui.activity.subscribe.SubscriptionHistoryActivity
|
||||
import com.abbidot.tracker.ui.activity.subscribe.SubscriptionPlanActivity
|
||||
import com.abbidot.tracker.widget.TypefaceTextView
|
||||
import com.qmuiteam.qmui.skin.QMUISkinManager
|
||||
import com.qmuiteam.qmui.widget.popup.QMUIPopup
|
||||
import com.qmuiteam.qmui.widget.popup.QMUIPopups
|
||||
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/3/29/029.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class MySubscriptionAdapter(
|
||||
ctx: Context, list: MutableList<SubscriptionsOrderBean>?
|
||||
) : BaseRecyclerAdapter<SubscriptionsOrderBean>(ctx, list) {
|
||||
|
||||
private val mMySubscriptionActivity = ctx as MySubscriptionActivity
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_my_subscription_layout
|
||||
|
||||
override fun bindData(
|
||||
holder: RecyclerViewHolder?, position: Int, item: SubscriptionsOrderBean
|
||||
) {
|
||||
holder!!.setText(R.id.tv_my_subscription_device_out_id, item.deviceOutId)
|
||||
holder.setText(R.id.tv_my_subscription_plan_name, "${item.mealName}(${item.planCategory})")
|
||||
holder.getTextView(R.id.tv_my_subscription_auto_subscription_tips).apply {
|
||||
visibility = if (item.subscriptionStatus == ConstantInt.Open) {
|
||||
text = if (item.mealUnit == ConstantString.PackageUnitYear) String.format(
|
||||
mContext.getString(R.string.txt_auto_subscription_year),
|
||||
item.autoRenewPrice.toString()
|
||||
)
|
||||
else String.format(
|
||||
mContext.getString(R.string.txt_auto_subscription_month),
|
||||
item.autoRenewPrice.toString()
|
||||
)
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
}
|
||||
holder.setText(
|
||||
R.id.tv_my_subscription_active_time,
|
||||
Utils.stringToDate(item.updateTime, resultFormat = Utils.DATE_FORMAT_PATTERN_EN6)
|
||||
)
|
||||
|
||||
holder.getTextView(R.id.tv_my_subscription_annual_care).apply {
|
||||
text =
|
||||
if (item.annualCareType == ConstantInt.Type1) mContext.getString(R.string.start_txt_yes)
|
||||
else mContext.getString(R.string.txt_no)
|
||||
}
|
||||
|
||||
// val timestamp = getAfterHowTimestamp(
|
||||
// Utils.stringToTimestamp(item.currentTime), item.surplusDays
|
||||
// )
|
||||
holder.setText(
|
||||
R.id.tv_my_subscription_expires_on,
|
||||
Utils.formatTime(item.endTime, Utils.DATE_FORMAT_PATTERN_EN7)
|
||||
)
|
||||
|
||||
if (item.subscriptionStatus == ConstantInt.Close) {
|
||||
holder.setText(
|
||||
R.id.tv_my_subscription_auto_renew,
|
||||
mContext.getString(R.string.tracker_manage_set_led_off)
|
||||
)
|
||||
} else {
|
||||
holder.setText(
|
||||
R.id.tv_my_subscription_auto_renew,
|
||||
mContext.getString(R.string.tracker_manage_set_led_on)
|
||||
)
|
||||
}
|
||||
|
||||
val expiresTitle = holder.getTextView(R.id.tv_my_subscription_expires_title)
|
||||
holder.getButton(R.id.btn_my_subscription_recharge).apply {
|
||||
visibility =
|
||||
if (item.orderStatus == 6 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
setText(R.string.txt_card_recharge)
|
||||
expiresTitle.setText(R.string.txt_expires_on2)
|
||||
View.VISIBLE
|
||||
} else if (item.subscriptionStatus == ConstantInt.Close) {
|
||||
setText(R.string.txt_enable_auto_renew)
|
||||
expiresTitle.setText(R.string.txt_expires_on1)
|
||||
View.VISIBLE
|
||||
} else {
|
||||
expiresTitle.setText(R.string.txt_expires_on1)
|
||||
View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
holder.getView(R.id.il_my_subscription_count_down).apply {
|
||||
visibility =
|
||||
if (item.orderStatus == 6 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
View.GONE
|
||||
} else {
|
||||
View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
val times = Utils.getDayToYearMonthDay(item.surplusDays)
|
||||
holder.setText(R.id.tv_add_success_device_expires_days, times[0])
|
||||
holder.setText(R.id.tv_add_success_device_expires_hours, times[1])
|
||||
holder.setText(R.id.tv_add_success_device_expires_min, times[2])
|
||||
|
||||
holder.getView(R.id.fl_my_subscription_btn_layout).apply {
|
||||
val userId = MMKVUtil.getString(MMKVKey.UserId)
|
||||
//UserId不一样就是共享设备的订单
|
||||
visibility = if (item.userId == userId) {
|
||||
setOnClickListener {
|
||||
showPop(holder.getView(R.id.iv_my_subscription_btn), item, position)
|
||||
}
|
||||
View.VISIBLE
|
||||
} else View.GONE
|
||||
}
|
||||
holder.setClickListener(R.id.btn_my_subscription_recharge) {
|
||||
if (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close) {
|
||||
Intent(mContext, SubscriptionPlanActivity::class.java).let {
|
||||
it.putExtra(ConstantString.LkSetMeal, item)
|
||||
mMySubscriptionActivity.startActivity(it)
|
||||
}
|
||||
} else {
|
||||
mMySubscriptionActivity.updateSubscriptionStatus(item.subscriptionId, 1, position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showPop(v: View, item: SubscriptionsOrderBean, position: Int) {
|
||||
val view = LayoutInflater.from(mContext).inflate(R.layout.pop_subscription_item, null)
|
||||
val qMUIPopups =
|
||||
QMUIPopups.popup(mContext).preferredDirection(QMUIPopup.DIRECTION_BOTTOM).view(view)
|
||||
// .edgeProtection(QMUIDisplayHelper.dp2px(mContext, 20))
|
||||
.dimAmount(0.6f).arrowSize(AppUtils.dpToPx(6), AppUtils.dpToPx(4))
|
||||
.radius(AppUtils.dpToPx(16)).animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER)
|
||||
.skinManager(QMUISkinManager.defaultInstance(mContext)).show(v)
|
||||
|
||||
view.findViewById<TypefaceTextView>(R.id.tv_pop_my_subscription_history).apply {
|
||||
setOnClickListener {
|
||||
qMUIPopups.dismiss()
|
||||
Intent(mContext, SubscriptionHistoryActivity::class.java).let {
|
||||
it.putExtra(ConstantString.DeviceId, item.deviceId)
|
||||
mMySubscriptionActivity.startActivity(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
//升级套餐
|
||||
view.findViewById<TypefaceTextView>(R.id.tv_pop_my_subscription_auto_renew).apply {
|
||||
visibility =
|
||||
if (item.planCategory == "Premium" || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
View.GONE
|
||||
} else {
|
||||
View.VISIBLE
|
||||
}
|
||||
setOnClickListener {
|
||||
qMUIPopups.dismiss()
|
||||
val intent = Intent(mContext, ChoosePlanActivity::class.java)
|
||||
intent.putExtra(ConstantString.Title, "Premium")
|
||||
intent.putExtra(ConstantString.Upgrade, true)
|
||||
intent.putExtra(ConstantString.LkSetMeal, item)
|
||||
mMySubscriptionActivity.startActivity(intent)
|
||||
}
|
||||
}
|
||||
view.findViewById<TypefaceTextView>(R.id.tv_pop_my_subscription_cancel).apply {
|
||||
visibility = if (item.subscriptionStatus == ConstantInt.Open) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
setOnClickListener {
|
||||
qMUIPopups.dismiss()
|
||||
mMySubscriptionActivity.updateSubscriptionStatus(item.subscriptionId, 0, position)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DeviceBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.ui.activity.device.AddNewTracker1Activity
|
||||
import com.abbidot.tracker.ui.activity.device.MyTrackerV2Activity
|
||||
import com.abbidot.tracker.ui.activity.pet.PetProfileActivity
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.qmuiteam.qmui.widget.QMUIRadiusImageView
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/3/7/007.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class MyTrackerV2Adapter(
|
||||
ctx: Context, list: MutableList<DeviceBean>?
|
||||
) : BaseRecyclerAdapter<DeviceBean>(ctx, list) {
|
||||
|
||||
private val mMyTrackerActivity = mContext as MyTrackerV2Activity
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_my_tracker_v2_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DeviceBean) {
|
||||
val batteryTextView = holder!!.getTextView(R.id.iv_item_my_tracker_v2_battery)
|
||||
val trackerImageView = holder.getImageView(R.id.iv_item_my_tracker_v2_device)
|
||||
val addTrackerLayout = holder.getView(R.id.ll_my_tracker_v2_add_tracker_layout)
|
||||
val petHead = holder.getView(R.id.il_my_tracker_v2_pet_head) as QMUIRadiusImageView
|
||||
val addPetLayout = holder.getView(R.id.ll_my_tracker_v2_add_pet_layout)
|
||||
val trackerName = holder.getTextView(R.id.tv_my_tracker_v2_device_name)
|
||||
val petName = holder.getTextView(R.id.tv_my_tracker_v2_pet_name)
|
||||
|
||||
holder.getImageView(R.id.iv_my_tracker_v2_share).apply {
|
||||
visibility = if (item.shared == ConstantInt.NoShare) View.GONE else View.VISIBLE
|
||||
}
|
||||
|
||||
addTrackerLayout.setOnClickListener {
|
||||
if (itemCount - 1 == position) {
|
||||
mMyTrackerActivity.startActivity(
|
||||
Intent(
|
||||
mContext, AddNewTracker1Activity::class.java
|
||||
)
|
||||
)
|
||||
} else {
|
||||
mMyTrackerActivity.getAssignData(position)
|
||||
}
|
||||
}
|
||||
addPetLayout.setOnClickListener {
|
||||
if (itemCount - 1 == position) {
|
||||
mMyTrackerActivity.startActivity(Intent(mContext, PetProfileActivity::class.java))
|
||||
} else {
|
||||
mMyTrackerActivity.getAssignData(position)
|
||||
}
|
||||
}
|
||||
|
||||
trackerImageView.setOnClickListener {
|
||||
if (item.shared == ConstantInt.NoShare) {
|
||||
mMyTrackerActivity.showDeviceBottomSheetMenu(position)
|
||||
}
|
||||
}
|
||||
petHead.setOnClickListener {
|
||||
if (item.shared == ConstantInt.NoShare) {
|
||||
mMyTrackerActivity.showPetBottomSheetMenu(position)
|
||||
}
|
||||
}
|
||||
|
||||
if (itemCount - 1 == position) {
|
||||
batteryTextView.visibility = View.GONE
|
||||
trackerImageView.visibility = View.GONE
|
||||
trackerName.visibility = View.GONE
|
||||
addTrackerLayout.visibility = View.VISIBLE
|
||||
|
||||
addPetLayout.visibility = View.VISIBLE
|
||||
petHead.visibility = View.GONE
|
||||
petName.visibility = View.GONE
|
||||
} else {
|
||||
if (TextUtils.isEmpty(item.deviceOutId)) {
|
||||
addTrackerLayout.visibility = View.VISIBLE
|
||||
batteryTextView.visibility = View.GONE
|
||||
trackerImageView.visibility = View.GONE
|
||||
trackerName.visibility = View.GONE
|
||||
} else {
|
||||
addTrackerLayout.visibility = View.GONE
|
||||
batteryTextView.visibility = View.VISIBLE
|
||||
trackerImageView.visibility = View.VISIBLE
|
||||
trackerName.visibility = View.VISIBLE
|
||||
|
||||
trackerName.text = item.deviceOutId
|
||||
val battery = "${item.batteryCapacity} "
|
||||
batteryTextView.text = battery
|
||||
}
|
||||
if (null == item.pet) {
|
||||
addPetLayout.visibility = View.VISIBLE
|
||||
petHead.visibility = View.GONE
|
||||
petName.visibility = View.GONE
|
||||
} else {
|
||||
addPetLayout.visibility = View.GONE
|
||||
petHead.visibility = View.VISIBLE
|
||||
petName.visibility = View.VISIBLE
|
||||
item.pet?.let {
|
||||
petName.text = it.petName
|
||||
ViewUtil.instance.setPetTypeHead(petHead, it.imgurl, it.petType)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.text.format.DateUtils
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.Utils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.MessageBean
|
||||
import com.abbidot.tracker.widget.TypefaceRoundButton
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2023/12/26/026.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class NotificationV2Adapter(
|
||||
ctx: Context, list: MutableList<MessageBean>?
|
||||
) : BaseRecyclerAdapter<MessageBean>(ctx, list) {
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_home_route_notification
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: MessageBean) {
|
||||
val roundButton =
|
||||
holder!!.getView(R.id.iv_home_route_notification_state) as TypefaceRoundButton
|
||||
val textColor = if (item.isRead) {
|
||||
roundButton.visibility = View.GONE
|
||||
R.color.black70
|
||||
} else {
|
||||
roundButton.visibility = View.VISIBLE
|
||||
R.color.data_black_color
|
||||
}
|
||||
holder.getTextView(R.id.tv_home_route_notification_content).apply {
|
||||
text = item.message
|
||||
if (item.isSelect) {
|
||||
ellipsize = null
|
||||
isSingleLine = false
|
||||
} else {
|
||||
ellipsize = TextUtils.TruncateAt.END
|
||||
isSingleLine = true
|
||||
}
|
||||
setTextColor(ContextCompat.getColor(mContext, textColor))
|
||||
}
|
||||
holder.getTextView(R.id.tv_home_route_notification_type).apply {
|
||||
text = item.title
|
||||
setTextColor(ContextCompat.getColor(mContext, textColor))
|
||||
}
|
||||
holder.getTextView(R.id.tv_home_route_notification_date).apply {
|
||||
text = getRelativeTimeString(Utils.stringToTimestamp(item.sendTime))
|
||||
setTextColor(ContextCompat.getColor(mContext, textColor))
|
||||
}
|
||||
}
|
||||
|
||||
private fun getRelativeTimeString(time: Long): String {
|
||||
var formatDateStr = ""
|
||||
val now = System.currentTimeMillis()
|
||||
formatDateStr = if (DateUtils.isToday(time)) {
|
||||
mContext.getString(R.string.txt_today) + " " + Utils.formatTime(
|
||||
time, Utils.DATE_FORMAT_PATTERN_EN8
|
||||
)
|
||||
} else if (now - time < (48 * 60 * 60 * 1000)) {
|
||||
mContext.getString(R.string.txt_yesterday)
|
||||
} else {
|
||||
Utils.formatTime(time, Utils.DATE_FORMAT_PATTERN_EN9)
|
||||
}
|
||||
return formatDateStr
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.ui.activity.set.PermissionsSetActivity
|
||||
import com.abbidot.tracker.widget.TypefaceButton
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/3/25/025.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class PermissionsSetAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
|
||||
private val mPermissionsSetActivity = ctx as PermissionsSetActivity
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_permission_state_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
val stateView = holder!!.getImageView(R.id.cb_permission_state_item)
|
||||
val typefaceTextView = holder.getTextView(R.id.tv_permission_tip_item)
|
||||
val btnLayout = holder.getView(R.id.ll_permission_set_layout)
|
||||
val btnSkip = holder.getView(R.id.btn_permission_skip_set) as TypefaceButton
|
||||
val btnEnable = holder.getView(R.id.btn_permission_enable_set) as TypefaceButton
|
||||
btnSkip.visibility = View.INVISIBLE
|
||||
btnEnable.setChangeAlphaWhenPress(true)
|
||||
btnEnable.setText(R.string.txt_turn_on_upper)
|
||||
|
||||
if (item.selected) {
|
||||
typefaceTextView.visibility = View.VISIBLE
|
||||
btnLayout.visibility = View.VISIBLE
|
||||
holder.itemView.setBackgroundResource(R.drawable.shape16_white_color_bg)
|
||||
} else {
|
||||
btnLayout.visibility = View.GONE
|
||||
typefaceTextView.visibility = View.GONE
|
||||
holder.itemView.setBackgroundResource(R.drawable.shape10_white_bg)
|
||||
}
|
||||
|
||||
when (item.state) {
|
||||
ConstantInt.Type0 -> stateView.setImageResource(R.drawable.icon_permission_error_check_svg)
|
||||
ConstantInt.Type1 -> stateView.setImageResource(R.drawable.icon_permission_check_svg)
|
||||
}
|
||||
|
||||
holder.setText(R.id.tv_permission_name_item, item.name)
|
||||
typefaceTextView.text = item.value
|
||||
|
||||
btnEnable.setOnClickListener {
|
||||
when (position) {
|
||||
0 -> mPermissionsSetActivity.mPermissionsCommon.operateBluetooth()
|
||||
1 -> mPermissionsSetActivity.mPermissionsCommon.operateGPSLocation()
|
||||
2 -> mPermissionsSetActivity.mPermissionsCommon.operateNotifications(
|
||||
this, ConstantInt.Type0
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.LabelBean
|
||||
import com.qmuiteam.qmui.layout.QMUILinearLayout
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/2/21/021.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class PetLabelsAdapter(ctx: Context, list: MutableList<LabelBean>?) :
|
||||
BaseRecyclerAdapter<LabelBean>(ctx, list) {
|
||||
|
||||
private val mLabelBgColorList = mutableListOf(
|
||||
R.color.green_color10,
|
||||
R.color.label_color2,
|
||||
R.color.label_color3,
|
||||
R.color.label_color4,
|
||||
R.color.label_color5,
|
||||
R.color.label_color6,
|
||||
R.color.label_color7,
|
||||
R.color.label_color8,
|
||||
R.color.label_color9,
|
||||
R.color.label_color10,
|
||||
R.color.label_color11,
|
||||
R.color.label_color12,
|
||||
R.color.label_color13,
|
||||
R.color.label_color14
|
||||
)
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_pet_label_layout_v2
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: LabelBean) {
|
||||
val textView = holder!!.getTextView(R.id.tv_label_v2_name)
|
||||
val rootView = holder.itemView as QMUILinearLayout
|
||||
val imageView = holder.getImageView(R.id.iv_label_v2_is_select)
|
||||
if (item.check) {
|
||||
imageView.visibility = View.VISIBLE
|
||||
} else {
|
||||
imageView.visibility = View.GONE
|
||||
}
|
||||
textView.text = item.name
|
||||
|
||||
rootView.setBackgroundResource(mLabelBgColorList[Random.nextInt(mLabelBgColorList.size)])
|
||||
|
||||
rootView.radius = AppUtils.dpToPx(6)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/12/30/030.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class PetsBadgesAdapter(ctx: Context, list: MutableList<DataBean>?,itemViewWidthDp:Int=80) :
|
||||
BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
|
||||
private val mItemViewWidthDp=AppUtils.dpToPx(itemViewWidthDp)
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_pets_badges_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
holder!!.getTextView(R.id.tv_item_my_pets_badge).apply {
|
||||
text = item.name
|
||||
}
|
||||
holder.itemView.layoutParams.width= mItemViewWidthDp
|
||||
holder.getImageView(R.id.iv_item_my_pets_badge).setImageResource(item.imageId)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.base.BaseActivity
|
||||
import com.abbidot.tracker.bean.ParentBadgeBean
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.ui.activity.pet.BadgeDetailActivity
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.widget.TypefaceButton
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/12/30/030.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class PetsParentBadgesAdapter(ctx: Context, list: MutableList<ParentBadgeBean>?) :
|
||||
BaseRecyclerAdapter<ParentBadgeBean>(ctx, list) {
|
||||
|
||||
//默认显示的勋章个数
|
||||
private val defaultShowCount = 9
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_pets_parent_badges_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: ParentBadgeBean) {
|
||||
val recyclerView = holder!!.getView(R.id.rv_pet_badges_list) as RecyclerView
|
||||
holder.setText(R.id.tv_pets_parent_badges_name, item.parentName)
|
||||
val btn = (holder.getView(R.id.btn_parent_badges_expand_fold) as TypefaceButton).apply {
|
||||
visibility = View.GONE
|
||||
if (item.isExpand) {
|
||||
setText(R.string.txt_view_less)
|
||||
} else {
|
||||
setText(R.string.txt_see_all)
|
||||
}
|
||||
setOnClickListener {
|
||||
item.isExpand = !item.isExpand
|
||||
notifyItemChanged(position)
|
||||
}
|
||||
}
|
||||
item.badgeList?.apply {
|
||||
if (size > defaultShowCount) {
|
||||
btn.visibility = View.VISIBLE
|
||||
} else {
|
||||
btn.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
val list = if (item.isExpand || null == item.badgeList || item.badgeList!!.size < 4) {
|
||||
item.badgeList
|
||||
} else {
|
||||
item.badgeList!!.subList(0, defaultShowCount)
|
||||
}
|
||||
if (null == recyclerView.adapter) {
|
||||
val petsBadgesAdapter = PetsBadgesAdapter(mContext, list).apply {
|
||||
setOnItemClickListener(object : OnItemClickListener {
|
||||
override fun onItemClick(itemView: View?, pos: Int) {
|
||||
val activity = mContext as BaseActivity<*>
|
||||
Intent(mContext, BadgeDetailActivity::class.java).let {
|
||||
it.putExtra(ConstantString.PetLabels, list!![pos])
|
||||
activity.startActivity(it)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
ViewUtil.instance.setRecyclerViewGridLayout(
|
||||
mContext,
|
||||
recyclerView,
|
||||
petsBadgesAdapter,
|
||||
3,
|
||||
AppUtils.dpToPx(80),
|
||||
top = AppUtils.dpToPx(16),
|
||||
bottom = AppUtils.dpToPx(18),
|
||||
offset = AppUtils.dpToPx(32)
|
||||
)
|
||||
} else {
|
||||
val adapter = recyclerView.adapter as PetsBadgesAdapter
|
||||
adapter.setData(list, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import androidx.cardview.widget.CardView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
||||
|
||||
/**
|
||||
*/
|
||||
class SelectFencesTypeCardShadeAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_select_type_card_shade_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
val imageView = holder!!.getImageView(R.id.iv_select_type_image)
|
||||
imageView.setImageResource(item.imageId)
|
||||
val cardView = holder.itemView as CardView
|
||||
cardView.apply {
|
||||
isSelected = item.selected
|
||||
cardElevation = if (item.selected) {
|
||||
setCardBackgroundColor(ContextCompat.getColor(context, R.color.select_color))
|
||||
QMUIDisplayHelper.dpToPx(4).toFloat()
|
||||
} else {
|
||||
setCardBackgroundColor(ContextCompat.getColor(context, R.color.transparent))
|
||||
0f
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.MenuTxtBean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/1/10/010.
|
||||
* @link
|
||||
* @description:选择地图应用列表弹窗
|
||||
*/
|
||||
class SelectMapListDialogAdapter(ctx: Context, list: MutableList<MenuTxtBean>?) :
|
||||
BaseRecyclerAdapter<MenuTxtBean>(ctx, list) {
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_select_map
|
||||
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: MenuTxtBean) {
|
||||
val textView = holder!!.getTextView(R.id.item_select_map_name)
|
||||
textView.text = item.menuName
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(
|
||||
item.imageId, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import androidx.cardview.widget.CardView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
|
||||
/**
|
||||
*/
|
||||
class SelectMapTypeCardShadeAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_map_type_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
val imageView = holder!!.getImageView(R.id.iv_select_type_image)
|
||||
imageView.setImageResource(item.imageId)
|
||||
holder.setText(R.id.tv_map_type_name, item.name)
|
||||
val cardView = holder.getView(R.id.il_map_type_shade_image) as CardView
|
||||
cardView.apply {
|
||||
isSelected = item.selected
|
||||
cardElevation = if (item.selected) {
|
||||
setCardBackgroundColor(ContextCompat.getColor(context, R.color.white))
|
||||
val padding = AppUtils.dpToPx(3)
|
||||
setContentPadding(padding, padding, padding, padding)
|
||||
AppUtils.dpToPx(4).toFloat()
|
||||
} else {
|
||||
setCardBackgroundColor(ContextCompat.getColor(context, R.color.transparent))
|
||||
setContentPadding(0, 0, 0, 0)
|
||||
0f
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.graphics.Rect
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/12/24/024.
|
||||
* @link https://qa.1r1g.com/sf/ask/1997239751/
|
||||
* @description:RecyclerView的LinearLayoutManager和FlexboxLayoutManager通用item间距设置
|
||||
*/
|
||||
class SpaceItemDecoration(
|
||||
left: Int = 0, right: Int = 0, top: Int = 0, bottom: Int = 0
|
||||
) : RecyclerView.ItemDecoration() {
|
||||
|
||||
private var mLeft = left
|
||||
private var mRight = right
|
||||
private var mTop = top
|
||||
private var mBottom = bottom
|
||||
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State
|
||||
) {
|
||||
if (mLeft > 0) {
|
||||
outRect.left = mLeft
|
||||
}
|
||||
if (mRight > 0) {
|
||||
outRect.right = mRight
|
||||
}
|
||||
if (mTop > 0) {
|
||||
outRect.top = mTop
|
||||
}
|
||||
if (mBottom > 0) {
|
||||
outRect.bottom = mBottom
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.Utils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.SubscriptionsOrderBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.ui.activity.subscribe.RequestRefundActivity
|
||||
import com.abbidot.tracker.ui.activity.subscribe.SubscriptionHistoryActivity
|
||||
import com.abbidot.tracker.widget.TypefaceRoundButton
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/8/19/019.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class SubscriptionHistoryAdapter(
|
||||
ctx: Context, list: MutableList<SubscriptionsOrderBean>?
|
||||
) : BaseRecyclerAdapter<SubscriptionsOrderBean>(ctx, list) {
|
||||
|
||||
private val mHistoryActivity = ctx as SubscriptionHistoryActivity
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_subscription_history_layout
|
||||
|
||||
override fun bindData(
|
||||
holder: RecyclerViewHolder?, position: Int, item: SubscriptionsOrderBean
|
||||
) {
|
||||
holder!!.setText(
|
||||
R.id.tv_subscription_history_order_id,
|
||||
mContext.getString(R.string.txt_order_id) + item.orderNum
|
||||
)
|
||||
holder.setText(
|
||||
R.id.tv_subscription_history_order_time,
|
||||
Utils.stringToDate(item.createTime, resultFormat = Utils.DATE_FORMAT_PATTERN_EN10)
|
||||
)
|
||||
holder.setText(R.id.tv_subscription_history_package_name, item.mealName)
|
||||
holder.setText(
|
||||
R.id.tv_subscription_history_package_price,
|
||||
String.format(mContext.getString(R.string.txt_money_unit), "${item.totalAmountWithTax}")
|
||||
)
|
||||
|
||||
|
||||
(holder.getView(R.id.btn_subscription_history_operate) as TypefaceRoundButton).apply {
|
||||
|
||||
setTextColor(ContextCompat.getColor(mContext, R.color.line_color1))
|
||||
|
||||
if (item.enabled == ConstantInt.Type0) visibility = View.GONE
|
||||
else {
|
||||
visibility = View.VISIBLE
|
||||
when (item.orderStatus) {
|
||||
1 -> {
|
||||
val updateTimestamp = Utils.stringToTimestamp(item.updateTime)
|
||||
val nowTimestamp = System.currentTimeMillis()
|
||||
// val nowTimestamp = Utils.stringToTimestamp(item.currentTime)
|
||||
if (item.mealUnit == ConstantString.PackageUnitMonth) {
|
||||
val day7Timestamp = 7 * 24 * 60 * 60 * 1000L
|
||||
//套餐超出7天不能退款
|
||||
if (nowTimestamp - updateTimestamp <= day7Timestamp) {
|
||||
visibility = View.VISIBLE
|
||||
setText(R.string.txt_refund)
|
||||
} else {
|
||||
visibility = View.GONE
|
||||
}
|
||||
} else {
|
||||
val day30Timestamp = 30 * 24 * 60 * 60 * 1000L
|
||||
//套餐超出30天不能退款
|
||||
if (nowTimestamp - updateTimestamp <= day30Timestamp) {
|
||||
visibility = View.VISIBLE
|
||||
setText(R.string.txt_refund)
|
||||
} else {
|
||||
visibility = View.GONE
|
||||
}
|
||||
}
|
||||
setTextColor(ContextCompat.getColor(mContext, R.color.select_color))
|
||||
}
|
||||
|
||||
4 -> setText(R.string.txt_waiting)
|
||||
5 -> setText(R.string.txt_refunding)
|
||||
6 -> setText(R.string.txt_refunded)
|
||||
7, 8 -> {
|
||||
setTextColor(ContextCompat.getColor(mContext, R.color.orange_red_color))
|
||||
setText(R.string.txt_rejected)
|
||||
}
|
||||
|
||||
else -> visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
setChangeAlphaWhenPress(true)
|
||||
setOnClickListener {
|
||||
if (item.orderStatus == ConstantInt.Type1) {
|
||||
Intent(mContext, RequestRefundActivity::class.java).apply {
|
||||
putExtra(ConstantString.SetMeal, item)
|
||||
mHistoryActivity.startActivity(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val state =
|
||||
if (item.enabled == ConstantInt.Type0 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
mContext.getString(R.string.txt_expired)
|
||||
} else {
|
||||
mContext.getString(R.string.txt_active)
|
||||
}
|
||||
holder.setText(R.id.tv_subscription_history_subscription_state, state)
|
||||
|
||||
holder.getTextView(R.id.tv_subscription_history_annual_care).apply {
|
||||
text =
|
||||
if (item.annualCareType == ConstantInt.Type1) mContext.getString(R.string.start_txt_yes)
|
||||
else mContext.getString(R.string.txt_no)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.RelativeLayout
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.Utils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.PackageTypeBean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/3/19/019.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class SubscriptionPlanAdapter(
|
||||
ctx: Context, list: MutableList<PackageTypeBean>?
|
||||
) : BaseRecyclerAdapter<PackageTypeBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_subscription_plan_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: PackageTypeBean) {
|
||||
val relativeLayout = holder!!.getView(R.id.rl_subscribe_plan_shade_item) as RelativeLayout
|
||||
// val popularCardView = holder.getView(R.id.cv_subscribe_plan_item_popular) as CardView
|
||||
// val subscription = holder.getTextView(R.id.tv_subscribe_plan_item_per_year)
|
||||
|
||||
if (item.selected) {
|
||||
relativeLayout.setBackgroundResource(R.drawable.shape20_yellow_border_cyan_bg)
|
||||
// popularCardView.visibility = View.VISIBLE
|
||||
} else {
|
||||
relativeLayout.setBackgroundResource(0)
|
||||
// popularCardView.visibility = View.GONE
|
||||
}
|
||||
holder.setText(R.id.tv_subscribe_plan_item_name, item.name)
|
||||
holder.setText(
|
||||
R.id.tv_subscribe_plan_item_money,
|
||||
String.format(mContext.getString(R.string.txt_money_unit), Utils.formatDecimal( item.price, 2))
|
||||
)
|
||||
// subscription.text =
|
||||
// String.format(mContext.getString(R.string.txt_per_year_money), item.subscriptionFee)
|
||||
// subscription.visibility = if (item.subscriptionFee == 0.0) View.INVISIBLE
|
||||
// else View.VISIBLE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import androidx.appcompat.widget.AppCompatCheckBox
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.PackageBenefitsBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/3/19/019.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class SubscriptionPlanDetailAdapter(
|
||||
ctx: Context, list: MutableList<PackageBenefitsBean>?
|
||||
) : BaseRecyclerAdapter<PackageBenefitsBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_subscription_plan_detail_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: PackageBenefitsBean) {
|
||||
val checkBox = holder!!.getView(R.id.cb_subscribe_plan_detail_item) as AppCompatCheckBox
|
||||
checkBox.setOnClickListener {
|
||||
checkBox.isChecked = !checkBox.isChecked
|
||||
}
|
||||
holder.setText(R.id.tv_subscribe_plan_detail_name, item.title)
|
||||
checkBox.isChecked = item.status == ConstantInt.Open
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.MenuTxtBean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/9/9/009.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class SureSubscribeSummaryAdapter(
|
||||
ctx: Context, list: MutableList<MenuTxtBean>?
|
||||
) : BaseRecyclerAdapter<MenuTxtBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_subscribe_summary_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: MenuTxtBean) {
|
||||
holder?.apply {
|
||||
setText(R.id.tv_subscribe_summary_item_name, item.menuName)
|
||||
getTextView(R.id.tv_subscribe_summary_item_money).let {
|
||||
val string =
|
||||
String.format(mContext.getString(R.string.txt_money_unit), item.menuValue)
|
||||
it.text = if (item.isSwitch) "-$string"
|
||||
else string
|
||||
it.setTextColor(ContextCompat.getColor(mContext, item.colorRedId))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/2/20/020.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class TextViewAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_text_view
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
holder!!.setText(R.id.tv_text_view_item, item.name)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/11/19/019.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class ViewPagerAdapter(list: MutableList<Fragment>, fragmentActivity: FragmentActivity) :
|
||||
FragmentStateAdapter(fragmentActivity) {
|
||||
|
||||
private val mFragmentList = list
|
||||
|
||||
override fun getItemCount() = mFragmentList.size
|
||||
|
||||
override fun createFragment(position: Int) = mFragmentList[position]
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import androidx.cardview.widget.CardView
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
||||
|
||||
/**
|
||||
*围栏类型
|
||||
*/
|
||||
class VirtualFencesZoneShadeAdapter(
|
||||
ctx: Context, list: MutableList<DataBean>?
|
||||
) : BaseRecyclerAdapter<DataBean>(ctx, list) {
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_shadow_image_view
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: DataBean) {
|
||||
val imageView = holder!!.getImageView(R.id.iv_item_shadow_image_view)
|
||||
val cardView = holder.itemView as CardView
|
||||
|
||||
if (item.selected) {
|
||||
imageView.setImageResource(item.selectImageId)
|
||||
cardView.cardElevation = QMUIDisplayHelper.dpToPx(4).toFloat()
|
||||
} else {
|
||||
imageView.setImageResource(item.imageId)
|
||||
cardView.cardElevation = 0f
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.baselibrary.util.Utils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.WiFiBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.widget.MyWiFiSignalView
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/3/26/026.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
class WiFiListAdapter(
|
||||
ctx: Context, list: MutableList<WiFiBean>?
|
||||
) : BaseRecyclerAdapter<WiFiBean>(ctx, list) {
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_wifi_info_layout
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: WiFiBean) {
|
||||
// val wifiName = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
// item.wifiSsid.toString()
|
||||
// } else {
|
||||
// item.SSID
|
||||
// }
|
||||
holder!!.setText(R.id.tv_wifi_item_name, item.name)
|
||||
val signalView = holder.getView(R.id.tv_wifi_item_signal) as MyWiFiSignalView
|
||||
val signal = Utils.calculateSignalLevel(item.signal, 3)
|
||||
if (item.auth_type == ConstantInt.Type0) {
|
||||
signalView.setValue(signal)
|
||||
} else {
|
||||
signalView.setValue(signal, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.WiFiZoneBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
|
||||
/**
|
||||
*/
|
||||
class WiFiZoneAdapter(
|
||||
ctx: Context, list: MutableList<WiFiZoneBean>?, isShowArrowRight: Boolean = true
|
||||
) : BaseRecyclerAdapter<WiFiZoneBean>(ctx, list) {
|
||||
|
||||
private val isShowArrow = isShowArrowRight
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = R.layout.layout_virtual_fences_empty_view
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_wifi_zone_layout
|
||||
|
||||
override fun noData(holder: RecyclerViewHolder?) {
|
||||
holder?.apply {
|
||||
getView(R.id.btn_empty_fences_add_safe_zone).visibility =
|
||||
if (isShowNoDataAddButton) View.VISIBLE
|
||||
else View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: WiFiZoneBean) {
|
||||
holder!!.setText(R.id.tv_wifi_zone_name, item.wifiZoneName)
|
||||
holder.setText(R.id.tv_wifi_zone_address, item.address)
|
||||
val wifiZoneTypeImage =
|
||||
if (item.type == ConstantInt.Type1) R.drawable.icon_wifi_zone_type1_svg
|
||||
else R.drawable.icon_wifi_zone_type2_svg
|
||||
holder.getImageView(R.id.iv_wifi_zone_type).setBackgroundResource(wifiZoneTypeImage)
|
||||
|
||||
holder.getImageView(R.id.iv_wifi_zone_list_arrow_right).visibility =
|
||||
if (isShowArrow) View.VISIBLE
|
||||
else View.GONE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package com.abbidot.tracker.alipay
|
||||
799
app/src/main/java/com/abbidot/tracker/base/BaseActivity.kt
Normal file
799
app/src/main/java/com/abbidot/tracker/base/BaseActivity.kt
Normal file
@@ -0,0 +1,799 @@
|
||||
package com.abbidot.tracker.base
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.Window
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.abbidot.baselibrary.network.exception.ErrorCode
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.baselibrary.util.LogUtil
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.GetResultCallback
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.hjq.toast.Toaster
|
||||
import com.qmuiteam.qmui.alpha.QMUIAlphaButton
|
||||
import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
|
||||
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
||||
import com.qmuiteam.qmui.util.QMUIStatusBarHelper
|
||||
import com.qmuiteam.qmui.widget.QMUITopBar
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
|
||||
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/11/2/002.
|
||||
* @link
|
||||
* @description: Activity基类
|
||||
*/
|
||||
abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInflater) -> T) :
|
||||
AppCompatActivity(), View.OnClickListener {
|
||||
|
||||
protected lateinit var mViewBinding: T
|
||||
var mTopBar: QMUITopBar? = null
|
||||
lateinit var mContext: Context
|
||||
lateinit var mActivity: Activity
|
||||
private var mLoadingDialog: QMUITipDialog? = null
|
||||
|
||||
//默认删除去掉titleTopBar底部间隔下划线
|
||||
var mDeleteBottomDivider: Boolean = true
|
||||
|
||||
//Activity是否在前台显示运行
|
||||
var isFrontRunning = false
|
||||
|
||||
//是否需要通知上个页面更新数据
|
||||
var isNotifyUpdate = false
|
||||
|
||||
//右边图标按钮
|
||||
var mRightImageButton: QMUIAlphaImageButton? = null
|
||||
|
||||
//右边按钮
|
||||
var mRightTextButton: Button? = null
|
||||
|
||||
//网络请求失败,需要重试次数
|
||||
var mNetworkRequestsFailRetryCount = 0
|
||||
val mNetworkRequestsFailMaxCount = 3
|
||||
val mNetworkRequestsFailLimit = "networkRequestsFailLimit"
|
||||
|
||||
//是否拦截网络请求错误code提示
|
||||
var isInterceptNetErrorCodeTip = false
|
||||
|
||||
//软键盘管理
|
||||
private var mInputMethodManager: InputMethodManager? = null
|
||||
|
||||
// 监听因输入框弹出,遮挡输入框,界面移动,需要移动的view
|
||||
private var mTranslateView: View? = null
|
||||
|
||||
/*****************************监听软键盘弹出,输入框上移start************************************/
|
||||
private var isKeyboardTranslate = true
|
||||
|
||||
//是否需要适配底部EdgeToEdge
|
||||
var isEdgeToEdgeAdapterNavigationBars = true
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
isFrontRunning = true
|
||||
super.onCreate(savedInstanceState)
|
||||
mViewBinding = inflater(layoutInflater)
|
||||
mContext = this
|
||||
mActivity = this
|
||||
//禁用屏幕旋转 代码设置无效
|
||||
// requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
mViewBinding.root.apply {
|
||||
//点击屏幕页面隐藏软键盘start
|
||||
setOnClickListener {
|
||||
hideInputMethod(this)
|
||||
}
|
||||
|
||||
//判断是否是深色模式
|
||||
if (AppUtils.isDarkThemeEnabled(mContext)) {
|
||||
// 设备处于深色模式
|
||||
setBackgroundResource(R.color.gray)
|
||||
} else {
|
||||
// 设备处于浅色模式,统一设置的渐变背景色
|
||||
background = ContextCompat.getDrawable(mContext, R.drawable.v2_bg_color_gradient)
|
||||
}
|
||||
}
|
||||
setContentView(mViewBinding.root)
|
||||
mTopBar = getTopBar()
|
||||
|
||||
//拦截返回按键
|
||||
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
listenBackPressed()
|
||||
//Removing this callback
|
||||
// remove()
|
||||
// onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
})
|
||||
|
||||
initData()
|
||||
liveDataObserve()
|
||||
}
|
||||
|
||||
// 字体大小不跟随系统
|
||||
override fun attachBaseContext(newBase: Context) {
|
||||
super.attachBaseContext(getConfigurationContext(newBase))
|
||||
}
|
||||
|
||||
// 字体大小不跟随系统
|
||||
private fun getConfigurationContext(context: Context): Context {
|
||||
val configuration = context.resources.configuration
|
||||
configuration.fontScale = 1F
|
||||
return context.createConfigurationContext(configuration)
|
||||
}
|
||||
|
||||
/*
|
||||
lifecycleScope.launch {
|
||||
|
||||
Dispatchers.IO
|
||||
专为磁盘和网络IO进行了优化
|
||||
数据库-文件读写-网络处理
|
||||
Dispatchers.Default
|
||||
专为CPU密集型任务进行了优化
|
||||
数组排序 - JSON数据解析-处理差异判断
|
||||
withContext(Dispatchers.Default){
|
||||
|
||||
}
|
||||
lifecycleScope.coroutineContext
|
||||
}
|
||||
*/
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
isFrontRunning = true
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
//键盘隐藏恢复默认状态
|
||||
mTranslateView?.apply {
|
||||
scrollTo(0, 0)
|
||||
isKeyboardTranslate = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
showLoading(false)
|
||||
isFrontRunning = false
|
||||
}
|
||||
|
||||
/**
|
||||
* 没有TopBar就设置返回null
|
||||
*/
|
||||
abstract fun getTopBar(): QMUITopBar?
|
||||
|
||||
/**
|
||||
* 注册监听livedata观察者
|
||||
*/
|
||||
open fun liveDataObserve() {}
|
||||
|
||||
/**
|
||||
* open修饰的类和方法可以被子类继承和重写
|
||||
* 初始化
|
||||
*/
|
||||
open fun initData() {
|
||||
//沉浸式状态栏
|
||||
QMUIStatusBarHelper.translucent(window)
|
||||
//判断是否是深色模式
|
||||
if (AppUtils.isDarkThemeEnabled(mContext)) {
|
||||
setStatusBarDark()
|
||||
} else {
|
||||
setStatusBarLight()
|
||||
}
|
||||
mTopBar?.apply {
|
||||
//适配状态栏
|
||||
this.parent?.let {
|
||||
edgeToEdgeAdapterBars(it as View, WindowInsetsCompat.Type.statusBars())
|
||||
}
|
||||
//去掉titleTopBar底部间隔下划线
|
||||
if (mDeleteBottomDivider) updateBottomDivider(0, 0, 0, 0)
|
||||
}
|
||||
//适配底部导航栏
|
||||
if (isEdgeToEdgeAdapterNavigationBars) edgeToEdgeAdapterBars(mViewBinding.root)
|
||||
}
|
||||
|
||||
/**
|
||||
* 和 setContentView 对应的方法
|
||||
*/
|
||||
private fun getContentView(): ViewGroup {
|
||||
return findViewById(Window.ID_ANDROID_CONTENT)
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听键盘弹出和隐藏,解决键盘弹出隐藏输入框的问题
|
||||
*/
|
||||
fun setListenKeyboardChange(windowTranslateY: Int = 500, view: View = window.decorView) {
|
||||
window.decorView.viewTreeObserver.addOnGlobalLayoutListener {
|
||||
onLayoutChange(view, windowTranslateY)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置其他包含的view点击。隐藏软键盘,如ScrollView
|
||||
*/
|
||||
fun setViewClickHideInputMethod(view: View) {
|
||||
// 点击外部隐藏软键盘,提升用户体验
|
||||
view.setOnClickListener {
|
||||
hideInputMethod(view)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* edgeToEdge全面屏适配Android15 底部。防止view被菜单、状态栏遮挡
|
||||
* https://mp.weixin.qq.com/s?__biz=MzA5MzI3NjE2MA==&mid=2650286452&idx=1&sn=354b78ae82c52b6d3d510256779a3df9&scene=21&poc_token=HN91iGij_n_mGA9z9ZarQC_44XYBhBjN9N9z_w1_
|
||||
*/
|
||||
fun edgeToEdgeAdapterBars(
|
||||
view: View, typeMask: Int = WindowInsetsCompat.Type.navigationBars()
|
||||
) {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(view) { v, insets ->
|
||||
val bars = insets.getInsets(typeMask)
|
||||
v.setPadding(bars.left, bars.top, bars.right, bars.bottom)
|
||||
insets
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态颜色,有状态栏时用到,现在状态栏直接被占位
|
||||
*/
|
||||
// fun setStatusBarColor(color: Int) {
|
||||
// //这里动态修改颜色
|
||||
// window.statusBarColor = color
|
||||
// }
|
||||
|
||||
/**
|
||||
* 设置状态栏白色字体与图标
|
||||
*/
|
||||
fun setStatusBarDark() {
|
||||
QMUIStatusBarHelper.setStatusBarDarkMode(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置状态栏黑色字体与图标
|
||||
*/
|
||||
fun setStatusBarLight() {
|
||||
QMUIStatusBarHelper.setStatusBarLightMode(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置多个view的监听事件
|
||||
*/
|
||||
fun setOnClickListenerViews(vararg views: View?) {
|
||||
for (v in views) {
|
||||
v?.let {
|
||||
if (v is QMUIAlphaButton) {
|
||||
//设置按下点击透明效果
|
||||
v.setChangeAlphaWhenPress(true)
|
||||
} else if (v is QMUIAlphaImageButton) {
|
||||
//设置按下点击透明效果
|
||||
v.setChangeAlphaWhenPress(true)
|
||||
}
|
||||
v.setOnClickListener(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
// 默认不实现,让子类实现
|
||||
}
|
||||
|
||||
/**
|
||||
* 按钮开启/禁用点击
|
||||
*/
|
||||
fun setButtonEnabled(v: View, enabled: Int = ConstantInt.SpecialType) {
|
||||
when (enabled) {
|
||||
ConstantInt.SpecialType -> v.isEnabled = !v.isEnabled
|
||||
ConstantInt.Type0 -> v.isEnabled = false
|
||||
ConstantInt.Type1 -> v.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置title标题 resIdTitle
|
||||
*/
|
||||
fun setTopBarTitle(resIdTitle: Int) {
|
||||
setTopBarTitle(getString(resIdTitle))
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置透明一体化状态栏TopBarTitle,只有返回按钮
|
||||
*/
|
||||
fun setTranslucentTopBar() {
|
||||
//去掉titleTopBar背景颜色,设置TopBar背景透明
|
||||
mTopBar!!.setBackgroundAlpha(0)
|
||||
setTopBarTitle("")
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置按钮图片
|
||||
*/
|
||||
fun setLeftBackImage(@DrawableRes resId: Int) {
|
||||
mTopBar!!.removeAllLeftViews()
|
||||
val leftBtn = mTopBar!!.addLeftImageButton(resId, R.id.topbar_left_change_button)
|
||||
if (resId == 0) {
|
||||
return
|
||||
}
|
||||
leftBtn.setOnClickListener { leftBackOnClick() }
|
||||
}
|
||||
|
||||
/**
|
||||
* 需要重写返回按钮时
|
||||
*/
|
||||
open fun leftBackOnClick() {
|
||||
finish()
|
||||
}
|
||||
|
||||
/**
|
||||
* 拦截返回按键
|
||||
*/
|
||||
// override fun onBackPressed() {
|
||||
// leftBackOnClick()
|
||||
// super.onBackPressed()
|
||||
// }
|
||||
|
||||
open fun listenBackPressed() {
|
||||
leftBackOnClick()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加TopBar右边图片按钮
|
||||
*/
|
||||
fun addRightImageButton(@DrawableRes resId: Int): QMUIAlphaImageButton {
|
||||
val rightBtn = mTopBar!!.addRightImageButton(resId, R.id.topbar_right_change_button)
|
||||
setOnClickListenerViews(rightBtn)
|
||||
return rightBtn
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加TopBar右边文字按钮
|
||||
*/
|
||||
fun addRightTextButton(
|
||||
@StringRes resId: Int, textColor: Int = R.color.select_color
|
||||
): Button {
|
||||
val textButton = mTopBar!!.addRightTextButton(
|
||||
getString(resId), R.id.topbar_right_change_textview
|
||||
).apply {
|
||||
setBackgroundResource(R.drawable.selector_transparent_pressed)
|
||||
setTextColor(ContextCompat.getColor(mContext, textColor))
|
||||
setOnClickListenerViews(this)
|
||||
}
|
||||
return textButton
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置title标题titleString
|
||||
*/
|
||||
fun setTopBarTitle(title: String) {
|
||||
if (null != mTopBar) {
|
||||
if (TextUtils.isEmpty(title)) mTopBar!!.showTitleView(false)
|
||||
else {
|
||||
mTopBar!!.setTitle(title)
|
||||
val tf =
|
||||
ViewUtil.instance.setTypeface(mContext, getString(R.string.roboto_bold_font))
|
||||
mTopBar!!.titleView!!.setTypeface(tf)
|
||||
}
|
||||
mTopBar!!.addLeftBackImageButton().setOnClickListener { leftBackOnClick() }
|
||||
}
|
||||
}
|
||||
|
||||
fun isShowLoading(): Boolean {
|
||||
if (null != mLoadingDialog && mLoadingDialog!!.isShowing) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun showLoading(show: Boolean, tipsRes: Int, cancelable: Boolean = true) {
|
||||
showLoading(show, getString(tipsRes), cancelable)
|
||||
}
|
||||
|
||||
fun showLoading(show: Boolean, tip: String = "", cancelable: Boolean = true) {
|
||||
// if (!isFrontRunning) {
|
||||
// return
|
||||
// }
|
||||
// if (show) {
|
||||
// if (isShowLoading()) {
|
||||
// mLoadingDialog!!.dismiss()
|
||||
// }
|
||||
// var message = tip
|
||||
// if (TextUtils.isEmpty(tip)) {
|
||||
// message = getString(R.string.txt_loading)
|
||||
// }
|
||||
// mLoadingDialog =
|
||||
// QMUITipDialog.Builder(mContext).setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
|
||||
// .setTipWord(message).create(cancelable).apply {
|
||||
// setCanceledOnTouchOutside(false)
|
||||
// show()
|
||||
// }
|
||||
// } else {
|
||||
// mLoadingDialog?.dismiss()
|
||||
// }
|
||||
}
|
||||
|
||||
fun showNoCancelableLoading(show: Boolean) {
|
||||
if (!isFrontRunning) {
|
||||
return
|
||||
}
|
||||
if (show) {
|
||||
if (isShowLoading()) {
|
||||
mLoadingDialog!!.dismiss()
|
||||
}
|
||||
// var message = tip
|
||||
// if (TextUtils.isEmpty(tip)) {
|
||||
// }
|
||||
val message = getString(R.string.txt_loading)
|
||||
mLoadingDialog =
|
||||
QMUITipDialog.Builder(mContext).setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
|
||||
.setTipWord(message).create(false).apply {
|
||||
setCanceledOnTouchOutside(false)
|
||||
show()
|
||||
}
|
||||
} else {
|
||||
mLoadingDialog?.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示提示toast
|
||||
*/
|
||||
fun showToast(
|
||||
tip: String, isFinish: Boolean = false, gravity: Int = Gravity.BOTTOM
|
||||
// @QMUITipDialog.Builder.IconType iconType: Int = QMUITipDialog.Builder.ICON_TYPE_NOTHING
|
||||
) {
|
||||
if (gravity == Gravity.BOTTOM) Toaster.setGravity(gravity, 0, 300, 0f, 0f)
|
||||
if (isFinish) {
|
||||
// DialogUtils.showTipDialog(mContext, mViewBinding.root, tip, iconType, true)
|
||||
//activity前台显示运行才弹出
|
||||
if (isFrontRunning) {
|
||||
Toaster.show(tip)
|
||||
//根据文字长度来决定显示时间长短
|
||||
var showTime = if (AppUtils.isChina()) {
|
||||
tip.length * (1000L / 4)
|
||||
} else {
|
||||
tip.length * (1000L / 10)
|
||||
}
|
||||
if (showTime < 1000) showTime = 1500
|
||||
if (showTime > 8000) showTime = 8000
|
||||
mViewBinding.root.postDelayed({
|
||||
if (!isFinishing) {
|
||||
Toaster.cancel()
|
||||
finish()
|
||||
}
|
||||
}, showTime)
|
||||
}
|
||||
} else {
|
||||
Toaster.show(tip)
|
||||
}
|
||||
}
|
||||
|
||||
fun showToast(
|
||||
resIdString: Int, isFinish: Boolean = false, gravity: Int = Gravity.BOTTOM
|
||||
// @QMUITipDialog.Builder.IconType iconType: Int = QMUITipDialog.Builder.ICON_TYPE_NOTHING
|
||||
) {
|
||||
showToast(getString(resIdString), isFinish, gravity)
|
||||
}
|
||||
|
||||
fun hideFragment(fragmentTransaction: FragmentTransaction, fragment: Fragment) {
|
||||
if (fragment.isAdded) {
|
||||
fragmentTransaction.hide(fragment)
|
||||
}
|
||||
}
|
||||
|
||||
override fun finish() {
|
||||
super.finish()
|
||||
overridePendingTransition(R.anim.slide_still, R.anim.slide_out_right)
|
||||
}
|
||||
|
||||
override fun startActivity(intent: Intent) {
|
||||
super.startActivity(intent)
|
||||
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left)
|
||||
}
|
||||
|
||||
fun startActivityFinish(intent: Intent) {
|
||||
startActivity(intent)
|
||||
super.finish()
|
||||
}
|
||||
|
||||
override fun startActivity(intent: Intent, options: Bundle?) {
|
||||
super.startActivity(intent, options)
|
||||
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left)
|
||||
}
|
||||
|
||||
/**
|
||||
* onActivityResult 替换跳转方法
|
||||
*/
|
||||
fun launchActivity(activityResultLauncher: ActivityResultLauncher<Intent>, intent: Intent) {
|
||||
activityResultLauncher.launch(intent)
|
||||
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left)
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一处理网络请求结果
|
||||
*/
|
||||
fun <T> dealRequestResult(
|
||||
it: Result<T>,
|
||||
getResultCallback: GetResultCallback,
|
||||
showLoading: Boolean = false,
|
||||
isShowNoDataTip: Boolean = true,
|
||||
isShowRequestErrorTip: Boolean = true,
|
||||
errorTip: String = getString(R.string.txt_net_error)
|
||||
) {
|
||||
try {
|
||||
showLoading(showLoading)
|
||||
//服务器返回错误信息
|
||||
val exceptionMessage = it.exceptionOrNull()?.message
|
||||
//服务器返回错误code
|
||||
val exceptionCode: String? = it.exceptionOrNull()?.toString()
|
||||
LogUtil.d("Throwable?", "code=${exceptionCode},${exceptionMessage}")
|
||||
if (null != exceptionCode) {
|
||||
//处理注册用户已存在的情况
|
||||
if (exceptionCode == ErrorCode.USER_HAS_EXIST.toString()) {
|
||||
getResultCallback.onRequestError(exceptionCode)
|
||||
}
|
||||
//拦截请求异常code
|
||||
if (netErrorCodeTips(exceptionCode)) {
|
||||
//已经处理相关错误码就直接返回
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
val data = it.getOrNull()
|
||||
if (null == data) {
|
||||
if (isShowRequestErrorTip) showToast(errorTip)
|
||||
if (mNetworkRequestsFailRetryCount < mNetworkRequestsFailMaxCount) {
|
||||
mNetworkRequestsFailRetryCount++
|
||||
getResultCallback.onRequestError(exceptionCode)
|
||||
} else {
|
||||
//请求次数上限
|
||||
getResultCallback.onRequestError(mNetworkRequestsFailLimit)
|
||||
}
|
||||
} else {
|
||||
mNetworkRequestsFailRetryCount = 0
|
||||
if (isShowNoDataTip && data is MutableList<*> && data.size == 0) {
|
||||
showToast(R.string.no_data)
|
||||
}
|
||||
//不做强制类型转换
|
||||
getResultCallback.onResult(0)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
LogUtil.e("接口出错造成的异常:${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 网络请求错误code提示
|
||||
*/
|
||||
private fun netErrorCodeTips(exceptionCode: String): Boolean {
|
||||
//设备已过期,请续费
|
||||
when (exceptionCode) {
|
||||
ErrorCode.DEVICE_RENEWAL.toString() -> {
|
||||
showToast(R.string.txt_device_renewal)
|
||||
return true
|
||||
}
|
||||
//TOKEN失效或者过期
|
||||
ErrorCode.TOKEN_OVERDUE.toString() -> {
|
||||
showToast(R.string.txt_token_overdue)
|
||||
return true
|
||||
}
|
||||
//用户名或密码错误
|
||||
ErrorCode.USER_PASSWORD_ERROR.toString() -> {
|
||||
showToast(R.string.txt_user_password_error, gravity = Gravity.CENTER)
|
||||
return true
|
||||
}
|
||||
//验证码错误
|
||||
ErrorCode.VERIFY_CODE_ERROR.toString() -> {
|
||||
showToast(R.string.txt_verify_code_error, gravity = Gravity.CENTER)
|
||||
return true
|
||||
}
|
||||
//验证码已过期
|
||||
ErrorCode.VERIFY_CODE_EXPIRE.toString() -> {
|
||||
showToast(R.string.txt_verify_code_expire, gravity = Gravity.CENTER)
|
||||
return true
|
||||
}
|
||||
//注册失败
|
||||
ErrorCode.REGISTER_FAIL.toString() -> {
|
||||
showToast(R.string.txt_register_fail, gravity = Gravity.CENTER)
|
||||
return true
|
||||
}
|
||||
//用户不存在
|
||||
ErrorCode.USER_NO_EXIST.toString() -> {
|
||||
showToast(R.string.txt_user_no_exist, gravity = Gravity.CENTER)
|
||||
return true
|
||||
}
|
||||
//用户已存在
|
||||
ErrorCode.USER_HAS_EXIST.toString() -> {
|
||||
if (!isInterceptNetErrorCodeTip) {
|
||||
showToast(R.string.txt_user_has_exist, gravity = Gravity.BOTTOM)
|
||||
}
|
||||
return true
|
||||
}
|
||||
//邮箱格式不对
|
||||
ErrorCode.EMAIL_FORMAT_ERROR.toString() -> {
|
||||
showToast(R.string.txt_email_format_error, gravity = Gravity.CENTER)
|
||||
return true
|
||||
}
|
||||
//不能分享给自己
|
||||
ErrorCode.NO_SHARE_MYSELF.toString() -> {
|
||||
showToast(R.string.txt_no_share_myself)
|
||||
return true
|
||||
}
|
||||
//当前用户已经绑定该设备
|
||||
ErrorCode.DEVICE_HAS_BOUND.toString() -> {
|
||||
showToast(R.string.txt_device_has_bound)
|
||||
return true
|
||||
}
|
||||
//该设备已被绑定
|
||||
ErrorCode.DEVICE_HAS_BIND.toString() -> {
|
||||
showToast(R.string.txt_device_has_bind)
|
||||
return true
|
||||
}
|
||||
//设备不存在
|
||||
ErrorCode.DEVICE_NOT_EXIST.toString() -> {
|
||||
showToast(R.string.txt_no_dfu)
|
||||
return true
|
||||
}
|
||||
|
||||
else -> return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听软键盘隐藏
|
||||
*/
|
||||
open fun listenHideKeyboard() {}
|
||||
|
||||
/******************************点击屏幕页面隐藏软键盘start**************************************/
|
||||
// override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
|
||||
// if (ev.action == MotionEvent.ACTION_DOWN) {
|
||||
// val v = currentFocus
|
||||
// v?.let {
|
||||
// //如果搜索框内没有输入,隐藏键盘时则返回Contacts页面
|
||||
// if (isShouldHideKeyboard(v, ev)) {
|
||||
// if (hideInputMethod(it)) {
|
||||
// LogUtil.e("dispatchTouchEvent-->listenHideKeyboard,隐藏键盘")
|
||||
// listenHideKeyboard()
|
||||
// //这里可以执行隐藏需要执行的任务;
|
||||
// //隐藏键盘时,其他控件不响应点击事件==》注释则不拦截点击事件
|
||||
// //不拦截事件,按钮需要事件
|
||||
//// return true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return super.dispatchTouchEvent(ev)
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取InputMethodManager
|
||||
*/
|
||||
private fun getInputMethodManager(): InputMethodManager? {
|
||||
if (null == mInputMethodManager) mInputMethodManager =
|
||||
getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
return mInputMethodManager
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏软键盘
|
||||
*/
|
||||
fun hideInputMethod(view: View): Boolean {
|
||||
getInputMethodManager()?.apply {
|
||||
return hideSoftInputFromWindow(view.windowToken, 0)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出软键盘
|
||||
*/
|
||||
fun showInputMethod(view: View) {
|
||||
getInputMethodManager()?.apply {
|
||||
showSoftInput(view, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据EditText所在坐标和用户点击的坐标相对比,来判断是否隐藏键盘,因为当用户点击EditText时则不能隐藏
|
||||
*/
|
||||
private fun isShouldHideKeyboard(v: View?, ev: MotionEvent): Boolean {
|
||||
if (v != null && (v is EditText)) {
|
||||
val l = intArrayOf(0, 0)
|
||||
v.getLocationInWindow(l)
|
||||
val left = l[0]
|
||||
val top = l[1]
|
||||
val bottom = top + v.getHeight()
|
||||
val right = left + v.getWidth()
|
||||
return !(ev.x > left && ev.x < right && ev.y > top && ev.y < bottom)
|
||||
}
|
||||
// 如果焦点不是EditText则忽略,这个发生在视图刚绘制完,第一个焦点不在EditText上,和用户用轨迹球选择其他的焦点
|
||||
return false
|
||||
}
|
||||
|
||||
/******************************点击屏幕页面隐藏软键盘end**************************************/
|
||||
|
||||
|
||||
/**
|
||||
* 软键盘显示
|
||||
*/
|
||||
open fun showSoftKeyboardCallback() {
|
||||
LogUtil.e("监听重写软键盘弹出")
|
||||
}
|
||||
|
||||
/**
|
||||
* 软键盘隐藏
|
||||
*/
|
||||
open fun hideSoftKeyboardCallback() {
|
||||
LogUtil.e("监听重写软键盘隐藏")
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取导航栏高度
|
||||
*/
|
||||
private fun getNavigatorBarHeight(): Int {
|
||||
// val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
|
||||
// val height = resources.getDimensionPixelSize(resourceId)
|
||||
return QMUIDisplayHelper.getNavMenuHeight(mContext)
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听因输入框弹出,遮挡输入框,界面移动
|
||||
* @param translateView 需要移动的view
|
||||
* @param translateY 移动的坐标点
|
||||
*/
|
||||
private fun onLayoutChange(translateView: View, translateY: Int) {
|
||||
mTranslateView = translateView
|
||||
//获取当前屏幕内容的高度
|
||||
val screenHeight = window.decorView.height
|
||||
//获取View可见区域的bottom
|
||||
val rect = Rect()
|
||||
window.decorView.getWindowVisibleDisplayFrame(rect)
|
||||
if (screenHeight - getNavigatorBarHeight() > rect.bottom) {
|
||||
// 获取按钮的左上角,按钮高度为40dp
|
||||
// val location = IntArray(2)
|
||||
// translateView.getLocationOnScreen(location)
|
||||
// val bottom = location[1] + resources.getDimensionPixelSize(R.dimen.dp_80)
|
||||
//// 如果按钮被覆盖,移动整个界面向上移动
|
||||
// if (bottom > rect.bottom) {
|
||||
// window.decorView.scrollBy(0, bottom - rect.bottom)
|
||||
// isKeyboardTranslate = true
|
||||
// }
|
||||
if (!isKeyboardTranslate) {
|
||||
//移动到指定位置点坐标
|
||||
translateView.scrollBy(0, translateY)
|
||||
isKeyboardTranslate = true
|
||||
}
|
||||
LogUtil.e("软键盘弹出")
|
||||
showSoftKeyboardCallback()
|
||||
} else {
|
||||
LogUtil.e("隐藏软键盘")
|
||||
if (isKeyboardTranslate) {
|
||||
translateView.scrollTo(0, 0)
|
||||
isKeyboardTranslate = false
|
||||
}
|
||||
hideSoftKeyboardCallback()
|
||||
}
|
||||
}
|
||||
/*****************************监听软键盘弹出,输入框上移end************************************/
|
||||
}
|
||||
96
app/src/main/java/com/abbidot/tracker/base/BaseDialog.kt
Normal file
96
app/src/main/java/com/abbidot/tracker/base/BaseDialog.kt
Normal file
@@ -0,0 +1,96 @@
|
||||
package com.abbidot.tracker.base
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.View.OnClickListener
|
||||
import android.view.WindowManager
|
||||
import androidx.annotation.StyleRes
|
||||
import androidx.appcompat.app.AppCompatDialog
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.tracker.R
|
||||
import com.qmuiteam.qmui.alpha.QMUIAlphaButton
|
||||
import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
|
||||
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/1/11/011.-
|
||||
* @link
|
||||
* @dialogHeightDp 默认高度350dp
|
||||
* @description:BaseDialog
|
||||
*/
|
||||
abstract class BaseDialog<T : ViewBinding>
|
||||
(
|
||||
val inflater: (inflater: LayoutInflater) -> T,
|
||||
context: Context,
|
||||
dialogHeightDp: Int = 0,
|
||||
@StyleRes animationResId: Int = R.style.QMUI_Animation_Scale,
|
||||
@StyleRes themeResId: Int = R.style.my_Dialog_shadow_style
|
||||
) : AppCompatDialog(context, themeResId), OnClickListener {
|
||||
|
||||
protected lateinit var mViewBinding: T
|
||||
|
||||
val mContext = context
|
||||
|
||||
private val mAnimationResId = animationResId
|
||||
private val mDialogHeightDp = dialogHeightDp
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mViewBinding = inflater(layoutInflater)
|
||||
setContentView(mViewBinding.root)
|
||||
//设置Dialog动画
|
||||
window!!.setWindowAnimations(mAnimationResId)
|
||||
//设置弹窗的高度
|
||||
val layoutParams: WindowManager.LayoutParams = window!!.attributes
|
||||
if (mDialogHeightDp == 0) {
|
||||
//采用自适应高度
|
||||
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
} else {
|
||||
layoutParams.height = AppUtils.dpToPx(mDialogHeightDp)
|
||||
}
|
||||
// layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
window!!.attributes = layoutParams
|
||||
|
||||
initView()
|
||||
}
|
||||
|
||||
abstract fun initView()
|
||||
|
||||
/**
|
||||
* 设置多个view的监听事件
|
||||
*/
|
||||
fun setOnClickListenerViews(vararg views: View?) {
|
||||
for (v in views) {
|
||||
v?.let {
|
||||
if (v is QMUIAlphaButton) {
|
||||
//设置按下点击透明效果
|
||||
v.setChangeAlphaWhenPress(true)
|
||||
} else if (v is QMUIAlphaImageButton) {
|
||||
//设置按下点击透明效果
|
||||
v.setChangeAlphaWhenPress(true)
|
||||
}
|
||||
v.setOnClickListener(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
// 默认不实现,让子类实现
|
||||
}
|
||||
|
||||
interface OnDialogOkListener {
|
||||
fun onOkClick(dialog: BaseDialog<*>)
|
||||
}
|
||||
|
||||
interface OnDialogSelectListener {
|
||||
fun onSelectClick(dialog: BaseDialog<*>, any: Any)
|
||||
}
|
||||
|
||||
interface OnDialogCancelListener {
|
||||
fun onCancelClick(dialog: BaseDialog<*>)
|
||||
}
|
||||
}
|
||||
|
||||
14
app/src/main/java/com/abbidot/tracker/base/BaseDiffBean.kt
Normal file
14
app/src/main/java/com/abbidot/tracker/base/BaseDiffBean.kt
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.abbidot.tracker.base
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/4/20/020.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
abstract class BaseDiffBean {
|
||||
// 判断当前对象和给定对象是否是同一对象
|
||||
abstract fun isSameObject(other: Any): Boolean
|
||||
|
||||
// 判断当前对象和给定对象是否拥有相同内容
|
||||
abstract fun hasSameContent(other: Any): Boolean
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.abbidot.tracker.base
|
||||
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/11/12/012.
|
||||
* @link
|
||||
* @description: DiffUtil基类封装
|
||||
*/
|
||||
open class BaseDiffCallBack<T>(oldList: MutableList<T>?, newList: MutableList<T>?) :
|
||||
DiffUtil.Callback() {
|
||||
|
||||
private var mOldList: MutableList<T>? = oldList
|
||||
private var mNewList: MutableList<T>? = newList
|
||||
|
||||
override fun getOldListSize() = if (mOldList == null) {
|
||||
0
|
||||
} else mOldList!!.size
|
||||
|
||||
override fun getNewListSize() = if (mNewList == null) {
|
||||
0
|
||||
} else mNewList!!.size
|
||||
|
||||
/**
|
||||
* 判断新旧item是否是同一个item,最好以唯一不变的id作比较
|
||||
*/
|
||||
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
|
||||
// if (null == mNewList || null == mOldList) return false
|
||||
val newItem = mNewList!![newItemPosition]
|
||||
if (newItem is BaseDiffBean) {
|
||||
return newItem.isSameObject(mOldList!![oldItemPosition]!!)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* 是同一个item。然后比较新旧item的内容是否一样
|
||||
*/
|
||||
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
|
||||
val newItem = mNewList!![newItemPosition]
|
||||
if (newItem is BaseDiffBean) {
|
||||
return newItem.hasSameContent(mOldList!![oldItemPosition]!!)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 局部刷新比较,只更新某个item
|
||||
*/
|
||||
override fun getChangePayload(oldItemPosition: Int, newItemPosition: Int): Any? {
|
||||
val newDeviceBean = mNewList?.get(newItemPosition)
|
||||
if (!areContentsTheSame(oldItemPosition, newItemPosition)) {
|
||||
return newDeviceBean
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
167
app/src/main/java/com/abbidot/tracker/base/BaseFragment.kt
Normal file
167
app/src/main/java/com/abbidot/tracker/base/BaseFragment.kt
Normal file
@@ -0,0 +1,167 @@
|
||||
package com.abbidot.tracker.base
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.abbidot.baselibrary.util.LogUtil
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.constant.GetResultCallback
|
||||
import com.qmuiteam.qmui.alpha.QMUIAlphaButton
|
||||
import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/11/2/002.
|
||||
* @link
|
||||
* @description:Fragment基类
|
||||
* 关于@JvmOverloads constructor说明 https://stackoverflow.com/questions/34469487/caused-by-java-lang-nosuchmethodexception-init-class-android-content-contex
|
||||
*/
|
||||
abstract class BaseFragment<T : ViewBinding>(
|
||||
val inflater: (inflater: LayoutInflater, container: ViewGroup?, attachToRoot: Boolean) -> T
|
||||
) : Fragment(), View.OnClickListener {
|
||||
|
||||
protected lateinit var mViewBinding: T
|
||||
var mActivity: Activity? = null
|
||||
var mContext: Context? = null
|
||||
var mLoadingDialog: QMUITipDialog? = null
|
||||
|
||||
/**
|
||||
* Fragment中嵌套子Fragment时,如果父Fragment被销毁而子Fragment未被销毁,会导致子Fragment的视图不再显示
|
||||
*/
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
savedInstanceState?.remove("android:support:fragments")
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
mViewBinding = this.inflater(inflater, container, false)
|
||||
LogUtil.e("${javaClass.simpleName},onCreateView")
|
||||
return mViewBinding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mActivity = activity
|
||||
mContext = context
|
||||
//统一设置的渐变背景色
|
||||
mViewBinding.root.background =
|
||||
ContextCompat.getDrawable(mContext!!, R.drawable.v2_bg_color_gradient)
|
||||
LogUtil.e("${javaClass.simpleName},onViewCreated")
|
||||
initData()
|
||||
liveDataObserve()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 注册监听livedata观察者
|
||||
*/
|
||||
open fun liveDataObserve() {}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
open fun initData() {}
|
||||
|
||||
fun showLoading(show: Boolean, tip: String = "", cancelable: Boolean = true) {
|
||||
(activity as BaseActivity<*>).showLoading(show, tip, cancelable)
|
||||
}
|
||||
|
||||
fun showLoading(show: Boolean) {
|
||||
(activity as BaseActivity<*>).showLoading(show)
|
||||
}
|
||||
|
||||
fun showNoCancelableLoading(show: Boolean) {
|
||||
(activity as BaseActivity<*>).showNoCancelableLoading(show)
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示提示toast
|
||||
*/
|
||||
fun showToast(
|
||||
tip: String, isFinish: Boolean = false, gravity: Int = Gravity.BOTTOM
|
||||
) {
|
||||
// DialogUtils.showTipDialog(mContext!!, mViewBinding.root, tip, iconType, isFinish = isFinish)
|
||||
(activity as BaseActivity<*>).showToast(tip, isFinish, gravity)
|
||||
}
|
||||
|
||||
fun showToast(
|
||||
resIdString: Int, isFinish: Boolean = false, gravity: Int = Gravity.BOTTOM
|
||||
) {
|
||||
// showToast(getString(resIdString), isFinish, iconType)
|
||||
(activity as BaseActivity<*>).showToast(resIdString, isFinish, gravity)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置多个view的监听事件
|
||||
*/
|
||||
fun setOnClickListenerViews(vararg views: View?) {
|
||||
for (v in views) {
|
||||
v?.let {
|
||||
if (v is QMUIAlphaButton) {
|
||||
//设置按下点击透明效果
|
||||
v.setChangeAlphaWhenPress(true)
|
||||
} else if (v is QMUIAlphaImageButton) {
|
||||
//设置按下点击透明效果
|
||||
v.setChangeAlphaWhenPress(true)
|
||||
}
|
||||
v.setOnClickListener(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
// 默认不实现,让子类实现
|
||||
}
|
||||
|
||||
fun finish(activity: Activity) {
|
||||
(activity as BaseActivity<*>).finish()
|
||||
}
|
||||
|
||||
fun startActivity(activity: Activity, intent: Intent) {
|
||||
(activity as BaseActivity<*>).startActivity(intent)
|
||||
}
|
||||
|
||||
fun startActivityFinish(activity: Activity, intent: Intent) {
|
||||
(activity as BaseActivity<*>).startActivityFinish(intent)
|
||||
}
|
||||
|
||||
fun startActivity(activity: Activity, intent: Intent, options: Bundle?) {
|
||||
(activity as BaseActivity<*>).startActivity(intent, options)
|
||||
}
|
||||
|
||||
/**
|
||||
* onActivityResult 替换跳转方法
|
||||
*/
|
||||
fun launchActivity(
|
||||
activity: Activity, activityResultLauncher: ActivityResultLauncher<Intent>, intent: Intent
|
||||
) {
|
||||
(activity as BaseActivity<*>).launchActivity(activityResultLauncher, intent)
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一处理网络请求结果
|
||||
*/
|
||||
fun <T> dealRequestResult(
|
||||
it: Result<T>,
|
||||
getResultCallback: GetResultCallback,
|
||||
showLoading: Boolean = false,
|
||||
isShowNoDataTip: Boolean = true,
|
||||
isRequestErrorTip: Boolean = true,
|
||||
errorTip: String = getString(R.string.txt_net_error)
|
||||
) {
|
||||
(activity as BaseActivity<*>).dealRequestResult(
|
||||
it, getResultCallback, showLoading, isShowNoDataTip, isRequestErrorTip, errorTip
|
||||
)
|
||||
}
|
||||
}
|
||||
195
app/src/main/java/com/abbidot/tracker/base/BaseMapCommon.kt
Normal file
195
app/src/main/java/com/abbidot/tracker/base/BaseMapCommon.kt
Normal file
@@ -0,0 +1,195 @@
|
||||
package com.abbidot.tracker.base
|
||||
|
||||
import android.content.Context
|
||||
import com.abbidot.baselibrary.constant.MMKVKey
|
||||
import com.abbidot.baselibrary.util.MMKVUtil
|
||||
import com.abbidot.tracker.bean.FencesBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.ui.fragment.map.baidumap.BaseBaiduMapFragment
|
||||
import com.abbidot.tracker.ui.fragment.map.googlemap.BaseGoogleMapFragment
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.baidu.mapapi.utils.DistanceUtil
|
||||
import com.google.android.gms.maps.model.LatLng
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/5/10/010.
|
||||
* @link
|
||||
* @description:重复调用方法写在这个类中
|
||||
*/
|
||||
open class BaseMapCommon {
|
||||
|
||||
/**
|
||||
* 地图是否加载好了,准备好了
|
||||
*/
|
||||
fun isMapLoadOk(
|
||||
baiduMapFragment: BaseBaiduMapFragment?, googleMapFragment: BaseGoogleMapFragment?
|
||||
): Boolean {
|
||||
var loadOK = false
|
||||
if (null != baiduMapFragment) {
|
||||
loadOK = baiduMapFragment.isMapLoadOk
|
||||
} else if (null != googleMapFragment) {
|
||||
loadOK = googleMapFragment.isMapLoadOk
|
||||
}
|
||||
return loadOK
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始每隔几秒刷新用户位置
|
||||
*/
|
||||
fun startRefreshUserLocation(
|
||||
baiduMapFragment: BaseBaiduMapFragment?, googleMapFragment: BaseGoogleMapFragment?
|
||||
) {
|
||||
googleMapFragment?.getLastLocation()
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换地图类型
|
||||
*/
|
||||
fun switchSatelliteAndNormalMapType(
|
||||
baiduMapFragment: BaseBaiduMapFragment?, googleMapFragment: BaseGoogleMapFragment?
|
||||
) {
|
||||
val mapTypeSp = Util.getMapTypeSp()
|
||||
if (mapTypeSp == ConstantInt.Type0) {
|
||||
MMKVUtil.putInt(MMKVKey.MapType, ConstantInt.Type1)
|
||||
} else {
|
||||
MMKVUtil.putInt(MMKVKey.MapType, ConstantInt.Type0)
|
||||
}
|
||||
if (null != baiduMapFragment) {
|
||||
baiduMapFragment.switchSatelliteAndNormalMapType()
|
||||
} else googleMapFragment?.switchSatelliteAndNormalMapType()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置宠物当前经纬度和头像
|
||||
*/
|
||||
fun setPetHeadAndCurrentLocation(
|
||||
petHeadUrl: String,
|
||||
petType: Int,
|
||||
lat: Double,
|
||||
lon: Double,
|
||||
baiduMapFragment: BaseBaiduMapFragment?,
|
||||
googleMapFragment: BaseGoogleMapFragment?
|
||||
) {
|
||||
if (null != googleMapFragment) {
|
||||
googleMapFragment.setPetCurrentLocation(petHeadUrl, lat, lon, petType)
|
||||
} else baiduMapFragment?.setPetCurrentLocation(petHeadUrl, lat, lon)
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换用户和宠物的位置居中显示
|
||||
*/
|
||||
fun switchShowLocationType(
|
||||
@ConstantInt type: Int,
|
||||
baiduMapFragment: BaseBaiduMapFragment?,
|
||||
googleMapFragment: BaseGoogleMapFragment?
|
||||
) {
|
||||
if (null != baiduMapFragment) {
|
||||
baiduMapFragment.switchShowLocation(type)
|
||||
} else googleMapFragment?.switchShowLocation(type)
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换用户、宠物和第三方的位置(围栏或者wifi zone)居中显示
|
||||
*/
|
||||
fun switchShowLocationType(
|
||||
@ConstantInt type: Int,
|
||||
lat: Double,
|
||||
lon: Double,
|
||||
baiduMapFragment: BaseBaiduMapFragment?,
|
||||
googleMapFragment: BaseGoogleMapFragment?
|
||||
) {
|
||||
if (null != baiduMapFragment) {
|
||||
if (type == ConstantInt.OtherLocationType) {
|
||||
baiduMapFragment.moveCameraLocation(lat, lon)
|
||||
} else {
|
||||
baiduMapFragment.switchShowLocation(type)
|
||||
}
|
||||
} else if (null != googleMapFragment) {
|
||||
if (type == ConstantInt.OtherLocationType) {
|
||||
googleMapFragment.moveCameraUpdate(lat, lon)
|
||||
} else {
|
||||
googleMapFragment.switchShowLocation(type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据预览围栏类型设置地图等级
|
||||
* @param padding 距离屏幕边缘的距离,px单位
|
||||
*/
|
||||
fun restoreFencesSetMapZoom(
|
||||
context: Context,
|
||||
fencesBean: FencesBean,
|
||||
baiduMapFragment: BaseBaiduMapFragment?,
|
||||
googleMapFragment: BaseGoogleMapFragment?,
|
||||
padding: Int
|
||||
) {
|
||||
fencesBean.apply {
|
||||
when (fenceShapeType) {
|
||||
ConstantInt.CircleShapeType -> {
|
||||
googleMapFragment?.apply {
|
||||
setLatLngZoom(
|
||||
context,
|
||||
padding,
|
||||
LatLng(ancillaryLatitude, ancillaryLongitude),
|
||||
LatLng(ancillaryOtherLatitude, ancillaryOtherLongitude)
|
||||
)
|
||||
}
|
||||
baiduMapFragment?.apply {
|
||||
setBaiduMapZoom(getDistanceZoom(radius.toDouble()) + 1)
|
||||
}
|
||||
}
|
||||
|
||||
ConstantInt.RectangleShapeType -> {
|
||||
googleMapFragment?.setLatLngZoom(
|
||||
context,
|
||||
padding,
|
||||
LatLng(latitudeA, longitudeA),
|
||||
LatLng(latitudeB, longitudeB),
|
||||
LatLng(latitudeC, longitudeC),
|
||||
LatLng(latitudeD, longitudeD)
|
||||
)
|
||||
baiduMapFragment?.apply {
|
||||
setBaiduMapZoom(
|
||||
getDistanceZoom(
|
||||
maxOf(
|
||||
shortDistance, longDistance
|
||||
).toDouble()
|
||||
) + 1
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
ConstantInt.PolygonShapeType -> {
|
||||
googleMapFragment?.setLatLngZoom(
|
||||
context,
|
||||
padding,
|
||||
LatLng(latitudeA, longitudeA),
|
||||
LatLng(latitudeB, longitudeB),
|
||||
LatLng(latitudeC, longitudeC),
|
||||
LatLng(latitudeD, longitudeD),
|
||||
LatLng(latitudeE, longitudeE),
|
||||
LatLng(latitudeF, longitudeF),
|
||||
)
|
||||
baiduMapFragment?.apply {
|
||||
val minLat =
|
||||
minOf(latitudeA, latitudeB, latitudeC, latitudeD, latitudeE, latitudeF)
|
||||
val maxLat =
|
||||
minOf(latitudeA, latitudeB, latitudeC, latitudeD, latitudeE, latitudeF)
|
||||
val minLon = minOf(
|
||||
longitudeA, longitudeB, longitudeC, longitudeD, longitudeE, longitudeF
|
||||
)
|
||||
val maxLon = minOf(
|
||||
longitudeA, longitudeB, longitudeC, longitudeD, longitudeE, longitudeF
|
||||
)
|
||||
val distance = DistanceUtil.getDistance(
|
||||
getBaiduMapLatLng(minLat, minLon), getBaiduMapLatLng(maxLat, maxLon)
|
||||
)
|
||||
setBaiduMapZoom(getDistanceZoom(distance))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.abbidot.tracker.base
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.qmuiteam.qmui.recyclerView.QMUIRVItemSwipeAction
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/11/22/022.
|
||||
* @link
|
||||
* @description: QMUIRVItemSwipeAction.Callback
|
||||
*/
|
||||
abstract class BaseQMUIRVItemSwipeAction(swipeDirection: Int) : QMUIRVItemSwipeAction.Callback() {
|
||||
|
||||
private val mSwipeDirection = swipeDirection
|
||||
|
||||
abstract fun removeItem(position: Int)
|
||||
|
||||
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
|
||||
removeItem(viewHolder.adapterPosition)
|
||||
}
|
||||
|
||||
override fun getSwipeDirection(recyclerView: RecyclerView,
|
||||
viewHolder: RecyclerView.ViewHolder): Int {
|
||||
return mSwipeDirection
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.abbidot.tracker.base
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.qmuiteam.qmui.recyclerView.QMUISwipeAction
|
||||
import com.qmuiteam.qmui.recyclerView.QMUISwipeAction.ActionBuilder
|
||||
import com.qmuiteam.qmui.recyclerView.QMUISwipeViewHolder
|
||||
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
||||
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/11/20/020.
|
||||
* @link
|
||||
* @description:带有滑动删除菜单列表适配器,配合DiffUtil使用取消notifyDataSetChanged()方法
|
||||
*/
|
||||
abstract class BaseSwipeMenuAdapter<T>(context: Context, list: MutableList<T>) :
|
||||
RecyclerView.Adapter<QMUISwipeViewHolder>() {
|
||||
|
||||
private var mData: MutableList<T> = list
|
||||
private val mContext: Context = context
|
||||
private val mInflater: LayoutInflater = LayoutInflater.from(context)
|
||||
|
||||
private var mClickListener: BaseRecyclerAdapter.OnItemClickListener? = null
|
||||
private var mLongClickListener: BaseRecyclerAdapter.OnItemLongClickListener? = null
|
||||
|
||||
// 是否显示空布局,默认显示
|
||||
private var showEmptyView = true
|
||||
|
||||
//重试事件
|
||||
private var mAgainClickListener: BaseRecyclerAdapter.OnAgainClickListener? = null
|
||||
|
||||
/**
|
||||
* viewType--分别为item以及空view
|
||||
*/
|
||||
private val mViewTypeEmpty = 0
|
||||
private val mViewTypeItem = 1
|
||||
|
||||
//菜单样式Builder
|
||||
var mActionBuilder: ActionBuilder =
|
||||
ActionBuilder().textSize(QMUIDisplayHelper.sp2px(context, 14)).textColor(Color.WHITE)
|
||||
.paddingStartEnd(QMUIDisplayHelper.dp2px(context, 14))
|
||||
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QMUISwipeViewHolder {
|
||||
//空布局
|
||||
if (getEmptyLayoutId(viewType) != 0 && viewType == mViewTypeEmpty) {
|
||||
val itemView: View = mInflater.inflate(getEmptyLayoutId(viewType), parent, false)
|
||||
val swipeViewHolder = QMUISwipeViewHolder(itemView)
|
||||
if (null != mAgainClickListener) {
|
||||
itemView.setOnClickListener {
|
||||
showEmptyView(false)
|
||||
mAgainClickListener!!.onAgainListener()
|
||||
}
|
||||
}
|
||||
return swipeViewHolder
|
||||
} else {
|
||||
val itemView: View = mInflater.inflate(getItemLayoutId(viewType), parent, false)
|
||||
val swipeViewHolder = QMUISwipeViewHolder(itemView)
|
||||
//添加滑动菜单
|
||||
for (swipeAction in getSwipeActions()) {
|
||||
swipeViewHolder.addSwipeAction(swipeAction)
|
||||
}
|
||||
if (null != mClickListener) {
|
||||
itemView.setOnClickListener {
|
||||
mClickListener!!.onItemClick(itemView, swipeViewHolder.adapterPosition)
|
||||
}
|
||||
}
|
||||
if (null != mLongClickListener) {
|
||||
itemView.setOnLongClickListener {
|
||||
mLongClickListener!!.onItemLongClick(itemView, swipeViewHolder.adapterPosition)
|
||||
true
|
||||
}
|
||||
}
|
||||
return swipeViewHolder
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: QMUISwipeViewHolder, position: Int) {
|
||||
if (mData.size > 0) bindData(holder, position, mData[position])
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是空布局
|
||||
*/
|
||||
private fun isEmptyPosition(position: Int): Boolean {
|
||||
val count = mData.size
|
||||
return position == 0 && showEmptyView && count == 0
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置空布局显示。默认显示
|
||||
*/
|
||||
private fun showEmptyView(isShow: Boolean) {
|
||||
if (isShow != showEmptyView) {
|
||||
showEmptyView = isShow
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = if (mData.size == 0 && showEmptyView) 1 else mData.size
|
||||
|
||||
override fun getItemViewType(position: Int) =
|
||||
if (isEmptyPosition(position)) mViewTypeEmpty else mViewTypeItem
|
||||
|
||||
fun setData(list: MutableList<T>?) {
|
||||
if (list != null) {
|
||||
mData = list
|
||||
//出现没有数据就显示空布局
|
||||
if (mData.size == 0) {
|
||||
showEmptyView(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getData() = mData
|
||||
|
||||
fun remove(oldList: MutableList<T>, pos: Int): MutableList<T> {
|
||||
val newList: MutableList<T> = oldList.toMutableList()
|
||||
newList.removeAt(pos)
|
||||
return newList
|
||||
}
|
||||
|
||||
fun getItem(pos: Int) = mData[pos]
|
||||
|
||||
/**
|
||||
* 设置显示空布局 等于0不显示空布局
|
||||
*/
|
||||
abstract fun getEmptyLayoutId(viewType: Int): Int
|
||||
|
||||
//菜单集合
|
||||
abstract fun getSwipeActions(): MutableList<QMUISwipeAction>
|
||||
abstract fun getItemLayoutId(viewType: Int): Int
|
||||
abstract fun bindData(holder: QMUISwipeViewHolder?, position: Int, item: T)
|
||||
|
||||
fun setOnItemClickListener(listener: BaseRecyclerAdapter.OnItemClickListener?) {
|
||||
mClickListener = listener
|
||||
}
|
||||
|
||||
fun setOnItemLongClickListener(listener: BaseRecyclerAdapter.OnItemLongClickListener?) {
|
||||
mLongClickListener = listener
|
||||
}
|
||||
|
||||
fun setOnAgainClickListener(listener: BaseRecyclerAdapter.OnAgainClickListener?) {
|
||||
mAgainClickListener = listener
|
||||
}
|
||||
|
||||
}
|
||||
51
app/src/main/java/com/abbidot/tracker/base/BaseView.kt
Normal file
51
app/src/main/java/com/abbidot/tracker/base/BaseView.kt
Normal file
@@ -0,0 +1,51 @@
|
||||
package com.abbidot.tracker.base
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/10/11/011.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
open class BaseView : View {
|
||||
|
||||
lateinit var mContext: Context
|
||||
var mWidth = 0
|
||||
var mHeight = 0
|
||||
var mValue = 0
|
||||
var mStrokeWidth = 0f
|
||||
|
||||
lateinit var mPaint: Paint
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(
|
||||
context, attrs, defStyleAttr
|
||||
)
|
||||
|
||||
open fun init(context: Context, attrs: AttributeSet?) {
|
||||
mContext = context
|
||||
|
||||
//禁用硬件加速,防止返回到界面多次执行onDraw
|
||||
setLayerType(LAYER_TYPE_SOFTWARE, null)
|
||||
|
||||
mStrokeWidth = AppUtils.dpToPx(1f)
|
||||
mPaint = Paint()
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
canvas.apply {
|
||||
startDraw(this)
|
||||
}
|
||||
}
|
||||
|
||||
open fun startDraw(canvas: Canvas) {
|
||||
|
||||
}
|
||||
}
|
||||
40
app/src/main/java/com/abbidot/tracker/bean/ActiveTimeBean.kt
Normal file
40
app/src/main/java/com/abbidot/tracker/bean/ActiveTimeBean.kt
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/15/015.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
@Parcelize
|
||||
data class ActiveTimeBean(
|
||||
var activeId: String,
|
||||
var activeTime: Int,
|
||||
var goalTime: Int,
|
||||
var goal: Int,
|
||||
var calories: Double,
|
||||
var dayTime: String,
|
||||
var deviceId: String,
|
||||
var distance: Double,
|
||||
var lickCounts: Int,
|
||||
var persisted: Int,
|
||||
var scratchCounts: Int,
|
||||
var steps: Long,
|
||||
var timeZone: Int,
|
||||
var updateDate: String,
|
||||
var vomitCount: Int,
|
||||
var avgActiveTime: Int,
|
||||
var avgSleepTime: Int,
|
||||
var totalTimes: Int,
|
||||
var totalDistance: Double,
|
||||
var activeValue: String,
|
||||
var avgCalories: Int,
|
||||
var sevenDatas: MutableList<ActiveTimeBean>?,
|
||||
var thirtyDatas: MutableList<ActiveTimeBean>?,
|
||||
) : Parcelable {
|
||||
constructor() : this(
|
||||
"", 0, 0, 0, 0.0, "", "", 0.0, 0, 0, 0, 0, 0, "", 0, 0, 0, 0, 0.0, "", 0, null, null
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/7/29/029.
|
||||
* @link
|
||||
* @description:微信支付预支付订单
|
||||
*/
|
||||
data class AlipayOrderBean(val orderString: String) {
|
||||
constructor() : this("")
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2025/3/19/019.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class BleReportDataBean(
|
||||
var mac: String,
|
||||
var haveDeviceStateData: Boolean,
|
||||
var updateTime: Long,
|
||||
var latLonUpdateTime: Long,
|
||||
var powerSwitch: Int,
|
||||
var lteSignal: Int,
|
||||
var gpsSignal: Int,
|
||||
var batteryLevel: Int,
|
||||
var gnssInterval: Int,
|
||||
var ledSwitch: Int,
|
||||
var ledMode: Int,
|
||||
var ledRedValue: Int,
|
||||
var ledGreenValue: Int,
|
||||
var ledBlueValue: Int,
|
||||
var liveFlag: Int,
|
||||
var inSafeZone: Int,
|
||||
var inNoGoZone: Int,
|
||||
var cFencesId: String,
|
||||
var inWifiZone: Int,
|
||||
var wiFiZoneMac: String,
|
||||
var haveLocationData: Boolean,
|
||||
var locationMode: Int,
|
||||
var locationList: MutableList<HistoryDataBean>?,
|
||||
var haveActiveSleepData: Boolean,
|
||||
var year: Int,
|
||||
var month: Int,
|
||||
var day: Int,
|
||||
var activeTime: Long,
|
||||
var steps: Long,
|
||||
var timeZone: Int,
|
||||
var cTime: Int,
|
||||
var cActiveTime: Int,
|
||||
var cSleepTime: Int
|
||||
) {
|
||||
constructor() : this(
|
||||
"",
|
||||
false,
|
||||
0L,
|
||||
0L,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
false,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0L,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import com.abbidot.baselibrary.constant.ConState
|
||||
import com.clj.fastble.data.BleDevice
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/5/27/027.
|
||||
* @link
|
||||
* @description:已绑定添加的设备实体类
|
||||
*/
|
||||
data class BleTrackDeviceBean(var mac: String,
|
||||
var bleDevice: BleDevice?,
|
||||
@ConState var conState: Int) {
|
||||
constructor() : this("", null, ConState.DISCONNECTED)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/5/23/023.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class CountryCodeBean(var countryCode: Int)
|
||||
30
app/src/main/java/com/abbidot/tracker/bean/CreditCardBean.kt
Normal file
30
app/src/main/java/com/abbidot/tracker/bean/CreditCardBean.kt
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Ignore
|
||||
import androidx.room.PrimaryKey
|
||||
import com.abbidot.tracker.database.MyDatabase
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/4/1/001.
|
||||
* @link
|
||||
* @description:保存用户输入信用卡
|
||||
*/
|
||||
@Parcelize
|
||||
@Entity(tableName = MyDatabase.CreditCardTableName)
|
||||
data class CreditCardBean(
|
||||
@PrimaryKey @ColumnInfo var cardNumber: String,
|
||||
@ColumnInfo var firstName: String,
|
||||
@ColumnInfo var lastName: String,
|
||||
@ColumnInfo var cardName: String,
|
||||
@ColumnInfo var expirationDate: String,
|
||||
@ColumnInfo var cvv: String,//信用卡验证值(Card Verification Value)
|
||||
@ColumnInfo var countryCode: String,
|
||||
@ColumnInfo var isPrimary: Boolean,
|
||||
@Ignore var checked: Boolean = false
|
||||
) : Parcelable {
|
||||
constructor() : this("", "", "", "", "", "", "USA", false, false)
|
||||
}
|
||||
12
app/src/main/java/com/abbidot/tracker/bean/DFUStateBean.kt
Normal file
12
app/src/main/java/com/abbidot/tracker/bean/DFUStateBean.kt
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2023/3/23/023.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class DFUStateBean(var stateName: String, var progress: Int, var filePath: String) {
|
||||
constructor() : this("", 0, "")
|
||||
constructor(stateName: String, progress: Int) : this(stateName, progress, "")
|
||||
constructor(stateName: String) : this(stateName, 0, "")
|
||||
}
|
||||
43
app/src/main/java/com/abbidot/tracker/bean/DataBean.kt
Normal file
43
app/src/main/java/com/abbidot/tracker/bean/DataBean.kt
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.abbidot.tracker.constant.MultipleEntity
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import kotlinx.parcelize.IgnoredOnParcel
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/12/20/020.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
@Parcelize
|
||||
data class DataBean(
|
||||
var id: String,
|
||||
var name: String,
|
||||
var value: String,
|
||||
var imageId: Int,
|
||||
var state: Int,
|
||||
var selectImageId: Int,
|
||||
var unit: String,
|
||||
var selected: Boolean = false,
|
||||
var checked: Boolean = false,
|
||||
var menuType: Int
|
||||
) : MultiItemEntity, Parcelable {
|
||||
|
||||
//设置空的构造方法
|
||||
constructor() : this("", "", "", 0, 0, 0, "", false, false, MultipleEntity.TEXT)
|
||||
|
||||
constructor(name: String, value: String) : this(
|
||||
"", name, value, 0, 0,0, "", false, false, MultipleEntity.TEXT
|
||||
)
|
||||
|
||||
//设置多个构造方法
|
||||
constructor(name: String, value: String, imageId: Int, unit: String) : this(
|
||||
"", name, value, imageId, 0, 0, unit, false, false, MultipleEntity.TEXT
|
||||
)
|
||||
|
||||
@IgnoredOnParcel
|
||||
@MultipleEntity
|
||||
override val itemType = menuType
|
||||
}
|
||||
53
app/src/main/java/com/abbidot/tracker/bean/DeviceBean.kt
Normal file
53
app/src/main/java/com/abbidot/tracker/bean/DeviceBean.kt
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Ignore
|
||||
import com.abbidot.baselibrary.constant.ConState
|
||||
import com.abbidot.baselibrary.constant.DeviceType
|
||||
import com.abbidot.tracker.base.BaseDiffBean
|
||||
import com.abbidot.tracker.database.MyDatabase
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/11/8/008.
|
||||
* @link
|
||||
* @description:连接保存的设备表
|
||||
*/
|
||||
// 定义表名称,SQLite 中的表名称不区分大小写,2个主键
|
||||
@Entity(tableName = MyDatabase.DeviceTableName, primaryKeys = ["deviceOutId", "deviceId"])
|
||||
@Parcelize
|
||||
data class DeviceBean(//@PrimaryKey(autoGenerate = true) var id: Long,//autoGenerate = true 自动增长分配ID
|
||||
@ColumnInfo @DeviceType var type: Int,//设备类型
|
||||
@ColumnInfo var deviceName: String,
|
||||
@ColumnInfo var deviceOutId: String,
|
||||
@ColumnInfo var deviceId: String,
|
||||
@ColumnInfo var shared: Int, //0=没有分享,1=是授权分享的
|
||||
@ColumnInfo var batteryCapacity: Int,
|
||||
@ColumnInfo var ledSwitch: Int,
|
||||
@ColumnInfo @ConState var conState: Int,//连接状态
|
||||
@ColumnInfo var macId: String,
|
||||
@ColumnInfo var deviceInfoId: String,
|
||||
@ColumnInfo var surplusDays: Int,
|
||||
@ColumnInfo var gnssSignal: Int,
|
||||
@ColumnInfo var lteSignal: Int,
|
||||
@ColumnInfo var turnOff: Int,
|
||||
@ColumnInfo var lightMode: Int,
|
||||
@Ignore var pet: PetBean?) : BaseDiffBean(), Parcelable {
|
||||
// 如果某个实体中有您不想保留的字段,则可以使用 @Ignore 为这些字段添加注释
|
||||
|
||||
//设置空的构造方法
|
||||
constructor() : this(DeviceType.TYPE_ONE, "", "", "", 0, 0, 0, ConState.DISCONNECTED, "", "", 0,
|
||||
0, 0, 0, 0, null)
|
||||
|
||||
override fun isSameObject(other: Any): Boolean {
|
||||
val oldItem = other as DeviceBean
|
||||
return deviceId == oldItem.deviceId
|
||||
}
|
||||
|
||||
override fun hasSameContent(other: Any): Boolean {
|
||||
val oldItem = other as DeviceBean
|
||||
return oldItem.deviceOutId == deviceOutId && oldItem.batteryCapacity == batteryCapacity && oldItem.ledSwitch == ledSwitch && oldItem.pet == pet && oldItem.gnssSignal == gnssSignal && oldItem.lteSignal == lteSignal
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/2/28/028.
|
||||
* @link
|
||||
* @description:设备详情
|
||||
*/
|
||||
@Parcelize
|
||||
data class DeviceDetailBean(var deviceOutId: String,
|
||||
var deviceId: String,
|
||||
var macId: String,
|
||||
var pet: PetBean?,
|
||||
var fenceCount: Int,
|
||||
var surplusDays: Int,
|
||||
var familieCount: Int,var deviceInfo:DeviceInfoBean?) : Parcelable {
|
||||
constructor() : this("", "", "", null, 0, 0,0,null)
|
||||
}
|
||||
22
app/src/main/java/com/abbidot/tracker/bean/DeviceInfoBean.kt
Normal file
22
app/src/main/java/com/abbidot/tracker/bean/DeviceInfoBean.kt
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class DeviceInfoBean(var deviceInfoId: String,
|
||||
var red: Int,
|
||||
var green: Int,
|
||||
var blue: Int,
|
||||
//第一个 是:几分钟设备上报。2信号强度,3电量 4设备关机还是开机 5 light登打开还是关闭。5 wifi强度
|
||||
var gnssInterval: Int,
|
||||
var gnssSignal: Int,
|
||||
var batteryLevel: Int,
|
||||
var turnOff: Int,
|
||||
var ledSwitch: Int,
|
||||
var wifiSignal: Int,
|
||||
//当前LTE网络信号
|
||||
var lteSignal: Int,
|
||||
var lightMode: Int) : Parcelable {
|
||||
constructor() : this("", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
}
|
||||
39
app/src/main/java/com/abbidot/tracker/bean/FamilyBean.kt
Normal file
39
app/src/main/java/com/abbidot/tracker/bean/FamilyBean.kt
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.abbidot.tracker.base.BaseDiffBean
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/2/28/028.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
@Parcelize
|
||||
data class FamilyBean(
|
||||
var acceptEmail: String,
|
||||
var deviceId: String,
|
||||
var familyId: String,
|
||||
var imgurl: String,
|
||||
var inviteDate: String,
|
||||
var sendEmail: String,
|
||||
var status: Int,//设备的分享状态 1 是分享成功 0 分享中 2 已拒绝
|
||||
var userId: String,
|
||||
var relation: Int,//关系 1 Family 2 friend 3 love 4 colleague
|
||||
var avatar: Int,//头像 1 男生 2 女生 3 未知
|
||||
var userName: String,
|
||||
var petId: String,
|
||||
var petName: String
|
||||
) : Parcelable, BaseDiffBean() {
|
||||
constructor() : this("", "", "", "", "", "", 0, "", 1, 1, "", "", "")
|
||||
|
||||
override fun isSameObject(other: Any): Boolean {
|
||||
val oldItem = other as FamilyBean
|
||||
return familyId == oldItem.familyId
|
||||
}
|
||||
|
||||
override fun hasSameContent(other: Any): Boolean {
|
||||
val oldItem = other as FamilyBean
|
||||
return oldItem.imgurl == imgurl && oldItem.acceptEmail == acceptEmail
|
||||
}
|
||||
}
|
||||
13
app/src/main/java/com/abbidot/tracker/bean/FamilyPetBean.kt
Normal file
13
app/src/main/java/com/abbidot/tracker/bean/FamilyPetBean.kt
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/10/010.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class FamilyPetBean(var petName: String,
|
||||
var petImgurl: String,
|
||||
var deviceOutId: String,
|
||||
var families: MutableList<FamilyBean>?) {
|
||||
constructor() : this("", "", "", null)
|
||||
}
|
||||
96
app/src/main/java/com/abbidot/tracker/bean/FencesBean.kt
Normal file
96
app/src/main/java/com/abbidot/tracker/bean/FencesBean.kt
Normal file
@@ -0,0 +1,96 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.abbidot.tracker.base.BaseDiffBean
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/2/28/028.
|
||||
* @link
|
||||
* @description:围栏
|
||||
*/
|
||||
@Parcelize
|
||||
data class FencesBean(
|
||||
var deviceId: String,
|
||||
var deviceServiceId: String,
|
||||
var fenceId: String,
|
||||
var name: String,
|
||||
var address: String,
|
||||
var imgurl: String,
|
||||
var isOn: Int,
|
||||
var radius: Int,
|
||||
var longitude: Double,
|
||||
var latitude: Double,
|
||||
var fenceShapeType: Int,// fenceShapeType 围栏类型,1是圆形,2是矩形 3是六边形
|
||||
var fenceType: Int,//围栏类型,1是Safe Zone,2是No Go Zone
|
||||
var fenceNameType: Int,//名称类型,1是home,2是Office,3是Garden,4是Park,5是Play,6是Garage,7是vegetable garden,8是River
|
||||
var longitudeA: Double,
|
||||
var latitudeA: Double,
|
||||
var longitudeB: Double,
|
||||
var latitudeB: Double,
|
||||
var longitudeC: Double,
|
||||
var latitudeC: Double,
|
||||
var longitudeD: Double,
|
||||
var latitudeD: Double,
|
||||
var longitudeE: Double,
|
||||
var latitudeE: Double,
|
||||
var longitudeF: Double,
|
||||
var latitudeF: Double,
|
||||
var longitudeCenter: Double,
|
||||
var latitudeCenter: Double,
|
||||
var ancillaryLatitude: Double,
|
||||
var ancillaryLongitude: Double,
|
||||
var ancillaryOtherLatitude: Double,
|
||||
var ancillaryOtherLongitude: Double,
|
||||
var longDistance: Int,
|
||||
var shortDistance: Int,
|
||||
var startDrag: Boolean//围栏形状是否开始拖动
|
||||
) : Parcelable, BaseDiffBean() {
|
||||
constructor() : this(
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0,
|
||||
0.0,
|
||||
0.0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
false
|
||||
)
|
||||
|
||||
override fun isSameObject(other: Any): Boolean {
|
||||
val oldItem = other as FencesBean
|
||||
return oldItem.fenceId == fenceId
|
||||
}
|
||||
|
||||
override fun hasSameContent(other: Any): Boolean {
|
||||
val oldItem = other as FencesBean
|
||||
return oldItem.isOn == isOn && oldItem.name == name && oldItem.imgurl == imgurl && oldItem.address == address && oldItem.fenceType == fenceType
|
||||
}
|
||||
|
||||
}
|
||||
16
app/src/main/java/com/abbidot/tracker/bean/FirmwareBean.kt
Normal file
16
app/src/main/java/com/abbidot/tracker/bean/FirmwareBean.kt
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2023/3/22/022.
|
||||
* @link
|
||||
* @description:固件信息
|
||||
*/
|
||||
data class FirmwareBean(
|
||||
var deviceName: String,
|
||||
var version: String,
|
||||
var remark: String,
|
||||
var fileName: String,
|
||||
var firmwareUrl: String,
|
||||
var mac: String,
|
||||
var firmwareSize: String
|
||||
)
|
||||
19
app/src/main/java/com/abbidot/tracker/bean/GetFencesBean.kt
Normal file
19
app/src/main/java/com/abbidot/tracker/bean/GetFencesBean.kt
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/4/25/025.
|
||||
* @link
|
||||
* @description:获取围栏数据返回
|
||||
*/
|
||||
@Parcelize
|
||||
data class GetFencesBean(
|
||||
var latitude: Double,
|
||||
var longitude: Double,
|
||||
var normalFenceList: MutableList<FencesBean>?,
|
||||
var nogoFenceList: MutableList<FencesBean>?
|
||||
) : Parcelable {
|
||||
constructor() : this(0.0, 0.0, null, null)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/16/016.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
@Parcelize
|
||||
data class HistoryDataBean(var dayTime: String,
|
||||
var deviceId: String,
|
||||
var deviceInfoId: String,
|
||||
var historyPointId: String,
|
||||
var latitude: Double,
|
||||
var longitude: Double,
|
||||
var address: String,
|
||||
var positionMode: Int,
|
||||
var timeStamp: Long,
|
||||
var ledSwitch: Int,
|
||||
var gnssSignal: Int,
|
||||
var batteryLevel: Int,
|
||||
var lightMode: Int,
|
||||
@ConstantInt var inFance: Int,
|
||||
var petName: String,
|
||||
var petImgurl: String) : Parcelable {
|
||||
constructor() : this("", "", "", "", 0.0, 0.0, "", 0, 0L, 0, 0, 0, 0, ConstantInt.GoodZone, "",
|
||||
"")
|
||||
}
|
||||
14
app/src/main/java/com/abbidot/tracker/bean/HomeDataBean.kt
Normal file
14
app/src/main/java/com/abbidot/tracker/bean/HomeDataBean.kt
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/15/015.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class HomeDataBean(
|
||||
var activeTime: ActiveTimeBean?,
|
||||
var sleepTime: SleepTimeBean?,
|
||||
var updateTime: Long
|
||||
) {
|
||||
constructor() : this(null, null, 0)
|
||||
}
|
||||
10
app/src/main/java/com/abbidot/tracker/bean/InviteInfoBean.kt
Normal file
10
app/src/main/java/com/abbidot/tracker/bean/InviteInfoBean.kt
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/12/4/004.
|
||||
* @link
|
||||
* @description:设备邀请信息
|
||||
*/
|
||||
data class InviteInfoBean(
|
||||
var deleteArray: MutableList<FamilyBean>, var inviteArray: MutableList<FamilyBean>
|
||||
)
|
||||
16
app/src/main/java/com/abbidot/tracker/bean/LKSimListBean.kt
Normal file
16
app/src/main/java/com/abbidot/tracker/bean/LKSimListBean.kt
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2023/7/10/010.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
@Parcelize
|
||||
data class LKSimListBean(
|
||||
var partnerCode: String, var planList: MutableList<LKSimSetMealBean>?
|
||||
) : Parcelable {
|
||||
constructor() : this("", null)
|
||||
}
|
||||
24
app/src/main/java/com/abbidot/tracker/bean/LKSimPriceBean.kt
Normal file
24
app/src/main/java/com/abbidot/tracker/bean/LKSimPriceBean.kt
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2023/7/7/007.
|
||||
* @link
|
||||
* @description:领科sim卡套餐价格
|
||||
*/
|
||||
@Parcelize
|
||||
data class LKSimPriceBean(
|
||||
var autoRenewal: String,
|
||||
var currency: String,
|
||||
var currencySymbol: String,
|
||||
var discountPriceCNY: String,
|
||||
var discountPriceUSD: Double,
|
||||
var orderPeriod: String,
|
||||
var packageType: String,
|
||||
var specifications: String,
|
||||
var specifiedNameLabel: String
|
||||
) : Parcelable {
|
||||
constructor() : this("", "", "", "", 0.0, "", "", "", "")
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2023/7/7/007.
|
||||
* @link
|
||||
* @description:领科sim卡套餐
|
||||
*/
|
||||
@Parcelize
|
||||
data class LKSimSetMealBean(
|
||||
var currency: String,
|
||||
var currencyId: String,
|
||||
var currencySymbol: String,
|
||||
var languageCode: String,
|
||||
var minOrderPeriod: String,
|
||||
var packageCode: String,
|
||||
var servicePlanCode: String,
|
||||
var servicePlanDetailsDesc: String,
|
||||
var servicePlanShortDesc: String,
|
||||
var servicePlanShowName: String,
|
||||
var specAndPriceList: MutableList<LKSimPriceBean>?,
|
||||
var stripeCoupon: String
|
||||
) : Parcelable {
|
||||
constructor() : this("", "", "", "", "", "", "", "", "", "", null, "")
|
||||
}
|
||||
25
app/src/main/java/com/abbidot/tracker/bean/LabelBean.kt
Normal file
25
app/src/main/java/com/abbidot/tracker/bean/LabelBean.kt
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import com.abbidot.tracker.base.BaseDiffBean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/12/21/021.
|
||||
* @link
|
||||
* @description:宠物标签
|
||||
*/
|
||||
data class LabelBean(var name: String, var check: Boolean) : BaseDiffBean() {
|
||||
|
||||
//设置空的构造方法
|
||||
constructor() : this("", false)
|
||||
constructor(name: String) : this(name, false)
|
||||
|
||||
override fun isSameObject(other: Any): Boolean {
|
||||
val oldItem = other as LabelBean
|
||||
return oldItem.name == name
|
||||
}
|
||||
|
||||
override fun hasSameContent(other: Any): Boolean {
|
||||
val oldItem = other as LabelBean
|
||||
return oldItem.name == name && oldItem.check == check
|
||||
}
|
||||
}
|
||||
12
app/src/main/java/com/abbidot/tracker/bean/LiveDataBean.kt
Normal file
12
app/src/main/java/com/abbidot/tracker/bean/LiveDataBean.kt
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/4/28/028.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class LiveDataBean(
|
||||
var livePoints: MutableList<HistoryDataBean>?, var deviceInfo: MapDeviceBean?
|
||||
) {
|
||||
constructor() : this(null, null)
|
||||
}
|
||||
70
app/src/main/java/com/abbidot/tracker/bean/MapDeviceBean.kt
Normal file
70
app/src/main/java/com/abbidot/tracker/bean/MapDeviceBean.kt
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class MapDeviceBean(
|
||||
var deviceId: String,
|
||||
var deviceOutId: String,
|
||||
var baseId: String,
|
||||
var inSafeZone: Int,
|
||||
var gpsSignal: Int,
|
||||
var batteryLevel: Int,
|
||||
var longitude: Double,
|
||||
var latitude: Double,
|
||||
var ledSwitch: Int,
|
||||
var gnssInterval: Int,
|
||||
var liveTime: Int,
|
||||
var liveFlag: Int,
|
||||
var updateTime: Long,
|
||||
var latLonUpdateTime: Long,
|
||||
var lteSignal: Int,
|
||||
var deviceMacId: String,
|
||||
var deviceServerId: String,
|
||||
var powerSwitch: Int,
|
||||
var inNoGoZone: Int,
|
||||
var speed: Float,
|
||||
var inWifiZone: Int,
|
||||
var ledMode: Int,
|
||||
var ledRedValue: Int,
|
||||
var ledGreenValue: Int,
|
||||
var ledBlueValue: Int,
|
||||
var fences: MutableList<FencesBean>?,
|
||||
var wifiZones: MutableList<WiFiZoneBean>?,
|
||||
var startTime: String,
|
||||
var endTime: String
|
||||
) : Parcelable {
|
||||
constructor() : this(
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
ConstantInt.GoodZone,
|
||||
0,
|
||||
0,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
System.currentTimeMillis(),
|
||||
System.currentTimeMillis(),
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0,
|
||||
0f,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
"",
|
||||
""
|
||||
)
|
||||
}
|
||||
39
app/src/main/java/com/abbidot/tracker/bean/MenuTxtBean.kt
Normal file
39
app/src/main/java/com/abbidot/tracker/bean/MenuTxtBean.kt
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import com.abbidot.tracker.constant.MultipleEntity
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/12/20/020.
|
||||
* @link
|
||||
* @description: 菜单显示
|
||||
*/
|
||||
data class MenuTxtBean(
|
||||
var menuName: String,
|
||||
var menuValue: String,
|
||||
var imageId: Int,
|
||||
var colorRedId: Int,
|
||||
var imageUrl: String,
|
||||
var isSwitch: Boolean,
|
||||
@MultipleEntity val menuType: Int
|
||||
) : MultiItemEntity {
|
||||
|
||||
//设置空的构造方法
|
||||
constructor(@MultipleEntity menuType: Int) : this("", "", 0, 0, "", false, menuType)
|
||||
|
||||
//设置多个构造方法
|
||||
constructor(menuName: String, menuValue: String, @MultipleEntity menuType: Int) : this(
|
||||
menuName, menuValue, 0, 0, "", false, menuType
|
||||
)
|
||||
|
||||
constructor(menuName: String, menuValue: String) : this(
|
||||
menuName, menuValue, 0, 0, "", false, MultipleEntity.TEXT
|
||||
)
|
||||
|
||||
constructor(menuName: String, imageId: Int, menuValue: String) : this(
|
||||
menuName, menuValue, imageId, 0, "", false, MultipleEntity.TEXT
|
||||
)
|
||||
|
||||
@MultipleEntity
|
||||
override val itemType = menuType
|
||||
}
|
||||
28
app/src/main/java/com/abbidot/tracker/bean/MessageBean.kt
Normal file
28
app/src/main/java/com/abbidot/tracker/bean/MessageBean.kt
Normal file
@@ -0,0 +1,28 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Ignore
|
||||
import com.abbidot.tracker.constant.MultipleEntity
|
||||
import com.abbidot.tracker.database.MyDatabase
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/2/24/024.
|
||||
* @link
|
||||
* @description:消息列表
|
||||
*/
|
||||
@Entity(tableName = MyDatabase.MessageTableName, primaryKeys = ["messageId"])
|
||||
data class MessageBean(
|
||||
@ColumnInfo var messageId: String,
|
||||
@ColumnInfo var title: String,
|
||||
@ColumnInfo var message: String,
|
||||
@ColumnInfo var sendTime: String,
|
||||
@ColumnInfo var messageType: Int,
|
||||
@ColumnInfo var imgUrl: String,
|
||||
@ColumnInfo var isRead: Boolean,
|
||||
@Ignore @MultipleEntity var isContainImg: Int,
|
||||
@Ignore var isSelect: Boolean
|
||||
) {
|
||||
constructor() : this("", "", "", "", 1, "", false, MultipleEntity.TEXT, false)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/9/26/026.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
|
||||
data class NotificationBean(
|
||||
var enabled: Int, var notificationType: Int, var status: Int, var userId: String
|
||||
)
|
||||
12
app/src/main/java/com/abbidot/tracker/bean/OrderBean.kt
Normal file
12
app/src/main/java/com/abbidot/tracker/bean/OrderBean.kt
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/31/031.
|
||||
* @link
|
||||
* @description:
|
||||
* @param isCanRefund 是否可以退款 1 是可以 0 是不可以
|
||||
*/
|
||||
data class OrderBean(
|
||||
var orderId: String, var orderNo: String, var availableOrder: Int,//判断套餐是否可用或过期,1是可用 0不可用
|
||||
var isCanRefund: Int
|
||||
)
|
||||
25
app/src/main/java/com/abbidot/tracker/bean/PackageBean.kt
Normal file
25
app/src/main/java/com/abbidot/tracker/bean/PackageBean.kt
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/9/5/005.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
@Parcelize
|
||||
data class PackageBean(
|
||||
var mealId: String,
|
||||
var planName: String,
|
||||
var mealUnit: String,
|
||||
var planCategory: String,
|
||||
var period: Int,
|
||||
var popularType: Int,
|
||||
var discountedPrice: Double,
|
||||
var autoRenewPrice: Double,
|
||||
var planPrice: Double,
|
||||
var discount: Int,
|
||||
var active: Int,
|
||||
var selected: Boolean
|
||||
) : Parcelable
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/9/5/005.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class PackageBenefitsBean(var title: String, var status: Int)
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/9/5/005.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class PackageTypeBean(
|
||||
var price: Double,
|
||||
var name: String,
|
||||
var packageId: String,
|
||||
var list: MutableList<PackageBenefitsBean>?,
|
||||
var selected: Boolean
|
||||
)
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/3/6/006.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class ParentBadgeBean(
|
||||
var parentName: String, var badgeList: MutableList<DataBean>?, var isExpand: Boolean = false
|
||||
) {
|
||||
constructor() : this("", null, false)
|
||||
}
|
||||
25
app/src/main/java/com/abbidot/tracker/bean/PayResultBean.kt
Normal file
25
app/src/main/java/com/abbidot/tracker/bean/PayResultBean.kt
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/28/028.
|
||||
* @link
|
||||
* @description:BraintreePal请求结果返回
|
||||
*/
|
||||
@Parcelize
|
||||
data class PayResultBean(
|
||||
var orderId: String,
|
||||
var tokenId: String,
|
||||
var url: String,
|
||||
var surplusDays: Long,
|
||||
var expirationTime: String,
|
||||
var deviceOutId: String,
|
||||
var deviceId: String,
|
||||
//设备充值类型,0=首次设备充值激活,1=已添加设备再次添加设备充值,2=给当前的设备续费或者升级套餐
|
||||
var rechargeType: Int
|
||||
) : Parcelable {
|
||||
constructor() : this("", "", "", 0L, "", "", "", ConstantInt.Type1)
|
||||
}
|
||||
15
app/src/main/java/com/abbidot/tracker/bean/PetAllInfoBean.kt
Normal file
15
app/src/main/java/com/abbidot/tracker/bean/PetAllInfoBean.kt
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/5/28/028.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class PetAllInfoBean(
|
||||
var badges: MutableList<DataBean>?,
|
||||
var activity: ActiveTimeBean?,
|
||||
var petInfo: PetBean?,
|
||||
var invites: MutableList<FamilyBean>?
|
||||
) {
|
||||
constructor() : this(null, null, null, null)
|
||||
}
|
||||
52
app/src/main/java/com/abbidot/tracker/bean/PetBean.kt
Normal file
52
app/src/main/java/com/abbidot/tracker/bean/PetBean.kt
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.abbidot.baselibrary.constant.MMKVKey
|
||||
import com.abbidot.baselibrary.util.MMKVUtil
|
||||
import com.abbidot.baselibrary.util.Utils
|
||||
import com.abbidot.tracker.base.BaseDiffBean
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/2/28/028.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
@Parcelize
|
||||
data class PetBean(
|
||||
var petId: String,
|
||||
var deviceServiceId: String,
|
||||
var petName: String,
|
||||
var breed: String,
|
||||
var shared: Int, //0=没有分享,1=是授权分享的
|
||||
var petType: Int, //宠物类别 0=其他 1是狗 2是猫
|
||||
var userId: String,
|
||||
var imgurl: String,
|
||||
var gender: Int,
|
||||
var birthdayDate: String,
|
||||
var createDate: String,
|
||||
var weight: Float,
|
||||
var height: Float,
|
||||
var labels: String,
|
||||
var deviceOutId: String,
|
||||
var macID: String,
|
||||
var mealType: Int,
|
||||
var availableOrder: Int,//判断套餐是否可用或过期,1是可用 0不可用
|
||||
var deviceId: String
|
||||
) : Parcelable, BaseDiffBean() {
|
||||
constructor() : this(
|
||||
"", "", "", "", 0, 1, MMKVUtil.getString(MMKVKey.UserId), "", 0, Utils.formatTime(
|
||||
System.currentTimeMillis(), Utils.DATE_FORMAT_PATTERN_CN
|
||||
), "", 0f, 0f, "", "", "", 1, 1, ""
|
||||
)
|
||||
|
||||
override fun isSameObject(other: Any): Boolean {
|
||||
val oldItem = other as PetBean
|
||||
return oldItem.petId == petId
|
||||
}
|
||||
|
||||
override fun hasSameContent(other: Any): Boolean {
|
||||
val oldItem = other as PetBean
|
||||
return oldItem.petName == petName && oldItem.imgurl == imgurl && oldItem.deviceOutId == deviceOutId && oldItem.breed == breed && oldItem.gender == gender && oldItem.birthdayDate == birthdayDate && oldItem.petType == petType && oldItem.weight == weight && oldItem.height == height && oldItem.labels == labels
|
||||
}
|
||||
}
|
||||
14
app/src/main/java/com/abbidot/tracker/bean/PointBean.kt
Normal file
14
app/src/main/java/com/abbidot/tracker/bean/PointBean.kt
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/1/26/026.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class PointBean(var x: Float, var y: Float) {
|
||||
constructor() : this(0f, 0f)
|
||||
|
||||
override fun toString(): String {
|
||||
return "x=$x,y=$y"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import com.clj.fastble.data.BleDevice
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2021/12/1/001.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class ReceiveDeviceData(var bleDevice: BleDevice?, var data: ByteArray?, var mac: String) {
|
||||
constructor() : this(null, null, "")
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/25/025.
|
||||
* @link
|
||||
* @description:my card
|
||||
*/
|
||||
@Parcelize
|
||||
data class RechargeDeviceBean(
|
||||
var deviceId: String,
|
||||
var deviceOutId: String,
|
||||
var payType: Int,//付款渠道 1 信用卡 2Paypal
|
||||
var orderId: String,
|
||||
var subscriptionsId: String,//取消自动续费用的id
|
||||
var overdueDate: String,//过期日期
|
||||
@ConstantInt var subscriptionStatus: Int,//自动续费状态
|
||||
var pet: PetBean?,
|
||||
var surplusDays: Int,
|
||||
var addStatus: Int,
|
||||
var orderStatus: Int,
|
||||
var period: String,
|
||||
var iccid: String
|
||||
) : Parcelable {
|
||||
constructor() : this("", "", 0, "", "", "", ConstantInt.Close, null, 0, 0, 0, "0", "")
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/26/026.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class RechargeHistoryBean(var cost: Float,
|
||||
var historyId: String,
|
||||
var payTime: String,
|
||||
var feePackage: String,
|
||||
var deviceOutId: String) {
|
||||
constructor() : this(0f, "", "", "", "")
|
||||
}
|
||||
24
app/src/main/java/com/abbidot/tracker/bean/SetMealBean.kt
Normal file
24
app/src/main/java/com/abbidot/tracker/bean/SetMealBean.kt
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/26/026.
|
||||
* @link
|
||||
* @description:充值套餐列表
|
||||
*/
|
||||
@Parcelize
|
||||
data class SetMealBean(var subscriptionFee: Double,
|
||||
var hotType: Int,//1=hot 0=普通
|
||||
var mealId: String,
|
||||
var name: String,
|
||||
var createdDate: String,
|
||||
var updateDate: String,
|
||||
var days: Int,
|
||||
var period: Float,
|
||||
var planId: String,
|
||||
var selected: Boolean,
|
||||
var accountFee: Double) : Parcelable {
|
||||
constructor() : this(0.0, 0, "", "", "", "", 0, 0f, "", false,0.0)
|
||||
}
|
||||
20
app/src/main/java/com/abbidot/tracker/bean/SleepTimeBean.kt
Normal file
20
app/src/main/java/com/abbidot/tracker/bean/SleepTimeBean.kt
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/3/15/015.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class SleepTimeBean(
|
||||
var dayTime: String,
|
||||
var deviceId: String,
|
||||
var sleepTime: Int,
|
||||
var activeTime: Int,
|
||||
var sleepId: String,
|
||||
var sleepValue: String,
|
||||
var avgSleepTime: Int,
|
||||
var sevenDatas: MutableList<SleepTimeBean>? = null,
|
||||
var thirtyDatas: MutableList<SleepTimeBean>? = null
|
||||
) {
|
||||
constructor() : this("", "", 0, 0, "", "", 0, null, null)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2023/7/20/020.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
data class StripeSubscriptionPriceBean(var customerId: String, var priceId: String) {
|
||||
constructor() : this("", "")
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/9/4/004.
|
||||
* @link
|
||||
* @description:
|
||||
*/
|
||||
@Parcelize
|
||||
data class SubscriptionsOrderBean(
|
||||
var annualCarePrice: Double,
|
||||
var annualCareType: Int,
|
||||
var couponCode: String,
|
||||
var couponPrice: Double,
|
||||
var createTime: String,
|
||||
var customerId: String,
|
||||
var deviceId: String,
|
||||
var deviceOutId: String,
|
||||
var enabled: Int,
|
||||
var id: String,
|
||||
var mealDesc: String,
|
||||
var mealId: String,
|
||||
var mealName: String,
|
||||
var mealPeriod: Int,
|
||||
var mealPrice: Double,
|
||||
var mealDiscountPrice: Double,
|
||||
var orderNum: String,
|
||||
var orderStatus: Int,//0支付取消 1支付成功 2支付失败 3待支付 4申请审核中 5退款中 6退款成功 7退款失败 8审核失败
|
||||
var payTime: String,
|
||||
var payType: Int,
|
||||
var planCategory: String,
|
||||
var planId: String,
|
||||
var priceId: String,
|
||||
var reactivatePrice: Double,
|
||||
var reactivation: Int,
|
||||
var simId: String,
|
||||
var subscriptionId: String,
|
||||
var subscriptionStatus: Int,
|
||||
var surplusDays: Long,
|
||||
var autoRenewPrice: Double,
|
||||
var tax: Double,
|
||||
var totalAmountWithTax: Double,
|
||||
var transactionId: String,
|
||||
var updateTime: String,
|
||||
var useCoupon: Int,
|
||||
var userId: String,
|
||||
var mealUnit: String,
|
||||
var username: String,
|
||||
var iccid: String,
|
||||
var endTime: Long,
|
||||
var isUpdateOrder: Int = 0//是否是升级订单 1:是 0:否
|
||||
) : Parcelable {
|
||||
constructor() : this(
|
||||
0.0,
|
||||
0,
|
||||
"",
|
||||
0.0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0.0,
|
||||
0.0,
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0.0,
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0L,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0L,
|
||||
0
|
||||
)
|
||||
}
|
||||
26
app/src/main/java/com/abbidot/tracker/bean/UserBean.kt
Normal file
26
app/src/main/java/com/abbidot/tracker/bean/UserBean.kt
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/2/18/018.
|
||||
* @link
|
||||
* @description:登录成功返回用户信息
|
||||
*/
|
||||
data class UserBean(
|
||||
var userId: String,
|
||||
var email: String,
|
||||
var token: String,
|
||||
var userName: String,
|
||||
var wxId: String,
|
||||
//0没有绑定手机号 1绑定了
|
||||
var status: Int,
|
||||
var isBindDevice: Int, //是否绑定了设备 0未绑定 1绑定
|
||||
var isBindPet: Int, //是否绑定了宠物 0未绑定 1绑定
|
||||
var isExistNewInvite: Int, //是否有被邀请的设备 0没有 1有
|
||||
var measurementUnitType: Int//1:Imperial 2:Metric
|
||||
) {
|
||||
|
||||
//设置空的构造方法
|
||||
constructor() : this("", "", "", "", "", 0, 0, 0, 0, ConstantInt.Type1)
|
||||
}
|
||||
37
app/src/main/java/com/abbidot/tracker/bean/UserInfoBean.kt
Normal file
37
app/src/main/java/com/abbidot/tracker/bean/UserInfoBean.kt
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import com.abbidot.baselibrary.constant.MMKVKey
|
||||
import com.abbidot.baselibrary.util.MMKVUtil
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2022/2/18/018.
|
||||
* @link
|
||||
* @description:用户信息
|
||||
*/
|
||||
data class UserInfoBean(
|
||||
var userId: String,
|
||||
var email: String,
|
||||
var userName: String,
|
||||
var imgurl: String,
|
||||
var phone: String,
|
||||
var location: String,
|
||||
var gender: Int,
|
||||
var birthdayDate: String,
|
||||
var deviceCount: Int,
|
||||
val countryCode: String
|
||||
// var pets: MutableList<PetBean>?
|
||||
) {
|
||||
|
||||
constructor() : this(
|
||||
MMKVUtil.getString(MMKVKey.UserId),
|
||||
MMKVUtil.getString(MMKVKey.Email),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
""
|
||||
)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user