Merge branch 'dev_arch_opt_3.0' into 'dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0'
Dev arch opt 3.0 See merge request zhjt/AndroidApp/MoGoEagleEye!659
This commit is contained in:
@@ -318,7 +318,7 @@
|
||||
android:id="@+id/tbOpenMfView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="打开蘑方按键Toast"
|
||||
android:text="蘑方按键Toast"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:visibility="gone"
|
||||
|
||||
@@ -126,6 +126,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
}
|
||||
//设置长链接的secretKey 通过SHA1和包名找中台服务生成,后续包名分渠道,需要做对应操作
|
||||
clientConfig.secretKey = "YMj2VFDFxJ3Q4gNoZceJ"
|
||||
// clientConfig.secretKey = "n48AlVufihvMDWgzwHX42yzSgiWaad6v"
|
||||
|
||||
clientConfig.iHttpCurrentLocation = object : ICurrentLocation {
|
||||
override fun getCurrentLocation(): SimpleLocation {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.mogo.map.location
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
import com.amap.api.location.AMapLocation
|
||||
import com.amap.api.location.AMapLocationClient
|
||||
import com.amap.api.location.AMapLocationClientOption
|
||||
@@ -29,6 +31,12 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
|
||||
*/
|
||||
private var lastGaoDeLocation: MogoLocation = MogoLocation()
|
||||
|
||||
private val handler by lazy {
|
||||
val thread = HandlerThread("GDLocationChange")
|
||||
thread.start()
|
||||
Handler(thread.looper)
|
||||
}
|
||||
|
||||
init {
|
||||
AMapLocationClient.updatePrivacyShow(context, true, true)
|
||||
AMapLocationClient.updatePrivacyAgree(context, true)
|
||||
@@ -64,66 +72,68 @@ class GDLocationClient private constructor(context: Context) : AMapLocationListe
|
||||
}
|
||||
|
||||
override fun onLocationChanged(aMapLocation: AMapLocation) {
|
||||
// 更新GNSS 信息
|
||||
lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills()
|
||||
|
||||
// 将高德中的一些用于业务的数据进行融合,例如:CityCode、address等
|
||||
mapLocation?.let {
|
||||
// 转换 GCJ02-->WGS84 坐标
|
||||
val wgs84Location =
|
||||
CoordinateTransform.GCJ02ToWGS84(it.longitude, it.latitude)
|
||||
|
||||
lastGaoDeLocation.longitude = wgs84Location[0]
|
||||
lastGaoDeLocation.latitude = wgs84Location[1]
|
||||
lastGaoDeLocation.heading = it.bearing.toDouble()
|
||||
lastGaoDeLocation.gnssSpeed = it.speed
|
||||
lastGaoDeLocation.altitude = it.altitude
|
||||
lastGaoDeLocation.satelliteTime = it.time
|
||||
handler.post {
|
||||
// 更新GNSS 信息
|
||||
lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills()
|
||||
|
||||
lastGaoDeLocation.locType = 1 // 定位类型为高德坐标(网路或者硬件定位)
|
||||
lastGaoDeLocation.satellite = 4
|
||||
// 将高德中的一些用于业务的数据进行融合,例如:CityCode、address等
|
||||
mapLocation?.let {
|
||||
// 转换 GCJ02-->WGS84 坐标
|
||||
val wgs84Location =
|
||||
CoordinateTransform.GCJ02ToWGS84(it.longitude, it.latitude)
|
||||
|
||||
lastGaoDeLocation.cityName = it.city
|
||||
lastGaoDeLocation.cityCode = it.cityCode
|
||||
lastGaoDeLocation.provider = it.provider
|
||||
lastGaoDeLocation.address = it.address
|
||||
lastGaoDeLocation.district = it.district
|
||||
lastGaoDeLocation.province = it.province
|
||||
lastGaoDeLocation.adCode = it.adCode
|
||||
lastGaoDeLocation.locationDetail = it.locationDetail
|
||||
lastGaoDeLocation.poiName = it.poiName
|
||||
lastGaoDeLocation.aoiName = it.aoiName
|
||||
lastGaoDeLocation.street = it.street
|
||||
lastGaoDeLocation.streetNum = it.streetNum
|
||||
lastGaoDeLocation.description = it.description
|
||||
lastGaoDeLocation.buildingId = it.buildingId
|
||||
lastGaoDeLocation.floor = it.floor
|
||||
lastGaoDeLocation.errorCode = it.errorCode
|
||||
lastGaoDeLocation.errorInfo = it.errorInfo
|
||||
}
|
||||
lastGaoDeLocation.longitude = wgs84Location[0]
|
||||
lastGaoDeLocation.latitude = wgs84Location[1]
|
||||
lastGaoDeLocation.heading = it.bearing.toDouble()
|
||||
lastGaoDeLocation.gnssSpeed = it.speed
|
||||
lastGaoDeLocation.altitude = it.altitude
|
||||
lastGaoDeLocation.satelliteTime = it.time
|
||||
lastGaoDeLocation.lastReceiveTime = TimeUtils.getNowMills()
|
||||
|
||||
// 回掉给监听者
|
||||
CallerGaoDeMapLocationListenerManager.invokeMoGoLocationChanged(lastGaoDeLocation)
|
||||
lastGaoDeLocation.locType = 1 // 定位类型为高德坐标(网路或者硬件定位)
|
||||
lastGaoDeLocation.satellite = 4
|
||||
|
||||
mapLocation = aMapLocation
|
||||
// 本地SP缓存城市Code
|
||||
val cityCode = aMapLocation.cityCode
|
||||
if (cityCode != null && cityCode.isNotEmpty()) {
|
||||
mCityCode = aMapLocation.cityCode
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
|
||||
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode)
|
||||
lastGaoDeLocation.cityName = it.city
|
||||
lastGaoDeLocation.cityCode = it.cityCode
|
||||
lastGaoDeLocation.provider = it.provider
|
||||
lastGaoDeLocation.address = it.address
|
||||
lastGaoDeLocation.district = it.district
|
||||
lastGaoDeLocation.province = it.province
|
||||
lastGaoDeLocation.adCode = it.adCode
|
||||
lastGaoDeLocation.locationDetail = it.locationDetail
|
||||
lastGaoDeLocation.poiName = it.poiName
|
||||
lastGaoDeLocation.aoiName = it.aoiName
|
||||
lastGaoDeLocation.street = it.street
|
||||
lastGaoDeLocation.streetNum = it.streetNum
|
||||
lastGaoDeLocation.description = it.description
|
||||
lastGaoDeLocation.buildingId = it.buildingId
|
||||
lastGaoDeLocation.floor = it.floor
|
||||
lastGaoDeLocation.errorCode = it.errorCode
|
||||
lastGaoDeLocation.errorInfo = it.errorInfo
|
||||
}
|
||||
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
|
||||
.putString(
|
||||
SharedPrefsConstants.LOCATION_LATITUDE,
|
||||
aMapLocation.latitude.toString()
|
||||
)
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
|
||||
.putString(
|
||||
SharedPrefsConstants.LOCATION_LONGITUDE,
|
||||
aMapLocation.longitude.toString()
|
||||
)
|
||||
// 回掉给监听者
|
||||
CallerGaoDeMapLocationListenerManager.invokeMoGoLocationChanged(lastGaoDeLocation)
|
||||
|
||||
mapLocation = aMapLocation
|
||||
// 本地SP缓存城市Code
|
||||
val cityCode = aMapLocation.cityCode
|
||||
if (cityCode != null && cityCode.isNotEmpty()) {
|
||||
mCityCode = aMapLocation.cityCode
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
|
||||
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, cityCode)
|
||||
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
|
||||
.putString(
|
||||
SharedPrefsConstants.LOCATION_LATITUDE,
|
||||
aMapLocation.latitude.toString()
|
||||
)
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp())
|
||||
.putString(
|
||||
SharedPrefsConstants.LOCATION_LONGITUDE,
|
||||
aMapLocation.longitude.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user