Merge remote-tracking branch 'origin/feature/v1.0.4' into feature/v1.0.4
This commit is contained in:
@@ -56,7 +56,7 @@ android {
|
||||
flavorDimensions "product", "env"
|
||||
|
||||
productFlavors {
|
||||
//诺威达
|
||||
// 诺威达
|
||||
nwd {
|
||||
dimension "product"
|
||||
sourceSets {
|
||||
@@ -64,6 +64,16 @@ android {
|
||||
manifest.srcFile 'src/nwd/AndroidManifest.xml'
|
||||
}
|
||||
}
|
||||
applicationId rootProject.ext.android.applicationId
|
||||
}
|
||||
d80x {
|
||||
dimension "product"
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'src/d80x/AndroidManifest.xml'
|
||||
}
|
||||
}
|
||||
applicationId rootProject.ext.android.zhidadoApplicationId
|
||||
}
|
||||
zhidao {
|
||||
dimension "product"
|
||||
@@ -72,6 +82,7 @@ android {
|
||||
manifest.srcFile 'src/main/AndroidManifest.xml'
|
||||
}
|
||||
}
|
||||
applicationId rootProject.ext.android.applicationId
|
||||
}
|
||||
qa {
|
||||
dimension "env"
|
||||
|
||||
25
app/src/d80x/AndroidManifest.xml
Normal file
25
app/src/d80x/AndroidManifest.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.mogo.launcher"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<application
|
||||
android:name=".MogoApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_shell_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme.App"
|
||||
tools:replace="android:label">
|
||||
<!-- 高德地图 -->
|
||||
<meta-data
|
||||
tools:replace="android:value"
|
||||
android:name="com.amap.api.v2.apikey"
|
||||
android:value="40e2e7e773c7562b1f2b13699a93992c" />
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
</manifest>
|
||||
@@ -1,10 +1,11 @@
|
||||
ext {
|
||||
android = [
|
||||
applicationId : "com.mogo.launcher",
|
||||
compileSdkVersion: 28,
|
||||
buildToolsVersion: "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
applicationId : "com.mogo.launcher",
|
||||
zhidadoApplicationId: "com.zhidao.launcher",
|
||||
compileSdkVersion : 28,
|
||||
buildToolsVersion : "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
versionName : "8.0.4",
|
||||
]
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.alibaba.idst.nls.internal.utils.L;
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.AMapUtils;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
@@ -47,6 +46,7 @@ import com.mogo.map.impl.amap.utils.MogoMapUtils;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
@@ -87,6 +87,11 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
private boolean mIsCarLocked = false;
|
||||
|
||||
private float mDefaultZoomLevel = 16.0f;
|
||||
private final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
|
||||
.carCursorRes( R.drawable.map_api_ic_current_location2 )
|
||||
.naviCursorRes( R.drawable.ic_amap_navi_cursor )
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
|
||||
public AMapNaviViewWrapper( AMapNaviView mapView ) {
|
||||
this.mMapView = mapView;
|
||||
@@ -113,8 +118,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
// 设置路线相关的配置属性,如:路线的路况颜色,路线上是否显示摄像头气泡等。
|
||||
// options.setRouteOverlayOptions( MapStyleUtils.getRouteOverlayOptions() );
|
||||
// 设置自车的图片对象
|
||||
options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(),
|
||||
R.drawable.ic_amap_navi_cursor ) );
|
||||
options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), DEFAULT_OPTION.getNaviCursorRes() ) );
|
||||
// 设置指南针图标否在导航界面显示,默认显示。true,显示;false,隐藏。
|
||||
options.setCompassEnabled( false );
|
||||
// 黑夜模式
|
||||
@@ -463,10 +467,10 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
break;
|
||||
case NorthUP_2D:
|
||||
mMapView.setNaviMode( AMapNaviView.NORTH_UP_MODE );
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
Logger.d(TAG,"mCurrentUIMode--->"+mCurrentUIMode.name());
|
||||
Logger.d( TAG, "mCurrentUIMode--->" + mCurrentUIMode.name() );
|
||||
if ( options == null ) {
|
||||
return;
|
||||
}
|
||||
@@ -517,7 +521,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
style.showMyLocation( visible );
|
||||
if ( visible ) {
|
||||
// 强制刷新一遍车标
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromResource( R.drawable.map_api_ic_current_location2 ) );
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromResource( mCarCursorOption.getCarCursorRes() ) );
|
||||
}
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
@@ -840,4 +844,37 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
public synchronized boolean isCarLocked() {
|
||||
return mIsCarLocked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCarCursorOption( CarCursorOption option ) {
|
||||
if ( mCarCursorOption != null ) {
|
||||
mCarCursorOption.destroy();
|
||||
}
|
||||
try {
|
||||
mCarCursorOption = option.clone();
|
||||
} catch ( CloneNotSupportedException e ) {
|
||||
mCarCursorOption = DEFAULT_OPTION;
|
||||
}
|
||||
if ( !checkAMapView() ) {
|
||||
return;
|
||||
}
|
||||
AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
if ( options != null && mCarCursorOption.getNaviCursorRes() != 0 ) {
|
||||
options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), mCarCursorOption.getNaviCursorRes() ) );
|
||||
mMapView.setViewOptions( options );
|
||||
}
|
||||
|
||||
if ( mMapView.getMap() == null ) {
|
||||
return;
|
||||
}
|
||||
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
if ( mCarCursorOption.getCarCursorBmp() != null && !mCarCursorOption.getCarCursorBmp().isRecycled() ) {
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromBitmap( mCarCursorOption.getCarCursorBmp() ) );
|
||||
} else {
|
||||
if ( mCarCursorOption.getCarCursorRes() != 0 ) {
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromResource( mCarCursorOption.getCarCursorRes() ) );
|
||||
}
|
||||
}
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.view.animation.Interpolator;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.MogoMap;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
@@ -252,4 +253,11 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCarCursorOption( CarCursorOption option ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setCarCursorOption( option );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.mogo.map.uicontroller;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
||||
import com.mogo.map.IDestroyable;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-13
|
||||
* <p>
|
||||
* 设置自车图标
|
||||
*/
|
||||
public class CarCursorOption implements Cloneable, IDestroyable {
|
||||
|
||||
private CarCursorOption() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车图标资源
|
||||
*/
|
||||
@DrawableRes
|
||||
private int mCarCursorRes = 0;
|
||||
|
||||
/**
|
||||
* 自车图标图片,优先使用
|
||||
*/
|
||||
private Bitmap mCarCursorBmp;
|
||||
|
||||
/**
|
||||
* 导航图标资源
|
||||
*/
|
||||
@DrawableRes
|
||||
private int mNaviCursorRes = 0;
|
||||
|
||||
public int getCarCursorRes() {
|
||||
return mCarCursorRes;
|
||||
}
|
||||
|
||||
public void setCarCursorRes( int carCursorRes ) {
|
||||
this.mCarCursorRes = carCursorRes;
|
||||
}
|
||||
|
||||
public Bitmap getCarCursorBmp() {
|
||||
return mCarCursorBmp;
|
||||
}
|
||||
|
||||
public void setCarCursorBmp( Bitmap carCursorBmp ) {
|
||||
this.mCarCursorBmp = carCursorBmp;
|
||||
}
|
||||
|
||||
public int getNaviCursorRes() {
|
||||
return mNaviCursorRes;
|
||||
}
|
||||
|
||||
public void setNaviCursorRes( int naviCursorRes ) {
|
||||
this.mNaviCursorRes = naviCursorRes;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private CarCursorOption target;
|
||||
|
||||
public Builder() {
|
||||
target = new CarCursorOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车图标资源
|
||||
*/
|
||||
public Builder carCursorRes( @DrawableRes int redId ) {
|
||||
target.mCarCursorRes = redId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车图标图片,优先使用
|
||||
*/
|
||||
public Builder carCursorBmp( Bitmap bmp ) {
|
||||
target.mCarCursorBmp = bmp;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航图标资源
|
||||
*
|
||||
* @param naviCursorRes
|
||||
* @return
|
||||
*/
|
||||
public Builder naviCursorRes( int naviCursorRes ) {
|
||||
target.mNaviCursorRes = naviCursorRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CarCursorOption build() {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CarCursorOption clone() throws CloneNotSupportedException {
|
||||
CarCursorOption option = ( CarCursorOption ) super.clone();
|
||||
if ( mCarCursorBmp != null && !mCarCursorBmp.isRecycled() ) {
|
||||
try {
|
||||
option.mCarCursorBmp = Bitmap.createBitmap( mCarCursorBmp );
|
||||
} catch ( Exception e ) {
|
||||
option.mCarCursorBmp = null;
|
||||
}
|
||||
}
|
||||
option.mCarCursorRes = mCarCursorRes;
|
||||
option.mNaviCursorRes = mNaviCursorRes;
|
||||
return option;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if ( mCarCursorBmp != null && !mCarCursorBmp.isRecycled() ) {
|
||||
mCarCursorBmp.recycle();
|
||||
}
|
||||
mCarCursorBmp = null;
|
||||
mCarCursorRes = 0;
|
||||
mNaviCursorRes = 0;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import android.location.Location;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
@@ -56,7 +58,6 @@ public interface IMogoMapUIController {
|
||||
void showMyLocation( boolean visible );
|
||||
|
||||
/**
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
void showMyLocation( View view );
|
||||
@@ -183,7 +184,15 @@ public interface IMogoMapUIController {
|
||||
|
||||
/**
|
||||
* 锁车状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isCarLocked();
|
||||
|
||||
/**
|
||||
* 配置自车图标样式
|
||||
*
|
||||
* @param option
|
||||
*/
|
||||
void setCarCursorOption( CarCursorOption option );
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.map.impl.amap.uicontroller.AMapUIController;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
@@ -245,4 +246,11 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCarCursorOption( CarCursorOption option ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setCarCursorOption( option );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,17 +144,6 @@ public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavig
|
||||
return new AppNavigatorPresenter(this);
|
||||
}
|
||||
|
||||
private void openSearchPanel() {
|
||||
mSearchProvider = (IMogoModuleProvider) ARouter.getInstance()
|
||||
.build(MogoModulePaths.PATH_MODULE_SEARCH)
|
||||
.navigation();
|
||||
final Fragment fragment = mSearchProvider.createFragment(getContext(), null);
|
||||
mMogoFragmentManager.push(new FragmentDescriptor.Builder().fragment(fragment)
|
||||
.tag(MogoModulePaths.PATH_FRAGMENT_SEARCH)
|
||||
.notifyMainModule(true)
|
||||
.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
<string name="module_apps_str_guide_warning">为了您的安全,导航中不可播放视频</string>
|
||||
<string-array name="module_apps_array_filter_packages">
|
||||
<item>com.mogo.launcher</item>
|
||||
<item>com.zhidao.launcher</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.mogo.module.authorize.authprovider.biz
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeContentListener
|
||||
import com.mogo.module.authorize.model.BaseResponse
|
||||
import com.mogo.module.authorize.model.IMogoAuthorizeModel
|
||||
import com.mogo.module.authorize.model.bean.Agreement
|
||||
import com.mogo.module.authorize.model.bean.AgreementData
|
||||
import com.mogo.module.authorize.model.bean.*
|
||||
import com.mogo.module.authorize.net.request
|
||||
import com.mogo.module.authorize.util.DateUtil.parseDateToTime
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.getAuthorizeVersion
|
||||
@@ -31,7 +31,7 @@ open class IMogoAuthorizeController {
|
||||
}
|
||||
}, { msg: String ->
|
||||
onError.invoke(msg)
|
||||
})
|
||||
}, true)
|
||||
}
|
||||
|
||||
fun invokeAuthorizeContent(tag: String, agreementType: Int) {
|
||||
@@ -62,12 +62,12 @@ open class IMogoAuthorizeController {
|
||||
})
|
||||
}
|
||||
|
||||
private fun realInvokeAuthorizeContent(agreementType: Int, onStart: (() -> Unit), onSuccess: ((BaseResponse<AgreementData>) -> Unit), onError: ((String) -> Unit)) {
|
||||
private fun realInvokeAuthorizeContent(agreementType: Int, onStart: (() -> Unit), onSuccess: ((BaseResponse<AgreementData>) -> Unit), onError: ((String) -> Unit), needContent: Boolean = false) {
|
||||
onStart.invoke()
|
||||
try {
|
||||
request<BaseResponse<AgreementData>> {
|
||||
loader {
|
||||
authorizeModel.invokeAuthorizeContent(agreementType)
|
||||
authorizeModel.invokeAuthorizeContent(agreementType, needContent)
|
||||
}
|
||||
onSuccess {
|
||||
onSuccess.invoke(it)
|
||||
@@ -116,4 +116,25 @@ open class IMogoAuthorizeController {
|
||||
val oldVersion = getAuthorizeVersion()
|
||||
return currentTime > oldVersion
|
||||
}
|
||||
|
||||
fun checkIfNeedAuthorize(agreementType: Int) {
|
||||
request<BaseResponse<AgreementStatus>> {
|
||||
loader {
|
||||
authorizeModel.invokeIfNeedAuthorize(agreementType)
|
||||
}
|
||||
onSuccess {
|
||||
Logger.d(TAG,"result : ${it.result}")
|
||||
val result = it.result
|
||||
when (result.agreementStatus) {
|
||||
AGREEMENT_EFFECT -> setAuthorizeStatus(agreementType, true)
|
||||
AGREEMENT_NOT_EFFECT -> setAuthorizeStatus(agreementType, false)
|
||||
else -> Logger.d(TAG, "agreementStatus is not match any case")
|
||||
}
|
||||
}
|
||||
onError {
|
||||
Logger.d(TAG, it.message ?: "checkIfNeedAuthorize onError, message is null")
|
||||
setAuthorizeStatus(agreementType, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListen
|
||||
import com.mogo.module.authorize.model.proxy.AuthorizeProxy
|
||||
import com.mogo.module.authorize.model.proxy.toAuthorizeType
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.needAuthorization
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.setAuthorizeStatus
|
||||
import com.mogo.module.authorize.util.isDeviceOfD
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
@@ -19,14 +20,18 @@ open abstract class MogoAuthorizeManagerImpl : IMogoAuthorizeInvoke {
|
||||
|
||||
override fun needAuthorize(tag: String): Boolean {
|
||||
return if (isDeviceOfD()) {
|
||||
Logger.d(TAG, "needAuthorize update agreement in background")
|
||||
baseController.updateAgreementVersion(tag.toAuthorizeType())
|
||||
Logger.d(TAG, "===== needAuthorize update agreement in background")
|
||||
baseController.checkIfNeedAuthorize(tag.toAuthorizeType())
|
||||
needAuthorization(tag.toAuthorizeType())
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateAuthorizeStatus(tag: String) {
|
||||
baseController.checkIfNeedAuthorize(tag.toAuthorizeType())
|
||||
}
|
||||
|
||||
override fun invokeAuthorizeContent(tag: String) {
|
||||
//todo 后面动态代理统一处理校验问题
|
||||
Logger.d(TAG, "tag:$tag")
|
||||
|
||||
@@ -67,6 +67,8 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
|
||||
if (isDeviceOfD() && hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
mogoAuthShow.invokeAuthorizeForShow()
|
||||
} else {
|
||||
//首次进入Launcher同步一下授权状态,防止由于用户清除数据造成首次加载还会出现授权状态不同步问题
|
||||
mogoAuthShow.updateAuthorizeStatus(AUTHORIZE_TYPE_LAUNCHER_MAIN)
|
||||
Logger.d(TAG, "not do match self startUp condition ,wait for someone invoke")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,12 @@ interface IMogoAuthorizeInvoke : IMogoAuthorizeRegister {
|
||||
* tag:模块ID
|
||||
*/
|
||||
fun invokeAuthorizeContent(tag: String)
|
||||
|
||||
/**
|
||||
* 更新授权状态
|
||||
* tag:模块ID
|
||||
*/
|
||||
fun updateAuthorizeStatus(tag:String){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,10 @@ import com.mogo.module.authorize.voice.IVoiceCommandListener
|
||||
import com.mogo.module.authorize.voice.IVoiceAuthorizeIntentListener
|
||||
import com.mogo.module.authorize.voice.VoiceUtil
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class AuthorizeFragment : MvpFragment<AuthorizeContract.View, AuthorizePresenter>(), AuthorizeContract.View, View.OnClickListener, IVoiceCommandListener, IVoiceAuthorizeIntentListener {
|
||||
|
||||
@@ -105,7 +109,12 @@ class AuthorizeFragment : MvpFragment<AuthorizeContract.View, AuthorizePresenter
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clContainer?.visibility = View.VISIBLE
|
||||
tvTitle?.text = Html.fromHtml(agreementTitle)
|
||||
tvContent?.text = Html.fromHtml(agreementContent)
|
||||
GlobalScope.async(Dispatchers.IO) {
|
||||
val spannable = Html.fromHtml(agreementContent)
|
||||
withContext(Dispatchers.Main){
|
||||
tvContent?.text = spannable
|
||||
}
|
||||
}
|
||||
tvButtonContent?.text = Html.fromHtml(agreementBottom)
|
||||
tvLastContent?.text = Html.fromHtml(agreementLast)
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.mogo.module.authorize.model
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.commons.network.Utils.getSn
|
||||
import com.mogo.module.authorize.model.bean.RequestUserAgreement
|
||||
import com.mogo.module.authorize.model.bean.Agreement
|
||||
import com.mogo.module.authorize.model.bean.AgreementData
|
||||
import com.mogo.module.authorize.model.bean.AgreementStatus
|
||||
import com.mogo.module.authorize.model.bean.RequestUserAgreement
|
||||
|
||||
open class IMogoAuthorizeModel : BaseRepository() {
|
||||
|
||||
@@ -12,9 +12,15 @@ open class IMogoAuthorizeModel : BaseRepository() {
|
||||
const val TAG = "IMogoAuthorizeModel"
|
||||
}
|
||||
|
||||
suspend fun invokeAuthorizeContent(agreementType: Int): BaseResponse<AgreementData> {
|
||||
val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType))
|
||||
suspend fun invokeAuthorizeContent(agreementType: Int, needContent: Boolean = false): BaseResponse<AgreementData> {
|
||||
val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType, needContent))
|
||||
val map = mapOf("sn" to getSn(), "data" to requestUserAgreement)
|
||||
return apiCall { getNetWorkApi().getAuthorizeContent(map) }
|
||||
}
|
||||
|
||||
suspend fun invokeIfNeedAuthorize(agreementType: Int): BaseResponse<AgreementStatus> {
|
||||
val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType))
|
||||
val map = mapOf("sn" to getSn(), "data" to requestUserAgreement)
|
||||
return apiCall { getNetWorkApi().checkIfNeedAuthorize(map) }
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,21 @@ package com.mogo.module.authorize.model.bean
|
||||
const val AGREEMENT_EFFECT = 1 //用户协议生效
|
||||
const val AGREEMENT_NOT_EFFECT = 2 //用户协议不生效
|
||||
|
||||
class RequestUserAgreement(val agreementType: Int)
|
||||
class RequestUserAgreement{
|
||||
var agreementType:Int
|
||||
var want:Boolean = false
|
||||
|
||||
constructor(agreementType:Int){
|
||||
this.agreementType = agreementType
|
||||
}
|
||||
|
||||
constructor(agreementType: Int, want: Boolean) {
|
||||
this.agreementType = agreementType
|
||||
this.want = want
|
||||
}
|
||||
}
|
||||
|
||||
data class AgreementStatus(val agreementStatus:Int)
|
||||
|
||||
data class AgreementData(val agreement: Agreement)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.module.authorize.net
|
||||
|
||||
import com.mogo.module.authorize.model.BaseResponse
|
||||
import com.mogo.module.authorize.model.bean.Agreement
|
||||
import com.mogo.module.authorize.model.bean.AgreementData
|
||||
import com.mogo.module.authorize.model.bean.AgreementStatus
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.POST
|
||||
@@ -19,4 +19,9 @@ interface AuthorizeApi {
|
||||
@POST("yycp-channelManager/agreement/updateStatus")
|
||||
suspend fun updateAuthorize(@FieldMap updateStatus: Map<String, String>): BaseResponse<Any>
|
||||
|
||||
//查询是否要授权
|
||||
@FormUrlEncoded
|
||||
@POST("yycp-channelManager/agreement/queryUserAuthorizeStatusByType")
|
||||
suspend fun checkIfNeedAuthorize(@FieldMap needAuthorize: Map<String, String>): BaseResponse<AgreementStatus>
|
||||
|
||||
}
|
||||
@@ -20,6 +20,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -6,7 +6,6 @@ import androidx.annotation.Keep;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -38,57 +37,6 @@ public class MogoModulePaths {
|
||||
public static void addModule( String path ) {
|
||||
throw new IllegalArgumentException( "this method can't be invoked." );
|
||||
}
|
||||
/**
|
||||
* 搜索页面模块实例化路径
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_MODULE_SEARCH= "/navi/search/ui";
|
||||
|
||||
/**
|
||||
* 搜索页面Activity实例化路径
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_MODULE_NAV_ACTIVITY= "/navi/search/ui/activity";
|
||||
|
||||
|
||||
/**
|
||||
* 搜索 fragment
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_FRAGMENT_SEARCH = "/navi/search";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 搜索 fragment
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_FRAGMENT_CHOOSE_PAHT = "/navi/search";
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 按类别搜索 fragment
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_FRAGMENT_SEARCH_CATEGORY = "/navi/search/category";
|
||||
|
||||
|
||||
/**
|
||||
* 设置 fragment
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_FRAGMENT_SETTING = "/navi/setting";
|
||||
|
||||
|
||||
/**
|
||||
* 设置家和公司 fragment
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_FRAGMENT_SETTING_HOME = "/navi/setting/home";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加卡片模块
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.module.common.map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-10
|
||||
* <p>
|
||||
* 拦截器
|
||||
*/
|
||||
public interface Interrupter {
|
||||
|
||||
/**
|
||||
* 是否拦截
|
||||
* @return true - 拦截, false - 不拦截
|
||||
*/
|
||||
boolean interrupt();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.module.common.map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-10
|
||||
* <p>
|
||||
* 地图视图中心点
|
||||
*/
|
||||
public class MapCenterPoint {
|
||||
|
||||
public final double x;
|
||||
public final double y;
|
||||
|
||||
public MapCenterPoint( double x, double y ) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.mogo.module.common.map;
|
||||
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-10
|
||||
* <p>
|
||||
* 地图中心点策略
|
||||
*/
|
||||
public class MapCenterPointStrategy {
|
||||
|
||||
private static final String TAG = "MapCenterPointStrategy";
|
||||
|
||||
private static Map< Integer, Map< Integer, MapCenterPoint > > sStrategies = new HashMap<>();
|
||||
|
||||
public static final MapCenterPoint DEFAULT = new MapCenterPoint( 0.677734D, 0.5733333D );
|
||||
|
||||
static {
|
||||
// 普通场景,使用高德内部值
|
||||
Map< Integer, MapCenterPoint > common = new HashMap<>();
|
||||
common.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.5D, 0.666666666D ) );
|
||||
common.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.5D, 0.666666666D ) );
|
||||
sStrategies.put( Scene.COMMON, common );
|
||||
|
||||
// 选点场景,定位中心点
|
||||
Map< Integer, MapCenterPoint > choosePoint = new HashMap<>();
|
||||
choosePoint.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
choosePoint.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
sStrategies.put( Scene.CHOOSE_POINT, choosePoint );
|
||||
|
||||
|
||||
// 导航场景,定位视图右下角偏下
|
||||
Map< Integer, MapCenterPoint > navi = new HashMap<>();
|
||||
navi.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.7734375D, 0.65D ) );
|
||||
navi.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.775521D, 0.6759259D ) );
|
||||
sStrategies.put( Scene.NAVI, navi );
|
||||
|
||||
|
||||
// 巡航场景,定位视图右下角偏下
|
||||
Map< Integer, MapCenterPoint > aimless = new HashMap<>();
|
||||
aimless.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.677734375D, 0.54D ) );
|
||||
aimless.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.6963541D, 0.6833333D ) );
|
||||
sStrategies.put( Scene.AIMLESS, aimless );
|
||||
|
||||
|
||||
// 规划路线,定位视图右边
|
||||
Map< Integer, MapCenterPoint > calculatePath = new HashMap<>();
|
||||
calculatePath.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.733398D, 0.610833D ) );
|
||||
calculatePath.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.703125D, 0.6083333D ) );
|
||||
sStrategies.put( Scene.CALCULATE_PATH, calculatePath );
|
||||
|
||||
// 分类搜索,定位视图右边
|
||||
Map< Integer, MapCenterPoint > categorySearch = new HashMap<>();
|
||||
categorySearch.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.733398D, 0.610833D ) );
|
||||
categorySearch.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.733594D, 0.596759D ) );
|
||||
sStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
|
||||
}
|
||||
|
||||
public static void addScene( int scene, Map< Integer, MapCenterPoint > config ) {
|
||||
if ( sStrategies.containsKey( scene ) ) {
|
||||
Logger.w( TAG, "scene has already defined, append config..." );
|
||||
}
|
||||
if ( sStrategies.get( scene ) != null ) {
|
||||
sStrategies.get( scene ).putAll( config );
|
||||
} else {
|
||||
sStrategies.put( scene, config );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据场景触发地图视图改变
|
||||
*
|
||||
* @param controller
|
||||
* @param scene
|
||||
*/
|
||||
public static void setMapCenterPointByScene( IMogoMapUIController controller, int scene ) {
|
||||
if ( controller == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !sStrategies.containsKey( scene ) ) {
|
||||
Logger.w( TAG, "no strategy for scene: %s, use DEFAULT", scene );
|
||||
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
|
||||
return;
|
||||
}
|
||||
Map< Integer, MapCenterPoint > points = sStrategies.get( scene );
|
||||
int car = CarSeries.getSeries();
|
||||
if ( !points.containsKey( car ) ) {
|
||||
Logger.w( TAG, "no strategy for series: %s, use DEFAULT", scene );
|
||||
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
|
||||
return;
|
||||
}
|
||||
MapCenterPoint point = points.get( car );
|
||||
if ( point == null ) {
|
||||
Logger.w( TAG, "no strategy config for series: %s, use DEFAULT", scene );
|
||||
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
|
||||
return;
|
||||
}
|
||||
controller.setPointToCenter( point.x, point.y );
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据场景触发地图视图改变
|
||||
*
|
||||
* @param controller
|
||||
* @param scene
|
||||
*/
|
||||
public static void setMapCenterPointBySceneAndDelay( final IMogoMapUIController controller, final int scene, long delay, final Interrupter interrupter ) {
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
if ( interrupter != null ) {
|
||||
if ( interrupter.interrupt() ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
setMapCenterPointByScene( controller, scene );
|
||||
}, delay );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.module.common.map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public interface Scene {
|
||||
|
||||
/**
|
||||
* 普通场景
|
||||
*/
|
||||
int COMMON = 0;
|
||||
|
||||
/**
|
||||
* 选点
|
||||
*/
|
||||
int CHOOSE_POINT = 1;
|
||||
|
||||
/**
|
||||
* 导航
|
||||
*/
|
||||
int NAVI = 2;
|
||||
|
||||
/**
|
||||
* 巡航
|
||||
*/
|
||||
int AIMLESS = 3;
|
||||
|
||||
/**
|
||||
* 路线规划
|
||||
*/
|
||||
int CALCULATE_PATH = 4;
|
||||
|
||||
/**
|
||||
* 分类搜索
|
||||
*/
|
||||
int CATEGORY_SEARCH = 5;
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -12,7 +9,6 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
@@ -29,16 +25,14 @@ import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant;
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeContentListener;
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeRegister;
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListener;
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.dialog.NaviNoticeDialog;
|
||||
@@ -47,24 +41,16 @@ import com.mogo.module.share.ShareControl;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import retrofit2.http.HEAD;
|
||||
|
||||
import static com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE;
|
||||
|
||||
/**
|
||||
@@ -118,11 +104,9 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
/**
|
||||
* 搜索莫模块
|
||||
*/
|
||||
private IMogoModuleProvider mSearchProvider;
|
||||
private boolean mIsLock = true;
|
||||
private TextView ivMode;
|
||||
private TextView mCameraMode;
|
||||
|
||||
private IMogoPolyline iMogoPolyline;
|
||||
public static boolean isClickShare;
|
||||
|
||||
@Override
|
||||
@@ -145,22 +129,12 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mSearch = findViewById( R.id.module_entrance_id_search );
|
||||
|
||||
mSearch.setOnClickListener( view -> {
|
||||
setMarkerStatus( true );
|
||||
mSearchProvider = ( IMogoModuleProvider ) ARouter.getInstance()
|
||||
.build( MogoModulePaths.PATH_MODULE_SEARCH )
|
||||
.navigation();
|
||||
final Fragment fragment = mSearchProvider.createFragment( getContext(), null );
|
||||
mMogoFragmentManager.push( new FragmentDescriptor.Builder().fragment( fragment )
|
||||
.tag( MogoModulePaths.PATH_FRAGMENT_SEARCH )
|
||||
.notifyMainModule( true )
|
||||
.build() );
|
||||
|
||||
mApis.getAddressManagerApi().goSearch();
|
||||
mApis.getAdasControllerApi().closeADAS();
|
||||
} );
|
||||
|
||||
mHome = findViewById( R.id.module_entrance_id_home );
|
||||
mHome.setOnClickListener( view -> {
|
||||
setMarkerStatus( true );
|
||||
mMogoAddressManager.goHome();
|
||||
mApis.getAdasControllerApi().closeADAS();
|
||||
|
||||
@@ -168,7 +142,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
mCompany = findViewById( R.id.module_entrance_id_company );
|
||||
mCompany.setOnClickListener( view -> {
|
||||
setMarkerStatus( true );
|
||||
mMogoAddressManager.goCompany();
|
||||
mApis.getAdasControllerApi().closeADAS();
|
||||
|
||||
@@ -210,23 +183,21 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
NaviNoticeDialog naviNoticeDialog = new NaviNoticeDialog( getContext() );
|
||||
naviNoticeDialog.show();
|
||||
} else {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mMApUIController, Scene.NAVI );
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
ivMode = findViewById( R.id.module_ext_id_north );
|
||||
ivMode.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
if ( ivMode.isSelected() ) {
|
||||
mMApUIController.changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else {
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
}
|
||||
ivMode.setSelected( !ivMode.isSelected() );
|
||||
ivMode.setText( getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
mCameraMode = findViewById( R.id.module_ext_id_north );
|
||||
mCameraMode.setOnClickListener( view -> {
|
||||
if ( mCameraMode.isSelected() ) {
|
||||
mMApUIController.changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else {
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
}
|
||||
mCameraMode.setSelected( !mCameraMode.isSelected() );
|
||||
mCameraMode.setText( getString( mCameraMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
} );
|
||||
|
||||
mSpeedLimit = findViewById( R.id.module_entrance_id_speed_limit_container );
|
||||
@@ -243,23 +214,17 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
if ( key_type == 10027 ) {
|
||||
if ( opera_type == 0 ) {
|
||||
ivMode.setSelected( false );
|
||||
mCameraMode.setSelected( false );
|
||||
} else if ( opera_type == 1 ) {
|
||||
ivMode.setSelected( true );
|
||||
mCameraMode.setSelected( true );
|
||||
}
|
||||
ivMode.setText( getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
mCameraMode.setText( getString( mCameraMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void setMarkerStatus( boolean show ) {
|
||||
mMogoStatusManager.setSearchUIShow( MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, show );
|
||||
}
|
||||
|
||||
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
|
||||
@NonNull
|
||||
@@ -340,21 +305,23 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
public void onStartNavi() {
|
||||
mCommonAddress.setVisibility( View.GONE );
|
||||
mNaviInfo.setVisibility( View.VISIBLE );
|
||||
ivMode.setVisibility( View.VISIBLE );
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
mExitNavi.setVisibility( View.VISIBLE );
|
||||
mMApUIController.setPointToCenter( 0.675926, 0.77552 );
|
||||
mMApUIController.changeMapMode( ivMode.isSelected() ? EnumMapUI.NorthUP_2D : EnumMapUI.CarUp_2D );
|
||||
mMApUIController.changeMapMode( mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D : EnumMapUI.CarUp_2D );
|
||||
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay( mMApUIController, Scene.NAVI, 500, () -> {
|
||||
return !mMogoNavi.isNaviing();
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
mCommonAddress.setVisibility( View.VISIBLE );
|
||||
mNaviInfo.setVisibility( View.GONE );
|
||||
ivMode.setVisibility( View.GONE );
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
mExitNavi.setVisibility( View.GONE );
|
||||
mSpeedLimit.setVisibility( View.GONE );
|
||||
mMApUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mMApUIController, Scene.AIMLESS );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,8 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.main.cards.CardIntroduceConfigs;
|
||||
import com.mogo.module.main.cards.CardModulesAdapter;
|
||||
import com.mogo.module.main.cards.HorizentalStackTransformer;
|
||||
@@ -261,7 +263,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
|
||||
// 右移地图中心点
|
||||
mMogoMapUIController = mMogoMapService.getMapUIController();
|
||||
mMogoMapUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mMogoMapUIController, Scene.AIMLESS );
|
||||
|
||||
// 开启定位
|
||||
startLocation();
|
||||
|
||||
@@ -34,4 +34,11 @@ public class AMapConstants {
|
||||
|
||||
public static final float AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED = 1f;
|
||||
public static final float AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED = 0.3f;
|
||||
|
||||
public static final String PATH_FRAGMENT_SEARCH = "PATH_FRAGMENT_SEARCH";
|
||||
public static final String PATH_FRAGMENT_CHOOSE_PATH = "PATH_FRAGMENT_CHOOSE_PATH";
|
||||
public static final String PATH_FRAGMENT_SEARCH_CATEGORY = "PATH_FRAGMENT_SEARCH_CATEGORY";
|
||||
public static final String PATH_FRAGMENT_SETTING = "PATH_FRAGMENT_SETTING";
|
||||
public static final String PATH_FRAGMENT_NAVI_SETTING = "PATH_FRAGMENT_NAVI_SETTING";
|
||||
public static final String PATH_FRAGMENT_SETTING_HOME = "PATH_FRAGMENT_SETTING_HOME";
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.analytics.IMogoAnalytics
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager
|
||||
import com.mogo.service.launcher.IMogoLauncher
|
||||
import com.mogo.service.map.IMogoMapService
|
||||
import com.mogo.service.module.IMogoRegisterCenter
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager
|
||||
@@ -28,24 +29,14 @@ import com.mogo.service.statusmanager.IMogoStatusManager
|
||||
object SearchServiceHolder{
|
||||
// 单例对象,要使用Application Context
|
||||
private lateinit var context: Context
|
||||
val fragmentManager: IMogoFragmentManager = ARouter.getInstance().build(
|
||||
MogoServicePaths.PATH_FRAGMENT_MANAGER
|
||||
).navigation() as IMogoFragmentManager
|
||||
val mapService: IMogoMapService = ARouter.getInstance().build(
|
||||
MogoServicePaths.PATH_SERVICES_MAP
|
||||
).navigation() as IMogoMapService
|
||||
val listenerCenter: IMogoRegisterCenter = ARouter.getInstance().build(
|
||||
MogoServicePaths.PATH_REGISTER_CENTER
|
||||
).navigation() as IMogoRegisterCenter
|
||||
val statusManager: IMogoStatusManager = ARouter.getInstance().build(
|
||||
MogoServicePaths.PATH_STATUS_MANAGER
|
||||
).navigation() as IMogoStatusManager
|
||||
val analyticsManager: IMogoAnalytics = ARouter.getInstance().build(
|
||||
MogoServicePaths.PATH_UTILS_ANALYTICS
|
||||
).navigation() as IMogoAnalytics
|
||||
val guideShowProvider: IGuideShowProvider = ARouter.getInstance().build(
|
||||
GuideShowProviderConstant.GUIDE_SHOW_PROVIDER
|
||||
).navigation() as IGuideShowProvider
|
||||
|
||||
val fragmentManager: IMogoFragmentManager = ARouter.getInstance().build(MogoServicePaths.PATH_FRAGMENT_MANAGER).navigation() as IMogoFragmentManager
|
||||
val mapService: IMogoMapService = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation() as IMogoMapService
|
||||
val listenerCenter: IMogoRegisterCenter = ARouter.getInstance().build(MogoServicePaths.PATH_REGISTER_CENTER).navigation() as IMogoRegisterCenter
|
||||
val statusManager: IMogoStatusManager = ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation() as IMogoStatusManager
|
||||
val analyticsManager: IMogoAnalytics = ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation() as IMogoAnalytics
|
||||
val guideShowProvider: IGuideShowProvider = ARouter.getInstance().build(GuideShowProviderConstant.GUIDE_SHOW_PROVIDER).navigation() as IGuideShowProvider
|
||||
val mogoLauncher: IMogoLauncher = ARouter.getInstance().build(MogoServicePaths.PATH_LAUNCHER_API).navigation() as IMogoLauncher
|
||||
|
||||
var geoSearch: IMogoGeoSearch? = null
|
||||
fun init(context: Context) {
|
||||
@@ -86,10 +77,4 @@ object SearchServiceHolder{
|
||||
return geoSearch!!
|
||||
}
|
||||
|
||||
fun setMarkerStatus(show: Boolean) {
|
||||
statusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, show
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,20 +2,25 @@ package com.mogo.module.navi.manager
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy
|
||||
import com.mogo.module.common.map.Scene
|
||||
import com.mogo.module.navi.bean.EntityConvertUtils
|
||||
import com.mogo.module.navi.bean.SearchPoi
|
||||
import com.mogo.module.navi.constants.AMapConstants
|
||||
import com.mogo.module.navi.constants.DataConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.cp.AddressHelper
|
||||
import com.mogo.module.navi.dao.SearchPoiDao
|
||||
import com.mogo.module.navi.database.AppDataBase
|
||||
import com.mogo.module.navi.ui.search.CategorySearchFragment
|
||||
import com.mogo.module.navi.ui.search.ChoosePathFragment
|
||||
import com.mogo.module.navi.ui.search.SearchFragment
|
||||
import com.mogo.module.navi.ui.setting.NaviSettingFragment
|
||||
import com.mogo.module.navi.ui.setting.SettingAddressFragment
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableEmitter
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
@@ -27,124 +32,153 @@ import org.greenrobot.eventbus.EventBus
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object AddressManager {
|
||||
var homeAddress: SearchPoi? = null
|
||||
var companyAddress: SearchPoi? = null
|
||||
private lateinit var poiDao:SearchPoiDao
|
||||
fun goHome() {
|
||||
if (homeAddress == null) {
|
||||
pushSettingAddress(
|
||||
DataConstants.TYPE_HOME_ADDRESS
|
||||
)
|
||||
} else {
|
||||
var newInstance = ChoosePathFragment.newInstance(
|
||||
EntityConvertUtils.poi2MogoTip(
|
||||
homeAddress
|
||||
).point
|
||||
)
|
||||
SearchServiceHolder.push(
|
||||
newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun goCompany() {
|
||||
if (companyAddress == null) {
|
||||
pushSettingAddress(
|
||||
DataConstants.TYPE_COMPANY_ADDRESS
|
||||
)
|
||||
} else {
|
||||
var newInstance =
|
||||
ChoosePathFragment.newInstance(
|
||||
EntityConvertUtils.poi2MogoTip(
|
||||
companyAddress
|
||||
).point
|
||||
val TAG: String = "AddressManager.kt"
|
||||
|
||||
var homeAddress: SearchPoi? = null
|
||||
var companyAddress: SearchPoi? = null
|
||||
private lateinit var poiDao: SearchPoiDao
|
||||
|
||||
fun hasHome(): Boolean {
|
||||
return homeAddress != null
|
||||
}
|
||||
|
||||
fun hasCompany(): Boolean {
|
||||
return companyAddress != null
|
||||
}
|
||||
|
||||
private fun choosePoint(type: Int){
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CHOOSE_POINT)
|
||||
val builder = FragmentDescriptor.Builder()
|
||||
builder.fragment(SettingAddressFragment.newInstance(type))
|
||||
val build = builder.tag(AMapConstants.PATH_FRAGMENT_SETTING_HOME).build()
|
||||
SearchServiceHolder.fragmentManager.push(build)
|
||||
}
|
||||
|
||||
private lateinit var context: Context
|
||||
@SuppressLint("CheckResult")
|
||||
fun init(context: Context) {
|
||||
|
||||
this.context = context
|
||||
poiDao = AppDataBase.getDatabase(context).poiDao()
|
||||
poiDao.companyAddress
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { t1, t2 ->
|
||||
if (t1.size > 0) {
|
||||
companyAddress = t1[0]
|
||||
}
|
||||
}
|
||||
|
||||
poiDao.homeAddress
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { t1, t2 ->
|
||||
if (t1.size > 0) {
|
||||
homeAddress = t1[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun insert(searchPoi: SearchPoi) {
|
||||
|
||||
EventBus.getDefault().post(searchPoi)
|
||||
if (searchPoi.type == DataConstants.TYPE_COMPANY_ADDRESS) {
|
||||
companyAddress = searchPoi
|
||||
} else {
|
||||
homeAddress = searchPoi
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteHome(context: Context) {
|
||||
Observable.create(
|
||||
ObservableOnSubscribe<String> {
|
||||
poiDao.delete(homeAddress)
|
||||
homeAddress?.name = ""
|
||||
AddressHelper.notifyAddressChanged(1)
|
||||
|
||||
homeAddress = null
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun deleteCompany(context: Context) {
|
||||
Observable.create(
|
||||
ObservableOnSubscribe<String> {
|
||||
poiDao.delete(companyAddress)
|
||||
companyAddress?.name = ""
|
||||
AddressHelper.notifyAddressChanged(0)
|
||||
|
||||
companyAddress = null
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
}
|
||||
|
||||
/**
|
||||
* 回家
|
||||
*/
|
||||
fun goHome() {
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(TAG, true)
|
||||
if (homeAddress == null) {
|
||||
choosePoint(DataConstants.TYPE_HOME_ADDRESS)
|
||||
} else {
|
||||
calculatePath(EntityConvertUtils.poi2MogoTip(homeAddress).point)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 去公司
|
||||
*/
|
||||
fun goCompany() {
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(TAG, true)
|
||||
if (companyAddress == null) {
|
||||
choosePoint( DataConstants.TYPE_COMPANY_ADDRESS)
|
||||
} else {
|
||||
calculatePath(EntityConvertUtils.poi2MogoTip(companyAddress).point)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
fun goSearch() {
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(TAG, true)
|
||||
SearchServiceHolder.fragmentManager.push(
|
||||
FragmentDescriptor.Builder().fragment(SearchFragment())
|
||||
.tag(AMapConstants.PATH_FRAGMENT_SEARCH)
|
||||
.notifyMainModule(true)
|
||||
.build()
|
||||
)
|
||||
SearchServiceHolder.push(
|
||||
newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun hasHome(): Boolean {
|
||||
return homeAddress != null
|
||||
}
|
||||
|
||||
fun hasCompany(): Boolean {
|
||||
return companyAddress != null
|
||||
}
|
||||
|
||||
private fun pushSettingAddress(type: Int) {
|
||||
|
||||
val builder = FragmentDescriptor.Builder()
|
||||
builder.fragment(SettingAddressFragment.newInstance(type))
|
||||
val build = builder.tag(MogoModulePaths.PATH_FRAGMENT_SETTING_HOME)
|
||||
.build()
|
||||
SearchServiceHolder.fragmentManager.push(build)
|
||||
}
|
||||
|
||||
private lateinit var context: Context
|
||||
@SuppressLint("CheckResult") fun init(context: Context) {
|
||||
|
||||
this.context=context
|
||||
poiDao = AppDataBase.getDatabase(context)
|
||||
.poiDao()
|
||||
poiDao
|
||||
.companyAddress
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { t1, t2 ->
|
||||
if (t1.size > 0) {
|
||||
companyAddress = t1[0]
|
||||
}
|
||||
/**
|
||||
* 路径规划
|
||||
*/
|
||||
fun calculatePath(destination: MogoLatLng?) {
|
||||
destination?.let {
|
||||
var newInstance = ChoosePathFragment.newInstance(destination)
|
||||
SearchServiceHolder.push(newInstance, AMapConstants.PATH_FRAGMENT_CHOOSE_PATH)
|
||||
}
|
||||
|
||||
poiDao
|
||||
.homeAddress
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { t1, t2 ->
|
||||
if (t1.size > 0) {
|
||||
homeAddress = t1[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun insert(searchPoi: SearchPoi) {
|
||||
|
||||
EventBus.getDefault().post(searchPoi)
|
||||
if (searchPoi.type == DataConstants.TYPE_COMPANY_ADDRESS) {
|
||||
companyAddress = searchPoi
|
||||
} else {
|
||||
homeAddress = searchPoi
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteHome(context: Context){
|
||||
Observable.create(
|
||||
ObservableOnSubscribe<String> {
|
||||
poiDao.delete(homeAddress)
|
||||
homeAddress?.name=""
|
||||
AddressHelper.notifyAddressChanged( 1)
|
||||
fun categorySearch(category: String){
|
||||
val searchFragment = CategorySearchFragment.newInstance(category)
|
||||
SearchServiceHolder.fragmentManager.push(FragmentDescriptor.Builder().fragment(searchFragment)
|
||||
.tag(AMapConstants.PATH_FRAGMENT_SEARCH_CATEGORY)
|
||||
.notifyMainModule(true)
|
||||
.build())
|
||||
}
|
||||
|
||||
homeAddress=null
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
fun goSettings(){
|
||||
val naviSettingFragment = NaviSettingFragment()
|
||||
SearchServiceHolder.fragmentManager.push(FragmentDescriptor.Builder().fragment(naviSettingFragment)
|
||||
.tag(AMapConstants.PATH_FRAGMENT_NAVI_SETTING)
|
||||
.notifyMainModule(true)
|
||||
.build())
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun deleteCompany(context: Context){
|
||||
Observable.create(
|
||||
ObservableOnSubscribe<String> {
|
||||
poiDao.delete(companyAddress)
|
||||
companyAddress?.name=""
|
||||
AddressHelper.notifyAddressChanged( 0)
|
||||
|
||||
companyAddress=null
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.navi.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
@@ -12,6 +13,7 @@ import com.mogo.service.module.IMogoAddressManager;
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_ADDRESS_MANAGER )
|
||||
public class MogoAddressManager implements IMogoAddressManager {
|
||||
|
||||
@Override public void goHome() {
|
||||
AddressManager.INSTANCE.goHome();
|
||||
}
|
||||
@@ -20,7 +22,27 @@ public class MogoAddressManager implements IMogoAddressManager {
|
||||
AddressManager.INSTANCE.goCompany();
|
||||
}
|
||||
|
||||
@Override public void init(Context context) {
|
||||
@Override
|
||||
public void goSearch() {
|
||||
AddressManager.INSTANCE.goSearch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculatePath( MogoLatLng destination ) {
|
||||
AddressManager.INSTANCE.calculatePath( destination );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void categorySearch( String category ) {
|
||||
AddressManager.INSTANCE.categorySearch( category );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goSettings() {
|
||||
AddressManager.INSTANCE.goSettings();
|
||||
}
|
||||
|
||||
@Override public void init( Context context) {
|
||||
AddressManager.INSTANCE.init(context);
|
||||
SearchServiceHolder.INSTANCE.init(context);
|
||||
SettingManager.INSTANCE.init(context);
|
||||
|
||||
@@ -5,6 +5,7 @@ import androidx.fragment.app.Fragment;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.constants.BroadcastMode;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.navi.constants.AMapConstants;
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder;
|
||||
import com.mogo.module.navi.ui.search.CategorySearchFragment;
|
||||
import com.mogo.module.navi.ui.search.SearchFragment;
|
||||
@@ -30,7 +31,7 @@ public class MogoSearchManager implements IMogoSearchManager {
|
||||
SearchFragment searchFragment = new SearchFragment();
|
||||
SearchServiceHolder.INSTANCE.getFragmentManager()
|
||||
.push(new FragmentDescriptor.Builder().fragment(searchFragment)
|
||||
.tag(MogoModulePaths.PATH_FRAGMENT_SEARCH)
|
||||
.tag( AMapConstants.PATH_FRAGMENT_SEARCH)
|
||||
.notifyMainModule(true)
|
||||
.build());
|
||||
}
|
||||
@@ -49,12 +50,7 @@ public class MogoSearchManager implements IMogoSearchManager {
|
||||
}
|
||||
|
||||
@Override public void showCategory(String keyword) {
|
||||
Fragment searchFragment = CategorySearchFragment.Companion.newInstance(keyword);
|
||||
SearchServiceHolder.INSTANCE.getFragmentManager()
|
||||
.push(new FragmentDescriptor.Builder().fragment(searchFragment)
|
||||
.tag(MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY)
|
||||
.notifyMainModule(true)
|
||||
.build());
|
||||
AddressManager.INSTANCE.categorySearch( keyword );
|
||||
}
|
||||
|
||||
@Override public void init(Context context) {
|
||||
|
||||
@@ -1,109 +1,90 @@
|
||||
package com.mogo.module.navi.manager
|
||||
|
||||
import android.app.SearchManager
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.text.TextUtils
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.map.navi.MogoNaviConfig
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.ui.search.ChoosePathFragment
|
||||
import com.mogo.utils.logger.Logger
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import com.mogo.map.navi.MogoNaviConfig
|
||||
import com.mogo.module.navi.ui.search.SearchFragment
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
/**
|
||||
*@author zyz
|
||||
* 2020-01-18.
|
||||
*/
|
||||
object NaviManager {
|
||||
private lateinit var mReceiver: BroadcastReceiver
|
||||
private val AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV"
|
||||
private lateinit var mReceiver: BroadcastReceiver
|
||||
private val AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV"
|
||||
|
||||
fun init(context: Context) {
|
||||
mReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(
|
||||
context: Context,
|
||||
intent: Intent
|
||||
) {
|
||||
val action = intent.action
|
||||
if (TextUtils.equals(action, AUTONAVI_STANDARD_BROADCAST_RECV)) {
|
||||
val key_type = intent.getIntExtra("KEY_TYPE", 0)
|
||||
Logger.d("NaviManager", "key_type" + key_type, null)
|
||||
if (key_type == 10038 || key_type == 10007) {
|
||||
val lat: Double
|
||||
val lon: Double
|
||||
fun init(context: Context) {
|
||||
mReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val action = intent.action
|
||||
if (TextUtils.equals(action, AUTONAVI_STANDARD_BROADCAST_RECV)) {
|
||||
val key_type = intent.getIntExtra("KEY_TYPE", 0)
|
||||
Logger.d("NaviManager", "key_type" + key_type, null)
|
||||
if (key_type == 10038 || key_type == 10007) {
|
||||
SearchServiceHolder.mogoLauncher.backToLauncher(context)
|
||||
choosePath(intent, key_type)
|
||||
} else if (key_type == 10021) {
|
||||
SearchServiceHolder.getNavi().stopNavi()
|
||||
} else if (key_type == 20009) {
|
||||
SearchServiceHolder.mogoLauncher.backToLauncher(context)
|
||||
gotoSearch()
|
||||
|
||||
if (key_type == 10007) {
|
||||
lat = intent.getDoubleExtra("ENTRY_LAT", 0.0)
|
||||
lon = intent.getDoubleExtra("ENTRY_LON", 0.0)
|
||||
} else {
|
||||
lat = intent.getDoubleExtra("LAT", 0.0)
|
||||
lon = intent.getDoubleExtra("LON", 0.0)
|
||||
|
||||
}
|
||||
showHome()
|
||||
|
||||
SearchServiceHolder.setMarkerStatus(true)
|
||||
var newInstance =
|
||||
ChoosePathFragment.newInstance(
|
||||
MogoLatLng(lat, lon)
|
||||
)
|
||||
SearchServiceHolder.push(
|
||||
newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT
|
||||
)
|
||||
} else if (key_type == 10021) {
|
||||
SearchServiceHolder.getNavi()
|
||||
.stopNavi()
|
||||
} else if (key_type == 20009) {
|
||||
showHome()
|
||||
SearchServiceHolder.setMarkerStatus(true)
|
||||
SearchServiceHolder.fragmentManager
|
||||
.clearAll()
|
||||
|
||||
val searchFragment = SearchFragment()
|
||||
SearchServiceHolder.fragmentManager
|
||||
.push(
|
||||
FragmentDescriptor.Builder().fragment(searchFragment)
|
||||
.tag(MogoModulePaths.PATH_FRAGMENT_SEARCH)
|
||||
.notifyMainModule(true)
|
||||
.build()
|
||||
)
|
||||
|
||||
} else if (key_type == 10005) {
|
||||
} else if (key_type == 10005) {
|
||||
|
||||
// * 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
// * `避免收费` |`1` `多策略算路` |`2` `不走高速` |`3` ` 躲避拥堵` |`4` `不走高速且避免收费` |`5` `不走高速且躲避拥堵` |`6`
|
||||
// * `躲避收费和拥堵` |`7` `不走高速躲避收费和拥堵` |`8` `高速优先` |`20` `躲避拥堵且高速优先` |`24`
|
||||
// *
|
||||
var prefer = intent.getIntExtra("NAVI_ROUTE_PREFER", 0)
|
||||
var prefer = intent.getIntExtra("NAVI_ROUTE_PREFER", 0)
|
||||
|
||||
var avoidSpeed = MogoNaviConfig().congestion(prefer == 4)
|
||||
.cost(prefer == 1||prefer == 7)
|
||||
.highSpeed(prefer == 20)
|
||||
.avoidSpeed(prefer == 3)
|
||||
SearchServiceHolder.getNavi()
|
||||
.reCalculateRoute(avoidSpeed)
|
||||
var avoidSpeed = MogoNaviConfig().congestion(prefer == 4)
|
||||
.cost(prefer == 1 || prefer == 7)
|
||||
.highSpeed(prefer == 20)
|
||||
.avoidSpeed(prefer == 3)
|
||||
SearchServiceHolder.getNavi().reCalculateRoute(avoidSpeed)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开地图
|
||||
*/
|
||||
private fun gotoSearch() {
|
||||
AddressManager.goSearch()
|
||||
}
|
||||
|
||||
/**
|
||||
* 唤醒指令导航去哪里
|
||||
*/
|
||||
private fun choosePath(intent: Intent, type: Int) {
|
||||
val lat: Double
|
||||
val lon: Double
|
||||
|
||||
if (type == 10007) {
|
||||
lat = intent.getDoubleExtra("ENTRY_LAT", 0.0)
|
||||
lon = intent.getDoubleExtra("ENTRY_LON", 0.0)
|
||||
} else {
|
||||
lat = intent.getDoubleExtra("LAT", 0.0)
|
||||
lon = intent.getDoubleExtra("LON", 0.0)
|
||||
|
||||
}
|
||||
AddressManager.calculatePath(MogoLatLng(lat, lon))
|
||||
}
|
||||
}
|
||||
}
|
||||
val inputFilter = IntentFilter()
|
||||
inputFilter.addAction(AUTONAVI_STANDARD_BROADCAST_RECV)
|
||||
context.registerReceiver(mReceiver, inputFilter)
|
||||
|
||||
private fun showHome() {
|
||||
val intent = Intent(Intent.ACTION_MAIN)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
intent.addCategory(Intent.CATEGORY_HOME)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
val inputFilter = IntentFilter()
|
||||
inputFilter.addAction(AUTONAVI_STANDARD_BROADCAST_RECV)
|
||||
context.registerReceiver(mReceiver, inputFilter)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public class VolumeManager {
|
||||
}
|
||||
|
||||
/*
|
||||
判断是否future渠道
|
||||
判断是否future渠道(F系列)
|
||||
*/
|
||||
private boolean isFuture() {
|
||||
|
||||
@@ -181,7 +181,8 @@ public class VolumeManager {
|
||||
Class<?> buildConfig = Class.forName("com.mogo.launcher.BuildConfig");
|
||||
Field flavor = buildConfig.getDeclaredField("FLAVOR");
|
||||
//String descriptor= Modifier.toString(flavor.getModifiers());
|
||||
return TextUtils.equals((CharSequence) flavor.get(null),"zhidao");
|
||||
String val = (String) flavor.get(null);
|
||||
return val.toLowerCase().contains( "zhidao" );
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
@@ -189,6 +190,8 @@ public class VolumeManager {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
package com.mogo.module.navi.ui
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.ui.base.BaseActivity
|
||||
|
||||
@Route(path = MogoModulePaths.PATH_MODULE_NAV_ACTIVITY)
|
||||
class NaviActivity : BaseActivity() {
|
||||
|
||||
|
||||
|
||||
@@ -72,27 +72,4 @@ public abstract class BaseFragment extends Fragment {
|
||||
Toast.makeText( mContext, msg, Toast.LENGTH_LONG ).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void setMarkerStatus(boolean show){
|
||||
SearchServiceHolder.INSTANCE.getStatusManager().setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, show
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动地图中心点到屏幕中心
|
||||
*/
|
||||
protected void moveMapToCenter(){
|
||||
//SearchServiceHolder.INSTANCE.getMapUIController().setPointToCenter(0.5,0.5);
|
||||
}
|
||||
|
||||
//mMogoMapUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
/**
|
||||
* 移动地图中心点到屏幕右侧
|
||||
*/
|
||||
protected void moveMapToRight(){
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().setPointToCenter(0.66145, 0.661094);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,9 +17,13 @@ import com.mogo.map.marker.MogoMarkerOptions
|
||||
import com.mogo.map.search.geo.MogoPoiItem
|
||||
import com.mogo.map.search.inputtips.MogoTip
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy
|
||||
import com.mogo.module.common.map.Scene
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.bean.SearchPoi
|
||||
import com.mogo.module.navi.constants.AMapConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.manager.AddressManager
|
||||
import com.mogo.module.navi.ui.adapter.SearchCategoryAdapter
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.module.navi.uitls.BitmapUtils
|
||||
@@ -175,9 +179,6 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
category = arguments?.getString("category")
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, true
|
||||
)
|
||||
mSearchPresenter = CategoryPresenter(this)
|
||||
lifecycle.addObserver(mSearchPresenter)
|
||||
cmds = ArrayList<String>()
|
||||
@@ -223,8 +224,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
|
||||
private fun goPath() {
|
||||
mAdapter.currentItem?.let {
|
||||
var newInstance = ChoosePathFragment.newInstance(mAdapter.currentItem.point)
|
||||
SearchServiceHolder.push(newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT)
|
||||
AddressManager.calculatePath(mAdapter.currentItem.point)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,13 +279,11 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, false
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(category: String): Fragment {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CATEGORY_SEARCH)
|
||||
var bundle = Bundle()
|
||||
bundle.putString("category", category)
|
||||
var categorySerachFragment = CategorySearchFragment()
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.module.navi.ui.search
|
||||
|
||||
import android.app.SearchManager
|
||||
import android.app.Service
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
@@ -14,15 +12,16 @@ import com.mogo.map.navi.IMogoNaviListener
|
||||
import com.mogo.map.navi.MogoCalculatePath
|
||||
import com.mogo.map.navi.MogoNaviInfo
|
||||
import com.mogo.map.navi.MogoTraffic
|
||||
import com.mogo.map.search.inputtips.MogoTip
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.navi.BuildConfig
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy
|
||||
import com.mogo.module.common.map.Scene
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.constants.AMapConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.manager.SettingManager
|
||||
import com.mogo.module.navi.ui.adapter.CalculatePathAdapter
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.group_path
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.pb_path
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.rv_search_result
|
||||
@@ -35,263 +34,236 @@ import kotlinx.android.synthetic.main.include_search_bar.iv_navi_back
|
||||
* 2020-01-09.
|
||||
*/
|
||||
class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallBack {
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
|
||||
when (cmd) {
|
||||
"firstPath" -> {
|
||||
selectItem(0)
|
||||
startNavi()
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
when (cmd) {
|
||||
"firstPath" -> {
|
||||
selectItem(0)
|
||||
startNavi()
|
||||
|
||||
}
|
||||
"secondPath" -> {
|
||||
selectItem(1)
|
||||
startNavi()
|
||||
}
|
||||
"secondPath" -> {
|
||||
selectItem(1)
|
||||
startNavi()
|
||||
|
||||
}
|
||||
"thirdPath" -> {
|
||||
selectItem(2)
|
||||
startNavi()
|
||||
}
|
||||
"thirdPath" -> {
|
||||
selectItem(2)
|
||||
startNavi()
|
||||
|
||||
}
|
||||
"startNavi" -> {
|
||||
startNavi()
|
||||
}
|
||||
"retry" -> {
|
||||
retry()
|
||||
}
|
||||
"cancel" -> {
|
||||
SearchServiceHolder.fragmentManager
|
||||
.clearAll()
|
||||
}
|
||||
}
|
||||
"startNavi" -> {
|
||||
startNavi()
|
||||
}
|
||||
"retry" -> {
|
||||
retry()
|
||||
}
|
||||
"cancel" -> {
|
||||
SearchServiceHolder.fragmentManager.clearAll()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun selectItem(index: Int) {
|
||||
|
||||
if (mAdapter.list.size > index) {
|
||||
selectPath(mAdapter.list[index])
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCmdAction(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onCmdCancel(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onInitNaviFailure() {
|
||||
}
|
||||
|
||||
override fun onInitNaviSuccess() {
|
||||
}
|
||||
|
||||
override fun onNaviInfoUpdate(naviinfo: MogoNaviInfo?) {
|
||||
}
|
||||
|
||||
override fun onStartNavi() {
|
||||
}
|
||||
|
||||
override fun onStopNavi() {
|
||||
}
|
||||
|
||||
override fun onCalculateSuccess() {
|
||||
var calculatedStrategies = SearchServiceHolder.getNavi()
|
||||
.calculatedStrategies
|
||||
if (calculatedStrategies != null && calculatedStrategies.size > 0) {
|
||||
mAdapter.setDatas(calculatedStrategies)
|
||||
mAdapter.selectTag = calculatedStrategies[0].tagId
|
||||
}
|
||||
AIAssist.getInstance(context)
|
||||
.speakTTSVoice(String.format("已为你规划处%d条路线,请选择", calculatedStrategies.size))
|
||||
pb_path.visibility = View.GONE
|
||||
group_path.visibility = View.GONE
|
||||
tv_navi_navi.text = getString(R.string.start_navi)
|
||||
|
||||
unregisterRetryVoice()
|
||||
|
||||
}
|
||||
|
||||
override fun onoCalculateFailed() {
|
||||
group_path.visibility = View.VISIBLE
|
||||
tv_navi_navi.text = "重试"
|
||||
pb_path.visibility = View.GONE
|
||||
|
||||
registerRetryVoice()
|
||||
|
||||
}
|
||||
|
||||
override fun onUpdateTraffic(traffic: MogoTraffic?) {
|
||||
}
|
||||
|
||||
private lateinit var mAdapter: CalculatePathAdapter
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_search_category
|
||||
}
|
||||
|
||||
val firstPath: String = "第一个"
|
||||
val secondPath: String = "第二个"
|
||||
val thirdPath: String = "第三个"
|
||||
val startNavi: String = "开始导航"
|
||||
|
||||
var mogoTip: MogoLatLng? = null
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mogoTip = arguments?.getParcelable<MogoLatLng>(AMapConstants.KEY_PARCELABLE)
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT, true
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
// 是否开启导航
|
||||
var isStartedNavi = false
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
|
||||
tv_navi_navi.text = getString(R.string.start_navi)
|
||||
|
||||
et_navi_search.setText(getString(R.string.choose_path))
|
||||
et_navi_search.isEnabled = false
|
||||
SearchServiceHolder.getNavi()
|
||||
.naviTo(mogoTip)
|
||||
|
||||
SearchServiceHolder.listenerCenter.registerMogoNaviListener(
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT, this
|
||||
)
|
||||
|
||||
var arrayList = ArrayList<MogoCalculatePath>()
|
||||
mAdapter = CalculatePathAdapter(activity, arrayList)
|
||||
rv_search_result.layoutManager =
|
||||
LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
rv_search_result.adapter = mAdapter
|
||||
tv_navi_navi.setOnClickListener {
|
||||
|
||||
if (group_path.visibility == View.VISIBLE) {
|
||||
retry()
|
||||
} else {
|
||||
startNavi()
|
||||
}
|
||||
}
|
||||
|
||||
SearchServiceHolder.getNavi()
|
||||
.setLineClickInteraction {
|
||||
mAdapter.setSelectTag(it)
|
||||
}
|
||||
|
||||
mAdapter.setOnClickListener {
|
||||
var item = it.getTag(R.id.tag_item) as MogoCalculatePath
|
||||
selectPath(item)
|
||||
}
|
||||
|
||||
// rv_search_result.scroto
|
||||
private fun selectItem(index: Int) {
|
||||
|
||||
if (mAdapter.list.size > index) {
|
||||
selectPath(mAdapter.list[index])
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCmdAction(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onCmdCancel(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onInitNaviFailure() {
|
||||
}
|
||||
|
||||
override fun onInitNaviSuccess() {
|
||||
}
|
||||
|
||||
override fun onNaviInfoUpdate(naviinfo: MogoNaviInfo?) {
|
||||
}
|
||||
|
||||
override fun onStartNavi() {
|
||||
}
|
||||
|
||||
override fun onStopNavi() {
|
||||
}
|
||||
|
||||
override fun onCalculateSuccess() {
|
||||
var calculatedStrategies = SearchServiceHolder.getNavi().calculatedStrategies
|
||||
if (calculatedStrategies != null && calculatedStrategies.size > 0) {
|
||||
mAdapter.setDatas(calculatedStrategies)
|
||||
mAdapter.selectTag = calculatedStrategies[0].tagId
|
||||
UiThreadHandler.postDelayed({
|
||||
if (isRemoving || isDetached) {
|
||||
return@postDelayed
|
||||
}
|
||||
if (calculatedStrategies.isNullOrEmpty()) {
|
||||
return@postDelayed
|
||||
}
|
||||
SearchServiceHolder.getNavi().itemClickInteraction.onItemClicked(calculatedStrategies[0].tagId)
|
||||
}, 500L)
|
||||
}
|
||||
AIAssist.getInstance(context).speakTTSVoice(String.format("已为你规划处%d条路线,请选择", calculatedStrategies.size))
|
||||
pb_path.visibility = View.GONE
|
||||
group_path.visibility = View.GONE
|
||||
tv_navi_navi.text = getString(R.string.start_navi)
|
||||
|
||||
unregisterRetryVoice()
|
||||
|
||||
}
|
||||
|
||||
SearchServiceHolder.getMarkerManger()
|
||||
.removeMarkers()
|
||||
override fun onoCalculateFailed() {
|
||||
group_path.visibility = View.VISIBLE
|
||||
tv_navi_navi.text = "重试"
|
||||
pb_path.visibility = View.GONE
|
||||
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("firstPath", arrayOf<String>(firstPath), this)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("secondPath", arrayOf<String>(secondPath), this)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("thirdPath", arrayOf<String>(thirdPath), this)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("startNavi", arrayOf<String>(startNavi,"开始"), this)
|
||||
registerRetryVoice()
|
||||
|
||||
}
|
||||
|
||||
private fun registerRetryVoice() {
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("retry", arrayOf<String>("重试"), this)
|
||||
}
|
||||
|
||||
private fun unregisterRetryVoice() {
|
||||
AIAssist.getInstance(context)
|
||||
.unregisterUnWakeupCommand("retry")
|
||||
|
||||
}
|
||||
|
||||
private fun retry() {
|
||||
SearchServiceHolder.getNavi()
|
||||
.naviTo(mogoTip)
|
||||
pb_path.visibility = View.VISIBLE
|
||||
group_path.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun startNavi() {
|
||||
if (TextUtils.isEmpty(mAdapter.selectTag)) {
|
||||
return
|
||||
}
|
||||
moveMapToRight()
|
||||
|
||||
SearchServiceHolder.getNavi()
|
||||
.startNavi(!SettingManager.isMonitor())
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.recoverLockMode()
|
||||
|
||||
if (SearchServiceHolder.guideShowProvider.isPlayingVideo()) {
|
||||
SearchServiceHolder.guideShowProvider.closeGuideShowView()
|
||||
}
|
||||
isStartedNavi = true
|
||||
SearchServiceHolder.fragmentManager.clearAll()
|
||||
}
|
||||
|
||||
private fun selectPath(item: MogoCalculatePath?) {
|
||||
item?.let {
|
||||
mAdapter.setSelectTag(item.tagId)
|
||||
SearchServiceHolder.getNavi()
|
||||
.itemClickInteraction.onItemClicked(item.tagId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
SearchServiceHolder.listenerCenter.unregisterMogoNaviListener(
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT
|
||||
)
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT, false
|
||||
)
|
||||
if (!isStartedNavi) {
|
||||
SearchServiceHolder.getNavi()
|
||||
.clearCalculatePaths()
|
||||
}
|
||||
|
||||
|
||||
AIAssist.getInstance(context)
|
||||
.unregisterUnWakeupCommand("firstPath")
|
||||
AIAssist.getInstance(context)
|
||||
.unregisterUnWakeupCommand("secondPath")
|
||||
AIAssist.getInstance(context)
|
||||
.unregisterUnWakeupCommand("thirdPath")
|
||||
AIAssist.getInstance(context)
|
||||
.unregisterUnWakeupCommand("startNavi")
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(searchPoi: MogoLatLng): Fragment {
|
||||
var bundle = Bundle()
|
||||
bundle.putParcelable(AMapConstants.KEY_PARCELABLE, searchPoi)
|
||||
var choosePathFragment = ChoosePathFragment()
|
||||
choosePathFragment.arguments = bundle
|
||||
return choosePathFragment
|
||||
override fun onUpdateTraffic(traffic: MogoTraffic?) {
|
||||
}
|
||||
|
||||
private lateinit var mAdapter: CalculatePathAdapter
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_search_category
|
||||
}
|
||||
|
||||
val firstPath: String = "第一个"
|
||||
val secondPath: String = "第二个"
|
||||
val thirdPath: String = "第三个"
|
||||
val startNavi: String = "开始导航"
|
||||
|
||||
var mogoTip: MogoLatLng? = null
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mogoTip = arguments?.getParcelable<MogoLatLng>(AMapConstants.KEY_PARCELABLE)
|
||||
|
||||
}
|
||||
|
||||
// 是否开启导航
|
||||
var isStartedNavi = false
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?) {
|
||||
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
}
|
||||
|
||||
tv_navi_navi.text = getString(R.string.start_navi)
|
||||
|
||||
et_navi_search.setText(getString(R.string.choose_path))
|
||||
et_navi_search.isEnabled = false
|
||||
SearchServiceHolder.getNavi().naviTo(mogoTip)
|
||||
|
||||
SearchServiceHolder.listenerCenter.registerMogoNaviListener(AMapConstants.PATH_FRAGMENT_CHOOSE_PATH, this)
|
||||
|
||||
var arrayList = ArrayList<MogoCalculatePath>()
|
||||
mAdapter = CalculatePathAdapter(activity, arrayList)
|
||||
rv_search_result.layoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
|
||||
|
||||
rv_search_result.adapter = mAdapter
|
||||
tv_navi_navi.setOnClickListener {
|
||||
if (group_path.visibility == View.VISIBLE) {
|
||||
retry()
|
||||
} else {
|
||||
startNavi()
|
||||
}
|
||||
}
|
||||
|
||||
SearchServiceHolder.getNavi().setLineClickInteraction {
|
||||
mAdapter.selectTag = it
|
||||
}
|
||||
|
||||
mAdapter.setOnClickListener {
|
||||
var item = it.getTag(R.id.tag_item) as MogoCalculatePath
|
||||
selectPath(item)
|
||||
}
|
||||
|
||||
SearchServiceHolder.getMarkerManger().removeMarkers()
|
||||
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("firstPath", arrayOf<String>(firstPath), this)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("secondPath", arrayOf<String>(secondPath), this)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("thirdPath", arrayOf<String>(thirdPath), this)
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("startNavi", arrayOf<String>(startNavi, "开始"), this)
|
||||
|
||||
}
|
||||
|
||||
private fun registerRetryVoice() {
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand("retry", arrayOf<String>("重试"), this)
|
||||
}
|
||||
|
||||
private fun unregisterRetryVoice() {
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("retry")
|
||||
|
||||
}
|
||||
|
||||
private fun retry() {
|
||||
SearchServiceHolder.getNavi().naviTo(mogoTip)
|
||||
pb_path.visibility = View.VISIBLE
|
||||
group_path.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun startNavi() {
|
||||
if (TextUtils.isEmpty(mAdapter.selectTag)) {
|
||||
return
|
||||
}
|
||||
// moveMapToRight()
|
||||
|
||||
SearchServiceHolder.getNavi().startNavi(!SettingManager.isMonitor())
|
||||
SearchServiceHolder.getMapUIController().recoverLockMode()
|
||||
|
||||
if (SearchServiceHolder.guideShowProvider.isPlayingVideo()) {
|
||||
SearchServiceHolder.guideShowProvider.closeGuideShowView()
|
||||
}
|
||||
isStartedNavi = true
|
||||
SearchServiceHolder.fragmentManager.clearAll()
|
||||
}
|
||||
|
||||
private fun selectPath(item: MogoCalculatePath?) {
|
||||
item?.let {
|
||||
mAdapter.setSelectTag(item.tagId)
|
||||
SearchServiceHolder.getNavi().itemClickInteraction.onItemClicked(item.tagId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
SearchServiceHolder.listenerCenter.unregisterMogoNaviListener(AMapConstants.PATH_FRAGMENT_CHOOSE_PATH)
|
||||
if (!isStartedNavi) {
|
||||
SearchServiceHolder.getNavi().clearCalculatePaths()
|
||||
}
|
||||
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("firstPath")
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("secondPath")
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("thirdPath")
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand("startNavi")
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(searchPoi: MogoLatLng): Fragment {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CALCULATE_PATH)
|
||||
var bundle = Bundle()
|
||||
bundle.putParcelable(AMapConstants.KEY_PARCELABLE, searchPoi)
|
||||
var choosePathFragment = ChoosePathFragment()
|
||||
choosePathFragment.arguments = bundle
|
||||
return choosePathFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.navi.R;
|
||||
import com.mogo.module.navi.bean.EntityConvertUtils;
|
||||
import com.mogo.module.navi.bean.SearchPoi;
|
||||
import com.mogo.module.navi.constants.AMapConstants;
|
||||
import com.mogo.module.navi.manager.AddressManager;
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder;
|
||||
import com.mogo.module.navi.ui.adapter.HistoryPoiAdapter;
|
||||
@@ -43,7 +44,6 @@ import java.util.List;
|
||||
* {@link SearchConstants#SEARCH_TYPE_MULTI_COMPANY}
|
||||
* {@link SearchConstants#SEARCH_TYPE_MULTI_HOME}
|
||||
*/
|
||||
@Route(path = MogoModulePaths.PATH_FRAGMENT_SEARCH)
|
||||
public class SearchFragment extends BaseSearchFragment
|
||||
implements SearchView, View.OnClickListener, IMogoVoiceCmdCallBack,
|
||||
FragmentStackTransactionListener {
|
||||
@@ -92,7 +92,6 @@ public class SearchFragment extends BaseSearchFragment
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
SearchServiceHolder.INSTANCE.getMarkerManger().removeMarkers();
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation(false);
|
||||
moveMapToCenter();
|
||||
}
|
||||
|
||||
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
@@ -186,24 +185,18 @@ public class SearchFragment extends BaseSearchFragment
|
||||
goCategory(tag.getName());
|
||||
} else {
|
||||
mSearchPresenter.insert(searchPoi);
|
||||
SearchServiceHolder.INSTANCE.push(
|
||||
ChoosePathFragment.Companion.newInstance(tag.getPoint()),
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT);
|
||||
AddressManager.INSTANCE.calculatePath( tag.getPoint() );
|
||||
}
|
||||
}
|
||||
|
||||
private void goSetting() {
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager()
|
||||
.track("Navigation_button_setting", new HashMap<String, Object>());
|
||||
|
||||
push(new NaviSettingFragment(), MogoModulePaths.PATH_FRAGMENT_SETTING);
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager().track("Navigation_button_setting", new HashMap<String, Object>());
|
||||
AddressManager.INSTANCE.goSettings();
|
||||
}
|
||||
|
||||
private void goHistory(SearchPoi item) {
|
||||
MogoTip mogoTip = EntityConvertUtils.poi2MogoTip(item);
|
||||
SearchServiceHolder.INSTANCE.push(
|
||||
ChoosePathFragment.Companion.newInstance(mogoTip.getPoint()),
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT);
|
||||
AddressManager.INSTANCE.calculatePath( mogoTip.getPoint() );
|
||||
}
|
||||
|
||||
private static final String GO_HOME_CMD = "goHome";
|
||||
@@ -501,8 +494,7 @@ public class SearchFragment extends BaseSearchFragment
|
||||
}
|
||||
|
||||
private void goCategory(String text) {
|
||||
push(CategorySearchFragment.Companion.newInstance(text),
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY);
|
||||
AddressManager.INSTANCE.categorySearch( text );
|
||||
}
|
||||
|
||||
@Override public void onResume() {
|
||||
@@ -517,7 +509,7 @@ public class SearchFragment extends BaseSearchFragment
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation(true);
|
||||
moveMapToRight();
|
||||
// moveMapToRight();
|
||||
unRegisterVoice();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
package com.mogo.module.navi.ui.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-30
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
|
||||
@Route( path = MogoModulePaths.PATH_MODULE_SEARCH )
|
||||
public class SearchFragmentProvider implements IMogoModuleProvider {
|
||||
|
||||
private SearchFragment mAppsFragment;
|
||||
|
||||
@Override
|
||||
public Fragment createFragment( Context context, Bundle data ) {
|
||||
mAppsFragment = new SearchFragment();
|
||||
mAppsFragment.setArguments( data );
|
||||
return mAppsFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView( Context context ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
return MogoModulePaths.PATH_MODULE_SEARCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoModuleLifecycle getCardLifecycle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapListener getMapListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return ModuleType.TYPE_NAVI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNaviListener getNaviListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationListener getLocationListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import org.greenrobot.eventbus.ThreadMode
|
||||
* @author zyz
|
||||
* 2020-01-07.
|
||||
*/
|
||||
@Route(path = MogoModulePaths.PATH_FRAGMENT_SETTING)
|
||||
class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
|
||||
private var type: Int = 0
|
||||
|
||||
@@ -17,6 +17,8 @@ import com.mogo.map.search.geo.MogoRegeocodeResult
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.common.adapter.MogoMapListenerAdapter
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy
|
||||
import com.mogo.module.common.map.Scene
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.R.string
|
||||
import com.mogo.module.navi.bean.EntityConvertUtils
|
||||
@@ -40,7 +42,6 @@ import kotlinx.android.synthetic.main.fragment_setting_address.tv_set_as_home
|
||||
* @author zyz
|
||||
* 2020-01-07.
|
||||
*/
|
||||
@Route(path = MogoModulePaths.PATH_FRAGMENT_SETTING_HOME)
|
||||
class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
override fun onRegeocodeSearched(regeocodeResult: MogoRegeocodeResult?) {
|
||||
et_navi_search.setText(regeocodeResult?.regeocodeAddress?.formatAddress)
|
||||
@@ -97,22 +98,14 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
style = arguments?.getInt(AMapConstants.KEY_SET_HOME_COMPONY) ?: DataConstants.TYPE_HOME_ADDRESS
|
||||
setMarkerStatus(true)
|
||||
SearchServiceHolder.listenerCenter.registerMogoMapListener(
|
||||
MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, mapListener
|
||||
AMapConstants.PATH_FRAGMENT_SETTING_HOME, mapListener
|
||||
)
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.showMyLocation(false)
|
||||
SearchServiceHolder.getMapUIController().showMyLocation(false)
|
||||
|
||||
SearchServiceHolder.getGeoSearcher()
|
||||
.setGeoSearchListener(this)
|
||||
SearchServiceHolder.getGeoSearcher().setGeoSearchListener(this)
|
||||
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, true
|
||||
)
|
||||
|
||||
SearchServiceHolder.getMarkerManger()
|
||||
.removeMarkers()
|
||||
SearchServiceHolder.getMarkerManger().removeMarkers()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
@@ -155,9 +148,8 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
|
||||
et_navi_search.isEnabled = false
|
||||
et_navi_search.setText(getString(string.drag_map_to_choose))
|
||||
var location = SearchServiceHolder.getMapUIController()
|
||||
.windowCenterLocation
|
||||
moveMapToCenter()
|
||||
var location = SearchServiceHolder.getMapUIController().windowCenterLocation
|
||||
|
||||
UiThreadHandler.postDelayed({
|
||||
if (!isAdded) {
|
||||
return@postDelayed
|
||||
@@ -170,10 +162,9 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
.anchor(0.5f, 1f)
|
||||
.longitude(location?.lng ?: 0.0)
|
||||
addMarker = SearchServiceHolder.getMarkerManger()
|
||||
.addMarker(MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, options)
|
||||
.addMarker(AMapConstants.PATH_FRAGMENT_SETTING_HOME, options)
|
||||
|
||||
var locationPointInScreen = SearchServiceHolder.getMapUIController()
|
||||
.getLocationPointInScreen(location)
|
||||
var locationPointInScreen = SearchServiceHolder.getMapUIController().getLocationPointInScreen(location)
|
||||
addMarker?.setPositionByPixels(locationPointInScreen)
|
||||
}, 500L)
|
||||
}
|
||||
@@ -190,31 +181,14 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
// setMarkerStatus(true)
|
||||
// SearchServiceHolder.getMapUIController()
|
||||
// .showMyLocation(true)
|
||||
SearchServiceHolder.listenerCenter.unregisterMogoMapListener(
|
||||
MogoModulePaths.PATH_FRAGMENT_SETTING_HOME
|
||||
AMapConstants.PATH_FRAGMENT_SETTING_HOME
|
||||
)
|
||||
addMarker?.destroy()
|
||||
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, false
|
||||
)
|
||||
|
||||
if (SearchServiceHolder.fragmentManager.stackSize == 0) {
|
||||
moveMapToRight()
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.showMyLocation(true)
|
||||
}
|
||||
|
||||
// moveMapToRight()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.module.service;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
@@ -36,6 +34,8 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.service.carinfo.CarStateInfo;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
@@ -966,19 +966,18 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( size == 0 ) {
|
||||
mUiController.showMyLocation( !mNavi.isNaviing() );
|
||||
AIAssist.getInstance( mContext ).unregisterUnWakeupCommand( ServiceConst.CMD_BACK );
|
||||
// 控制SearchUIShow 打点逻辑
|
||||
mStatusManager.setSearchUIShow( TAG, false );
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
mStatusManager.setSearchUIShow( TAG, false );
|
||||
}
|
||||
if ( mNavi.isNaviing() ) {
|
||||
mUiController.setPointToCenter( 0.675926, 0.77552 );
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mUiController, Scene.NAVI );
|
||||
} else {
|
||||
mUiController.setPointToCenter( 0.66145, 0.661094 );
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mUiController, Scene.AIMLESS );
|
||||
}
|
||||
mUiController.recoverLockMode();
|
||||
} else {
|
||||
mUiController.showMyLocation( false );
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this );
|
||||
mStatusManager.setSearchUIShow( TAG, true );
|
||||
mUiController.setPointToCenter( 0.5, 0.5 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.service.module;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
@@ -8,6 +9,32 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
*/
|
||||
public interface IMogoAddressManager extends IProvider {
|
||||
|
||||
/**
|
||||
* 回家
|
||||
*/
|
||||
void goHome();
|
||||
|
||||
/**
|
||||
* 去公司
|
||||
*/
|
||||
void goCompany();
|
||||
|
||||
/**
|
||||
* 打开搜索
|
||||
*/
|
||||
void goSearch();
|
||||
|
||||
/**
|
||||
* 规划路线
|
||||
*
|
||||
* @param destination 目的地
|
||||
*/
|
||||
void calculatePath( MogoLatLng destination );
|
||||
|
||||
/**
|
||||
* 分类搜索
|
||||
*/
|
||||
void categorySearch(String category);
|
||||
|
||||
void goSettings();
|
||||
}
|
||||
|
||||
@@ -84,6 +84,12 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isAIAssistReady();
|
||||
|
||||
/**
|
||||
* 求助状态
|
||||
* @return
|
||||
*/
|
||||
boolean isSeekHelping();
|
||||
|
||||
/**
|
||||
* 设置小智语音UI状态
|
||||
*
|
||||
@@ -166,6 +172,13 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
void setAIAssistReady( String tag, boolean ready );
|
||||
|
||||
/**
|
||||
* 设置求助状态
|
||||
* @param tag
|
||||
* @param seekHelping
|
||||
*/
|
||||
void setSeekHelping(String tag, boolean seekHelping);
|
||||
|
||||
/**
|
||||
* 注册监听
|
||||
*
|
||||
|
||||
@@ -59,5 +59,10 @@ public enum StatusDescriptor {
|
||||
/**
|
||||
* 小智语音状态
|
||||
*/
|
||||
AI_ASSIST_READY;
|
||||
AI_ASSIST_READY,
|
||||
|
||||
/**
|
||||
* 求助状态
|
||||
*/
|
||||
SEEK_HELPING;
|
||||
}
|
||||
|
||||
@@ -99,6 +99,12 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
return get_bool_val( StatusDescriptor.AI_ASSIST_READY );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSeekHelping() {
|
||||
return get_bool_val( StatusDescriptor.SEEK_HELPING );
|
||||
}
|
||||
|
||||
private boolean get_bool_val( StatusDescriptor descriptor ) {
|
||||
Boolean val = mStatus.get( descriptor );
|
||||
return val == null ? false : val;
|
||||
@@ -177,6 +183,13 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
recordStatusModifier( tag, StatusDescriptor.AI_ASSIST_READY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSeekHelping( String tag, boolean seekHelping ) {
|
||||
mStatus.put( StatusDescriptor.SEEK_HELPING, seekHelping );
|
||||
invokeStatusChangedListener( StatusDescriptor.SEEK_HELPING, seekHelping );
|
||||
recordStatusModifier( tag, StatusDescriptor.SEEK_HELPING );
|
||||
}
|
||||
|
||||
private void invokeStatusChangedListener( StatusDescriptor descriptor, boolean status ) {
|
||||
if ( mListeners.containsKey( descriptor ) ) {
|
||||
Iterator< IMogoStatusChangedListener > iterator = mListeners.get( descriptor ).iterator();
|
||||
|
||||
Reference in New Issue
Block a user