+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index fe41377686..536d5ac6c6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -113,6 +113,8 @@ android {
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
+ // 是否支持查询导航目的地车友
+ buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
}
// f系列-分体机
f80x {
@@ -131,6 +133,8 @@ android {
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
+ // 是否支持查询导航目的地车友
+ buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
}
// e系列,采用Launcher方案
e8xx {
@@ -149,6 +153,8 @@ android {
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
+ // 是否支持查询导航目的地车友
+ buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
}
// 同上
em4 {
@@ -167,6 +173,8 @@ android {
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
+ // 是否支持查询导航目的地车友
+ buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
}
// e系列-2+32,对标D系列2+32,采用独立app的形式
em3 {
@@ -185,6 +193,8 @@ android {
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'false'
+ // 是否支持查询导航目的地车友
+ buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
}
// e系列-1+16,对标D系列1+16,采用独立app形式
em1 {
@@ -203,6 +213,8 @@ android {
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'false'
+ // 是否支持查询导航目的地车友
+ buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
}
// d系列
d8xx {
@@ -220,7 +232,9 @@ android {
// 是否加载引导模块
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'true'
// 是否支持换肤
- buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'false'
+ buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
+ // 是否支持查询导航目的地车友
+ buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
}
// d系列 2 + 32
d80x {
@@ -238,7 +252,9 @@ android {
// 是否加载引导模块
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'true'
// 是否支持换肤
- buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'false'
+ buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
+ // 是否支持查询导航目的地车友
+ buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
}
// d系列 1+16 版本
d82x {
@@ -257,6 +273,8 @@ android {
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'true'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'false'
+ // 是否支持查询导航目的地车友
+ buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
}
// 比亚迪
bydauto {
@@ -275,6 +293,8 @@ android {
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
// 是否支持换肤
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'false'
+ // 是否支持查询导航目的地车友
+ buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'false'
}
qa {
dimension "env"
diff --git a/app/functions/skin.gradle b/app/functions/skin.gradle
index 5945ee7e4c..12cf97f10c 100644
--- a/app/functions/skin.gradle
+++ b/app/functions/skin.gradle
@@ -1,13 +1,11 @@
-project.dependencies {
-
- if (Boolean.valueOf(RELEASE)) {
+if (Boolean.valueOf(RELEASE)) {
bydautoImplementation rootProject.ext.dependencies.skinsupportnoop
- d8xxImplementation rootProject.ext.dependencies.skinsupportnoop
d82xImplementation rootProject.ext.dependencies.skinsupportnoop
em1Implementation rootProject.ext.dependencies.skinsupportnoop
- d80xImplementation rootProject.ext.dependencies.skinsupportnoop
em3Implementation rootProject.ext.dependencies.skinsupportnoop
+ d8xxImplementation rootProject.ext.dependencies.skinsupportimpl
+ d80xImplementation rootProject.ext.dependencies.skinsupportimpl
f8xxImplementation rootProject.ext.dependencies.skinsupportimpl
f80xImplementation rootProject.ext.dependencies.skinsupportimpl
em4Implementation rootProject.ext.dependencies.skinsupportimpl
@@ -17,19 +15,21 @@ project.dependencies {
f80xImplementation rootProject.ext.dependencies.skinsupportlight
em4Implementation rootProject.ext.dependencies.skinsupportlight
e8xxImplementation rootProject.ext.dependencies.skinsupportlight
-// d8xxImplementation rootProject.ext.dependencies.skinsupportlight
+ d8xxImplementation rootProject.ext.dependencies.skinsupportlight
+ d80xImplementation rootProject.ext.dependencies.skinsupportlight
// d82xImplementation rootProject.ext.dependencies.skinsupportlight
// em1Implementation rootProject.ext.dependencies.skinsupportlight
-// d80xImplementation rootProject.ext.dependencies.skinsupportlight
// em3Implementation rootProject.ext.dependencies.skinsupportlight
- } else {
+} else {
+ project.dependencies {
+
bydautoImplementation project(':skin:mogo-skin-support-noop')
- d8xxImplementation project(':skin:mogo-skin-support-noop')
d82xImplementation project(':skin:mogo-skin-support-noop')
em1Implementation project(':skin:mogo-skin-support-noop')
- d80xImplementation project(':skin:mogo-skin-support-noop')
em3Implementation project(':skin:mogo-skin-support-noop')
+ d8xxImplementation project(':skin:mogo-skin-support-impl')
+ d80xImplementation project(':skin:mogo-skin-support-impl')
f8xxImplementation project(':skin:mogo-skin-support-impl')
f80xImplementation project(':skin:mogo-skin-support-impl')
em4Implementation project(':skin:mogo-skin-support-impl')
@@ -39,10 +39,10 @@ project.dependencies {
f80xImplementation project(':skin:mogo-skin-light')
em4Implementation project(':skin:mogo-skin-light')
e8xxImplementation project(':skin:mogo-skin-light')
-// d8xxImplementation project(':skin:mogo-skin-light')
+ d8xxImplementation project(':skin:mogo-skin-light')
+ d80xImplementation project(':skin:mogo-skin-light')
// d82xImplementation project(':skin:mogo-skin-light')
// em1Implementation project(':skin:mogo-skin-light')
-// d80xImplementation project(':skin:mogo-skin-light')
// em3Implementation project(':skin:mogo-skin-light')
}
}
\ No newline at end of file
diff --git a/app/functions/widgets.gradle b/app/functions/widgets.gradle
index cc816fc4c2..7309852d9e 100644
--- a/app/functions/widgets.gradle
+++ b/app/functions/widgets.gradle
@@ -3,7 +3,9 @@
project.dependencies {
if (Boolean.valueOf(RELEASE)) {
independentImplementation rootProject.ext.dependencies.mogomodulewidgets
+ implementation rootProject.ext.dependencies.mogomodulewidgets
} else {
independentImplementation project(':modules:mogo-module-widgets')
+ implementation project(':modules:mogo-module-widgets')
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java
index f7ff196ea7..7abefd176e 100644
--- a/app/src/main/java/com/mogo/launcher/MogoApplication.java
+++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java
@@ -14,6 +14,7 @@ import com.mogo.commons.network.Utils;
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
import com.mogo.module.back.BackToLauncherConst;
import com.mogo.module.carchatting.card.CallChatConstant;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.module.main.service.MogoMainService;
@@ -74,8 +75,8 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addModule( new MogoModule( BackToLauncherConst.MODULE_PATH, BackToLauncherConst.MODULE_NAME ) );
MogoModulePaths.addModule( new MogoModule( MediaConstants.TAG, MediaConstants.MODULE_TYPE ) );
} else {
- MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_WIDGETS, MogoServicePaths.PATH_WIDGETS ) );
}
+ MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_WIDGETS, MogoServicePaths.PATH_WIDGETS ) );
if ( DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD ) {
MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
}
@@ -130,6 +131,7 @@ public class MogoApplication extends AbsMogoApplication {
DebugConfig.setRoadEventAnimated( BuildConfig.ROAD_EVENT_ANIMATED );
DebugConfig.setLoadGuideModule( BuildConfig.LOAD_GUIDE_MODULE );
DebugConfig.setSkinSupported( BuildConfig.IS_SKIN_SUPPORTED );
+ DebugConfig.setSupportedSearchDestinationOnlineCarList( BuildConfig.IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST );
}
@Override
@@ -140,7 +142,7 @@ public class MogoApplication extends AbsMogoApplication {
@Override
protected void init() {
super.init();
- final IMogoServiceApis apis = ARouter.getInstance().navigation( IMogoServiceApis.class );
+ final IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
prepareBaseService( apis, 2_000L );
// installSkinManager( this, apis );
}
diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java
index 4f9761ca27..91bcb237ec 100644
--- a/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java
+++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java
@@ -264,7 +264,7 @@ public class DebugConfig {
private static String SP_GUIDE = "SP_GUIDE_2020_09_09";
- public static String getSpGuide(){
+ public static String getSpGuide() {
return SP_GUIDE;
}
@@ -277,4 +277,17 @@ public class DebugConfig {
public static boolean isSkinSupported() {
return isSkinSupported;
}
+
+ /**
+ * 是否支持支持查询导航目的地车友信息
+ */
+ private static boolean isSupportedSearchDestinationOnlineCarList = false;
+
+ public static void setSupportedSearchDestinationOnlineCarList( boolean isSupportedSearchDestinationOnlineCarList ) {
+ DebugConfig.isSupportedSearchDestinationOnlineCarList = isSupportedSearchDestinationOnlineCarList;
+ }
+
+ public static boolean isSupportedSearchDestinationOnlineCarList() {
+ return isSupportedSearchDestinationOnlineCarList;
+ }
}
diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/storage/SpStorage.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/storage/SpStorage.java
index 0fbca06a32..6971ebd8d4 100644
--- a/foudations/mogo-commons/src/main/java/com/mogo/commons/storage/SpStorage.java
+++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/storage/SpStorage.java
@@ -18,4 +18,12 @@ public class SpStorage {
public static void setTicket( String ticket ) {
SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).putString( "ticket", ticket );
}
+
+ public static String getNavigationTarget(){
+ return SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).getString( "naviTarget" );
+ }
+
+ public static void setNavigationTarget( String naviTarget ) {
+ SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).putString( "naviTarget", naviTarget );
+ }
}
diff --git a/libraries/map-autonavi/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java b/libraries/map-autonavi/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java
index 516be8652e..9bcd3e772c 100644
--- a/libraries/map-autonavi/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java
+++ b/libraries/map-autonavi/src/main/java/com/mogo/map/impl/automap/navi/AutoNaviReceiver.java
@@ -6,6 +6,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.text.TextUtils;
+import com.mogo.commons.storage.SpStorage;
import com.mogo.map.impl.amap.utils.IconTypeUtils;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoNaviListenerHandler;
@@ -66,6 +67,11 @@ public class AutoNaviReceiver extends BroadcastReceiver {
int state = intent.getIntExtra( "EXTRA_STATE", -1 );
handleMapStatusChanged( state );
break;
+ case 10056:
+ String json = intent.getStringExtra( "EXTRA_ROAD_INFO" );
+ SpStorage.setNavigationTarget(json);
+ Logger.d( TAG, json );
+ break;
}
}
diff --git a/main-extensions/mogo-module-main-independent/src/main/java/com/zhidao/mogo/module/main/independent/MainIndependentActivity.java b/main-extensions/mogo-module-main-independent/src/main/java/com/zhidao/mogo/module/main/independent/MainIndependentActivity.java
index f3ae390679..0b6ecceac5 100644
--- a/main-extensions/mogo-module-main-independent/src/main/java/com/zhidao/mogo/module/main/independent/MainIndependentActivity.java
+++ b/main-extensions/mogo-module-main-independent/src/main/java/com/zhidao/mogo/module/main/independent/MainIndependentActivity.java
@@ -39,6 +39,11 @@ public class MainIndependentActivity extends MainActivity {
eventPanelParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft );
mEntrance.setLayoutParams( eventPanelParams );
+ // 事件面板
+ FrameLayout.LayoutParams historyMessagePanelParams = ( ( FrameLayout.LayoutParams ) mEventPanel.getLayoutParams() );
+ historyMessagePanelParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft );
+ mHistoryMessagePanel.setLayoutParams( historyMessagePanelParams );
+
mLeftShadowFrame.setVisibility(View.VISIBLE);
mApps.setVisibility( View.GONE );
}
@@ -58,7 +63,6 @@ public class MainIndependentActivity extends MainActivity {
}
}
-
@Override
protected void onPause() {
super.onPause();
diff --git a/main-extensions/mogo-module-main-independent/src/main/res/values/dimens.xml b/main-extensions/mogo-module-main-independent/src/main/res/values/dimens.xml
index 7c6006c413..d25f1c125d 100644
--- a/main-extensions/mogo-module-main-independent/src/main/res/values/dimens.xml
+++ b/main-extensions/mogo-module-main-independent/src/main/res/values/dimens.xml
@@ -1,5 +1,5 @@
- 350px
+ 358px
366px
\ No newline at end of file
diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppServiceHandler.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppServiceHandler.java
index 4df55c25b6..faa3baec81 100644
--- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppServiceHandler.java
+++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppServiceHandler.java
@@ -1,9 +1,7 @@
package com.mogo.module.apps;
-import com.alibaba.android.arouter.launcher.ARouter;
-import com.mogo.commons.AbsMogoApplication;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.MogoServicePaths;
/**
* author : zyz
@@ -20,7 +18,7 @@ public class AppServiceHandler {
public static IMogoServiceApis getApis() {
if ( mApis == null ) {
- mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( AbsMogoApplication.getApp() );
+ mApis = MogoApisHandler.getInstance().getApis();
}
return mApis;
}
diff --git a/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToLauncherModuleProvider.java b/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToLauncherModuleProvider.java
index c03d6944b3..29b64c6c25 100644
--- a/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToLauncherModuleProvider.java
+++ b/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToLauncherModuleProvider.java
@@ -8,15 +8,9 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
-import com.alibaba.android.arouter.launcher.ARouter;
-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.MogoApisHandler;
import com.mogo.module.common.utils.CarSeries;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.MogoServicePaths;
-import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.service.module.ModuleType;
@@ -59,7 +53,7 @@ public class BackToLauncherModuleProvider implements IMogoModuleProvider {
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
BackToMainHomeManager.addMainHomeView();
}
- mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
+ mServiceApis = MogoApisHandler.getInstance().getApis();
BackToMainHomeManager.init( mServiceApis );
}
}
diff --git a/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java b/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java
index ea748c53fe..26dbe1f40e 100644
--- a/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java
+++ b/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java
@@ -63,7 +63,7 @@ public class BackToMainHomeManager {
.size( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT )
.gravity( Gravity.LEFT | Gravity.TOP )
.showInWindowManager();
- mWindowManagerView.attachTouchEvent( view -> {
+ mWindowManagerView.attachTouchEvent( (view, xPos, yPos) -> {
backToLauncher();
} );
}
diff --git a/modules/mogo-module-common/build.gradle b/modules/mogo-module-common/build.gradle
index c3f39b9c50..3a8b6d5986 100644
--- a/modules/mogo-module-common/build.gradle
+++ b/modules/mogo-module-common/build.gradle
@@ -32,6 +32,7 @@ dependencies {
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.androidxconstraintlayout
+ implementation rootProject.ext.dependencies.arouter
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogomap
api rootProject.ext.dependencies.mogomapapi
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/MogoApisHandler.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/MogoApisHandler.java
new file mode 100644
index 0000000000..1fc4db92be
--- /dev/null
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/MogoApisHandler.java
@@ -0,0 +1,52 @@
+package com.mogo.module.common;
+
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.service.IMogoServiceApis;
+
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+public final class MogoApisHandler {
+
+ private IMogoServiceApis sApis;
+
+ private static volatile MogoApisHandler sInstance;
+
+ private MogoApisHandler() {
+ sApis = ARouter.getInstance().navigation( IMogoServiceApis.class );
+ }
+
+ public static MogoApisHandler getInstance() {
+ if ( sInstance == null ) {
+ synchronized ( MogoApisHandler.class ) {
+ if ( sInstance == null ) {
+ sInstance = new MogoApisHandler();
+ }
+ }
+ }
+ return sInstance;
+ }
+
+ public synchronized void release() {
+ sInstance = null;
+ }
+
+ private Object readResolve() {
+ // 阻止反序列化,必须实现 Serializable 接口
+ return sInstance;
+ }
+
+ public IMogoServiceApis getApis() {
+ if ( sApis == null ) {
+ synchronized ( this ) {
+ if ( sApis != null ) {
+ sApis = ARouter.getInstance().navigation( IMogoServiceApis.class );
+ }
+ }
+ }
+ return sApis;
+ }
+}
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/widget/CustomCircleImageView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/widget/CustomCircleImageView.java
new file mode 100644
index 0000000000..c743b08a24
--- /dev/null
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/widget/CustomCircleImageView.java
@@ -0,0 +1,337 @@
+package com.mogo.module.common.widget;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.BitmapShader;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.graphics.Shader;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.ColorRes;
+import androidx.annotation.DrawableRes;
+
+import com.mogo.module.common.R;
+
+@SuppressLint("AppCompatCustomView")
+public class CustomCircleImageView extends ImageView {
+
+ private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP;
+
+ private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888;
+ private static final int COLORDRAWABLE_DIMENSION = 2;
+
+ private static final int DEFAULT_BORDER_WIDTH = 0;
+ private static final int DEFAULT_BORDER_COLOR = Color.BLACK;
+ private static final int DEFAULT_FILL_COLOR = Color.TRANSPARENT;
+ private static final boolean DEFAULT_BORDER_OVERLAY = false;
+
+ private final RectF mDrawableRect = new RectF();
+ private final RectF mBorderRect = new RectF();
+
+ private final Matrix mShaderMatrix = new Matrix();
+ private final Paint mBitmapPaint = new Paint();
+ private final Paint mBorderPaint = new Paint();
+ private final Paint mFillPaint = new Paint();
+
+ private int mBorderColor = DEFAULT_BORDER_COLOR;
+ private int mBorderWidth = DEFAULT_BORDER_WIDTH;
+ private int mFillColor = DEFAULT_FILL_COLOR;
+
+ private Bitmap mBitmap;
+ private BitmapShader mBitmapShader;
+ private int mBitmapWidth;
+ private int mBitmapHeight;
+
+ private float mDrawableRadius;
+ private float mBorderRadius;
+
+ private ColorFilter mColorFilter;
+
+ private boolean mReady;
+ private boolean mSetupPending;
+ private boolean mBorderOverlay;
+
+ public CustomCircleImageView( Context context) {
+ super(context);
+
+ init();
+ }
+
+ public CustomCircleImageView( Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public CustomCircleImageView( Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomCircleImageView, defStyle, 0);
+
+ mBorderWidth = a.getDimensionPixelSize(R.styleable.CustomCircleImageView_civ_border_width, DEFAULT_BORDER_WIDTH);
+ mBorderColor = a.getColor(R.styleable.CustomCircleImageView_civ_border_color, DEFAULT_BORDER_COLOR);
+ mBorderOverlay = a.getBoolean(R.styleable.CustomCircleImageView_civ_border_overlay, DEFAULT_BORDER_OVERLAY);
+ mFillColor = a.getColor(R.styleable.CustomCircleImageView_civ_fill_color, DEFAULT_FILL_COLOR);
+
+ a.recycle();
+
+ init();
+ }
+
+ private void init() {
+ super.setScaleType(SCALE_TYPE);
+ mReady = true;
+
+ if (mSetupPending) {
+ setup();
+ mSetupPending = false;
+ }
+ }
+
+ @Override
+ public ScaleType getScaleType() {
+ return SCALE_TYPE;
+ }
+
+ @Override
+ public void setScaleType(ScaleType scaleType) {
+ if (scaleType != SCALE_TYPE) {
+ throw new IllegalArgumentException(String.format("ScaleType %s not supported.", scaleType));
+ }
+ }
+
+ @Override
+ public void setAdjustViewBounds(boolean adjustViewBounds) {
+ if (adjustViewBounds) {
+ throw new IllegalArgumentException("adjustViewBounds not supported.");
+ }
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ if (mBitmap == null) {
+ return;
+ }
+
+ if (mFillColor != Color.TRANSPARENT) {
+ canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mDrawableRadius, mFillPaint);
+ }
+ canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mDrawableRadius, mBitmapPaint);
+ if (mBorderWidth != 0) {
+ canvas.drawCircle(getWidth() / 2.0f, getHeight() / 2.0f, mBorderRadius, mBorderPaint);
+ }
+ }
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ super.onSizeChanged(w, h, oldw, oldh);
+ setup();
+ }
+
+ public int getBorderColor() {
+ return mBorderColor;
+ }
+
+ public void setBorderColor(@ColorInt int borderColor) {
+ if (borderColor == mBorderColor) {
+ return;
+ }
+
+ mBorderColor = borderColor;
+ mBorderPaint.setColor(mBorderColor);
+ invalidate();
+ }
+
+ public void setBorderColorResource(@ColorRes int borderColorRes) {
+ setBorderColor(getContext().getResources().getColor(borderColorRes));
+ }
+
+ public int getFillColor() {
+ return mFillColor;
+ }
+
+ public void setFillColor(@ColorInt int fillColor) {
+ if (fillColor == mFillColor) {
+ return;
+ }
+
+ mFillColor = fillColor;
+ mFillPaint.setColor(fillColor);
+ invalidate();
+ }
+
+ public void setFillColorResource(@ColorRes int fillColorRes) {
+ setFillColor(getContext().getResources().getColor(fillColorRes));
+ }
+
+ public int getBorderWidth() {
+ return mBorderWidth;
+ }
+
+ public void setBorderWidth(int borderWidth) {
+ if (borderWidth == mBorderWidth) {
+ return;
+ }
+
+ mBorderWidth = borderWidth;
+ setup();
+ }
+
+ public boolean isBorderOverlay() {
+ return mBorderOverlay;
+ }
+
+ public void setBorderOverlay(boolean borderOverlay) {
+ if (borderOverlay == mBorderOverlay) {
+ return;
+ }
+
+ mBorderOverlay = borderOverlay;
+ setup();
+ }
+
+ @Override
+ public void setImageBitmap(Bitmap bm) {
+ super.setImageBitmap(bm);
+ mBitmap = bm;
+ setup();
+ }
+
+ @Override
+ public void setImageDrawable(Drawable drawable) {
+ super.setImageDrawable(drawable);
+ mBitmap = getBitmapFromDrawable(drawable);
+ setup();
+ }
+
+ @Override
+ public void setImageResource(@DrawableRes int resId) {
+ super.setImageResource(resId);
+ mBitmap = getBitmapFromDrawable(getDrawable());
+ setup();
+ }
+
+ @Override
+ public void setImageURI(Uri uri) {
+ super.setImageURI(uri);
+ mBitmap = uri != null ? getBitmapFromDrawable(getDrawable()) : null;
+ setup();
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter cf) {
+ if (cf == mColorFilter) {
+ return;
+ }
+
+ mColorFilter = cf;
+ mBitmapPaint.setColorFilter(mColorFilter);
+ invalidate();
+ }
+
+ private Bitmap getBitmapFromDrawable(Drawable drawable) {
+ if (drawable == null) {
+ return null;
+ }
+
+ if (drawable instanceof BitmapDrawable) {
+ return ((BitmapDrawable) drawable).getBitmap();
+ }
+
+ try {
+ Bitmap bitmap;
+
+ if (drawable instanceof ColorDrawable) {
+ bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG);
+ } else {
+ bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), BITMAP_CONFIG);
+ }
+
+ Canvas canvas = new Canvas(bitmap);
+ drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
+ drawable.draw(canvas);
+ return bitmap;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ private void setup() {
+ if (!mReady) {
+ mSetupPending = true;
+ return;
+ }
+
+ if (getWidth() == 0 && getHeight() == 0) {
+ return;
+ }
+
+ if (mBitmap == null) {
+ invalidate();
+ return;
+ }
+
+ mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
+
+ mBitmapPaint.setAntiAlias(true);
+ mBitmapPaint.setShader(mBitmapShader);
+
+ mBorderPaint.setStyle(Paint.Style.STROKE);
+ mBorderPaint.setAntiAlias(true);
+ mBorderPaint.setColor(mBorderColor);
+ mBorderPaint.setStrokeWidth(mBorderWidth);
+
+ mFillPaint.setStyle(Paint.Style.FILL);
+ mFillPaint.setAntiAlias(true);
+ mFillPaint.setColor(mFillColor);
+
+ mBitmapHeight = mBitmap.getHeight();
+ mBitmapWidth = mBitmap.getWidth();
+
+ mBorderRect.set(0, 0, getWidth(), getHeight());
+ mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2.0f, (mBorderRect.width() - mBorderWidth) / 2.0f);
+
+ mDrawableRect.set(mBorderRect);
+ if (!mBorderOverlay) {
+ mDrawableRect.inset(mBorderWidth, mBorderWidth);
+ }
+ mDrawableRadius = Math.min(mDrawableRect.height() / 2.0f, mDrawableRect.width() / 2.0f);
+
+ updateShaderMatrix();
+ invalidate();
+ }
+
+ private void updateShaderMatrix() {
+ float scale;
+ float dx = 0;
+ float dy = 0;
+
+ mShaderMatrix.set(null);
+
+ if (mBitmapWidth * mDrawableRect.height() > mDrawableRect.width() * mBitmapHeight) {
+ scale = mDrawableRect.height() / (float) mBitmapHeight;
+ dx = (mDrawableRect.width() - mBitmapWidth * scale) * 0.5f;
+ } else {
+ scale = mDrawableRect.width() / (float) mBitmapWidth;
+ dy = (mDrawableRect.height() - mBitmapHeight * scale) * 0.5f;
+ }
+
+ mShaderMatrix.setScale(scale, scale);
+ mShaderMatrix.postTranslate((int) (dx + 0.5f) + mDrawableRect.left, (int) (dy + 0.5f) + mDrawableRect.top);
+
+ mBitmapShader.setLocalMatrix(mShaderMatrix);
+ }
+
+}
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/IWindowManagerView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/IWindowManagerView.java
index 14891ed7d6..cab1b77605 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/IWindowManagerView.java
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/IWindowManagerView.java
@@ -33,6 +33,6 @@ interface IWindowManagerView {
void hide();
interface OnViewClickListener {
- void onClick( View view );
+ void onClick( View view, float xPos, float yPos );
}
}
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/WindowManagerImpl.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/WindowManagerImpl.java
index d4314d4106..d810e6033f 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/WindowManagerImpl.java
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/WindowManagerImpl.java
@@ -64,7 +64,10 @@ class WindowManagerImpl implements IWindowManagerView {
// 只要按钮一动位置不是很大,就认为是点击事件
if ( Math.abs( mOldOffsetX - newOffsetX ) <= 20
&& Math.abs( mOldOffsetY - newOffsetY ) <= 20 ) {
- listener.onClick( mParams.mContentView );
+ if ( listener != null ) {
+ listener.onClick( mParams.mContentView, x, y );
+ }
+ return false;
}
mOldOffsetX = newOffsetX;
mOldOffsetY = newOffsetY;
diff --git a/modules/mogo-module-common/src/main/res/drawable-ldpi/module_common_default_user_head.png b/modules/mogo-module-common/src/main/res/drawable-ldpi/module_common_default_user_head.png
new file mode 100644
index 0000000000..726124020a
Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-ldpi/module_common_default_user_head.png differ
diff --git a/modules/mogo-module-common/src/main/res/drawable-mdpi/module_common_default_user_head.png b/modules/mogo-module-common/src/main/res/drawable-mdpi/module_common_default_user_head.png
new file mode 100644
index 0000000000..726124020a
Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-mdpi/module_common_default_user_head.png differ
diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_default_user_head.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_default_user_head.png
new file mode 100644
index 0000000000..baa717be4d
Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_common_default_user_head.png differ
diff --git a/modules/mogo-module-common/src/main/res/drawable/module_common_default_user_head.png b/modules/mogo-module-common/src/main/res/drawable/module_common_default_user_head.png
new file mode 100644
index 0000000000..726124020a
Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable/module_common_default_user_head.png differ
diff --git a/modules/mogo-module-common/src/main/res/values/attr.xml b/modules/mogo-module-common/src/main/res/values/attr.xml
index 7310089318..2bb191d2d9 100644
--- a/modules/mogo-module-common/src/main/res/values/attr.xml
+++ b/modules/mogo-module-common/src/main/res/values/attr.xml
@@ -6,4 +6,11 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsPresenter.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsPresenter.java
index 11aa6dee90..8a26258914 100644
--- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsPresenter.java
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsPresenter.java
@@ -8,6 +8,7 @@ import androidx.lifecycle.LifecycleOwner;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.network.Utils;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.extensions.net.UserInfoNetApiServices;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.extensions.userinfo.UserInfoConstant;
@@ -53,8 +54,7 @@ public class ExtensionsPresenter extends Presenter< ExtensionsView > implements
public ExtensionsPresenter( ExtensionsView view ) {
super( view );
mWeatherModel = new WeatherModel( getContext() );
- mNetWork =
- ((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi();
+ mNetWork = MogoApisHandler.getInstance().getApis().getNetworkApi();
}
@Override
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
index d1f640ec5a..e310869dfa 100644
--- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
@@ -32,6 +32,7 @@ import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.dialog.WMDialog;
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
import com.mogo.module.common.map.CustomNaviInterrupter;
@@ -45,7 +46,6 @@ import com.mogo.module.extensions.utils.EntranceViewHolder;
import com.mogo.module.extensions.utils.TopViewAnimHelper;
import com.mogo.module.share.manager.ServiceApisManager;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.MogoServicePaths;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.fragmentmanager.IFragmentProvider;
@@ -135,6 +135,8 @@ public class EntranceFragment extends MvpFragment {
+ MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().showPanel();
+ Map properties = new HashMap<>();
+ properties.put( "type", 1 );
+ MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "APP_Find_Mogoer", properties );
+ } );
+
dealWeatherContainer();
debugTopView();
@@ -429,6 +439,11 @@ public class EntranceFragment extends MvpFragment());
+ if ( DebugConfig.isSupportedSearchDestinationOnlineCarList() ) {
+ mOnlineCarEntrance.setVisibility( View.VISIBLE );
+ } else {
+ mOnlineCarEntrance.setVisibility( View.GONE );
+ }
}
@Override
@@ -438,6 +453,7 @@ public class EntranceFragment extends MvpFragment implements Weathe
public EntrancePresenter(Context context, EntranceView view) {
super(view);
mWeatherModel = new WeatherModel( getContext() );
- mNetWork =
- ((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi();
+ mNetWork = MogoApisHandler.getInstance().getApis().getNetworkApi();
}
@Override
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_destination_online_car_dw.png b/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_destination_online_car_dw.png
new file mode 100644
index 0000000000..36a731a814
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-ldpi/module_ext_destination_online_car_dw.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-mdpi/module_ext_destination_online_car_dw.png b/modules/mogo-module-extensions/src/main/res/drawable-mdpi/module_ext_destination_online_car_dw.png
new file mode 100644
index 0000000000..36a731a814
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-mdpi/module_ext_destination_online_car_dw.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi-1920x1000/module_ext_destination_online_car_dw.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi-1920x1000/module_ext_destination_online_car_dw.png
new file mode 100644
index 0000000000..fcfe56f4f4
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi-1920x1000/module_ext_destination_online_car_dw.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_ext_destination_online_car_dw.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_ext_destination_online_car_dw.png
new file mode 100644
index 0000000000..fcfe56f4f4
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_ext_destination_online_car_dw.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml
index 68db42363e..fc9358f174 100644
--- a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml
+++ b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml
@@ -36,6 +36,30 @@
app:layout_goneMarginTop="@dimen/module_ext_north_goneMarginTop"
tools:visibility="visible" />
+
+
+
+ tools:visibility="gone">
10px
2px
2px
+ 4px
+ 14px
+ 14px
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/res/values-xhdpi-1920x1000/dimens.xml b/modules/mogo-module-extensions/src/main/res/values-xhdpi-1920x1000/dimens.xml
index d34d1a739a..a30623fe52 100644
--- a/modules/mogo-module-extensions/src/main/res/values-xhdpi-1920x1000/dimens.xml
+++ b/modules/mogo-module-extensions/src/main/res/values-xhdpi-1920x1000/dimens.xml
@@ -150,4 +150,7 @@
30px
20px
20px
+ 8px
+ 21px
+ 31px
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml
index c06db31dd1..aa75703d09 100644
--- a/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml
+++ b/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml
@@ -152,4 +152,7 @@
30px
20px
20px
+ 8px
+ 21px
+ 31px
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/res/values/dimens.xml b/modules/mogo-module-extensions/src/main/res/values/dimens.xml
index 37328f34fd..8d6484ba10 100644
--- a/modules/mogo-module-extensions/src/main/res/values/dimens.xml
+++ b/modules/mogo-module-extensions/src/main/res/values/dimens.xml
@@ -157,4 +157,7 @@
10px
2px
2px
+ 4px
+ 14px
+ 14px
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/res/values/strings.xml b/modules/mogo-module-extensions/src/main/res/values/strings.xml
index def8fbcd0e..48600136b3 100644
--- a/modules/mogo-module-extensions/src/main/res/values/strings.xml
+++ b/modules/mogo-module-extensions/src/main/res/values/strings.xml
@@ -22,6 +22,7 @@
退出全览
车头
正北
+ 目的地车友
- 你好小智,播放音乐
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
index 85a097bb79..a7c0f71916 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
@@ -19,6 +19,7 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.map.MapCenterPointStrategy;
import com.mogo.module.common.map.Scene;
import com.mogo.module.main.cards.MogoModulesManager;
@@ -135,7 +136,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
private void init() {
if ( mServiceApis == null ) {
- mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
+ mServiceApis = MogoApisHandler.getInstance().getApis();
}
mServiceApis.getShareManager().resetContext( this );
mServiceApis.getAuthManagerApi().showAuth( this );
@@ -189,6 +190,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mMogoFragmentManager = mServiceApis.getFragmentManagerApi();
mMogoFragmentManager.init( this, R.id.module_main_id_search_fragment );
mMogoFragmentManager.initMessageHistoryContainerId( R.id.module_main_id_message_history_fragment_container );
+ mServiceApis.getOnlineCarPanelApi().initContainer( R.id.module_main_id_message_history_fragment_container, this );
mMogoFragmentManager.registerMainFragmentStackTransactionListener( ( size ) -> {
if ( size == 0 ) {
showLayout();
@@ -332,7 +334,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
@Override
public IMogoServiceApis getApis() {
if ( mServiceApis == null ) {
- mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
+ mServiceApis = MogoApisHandler.getInstance().getApis();
}
return mServiceApis;
}
@@ -350,5 +352,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
Logger.d( TAG, "destroy." );
mServiceApis.getRefreshStrategyControllerApi().clearAllData();
AIAssist.getInstance( this ).release();
+ mServiceApis.getOnlineCarPanelApi().clear();
}
}
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/SchemeIntent.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/SchemeIntent.java
index d8e6e15f60..c6199eac00 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/SchemeIntent.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/SchemeIntent.java
@@ -41,6 +41,8 @@ public class SchemeIntent implements IMogoStatusChangedListener {
public static final String TYPE_LAUNCH = "launch";
+ public static final String TYPE_SHOW_ONLINE_CAR_PANEL = "showOnlineCarPanel";
+
private IMogoServiceApis mApis;
private Context mContext;
@@ -125,21 +127,23 @@ public class SchemeIntent implements IMogoStatusChangedListener {
handleLaunchIntent( target );
break;
case TYPE_SEARCH_ROAD_CONDITION:
- handleSearchRoadCondition(target);
+ handleSearchRoadCondition( target );
break;
+ case TYPE_SHOW_ONLINE_CAR_PANEL:
+ handleShowOnlineCarPanel( target );
default:
break;
}
}
- private void handleSearchRoadCondition(Uri target) {
- if (mApis == null) {
+ private void handleSearchRoadCondition( Uri target ) {
+ if ( mApis == null ) {
return;
}
- mApis.getTanluUiApi().searchRoadCondition(target.getQueryParameter("intentStr"),
- target.getQueryParameter("data"), target.getQueryParameter("city"),
- target.getQueryParameter("keywords"));
+ mApis.getTanluUiApi().searchRoadCondition( target.getQueryParameter( "intentStr" ),
+ target.getQueryParameter( "data" ), target.getQueryParameter( "city" ),
+ target.getQueryParameter( "keywords" ) );
}
private void handleSwitchCardIntent( String type ) {
@@ -153,8 +157,6 @@ public class SchemeIntent implements IMogoStatusChangedListener {
String lon = naviUri.getQueryParameter( "lon" );
String lat = naviUri.getQueryParameter( "lat" );
- // TODO: 2020-04-20 补充场景
-
try {
double dlon = Double.valueOf( lon );
double dlat = Double.valueOf( lat );
@@ -178,6 +180,10 @@ public class SchemeIntent implements IMogoStatusChangedListener {
mApis.getAnalyticsApi().track( "appenterfront", properties );
}
+ private void handleShowOnlineCarPanel( Uri uri ) {
+ mApis.getOnlineCarPanelApi().showPanel();
+ }
+
@Override
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
if ( descriptor == StatusDescriptor.MAIN_PAGE_RESUME ) {
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/service/MogoMainService.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/service/MogoMainService.java
index b7c220f00b..149ffad5e7 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/service/MogoMainService.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/service/MogoMainService.java
@@ -7,15 +7,14 @@ import android.os.IBinder;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.facade.annotation.Route;
-import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.main.EventDispatchCenter;
import com.mogo.module.main.cards.MogoModulesManager;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.MogoServicePaths;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
@@ -26,7 +25,7 @@ public
*
* 描述
*/
-@Route(path = "/service/base/info")
+@Route( path = "/service/base/info" )
class MogoMainService extends Service implements IMogoLocationListener {
private static final String TAG = "MogoMainService";
@@ -39,10 +38,10 @@ class MogoMainService extends Service implements IMogoLocationListener {
@Override
public void onCreate() {
- Logger.d(TAG, "基本服务启动");
- mServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation();
+ Logger.d( TAG, "基本服务启动" );
+ mServiceApis = MogoApisHandler.getInstance().getApis();
initAndStartLocation();
- UiThreadHandler.postDelayed(() -> {
+ UiThreadHandler.postDelayed( () -> {
loadBaseModules();
startTanluService();
initADAS();
@@ -53,53 +52,53 @@ class MogoMainService extends Service implements IMogoLocationListener {
@Nullable
@Override
- public IBinder onBind(Intent intent) {
+ public IBinder onBind( Intent intent ) {
return null;
}
@Override
- public int onStartCommand(Intent intent, int flags, int startId) {
+ public int onStartCommand( Intent intent, int flags, int startId ) {
return START_STICKY;
}
private void initAndStartLocation() {
- Logger.d(TAG, "开始定位");
- mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp());
- mLocationClient.addLocationListener(this);
- mLocationClient.start(2_000L);
+ Logger.d( TAG, "开始定位" );
+ mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() );
+ mLocationClient.addLocationListener( this );
+ mLocationClient.start( 2_000L );
}
private void initGpsSimulatorListener() {
- mServiceApis.getMapServiceApi().getNavi(this).registerCarLocationChangedListener(EventDispatchCenter.getInstance());
+ mServiceApis.getMapServiceApi().getNavi( this ).registerCarLocationChangedListener( EventDispatchCenter.getInstance() );
}
private void loadBaseModules() {
- Logger.d(TAG, "加载基本模块");
+ Logger.d( TAG, "加载基本模块" );
MogoModulesManager.getInstance().loadBaseModule();
}
private void startTanluService() {
- UiThreadHandler.postDelayed(() -> {
- Logger.d(TAG, "startTanluService ---------- ");
+ UiThreadHandler.postDelayed( () -> {
+ Logger.d( TAG, "startTanluService ---------- " );
mServiceApis.getTanluApi().startTanluService();
}, 2_000L
);
}
private void initADAS() {
- mServiceApis.getAdasControllerApi().init(AbsMogoApplication.getApp());
+ mServiceApis.getAdasControllerApi().init( AbsMogoApplication.getApp() );
}
@Override
- public void onLocationChanged(MogoLocation location) {
- EventDispatchCenter.getInstance().onLocationChanged(location);
+ public void onLocationChanged( MogoLocation location ) {
+ EventDispatchCenter.getInstance().onLocationChanged( location );
}
@Override
public void onDestroy() {
super.onDestroy();
- if (mLocationClient != null) {
- mLocationClient.removeLocationListener(this);
+ if ( mLocationClient != null ) {
+ mLocationClient.removeLocationListener( this );
mLocationClient.stop();
mLocationClient.destroy();
mLocationClient = null;
diff --git a/modules/mogo-module-main/src/main/res/values/dimens.xml b/modules/mogo-module-main/src/main/res/values/dimens.xml
index 3cf1f1ee39..d27dfc19e4 100644
--- a/modules/mogo-module-main/src/main/res/values/dimens.xml
+++ b/modules/mogo-module-main/src/main/res/values/dimens.xml
@@ -26,6 +26,6 @@
16px
658px
8px
- 10px
+ 2px
\ No newline at end of file
diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java
index 8eef0ad064..8b8dac214a 100644
--- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java
+++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapBroadCastHelper.java
@@ -4,11 +4,10 @@ import android.content.Context;
import android.content.Intent;
import android.util.Log;
-import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.map.navi.MogoNaviInfo;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.map.CustomNaviInterrupter;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.MogoServicePaths;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.AppUtils;
@@ -31,7 +30,7 @@ public class MapBroadCastHelper implements IMogoStatusChangedListener {
private MapBroadCastHelper( Context context ) {
this.mContext = context;
- IMogoServiceApis api = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( context );
+ IMogoServiceApis api = MogoApisHandler.getInstance().getApis();
api.getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.AI_ASSIST_READY, this );
}
diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java
index f0316ac8e9..f96ca3c162 100644
--- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java
+++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java
@@ -9,7 +9,6 @@ import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
-import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
@@ -21,9 +20,9 @@ import com.mogo.map.navi.MogoNaviConfig;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.MapControlResult;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.map.CustomNaviInterrupter;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.MogoServicePaths;
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.intent.IMogoIntentManager;
@@ -248,7 +247,7 @@ public class MapPresenter extends Presenter< MapView > implements
public void onCreate( @NonNull LifecycleOwner owner ) {
super.onCreate( owner );
- mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
+ mApis = MogoApisHandler.getInstance().getApis();
mMogoMapService = mApis.getMapServiceApi();
mMogoIntentManager = mApis.getIntentManagerApi();
mSearchManager = mApis.getSearchManagerApi();
diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java
index 60810062c4..6d40bafb55 100644
--- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java
+++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/KwPresenter.java
@@ -5,13 +5,12 @@ import android.os.Handler;
import android.os.Message;
import android.util.Log;
-import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.media.MediaConstants;
import com.mogo.module.media.constants.MusicConstant;
import com.mogo.module.media.model.MediaInfoData;
import com.mogo.module.media.view.IMusicView;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.MogoServicePaths;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
@@ -108,8 +107,7 @@ public class KwPresenter extends BaseMediaPresenter {
}
});
- IMogoServiceApis serviceApis =
- (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
+ IMogoServiceApis serviceApis = MogoApisHandler.getInstance().getApis();
serviceApis.getStatusManagerApi().registerStatusChangedListener(MediaConstants.MODULE_TYPE, StatusDescriptor.MAIN_PAGE_RESUME, new IMogoStatusChangedListener() {
@Override
diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java
index 4aa6dd259c..570964a4b2 100644
--- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java
+++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/presenter/WeCarFlowPresenter.java
@@ -2,16 +2,12 @@ package com.mogo.module.media.presenter;
import android.content.Context;
-import androidx.annotation.NonNull;
-import androidx.lifecycle.LifecycleOwner;
-
-import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.media.MediaConstants;
import com.mogo.module.media.constants.MusicConstant;
import com.mogo.module.media.model.MediaInfoData;
import com.mogo.module.media.view.IMusicView;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.MogoServicePaths;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.logger.Logger;
@@ -77,8 +73,7 @@ public class WeCarFlowPresenter extends BaseMediaPresenter {
this.context = context;
currentMedia = new MediaInfoData();
- serviceApis =
- (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
+ serviceApis = MogoApisHandler.getInstance().getApis();
serviceApis.getStatusManagerApi().registerStatusChangedListener(MediaConstants.MODULE_TYPE, StatusDescriptor.MAIN_PAGE_RESUME, new IMogoStatusChangedListener() {
@Override
diff --git a/modules/mogo-module-monitor/src/main/java/com/zhidao/mogo/module/monitor/MogoMonitorProvider.java b/modules/mogo-module-monitor/src/main/java/com/zhidao/mogo/module/monitor/MogoMonitorProvider.java
index 133fd25bd5..4f1c08f5aa 100644
--- a/modules/mogo-module-monitor/src/main/java/com/zhidao/mogo/module/monitor/MogoMonitorProvider.java
+++ b/modules/mogo-module-monitor/src/main/java/com/zhidao/mogo/module/monitor/MogoMonitorProvider.java
@@ -8,10 +8,9 @@ import android.os.Message;
import android.widget.Toast;
import com.alibaba.android.arouter.facade.annotation.Route;
-import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.MogoServicePaths;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.service.monitor.IMogoMonitorProvider;
import com.mogo.utils.logger.LogLevel;
@@ -49,8 +48,7 @@ public class MogoMonitorProvider implements IMogoMonitorProvider,
@Override
public void init(Context context) {
this.context = context;
- IMogoServiceApis apis =
- (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
+ IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
apis.getSocketManagerApi(context).registerOnMessageListener(MogoMonitorConst.LOG_PUSH_TYPE, this);
startRemoteCtrl();
}
diff --git a/modules/mogo-module-push/src/main/java/com/mogo/module/push/PushHistoryUiProvider.java b/modules/mogo-module-push/src/main/java/com/mogo/module/push/PushHistoryUiProvider.java
index dd389a6bdb..b2f7ac35cd 100644
--- a/modules/mogo-module-push/src/main/java/com/mogo/module/push/PushHistoryUiProvider.java
+++ b/modules/mogo-module-push/src/main/java/com/mogo/module/push/PushHistoryUiProvider.java
@@ -26,7 +26,7 @@ class PushHistoryUiProvider implements IFragmentProvider {
Fragment fragment = new MessageHistoryFragment();
activity.getSupportFragmentManager()
.beginTransaction()
- .add( containerId, fragment, PushUIConstants.Push_MESSAGE_ACTIVITY_PATH )
+ .replace( containerId, fragment, PushUIConstants.Push_MESSAGE_ACTIVITY_PATH )
.show( fragment )
.commitNowAllowingStateLoss();
return fragment;
diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/constants/SearchApisHolder.java b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/constants/SearchApisHolder.java
index 1062a25fe7..6584886e78 100644
--- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/constants/SearchApisHolder.java
+++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/constants/SearchApisHolder.java
@@ -6,6 +6,7 @@ import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.uicontroller.IMogoMapUIController;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.gps.simulator.IMogoGpsSimulatorManager;
import com.mogo.module.navi.cp.PersonalInfoManagerImpl;
import com.mogo.service.IMogoServiceApis;
@@ -34,15 +35,9 @@ public class SearchApisHolder {
private static PersonalInfoManagerImpl mPersonalInfoManager;
- static {
- Logger.d( TAG, "static block init." );
- sApis = ARouter.getInstance().navigation( IMogoServiceApis.class );
- sGpsSimulatorManager = ARouter.getInstance().navigation( IMogoGpsSimulatorManager.class );
- }
-
public static IMogoServiceApis getApis() {
if ( sApis == null ) {
- sApis = ARouter.getInstance().navigation( IMogoServiceApis.class );
+ sApis = MogoApisHandler.getInstance().getApis();
}
return sApis;
}
diff --git a/modules/mogo-module-service/build.gradle b/modules/mogo-module-service/build.gradle
index 01bf8f3eaa..ed661cc3b0 100644
--- a/modules/mogo-module-service/build.gradle
+++ b/modules/mogo-module-service/build.gradle
@@ -35,6 +35,10 @@ android {
targetCompatibility 1.8
}
+ lintOptions {
+ abortOnError false
+ }
+
}
dependencies {
@@ -47,6 +51,7 @@ dependencies {
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.carcallprovider
+ implementation rootProject.ext.dependencies.androidxrecyclerview
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogomap
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java
index caaf67dd12..0e34398d47 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java
@@ -9,12 +9,12 @@ import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.carchattingprovider.ICarsChattingProvider;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.gps.simulator.IMogoGpsSimulatorManager;
import com.mogo.module.service.marker.MapMarkerManager;
import com.mogo.service.IMogoServiceApis;
-import com.mogo.service.MogoServicePaths;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.cardmanager.IMogoCardManager;
@@ -69,7 +69,7 @@ public class MarkerServiceHandler {
return;
}
- sApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( context );
+ sApis = MogoApisHandler.getInstance().getApis();
sMapService = sApis.getMapServiceApi();
sImageloader = sApis.getImageLoaderApi();
sMogoStatusManager = sApis.getStatusManagerApi();
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java
index 37d8c41c8d..27ab6142e5 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java
@@ -15,6 +15,9 @@ import android.view.MotionEvent;
import androidx.annotation.NonNull;
import com.mogo.commons.debug.DebugConfig;
+import com.mogo.commons.network.ParamsProvider;
+import com.mogo.commons.network.SubscribeImpl;
+import com.mogo.commons.storage.SpStorage;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.map.MogoLatLng;
@@ -38,6 +41,9 @@ import com.mogo.module.service.launchercard.LauncherCardRefresher;
import com.mogo.module.service.marker.MapMarkerManager;
import com.mogo.module.service.network.RefreshCallback;
import com.mogo.module.service.network.RefreshModel;
+import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushData;
+import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse;
+import com.mogo.module.service.onlinecar.panel.NavigationTargetInfo;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.service.refresh.AutoRefreshStrategy;
import com.mogo.module.service.refresh.CustomRefreshStrategy;
@@ -60,10 +66,16 @@ import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
+import com.mogo.utils.network.RequestOptions;
+import com.mogo.utils.network.utils.GsonUtil;
import org.json.JSONObject;
import java.util.List;
+import java.util.Map;
+
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
/**
* @author congtaowang
@@ -243,7 +255,7 @@ public class MogoServices implements IMogoMapListener,
/**
* 自动刷新回调
*/
- private RefreshCallback mAutoRefreshCallback = new RefreshCallback() {
+ private RefreshCallback mAutoRefreshCallback = new RefreshCallback< MarkerResponse >() {
@Override
public void onSuccess( MarkerResponse o ) {
MapMarkerManager.getInstance().onSyncMarkerResponse( o );
@@ -390,6 +402,7 @@ public class MogoServices implements IMogoMapListener,
mIntentManager.registerIntentListener( MogoReceiver.ACTION_AUTO_NAVI_RECEIVER, this );
mIntentManager.registerIntentListener( MogoReceiver.ACTION_AUTO_NAVI_SEND, this );
mIntentManager.registerIntentListener( MogoReceiver.ACTION_MOGO, this );
+ mIntentManager.registerIntentListener( ServiceConst.COMMAND_ONLINE_CAR_PANEL, this );
mADASController = MarkerServiceHandler.getADASController();
mLauncher = MarkerServiceHandler.getLauncher();
@@ -484,7 +497,7 @@ public class MogoServices implements IMogoMapListener,
filter.addAction( MogoReceiver.ACTION_AUTO_NAVI_RECEIVER );
filter.addAction( MogoReceiver.ACTION_AUTO_NAVI_SEND );
filter.addAction( MogoReceiver.ACTION_MOGO );
- filter.addAction(MogoReceiver.ACTION_TXZ_BLOCK_SEARCH);
+ filter.addAction( MogoReceiver.ACTION_TXZ_BLOCK_SEARCH );
try {
context.getApplicationContext().registerReceiver( mAIAssistReceiver, filter );
Logger.i( TAG, "register voice receiver." );
@@ -842,6 +855,7 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onIntentReceived( String command, Intent intent ) {
+
if ( ServiceConst.COMMAND_NEXT.equals( command ) ) {
onActionDone( MogoAction.Next );
} else if ( ServiceConst.COMMAND_PREVIOUS.equals( command ) ) {
@@ -925,4 +939,48 @@ public class MogoServices implements IMogoMapListener,
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this );
}
}
+
+ @Override
+ public void onStartNavi() {
+ String json = SpStorage.getNavigationTarget();
+ if ( !TextUtils.isEmpty( json ) ) {
+ try {
+ NavigationTargetInfo info = GsonUtil.objectFromJson( json, NavigationTargetInfo.class );
+
+ Logger.d( TAG, "info = %s", info );
+
+ HomeCompanyDistanceForPushData data = new HomeCompanyDistanceForPushData();
+ data.lat = Double.valueOf( info.getToPoiLatitude() );
+ data.lon = Double.valueOf( info.getToPoiLongitude() );
+
+ final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
+ query.put( "data", GsonUtil.jsonFromObject( data ) );
+ mRefreshModel.getRefreshApiService().calculationNotHomeCompanyDistanceForPush( query )
+ .subscribeOn( Schedulers.io() )
+ .observeOn( AndroidSchedulers.mainThread() )
+ .subscribe( new SubscribeImpl< HomeCompanyDistanceForPushResponse >( RequestOptions.create( mContext ) ) {
+ @Override
+ public void onSuccess( HomeCompanyDistanceForPushResponse o ) {
+ super.onSuccess( o );
+ if ( o != null && o.result != null ) {
+ Logger.d( TAG, "calculationNotHomeCompanyDistanceForPush result %s", o.result.pushFlag );
+ }
+ }
+
+ @Override
+ public void onError( Throwable e ) {
+ super.onError( e );
+ }
+
+ @Override
+ public void onError( String message, int code ) {
+ super.onError( message, code );
+ }
+ } );
+ } catch ( Exception e ) {
+ Logger.e( TAG, e, "onStartNavi" );
+ }
+
+ }
+ }
}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java
index b07aad4f99..8fccd82812 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java
@@ -108,7 +108,6 @@ public class ServiceConst {
public static final int MSG_REQUEST_DATA = 0x201;
/**
- *
* 锁车消息
*/
public static final int MSG_LOCK_CAR = 0x202;
@@ -159,7 +158,7 @@ public class ServiceConst {
};
public static final String CMD_BACK = "back";
- public static final String[] CMD_BACK_WORDS = new String[]{"关闭", "返回"};
+ public static final String[] CMD_BACK_WORDS = new String[]{"关闭", "返回"};
/**
@@ -203,4 +202,10 @@ public class ServiceConst {
public static final int ONLINE_SEARCH_LIMIT = 20;
public static final int ONLINE_SEARCH_RADIUS = 2_000;
+
+ /**
+ * 查找目的地车友
+ */
+ public static final String COMMAND_ONLINE_CAR_PANEL = "com.zhidao.search.riders";
+
}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java
index 1f9939807f..0124379b5d 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java
@@ -38,6 +38,7 @@ public class IntentHandlerFactory {
mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() );
mHandlers.put( ServiceConst.COMMAND_BACK, WholeVoiceCommandIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTION_MOGO, new MogoControllerIntentHandler() );
+ mHandlers.put( ServiceConst.COMMAND_ONLINE_CAR_PANEL, new OnlineCarPanelIntentHandler() );
}
private static final class InstanceHolder {
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/OnlineCarPanelIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/OnlineCarPanelIntentHandler.java
new file mode 100644
index 0000000000..e48297bf71
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/OnlineCarPanelIntentHandler.java
@@ -0,0 +1,29 @@
+package com.mogo.module.service.intent;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+import com.mogo.module.service.MarkerServiceHandler;
+
+public
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+class OnlineCarPanelIntentHandler implements IntentHandler {
+
+ @Override
+ public void handle( Context context, Intent intent ) {
+ if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
+ MarkerServiceHandler.getApis().getOnlineCarPanelApi().showPanel();
+ } else {
+ Intent start = new Intent( Intent.ACTION_VIEW );
+ start.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
+ start.setData( Uri.parse( "mogo://launcher/main/switch2?type=showOnlineCarPanel" ) );
+ context.startActivity( start );
+ }
+ }
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java
index 73fe2a4801..17a0c4a293 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/launchercard/LauncherCardRefresher.java
@@ -243,7 +243,7 @@ class LauncherCardRefresher {
}
private void handleRefreshExplorerWayOrOnlineCarData( MogoLatLng latLng, LauncherCardRefreshType type ) {
- mRefreshModel.refreshDataSync( latLng,
+ mRefreshModel.refreshLauncherCardDataSync( latLng,
mRefreshStrategy.getRadius(),
mRefreshStrategy.getLimit(),
new RefreshCallback< MarkerResponse >() {
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshApiService.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshApiService.java
index 8f58de2d68..3076af4be6 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshApiService.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshApiService.java
@@ -3,6 +3,7 @@ package com.mogo.module.service.network;
import com.mogo.commons.data.BaseData;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.service.network.bean.DemoUserInfoEntity;
+import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse;
import java.util.Map;
@@ -37,4 +38,8 @@ public interface RefreshApiService {
*/
@GET( "/yycp-launcherSnapshot/mock/getMockUserInfos" )
Observable< DemoUserInfoEntity > getMockUsers();
+
+ @FormUrlEncoded
+ @POST("/yycp-travel-condition/trajectoryPrediction/calculationNotHomeCompanyDistanceForPush")
+ Observable< HomeCompanyDistanceForPushResponse > calculationNotHomeCompanyDistanceForPush( @FieldMap Map< String, Object > parameters);
}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java
index c368ec6956..16fc3e91a2 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java
@@ -65,51 +65,6 @@ public class RefreshModel {
}
}
- public void refreshData( MogoLatLng latLng, int radius, int limit, final RefreshCallback callback ) {
- if ( mRefreshApiService != null ) {
- final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
- final RefreshBody refreshBody = new RefreshBody();
- refreshBody.limit = limit;
- refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
- refreshBody.radius = radius;
- refreshBody.dataType.add( ServiceConst.CARD_TYPE_ROAD_CONDITION );
-
- String data = GsonUtil.jsonFromObject( refreshBody );
- query.put( "data", data );
- Logger.d( TAG, data );
-
-
- mRefreshApiService.refreshData( query )
- .subscribeOn( Schedulers.io() )
- .observeOn( AndroidSchedulers.mainThread() )
- .subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( mContext ) ) {
- @Override
- public void onSuccess( BaseData o ) {
- super.onSuccess( o );
- if ( callback != null ) {
- callback.onSuccess( o );
- }
- }
-
- @Override
- public void onError( Throwable e ) {
- super.onError( e );
- if ( callback != null ) {
- callback.onFail();
- }
- }
-
- @Override
- public void onError( String message, int code ) {
- super.onError( message, code );
- if ( callback != null ) {
- callback.onFail();
- }
- }
- } );
- }
- }
-
public void refreshExplorerWayData( MogoLatLng latLng, int radius, int limit, final RefreshCallback callback ) {
if ( mRefreshApiService != null ) {
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
@@ -155,7 +110,7 @@ public class RefreshModel {
}
}
- public void refreshDataSync( MogoLatLng latLng, int radius, int limit, final RefreshCallback callback ) {
+ public void refreshLauncherCardDataSync( MogoLatLng latLng, int radius, int limit, final RefreshCallback callback ) {
if ( mRefreshApiService != null ) {
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
final RefreshBody refreshBody = new RefreshBody();
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/bean/HomeCompanyDistanceForPushData.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/bean/HomeCompanyDistanceForPushData.java
new file mode 100644
index 0000000000..574627da0b
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/bean/HomeCompanyDistanceForPushData.java
@@ -0,0 +1,14 @@
+package com.mogo.module.service.network.bean;
+
+public
+/**
+ * @author congtaowang
+ * @since 2020/9/22
+ *
+ * 描述
+ */
+class HomeCompanyDistanceForPushData {
+
+ public double lon;
+ public double lat;
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/bean/HomeCompanyDistanceForPushResponse.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/bean/HomeCompanyDistanceForPushResponse.java
new file mode 100644
index 0000000000..c825712ef7
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/bean/HomeCompanyDistanceForPushResponse.java
@@ -0,0 +1,19 @@
+package com.mogo.module.service.network.bean;
+
+import com.mogo.commons.data.BaseData;
+
+public
+/**
+ * @author congtaowang
+ * @since 2020/9/22
+ *
+ * 描述
+ */
+class HomeCompanyDistanceForPushResponse extends BaseData {
+
+ public HomeCompanyDistanceForPushResult result;
+
+ public static class HomeCompanyDistanceForPushResult {
+ public boolean pushFlag;
+ }
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/ContainerHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/ContainerHandler.java
new file mode 100644
index 0000000000..b09def3289
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/ContainerHandler.java
@@ -0,0 +1,15 @@
+package com.mogo.module.service.onlinecar.panel;
+
+import androidx.fragment.app.FragmentActivity;
+
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+class ContainerHandler {
+
+ public static int sContainerId = 0;
+ public static FragmentActivity sAttachContext;
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/IOnlineCarPanelView.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/IOnlineCarPanelView.java
new file mode 100644
index 0000000000..749ef4d10a
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/IOnlineCarPanelView.java
@@ -0,0 +1,23 @@
+package com.mogo.module.service.onlinecar.panel;
+
+import com.mogo.commons.mvp.IView;
+import com.mogo.module.common.entity.MarkerOnlineCar;
+
+import java.util.List;
+
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+interface IOnlineCarPanelView extends IView {
+
+ void renderOnlineCarList( List< MarkerOnlineCar > onlineCars );
+
+ void renderEmptyUi( OnlineCarStrategy strategy );
+
+ void renderNoNavigationInfoUi();
+
+ void renderErrorUi();
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/NavigationTargetInfo.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/NavigationTargetInfo.java
new file mode 100644
index 0000000000..a8c5635cd9
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/NavigationTargetInfo.java
@@ -0,0 +1,85 @@
+package com.mogo.module.service.onlinecar.panel;
+
+public
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+class NavigationTargetInfo {
+
+
+ /**
+ * FromPoiName : 东城区小黄庄北街2号
+ * FromPoiAddr : 在中国银行(北京安贞桥支行)附近
+ * FromPoiLongitude : 116.41082763671875
+ * FromPoiLatitude : 39.96831130981445
+ * ToPoiName : 北京市北京市北小营镇宏大工业开发中心A座7号
+ * ToPoiLongitude : 116.74490356445312
+ * ToPoiLatitude : 40.19820785522461
+ */
+ private String FromPoiName;
+ private String FromPoiAddr;
+ private String FromPoiLongitude;
+ private String FromPoiLatitude;
+ private String ToPoiName;
+ private String ToPoiLongitude;
+ private String ToPoiLatitude;
+
+ public String getFromPoiName() {
+ return FromPoiName;
+ }
+
+ public void setFromPoiName( String FromPoiName ) {
+ this.FromPoiName = FromPoiName;
+ }
+
+ public String getFromPoiAddr() {
+ return FromPoiAddr;
+ }
+
+ public void setFromPoiAddr( String FromPoiAddr ) {
+ this.FromPoiAddr = FromPoiAddr;
+ }
+
+ public String getFromPoiLongitude() {
+ return FromPoiLongitude;
+ }
+
+ public void setFromPoiLongitude( String FromPoiLongitude ) {
+ this.FromPoiLongitude = FromPoiLongitude;
+ }
+
+ public String getFromPoiLatitude() {
+ return FromPoiLatitude;
+ }
+
+ public void setFromPoiLatitude( String FromPoiLatitude ) {
+ this.FromPoiLatitude = FromPoiLatitude;
+ }
+
+ public String getToPoiName() {
+ return ToPoiName;
+ }
+
+ public void setToPoiName( String ToPoiName ) {
+ this.ToPoiName = ToPoiName;
+ }
+
+ public String getToPoiLongitude() {
+ return ToPoiLongitude;
+ }
+
+ public void setToPoiLongitude( String ToPoiLongitude ) {
+ this.ToPoiLongitude = ToPoiLongitude;
+ }
+
+ public String getToPoiLatitude() {
+ return ToPoiLatitude;
+ }
+
+ public void setToPoiLatitude( String ToPoiLatitude ) {
+ this.ToPoiLatitude = ToPoiLatitude;
+ }
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarListPanelProvider.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarListPanelProvider.java
new file mode 100644
index 0000000000..ec0a404644
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarListPanelProvider.java
@@ -0,0 +1,77 @@
+package com.mogo.module.service.onlinecar.panel;
+
+import android.content.Context;
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
+
+import com.alibaba.android.arouter.facade.annotation.Route;
+import com.mogo.service.MogoServicePaths;
+import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
+import com.mogo.utils.logger.Logger;
+
+public
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+@Route( path = MogoServicePaths.PATH_ONLINE_CAR_PANEL )
+class OnlineCarListPanelProvider implements IMogoOnlineCarListPanelProvider {
+
+ private static final String TAG = "OnlineCarListPanelProvider";
+
+ @Override
+ public void initContainer( int containerId, FragmentActivity activity ) {
+ ContainerHandler.sContainerId = containerId;
+ ContainerHandler.sAttachContext = activity;
+ }
+
+ @Override
+ public void showPanel() {
+ if ( isFragmentExist( ContainerHandler.sAttachContext ) ) {
+ return;
+ }
+ Fragment fragment = new OnlineCarPanelFragment();
+ ContainerHandler.sAttachContext
+ .getSupportFragmentManager()
+ .beginTransaction()
+ .replace( ContainerHandler.sContainerId, fragment, TAG )
+ .commitNowAllowingStateLoss();
+ }
+
+ private boolean isFragmentExist( Context context ) {
+ if ( !( context instanceof FragmentActivity ) ) {
+ Logger.w( TAG, "context is not a instance of FragmentActivity" );
+ return false;
+ }
+ Fragment fragment = null;
+ return ( fragment = ( ( FragmentActivity ) context )
+ .getSupportFragmentManager()
+ .findFragmentByTag( TAG ) ) != null && fragment.isAdded();
+ }
+
+ @Override
+ public void hidePanel() {
+ Fragment fragment = ContainerHandler.sAttachContext.getSupportFragmentManager().findFragmentByTag( TAG );
+ if ( fragment != null ) {
+ ContainerHandler.sAttachContext
+ .getSupportFragmentManager()
+ .beginTransaction()
+ .remove( fragment )
+ .commitNowAllowingStateLoss();
+ }
+ }
+
+ @Override
+ public void clear() {
+ ContainerHandler.sContainerId = 0;
+ ContainerHandler.sAttachContext = null;
+ }
+
+ @Override
+ public void init( Context context ) {
+
+ }
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarPanelAdapter.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarPanelAdapter.java
new file mode 100644
index 0000000000..c003f218b7
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarPanelAdapter.java
@@ -0,0 +1,109 @@
+package com.mogo.module.service.onlinecar.panel;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.request.RequestOptions;
+import com.mogo.map.location.MogoLocation;
+import com.mogo.module.common.MogoApisHandler;
+import com.mogo.module.common.entity.MarkerLocation;
+import com.mogo.module.common.entity.MarkerOnlineCar;
+import com.mogo.module.common.glide.SkinAbleBitmapTarget;
+import com.mogo.module.service.MarkerServiceHandler;
+import com.mogo.module.service.R;
+import com.mogo.module.service.Utils;
+import com.mogo.utils.ResourcesHelper;
+import com.mogo.utils.WindowUtils;
+import com.mogo.utils.glide.GlideApp;
+
+import java.util.List;
+
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+class OnlineCarPanelAdapter extends RecyclerView.Adapter< OnlineCarPanelAdapter.VH > {
+
+ private List< MarkerOnlineCar > mDatums;
+
+ public OnlineCarPanelAdapter( List< MarkerOnlineCar > mDatums ) {
+ this.mDatums = mDatums;
+ }
+
+ public void setDatums( List< MarkerOnlineCar > mDatums ) {
+ this.mDatums = mDatums;
+ notifyDataSetChanged();
+ }
+
+ @NonNull
+ @Override
+ public OnlineCarPanelAdapter.VH onCreateViewHolder( @NonNull ViewGroup parent, int viewType ) {
+ return new VH( LayoutInflater.from( parent.getContext() ).inflate( R.layout.module_services_online_car_panel_item, null ) );
+ }
+
+ @Override
+ public void onBindViewHolder( @NonNull OnlineCarPanelAdapter.VH holder, int position ) {
+ holder.bind( mDatums.get( position ) );
+ }
+
+ @Override
+ public int getItemCount() {
+ return mDatums == null ? 0 : mDatums.size();
+ }
+
+ public static class VH extends RecyclerView.ViewHolder {
+
+ private ImageView avatar;
+ private TextView nickname;
+ private TextView distance;
+ private TextView detail;
+
+ public VH( @NonNull View itemView ) {
+ super( itemView );
+ RecyclerView.LayoutParams params = new RecyclerView.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT );
+ params.bottomMargin = ResourcesHelper.getDimensionPixelSize( itemView.getContext(), R.dimen.module_services_panel_item_marginBottom );
+ itemView.setLayoutParams( params );
+ avatar = itemView.findViewById( R.id.module_services_id_panel_item_avatar );
+ nickname = itemView.findViewById( R.id.module_services_id_panel_item_nickname );
+ distance = itemView.findViewById( R.id.module_services_id_panel_item_distance );
+ detail = itemView.findViewById( R.id.module_services_id_panel_item_detail );
+ }
+
+ public void bind( MarkerOnlineCar car ) {
+ RequestOptions options = new RequestOptions().circleCrop().placeholder( R.drawable.module_common_default_user_head ).error( R.drawable.module_common_default_user_head );
+ GlideApp.with( itemView.getContext() ).asBitmap().apply( options ).load( car.getUserInfo().getUserHead() ).into( new SkinAbleBitmapTarget( avatar, options ) );
+ nickname.setText( car.getUserInfo().getUserName() );
+ String content = getDistanceStr( car.getLocation() );
+ distance.setText( content );
+ detail.setOnClickListener( view -> {
+ MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "Mogoer_List_click", null );
+ } );
+ }
+
+ private String getDistanceStr( MarkerLocation location ) {
+ MogoLocation mogoLocation = MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( itemView.getContext() ).getLastKnowLocation();
+ if ( location == null ) {
+ return "";
+ }
+ if ( mogoLocation == null ) {
+ return "";
+ }
+ float distance = Utils.calculateLineDistance( location.getLon(), location.getLat(), mogoLocation.getLongitude(), mogoLocation.getLatitude() );
+ if ( distance >= 1000 ) {
+ return String.format( "%.1fKM", distance / 1000 );
+ } else {
+ return String.format( "%.1fM", distance );
+ }
+ }
+ }
+
+
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarPanelFragment.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarPanelFragment.java
new file mode 100644
index 0000000000..c425a3e37d
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarPanelFragment.java
@@ -0,0 +1,94 @@
+package com.mogo.module.service.onlinecar.panel;
+
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.mogo.commons.mvp.MvpFragment;
+import com.mogo.commons.voice.AIAssist;
+import com.mogo.module.common.MogoApisHandler;
+import com.mogo.module.common.entity.MarkerOnlineCar;
+import com.mogo.module.service.MarkerServiceHandler;
+import com.mogo.module.service.R;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+public class OnlineCarPanelFragment extends MvpFragment< IOnlineCarPanelView, OnlineCarPanelPresenter > implements IOnlineCarPanelView {
+
+ private RecyclerView mList;
+ private View mRefreshPanel;
+ private View mErrorPanel;
+
+ private OnlineCarPanelAdapter mOnlineCarPanelAdapter;
+
+ @Override
+ protected int getLayoutId() {
+ return R.layout.module_services_fragment_online_car_panel;
+ }
+
+ @Override
+ protected void initViews() {
+ findViewById( R.id.module_services_id_close ).setOnClickListener( view -> {
+ MarkerServiceHandler.getApis().getOnlineCarPanelApi().hidePanel();
+ } );
+ mList = findViewById( R.id.module_services_id_recycler_view );
+ mRefreshPanel = findViewById( R.id.module_services_id_load_strategy_container );
+ mErrorPanel = findViewById( R.id.module_services_id_error_container );
+
+ mList.setLayoutManager( new LinearLayoutManager( getContext(), LinearLayoutManager.VERTICAL, false ) );
+ }
+
+ @NonNull
+ @Override
+ protected OnlineCarPanelPresenter createPresenter() {
+ return new OnlineCarPanelPresenter( this );
+ }
+
+ @Override
+ public void renderOnlineCarList( List< MarkerOnlineCar > onlineCars ) {
+ mRefreshPanel.setVisibility( View.GONE );
+ mErrorPanel.setVisibility( View.GONE );
+ mList.setVisibility( View.VISIBLE );
+ if ( mOnlineCarPanelAdapter == null ) {
+ mOnlineCarPanelAdapter = new OnlineCarPanelAdapter( onlineCars );
+ mList.setAdapter( mOnlineCarPanelAdapter );
+ } else {
+ mOnlineCarPanelAdapter.setDatums( onlineCars );
+ }
+ AIAssist.getInstance( getContext() ).speakTTSVoice( String.format( "为您找到%s个车友", onlineCars.size() ) );
+ Map< String, Object > properties = new HashMap<>();
+ properties.put( "number", onlineCars.size() );
+ MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "Mogoer_List_number", properties );
+ }
+
+ @Override
+ public void renderEmptyUi( OnlineCarStrategy strategy ) {
+ mErrorPanel.setVisibility( View.GONE );
+ mList.setVisibility( View.GONE );
+ mRefreshPanel.setVisibility( View.VISIBLE );
+ }
+
+ @Override
+ public void renderNoNavigationInfoUi() {
+ mList.setVisibility( View.GONE );
+ mRefreshPanel.setVisibility( View.GONE );
+ mErrorPanel.setVisibility( View.VISIBLE );
+ }
+
+ @Override
+ public void renderErrorUi() {
+ mList.setVisibility( View.GONE );
+ mRefreshPanel.setVisibility( View.GONE );
+ mErrorPanel.setVisibility( View.VISIBLE );
+ }
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarPanelPresenter.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarPanelPresenter.java
new file mode 100644
index 0000000000..b51e1943f8
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarPanelPresenter.java
@@ -0,0 +1,83 @@
+package com.mogo.module.service.onlinecar.panel;
+
+import android.text.TextUtils;
+
+import androidx.annotation.NonNull;
+import androidx.lifecycle.LifecycleOwner;
+
+import com.mogo.commons.mvp.Presenter;
+import com.mogo.commons.storage.SpStorage;
+import com.mogo.map.MogoLatLng;
+import com.mogo.module.common.entity.MarkerResponse;
+import com.mogo.module.service.network.RefreshCallback;
+import com.mogo.module.service.network.RefreshModel;
+import com.mogo.utils.network.utils.GsonUtil;
+
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+class OnlineCarPanelPresenter extends Presenter< IOnlineCarPanelView > implements RefreshCallback< MarkerResponse > {
+
+ public static final int LIMIT = 20;
+ private RefreshModel mRefreshModel;
+ private OnlineCarStrategy mStrategy;
+ private NavigationTargetInfo mNavigationTargetInfo;
+
+ public OnlineCarPanelPresenter( IOnlineCarPanelView view ) {
+ super( view );
+ mRefreshModel = new RefreshModel( getContext() );
+ mStrategy = OnlineCarStrategy.Default;
+ }
+
+ @Override
+ public void onCreate( @NonNull LifecycleOwner owner ) {
+ super.onCreate( owner );
+ String json = SpStorage.getNavigationTarget();
+ if ( TextUtils.isEmpty( json ) ) {
+ mView.renderNoNavigationInfoUi();
+ return;
+ }
+ mNavigationTargetInfo = GsonUtil.objectFromJson( json, NavigationTargetInfo.class );
+ loadOnlineCar();
+ }
+
+ public void loadOnlineCar() {
+ if ( mNavigationTargetInfo == null ) {
+ return;
+ }
+ try {
+ double toLat = Double.valueOf( mNavigationTargetInfo.getToPoiLatitude() );
+ double toLon = Double.valueOf( mNavigationTargetInfo.getToPoiLongitude() );
+ mRefreshModel.queryOnLineCarWithRoute( new MogoLatLng( toLat, toLon ),
+ false,
+ false,
+ mStrategy.getRadius(),
+ LIMIT,
+ this
+ );
+ } catch ( Exception e ) {
+ mView.renderNoNavigationInfoUi();
+ }
+ }
+
+ @Override
+ public void onSuccess( MarkerResponse o ) {
+ if ( o == null || o.getResult() == null ) {
+ mView.renderErrorUi();
+ } else {
+ if ( o.getResult().getOnlineCar() == null || o.getResult().getOnlineCar().isEmpty() ) {
+ mView.renderEmptyUi( mStrategy );
+ } else {
+ mView.renderOnlineCarList( o.getResult().getOnlineCar() );
+ }
+ }
+ }
+
+ @Override
+ public void onFail() {
+ mView.renderErrorUi();
+ }
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarStrategy.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarStrategy.java
new file mode 100644
index 0000000000..b80c4062aa
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/onlinecar/panel/OnlineCarStrategy.java
@@ -0,0 +1,27 @@
+package com.mogo.module.service.onlinecar.panel;
+
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+enum OnlineCarStrategy {
+
+ Strategy3( 40_000, null ),
+ Strategy2( 20_000, Strategy3 ),
+ Default( 10_000, Strategy2 ),
+ ;
+
+ private int radius;
+ private OnlineCarStrategy next;
+
+ OnlineCarStrategy( int radius, OnlineCarStrategy next ) {
+ this.radius = radius;
+ this.next = next;
+ }
+
+ public int getRadius() {
+ return radius;
+ }
+}
diff --git a/modules/mogo-module-service/src/main/res/drawable-ldpi/module_services_close.png b/modules/mogo-module-service/src/main/res/drawable-ldpi/module_services_close.png
new file mode 100755
index 0000000000..c1381dc44c
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable-ldpi/module_services_close.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable-ldpi/module_services_online_car_panel_background.9.png b/modules/mogo-module-service/src/main/res/drawable-ldpi/module_services_online_car_panel_background.9.png
new file mode 100644
index 0000000000..80ab4b841f
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable-ldpi/module_services_online_car_panel_background.9.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable-ldpi/module_services_online_car_panel_empty_icon.png b/modules/mogo-module-service/src/main/res/drawable-ldpi/module_services_online_car_panel_empty_icon.png
new file mode 100644
index 0000000000..0befdbd823
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable-ldpi/module_services_online_car_panel_empty_icon.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable-mdpi/module_services_close.png b/modules/mogo-module-service/src/main/res/drawable-mdpi/module_services_close.png
new file mode 100755
index 0000000000..c1381dc44c
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable-mdpi/module_services_close.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable-mdpi/module_services_online_car_panel_background.9.png b/modules/mogo-module-service/src/main/res/drawable-mdpi/module_services_online_car_panel_background.9.png
new file mode 100644
index 0000000000..80ab4b841f
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable-mdpi/module_services_online_car_panel_background.9.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable-mdpi/module_services_online_car_panel_empty_icon.png b/modules/mogo-module-service/src/main/res/drawable-mdpi/module_services_online_car_panel_empty_icon.png
new file mode 100644
index 0000000000..0befdbd823
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable-mdpi/module_services_online_car_panel_empty_icon.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_services_close.png b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_services_close.png
new file mode 100755
index 0000000000..bb3e2b1195
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_services_close.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_services_online_car_panel_background.9.png b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_services_online_car_panel_background.9.png
new file mode 100644
index 0000000000..d4a8803684
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_services_online_car_panel_background.9.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_services_online_car_panel_empty_icon.png b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_services_online_car_panel_empty_icon.png
new file mode 100644
index 0000000000..e225da807b
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_services_online_car_panel_empty_icon.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable/module_services_close.png b/modules/mogo-module-service/src/main/res/drawable/module_services_close.png
new file mode 100755
index 0000000000..c1381dc44c
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable/module_services_close.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable/module_services_online_car_panel_background.9.png b/modules/mogo-module-service/src/main/res/drawable/module_services_online_car_panel_background.9.png
new file mode 100644
index 0000000000..80ab4b841f
Binary files /dev/null and b/modules/mogo-module-service/src/main/res/drawable/module_services_online_car_panel_background.9.png differ
diff --git a/modules/mogo-module-service/src/main/res/drawable/module_services_panel_item_bkg.xml b/modules/mogo-module-service/src/main/res/drawable/module_services_panel_item_bkg.xml
new file mode 100644
index 0000000000..08e5f85a0a
--- /dev/null
+++ b/modules/mogo-module-service/src/main/res/drawable/module_services_panel_item_bkg.xml
@@ -0,0 +1,9 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/drawable/module_services_panel_item_detail_bkg.xml b/modules/mogo-module-service/src/main/res/drawable/module_services_panel_item_detail_bkg.xml
new file mode 100644
index 0000000000..536a7a8e09
--- /dev/null
+++ b/modules/mogo-module-service/src/main/res/drawable/module_services_panel_item_detail_bkg.xml
@@ -0,0 +1,9 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/drawable/module_services_panel_strategy_button_bkg.xml b/modules/mogo-module-service/src/main/res/drawable/module_services_panel_strategy_button_bkg.xml
new file mode 100644
index 0000000000..265d98a08c
--- /dev/null
+++ b/modules/mogo-module-service/src/main/res/drawable/module_services_panel_strategy_button_bkg.xml
@@ -0,0 +1,9 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/layout/module_services_fragment_online_car_panel.xml b/modules/mogo-module-service/src/main/res/layout/module_services_fragment_online_car_panel.xml
new file mode 100644
index 0000000000..3e39b0146f
--- /dev/null
+++ b/modules/mogo-module-service/src/main/res/layout/module_services_fragment_online_car_panel.xml
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/layout/module_services_online_car_panel_item.xml b/modules/mogo-module-service/src/main/res/layout/module_services_online_car_panel_item.xml
new file mode 100644
index 0000000000..429a88d5a0
--- /dev/null
+++ b/modules/mogo-module-service/src/main/res/layout/module_services_online_car_panel_item.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/values-ldpi/dimens.xml b/modules/mogo-module-service/src/main/res/values-ldpi/dimens.xml
index fd1066746d..98ffc07076 100644
--- a/modules/mogo-module-service/src/main/res/values-ldpi/dimens.xml
+++ b/modules/mogo-module-service/src/main/res/values-ldpi/dimens.xml
@@ -22,4 +22,35 @@
64px
6.5px
10px
+
+ 2px
+ 2px
+ 8px
+ 28px
+ 16px
+
+ 20px
+ 28px
+ 20px
+ 84px
+ 18px
+ 58px
+ 14px
+ 16px
+ 18px
+ 5px
+ 20px
+ 13px
+ 42px
+ 8.89px
+ 13px
+ 16px
+ 25px
+ 13px
+ 26px
+ 20px
+ 18px
+ 17px
+ 60px
+ 12.5px
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/values-mdpi/dimens.xml b/modules/mogo-module-service/src/main/res/values-mdpi/dimens.xml
index fd1066746d..e0ef017da6 100644
--- a/modules/mogo-module-service/src/main/res/values-mdpi/dimens.xml
+++ b/modules/mogo-module-service/src/main/res/values-mdpi/dimens.xml
@@ -22,4 +22,35 @@
64px
6.5px
10px
+
+ 2px
+ 2px
+ 8px
+ 28px
+ 16px
+
+ 20px
+ 28px
+ 20px
+ 84px
+ 18px
+ 58px
+ 14px
+ 16px
+ 18px
+ 5px
+ 20px
+ 13px
+ 42px
+ 8.89px
+ 13px
+ 16px
+ 25px
+ 13px
+ 26px
+ 40px
+ 18px
+ 28px
+ 108px
+ 12.5px
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/values-xhdpi-1920x1000/dimens.xml b/modules/mogo-module-service/src/main/res/values-xhdpi-1920x1000/dimens.xml
index 341706179d..6e500351ca 100644
--- a/modules/mogo-module-service/src/main/res/values-xhdpi-1920x1000/dimens.xml
+++ b/modules/mogo-module-service/src/main/res/values-xhdpi-1920x1000/dimens.xml
@@ -22,4 +22,35 @@
20px
120px
20px
+
+ 20px
+ 20px
+ 20px
+ 50px
+ 28px
+
+ 36px
+ 50px
+ 36px
+ 151px
+ 33px
+ 102px
+ 26px
+ 30px
+ 34px
+ 9px
+ 40px
+ 20px
+ 70px
+ 16px
+ 21px
+ 28px
+ 45px
+ 22px
+ 42px
+ 40px
+ 34px
+ 17px
+ 108px
+ 22.5px
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-service/src/main/res/values-xhdpi/dimens.xml
index 341706179d..717e486bf5 100644
--- a/modules/mogo-module-service/src/main/res/values-xhdpi/dimens.xml
+++ b/modules/mogo-module-service/src/main/res/values-xhdpi/dimens.xml
@@ -22,4 +22,35 @@
20px
120px
20px
+
+ 20px
+ 20px
+ 20px
+ 50px
+ 28px
+
+ 36px
+ 50px
+ 36px
+ 151px
+ 33px
+ 102px
+ 26px
+ 30px
+ 34px
+ 9px
+ 40px
+ 20px
+ 70px
+ 16px
+ 21px
+ 28px
+ 45px
+ 22px
+ 42px
+ 20px
+ 34px
+ 28px
+ 60px
+ 22.5px
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/values/colors.xml b/modules/mogo-module-service/src/main/res/values/colors.xml
index e5cc33f8fa..f770bfe69f 100644
--- a/modules/mogo-module-service/src/main/res/values/colors.xml
+++ b/modules/mogo-module-service/src/main/res/values/colors.xml
@@ -1,4 +1,11 @@
#ffffff
+ #FFFFFFFF
+ #FFFFFF
+ #FFFFFF
+ #7FFFFFFF
+ #FFFFFF
+ #3081A4DC
+ #B2FFFFFF
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/values/dimens.xml b/modules/mogo-module-service/src/main/res/values/dimens.xml
index 341706179d..3364dbceac 100644
--- a/modules/mogo-module-service/src/main/res/values/dimens.xml
+++ b/modules/mogo-module-service/src/main/res/values/dimens.xml
@@ -22,4 +22,35 @@
20px
120px
20px
+
+ 2px
+ 2px
+ 8px
+ 28px
+ 16px
+
+ 20px
+ 28px
+ 20px
+ 84px
+ 18px
+ 58px
+ 14px
+ 16px
+ 18px
+ 5px
+ 20px
+ 13px
+ 42px
+ 8.89px
+ 13px
+ 16px
+ 25px
+ 13px
+ 26px
+ 20px
+ 18px
+ 17px
+ 60px
+ 12.5px
\ No newline at end of file
diff --git a/modules/mogo-module-service/src/main/res/values/strings.xml b/modules/mogo-module-service/src/main/res/values/strings.xml
index 78e8c3f560..dfbd56bf85 100644
--- a/modules/mogo-module-service/src/main/res/values/strings.xml
+++ b/modules/mogo-module-service/src/main/res/values/strings.xml
@@ -4,4 +4,8 @@
你的周围有%d个%s,请点击查看,你也可以对我说打开蘑菇出行
周围有%d个%s
建议开启蘑菇出行,守护你的每一段行程,你可以直接对我说,打开蘑菇出行
+ 扩大到20KM半径
+ 扩大到40KM半径
+ 距离导航目的地
+ 查看车友信息
diff --git a/modules/mogo-module-widgets/src/main/java/com/mogo/module/widgets/AutoNaviIntentHandler.java b/modules/mogo-module-widgets/src/main/java/com/mogo/module/widgets/AutoNaviIntentHandler.java
index 9602906ce0..3be64289d6 100644
--- a/modules/mogo-module-widgets/src/main/java/com/mogo/module/widgets/AutoNaviIntentHandler.java
+++ b/modules/mogo-module-widgets/src/main/java/com/mogo/module/widgets/AutoNaviIntentHandler.java
@@ -2,18 +2,26 @@ package com.mogo.module.widgets;
import android.content.Context;
import android.content.Intent;
+import android.graphics.Rect;
+import android.net.Uri;
import android.text.TextUtils;
import android.view.Gravity;
+import android.view.View;
import android.view.WindowManager;
+import android.widget.TextView;
+import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.wm.WindowManagerView;
+import com.mogo.service.IMogoServiceApis;
import com.mogo.utils.CommonUtils;
import com.mogo.utils.LaunchUtils;
import com.mogo.utils.ResourcesHelper;
+import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import java.util.HashMap;
@@ -50,6 +58,12 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
private WindowManagerView mWindowManagerView;
private Map< String, Object > mProperties = new HashMap<>();
+ private TextView mEnterApp;
+ private TextView mConsult;
+ private View mHandler;
+
+ private boolean mLargeStyle = true;
+
public synchronized void release() {
sInstance = null;
}
@@ -97,9 +111,12 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
.gravity( Gravity.LEFT | Gravity.TOP )
.position( ResourcesHelper.getDimensionPixelSize( context, R.dimen.module_widgets_app_entrance_x ), ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_widgets_app_entrance_y ) )
.showInWindowManager();
- mWindowManagerView.attachTouchEvent( view -> {
- enterApp( context );
+ mWindowManagerView.attachTouchEvent( ( view, xPos, yPos ) -> {
+ chooseAction( view, xPos, yPos );
} );
+ mEnterApp = mWindowManagerView.findViewById( R.id.module_widgets_app_entrance );
+ mConsult = mWindowManagerView.findViewById( R.id.module_widgets_app_consult );
+ mHandler = mWindowManagerView.findViewById( R.id.module_widgets_app_handler );
}
try {
if ( mWindowManagerView.isShowing() ) {
@@ -113,6 +130,62 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
}
}
+ private void chooseAction( View root, float xPos, float yPos ) {
+ if ( isInViewArea( mEnterApp, xPos, yPos ) ) {
+ enterApp( root.getContext() );
+ } else if ( isInViewArea( mHandler, xPos, yPos ) ) {
+ handleStyle( mHandler.getContext() );
+ } else if ( isInViewArea( mConsult, xPos, yPos ) ) {
+ consultUser( root.getContext() );
+ }
+ }
+
+ private boolean isInViewArea( View target, float xPos, float yPos ) {
+ if ( xPos >= target.getLeft()
+ && xPos <= target.getRight()
+ && yPos >= target.getTop()
+ && yPos <= target.getBottom() ) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * 咨询用户
+ *
+ * @param context
+ */
+ private void consultUser( Context context ) {
+ Map properties = new HashMap<>();
+ properties.put( "type", 1 );
+ MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "NAVI_Find_Mogoer", properties );
+ if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isMainPageOnResume() ) {
+ MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().showPanel();
+ } else {
+ Intent start = new Intent( Intent.ACTION_VIEW );
+ start.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
+ start.setData( Uri.parse( "mogo://launcher/main/switch2?type=showOnlineCarPanel" ) );
+ context.startActivity( start );
+ }
+ }
+
+ private void handleStyle( Context context ) {
+ if ( mLargeStyle ) {
+ mEnterApp.setText( R.string.module_widgets_app_entrance_short );
+ mConsult.setText( R.string.module_widgets_app_consult_short );
+ mLargeStyle = false;
+ } else {
+ mEnterApp.setText( R.string.module_widgets_app_entrance_text );
+ mConsult.setText( R.string.module_widgets_app_entrance_consult );
+ mLargeStyle = true;
+ }
+ }
+
+ /**
+ * 进入app
+ *
+ * @param context
+ */
private void enterApp( Context context ) {
try {
if ( DebugConfig.isLauncher() ) {
@@ -162,7 +235,7 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
@Override
public void onCmdSelected( String cmd ) {
if ( TextUtils.equals( OPEN, cmd ) ) {
- Logger.d(TAG, "recognized open command.");
+ Logger.d( TAG, "recognized open command." );
enterApp( AbsMogoApplication.getApp() );
}
}
diff --git a/modules/mogo-module-widgets/src/main/java/com/mogo/module/widgets/MogoWidgetManger.java b/modules/mogo-module-widgets/src/main/java/com/mogo/module/widgets/MogoWidgetManger.java
index 289c0a30ca..ab99a79fd5 100644
--- a/modules/mogo-module-widgets/src/main/java/com/mogo/module/widgets/MogoWidgetManger.java
+++ b/modules/mogo-module-widgets/src/main/java/com/mogo/module/widgets/MogoWidgetManger.java
@@ -3,8 +3,9 @@ package com.mogo.module.widgets;
import android.content.Context;
import android.content.Intent;
-import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.commons.storage.SpStorage;
import com.mogo.map.navi.IMogoNaviListener2;
+import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
@@ -60,7 +61,7 @@ class MogoWidgetManger implements IMogoNaviListener2, IMogoIntentListener, IMogo
public void init( Context context ) {
mContext = context;
- mApis = ARouter.getInstance().navigation( IMogoServiceApis.class );
+ mApis = MogoApisHandler.getInstance().getApis();
initMapStatusListener();
initStatusListener();
initIntentListener();
@@ -82,6 +83,7 @@ class MogoWidgetManger implements IMogoNaviListener2, IMogoIntentListener, IMogo
@Override
public void onStopNavi() {
+ SpStorage.setNavigationTarget( "" );
AutoNaviIntentHandler.getInstance().closeEntrance();
}
diff --git a/modules/mogo-module-widgets/src/main/res/drawable-ldpi/module_widgets_app_entrance_img_bkg.png b/modules/mogo-module-widgets/src/main/res/drawable-ldpi/module_widgets_app_entrance_img_bkg.png
deleted file mode 100644
index 0af1eeda01..0000000000
Binary files a/modules/mogo-module-widgets/src/main/res/drawable-ldpi/module_widgets_app_entrance_img_bkg.png and /dev/null differ
diff --git a/modules/mogo-module-widgets/src/main/res/drawable/module_widgets_app_body_bkg.xml b/modules/mogo-module-widgets/src/main/res/drawable/module_widgets_app_body_bkg.xml
new file mode 100644
index 0000000000..1885397945
--- /dev/null
+++ b/modules/mogo-module-widgets/src/main/res/drawable/module_widgets_app_body_bkg.xml
@@ -0,0 +1,9 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-widgets/src/main/res/drawable/module_widgets_app_entrance_img_bkg.png b/modules/mogo-module-widgets/src/main/res/drawable/module_widgets_app_entrance_img_bkg.png
deleted file mode 100644
index 0af1eeda01..0000000000
Binary files a/modules/mogo-module-widgets/src/main/res/drawable/module_widgets_app_entrance_img_bkg.png and /dev/null differ
diff --git a/modules/mogo-module-widgets/src/main/res/drawable/module_widgets_app_handler_bkg.xml b/modules/mogo-module-widgets/src/main/res/drawable/module_widgets_app_handler_bkg.xml
new file mode 100644
index 0000000000..b010e4976b
--- /dev/null
+++ b/modules/mogo-module-widgets/src/main/res/drawable/module_widgets_app_handler_bkg.xml
@@ -0,0 +1,9 @@
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-widgets/src/main/res/layout/module_widgets_app_entrance.xml b/modules/mogo-module-widgets/src/main/res/layout/module_widgets_app_entrance.xml
index 5ea9b7fe2a..50c79786b3 100644
--- a/modules/mogo-module-widgets/src/main/res/layout/module_widgets_app_entrance.xml
+++ b/modules/mogo-module-widgets/src/main/res/layout/module_widgets_app_entrance.xml
@@ -1,17 +1,66 @@
-
+ android:layout_height="wrap_content"
+ android:background="@drawable/module_widgets_app_handler_bkg">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-widgets/src/main/res/values-ldpi/dimens.xml b/modules/mogo-module-widgets/src/main/res/values-ldpi/dimens.xml
index bbd70cad6e..3b9f47b99b 100644
--- a/modules/mogo-module-widgets/src/main/res/values-ldpi/dimens.xml
+++ b/modules/mogo-module-widgets/src/main/res/values-ldpi/dimens.xml
@@ -1,11 +1,12 @@
- 20px
+ 22px
15px
2px
505px
501px
- 10px
- 15px
+ 20px
+ 27px
71px
+ 4px
\ No newline at end of file
diff --git a/modules/mogo-module-widgets/src/main/res/values-mdpi/dimens.xml b/modules/mogo-module-widgets/src/main/res/values-mdpi/dimens.xml
index bbd70cad6e..3b9f47b99b 100644
--- a/modules/mogo-module-widgets/src/main/res/values-mdpi/dimens.xml
+++ b/modules/mogo-module-widgets/src/main/res/values-mdpi/dimens.xml
@@ -1,11 +1,12 @@
- 20px
+ 22px
15px
2px
505px
501px
- 10px
- 15px
+ 20px
+ 27px
71px
+ 4px
\ No newline at end of file
diff --git a/modules/mogo-module-widgets/src/main/res/values-xhdpi-1920x1000/dimens.xml b/modules/mogo-module-widgets/src/main/res/values-xhdpi-1920x1000/dimens.xml
index e4fc6151e3..2914119343 100644
--- a/modules/mogo-module-widgets/src/main/res/values-xhdpi-1920x1000/dimens.xml
+++ b/modules/mogo-module-widgets/src/main/res/values-xhdpi-1920x1000/dimens.xml
@@ -5,7 +5,8 @@
4px
48px
1000px
- 10px
- 15px
+ 37px
+ 50px
71px
+ 8px
\ No newline at end of file
diff --git a/modules/mogo-module-widgets/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-widgets/src/main/res/values-xhdpi/dimens.xml
index e4fc6151e3..2914119343 100644
--- a/modules/mogo-module-widgets/src/main/res/values-xhdpi/dimens.xml
+++ b/modules/mogo-module-widgets/src/main/res/values-xhdpi/dimens.xml
@@ -5,7 +5,8 @@
4px
48px
1000px
- 10px
- 15px
+ 37px
+ 50px
71px
+ 8px
\ No newline at end of file
diff --git a/modules/mogo-module-widgets/src/main/res/values/colors.xml b/modules/mogo-module-widgets/src/main/res/values/colors.xml
new file mode 100644
index 0000000000..8184cc697b
--- /dev/null
+++ b/modules/mogo-module-widgets/src/main/res/values/colors.xml
@@ -0,0 +1,4 @@
+
+
+ #FFFFFF
+
\ No newline at end of file
diff --git a/modules/mogo-module-widgets/src/main/res/values/dimens.xml b/modules/mogo-module-widgets/src/main/res/values/dimens.xml
index e4fc6151e3..bf234e4ac3 100644
--- a/modules/mogo-module-widgets/src/main/res/values/dimens.xml
+++ b/modules/mogo-module-widgets/src/main/res/values/dimens.xml
@@ -1,11 +1,12 @@
- 40px
+ 22px
30px
4px
48px
1000px
- 10px
- 15px
+ 20px
+ 27px
71px
+ 4px
\ No newline at end of file
diff --git a/modules/mogo-module-widgets/src/main/res/values/strings.xml b/modules/mogo-module-widgets/src/main/res/values/strings.xml
index d824f729d5..1207c6ab0b 100644
--- a/modules/mogo-module-widgets/src/main/res/values/strings.xml
+++ b/modules/mogo-module-widgets/src/main/res/values/strings.xml
@@ -1,4 +1,7 @@
mogo-module-service
- 切换辅助驾驶
+ 辅助驾驶模式
+ 咨询终点车友
+ 辅
+ 咨
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/IMogoServiceApis.java b/services/mogo-service-api/src/main/java/com/mogo/service/IMogoServiceApis.java
index 66aecbd070..25fd02c006 100644
--- a/services/mogo-service-api/src/main/java/com/mogo/service/IMogoServiceApis.java
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/IMogoServiceApis.java
@@ -30,6 +30,7 @@ import com.mogo.service.passport.IMogoPassportManager;
import com.mogo.service.share.IMogoShareManager;
import com.mogo.service.statusmanager.IMogoMsgCenter;
import com.mogo.service.statusmanager.IMogoStatusManager;
+import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
import com.mogo.service.strategy.IMogoRefreshStrategyController;
import com.mogo.service.tanlu.IMogoTanluProvider;
import com.mogo.service.tanlu.IMogoTanluUiProvider;
@@ -270,4 +271,10 @@ public interface IMogoServiceApis extends IProvider {
* @return
*/
IMogoSkinSupportInstaller getSkinSupportInstallerApi();
+
+ /**
+ * 在线车辆面板
+ * @return
+ */
+ IMogoOnlineCarListPanelProvider getOnlineCarPanelApi();
}
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java b/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java
index 71b5fae096..bca6a29631 100644
--- a/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java
@@ -255,4 +255,9 @@ public class MogoServicePaths {
* 悬浮小控件
*/
public static final String PATH_WIDGETS = "/widgets/provider";
+
+ /**
+ * 在线好友面板
+ */
+ public static final String PATH_ONLINE_CAR_PANEL = "/onlinecar/panel";
}
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/strategy/IMogoOnlineCarListPanelProvider.java b/services/mogo-service-api/src/main/java/com/mogo/service/strategy/IMogoOnlineCarListPanelProvider.java
new file mode 100644
index 0000000000..16f68b3e74
--- /dev/null
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/strategy/IMogoOnlineCarListPanelProvider.java
@@ -0,0 +1,26 @@
+package com.mogo.service.strategy;
+
+import android.content.Context;
+
+import androidx.annotation.IdRes;
+import androidx.fragment.app.FragmentActivity;
+
+import com.alibaba.android.arouter.facade.template.IProvider;
+
+public
+/**
+ * @author congtaowang
+ * @since 2020/9/21
+ *
+ * 描述
+ */
+interface IMogoOnlineCarListPanelProvider extends IProvider {
+
+ void initContainer( @IdRes int containerId, FragmentActivity activity );
+
+ void showPanel();
+
+ void hidePanel();
+
+ void clear();
+}
diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java b/services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java
index add6d7a185..7f0ca8cec1 100644
--- a/services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java
+++ b/services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java
@@ -38,6 +38,7 @@ import com.mogo.service.passport.IMogoPassportManager;
import com.mogo.service.share.IMogoShareManager;
import com.mogo.service.statusmanager.IMogoMsgCenter;
import com.mogo.service.statusmanager.IMogoStatusManager;
+import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
import com.mogo.service.strategy.IMogoRefreshStrategyController;
import com.mogo.service.tanlu.IMogoTanluProvider;
import com.mogo.service.tanlu.IMogoTanluUiProvider;
@@ -232,6 +233,11 @@ public class MogoServiceApis implements IMogoServiceApis {
return getApiInstance( IMogoSkinSupportInstaller.class, SkinSupportInstallerConstants.PATH);
}
+ @Override
+ public IMogoOnlineCarListPanelProvider getOnlineCarPanelApi() {
+ return getApiInstance( IMogoOnlineCarListPanelProvider.class, MogoServicePaths.PATH_ONLINE_CAR_PANEL);
+ }
+
private static < T extends IProvider > T getApiInstance( Class< T > clazz, String path ) {
T inst = SingletonsHolder.get( clazz );
if ( inst == null ) {