1.新增蓝牙自动连接
2.led页面没有修改不会再次保存 3.优化直播蓝牙开启,然后立马关闭蓝牙情况 4.优化直播地图缩放比例不会随刷新而变化
This commit is contained in:
@@ -30,7 +30,7 @@ android {
|
||||
targetSdkVersion 35
|
||||
versionCode 2101
|
||||
// versionName "2.1.1"
|
||||
versionName "2.1.1-Beta4"
|
||||
versionName "2.1.1-Beta7"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ interface INetworkService {
|
||||
@POST("user/sendEmail")
|
||||
suspend fun getVerificationCode(
|
||||
@Field("email") email: String, @Field("type") type: Int
|
||||
): BaseResponse<String>
|
||||
): BaseResponse<UserBean>
|
||||
|
||||
/**
|
||||
* 验证码验证
|
||||
|
||||
@@ -23,17 +23,22 @@ import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.adapter.ChangePetListDialogAdapter
|
||||
import com.abbidot.tracker.adapter.ViewPagerAdapter
|
||||
import com.abbidot.tracker.base.BaseActivity
|
||||
import com.abbidot.tracker.base.BaseDialog
|
||||
import com.abbidot.tracker.bean.BleTrackDeviceBean
|
||||
import com.abbidot.tracker.bean.FamilyBean
|
||||
import com.abbidot.tracker.bean.PetBean
|
||||
import com.abbidot.tracker.bean.ReceiveDeviceData
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.constant.GetResultCallback
|
||||
import com.abbidot.tracker.database.MyDatabase
|
||||
import com.abbidot.tracker.databinding.ActivityHomeV2Binding
|
||||
import com.abbidot.tracker.dialog.CommonDialog1
|
||||
import com.abbidot.tracker.dialog.CommonListDialog
|
||||
import com.abbidot.tracker.receiver.BluetoothMonitorReceiver
|
||||
import com.abbidot.tracker.ui.DebugActivity
|
||||
import com.abbidot.tracker.ui.activity.device.AddNewTracker1Activity
|
||||
import com.abbidot.tracker.ui.activity.device.MyTrackerV2Activity
|
||||
import com.abbidot.tracker.ui.fragment.account.AccountV2Fragment
|
||||
import com.abbidot.tracker.ui.fragment.data.ActivityV2Fragment
|
||||
import com.abbidot.tracker.ui.fragment.data.RouteV2Fragment
|
||||
@@ -47,9 +52,9 @@ import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||
import com.abbidot.tracker.vm.ConnectionDeviceViewModel
|
||||
import com.abbidot.tracker.vm.CountDownTimerViewModel
|
||||
import com.abbidot.tracker.vm.DataViewModel
|
||||
import com.abbidot.tracker.vm.FamilyViewModel
|
||||
import com.abbidot.tracker.vm.LogBleReportViewModel
|
||||
import com.abbidot.tracker.vm.SocketSendMessageViewModel
|
||||
import com.abbidot.tracker.vm.SubscriptionManageViewModel
|
||||
import com.clj.fastble.BleManager
|
||||
import com.google.android.material.navigation.NavigationBarView
|
||||
import com.hjq.permissions.XXPermissions
|
||||
@@ -70,10 +75,10 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
|
||||
val mDataViewModel: DataViewModel by viewModels()
|
||||
private val mAutomaticConnectionDeviceViewModel: ConnectionDeviceViewModel by viewModels()
|
||||
private val mSubscriptionViewModel: SubscriptionManageViewModel by viewModels()
|
||||
private val mLogBleReportViewModel: LogBleReportViewModel by viewModels()
|
||||
private val mCountDownTimerViewModel: CountDownTimerViewModel by viewModels()
|
||||
private val mSocketSendMessageViewModel: SocketSendMessageViewModel by viewModels()
|
||||
private val mFamilyViewModel: FamilyViewModel by viewModels()
|
||||
|
||||
private var mChangePetDialog: CommonListDialog? = null
|
||||
|
||||
@@ -88,6 +93,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
|
||||
//是否请求过宠物数据
|
||||
var isRequestPetData = false
|
||||
private var mCountdownType = ConstantInt.SpecialType
|
||||
|
||||
private val mFragments = mutableListOf<Fragment>(
|
||||
ActivityV2Fragment.newInstance(this),
|
||||
@@ -137,44 +143,35 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
it.itemIconTintList = null
|
||||
it.setOnItemSelectedListener(this)
|
||||
}
|
||||
|
||||
mPetList = mutableListOf()
|
||||
mChangePetListDialogAdapter = ChangePetListDialogAdapter(mContext, mPetList).apply {
|
||||
setOnChangeClickListener(this@HomeV2Activity)
|
||||
}
|
||||
|
||||
//smoothScroll设为false,不显示动画,关闭预加载? true显示过渡动画
|
||||
mViewBinding.homeV2ViewPager2.setCurrentItem(2, false)
|
||||
setLineShow(2)
|
||||
|
||||
//注册监听蓝牙开关广播
|
||||
mBleListenerReceiver = BluetoothMonitorReceiver()
|
||||
val intentFilter = IntentFilter()
|
||||
intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED)
|
||||
// 注册广播
|
||||
registerReceiver(mBleListenerReceiver, intentFilter)
|
||||
|
||||
checkPermissions()
|
||||
|
||||
mDataViewModel.getHomeBindPetList(this)
|
||||
|
||||
//设置bugly的用户id
|
||||
CrashReport.setUserId(MMKVUtil.getString(MMKVKey.Email))
|
||||
|
||||
//自动重启APP
|
||||
// val intent = baseContext.packageManager.getLaunchIntentForPackage(baseContext.packageName)
|
||||
// //与正常页面跳转一样可传递序列化数据,在Launch页面内获得
|
||||
// intent!!.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
// intent.putExtra("REBOOT", "reboot")
|
||||
// startActivity(intent)
|
||||
|
||||
//出现闪退,5秒退出APP
|
||||
val isCrash = MMKVUtil.getBoolean(MMKVKey.isCrash, false)
|
||||
if (isCrash) {
|
||||
MMKVUtil.putBoolean(MMKVKey.isCrash, false)
|
||||
showToast(R.string.txt_show_crash)
|
||||
mCountdownType = ConstantInt.Type0
|
||||
mCountDownTimerViewModel.startCountDown(6)
|
||||
} else {
|
||||
//注册监听蓝牙开关广播
|
||||
mBleListenerReceiver = BluetoothMonitorReceiver()
|
||||
val intentFilter = IntentFilter()
|
||||
intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED)
|
||||
// 注册广播
|
||||
registerReceiver(mBleListenerReceiver, intentFilter)
|
||||
|
||||
checkPermissions()
|
||||
|
||||
mDataViewModel.getHomeBindPetList(this)
|
||||
|
||||
//设置bugly的用户id
|
||||
CrashReport.setUserId(MMKVUtil.getString(MMKVKey.Email))
|
||||
//预先加载相册,防止上传头像几千张照片加载慢
|
||||
XXPermissions.with(this).permission(PermissionLists.getReadMediaImagesPermission())
|
||||
.request { _, allGranted ->
|
||||
@@ -201,8 +198,22 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
|
||||
//出现闪退,5秒退出APP
|
||||
mCountDownTimerViewModel.mCountDownEndLiveData.observe(this) {
|
||||
finish()
|
||||
System.gc()
|
||||
//自动重启APP
|
||||
// val intent = baseContext.packageManager.getLaunchIntentForPackage(baseContext.packageName)
|
||||
// //与正常页面跳转一样可传递序列化数据,在Launch页面内获得
|
||||
// intent!!.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
// intent.putExtra("REBOOT", "reboot")
|
||||
// startActivity(intent)
|
||||
if (mCountdownType == ConstantInt.Type0) {
|
||||
finish()
|
||||
System.gc()
|
||||
} else if (mCountdownType == ConstantInt.Type1) {
|
||||
LogUtil.e("自动连接蓝牙倒计时结束")
|
||||
if (SRBleUtil.instance.isBleEnable(mContext)) {
|
||||
autoConnectDevice()
|
||||
mCountDownTimerViewModel.startCountDown(20)
|
||||
}
|
||||
}
|
||||
}
|
||||
//退出登录
|
||||
XEventBus.observe(this, EventName.LogOut) {
|
||||
@@ -215,8 +226,15 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
//接收开蓝牙操作,然后搜索连接设备
|
||||
XEventBus.observe(this, EventName.BluetoothSwitch) { conState: Int ->
|
||||
if (conState == ConState.BLUETOOTH_ON) {
|
||||
// mAutomaticConnectionDeviceViewModel.autoConnectBleDevice(mContext)
|
||||
autoConnectDevice()
|
||||
} else if (conState == ConState.BLUETOOTH_OFF) {
|
||||
//处理高版本关闭蓝牙开关,不断开蓝牙连接的情况
|
||||
getPet(false)?.apply {
|
||||
BleTrackDeviceBean().let { trackBle ->
|
||||
trackBle.mac = macID
|
||||
XEventBus.post(EventName.ConnectDeviceState, trackBle)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//接收蓝牙连接状态
|
||||
@@ -225,14 +243,19 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
//蓝牙连接断开上传日志
|
||||
if (ble.mac == macID) {
|
||||
if (ble.conState == ConState.CONNECTED) {
|
||||
mCountDownTimerViewModel.stopCountDown()
|
||||
//蓝牙连接就去连接socket
|
||||
mBleReportManage.dealBleReportData(macID, null)
|
||||
} else {
|
||||
mLogBleReportViewModel.uploadLog(mContext, macID)
|
||||
LogUtil.e("15秒监听蓝牙自动连接")
|
||||
mCountdownType = ConstantInt.Type1
|
||||
mCountDownTimerViewModel.startCountDown(15)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//更新套餐数据
|
||||
XEventBus.observe(this, EventName.RefreshPackage) {
|
||||
mDataViewModel.getHomeBindPetList(this)
|
||||
@@ -241,6 +264,10 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
XEventBus.observe(this, EventName.RefreshPet) {
|
||||
mDataViewModel.getHomeBindPetList(this)
|
||||
}
|
||||
//刷新下邀请家人数据
|
||||
XEventBus.observe(this, EventName.RefreshHomeList) {
|
||||
mDataViewModel.getHomeBindPetList(this)
|
||||
}
|
||||
//删除宠物
|
||||
XEventBus.observe(this, EventName.DeletePet) {
|
||||
mSelectPetPosition = 0
|
||||
@@ -308,6 +335,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
it.getOrNull()?.apply {
|
||||
setPetData(this)
|
||||
}
|
||||
mFamilyViewModel.getDeviceInviteInfo(this@HomeV2Activity)
|
||||
}
|
||||
|
||||
override fun onRequestError(exceptionCode: String?) {
|
||||
@@ -322,6 +350,17 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
isShowRequestErrorTip = mNetworkRequestsFailRetryCount == mNetworkRequestsFailMaxCount
|
||||
)
|
||||
}
|
||||
//获取设备邀请信息
|
||||
mFamilyViewModel.mInviteInfoLiveData.observe(this) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
it.getOrNull()?.apply {
|
||||
if (deleteArray.isNotEmpty()) showDeleteInviteDialog(deleteArray)
|
||||
if (inviteArray.isNotEmpty()) showInviteDialog(inviteArray)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun setPetData(petList: MutableList<PetBean>) {
|
||||
@@ -373,6 +412,65 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示被删除邀请的弹窗
|
||||
*/
|
||||
private fun showDeleteInviteDialog(deleteArray: MutableList<FamilyBean>) {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val myDeviceDb = MyDatabase.deviceDao().findAll(MyDatabase.DeviceTableName)
|
||||
myDeviceDb?.apply {
|
||||
for (deviceDb in myDeviceDb) {
|
||||
for (item in deleteArray) {
|
||||
if (deviceDb.deviceId == item.deviceId) {
|
||||
MyDatabase.deviceDao().delete(deviceDb)
|
||||
LogUtil.e("删除了邀请的设备")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val newDeviceDb = MyDatabase.deviceDao().findAll(MyDatabase.DeviceTableName)
|
||||
newDeviceDb?.apply {
|
||||
LogUtil.e("删去了邀请,还剩${newDeviceDb.size}下个设备")
|
||||
}
|
||||
}
|
||||
CommonDialog1(
|
||||
mContext,
|
||||
getString(R.string.txt_setting_notification),
|
||||
getString(R.string.txt_view_access),
|
||||
false,
|
||||
okClickListener = object : BaseDialog.OnDialogOkListener {
|
||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
if (mPetList.size == 0) {
|
||||
noSharePet()
|
||||
} else {
|
||||
onChangeClick(0)
|
||||
}
|
||||
}
|
||||
}).show()
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示被邀请通知弹窗
|
||||
*/
|
||||
private fun showInviteDialog(inviteArray: MutableList<FamilyBean>) {
|
||||
for (item in inviteArray) {
|
||||
val content = String.format(
|
||||
getString(R.string.txt_invites_you_check), item.userName, item.petName
|
||||
)
|
||||
CommonDialog1(
|
||||
mContext,
|
||||
getString(R.string.txt_setting_notification),
|
||||
content,
|
||||
false,
|
||||
okClickListener = object : BaseDialog.OnDialogOkListener {
|
||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
startActivity(Intent(mContext, MyTrackerV2Activity::class.java))
|
||||
}
|
||||
}).show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 套餐不可用状态
|
||||
*/
|
||||
@@ -402,10 +500,10 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
*/
|
||||
private fun checkPermissions() {
|
||||
val checkBleOpen = MMKVUtil.getBoolean(MMKVKey.isFirstCheckBleOpen, true)
|
||||
if (checkBleOpen) MMKVUtil.putBoolean(MMKVKey.isFirstCheckBleOpen, false)
|
||||
Util.checkBluetoothPermissionsEnabled(mContext, {
|
||||
// mAutomaticConnectionDeviceViewModel.autoConnectBleDevice(mContext)
|
||||
}, isCheckBleOpen = checkBleOpen)
|
||||
if (checkBleOpen) MMKVUtil.putBoolean(MMKVKey.isFirstCheckBleOpen, false)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -533,6 +631,8 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
mAutomaticConnectionDeviceViewModel.connectDeviceToMac(
|
||||
this@HomeV2Activity, macID, false
|
||||
)
|
||||
mCountdownType = ConstantInt.Type1
|
||||
mCountDownTimerViewModel.startCountDown(30)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class LoginV2Activity : BaseActivity<ActivityLoginV2Binding>(ActivityLoginV2Bind
|
||||
}
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(email)) {
|
||||
if (TextUtils.isEmpty(email) || !Utils.isValidEmail(email)) {
|
||||
isSure = false
|
||||
ViewUtil.instance.setInputViewErrorShow(
|
||||
mContext, ilLoginV2EmailAddress.rlEtInputLayout, tvEmailErrorTipLogin
|
||||
|
||||
@@ -108,7 +108,8 @@ class UserProfileActivity :
|
||||
|
||||
mTakePhotoAndCompressViewModel.registerCropImageActivityResult(this)
|
||||
|
||||
mUserViewModel.getCountryCodes(this)
|
||||
// mUserViewModel.getCountryCodes(this)
|
||||
mUserViewModel.getUserInfo(this@UserProfileActivity)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@@ -124,19 +125,19 @@ class UserProfileActivity :
|
||||
override fun liveDataObserve() {
|
||||
mUserViewModel.apply {
|
||||
//获取国家代码
|
||||
mCountryCodeLiveData.observe(this@UserProfileActivity) {
|
||||
getUserInfo(this@UserProfileActivity)
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
it.getOrNull()?.apply {
|
||||
mCountryCommon.setCountryCodeData(this)
|
||||
val countryCode = MMKVUtil.getString(MMKVKey.CountryCode)
|
||||
val country = mCountryCommon.codeToCountry(countryCode)
|
||||
mViewBinding.ilUserProfileCountry.etInputContent.setText(country)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// mCountryCodeLiveData.observe(this@UserProfileActivity) {
|
||||
// getUserInfo(this@UserProfileActivity)
|
||||
// dealRequestResult(it, object : GetResultCallback {
|
||||
// override fun onResult(any: Any) {
|
||||
// it.getOrNull()?.apply {
|
||||
// mCountryCommon.setCountryCodeData(this)
|
||||
// val countryCode = MMKVUtil.getString(MMKVKey.CountryCode)
|
||||
// val country = mCountryCommon.codeToCountry(countryCode)
|
||||
// mViewBinding.ilUserProfileCountry.etInputContent.setText(country)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
//获取用户信息
|
||||
mUserInfoLiveData.observe(this@UserProfileActivity) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
@@ -162,7 +163,9 @@ class UserProfileActivity :
|
||||
val data = it.getOrNull()
|
||||
// showToast(R.string.txt_upload_successful)
|
||||
mUploadImageUrl = data!!
|
||||
mViewBinding.ilUserProfileHeadLayout.ilPetProfileHead.appHeadImage.load(mUploadImageUrl)
|
||||
mViewBinding.ilUserProfileHeadLayout.ilPetProfileHead.appHeadImage.load(
|
||||
mUploadImageUrl
|
||||
)
|
||||
userProfileSave()
|
||||
}
|
||||
})
|
||||
@@ -215,7 +218,7 @@ class UserProfileActivity :
|
||||
private fun userProfileSave() {
|
||||
mViewBinding.apply {
|
||||
val name = ilUserProfileNameLayout.etInputContent.text.toString()
|
||||
val country = ilUserProfileCountry.etInputContent.text.toString()
|
||||
// val country = ilUserProfileCountry.etInputContent.text.toString()
|
||||
val email = ilUserProfileEmailLayout.etInputContent.text.toString()
|
||||
var isSure = true
|
||||
if (TextUtils.isEmpty(name)) {
|
||||
@@ -224,14 +227,14 @@ class UserProfileActivity :
|
||||
mContext, ilUserProfileNameLayout.rlEtInputLayout, tvUserProfileNameErrorTip
|
||||
)
|
||||
}
|
||||
if (TextUtils.isEmpty(country)) {
|
||||
isSure = false
|
||||
ViewUtil.instance.setInputViewErrorShow(
|
||||
mContext,
|
||||
ilUserProfileCountry.rlEtInputLayout,
|
||||
tvUserProfileSelectCountryErrorTip
|
||||
)
|
||||
}
|
||||
// if (TextUtils.isEmpty(country)) {
|
||||
// isSure = false
|
||||
// ViewUtil.instance.setInputViewErrorShow(
|
||||
// mContext,
|
||||
// ilUserProfileCountry.rlEtInputLayout,
|
||||
// tvUserProfileSelectCountryErrorTip
|
||||
// )
|
||||
// }
|
||||
if (TextUtils.isEmpty(email) || !Utils.isValidEmail(email)) {
|
||||
isSure = false
|
||||
ViewUtil.instance.setInputViewErrorShow(
|
||||
@@ -241,11 +244,7 @@ class UserProfileActivity :
|
||||
if (!isSure) return
|
||||
|
||||
mUserViewModel.updateUserInfo(
|
||||
this@UserProfileActivity,
|
||||
"",
|
||||
mUploadImageUrl,
|
||||
mCountryCommon.getCountryCode(),
|
||||
name
|
||||
this@UserProfileActivity, "", mUploadImageUrl, mCountryCommon.getCountryCode(), name
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ class MyTrackerV2Activity :
|
||||
override fun getTopBar() = mViewBinding.ilMyTrackerV2TopBar.titleTopBar
|
||||
|
||||
override fun initData() {
|
||||
//刷新下邀请家人的数据
|
||||
XEventBus.post(EventName.RefreshHomeList)
|
||||
super.initData()
|
||||
setTopBarTitle(R.string.tracker_manage_mine)
|
||||
setLeftBackImage(R.drawable.icon_white_back_svg)
|
||||
|
||||
@@ -46,6 +46,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
||||
|
||||
private var mPetBean: PetBean? = null
|
||||
private var mMapDeviceBean: MapDeviceBean? = null
|
||||
private var mOldMapDeviceBean: MapDeviceBean? = null
|
||||
private var mBleTrackDeviceBean: BleTrackDeviceBean? = null
|
||||
private lateinit var mLedLightColorAdapter: LedLightColorAdapter
|
||||
private lateinit var mLedModeList: MutableList<String>
|
||||
@@ -76,19 +77,6 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
||||
null,
|
||||
getString(R.string.tracker_manage_set_led)
|
||||
)
|
||||
mViewBinding.ledLightOpenAndClose.switch.apply {
|
||||
setOnCheckedChangeListener { _, isChecked ->
|
||||
mMapDeviceBean?.let {
|
||||
if (isChecked) {
|
||||
it.ledSwitch = ConstantInt.Open
|
||||
setBleLedMode(it.ledMode)
|
||||
} else {
|
||||
it.ledSwitch = ConstantInt.Close
|
||||
setBleLedMode(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val builder = ViewUtil.instance.showBottomSheetList(mContext, { dialog, _, position, _ ->
|
||||
mMapDeviceBean?.apply {
|
||||
@@ -171,7 +159,8 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
||||
ledLightBluetoothTips.trbBleConnectState,
|
||||
btnLedLightSetSave,
|
||||
btnLedLightIssue,
|
||||
ilLedLightIssueLayout.tvCloseIssueBtn
|
||||
ilLedLightIssueLayout.tvCloseIssueBtn,
|
||||
mViewBinding.ledLightOpenAndClose.switch
|
||||
)
|
||||
}
|
||||
|
||||
@@ -191,6 +180,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
||||
val data = it.getOrNull()
|
||||
data?.apply {
|
||||
mMapDeviceBean = data
|
||||
mOldMapDeviceBean = data.copy()
|
||||
setDeviceData(data)
|
||||
}
|
||||
}
|
||||
@@ -260,14 +250,26 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
||||
}
|
||||
|
||||
override fun leftBackOnClick() {
|
||||
if (null == mMapDeviceBean || null == mOldMapDeviceBean) {
|
||||
super.leftBackOnClick()
|
||||
return
|
||||
}
|
||||
if (isFinishSave) return
|
||||
//是否是蓝牙连接了,修改设备数据返回,同步服务器
|
||||
if (null != mBleTrackDeviceBean) {
|
||||
//判断是否有蓝牙连接
|
||||
if (BleManager.getInstance().isConnected(mBleTrackDeviceBean!!.bleDevice)) {
|
||||
finishAndSave(ConstantInt.Type1)
|
||||
} else {
|
||||
super.leftBackOnClick()
|
||||
mMapDeviceBean?.apply {
|
||||
mOldMapDeviceBean?.let {
|
||||
if (it == mMapDeviceBean) {
|
||||
super.leftBackOnClick()
|
||||
} else {
|
||||
//判断是否有蓝牙连接
|
||||
if (BleManager.getInstance().isConnected(mBleTrackDeviceBean!!.bleDevice)) {
|
||||
finishAndSave(ConstantInt.Type1)
|
||||
} else {
|
||||
super.leftBackOnClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.leftBackOnClick()
|
||||
@@ -278,6 +280,10 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
||||
* 保存设置数据
|
||||
*/
|
||||
private fun finishAndSave(modeType: Int) {
|
||||
if (null == mMapDeviceBean) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
mMapDeviceBean?.apply {
|
||||
isFinishSave = true
|
||||
mLedLightViewModel.setLedLight(this@LedLightActivity, this, modeType)
|
||||
@@ -365,6 +371,20 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
||||
}
|
||||
}
|
||||
|
||||
private fun setLedSwitch() {
|
||||
mViewBinding.ledLightOpenAndClose.switch.apply {
|
||||
mMapDeviceBean?.let {
|
||||
if (isChecked) {
|
||||
it.ledSwitch = ConstantInt.Open
|
||||
setBleLedMode(it.ledMode)
|
||||
} else {
|
||||
it.ledSwitch = ConstantInt.Close
|
||||
setBleLedMode(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
mViewBinding.apply {
|
||||
when (v) {
|
||||
@@ -380,6 +400,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
||||
|
||||
btnLedLightIssue -> showLedIssue()
|
||||
ilLedLightIssueLayout.tvCloseIssueBtn -> showLedIssue()
|
||||
ledLightOpenAndClose.switch -> setLedSwitch()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,8 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
mContext,
|
||||
ilLiveV3MapPetLocation,
|
||||
llLiveV3MapDeviceBatteryLayout,
|
||||
Utils.DATE_FORMAT_PATTERN_EN12
|
||||
Utils.DATE_FORMAT_PATTERN_EN12,
|
||||
isLiveJump
|
||||
) { mapLoadOk() }
|
||||
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||
ivMapLiveV2RefreshBtn, mShowCenterLocation
|
||||
@@ -349,6 +350,19 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
}
|
||||
}
|
||||
}
|
||||
// //接收开蓝牙操作,然后搜索连接设备
|
||||
// XEventBus.observe(this, EventName.BluetoothSwitch) { conState: Int ->
|
||||
// if (conState == ConState.BLUETOOTH_OFF) {
|
||||
// //隐藏蓝牙nearby
|
||||
// mViewBinding.ilLiveV3MapDeviceMsg.root.visibility = View.GONE
|
||||
// //处理高版本关闭蓝牙开关,不断开蓝牙连接的情况
|
||||
// mMapDeviceBean?.apply {
|
||||
// val trackBle = BleTrackDeviceBean()
|
||||
// trackBle.mac = deviceMacId
|
||||
// updateConState(trackBle)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//搜索蓝牙的设备状态
|
||||
XEventBus.observe(this, EventName.ActionConDeviceState) { conState: Int ->
|
||||
if (conState == ConState.DEVICE_NOT_FOUND) {
|
||||
@@ -588,11 +602,16 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
openNetLive(ConstantInt.Type2)
|
||||
}
|
||||
} else {
|
||||
if (isLiveJump && isStartLive) {
|
||||
mPetBean?.apply {
|
||||
//直播开启后,就去获取直播轨迹
|
||||
mMapLiveViewModel.mGetPetLivePointTimeStamp = System.currentTimeMillis() / 1000
|
||||
mMapLiveViewModel.getPetLivePoint(deviceId)
|
||||
if (isLiveJump) {
|
||||
if (isStartLive) {
|
||||
mPetBean?.apply {
|
||||
//直播开启后,就去获取直播轨迹
|
||||
mMapLiveViewModel.mGetPetLivePointTimeStamp =
|
||||
System.currentTimeMillis() / 1000
|
||||
mMapLiveViewModel.getPetLivePoint(deviceId)
|
||||
}
|
||||
} else {
|
||||
openNetLive(ConstantInt.Type2)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -705,7 +724,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
|
||||
|
||||
/**
|
||||
* 显示选择宠物弹窗
|
||||
* 显示选择宠物
|
||||
*/
|
||||
private fun showPetNameAndHead() {
|
||||
mPetBean?.apply {
|
||||
@@ -752,6 +771,11 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
).toString() + mSpeedUnit
|
||||
ilLiveV2OperateLayout.tvLiveV2Speed.text = speedStr
|
||||
|
||||
mMapDeviceBean?.let { m ->
|
||||
isCloseMsg = m.isCloseMsg
|
||||
isCloseBattery = m.isCloseBattery
|
||||
canShowBattery = m.canShowBattery
|
||||
}
|
||||
setMapDeviceBean(this)
|
||||
val isOpen = ledSwitch == ConstantInt.Open
|
||||
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.cbDeviceLightSwitch.isChecked = isOpen
|
||||
@@ -831,9 +855,10 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
*/
|
||||
private fun showAndHideFindLayout() {
|
||||
mViewBinding.apply {
|
||||
ilLiveV3MapPetLocation.root.visibility = View.GONE
|
||||
llLiveV3MapDeviceBatteryLayout.visibility = View.INVISIBLE
|
||||
val relativeLayout = ivMapLiveV2RefreshBtn.layoutParams as RelativeLayout.LayoutParams
|
||||
ivMapLiveV2RefreshBtn.visibility = View.GONE
|
||||
ilLiveV3MapPetLocation.root.visibility = View.INVISIBLE
|
||||
if (ilLiveV2BluetoothFindDevice.root.isGone) {
|
||||
//找蓝牙设备布局显示
|
||||
YoYo.with(Techniques.BounceInUp).duration(800).onStart {
|
||||
@@ -857,16 +882,16 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
YoYo.with(Techniques.BounceInUp).duration(800).delay(400).onEnd {
|
||||
//蓝牙图标按钮显示动画
|
||||
ViewUtil.instance.viewShowFadeInAnimation(ivMapLiveV2BluetoothBtn)
|
||||
ViewUtil.instance.viewShowFadeInAnimation(ilLiveV3MapPetLocation.root)
|
||||
//刷新定位按钮显示动画
|
||||
ViewUtil.instance.viewShowFadeInAnimation(ivMapLiveV2RefreshBtn)
|
||||
}.playOn(ilLiveV2OperateLayout.root)
|
||||
|
||||
relativeLayout.removeRule(RelativeLayout.ABOVE)
|
||||
relativeLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM)
|
||||
relativeLayout.addRule(RelativeLayout.ABOVE, R.id.il_live_v3_map_pet_location)
|
||||
}
|
||||
|
||||
root.postDelayed({
|
||||
ilLiveV3MapPetLocation.root.visibility = View.VISIBLE
|
||||
mHomeMapCommon.setMarkerInfoViewOffset()
|
||||
}, 1000)
|
||||
}
|
||||
@@ -877,23 +902,24 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
*/
|
||||
private fun showLiveIssue() {
|
||||
mViewBinding.apply {
|
||||
ilLiveV3MapPetLocation.root.visibility = View.GONE
|
||||
llLiveV3MapDeviceBatteryLayout.visibility = View.INVISIBLE
|
||||
if (ilMapLiveV2IssueLayout.root.isGone) {
|
||||
YoYo.with(Techniques.BounceInUp).duration(700).onStart {
|
||||
ilLiveV2OperateLayout.root.visibility = View.GONE
|
||||
ilLiveV3MapPetLocation.root.visibility = View.INVISIBLE
|
||||
ilMapLiveV2IssueLayout.root.visibility = View.VISIBLE
|
||||
}.playOn(ilMapLiveV2IssueLayout.root)
|
||||
} else {
|
||||
YoYo.with(Techniques.SlideOutDown).duration(600).onEnd {
|
||||
ilMapLiveV2IssueLayout.root.visibility = View.GONE
|
||||
YoYo.with(Techniques.BounceInUp).duration(600).onStart {
|
||||
ilLiveV3MapPetLocation.root.visibility = View.VISIBLE
|
||||
ilLiveV2OperateLayout.root.visibility = View.VISIBLE
|
||||
}.playOn(ilLiveV2OperateLayout.root)
|
||||
}.playOn(ilMapLiveV2IssueLayout.root)
|
||||
}
|
||||
|
||||
root.postDelayed({
|
||||
ilLiveV3MapPetLocation.root.visibility = View.VISIBLE
|
||||
mHomeMapCommon.setMarkerInfoViewOffset()
|
||||
}, 1000)
|
||||
}
|
||||
@@ -1013,11 +1039,15 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
ilLiveV2OperateLayout.btnLiveV2Issue -> showLiveIssue()
|
||||
ilMapLiveV2IssueLayout.tvCloseIssueBtn -> showLiveIssue()
|
||||
ilLiveV2BluetoothFindDevice.ivLiveV2FindDeviceSound -> setSound()
|
||||
ilLiveV3MapDeviceBatteryLayout.ivDeviceCloseBtn -> llLiveV3MapDeviceBatteryLayout.visibility =
|
||||
View.INVISIBLE
|
||||
ilLiveV3MapDeviceBatteryLayout.ivDeviceCloseBtn -> {
|
||||
mMapDeviceBean?.isCloseBattery = true
|
||||
llLiveV3MapDeviceBatteryLayout.visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
ilLiveV3MapDeviceMsg.ivDeviceMsgCloseBtn -> ilLiveV3MapDeviceMsg.root.visibility =
|
||||
View.GONE
|
||||
ilLiveV3MapDeviceMsg.ivDeviceMsgCloseBtn -> {
|
||||
mMapDeviceBean?.isCloseMsg = true
|
||||
ilLiveV3MapDeviceMsg.root.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,13 +424,13 @@ class PetProfileActivity :
|
||||
//接收身高设置页面的值
|
||||
it.data?.extras?.getFloat(ConstantString.PetHeight)?.apply {
|
||||
mViewBinding.ilPetProfileHeight.etInputContent.setText("$this")
|
||||
mPetBean?.height = Util.convertMetricUnits(this, ConstantInt.Type0,4)
|
||||
mPetBean?.height = Util.convertMetricUnits(this, ConstantInt.Type0, 4)
|
||||
}
|
||||
} else if (it.resultCode == ResultCode.ResultCode_3) {
|
||||
//接收体重设置页面的值
|
||||
it.data?.extras?.getFloat(ConstantString.PetWeight)?.apply {
|
||||
mViewBinding.ilPetProfileWeight.etInputContent.setText("$this")
|
||||
mPetBean?.weight = Util.convertMetricUnits(this, ConstantInt.Type1,4)
|
||||
mPetBean?.weight = Util.convertMetricUnits(this, ConstantInt.Type1, 4)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -502,7 +502,7 @@ class PetProfileActivity :
|
||||
if (any is String) {
|
||||
mViewBinding.ilPetProfileWeight.etInputContent.setText(any)
|
||||
weight = Util.convertMetricUnits(
|
||||
any.toFloat(), ConstantInt.Type1,4
|
||||
any.toFloat(), ConstantInt.Type1, 4
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ class HomeMapCommonV3 @Inject constructor() : BaseMapCommon() {
|
||||
locationLayoutViewBinding: LayoutPetLocationInfoBinding,
|
||||
deviceBatteryLayout: ViewGroup,
|
||||
petAddressTimeFormat: String,
|
||||
isGeocode: Boolean,
|
||||
mapLoadOk: () -> Unit
|
||||
): Fragment {
|
||||
return if (AppUtils.isChina(AppUtils.SWITCH_MAP_TYPE)) {
|
||||
@@ -42,6 +43,7 @@ class HomeMapCommonV3 @Inject constructor() : BaseMapCommon() {
|
||||
locationLayoutViewBinding,
|
||||
deviceBatteryLayout,
|
||||
petAddressTimeFormat,
|
||||
isGeocode,
|
||||
mapLoadOk
|
||||
)
|
||||
mHomeMapGoogleMapFragment!!
|
||||
|
||||
@@ -168,6 +168,7 @@ class CreateAccountV2OneFragment : BaseFragment<FragmentCreateAccountV2OneBindin
|
||||
|
||||
btnCreateAccountV2Continue.isEnabled = false
|
||||
mCreateAccountV2Activity.isInterceptNetErrorCodeTip = true
|
||||
mCreateAccountV2Activity.hideInputMethod(root)
|
||||
mRegisterViewModel.getEmailCode(mCreateAccountV2Activity, email, 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ open class EmailValidFragment : BaseFragment<FragmentBaseEmailValidBinding>(
|
||||
private val mCountDownTimerViewModel: CountDownTimerViewModel by viewModels()
|
||||
private val mRegisterViewModel: UserProfileViewModel by viewModels()
|
||||
|
||||
private val mResendCodeTime = 5 * 60 + 1
|
||||
private val mResendCodeTime = 5 * 60
|
||||
private var mEmail = ""
|
||||
private var mBtnString = ""
|
||||
private var mEmailCodeType = 0
|
||||
@@ -57,7 +57,13 @@ open class EmailValidFragment : BaseFragment<FragmentBaseEmailValidBinding>(
|
||||
fun setEmail(email: String) {
|
||||
mEmail = email
|
||||
//返回上一个页面修改邮箱,再次回到需要更新邮箱显示
|
||||
if (isResumed) formatEmail()
|
||||
if (isResumed) {
|
||||
mViewBinding.vetForgotPasswordV2EditText.clearContent()
|
||||
mCountDownTimerViewModel.stopCountDown()
|
||||
setResendCodeBtnEnabled(false)
|
||||
mCountDownTimerViewModel.startCountDown(mResendCodeTime.toLong())
|
||||
formatEmail()
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.abbidot.tracker.ui.fragment.map
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Typeface
|
||||
import android.location.LocationManager
|
||||
import android.provider.Settings
|
||||
import android.view.View
|
||||
@@ -9,7 +10,6 @@ import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.commit
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.abbidot.baselibrary.constant.ConState
|
||||
import com.abbidot.baselibrary.constant.EventName
|
||||
import com.abbidot.baselibrary.constant.MMKVKey
|
||||
@@ -26,31 +26,25 @@ import com.abbidot.tracker.base.BaseFragment
|
||||
import com.abbidot.tracker.bean.BleReportDataBean
|
||||
import com.abbidot.tracker.bean.BleTrackDeviceBean
|
||||
import com.abbidot.tracker.bean.DataBean
|
||||
import com.abbidot.tracker.bean.FamilyBean
|
||||
import com.abbidot.tracker.bean.MapDeviceBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.constant.GetResultCallback
|
||||
import com.abbidot.tracker.database.MyDatabase
|
||||
import com.abbidot.tracker.databinding.FragmentMapV3Binding
|
||||
import com.abbidot.tracker.dialog.CommonDialog1
|
||||
import com.abbidot.tracker.dialog.SelectMapTypeDialog
|
||||
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
||||
import com.abbidot.tracker.ui.activity.device.MyTrackerV2Activity
|
||||
import com.abbidot.tracker.ui.activity.map.LiveActivityV3
|
||||
import com.abbidot.tracker.ui.common.map.HomeMapCommonV3
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||
import com.abbidot.tracker.vm.FamilyViewModel
|
||||
import com.abbidot.tracker.vm.FencesMapViewModel
|
||||
import com.abbidot.tracker.vm.MapViewModel
|
||||
import com.clj.fastble.BleManager
|
||||
import com.hjq.permissions.XXPermissions
|
||||
import com.hjq.permissions.permission.PermissionLists
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@@ -63,7 +57,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
|
||||
private val mFencesMapViewModel: FencesMapViewModel by viewModels()
|
||||
private val mMapViewModel: MapViewModel by viewModels()
|
||||
private val mFamilyViewModel: FamilyViewModel by viewModels()
|
||||
|
||||
private lateinit var mLocationManager: LocationManager
|
||||
|
||||
@@ -115,7 +108,8 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
mContext!!,
|
||||
ilHomeMapPetLocation,
|
||||
llHomeMapDeviceBatteryLayout,
|
||||
Utils.DATE_FORMAT_PATTERN_EN11
|
||||
Utils.DATE_FORMAT_PATTERN_EN11,
|
||||
true
|
||||
) { mapLoadOk() }
|
||||
|
||||
llHomeMapTopPet.ivTopPetBtnSmall.setImageResource(R.drawable.icon_map_type)
|
||||
@@ -211,22 +205,10 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
// mHomeV2Activity.mDataViewModel.getHomeBindPetList(mHomeV2Activity)
|
||||
getHomeV2Activity()?.apply {
|
||||
if (mPetList.size > 0) showPetNameAndHead(mSelectPetPosition)
|
||||
mFamilyViewModel.getDeviceInviteInfo(this)
|
||||
}
|
||||
}
|
||||
|
||||
override fun liveDataObserve() {
|
||||
//获取设备邀请信息
|
||||
mFamilyViewModel.mInviteInfoLiveData.observe(this) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
it.getOrNull()?.apply {
|
||||
if (deleteArray.isNotEmpty()) showDeleteInviteDialog(deleteArray)
|
||||
if (inviteArray.isNotEmpty()) showInviteDialog(inviteArray)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取当前宠物位置和围栏信息
|
||||
mMapViewModel.mMapDeviceLiveData.observe(this) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
@@ -265,13 +247,15 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
//直播自动结束提示
|
||||
XEventBus.observe(this, EventName.LiveAutoEnd) {
|
||||
ViewUtil.instance.showDialog(
|
||||
mContext!!, R.string.txt_live_ended, object : BaseDialog.OnDialogOkListener {
|
||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
dialog.dismiss()
|
||||
}
|
||||
}, okTextResId = R.string.txt_sure, cancelTextResId = R.string.txt_cancel
|
||||
)
|
||||
CommonDialog1(
|
||||
mContext!!,
|
||||
"",
|
||||
getString(R.string.txt_live_ended),
|
||||
false,
|
||||
5f,
|
||||
Typeface.BOLD,
|
||||
R.color.data_black_color
|
||||
).show()
|
||||
}
|
||||
//直播超时
|
||||
XEventBus.observe(this, EventName.LiveOpenTimeOut) {
|
||||
@@ -319,6 +303,15 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
}
|
||||
}
|
||||
//接收开蓝牙操作,然后搜索连接设备
|
||||
// XEventBus.observe(this, EventName.BluetoothSwitch) { conState: Int ->
|
||||
// if (conState == ConState.BLUETOOTH_OFF) {
|
||||
// //隐藏蓝牙nearby
|
||||
// mViewBinding.ilHomeMapDeviceMsg.root.visibility = View.GONE
|
||||
// //蓝牙断开就重新获取服务器数据,蓝牙数据上报断开
|
||||
// updateMapDeviceStatus()
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -343,7 +336,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
)
|
||||
mHomeMapCommon.startRefreshUserLocation()
|
||||
}
|
||||
ViewUtil.instance.viewShow(mViewBinding.homeMapLiveBtn)
|
||||
mMapViewModel.setDeviceStateAndWarningData(
|
||||
mContext!!,
|
||||
getHomeV2Activity()?.getPet(),
|
||||
@@ -359,72 +351,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示被删除邀请的弹窗
|
||||
*/
|
||||
private fun showDeleteInviteDialog(deleteArray: MutableList<FamilyBean>) {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val myDeviceDb = MyDatabase.deviceDao().findAll(MyDatabase.DeviceTableName)
|
||||
myDeviceDb?.apply {
|
||||
for (deviceDb in myDeviceDb) {
|
||||
for (item in deleteArray) {
|
||||
if (deviceDb.deviceId == item.deviceId) {
|
||||
MyDatabase.deviceDao().delete(deviceDb)
|
||||
LogUtil.e("删除了邀请的设备")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val newDeviceDb = MyDatabase.deviceDao().findAll(MyDatabase.DeviceTableName)
|
||||
newDeviceDb?.apply {
|
||||
LogUtil.e("删去了邀请,还剩${newDeviceDb.size}下个设备")
|
||||
}
|
||||
}
|
||||
CommonDialog1(
|
||||
mContext!!,
|
||||
getString(R.string.txt_setting_notification),
|
||||
getString(R.string.txt_view_access),
|
||||
false,
|
||||
okClickListener = object : BaseDialog.OnDialogOkListener {
|
||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
getHomeV2Activity()?.apply {
|
||||
if (mPetList.size == 0) {
|
||||
noSharePet()
|
||||
} else {
|
||||
onChangeClick(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}).show()
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示被邀请通知弹窗
|
||||
*/
|
||||
private fun showInviteDialog(inviteArray: MutableList<FamilyBean>) {
|
||||
for (item in inviteArray) {
|
||||
val content = String.format(
|
||||
getString(R.string.txt_invites_you_check), item.userName, item.petName
|
||||
)
|
||||
CommonDialog1(
|
||||
mContext!!,
|
||||
getString(R.string.txt_setting_notification),
|
||||
content,
|
||||
false,
|
||||
okClickListener = object : BaseDialog.OnDialogOkListener {
|
||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
getHomeV2Activity()?.apply {
|
||||
startActivity(
|
||||
this, Intent(
|
||||
this, MyTrackerV2Activity::class.java
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}).show()
|
||||
}
|
||||
}
|
||||
|
||||
private val mPermissionsTips =
|
||||
"ABBIDOT APP collects location data,The route and distance between the current location and the device can be calculated."
|
||||
|
||||
@@ -537,6 +463,11 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
mCurrentShowPetPos = position
|
||||
|
||||
//隐藏蓝牙nearby
|
||||
mViewBinding.ilHomeMapDeviceMsg.root.visibility = View.GONE
|
||||
mViewBinding.llHomeMapDeviceBatteryLayout.visibility = View.INVISIBLE
|
||||
mViewBinding.ilHomeMapPetLocation.root.visibility = View.GONE
|
||||
|
||||
ViewUtil.instance.selectPetDialogShow(
|
||||
mContext,
|
||||
mPetList,
|
||||
@@ -553,7 +484,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
it.isCloseBattery = false
|
||||
it.canShowBattery = false
|
||||
}
|
||||
mViewBinding.ilHomeMapDeviceMsg.root.visibility = View.GONE
|
||||
showLoading(true)
|
||||
val pet = mPetList[position]
|
||||
//重新设置地图宠物头像
|
||||
@@ -571,11 +501,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
*/
|
||||
private fun setMapData(mapDeviceBean: MapDeviceBean) {
|
||||
mapDeviceBean.apply {
|
||||
//分钟后无上报、没有lte信号或在wifi中隐藏直播按钮
|
||||
mViewBinding.homeMapLiveBtn.visibility =
|
||||
if (Util.isTimeoutReport(updateTime) || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || inWifiZone == ConstantInt.Type1) View.GONE
|
||||
else View.VISIBLE
|
||||
|
||||
setMapDeviceBean(this)
|
||||
//设置循环查询时间间隔 30秒
|
||||
mMapViewModel.updateMillisInFuture(0.5f)
|
||||
@@ -595,6 +520,11 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
|
||||
private fun setMapDeviceBean(mapDeviceBean: MapDeviceBean) {
|
||||
mapDeviceBean.apply {
|
||||
//分钟后无上报、没有lte信号或在wifi中隐藏直播按钮
|
||||
mViewBinding.homeMapLiveBtn.visibility =
|
||||
if (Util.isTimeoutReport(updateTime) || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1) View.GONE
|
||||
else View.VISIBLE
|
||||
|
||||
mViewBinding.ilHomeMapDeviceBatteryLayout.let {
|
||||
mMapViewModel.setMapDeviceBattery(
|
||||
mContext!!, mapDeviceBean, it.root, it.tvDeviceBatteryInfo, it.ivDeviceCloseBtn
|
||||
|
||||
@@ -51,9 +51,14 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
|
||||
private var mRippleCirclePercent = 0.0
|
||||
private var mRippleCircleRadius = 200
|
||||
|
||||
//是否是地图摄像头移动了
|
||||
private var isMapCameraMove = false
|
||||
private var mPetAddressTimeFormat = Utils.DATE_FORMAT_PATTERN_EN11
|
||||
|
||||
//是否需要反编译地理位置
|
||||
private var isReverseGeocode = false
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(
|
||||
@@ -61,11 +66,13 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
locationLayoutViewBinding: LayoutPetLocationInfoBinding,
|
||||
deviceBatteryLayout: ViewGroup,
|
||||
petAddressTimeFormat: String,
|
||||
isGeocode: Boolean,
|
||||
mapLoadOk: () -> Unit
|
||||
) = HomeMapGoogleMapFragmentV3().apply {
|
||||
mContext = context
|
||||
mDeviceBatteryLayout = deviceBatteryLayout
|
||||
mPetLocationLayoutBinding = locationLayoutViewBinding
|
||||
isReverseGeocode = isGeocode
|
||||
mPetAddressTimeFormat = petAddressTimeFormat
|
||||
mMapLoadOk = mapLoadOk
|
||||
}
|
||||
@@ -114,6 +121,10 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
}
|
||||
}
|
||||
setOnCameraMoveListener {
|
||||
//监听地图放大缩小操作
|
||||
if (getGoogleMapZoom() != cameraPosition.zoom) {
|
||||
setGoogleMapZoom(cameraPosition.zoom)
|
||||
}
|
||||
isMapCameraMove = true
|
||||
setMarkerInfoViewOffset()
|
||||
}
|
||||
@@ -154,7 +165,9 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
*/
|
||||
private fun startReverseGeocode() {
|
||||
mMapDeviceBean?.apply {
|
||||
mGeoCoderViewModel.getLatLonAddress(latitude, longitude, false)
|
||||
if (isReverseGeocode) {
|
||||
mGeoCoderViewModel.getLatLonAddress(latitude, longitude, false)
|
||||
}
|
||||
setMarkerInfoViewOffset()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,11 +168,14 @@ class SRBleUtil private constructor() {
|
||||
gatt: BluetoothGatt,
|
||||
status: Int
|
||||
) {
|
||||
LogUtil.e("蓝牙断开${bleDevice.name},${bleDevice.mac},activeDisConnected=$isActiveDisConnected,status=$status")
|
||||
notifyDeviceState(bleDevice, ConState.DISCONNECTED)
|
||||
LogUtil.e("蓝牙断开${bleDevice.name},${bleDevice.mac},activeDisConnected=$isActiveDisConnected,status=$status,mContext=$mContext")
|
||||
mContext?.apply {
|
||||
if (isBleEnable(this) && !isActiveDisConnected) {
|
||||
connect(bleDevice)
|
||||
//蓝牙关闭不需要发送断开连接,因为主页已监听蓝牙开关,发送断开连接
|
||||
if (isBleEnable(this)) {
|
||||
notifyDeviceState(bleDevice, ConState.DISCONNECTED)
|
||||
if (!isActiveDisConnected) {
|
||||
connect(bleDevice)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||
import com.abbidot.tracker.widget.TypefaceButton
|
||||
import com.abbidot.tracker.widget.TypefaceTextView
|
||||
import com.clj.fastble.BleManager
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class MapViewModel : ViewModel() {
|
||||
@@ -188,7 +189,6 @@ class MapViewModel : ViewModel() {
|
||||
setWaringData(context, mapDeviceBean, deviceMsgList, isLive)
|
||||
}
|
||||
setDeviceState(context, mapDeviceBean, deviceStateList)
|
||||
|
||||
deviceStateAdapter.notifyItemRangeChanged(0, deviceStateList.size)
|
||||
deviceMsgAdapter.setData(deviceMsgList)
|
||||
deviceMsgAdapter.notifyDataSetChanged()
|
||||
@@ -219,7 +219,7 @@ class MapViewModel : ViewModel() {
|
||||
) {
|
||||
mapDeviceBean.apply {
|
||||
tvDeviceMsgView.setBackgroundResource(R.color.device_msg_color1)
|
||||
if (null != petBean && null != SRBleUtil.instance.getConnectMacDevice(petBean.macID)) {
|
||||
if (null != petBean && BleManager.getInstance().isConnected(petBean.macID)) {
|
||||
if (isCloseMsg && mDeviceMsgType == ConstantInt.Type0) {
|
||||
|
||||
} else {
|
||||
@@ -256,8 +256,8 @@ class MapViewModel : ViewModel() {
|
||||
rootView.visibility = View.GONE
|
||||
}
|
||||
setDeviceState(context, mapDeviceBean, deviceStateList)
|
||||
|
||||
deviceStateAdapter.notifyItemRangeChanged(0, deviceStateList.size)
|
||||
// deviceStateAdapter.notifyItemRangeChanged(0, deviceStateList.size)
|
||||
deviceStateAdapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import kotlinx.coroutines.launch
|
||||
*/
|
||||
class UserProfileViewModel : ViewModel() {
|
||||
|
||||
val mGetEmailCodeLiveData = MutableLiveData<Result<String>>()
|
||||
val mGetEmailCodeLiveData = MutableLiveData<Result<UserBean>>()
|
||||
val mValidateCodeLiveData = MutableLiveData<Result<String>>()
|
||||
private val mRegisterLiveData = MutableLiveData<Result<String>>()
|
||||
val mCountryCodeLiveData = MutableLiveData<Result<MutableList<CountryCodeBean>>>()
|
||||
|
||||
@@ -87,14 +87,6 @@
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:layoutDirection="rtl" />
|
||||
|
||||
<include
|
||||
android:id="@+id/il_live_v2_bluetooth_find_device"
|
||||
layout="@layout/layout_bluetooth_find_device"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
<include
|
||||
android:id="@+id/il_live_v3_map_pet_location"
|
||||
@@ -133,6 +125,14 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include
|
||||
android:id="@+id/il_live_v2_bluetooth_find_device"
|
||||
layout="@layout/layout_bluetooth_find_device"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<include
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_below="@id/il_login_v2_email_address"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:text="@string/txt_please_enter_email"
|
||||
android:text="@string/txt_valid_email"
|
||||
android:textColor="@color/red_color2"
|
||||
android:textSize="@dimen/textSize14"
|
||||
android:visibility="gone"
|
||||
|
||||
Reference in New Issue
Block a user