1. wifi zone定位点设置,改为拖动地图设置
2.添加被绑定设备增加提示被绑定的邮箱
This commit is contained in:
@@ -570,16 +570,24 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
|||||||
val exceptionMessage = it.exceptionOrNull()?.message
|
val exceptionMessage = it.exceptionOrNull()?.message
|
||||||
//服务器返回错误code
|
//服务器返回错误code
|
||||||
val exceptionCode: String? = it.exceptionOrNull()?.toString()
|
val exceptionCode: String? = it.exceptionOrNull()?.toString()
|
||||||
LogUtil.d("Throwable?", "code=${exceptionCode},${exceptionMessage}")
|
LogUtil.d("Throwable异常", "code=${exceptionCode},${exceptionMessage}")
|
||||||
if (null != exceptionCode) {
|
if (null != exceptionCode) {
|
||||||
//处理注册用户已存在的情况
|
//处理注册用户已存在的情况
|
||||||
if (exceptionCode == ErrorCode.USER_HAS_EXIST.toString()) {
|
if (exceptionCode == ErrorCode.USER_HAS_EXIST.toString()) {
|
||||||
getResultCallback.onRequestError(exceptionCode)
|
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
|
//拦截请求异常code
|
||||||
if (netErrorCodeTips(exceptionCode, isShowCodeError)) {
|
else if (netErrorCodeTips(exceptionCode, isShowCodeError)) {
|
||||||
//已经处理相关错误码就直接返回
|
//已经处理相关错误码就直接返回
|
||||||
getResultCallback.onErrorCode()
|
getResultCallback.onInterceptCode()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -685,10 +693,10 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//该设备已被绑定
|
//该设备已被绑定
|
||||||
ErrorCode.DEVICE_HAS_BIND.toString() -> {
|
// ErrorCode.DEVICE_HAS_BIND.toString() -> {
|
||||||
if (isShowCodeError) showToast(R.string.txt_device_has_bind)
|
// if (isShowCodeError) showToast(R.string.txt_device_has_bind)
|
||||||
return true
|
// return true
|
||||||
}
|
// }
|
||||||
//设备不存在
|
//设备不存在
|
||||||
ErrorCode.DEVICE_NOT_EXIST.toString() -> {
|
ErrorCode.DEVICE_NOT_EXIST.toString() -> {
|
||||||
if (isShowCodeError) showToast(R.string.txt_no_dfu)
|
if (isShowCodeError) showToast(R.string.txt_no_dfu)
|
||||||
|
|||||||
@@ -9,12 +9,16 @@ import kotlinx.parcelize.Parcelize
|
|||||||
* @description:设备详情
|
* @description:设备详情
|
||||||
*/
|
*/
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class DeviceDetailBean(var deviceOutId: String,
|
data class DeviceDetailBean(
|
||||||
|
var deviceOutId: String,
|
||||||
var deviceId: String,
|
var deviceId: String,
|
||||||
var macId: String,
|
var macId: String,
|
||||||
|
var email: String,
|
||||||
var pet: PetBean?,
|
var pet: PetBean?,
|
||||||
var fenceCount: Int,
|
var fenceCount: Int,
|
||||||
var surplusDays: Int,
|
var surplusDays: Int,
|
||||||
var familieCount: Int,var deviceInfo:DeviceInfoBean?) : Parcelable {
|
var familieCount: Int,
|
||||||
constructor() : this("", "", "", null, 0, 0,0,null)
|
var deviceInfo: DeviceInfoBean?
|
||||||
|
) : Parcelable {
|
||||||
|
constructor() : this("", "", "", "", null, 0, 0, 0, null)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ interface GetResultCallback {
|
|||||||
|
|
||||||
//默认可以不重写,相当于java中的default修饰的
|
//默认可以不重写,相当于java中的default修饰的
|
||||||
fun onRequestError(exceptionCode: String?) {}
|
fun onRequestError(exceptionCode: String?) {}
|
||||||
fun onErrorCode() {}
|
//已拦截的code
|
||||||
|
fun onInterceptCode() {}
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ class NotificationV2Activity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onErrorCode() {
|
override fun onInterceptCode() {
|
||||||
mPullAction?.let { p ->
|
mPullAction?.let { p ->
|
||||||
mViewBinding.ilNotificationV2MessageLayout.pullRefreshAndLoadMoreLayout.finishActionRun(
|
mViewBinding.ilNotificationV2MessageLayout.pullRefreshAndLoadMoreLayout.finishActionRun(
|
||||||
p
|
p
|
||||||
|
|||||||
@@ -135,8 +135,8 @@ class AddNewTracker3Activity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onErrorCode() {
|
override fun onInterceptCode() {
|
||||||
super.onErrorCode()
|
super.onInterceptCode()
|
||||||
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
|
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
|
||||||
setNoConnectState()
|
setNoConnectState()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
|||||||
setLedControlState()
|
setLedControlState()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onErrorCode() {
|
override fun onInterceptCode() {
|
||||||
setLedControlState()
|
setLedControlState()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -177,7 +177,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
|||||||
setLedModeControlState()
|
setLedModeControlState()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onErrorCode() {
|
override fun onInterceptCode() {
|
||||||
setLedModeControlState()
|
setLedModeControlState()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onErrorCode() {
|
override fun onInterceptCode() {
|
||||||
setButtonEnabled(
|
setButtonEnabled(
|
||||||
mViewBinding.ilLiveV2OperateLayout.llLiveV2StopLive, ConstantInt.Type1
|
mViewBinding.ilLiveV2OperateLayout.llLiveV2StopLive, ConstantInt.Type1
|
||||||
)
|
)
|
||||||
@@ -468,7 +468,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onErrorCode() {
|
override fun onInterceptCode() {
|
||||||
setErrorLedState()
|
setErrorLedState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ class HomeTrackFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onErrorCode() {
|
override fun onInterceptCode() {
|
||||||
setLedErrorState()
|
setLedErrorState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
|||||||
mMapViewModel.updateMillisInFuture(0.05f)
|
mMapViewModel.updateMillisInFuture(0.05f)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onErrorCode() {
|
override fun onInterceptCode() {
|
||||||
stopRefreshLocation()
|
stopRefreshLocation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import com.abbidot.tracker.bean.HistoryDataBean
|
|||||||
import com.abbidot.tracker.vm.GeoCoderViewModel
|
import com.abbidot.tracker.vm.GeoCoderViewModel
|
||||||
import com.google.android.gms.maps.GoogleMap
|
import com.google.android.gms.maps.GoogleMap
|
||||||
import com.google.android.gms.maps.model.LatLng
|
import com.google.android.gms.maps.model.LatLng
|
||||||
import com.google.android.gms.maps.model.Marker
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Created by .yzq on 2024/6/4/004.
|
*Created by .yzq on 2024/6/4/004.
|
||||||
@@ -34,26 +33,33 @@ class WiFiZone2GoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
mDecWifiAddressData = HistoryDataBean()
|
mDecWifiAddressData = HistoryDataBean()
|
||||||
|
|
||||||
googleMap.apply {
|
googleMap.apply {
|
||||||
setOnMarkerDragListener(object : GoogleMap.OnMarkerDragListener {
|
// setOnMarkerDragListener(object : GoogleMap.OnMarkerDragListener {
|
||||||
override fun onMarkerDrag(marker: Marker) {
|
// 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)
|
||||||
|
// }
|
||||||
|
|
||||||
|
setOnCameraIdleListener {
|
||||||
|
getCameraCenterLatLng(this, true)
|
||||||
}
|
}
|
||||||
|
setOnCameraMoveListener {
|
||||||
override fun onMarkerDragEnd(marker: Marker) {
|
getCameraCenterLatLng(this)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//点击地图任意地方都不消失自定义头部地点布局
|
//点击地图任意地方都不消失自定义头部地点布局
|
||||||
@@ -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) {
|
private fun geoCoderLatLon(latitude: Double, longitude: Double) {
|
||||||
mDecWifiAddressData?.apply {
|
mDecWifiAddressData?.apply {
|
||||||
this.latitude = latitude
|
this.latitude = latitude
|
||||||
@@ -91,10 +107,10 @@ class WiFiZone2GoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
override fun locationSuccess(location: Location?) {
|
override fun locationSuccess(location: Location?) {
|
||||||
location?.apply {
|
location?.apply {
|
||||||
val latLng = LatLng(latitude, longitude)
|
val latLng = LatLng(latitude, longitude)
|
||||||
moveCameraLocation(latLng, true)
|
moveCameraLocation(latLng)
|
||||||
if (null == mMarker) {
|
if (null == mMarker) {
|
||||||
mMarker = addImageMarker(
|
mMarker = addImageMarker(
|
||||||
latLng, R.drawable.icon_location_svg, anchorCenter = false, isDraggable = true
|
latLng, R.drawable.icon_location_svg, anchorCenter = false
|
||||||
)
|
)
|
||||||
} else mMarker?.position = latLng
|
} else mMarker?.position = latLng
|
||||||
geoCoderLatLon(latitude, longitude)
|
geoCoderLatLon(latitude, longitude)
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ public final class BrowserView extends WebView {
|
|||||||
DialogUtils.Companion.showEditTextDialog(mWebView.getContext(), message, defaultValue
|
DialogUtils.Companion.showEditTextDialog(mWebView.getContext(), message, defaultValue
|
||||||
, new GetResultCallback() {
|
, new GetResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onErrorCode() {
|
public void onInterceptCode() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -398,7 +398,7 @@
|
|||||||
<string name="txt_upgrade_start">Vorbereitung des Updates</string>
|
<string name="txt_upgrade_start">Vorbereitung des Updates</string>
|
||||||
<string name="txt_device_connect_success">Gerät erfolgreich verbunden</string>
|
<string name="txt_device_connect_success">Gerät erfolgreich verbunden</string>
|
||||||
<string name="txt_latest_version">Aktuell neueste Version</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_activity">Aktivität</string>
|
||||||
<string name="txt_route">Route</string>
|
<string name="txt_route">Route</string>
|
||||||
<string name="txt_pet">Haustier</string>
|
<string name="txt_pet">Haustier</string>
|
||||||
|
|||||||
@@ -442,7 +442,7 @@
|
|||||||
<string name="txt_upgrade_start">准备升级</string>
|
<string name="txt_upgrade_start">准备升级</string>
|
||||||
<string name="txt_device_connect_success">设备连接成功</string>
|
<string name="txt_device_connect_success">设备连接成功</string>
|
||||||
<string name="txt_latest_version">已是最新版本</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_activity">活动</string>
|
||||||
<string name="txt_route">路线</string>
|
<string name="txt_route">路线</string>
|
||||||
<string name="txt_pet">宠物</string>
|
<string name="txt_pet">宠物</string>
|
||||||
|
|||||||
@@ -500,7 +500,7 @@
|
|||||||
<string name="txt_upgrade_start">Preparing for Upgrade</string>
|
<string name="txt_upgrade_start">Preparing for Upgrade</string>
|
||||||
<string name="txt_device_connect_success">Device successfully connected</string>
|
<string name="txt_device_connect_success">Device successfully connected</string>
|
||||||
<string name="txt_latest_version">Already latest version</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_activity">Activity</string>
|
||||||
<string name="txt_route">Route</string>
|
<string name="txt_route">Route</string>
|
||||||
<string name="txt_pet">Pet</string>
|
<string name="txt_pet">Pet</string>
|
||||||
|
|||||||
@@ -72,7 +72,10 @@ abstract class BaseNetworkApi<I>(private val baseUrl: String) : IService<I> {
|
|||||||
return Result.success("${ErrorCode.CREDIT_CARD_PAY_FAIL}" as T)
|
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(
|
throw NetworkErrorCodeException.of(
|
||||||
response.code, "exception code is ${response.code},response code not 200"
|
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),不需要处理结果数据
|
//适用于只管请求成功(T=String),不需要处理结果数据
|
||||||
val data = response.data
|
val data = response.data
|
||||||
if (null == data || data == "") {
|
if (null == data || data == "") {
|
||||||
|
|
||||||
//处理信用卡支付返回结果
|
//处理信用卡支付返回结果
|
||||||
if (response.code == ErrorCode.OK) {
|
|
||||||
val message = response.message
|
val message = response.message
|
||||||
if (message == "支付成功") {
|
if (message == "支付成功") {
|
||||||
return Result.success("${ErrorCode.CREDIT_CARD_PAY_SUCCESS}" as T)
|
return Result.success("${ErrorCode.CREDIT_CARD_PAY_SUCCESS}" as T)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//throw NetworkException.of(ErrorCode.VALUE_IS_NULL, "response data is null")
|
//throw NetworkException.of(ErrorCode.VALUE_IS_NULL, "response data is null")
|
||||||
return Result.success("${response.code}" as T)
|
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 RETRY_COUNT = 1
|
||||||
|
|
||||||
//请求超时时间
|
//请求超时时间
|
||||||
private const val REQUEST_TIMEOUT=40L
|
private const val REQUEST_TIMEOUT = 40L
|
||||||
private val defaultOkHttpClient by lazy {
|
private val defaultOkHttpClient by lazy {
|
||||||
val builder = OkHttpClient.Builder().callTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS)
|
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)
|
.writeTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS).retryOnConnectionFailure(true)
|
||||||
//添加拦截器
|
//添加拦截器
|
||||||
builder.addInterceptor(CommonRequestInterceptor())
|
builder.addInterceptor(CommonRequestInterceptor())
|
||||||
|
|||||||
Reference in New Issue
Block a user