删除消息本地数据库,改为从服务器获取
This commit is contained in:
@@ -1 +1 @@
|
|||||||
#Thu Mar 12 15:15:30 CST 2026
|
#Thu Mar 19 17:33:53 CST 2026
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ android {
|
|||||||
targetSdkVersion 35
|
targetSdkVersion 35
|
||||||
versionCode 2110
|
versionCode 2110
|
||||||
// versionName "2.1.10"
|
// versionName "2.1.10"
|
||||||
versionName "2.1.10-Beta9"
|
versionName "2.1.10-Beta10"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ dependencies {
|
|||||||
implementation 'androidx.recyclerview:recyclerview:1.3.1'
|
implementation 'androidx.recyclerview:recyclerview:1.3.1'
|
||||||
|
|
||||||
//谷歌地图
|
//谷歌地图
|
||||||
implementation 'com.google.android.gms:play-services-maps:19.2.0'
|
implementation 'com.google.android.gms:play-services-maps:20.0.0'
|
||||||
//地图操作工具类,添加标记等https://github.com/googlemaps/android-maps-utils
|
//地图操作工具类,添加标记等https://github.com/googlemaps/android-maps-utils
|
||||||
// implementation 'com.google.maps.android:android-maps-utils:2.3.0'
|
// implementation 'com.google.maps.android:android-maps-utils:2.3.0'
|
||||||
// implementation 'com.google.maps.android:maps-utils-ktx:3.2.1'
|
// implementation 'com.google.maps.android:maps-utils-ktx:3.2.1'
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.abbidot.baselibrary.list.RecyclerViewHolder
|
|||||||
import com.abbidot.baselibrary.util.Utils
|
import com.abbidot.baselibrary.util.Utils
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.bean.MessageBean
|
import com.abbidot.tracker.bean.MessageBean
|
||||||
|
import com.abbidot.tracker.constant.ConstantInt
|
||||||
import com.abbidot.tracker.widget.TypefaceRoundButton
|
import com.abbidot.tracker.widget.TypefaceRoundButton
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,7 +29,7 @@ class NotificationV2Adapter(
|
|||||||
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: MessageBean) {
|
override fun bindData(holder: RecyclerViewHolder?, position: Int, item: MessageBean) {
|
||||||
val roundButton =
|
val roundButton =
|
||||||
holder!!.getView(R.id.iv_home_route_notification_state) as TypefaceRoundButton
|
holder!!.getView(R.id.iv_home_route_notification_state) as TypefaceRoundButton
|
||||||
val textColor = if (item.isRead) {
|
val textColor = if (item.isRead == ConstantInt.Type1) {
|
||||||
roundButton.visibility = View.GONE
|
roundButton.visibility = View.GONE
|
||||||
R.color.black70
|
R.color.black70
|
||||||
} else {
|
} else {
|
||||||
@@ -51,26 +52,30 @@ class NotificationV2Adapter(
|
|||||||
setTextColor(ContextCompat.getColor(mContext, textColor))
|
setTextColor(ContextCompat.getColor(mContext, textColor))
|
||||||
}
|
}
|
||||||
holder.getTextView(R.id.tv_home_route_notification_date).apply {
|
holder.getTextView(R.id.tv_home_route_notification_date).apply {
|
||||||
text = getRelativeTimeString(item.sendTime)
|
text = getRelativeTimeString(item.timeStamp)
|
||||||
setTextColor(ContextCompat.getColor(mContext, textColor))
|
setTextColor(ContextCompat.getColor(mContext, textColor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getRelativeTimeString(sendTime: String): String {
|
private fun getRelativeTimeString(timeStamp: Long): String {
|
||||||
var formatDateStr = ""
|
var formatDateStr = ""
|
||||||
val time = Utils.stringToTimestamp(sendTime, isUtc = true)
|
val cTimeStamp = Utils.stringToTimestamp(
|
||||||
val now = System.currentTimeMillis()
|
Utils.formatTime(
|
||||||
formatDateStr = if (DateUtils.isToday(time)) {
|
timeStamp, Utils.DATE_FORMAT_PATTERN_CN2
|
||||||
mContext.getString(R.string.txt_today) + " " + Utils.formatTime(
|
|
||||||
time, Utils.DATE_FORMAT_PATTERN_EN8
|
|
||||||
)
|
)
|
||||||
} else if (now - time < (48 * 60 * 60 * 1000)) {
|
)
|
||||||
|
val now = System.currentTimeMillis()
|
||||||
|
formatDateStr = if (DateUtils.isToday(cTimeStamp)) {
|
||||||
|
mContext.getString(R.string.txt_today) + " " + Utils.formatTime(
|
||||||
|
timeStamp, Utils.DATE_FORMAT_PATTERN_EN8
|
||||||
|
)
|
||||||
|
} else if (now - cTimeStamp < (48 * 60 * 60 * 1000)) {
|
||||||
mContext.getString(R.string.txt_yesterday) + " " + Utils.formatTime(
|
mContext.getString(R.string.txt_yesterday) + " " + Utils.formatTime(
|
||||||
time, Utils.DATE_FORMAT_PATTERN_EN8
|
timeStamp, Utils.DATE_FORMAT_PATTERN_EN8
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Utils.formatTime(
|
Utils.formatTime(
|
||||||
Utils.stringToTimestamp(sendTime), Utils.DATE_FORMAT_PATTERN_EN9
|
timeStamp, Utils.DATE_FORMAT_PATTERN_EN9
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return formatDateStr
|
return formatDateStr
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package com.abbidot.tracker.bean
|
|||||||
data class CommonDataBean(
|
data class CommonDataBean(
|
||||||
var taxRate: Double,
|
var taxRate: Double,
|
||||||
var surplusSafeValidMonths: Int,
|
var surplusSafeValidMonths: Int,
|
||||||
|
var unReadCount: Long,
|
||||||
var reactivationFee: Double,
|
var reactivationFee: Double,
|
||||||
var surplusSafeValidFee: Double
|
var surplusSafeValidFee: Double
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import kotlinx.parcelize.Parcelize
|
|||||||
* @description:保存用户输入信用卡
|
* @description:保存用户输入信用卡
|
||||||
*/
|
*/
|
||||||
@Parcelize
|
@Parcelize
|
||||||
@Entity(tableName = MyDatabase.CreditCardTableName)
|
@Entity(tableName = MyDatabase.CREDIT_CARD_TABLE)
|
||||||
data class CreditCardBean(
|
data class CreditCardBean(
|
||||||
@PrimaryKey @ColumnInfo var cardNumber: String,
|
@PrimaryKey @ColumnInfo var cardNumber: String,
|
||||||
@ColumnInfo var firstName: String,
|
@ColumnInfo var firstName: String,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import kotlinx.parcelize.Parcelize
|
|||||||
* @description:连接保存的设备表
|
* @description:连接保存的设备表
|
||||||
*/
|
*/
|
||||||
// 定义表名称,SQLite 中的表名称不区分大小写,2个主键
|
// 定义表名称,SQLite 中的表名称不区分大小写,2个主键
|
||||||
@Entity(tableName = MyDatabase.DeviceTableName, primaryKeys = ["deviceOutId", "deviceId"])
|
@Entity(tableName = MyDatabase.DEVICE_TABLE, primaryKeys = ["deviceOutId", "deviceId"])
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class DeviceBean(//@PrimaryKey(autoGenerate = true) var id: Long,//autoGenerate = true 自动增长分配ID
|
data class DeviceBean(//@PrimaryKey(autoGenerate = true) var id: Long,//autoGenerate = true 自动增长分配ID
|
||||||
@ColumnInfo @DeviceType var type: Int,//设备类型
|
@ColumnInfo @DeviceType var type: Int,//设备类型
|
||||||
|
|||||||
@@ -1,28 +1,25 @@
|
|||||||
package com.abbidot.tracker.bean
|
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.constant.MultipleEntity
|
||||||
import com.abbidot.tracker.database.MyDatabase
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Created by .yzq on 2022/2/24/024.
|
*Created by .yzq on 2022/2/24/024.
|
||||||
* @link
|
* @link
|
||||||
* @description:消息列表
|
* @description:消息列表
|
||||||
*/
|
*/
|
||||||
@Entity(tableName = MyDatabase.MessageTableName, primaryKeys = ["messageId"])
|
|
||||||
data class MessageBean(
|
data class MessageBean(
|
||||||
@ColumnInfo var messageId: String,
|
var messageId: String,
|
||||||
@ColumnInfo var title: String,
|
var title: String,
|
||||||
@ColumnInfo var message: String,
|
var message: String,
|
||||||
@ColumnInfo var sendTime: String,
|
var sendTime: String,
|
||||||
@ColumnInfo var messageType: Int,
|
var messageType: Int,
|
||||||
@ColumnInfo var imgUrl: String,
|
var imgUrl: String,
|
||||||
@ColumnInfo var isRead: Boolean,
|
var isRead: Int,
|
||||||
@Ignore @MultipleEntity var isContainImg: Int,
|
var deviceMessageType: Int,
|
||||||
@Ignore var isSelect: Boolean
|
var timeStamp: Long,
|
||||||
|
@MultipleEntity var isContainImg: Int,
|
||||||
|
var isSelect: Boolean
|
||||||
) {
|
) {
|
||||||
constructor() : this("", "", "", "", 1, "", false, MultipleEntity.TEXT, false)
|
constructor() : this("", "", "", "", 1, "", 0, 0, 0L, MultipleEntity.TEXT, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,8 @@ import androidx.room.RoomDatabase
|
|||||||
import com.abbidot.tracker.MyApplication
|
import com.abbidot.tracker.MyApplication
|
||||||
import com.abbidot.tracker.bean.CreditCardBean
|
import com.abbidot.tracker.bean.CreditCardBean
|
||||||
import com.abbidot.tracker.bean.DeviceBean
|
import com.abbidot.tracker.bean.DeviceBean
|
||||||
import com.abbidot.tracker.bean.MessageBean
|
|
||||||
import com.abbidot.tracker.database.dao.CreditCardDao
|
import com.abbidot.tracker.database.dao.CreditCardDao
|
||||||
import com.abbidot.tracker.database.dao.DeviceDao
|
import com.abbidot.tracker.database.dao.DeviceDao
|
||||||
import com.abbidot.tracker.database.dao.MessageDao
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Created by .yzq on 2021/11/6/006.
|
*Created by .yzq on 2021/11/6/006.
|
||||||
@@ -18,15 +16,14 @@ import com.abbidot.tracker.database.dao.MessageDao
|
|||||||
*/
|
*/
|
||||||
//exportSchema = false,防止改数据库内容版本自动增加
|
//exportSchema = false,防止改数据库内容版本自动增加
|
||||||
@Database(
|
@Database(
|
||||||
entities = [DeviceBean::class, CreditCardBean::class, MessageBean::class],
|
entities = [DeviceBean::class, CreditCardBean::class],
|
||||||
version = 4,
|
version = 5,
|
||||||
// autoMigrations = [AutoMigration(from = 1, to = 2)],
|
// autoMigrations = [AutoMigration(from = 1, to = 2)],
|
||||||
exportSchema = false,
|
exportSchema = false,
|
||||||
)
|
)
|
||||||
abstract class MyDatabase : RoomDatabase() {
|
abstract class MyDatabase : RoomDatabase() {
|
||||||
abstract fun deviceDao(): DeviceDao
|
abstract fun deviceDao(): DeviceDao
|
||||||
abstract fun creditCardDao(): CreditCardDao
|
abstract fun creditCardDao(): CreditCardDao
|
||||||
abstract fun messageDao(): MessageDao
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@@ -49,9 +46,8 @@ abstract class MyDatabase : RoomDatabase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//表名
|
//表名
|
||||||
const val CreditCardTableName = "creditCard"
|
const val CREDIT_CARD_TABLE = "creditCard"
|
||||||
const val DeviceTableName = "device"
|
const val DEVICE_TABLE = "device"
|
||||||
const val MessageTableName = "message"
|
|
||||||
|
|
||||||
fun deviceDao(): DeviceDao {
|
fun deviceDao(): DeviceDao {
|
||||||
return db.deviceDao()
|
return db.deviceDao()
|
||||||
@@ -60,9 +56,5 @@ abstract class MyDatabase : RoomDatabase() {
|
|||||||
fun creditCardDao(): CreditCardDao {
|
fun creditCardDao(): CreditCardDao {
|
||||||
return db.creditCardDao()
|
return db.creditCardDao()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun messageDao(): MessageDao {
|
|
||||||
return db.messageDao()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,6 @@ import com.abbidot.tracker.database.MyDatabase
|
|||||||
@Dao
|
@Dao
|
||||||
interface DeviceDao : BaseDao<DeviceBean> {
|
interface DeviceDao : BaseDao<DeviceBean> {
|
||||||
|
|
||||||
@Query("SELECT * FROM ${MyDatabase.DeviceTableName} WHERE macId LIKE :mac LIMIT 1")
|
@Query("SELECT * FROM ${MyDatabase.DEVICE_TABLE} WHERE macId LIKE :mac LIMIT 1")
|
||||||
fun findByMac(mac: String): DeviceBean?
|
fun findByMac(mac: String): DeviceBean?
|
||||||
}
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.abbidot.tracker.database.dao
|
|
||||||
|
|
||||||
import androidx.room.Dao
|
|
||||||
import com.abbidot.tracker.bean.MessageBean
|
|
||||||
|
|
||||||
/**
|
|
||||||
*Created by .yzq on 2024/7/19/019.
|
|
||||||
* @link
|
|
||||||
* @description:
|
|
||||||
*/
|
|
||||||
@Dao
|
|
||||||
interface MessageDao : BaseDao<MessageBean>
|
|
||||||
@@ -99,7 +99,7 @@ class PaymentMethodPayPalActivity :
|
|||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
ViewUtil.instance.addMenuBean(paymentMethodList, "", "", R.drawable.ico_lay_paypal)
|
ViewUtil.instance.addMenuBean(paymentMethodList, "", "", R.drawable.ico_lay_paypal)
|
||||||
|
|
||||||
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CreditCardTableName)
|
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CREDIT_CARD_TABLE)
|
||||||
list?.forEach {
|
list?.forEach {
|
||||||
val imageId = Util.getCreditCardType(it.cardNumber)
|
val imageId = Util.getCreditCardType(it.cardNumber)
|
||||||
ViewUtil.instance.addMenuBean(
|
ViewUtil.instance.addMenuBean(
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class PaymentMethodStripeActivity :
|
|||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
// ViewUtil.instance.addMenuBean(paymentMethodList, "", "", R.drawable.ico_lay_paypal)
|
// ViewUtil.instance.addMenuBean(paymentMethodList, "", "", R.drawable.ico_lay_paypal)
|
||||||
|
|
||||||
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CreditCardTableName)
|
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CREDIT_CARD_TABLE)
|
||||||
list?.forEach {
|
list?.forEach {
|
||||||
val imageId = Util.getCreditCardType(it.cardNumber)
|
val imageId = Util.getCreditCardType(it.cardNumber)
|
||||||
ViewUtil.instance.addMenuBean(
|
ViewUtil.instance.addMenuBean(
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ class BraintreePalViewModel : ViewModel() {
|
|||||||
// setMealBean.cost.toString(), nonce, deviceId)
|
// setMealBean.cost.toString(), nonce, deviceId)
|
||||||
var list: List<CreditCardBean>?
|
var list: List<CreditCardBean>?
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
list = MyDatabase.creditCardDao().findAll(MyDatabase.CreditCardTableName)
|
list = MyDatabase.creditCardDao().findAll(MyDatabase.CREDIT_CARD_TABLE)
|
||||||
}
|
}
|
||||||
if (null != list) {
|
if (null != list) {
|
||||||
val userId = MMKVUtil.getString(MMKVKey.UserId)
|
val userId = MMKVUtil.getString(MMKVKey.UserId)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import com.abbidot.baselibrary.constant.MMKVKey
|
import com.abbidot.baselibrary.constant.MMKVKey
|
||||||
import com.abbidot.baselibrary.util.MMKVUtil
|
import com.abbidot.baselibrary.util.MMKVUtil
|
||||||
import com.abbidot.tracker.base.BaseActivity
|
import com.abbidot.tracker.base.BaseActivity
|
||||||
|
import com.abbidot.tracker.bean.CommonDataBean
|
||||||
import com.abbidot.tracker.bean.MessageBean
|
import com.abbidot.tracker.bean.MessageBean
|
||||||
import com.abbidot.tracker.retrofit2.NetworkApi
|
import com.abbidot.tracker.retrofit2.NetworkApi
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -19,6 +20,9 @@ class NotificationsViewModel : ViewModel() {
|
|||||||
|
|
||||||
val mNotificationsLiveData = MutableLiveData<Result<MutableList<MessageBean>>>()
|
val mNotificationsLiveData = MutableLiveData<Result<MutableList<MessageBean>>>()
|
||||||
val mDeleteMessageLiveData = MutableLiveData<Result<String>>()
|
val mDeleteMessageLiveData = MutableLiveData<Result<String>>()
|
||||||
|
val mReadMessageLiveData = MutableLiveData<Result<String>>()
|
||||||
|
val mReadAllMessageLiveData = MutableLiveData<Result<String>>()
|
||||||
|
val mMessageCountLiveData = MutableLiveData<Result<CommonDataBean>>()
|
||||||
|
|
||||||
fun getMessageList() {
|
fun getMessageList() {
|
||||||
// activity.showLoading(true)
|
// activity.showLoading(true)
|
||||||
@@ -29,6 +33,37 @@ class NotificationsViewModel : ViewModel() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getMessageUnReadCount() {
|
||||||
|
viewModelScope.launch {
|
||||||
|
val userId = MMKVUtil.getString(MMKVKey.UserId)
|
||||||
|
val result = NetworkApi.getMessageUnReadCount(userId)
|
||||||
|
mMessageCountLiveData.value = result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun messageListByPage(page: Int) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
val userId = MMKVUtil.getString(MMKVKey.UserId)
|
||||||
|
val result = NetworkApi.messageListByPage(userId, page)
|
||||||
|
mNotificationsLiveData.value = result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setMessageIsRead(messageId: String) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
val result = NetworkApi.setMessageIsRead(messageId)
|
||||||
|
mReadMessageLiveData.value = result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setMessageAllIsRead() {
|
||||||
|
viewModelScope.launch {
|
||||||
|
val userId = MMKVUtil.getString(MMKVKey.UserId)
|
||||||
|
val result = NetworkApi.setMessageAllIsRead(userId)
|
||||||
|
mReadAllMessageLiveData.value = result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun deleteMessage(activity: BaseActivity<*>, messageIds: String) {
|
fun deleteMessage(activity: BaseActivity<*>, messageIds: String) {
|
||||||
activity.showLoading(true)
|
activity.showLoading(true)
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class StripePalViewModel : ViewModel() {
|
|||||||
fun startCheckout(activity: BaseActivity<*>, card: MenuTxtBean) {
|
fun startCheckout(activity: BaseActivity<*>, card: MenuTxtBean) {
|
||||||
activity.showLoading(true)
|
activity.showLoading(true)
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CreditCardTableName)
|
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CREDIT_CARD_TABLE)
|
||||||
if (null != list) {
|
if (null != list) {
|
||||||
for (it in list) {
|
for (it in list) {
|
||||||
if (card.menuName == it.cardNumber) {
|
if (card.menuName == it.cardNumber) {
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.abbidot.tracker.diff
|
|
||||||
|
|
||||||
import androidx.recyclerview.widget.DiffUtil
|
|
||||||
import com.abbidot.tracker.bean.MessageBean
|
|
||||||
|
|
||||||
/**
|
|
||||||
*Created by .yzq on 2021/12/31/031.
|
|
||||||
* @link
|
|
||||||
* @description:通知消息diffutil,多布局的没有写继承封装
|
|
||||||
*/
|
|
||||||
class NotificationsDiffUtil : DiffUtil.ItemCallback<MessageBean>() {
|
|
||||||
override fun areItemsTheSame(oldItem: MessageBean, newItem: MessageBean): Boolean {
|
|
||||||
return oldItem.messageId == newItem.messageId
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun areContentsTheSame(oldItem: MessageBean, newItem: MessageBean): Boolean {
|
|
||||||
return oldItem.title == newItem.title && oldItem.message == newItem.message && oldItem.isContainImg == newItem.isContainImg && oldItem.isSelect == newItem.isSelect
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -182,6 +182,36 @@ interface INetworkService {
|
|||||||
@Query("userId") userId: String
|
@Query("userId") userId: String
|
||||||
): BaseResponse<MutableList<MessageBean>>
|
): BaseResponse<MutableList<MessageBean>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取未读消息数量
|
||||||
|
*/
|
||||||
|
@GET("user/getMessageUnReadCount")
|
||||||
|
suspend fun getMessageUnReadCount(
|
||||||
|
@Query("userId") userId: String
|
||||||
|
): BaseResponse<CommonDataBean>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取消息列表(分页显示)
|
||||||
|
*/
|
||||||
|
@GET("user/messageListByPage")
|
||||||
|
suspend fun messageListByPage(
|
||||||
|
@Query("userId") userId: String, @Query("page") page: Int, @Query("size") size: Int
|
||||||
|
): BaseResponse<MutableList<MessageBean>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
*设置单条消息已读
|
||||||
|
*/
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("user/setMessageIsRead")
|
||||||
|
suspend fun setMessageIsRead(@Field("messageId") messageId: String): BaseResponse<String>
|
||||||
|
|
||||||
|
/**
|
||||||
|
*设置全部消息已读
|
||||||
|
*/
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("user/setMessageAllIsRead")
|
||||||
|
suspend fun setMessageAllIsRead(@Field("userId") userId: String): BaseResponse<String>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*删除消息
|
*删除消息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -127,6 +127,34 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
|||||||
service.getMessageList(userId)
|
service.getMessageList(userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取未读消息数量
|
||||||
|
*/
|
||||||
|
suspend fun getMessageUnReadCount(userId: String) = getResult {
|
||||||
|
service.getMessageUnReadCount(userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取消息列表
|
||||||
|
*/
|
||||||
|
suspend fun messageListByPage(userId: String, page: Int) = getResult {
|
||||||
|
service.messageListByPage(userId, page, 20)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置全部消息已读
|
||||||
|
*/
|
||||||
|
suspend fun setMessageAllIsRead(userId: String) = getResult {
|
||||||
|
service.setMessageAllIsRead(userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置单条消息已读
|
||||||
|
*/
|
||||||
|
suspend fun setMessageIsRead(messageId: String) = getResult {
|
||||||
|
service.setMessageIsRead(messageId)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取蓝牙设备Mac
|
* 获取蓝牙设备Mac
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
*/
|
*/
|
||||||
private fun showDeleteInviteDialog(deleteArray: MutableList<FamilyBean>) {
|
private fun showDeleteInviteDialog(deleteArray: MutableList<FamilyBean>) {
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
val myDeviceDb = MyDatabase.deviceDao().findAll(MyDatabase.DeviceTableName)
|
val myDeviceDb = MyDatabase.deviceDao().findAll(MyDatabase.DEVICE_TABLE)
|
||||||
myDeviceDb?.apply {
|
myDeviceDb?.apply {
|
||||||
for (deviceDb in myDeviceDb) {
|
for (deviceDb in myDeviceDb) {
|
||||||
for (item in deleteArray) {
|
for (item in deleteArray) {
|
||||||
@@ -501,7 +501,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val newDeviceDb = MyDatabase.deviceDao().findAll(MyDatabase.DeviceTableName)
|
val newDeviceDb = MyDatabase.deviceDao().findAll(MyDatabase.DEVICE_TABLE)
|
||||||
newDeviceDb?.apply {
|
newDeviceDb?.apply {
|
||||||
LogUtil.e("删去了邀请,还剩${newDeviceDb.size}下个设备")
|
LogUtil.e("删去了邀请,还剩${newDeviceDb.size}下个设备")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,20 +2,17 @@ package com.abbidot.tracker.ui.activity.account
|
|||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.lifecycle.lifecycleScope
|
|
||||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||||
import com.abbidot.baselibrary.util.LogUtil
|
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.adapter.NotificationV2Adapter
|
import com.abbidot.tracker.adapter.NotificationV2Adapter
|
||||||
import com.abbidot.tracker.base.BaseActivity
|
import com.abbidot.tracker.base.BaseActivity
|
||||||
|
import com.abbidot.tracker.bean.MessageBean
|
||||||
|
import com.abbidot.tracker.constant.ConstantInt
|
||||||
import com.abbidot.tracker.constant.GetResultCallback
|
import com.abbidot.tracker.constant.GetResultCallback
|
||||||
import com.abbidot.tracker.database.MyDatabase
|
|
||||||
import com.abbidot.tracker.databinding.ActivityNotificationV2Binding
|
import com.abbidot.tracker.databinding.ActivityNotificationV2Binding
|
||||||
import com.abbidot.tracker.deprecated.ui.activity.vm.NotificationsViewModel
|
import com.abbidot.tracker.deprecated.ui.activity.vm.NotificationsViewModel
|
||||||
import com.abbidot.tracker.util.Util
|
|
||||||
import com.abbidot.tracker.util.ViewUtil
|
import com.abbidot.tracker.util.ViewUtil
|
||||||
import kotlinx.coroutines.Dispatchers
|
import com.qmuiteam.qmui.widget.pullLayout.QMUIPullLayout
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息列表
|
* 消息列表
|
||||||
@@ -27,100 +24,142 @@ class NotificationV2Activity :
|
|||||||
|
|
||||||
private lateinit var mMessageAdapter: NotificationV2Adapter
|
private lateinit var mMessageAdapter: NotificationV2Adapter
|
||||||
|
|
||||||
|
private var mPage = 1
|
||||||
|
private var mPullAction: QMUIPullLayout.PullAction? = null
|
||||||
|
private var mReadMessageId = ""
|
||||||
|
|
||||||
override fun getTopBar() = mViewBinding.notificationV2DetailBar.titleTopBar
|
override fun getTopBar() = mViewBinding.notificationV2DetailBar.titleTopBar
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
super.initData()
|
super.initData()
|
||||||
setTopBarTitle(R.string.txt_notifications)
|
setTopBarTitle(R.string.txt_notifications)
|
||||||
|
|
||||||
mMessageAdapter = NotificationV2Adapter(mContext, null).apply {
|
mMessageAdapter = NotificationV2Adapter(mContext, mutableListOf()).apply {
|
||||||
setOnItemClickListener(object : BaseRecyclerAdapter.OnItemClickListener {
|
setOnItemClickListener(object : BaseRecyclerAdapter.OnItemClickListener {
|
||||||
override fun onItemClick(itemView: View?, pos: Int) {
|
override fun onItemClick(itemView: View?, pos: Int) {
|
||||||
val message = getItem(pos)
|
val message = getItem(pos)
|
||||||
message.isSelect = !message.isSelect
|
mReadMessageId = message.messageId
|
||||||
if (!message.isRead) {
|
mNotificationsViewModel.setMessageIsRead(mReadMessageId)
|
||||||
message.isRead = true
|
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
|
||||||
MyDatabase.messageDao().insert(message)
|
|
||||||
// XEventBus.post(EventName.RefreshMessage)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notifyItemChanged(pos)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ViewUtil.instance.setRecyclerViewDecorationLinearLayoutManager(
|
mViewBinding.apply {
|
||||||
mContext, mViewBinding.rvNotificationV2Detail, mMessageAdapter
|
ViewUtil.instance.setRecyclerViewDecorationLinearLayoutManager(
|
||||||
)
|
mContext, ilNotificationV2MessageLayout.pullRefreshAndLoadMoreRv, mMessageAdapter
|
||||||
setOnClickListenerViews(mViewBinding.btnNotificationV2ReadAll)
|
)
|
||||||
|
ilNotificationV2MessageLayout.pullRefreshAndLoadMoreLayout.let {
|
||||||
|
it.setActionListener { pullAction ->
|
||||||
|
mPullAction = pullAction
|
||||||
|
if (pullAction.pullEdge == QMUIPullLayout.PULL_EDGE_TOP) {
|
||||||
|
mPage = 1
|
||||||
|
mNotificationsViewModel.messageListByPage(mPage)
|
||||||
|
} else if (pullAction.pullEdge == QMUIPullLayout.PULL_EDGE_BOTTOM) {
|
||||||
|
mPage++
|
||||||
|
mNotificationsViewModel.messageListByPage(mPage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setOnClickListenerViews(btnNotificationV2ReadAll)
|
||||||
|
}
|
||||||
|
|
||||||
mNotificationsViewModel.getMessageList()
|
mNotificationsViewModel.messageListByPage(mPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun liveDataObserve() {
|
override fun liveDataObserve() {
|
||||||
mNotificationsViewModel.mNotificationsLiveData.observe(this) {
|
mNotificationsViewModel.apply {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
mNotificationsLiveData.observe(this@NotificationV2Activity) {
|
||||||
override fun onResult(any: Any) {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
it.getOrNull()?.apply {
|
override fun onResult(any: Any) {
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
mPullAction?.let { p ->
|
||||||
Util.dealMessage(this@apply)
|
mViewBinding.ilNotificationV2MessageLayout.pullRefreshAndLoadMoreLayout.finishActionRun(
|
||||||
setMessageData()
|
p
|
||||||
|
)
|
||||||
|
}
|
||||||
|
it.getOrNull()?.apply {
|
||||||
|
setMessageData(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRequestError(exceptionCode: String?) {
|
override fun onRequestError(exceptionCode: String?) {
|
||||||
setMessageData()
|
mPullAction?.let { p ->
|
||||||
}
|
mViewBinding.ilNotificationV2MessageLayout.pullRefreshAndLoadMoreLayout.finishActionRun(
|
||||||
}, isShowRequestErrorTip = false)
|
p
|
||||||
}
|
)
|
||||||
}
|
if (p.pullEdge == QMUIPullLayout.PULL_EDGE_BOTTOM) mPage--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setMessageData() {
|
override fun onErrorCode() {
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
mPullAction?.let { p ->
|
||||||
MyDatabase.messageDao().findAll(MyDatabase.MessageTableName)?.apply {
|
mViewBinding.ilNotificationV2MessageLayout.pullRefreshAndLoadMoreLayout.finishActionRun(
|
||||||
LogUtil.e("消息列表个数:${size}")
|
p
|
||||||
//按最新时间排序
|
)
|
||||||
val sortedByList = this.sortedByDescending { it.sendTime }
|
if (p.pullEdge == QMUIPullLayout.PULL_EDGE_BOTTOM) mPage--
|
||||||
runOnUiThread {
|
}
|
||||||
mMessageAdapter.setData(sortedByList.toMutableList(), true)
|
}
|
||||||
}
|
}, isShowRequestErrorTip = false)
|
||||||
// for (i in sortedByList){
|
}
|
||||||
// LogUtil.e(i.messageId+":"+i.message)
|
mReadMessageLiveData.observe(this@NotificationV2Activity) {
|
||||||
// }
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
|
override fun onResult(any: Any) {
|
||||||
|
val list = mMessageAdapter.getData()
|
||||||
|
for (i in 0 until list.size) {
|
||||||
|
val l = list[i]
|
||||||
|
if (mReadMessageId == l.messageId) {
|
||||||
|
l.isRead = ConstantInt.Type1
|
||||||
|
mMessageAdapter.notifyItemChanged(i)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
mReadAllMessageLiveData.observe(this@NotificationV2Activity) {
|
||||||
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
|
override fun onResult(any: Any) {
|
||||||
|
val list = mMessageAdapter.getData()
|
||||||
|
var isRefresh = false
|
||||||
|
for (l in list) {
|
||||||
|
if (l.isRead == ConstantInt.Type0) {
|
||||||
|
l.isRead = ConstantInt.Type1
|
||||||
|
isRefresh = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isRefresh) mMessageAdapter.notifyItemChanged(0, list.size)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readAllMessage() {
|
private fun setMessageData(list: MutableList<MessageBean>) {
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
val messageList = mMessageAdapter.getData()
|
||||||
MyDatabase.messageDao().findAll(MyDatabase.MessageTableName)?.apply {
|
if (null == mPullAction) {
|
||||||
var isUpdate = false
|
messageList.addAll(list)
|
||||||
for (message in this) {
|
mMessageAdapter.notifyItemRangeInserted(
|
||||||
if (!message.isRead) {
|
messageList.size - list.size, messageList.size
|
||||||
message.isRead = true
|
)
|
||||||
isUpdate = true
|
}
|
||||||
MyDatabase.messageDao().insert(message)
|
mPullAction?.apply {
|
||||||
}
|
if (pullEdge == QMUIPullLayout.PULL_EDGE_TOP) {
|
||||||
}
|
mMessageAdapter.notifyItemRangeRemoved(0, messageList.size)
|
||||||
runOnUiThread {
|
messageList.clear()
|
||||||
val list = mMessageAdapter.getData()
|
messageList.addAll(list)
|
||||||
for (m in list) {
|
mMessageAdapter.notifyItemRangeInserted(0, messageList.size)
|
||||||
if (!m.isRead) {
|
} else {
|
||||||
m.isRead = true
|
messageList.addAll(list)
|
||||||
}
|
mMessageAdapter.notifyItemRangeInserted(
|
||||||
}
|
messageList.size - list.size, messageList.size
|
||||||
mMessageAdapter.notifyItemRangeChanged(0, list.size)
|
)
|
||||||
}
|
|
||||||
// if (isUpdate) XEventBus.post(EventName.RefreshMessage)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
|
if (isLimitClick()) return
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
when (v!!) {
|
when (v!!) {
|
||||||
btnNotificationV2ReadAll -> readAllMessage()
|
btnNotificationV2ReadAll -> mNotificationsViewModel.setMessageAllIsRead()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class AddNewTracker3Activity :
|
|||||||
mScanDeviceAdapter = ScanDeviceAdapter(mContext, mutableListOf()).apply {
|
mScanDeviceAdapter = ScanDeviceAdapter(mContext, mutableListOf()).apply {
|
||||||
setOnItemClickListener(object : BaseRecyclerAdapter.OnItemClickListener {
|
setOnItemClickListener(object : BaseRecyclerAdapter.OnItemClickListener {
|
||||||
override fun onItemClick(itemView: View?, pos: Int) {
|
override fun onItemClick(itemView: View?, pos: Int) {
|
||||||
|
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = false
|
||||||
if (isConnect) return
|
if (isConnect) return
|
||||||
SRBleUtil.instance.cancelBleScan("AddNewTracker2Activity,开始连接蓝牙,取消蓝牙扫描")
|
SRBleUtil.instance.cancelBleScan("AddNewTracker2Activity,开始连接蓝牙,取消蓝牙扫描")
|
||||||
disconnectBle()
|
disconnectBle()
|
||||||
@@ -106,6 +107,10 @@ class AddNewTracker3Activity :
|
|||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
} else if (ble.conState == ConState.CONNECTION_FAIL) {
|
} else if (ble.conState == ConState.CONNECTION_FAIL) {
|
||||||
setNoConnectState()
|
setNoConnectState()
|
||||||
|
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,12 +140,14 @@ class AddNewTracker3Activity :
|
|||||||
|
|
||||||
override fun onErrorCode() {
|
override fun onErrorCode() {
|
||||||
super.onErrorCode()
|
super.onErrorCode()
|
||||||
|
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
|
||||||
setNoConnectState()
|
setNoConnectState()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRequestError(exceptionCode: String?) {
|
override fun onRequestError(exceptionCode: String?) {
|
||||||
super.onRequestError(exceptionCode)
|
super.onRequestError(exceptionCode)
|
||||||
setNoConnectState()
|
setNoConnectState()
|
||||||
|
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class DeleteTracker1Activity :
|
|||||||
MyDatabase.deviceDao().deleteByParams(
|
MyDatabase.deviceDao().deleteByParams(
|
||||||
ConstantString.DeviceId,
|
ConstantString.DeviceId,
|
||||||
device.deviceId,
|
device.deviceId,
|
||||||
MyDatabase.DeviceTableName
|
MyDatabase.DEVICE_TABLE
|
||||||
)
|
)
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
showDeleteDialog()
|
showDeleteDialog()
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class DeleteTracker2Activity :
|
|||||||
MyDatabase.deviceDao().deleteByParams(
|
MyDatabase.deviceDao().deleteByParams(
|
||||||
ConstantString.DeviceId,
|
ConstantString.DeviceId,
|
||||||
device.deviceId,
|
device.deviceId,
|
||||||
MyDatabase.DeviceTableName
|
MyDatabase.DEVICE_TABLE
|
||||||
)
|
)
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
showDeleteDialog()
|
showDeleteDialog()
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class MyTrackerV2Activity :
|
|||||||
MyDatabase.deviceDao().deleteByParams(
|
MyDatabase.deviceDao().deleteByParams(
|
||||||
ConstantString.DeviceId,
|
ConstantString.DeviceId,
|
||||||
device.deviceId,
|
device.deviceId,
|
||||||
MyDatabase.DeviceTableName
|
MyDatabase.DEVICE_TABLE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ class MyTrackerV2Activity :
|
|||||||
MyDatabase.deviceDao().deleteByParams(
|
MyDatabase.deviceDao().deleteByParams(
|
||||||
ConstantString.DeviceId,
|
ConstantString.DeviceId,
|
||||||
device.deviceId,
|
device.deviceId,
|
||||||
MyDatabase.DeviceTableName
|
MyDatabase.DEVICE_TABLE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
mUnAssignDeviceList.clear()
|
mUnAssignDeviceList.clear()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.abbidot.tracker.ui.activity.device.wifi
|
|||||||
|
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.text.TextUtils
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.animation.LinearInterpolator
|
import android.view.animation.LinearInterpolator
|
||||||
@@ -21,7 +22,6 @@ import com.abbidot.tracker.databinding.ActivityAddWifiPowerZone1Binding
|
|||||||
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
||||||
import com.abbidot.tracker.util.Util
|
import com.abbidot.tracker.util.Util
|
||||||
import com.abbidot.tracker.util.ViewUtil
|
import com.abbidot.tracker.util.ViewUtil
|
||||||
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
|
||||||
import com.abbidot.tracker.vm.ConnectionDeviceViewModel
|
import com.abbidot.tracker.vm.ConnectionDeviceViewModel
|
||||||
import com.clj.fastble.BleManager
|
import com.clj.fastble.BleManager
|
||||||
|
|
||||||
@@ -85,19 +85,25 @@ class AddWifiPowerZone1Activity :
|
|||||||
//接收蓝牙连接状态
|
//接收蓝牙连接状态
|
||||||
XEventBus.observe(this, EventName.ConnectDeviceState) { ble: BleTrackDeviceBean ->
|
XEventBus.observe(this, EventName.ConnectDeviceState) { ble: BleTrackDeviceBean ->
|
||||||
showLoading(false)
|
showLoading(false)
|
||||||
mViewBinding.ilAddWifiZone1BluetoothTips.trbBleConnectState.let { view ->
|
mPetBean?.apply {
|
||||||
val bgColor = if (ble.conState == ConState.CONNECTED) {
|
if (TextUtils.isEmpty(macID)) macID = ble.mac
|
||||||
mPetBean?.macID = ble.mac
|
if (macID == ble.mac) {
|
||||||
ViewUtil.instance.viewShowFadeInAnimation(mViewBinding.btnAddWifiZone1Next)
|
mViewBinding.ilAddWifiZone1BluetoothTips.trbBleConnectState.let { view ->
|
||||||
view.text = getString(R.string.tracker_manage_set_ble_connect)
|
val bgColor = if (ble.conState == ConState.CONNECTED) {
|
||||||
ContextCompat.getColor(mContext, R.color.cyan_color1)
|
ViewUtil.instance.viewShowFadeInAnimation(mViewBinding.btnAddWifiZone1Next)
|
||||||
} else {
|
view.text = getString(R.string.tracker_manage_set_ble_connect)
|
||||||
ViewUtil.instance.viewHideFadeInAnimation(mViewBinding.btnAddWifiZone1Next)
|
ContextCompat.getColor(mContext, R.color.cyan_color1)
|
||||||
view.text = getString(R.string.tracker_manage_set_ble_unconnect)
|
} else {
|
||||||
ContextCompat.getColor(mContext, R.color.red_color4)
|
ViewUtil.instance.viewHideFadeInAnimation(mViewBinding.btnAddWifiZone1Next)
|
||||||
|
view.text = getString(R.string.tracker_manage_set_ble_unconnect)
|
||||||
|
ContextCompat.getColor(mContext, R.color.red_color4)
|
||||||
|
}
|
||||||
|
view.setBackgroundColor(bgColor)
|
||||||
|
ViewUtil.instance.bleConStateToast(
|
||||||
|
this@AddWifiPowerZone1Activity, ble.conState, Gravity.CENTER
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
view.setBackgroundColor(bgColor)
|
|
||||||
ViewUtil.instance.bleConStateToast(this, ble.conState, Gravity.CENTER)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -710,25 +710,25 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
mViewBinding.let {
|
mViewBinding.let {
|
||||||
if (deviceType == ConstantInt.Type2) {
|
if (deviceType == ConstantInt.Type2) {
|
||||||
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.text =
|
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.text =
|
||||||
getString(R.string.txt_light)
|
getString(R.string.txt_tone)
|
||||||
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
R.drawable.icon_light_svg, 0, 0, 0
|
R.drawable.icon_sound_image, 0, 0, 0
|
||||||
)
|
)
|
||||||
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.text =
|
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.text =
|
||||||
getString(R.string.txt_light)
|
getString(R.string.txt_tone)
|
||||||
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
R.drawable.icon_light_svg, 0, 0, 0
|
R.drawable.icon_sound_image, 0, 0, 0
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.text =
|
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.text =
|
||||||
getString(R.string.txt_tone)
|
getString(R.string.txt_light)
|
||||||
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
R.drawable.icon_sound_image, 0, 0, 0
|
R.drawable.icon_light_svg, 0, 0, 0
|
||||||
)
|
)
|
||||||
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.text =
|
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.text =
|
||||||
getString(R.string.txt_tone)
|
getString(R.string.txt_light)
|
||||||
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
R.drawable.icon_sound_image, 0, 0, 0
|
R.drawable.icon_light_svg, 0, 0, 0
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
isLedOpen = ledSwitch == ConstantInt.Open
|
isLedOpen = ledSwitch == ConstantInt.Open
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.abbidot.tracker.ui.activity.subscribe
|
package com.abbidot.tracker.ui.activity.subscribe
|
||||||
|
|
||||||
import android.content.res.ColorStateList
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.text.InputFilter
|
import android.text.InputFilter
|
||||||
import android.text.InputFilter.LengthFilter
|
import android.text.InputFilter.LengthFilter
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
@@ -24,7 +22,6 @@ import com.abbidot.tracker.util.Util
|
|||||||
import com.abbidot.tracker.util.ViewUtil
|
import com.abbidot.tracker.util.ViewUtil
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
|
|
||||||
|
|
||||||
class AddCreditCardPaymentActivity :
|
class AddCreditCardPaymentActivity :
|
||||||
@@ -218,7 +215,7 @@ class AddCreditCardPaymentActivity :
|
|||||||
|
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
|
|
||||||
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CreditCardTableName)
|
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CREDIT_CARD_TABLE)
|
||||||
var existCard: CreditCardBean? = null
|
var existCard: CreditCardBean? = null
|
||||||
list?.apply {
|
list?.apply {
|
||||||
if (isNotEmpty()) {
|
if (isNotEmpty()) {
|
||||||
|
|||||||
@@ -481,7 +481,11 @@ class HomeTrackFragment :
|
|||||||
ViewUtil.instance.addMenuBean(
|
ViewUtil.instance.addMenuBean(
|
||||||
mTrackMenuList, getString(R.string.tracker_manage_set_duration)
|
mTrackMenuList, getString(R.string.tracker_manage_set_duration)
|
||||||
)
|
)
|
||||||
ViewUtil.instance.addMenuBean(mTrackMenuList, getString(R.string.txt_live_duration))
|
if (deviceType == ConstantInt.Type2) {
|
||||||
|
ViewUtil.instance.addMenuBean(
|
||||||
|
mTrackMenuList, getString(R.string.txt_live_duration)
|
||||||
|
)
|
||||||
|
}
|
||||||
ViewUtil.instance.addMenuBean(
|
ViewUtil.instance.addMenuBean(
|
||||||
mTrackMenuList,
|
mTrackMenuList,
|
||||||
getString(R.string.txt_firmware_version),
|
getString(R.string.txt_firmware_version),
|
||||||
|
|||||||
@@ -586,9 +586,9 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
|||||||
//隐藏蓝牙nearby
|
//隐藏蓝牙nearby
|
||||||
mViewBinding.ilHomeMapDeviceMsg.root.visibility = View.GONE
|
mViewBinding.ilHomeMapDeviceMsg.root.visibility = View.GONE
|
||||||
mViewBinding.homeMapLiveBtn.visibility = View.GONE
|
mViewBinding.homeMapLiveBtn.visibility = View.GONE
|
||||||
mViewBinding.ivHomeMapBleConState.setImageResource(R.drawable.icon_map_offline)
|
|
||||||
mViewBinding.llHomeMapDeviceBatteryLayout.visibility = View.INVISIBLE
|
mViewBinding.llHomeMapDeviceBatteryLayout.visibility = View.INVISIBLE
|
||||||
mViewBinding.ilHomeMapPetLocation.root.visibility = View.INVISIBLE
|
mViewBinding.ilHomeMapPetLocation.root.visibility = View.INVISIBLE
|
||||||
|
mViewBinding.ivHomeMapBleConState.setImageResource(R.drawable.icon_map_offline)
|
||||||
isCanLive = false
|
isCanLive = false
|
||||||
setRefreshLocationBtnState()
|
setRefreshLocationBtnState()
|
||||||
|
|
||||||
@@ -625,6 +625,15 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
|||||||
*/
|
*/
|
||||||
private fun setMapData(mapDeviceBean: MapDeviceBean) {
|
private fun setMapData(mapDeviceBean: MapDeviceBean) {
|
||||||
mapDeviceBean.apply {
|
mapDeviceBean.apply {
|
||||||
|
|
||||||
|
getHomeV2Activity()?.let {
|
||||||
|
it.getPet(false)?.let { pet ->
|
||||||
|
if (SRBleUtil.instance.isMacConnect(pet.macID)) {
|
||||||
|
mViewBinding.ivHomeMapBleConState.setImageResource(R.drawable.icon_map_online)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setMapDeviceBean(this)
|
setMapDeviceBean(this)
|
||||||
//设置循环查询时间间隔 30秒
|
//设置循环查询时间间隔 30秒
|
||||||
// mMapViewModel.updateMillisInFuture(0.5f)
|
// mMapViewModel.updateMillisInFuture(0.5f)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import android.view.View
|
|||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.lifecycle.lifecycleScope
|
|
||||||
import androidx.viewpager2.widget.ViewPager2
|
import androidx.viewpager2.widget.ViewPager2
|
||||||
import com.abbidot.baselibrary.util.AppUtils
|
import com.abbidot.baselibrary.util.AppUtils
|
||||||
import com.abbidot.baselibrary.util.LogUtil
|
import com.abbidot.baselibrary.util.LogUtil
|
||||||
@@ -14,16 +13,12 @@ import com.abbidot.tracker.R
|
|||||||
import com.abbidot.tracker.adapter.ViewPagerAdapter
|
import com.abbidot.tracker.adapter.ViewPagerAdapter
|
||||||
import com.abbidot.tracker.base.BaseFragment
|
import com.abbidot.tracker.base.BaseFragment
|
||||||
import com.abbidot.tracker.constant.GetResultCallback
|
import com.abbidot.tracker.constant.GetResultCallback
|
||||||
import com.abbidot.tracker.database.MyDatabase
|
|
||||||
import com.abbidot.tracker.databinding.FragmentPetV2Binding
|
import com.abbidot.tracker.databinding.FragmentPetV2Binding
|
||||||
import com.abbidot.tracker.deprecated.ui.activity.vm.NotificationsViewModel
|
import com.abbidot.tracker.deprecated.ui.activity.vm.NotificationsViewModel
|
||||||
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
||||||
import com.abbidot.tracker.ui.activity.account.NotificationV2Activity
|
import com.abbidot.tracker.ui.activity.account.NotificationV2Activity
|
||||||
import com.abbidot.tracker.ui.fragment.device.HomeTrackFragment
|
import com.abbidot.tracker.ui.fragment.device.HomeTrackFragment
|
||||||
import com.abbidot.tracker.util.Util
|
|
||||||
import com.abbidot.tracker.util.ViewUtil
|
import com.abbidot.tracker.util.ViewUtil
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,23 +96,13 @@ class PetV2Fragment : BaseFragment<FragmentPetV2Binding>(FragmentPetV2Binding::i
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun liveDataObserve() {
|
override fun liveDataObserve() {
|
||||||
// XEventBus.observe(viewLifecycleOwner, EventName.RefreshMessage) {
|
mNotificationsViewModel.mMessageCountLiveData.observe(viewLifecycleOwner) {
|
||||||
// getMessageCount()
|
|
||||||
// }
|
|
||||||
mNotificationsViewModel.mNotificationsLiveData.observe(viewLifecycleOwner) {
|
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
it.getOrNull()?.apply {
|
it.getOrNull()?.apply {
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
getMessageCount(unReadCount)
|
||||||
Util.dealMessage(this@apply)
|
|
||||||
getMessageCount()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRequestError(exceptionCode: String?) {
|
|
||||||
getMessageCount()
|
|
||||||
}
|
|
||||||
}, isRequestErrorTip = false, isShowNoDataTip = false)
|
}, isRequestErrorTip = false, isShowNoDataTip = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +118,7 @@ class PetV2Fragment : BaseFragment<FragmentPetV2Binding>(FragmentPetV2Binding::i
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
mNotificationsViewModel.getMessageList()
|
mNotificationsViewModel.getMessageUnReadCount()
|
||||||
(mFragments[1] as HomeTrackFragment).onResume()
|
(mFragments[1] as HomeTrackFragment).onResume()
|
||||||
getHomeV2Activity()?.apply {
|
getHomeV2Activity()?.apply {
|
||||||
//其他页面是否选择了宠物
|
//其他页面是否选择了宠物
|
||||||
@@ -157,25 +142,14 @@ class PetV2Fragment : BaseFragment<FragmentPetV2Binding>(FragmentPetV2Binding::i
|
|||||||
(mFragments[1] as HomeTrackFragment).onPause()
|
(mFragments[1] as HomeTrackFragment).onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getMessageCount() {
|
private fun getMessageCount(unReadCount: Long) {
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
var noReadNum = unReadCount
|
||||||
MyDatabase.messageDao().findAll(MyDatabase.MessageTableName)?.apply {
|
mViewBinding.homePetMessageCountText.let {
|
||||||
var noReadNum = size
|
if (unReadCount > 0) {
|
||||||
LogUtil.e("消息数量:${size}")
|
if (unReadCount > 99) noReadNum = 99
|
||||||
for (message in this) {
|
it.visibility = View.VISIBLE
|
||||||
if (message.isRead) noReadNum--
|
} else it.visibility = View.GONE
|
||||||
}
|
it.text = "$noReadNum"
|
||||||
getHomeV2Activity()?.runOnUiThread {
|
|
||||||
mViewBinding.homePetMessageCountText.let {
|
|
||||||
if (noReadNum > 0) {
|
|
||||||
if (noReadNum > 99) noReadNum = 99
|
|
||||||
it.visibility = View.VISIBLE
|
|
||||||
} else it.visibility = View.GONE
|
|
||||||
it.text = "$noReadNum"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class CreditCardPaymentFragment : BaseFragment<FragmentCreditCardPaymentBinding>
|
|||||||
|
|
||||||
private fun getCardData() {
|
private fun getCardData() {
|
||||||
viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO) {
|
viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO) {
|
||||||
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CreditCardTableName)
|
val list = MyDatabase.creditCardDao().findAll(MyDatabase.CREDIT_CARD_TABLE)
|
||||||
list?.let {
|
list?.let {
|
||||||
mActivity?.runOnUiThread {
|
mActivity?.runOnUiThread {
|
||||||
val sortedByList = list.sortedByDescending { l -> l.isPrimary }.toMutableList()
|
val sortedByList = list.sortedByDescending { l -> l.isPrimary }.toMutableList()
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.abbidot.tracker.base.BaseActivity
|
|||||||
import com.abbidot.tracker.base.BaseDialog
|
import com.abbidot.tracker.base.BaseDialog
|
||||||
import com.abbidot.tracker.bean.BleReportDataBean
|
import com.abbidot.tracker.bean.BleReportDataBean
|
||||||
import com.abbidot.tracker.bean.MapDeviceBean
|
import com.abbidot.tracker.bean.MapDeviceBean
|
||||||
import com.abbidot.tracker.bean.MessageBean
|
|
||||||
import com.abbidot.tracker.bean.UserBean
|
import com.abbidot.tracker.bean.UserBean
|
||||||
import com.abbidot.tracker.constant.ConstantInt
|
import com.abbidot.tracker.constant.ConstantInt
|
||||||
import com.abbidot.tracker.constant.ConstantString
|
import com.abbidot.tracker.constant.ConstantString
|
||||||
@@ -569,9 +568,8 @@ class Util {
|
|||||||
//保存最后一次登录的邮箱
|
//保存最后一次登录的邮箱
|
||||||
MMKVUtil.putString(MMKVKey.Email, email)
|
MMKVUtil.putString(MMKVKey.Email, email)
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
MyDatabase.deviceDao().deleteAll(MyDatabase.DeviceTableName)
|
MyDatabase.deviceDao().deleteAll(MyDatabase.DEVICE_TABLE)
|
||||||
MyDatabase.messageDao().deleteAll(MyDatabase.MessageTableName)
|
MyDatabase.creditCardDao().deleteAll(MyDatabase.CREDIT_CARD_TABLE)
|
||||||
MyDatabase.creditCardDao().deleteAll(MyDatabase.CreditCardTableName)
|
|
||||||
}
|
}
|
||||||
activity.startActivityFinish(Intent(activity, SayHelloActivity::class.java))
|
activity.startActivityFinish(Intent(activity, SayHelloActivity::class.java))
|
||||||
}
|
}
|
||||||
@@ -601,21 +599,6 @@ class Util {
|
|||||||
return intent
|
return intent
|
||||||
}
|
}
|
||||||
|
|
||||||
fun dealMessage(serverMessageList: MutableList<MessageBean>) {
|
|
||||||
MyDatabase.messageDao().findAll(MyDatabase.MessageTableName)?.let { messageList ->
|
|
||||||
for (message in serverMessageList) {
|
|
||||||
var isAdd = false
|
|
||||||
for (m in messageList) {
|
|
||||||
if (message.messageId == m.messageId) {
|
|
||||||
isAdd = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isAdd) MyDatabase.messageDao().insert(message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测是否有必要权限和开关
|
* 检测是否有必要权限和开关
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
|||||||
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet.BottomListSheetBuilder
|
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet.BottomListSheetBuilder
|
||||||
import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -785,7 +786,7 @@ class ViewUtil private constructor() {
|
|||||||
*/
|
*/
|
||||||
fun viewShowFadeInAnimation(target: View, duration: Long = 350): YoYoString {
|
fun viewShowFadeInAnimation(target: View, duration: Long = 350): YoYoString {
|
||||||
return YoYo.with(Techniques.FadeIn).duration(duration).onStart {
|
return YoYo.with(Techniques.FadeIn).duration(duration).onStart {
|
||||||
if (target.visibility == View.GONE || target.visibility == View.INVISIBLE) {
|
if (target.isGone || target.isInvisible) {
|
||||||
target.post {
|
target.post {
|
||||||
target.visibility = View.VISIBLE
|
target.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
@@ -798,7 +799,7 @@ class ViewUtil private constructor() {
|
|||||||
*/
|
*/
|
||||||
fun viewHideFadeInAnimation(target: View, duration: Long = 350, hideType: Int = View.GONE) {
|
fun viewHideFadeInAnimation(target: View, duration: Long = 350, hideType: Int = View.GONE) {
|
||||||
YoYo.with(Techniques.FadeOut).duration(duration).onEnd {
|
YoYo.with(Techniques.FadeOut).duration(duration).onEnd {
|
||||||
if (target.visibility == View.VISIBLE) target.visibility = hideType
|
if (target.isVisible) target.visibility = hideType
|
||||||
}.playOn(target)
|
}.playOn(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class ConnectionDeviceViewModel : ViewModel() {
|
|||||||
}
|
}
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val localDevices = MyDatabase.deviceDao()
|
val localDevices = MyDatabase.deviceDao()
|
||||||
.findAll(MyDatabase.DeviceTableName) as MutableList<DeviceBean>
|
.findAll(MyDatabase.DEVICE_TABLE) as MutableList<DeviceBean>
|
||||||
LogUtil.e("查找本地ble设备有${localDevices.size}个")
|
LogUtil.e("查找本地ble设备有${localDevices.size}个")
|
||||||
if (localDevices.size == 0) {
|
if (localDevices.size == 0) {
|
||||||
return@launch
|
return@launch
|
||||||
|
|||||||
@@ -34,11 +34,10 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<include
|
||||||
android:id="@+id/rv_notification_v2_detail"
|
android:id="@+id/il_notification_v2_message_layout"
|
||||||
|
layout="@layout/layout_pull_refresh_and_load_more"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginHorizontal="@dimen/dp_18"
|
android:layout_marginHorizontal="@dimen/dp_16" />
|
||||||
android:scrollbars="none" />
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -3,12 +3,13 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/pull_refresh_and_load_more_layout"
|
android:id="@+id/pull_refresh_and_load_more_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:background="@color/qmui_config_color_white"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:background="@color/transparent">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/pull_refresh_and_load_more_rv"
|
android:id="@+id/pull_refresh_and_load_more_rv"
|
||||||
style="@style/recycler_view_bg_style"
|
style="@style/recycler_view_bg_style"
|
||||||
|
android:background="@color/transparent"
|
||||||
app:qmui_is_target="true" />
|
app:qmui_is_target="true" />
|
||||||
|
|
||||||
<com.qmuiteam.qmui.widget.pullLayout.QMUIPullRefreshView
|
<com.qmuiteam.qmui.widget.pullLayout.QMUIPullRefreshView
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
app:qmui_can_over_pull="true"
|
app:qmui_can_over_pull="true"
|
||||||
app:qmui_need_receive_fling_from_target_view="false"
|
app:qmui_need_receive_fling_from_target_view="false"
|
||||||
app:qmui_pull_edge="top"
|
app:qmui_pull_edge="top"
|
||||||
app:qmui_pull_rate="0.45"
|
app:qmui_pull_rate="0.2"
|
||||||
app:qmui_target_view_trigger_offset="wrap" />
|
app:qmui_target_view_trigger_offset="wrap" />
|
||||||
|
|
||||||
<com.qmuiteam.qmui.widget.pullLayout.QMUIPullLoadMoreView
|
<com.qmuiteam.qmui.widget.pullLayout.QMUIPullLoadMoreView
|
||||||
@@ -26,8 +27,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:qmui_action_view_init_offset="0dp"
|
app:qmui_action_view_init_offset="0dp"
|
||||||
app:qmui_can_over_pull="true"
|
app:qmui_can_over_pull="true"
|
||||||
app:qmui_need_receive_fling_from_target_view="true"
|
app:qmui_pull_load_more_pull_text="@string/txt_load_more_pull_text"
|
||||||
|
app:qmui_pull_load_more_release_text="@string/txt_load_more_release_text"
|
||||||
|
app:qmui_need_receive_fling_from_target_view="false"
|
||||||
app:qmui_pull_edge="bottom"
|
app:qmui_pull_edge="bottom"
|
||||||
app:qmui_pull_rate="0.45"
|
app:qmui_pull_rate="0.2"
|
||||||
app:qmui_target_view_trigger_offset="wrap" />
|
app:qmui_target_view_trigger_offset="wrap" />
|
||||||
</com.qmuiteam.qmui.widget.pullLayout.QMUIPullLayout>
|
</com.qmuiteam.qmui.widget.pullLayout.QMUIPullLayout>
|
||||||
@@ -964,7 +964,6 @@
|
|||||||
<string name="txt_please_enter_email">请输入邮箱。</string>
|
<string name="txt_please_enter_email">请输入邮箱。</string>
|
||||||
<string name="txt_wifi_password_dec">当LTE信号弱时,Wi-Fi可确保追踪器保持连接</string>
|
<string name="txt_wifi_password_dec">当LTE信号弱时,Wi-Fi可确保追踪器保持连接</string>
|
||||||
<string name="txt_update_time">更新于:%s</string>
|
<string name="txt_update_time">更新于:%s</string>
|
||||||
|
|
||||||
<string name="txt_as_low_as">低至</string>
|
<string name="txt_as_low_as">低至</string>
|
||||||
<string name="txt_show_crash">APP出现异常,即将退出!</string>
|
<string name="txt_show_crash">APP出现异常,即将退出!</string>
|
||||||
<string name="txt_system_error">系统异常</string>
|
<string name="txt_system_error">系统异常</string>
|
||||||
@@ -973,5 +972,7 @@
|
|||||||
<string name="txt_tracker_offline">Tracker设备未在线</string>
|
<string name="txt_tracker_offline">Tracker设备未在线</string>
|
||||||
<string name="txt_tracker_live">Tracker启动了Live直播</string>
|
<string name="txt_tracker_live">Tracker启动了Live直播</string>
|
||||||
<string name="txt_abnormity">其他异常</string>
|
<string name="txt_abnormity">其他异常</string>
|
||||||
|
<string name="txt_load_more_pull_text">上拉加载更多</string>
|
||||||
|
<string name="txt_load_more_release_text">松手加载更多</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1070,6 +1070,7 @@
|
|||||||
<string name="txt_tone">Tone</string>
|
<string name="txt_tone">Tone</string>
|
||||||
<string name="txt_locate_works">Locate works on cellular only</string>
|
<string name="txt_locate_works">Locate works on cellular only</string>
|
||||||
<string name="txt_pet_close">Pet is close, try Radar</string>
|
<string name="txt_pet_close">Pet is close, try Radar</string>
|
||||||
|
<string name="txt_load_more_pull_text">Pull to load more</string>
|
||||||
|
<string name="txt_load_more_release_text">Release to load</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user