1. wifi zone定位点设置,改为拖动地图设置

2.添加被绑定设备增加提示被绑定的邮箱
This commit is contained in:
yezhiqiu
2026-05-11 17:04:05 +08:00
parent 0654ec87bc
commit 46c0a5b2a4
15 changed files with 91 additions and 61 deletions

View File

@@ -570,16 +570,24 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
val exceptionMessage = it.exceptionOrNull()?.message
//服务器返回错误code
val exceptionCode: String? = it.exceptionOrNull()?.toString()
LogUtil.d("Throwable", "code=${exceptionCode},${exceptionMessage}")
LogUtil.d("Throwable异常", "code=${exceptionCode},${exceptionMessage}")
if (null != exceptionCode) {
//处理注册用户已存在的情况
if (exceptionCode == ErrorCode.USER_HAS_EXIST.toString()) {
getResultCallback.onRequestError(exceptionCode)
}
if (exceptionCode == ErrorCode.DEVICE_HAS_BIND.toString()) {
val str =
String.format(getString(R.string.txt_device_has_bind), exceptionMessage)
showToast(str)
getResultCallback.onInterceptCode()
return
}
//拦截请求异常code
if (netErrorCodeTips(exceptionCode, isShowCodeError)) {
else if (netErrorCodeTips(exceptionCode, isShowCodeError)) {
//已经处理相关错误码就直接返回
getResultCallback.onErrorCode()
getResultCallback.onInterceptCode()
return
}
}
@@ -685,10 +693,10 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
return true
}
//该设备已被绑定
ErrorCode.DEVICE_HAS_BIND.toString() -> {
if (isShowCodeError) showToast(R.string.txt_device_has_bind)
return true
}
// ErrorCode.DEVICE_HAS_BIND.toString() -> {
// if (isShowCodeError) showToast(R.string.txt_device_has_bind)
// return true
// }
//设备不存在
ErrorCode.DEVICE_NOT_EXIST.toString() -> {
if (isShowCodeError) showToast(R.string.txt_no_dfu)

View File

@@ -9,12 +9,16 @@ import kotlinx.parcelize.Parcelize
* @description:设备详情
*/
@Parcelize
data class DeviceDetailBean(var deviceOutId: String,
var deviceId: String,
var macId: String,
var pet: PetBean?,
var fenceCount: Int,
var surplusDays: Int,
var familieCount: Int,var deviceInfo:DeviceInfoBean?) : Parcelable {
constructor() : this("", "", "", null, 0, 0,0,null)
data class DeviceDetailBean(
var deviceOutId: String,
var deviceId: String,
var macId: String,
var email: String,
var pet: PetBean?,
var fenceCount: Int,
var surplusDays: Int,
var familieCount: Int,
var deviceInfo: DeviceInfoBean?
) : Parcelable {
constructor() : this("", "", "", "", null, 0, 0, 0, null)
}

View File

@@ -10,5 +10,6 @@ interface GetResultCallback {
//默认可以不重写相当于java中的default修饰的
fun onRequestError(exceptionCode: String?) {}
fun onErrorCode() {}
//已拦截的code
fun onInterceptCode() {}
}

View File

@@ -91,7 +91,7 @@ class NotificationV2Activity :
}
}
override fun onErrorCode() {
override fun onInterceptCode() {
mPullAction?.let { p ->
mViewBinding.ilNotificationV2MessageLayout.pullRefreshAndLoadMoreLayout.finishActionRun(
p

View File

@@ -135,8 +135,8 @@ class AddNewTracker3Activity :
}
}
override fun onErrorCode() {
super.onErrorCode()
override fun onInterceptCode() {
super.onInterceptCode()
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
setNoConnectState()
}

View File

@@ -159,7 +159,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
setLedControlState()
}
override fun onErrorCode() {
override fun onInterceptCode() {
setLedControlState()
}
})
@@ -177,7 +177,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
setLedModeControlState()
}
override fun onErrorCode() {
override fun onInterceptCode() {
setLedModeControlState()
}
})

View File

@@ -377,7 +377,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
}
}
override fun onErrorCode() {
override fun onInterceptCode() {
setButtonEnabled(
mViewBinding.ilLiveV2OperateLayout.llLiveV2StopLive, ConstantInt.Type1
)
@@ -468,7 +468,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
}
}
override fun onErrorCode() {
override fun onInterceptCode() {
setErrorLedState()
}

View File

@@ -415,7 +415,7 @@ class HomeTrackFragment :
}
}
override fun onErrorCode() {
override fun onInterceptCode() {
setLedErrorState()
}

View File

@@ -271,7 +271,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
mMapViewModel.updateMillisInFuture(0.05f)
}
override fun onErrorCode() {
override fun onInterceptCode() {
stopRefreshLocation()
}

View File

@@ -8,7 +8,6 @@ import com.abbidot.tracker.bean.HistoryDataBean
import com.abbidot.tracker.vm.GeoCoderViewModel
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.Marker
/**
*Created by .yzq on 2024/6/4/004.
@@ -34,26 +33,33 @@ class WiFiZone2GoogleMapFragment : BaseGoogleMapFragment() {
mDecWifiAddressData = HistoryDataBean()
googleMap.apply {
setOnMarkerDragListener(object : GoogleMap.OnMarkerDragListener {
override fun onMarkerDrag(marker: Marker) {
// setOnMarkerDragListener(object : GoogleMap.OnMarkerDragListener {
// override fun onMarkerDrag(marker: Marker) {
//
// }
//
// override fun onMarkerDragEnd(marker: Marker) {
// marker.position.let {
// val newLatLng = toGpsLatLon(LatLng(it.latitude, it.longitude))
// geoCoderLatLon(newLatLng.latitude, newLatLng.longitude)
// }
// }
//
// override fun onMarkerDragStart(marker: Marker) {
// }
// })
//
// setOnMapLongClickListener { latLng ->
// mMarker?.position = latLng
// val newLatLng = toGpsLatLon(latLng)
// geoCoderLatLon(newLatLng.latitude, newLatLng.longitude)
// }
}
override fun onMarkerDragEnd(marker: Marker) {
marker.position.let {
val newLatLng = toGpsLatLon(LatLng(it.latitude, it.longitude))
geoCoderLatLon(newLatLng.latitude, newLatLng.longitude)
}
}
override fun onMarkerDragStart(marker: Marker) {
}
})
setOnMapLongClickListener { latLng ->
mMarker?.position = latLng
val newLatLng = toGpsLatLon(latLng)
geoCoderLatLon(newLatLng.latitude, newLatLng.longitude)
setOnCameraIdleListener {
getCameraCenterLatLng(this, true)
}
setOnCameraMoveListener {
getCameraCenterLatLng(this)
}
//点击地图任意地方都不消失自定义头部地点布局
@@ -80,6 +86,16 @@ class WiFiZone2GoogleMapFragment : BaseGoogleMapFragment() {
}
}
private fun getCameraCenterLatLng(googleMap: GoogleMap, isNeedGeoCoder: Boolean = false) {
googleMap.cameraPosition.let {
mMarker?.position = it.target
if (isNeedGeoCoder) {
val newLatLng = toGpsLatLon(it.target)
geoCoderLatLon(newLatLng.latitude, newLatLng.longitude)
}
}
}
private fun geoCoderLatLon(latitude: Double, longitude: Double) {
mDecWifiAddressData?.apply {
this.latitude = latitude
@@ -91,10 +107,10 @@ class WiFiZone2GoogleMapFragment : BaseGoogleMapFragment() {
override fun locationSuccess(location: Location?) {
location?.apply {
val latLng = LatLng(latitude, longitude)
moveCameraLocation(latLng, true)
moveCameraLocation(latLng)
if (null == mMarker) {
mMarker = addImageMarker(
latLng, R.drawable.icon_location_svg, anchorCenter = false, isDraggable = true
latLng, R.drawable.icon_location_svg, anchorCenter = false
)
} else mMarker?.position = latLng
geoCoderLatLon(latitude, longitude)

View File

@@ -327,7 +327,7 @@ public final class BrowserView extends WebView {
DialogUtils.Companion.showEditTextDialog(mWebView.getContext(), message, defaultValue
, new GetResultCallback() {
@Override
public void onErrorCode() {
public void onInterceptCode() {
}

View File

@@ -398,7 +398,7 @@
<string name="txt_upgrade_start">Vorbereitung des Updates</string>
<string name="txt_device_connect_success">Gerät erfolgreich verbunden</string>
<string name="txt_latest_version">Aktuell neueste Version</string>
<string name="txt_device_has_bind">Tracker ist mit anderem Konto gekoppelt</string>
<string name="txt_device_has_bind">Der Tracker ist mit %s gekoppelt.</string>
<string name="txt_activity">Aktivität</string>
<string name="txt_route">Route</string>
<string name="txt_pet">Haustier</string>

View File

@@ -442,7 +442,7 @@
<string name="txt_upgrade_start">准备升级</string>
<string name="txt_device_connect_success">设备连接成功</string>
<string name="txt_latest_version">已是最新版本</string>
<string name="txt_device_has_bind">该设备已被绑定</string>
<string name="txt_device_has_bind">该设备已被%s绑定</string>
<string name="txt_activity">活动</string>
<string name="txt_route">路线</string>
<string name="txt_pet">宠物</string>

View File

@@ -500,7 +500,7 @@
<string name="txt_upgrade_start">Preparing for Upgrade</string>
<string name="txt_device_connect_success">Device successfully connected</string>
<string name="txt_latest_version">Already latest version</string>
<string name="txt_device_has_bind">The tracker is paired with another account</string>
<string name="txt_device_has_bind">The tracker is paired with %s.</string>
<string name="txt_activity">Activity</string>
<string name="txt_route">Route</string>
<string name="txt_pet">Pet</string>

View File

@@ -72,7 +72,10 @@ abstract class BaseNetworkApi<I>(private val baseUrl: String) : IService<I> {
return Result.success("${ErrorCode.CREDIT_CARD_PAY_FAIL}" as T)
}
}
//设备已被绑定
else if (response.code == ErrorCode.DEVICE_HAS_BIND) {
throw NetworkErrorCodeException.of(response.code, response.message + "")
}
throw NetworkErrorCodeException.of(
response.code, "exception code is ${response.code},response code not 200"
@@ -81,15 +84,11 @@ abstract class BaseNetworkApi<I>(private val baseUrl: String) : IService<I> {
//适用于只管请求成功(T=String),不需要处理结果数据
val data = response.data
if (null == data || data == "") {
//处理信用卡支付返回结果
if (response.code == ErrorCode.OK) {
val message = response.message
if (message == "支付成功") {
return Result.success("${ErrorCode.CREDIT_CARD_PAY_SUCCESS}" as T)
}
val message = response.message
if (message == "支付成功") {
return Result.success("${ErrorCode.CREDIT_CARD_PAY_SUCCESS}" as T)
}
//throw NetworkException.of(ErrorCode.VALUE_IS_NULL, "response data is null")
return Result.success("${response.code}" as T)
}
@@ -114,11 +113,13 @@ abstract class BaseNetworkApi<I>(private val baseUrl: String) : IService<I> {
//失败重试请求次数
private const val RETRY_COUNT = 1
//请求超时时间
private const val REQUEST_TIMEOUT=40L
private const val REQUEST_TIMEOUT = 40L
private val defaultOkHttpClient by lazy {
val builder = OkHttpClient.Builder().callTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS)
.connectTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS).readTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS)
.connectTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS)
.readTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS)
.writeTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS).retryOnConnectionFailure(true)
//添加拦截器
builder.addInterceptor(CommonRequestInterceptor())