This commit is contained in:
wangcongtao
2020-09-22 20:22:48 +08:00
parent a186f46b6c
commit eb511fa3c1
107 changed files with 1850 additions and 183 deletions

2
.idea/misc.xml generated
View File

@@ -4,7 +4,7 @@
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -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"

View File

@@ -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')
}
}

View File

@@ -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')
}
}

View File

@@ -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 );
}

View File

@@ -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;
}
}

View File

@@ -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 );
}
}

View File

@@ -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;
}
}

View File

@@ -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();

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft">350px</dimen>
<dimen name="module_main_entrance_fragment_container_marginLeft">358px</dimen>
<dimen name="module_main_header_fragment_container_marginLeft">366px</dimen>
</resources>

View File

@@ -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;
}

View File

@@ -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 );
}
}

View File

@@ -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();
} );
}

View File

@@ -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

View File

@@ -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
* <p>
* 描述
*/
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;
}
}

View File

@@ -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);
}
}

View File

@@ -33,6 +33,6 @@ interface IWindowManagerView {
void hide();
interface OnViewClickListener {
void onClick( View view );
void onClick( View view, float xPos, float yPos );
}
}

View File

@@ -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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -6,4 +6,11 @@
<enum name="vertical" value="1" />
</attr>
</declare-styleable>
<declare-styleable name="CustomCircleImageView">
<attr format="dimension" name="civ_border_width"/>
<attr format="color" name="civ_border_color"/>
<attr format="boolean" name="civ_border_overlay"/>
<attr format="color" name="civ_fill_color"/>
</declare-styleable>
</resources>

View File

@@ -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

View File

@@ -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<EntranceView, EntrancePresente
private boolean toggle = false;
private View mOnlineCarEntrance;
private Runnable mLockCarRunnable = new Runnable() {
@Override
public void run() {
@@ -155,7 +157,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
protected void initViews() {
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext());
mApis = MogoApisHandler.getInstance().getApis();
mEntrancePresenter = new EntrancePresenter(getContext(), this);
mMogoFragmentManager = mApis.getFragmentManagerApi();
@@ -317,6 +319,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload,
mStatusManager);
mOnlineCarEntrance = findViewById( R.id.module_ext_id_destination_online_car );
mOnlineCarEntrance.setOnClickListener( view -> {
MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().showPanel();
Map<String, Object> 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<EntranceView, EntrancePresente
mCameraMode.setVisibility(View.VISIBLE);
}
mApis.getAnalyticsApi().track("Navigation_begin", new HashMap<>());
if ( DebugConfig.isSupportedSearchDestinationOnlineCarList() ) {
mOnlineCarEntrance.setVisibility( View.VISIBLE );
} else {
mOnlineCarEntrance.setVisibility( View.GONE );
}
}
@Override
@@ -438,6 +453,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
mDisplayOverview.setVisibility(View.GONE);
mCameraMode.setVisibility(View.GONE);
mOnlineCarEntrance.setVisibility( View.GONE );
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.AIMLESS);
}

View File

@@ -9,6 +9,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.R;
import com.mogo.module.extensions.net.UserInfoNetApiServices;
import com.mogo.module.extensions.userinfo.UserInfo;
@@ -55,8 +56,7 @@ public class EntrancePresenter extends Presenter<EntranceView> 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -36,6 +36,30 @@
app:layout_goneMarginTop="@dimen/module_ext_north_goneMarginTop"
tools:visibility="visible" />
<TextView
android:id="@+id/module_ext_id_destination_online_car"
android:layout_width="wrap_content"
android:layout_height="@dimen/module_ext_button_height"
android:layout_marginTop="@dimen/module_ext_camera_button_marginTop"
android:background="@drawable/module_ext_dw_navi_info_panel_bkg"
android:drawableLeft="@drawable/module_ext_destination_online_car_dw"
android:gravity="center"
android:drawablePadding="@dimen/module_ext_destination_online_car_drawablePadding"
android:paddingTop="@dimen/dp_14"
android:text="@string/module_ext_destination_online_car_text"
android:visibility="gone"
android:layout_marginLeft="@dimen/module_common_shadow_width_pos"
android:textColor="@color/module_ext_color_voice_text"
android:textSize="@dimen/module_ext_north_textSize"
android:textStyle="bold"
android:paddingRight="@dimen/module_ext_destination_online_car_paddingRight"
android:paddingLeft="@dimen/module_ext_destination_online_car_paddingLeft"
app:layout_constraintLeft_toLeftOf="@+id/module_map_id_navi_bg"
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_goneMarginTop="@dimen/module_ext_north_goneMarginTop"
tools:visibility="visible" />
<com.mogo.module.extensions.navi.TopView
android:id="@+id/module_entrance_id_top_container"
android:layout_width="match_parent"
@@ -58,7 +82,7 @@
android:layout_marginLeft="@dimen/module_common_shadow_width_pos"
app:layout_constraintLeft_toLeftOf="@+id/module_map_id_navi_bg"
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg"
tools:visibility="visible">
tools:visibility="gone">
<ImageView
android:id="@+id/module_ext_id_display_overview_icon"

View File

@@ -5,4 +5,7 @@
<dimen name="module_ext_layout_padding">10px</dimen>
<dimen name="module_ext_layout_paddingRight">2px</dimen>
<dimen name="module_ext_layout_paddingBottom">2px</dimen>
<dimen name="module_ext_destination_online_car_drawablePadding">4px</dimen>
<dimen name="module_ext_destination_online_car_paddingLeft">14px</dimen>
<dimen name="module_ext_destination_online_car_paddingRight">14px</dimen>
</resources>

View File

@@ -150,4 +150,7 @@
<dimen name="module_ext_layout_padding">30px</dimen>
<dimen name="module_ext_layout_paddingRight">20px</dimen>
<dimen name="module_ext_layout_paddingBottom">20px</dimen>
<dimen name="module_ext_destination_online_car_drawablePadding">8px</dimen>
<dimen name="module_ext_destination_online_car_paddingLeft">21px</dimen>
<dimen name="module_ext_destination_online_car_paddingRight">31px</dimen>
</resources>

View File

@@ -152,4 +152,7 @@
<dimen name="module_ext_layout_padding">30px</dimen>
<dimen name="module_ext_layout_paddingRight">20px</dimen>
<dimen name="module_ext_layout_paddingBottom">20px</dimen>
<dimen name="module_ext_destination_online_car_drawablePadding">8px</dimen>
<dimen name="module_ext_destination_online_car_paddingLeft">21px</dimen>
<dimen name="module_ext_destination_online_car_paddingRight">31px</dimen>
</resources>

View File

@@ -157,4 +157,7 @@
<dimen name="module_ext_layout_padding">10px</dimen>
<dimen name="module_ext_layout_paddingRight">2px</dimen>
<dimen name="module_ext_layout_paddingBottom">2px</dimen>
<dimen name="module_ext_destination_online_car_drawablePadding">4px</dimen>
<dimen name="module_ext_destination_online_car_paddingLeft">14px</dimen>
<dimen name="module_ext_destination_online_car_paddingRight">14px</dimen>
</resources>

View File

@@ -22,6 +22,7 @@
<string name="module_ext_str_exit_path">退出全览</string>
<string name="mode_car_up">车头</string>
<string name="mode_north_up">正北</string>
<string name="module_ext_destination_online_car_text">目的地车友</string>
<string-array name="module_ext_str_arr_ai_tips">
<item>你好小智,播放音乐</item>

View File

@@ -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();
}
}

View File

@@ -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 ) {

View File

@@ -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;

View File

@@ -26,6 +26,6 @@
<dimen name="module_main_entrance_fragment_container_padding_top">16px</dimen>
<dimen name="module_main_entrance_fragment_container_width">658px</dimen>
<dimen name="module_event_fragment_container_padding">8px</dimen>
<dimen name="module_main_apps_fragment_container_paddingTop">10px</dimen>
<dimen name="module_main_apps_fragment_container_paddingTop">2px</dimen>
</resources>

View File

@@ -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 );
}

View File

@@ -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();

View File

@@ -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<IMusicView> {
}
});
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

View File

@@ -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<IMusicView> {
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

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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();

View File

@@ -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<MarkerResponse>() {
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" );
}
}
}
}

View File

@@ -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";
}

View File

@@ -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 {

View File

@@ -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 );
}
}
}

View File

@@ -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 >() {

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -0,0 +1,15 @@
package com.mogo.module.service.onlinecar.panel;
import androidx.fragment.app.FragmentActivity;
/**
* @author congtaowang
* @since 2020/9/21
* <p>
* 描述
*/
class ContainerHandler {
public static int sContainerId = 0;
public static FragmentActivity sAttachContext;
}

View File

@@ -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
* <p>
* 描述
*/
interface IOnlineCarPanelView extends IView {
void renderOnlineCarList( List< MarkerOnlineCar > onlineCars );
void renderEmptyUi( OnlineCarStrategy strategy );
void renderNoNavigationInfoUi();
void renderErrorUi();
}

View File

@@ -0,0 +1,85 @@
package com.mogo.module.service.onlinecar.panel;
public
/**
* @author congtaowang
* @since 2020/9/21
* <p>
* 描述
*/
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;
}
}

View File

@@ -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 ) {
}
}

View File

@@ -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
* <p>
* 描述
*/
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 );
}
}
}
}

View File

@@ -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
* <p>
* 描述
*/
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 );
}
}

View File

@@ -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
* <p>
* 描述
*/
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();
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.module.service.onlinecar.panel;
/**
* @author congtaowang
* @since 2020/9/21
* <p>
* 描述
*/
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;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#1F2131"/>
<corners android:radius="@dimen/module_services_panel_item_corner"/>
</shape>
</item>
</selector>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient android:angle="0" android:endColor="#676982" android:startColor="#8384A9" />
<corners android:radius="@dimen/module_services_panel_item_detail_bkg_corner" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient android:angle="0" android:endColor="#585E8B" android:startColor="#2E324B" />
<corners android:radius="@dimen/module_services_panel_strategy_button_bkg_corner" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/module_services_online_car_panel_marginRight"
android:layout_marginTop="@dimen/module_services_online_car_panel_marginTop"
android:layout_marginRight="@dimen/module_services_online_car_panel_marginRight"
android:layout_marginBottom="@dimen/module_services_online_car_panel_marginBottom"
android:background="@drawable/module_services_online_car_panel_background"
android:paddingLeft="@dimen/module_services_online_car_panel_paddingLeft"
android:paddingRight="@dimen/module_services_online_car_panel_paddingLeft">
<TextView
android:id="@+id/module_services_id_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_services_online_car_panel_close_margin_top"
android:text="目的地车友"
android:textColor="@color/module_services_online_car_panel_title_textColor"
android:textSize="@dimen/module_services_online_car_panel_title_text_size" />
<ImageView
android:id="@+id/module_services_id_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="@dimen/module_services_online_car_panel_close_margin_top"
android:src="@drawable/module_services_close" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/module_services_id_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/module_services_online_car_panel_recycler_view_margin_top"
android:overScrollMode="never" />
<LinearLayout
android:id="@+id/module_services_id_load_strategy_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/module_services_online_car_panel_empty_icon" />
<TextView
android:id="@+id/module_services_empty_tip"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/module_services_empty_tip_marginTop"
android:layout_height="wrap_content"
android:textColor="@color/module_services_empty_tip_textColor"
android:textSize="@dimen/module_services_empty_tip_textSize"
android:textStyle="bold"
tools:text="很抱歉目的地10km内未找到车友" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_services_panel_strategy_button_marginTop"
android:gravity="center">
<TextView
android:id="@+id/module_services_id_20Km_radius"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/module_services_load_strategy_marginRight"
android:background="@drawable/module_services_panel_strategy_button_bkg"
android:paddingLeft="@dimen/module_services_load_strategy_paddingLeft"
android:paddingTop="@dimen/module_services_load_strategy_paddingTop"
android:paddingRight="@dimen/module_services_load_strategy_paddingLeft"
android:paddingBottom="@dimen/module_services_load_strategy_paddingTop"
android:text="@string/module_services_str_20Km_radius"
android:textColor="@color/module_services_load_strategy_textColor"
android:textSize="@dimen/module_services_load_strategy_textSize"
android:textStyle="bold" />
<TextView
android:id="@+id/module_services_id_40Km_radius"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/module_services_panel_strategy_button_bkg"
android:paddingLeft="@dimen/module_services_load_strategy_paddingLeft"
android:paddingTop="@dimen/module_services_load_strategy_paddingTop"
android:paddingRight="@dimen/module_services_load_strategy_paddingLeft"
android:paddingBottom="@dimen/module_services_load_strategy_paddingTop"
android:text="@string/module_services_str_40Km_radius"
android:textColor="@color/module_services_load_strategy_textColor"
android:textSize="@dimen/module_services_load_strategy_textSize"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/module_services_id_error_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/module_services_online_car_panel_recycler_view_margin_top"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="加载失败,请点击重试"
android:textColor="#FFFFFF" />
</LinearLayout>
</FrameLayout>

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/module_services_panel_item_marginBottom"
android:background="@drawable/module_services_panel_item_bkg"
android:padding="@dimen/module_services_panel_item_padding">
<com.mogo.module.common.widget.CustomCircleImageView
android:id="@+id/module_services_id_panel_item_avatar"
android:layout_width="@dimen/module_services_panel_item_avatar_size"
android:layout_height="@dimen/module_services_panel_item_avatar_size"
android:src="@drawable/module_common_default_user_head"
app:civ_border_color="@color/module_services_id_panel_item_avatar_border_color"
app:civ_border_width="@dimen/module_services_id_panel_item_avatar_border_width"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_services_id_panel_item_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/module_services_panel_item_nickname_marginLeft"
android:textColor="@color/module_services_panel_item_nickname_textColor"
android:textSize="@dimen/module_services_panel_item_nickname_textSize"
app:layout_constraintLeft_toRightOf="@+id/module_services_id_panel_item_avatar"
app:layout_constraintTop_toTopOf="parent"
tools:text="1111111" />
<TextView
android:id="@+id/module_services_id_panel_item_distance_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/module_services_panel_item_distance_textColor"
android:textSize="@dimen/module_services_panel_item_distance_textSize"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/module_services_id_panel_item_nickname"
android:text="@string/module_services_panel_item_distance_tag_text" />
<TextView
android:id="@+id/module_services_id_panel_item_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/module_services_id_panel_item_distance_marginLeft"
android:textColor="@color/module_services_panel_item_nickname_textColor"
android:textSize="@dimen/module_services_panel_item_distance_textSize"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/module_services_id_panel_item_distance_tag"
tools:text="980M" />
<TextView
android:id="@+id/module_services_id_panel_item_detail"
android:layout_width="wrap_content"
android:background="@drawable/module_services_panel_item_detail_bkg"
android:layout_height="wrap_content"
android:padding="@dimen/module_services_panel_item_detail_padding"
android:text="@string/module_services_panel_item_detail_text"
android:textColor="@color/module_services_panel_item_detail_textColor"
android:textSize="@dimen/module_services_panel_item_detail_textSize"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -22,4 +22,35 @@
<dimen name="module_service_content_minWidth">64px</dimen>
<dimen name="module_service_id_marker_content_paddingRight">6.5px</dimen>
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">10px</dimen>
<dimen name="module_services_online_car_panel_marginTop">2px</dimen>
<dimen name="module_services_online_car_panel_marginBottom">2px</dimen>
<dimen name="module_services_online_car_panel_marginRight">8px</dimen>
<dimen name="module_services_online_car_panel_paddingLeft">28px</dimen>
<dimen name="module_services_online_car_panel_paddingBottom">16px</dimen>
<dimen name="module_services_online_car_panel_close_margin_top">20px</dimen>
<dimen name="module_services_online_car_panel_title_margin_top">28px</dimen>
<dimen name="module_services_online_car_panel_title_text_size">20px</dimen>
<dimen name="module_services_online_car_panel_recycler_view_margin_top">84px</dimen>
<dimen name="module_services_load_strategy_textSize">18px</dimen>
<dimen name="module_services_panel_item_avatar_size">58px</dimen>
<dimen name="module_services_panel_item_detail_textSize">14px</dimen>
<dimen name="module_services_panel_item_distance_textSize">16px</dimen>
<dimen name="module_services_panel_item_nickname_textSize">18px</dimen>
<dimen name="module_services_id_panel_item_avatar_border_width">5px</dimen>
<dimen name="module_services_panel_item_padding">20px</dimen>
<dimen name="module_services_panel_item_nickname_marginLeft">13px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">42px</dimen>
<dimen name="module_services_panel_item_detail_bkg_corner">8.89px</dimen>
<dimen name="module_services_panel_item_detail_padding">13px</dimen>
<dimen name="module_services_panel_item_marginBottom">16px</dimen>
<dimen name="module_services_panel_strategy_button_bkg_corner">25px</dimen>
<dimen name="module_services_load_strategy_paddingTop">13px</dimen>
<dimen name="module_services_load_strategy_paddingLeft">26px</dimen>
<dimen name="module_services_load_strategy_marginRight">20px</dimen>
<dimen name="module_services_empty_tip_textSize">18px</dimen>
<dimen name="module_services_empty_tip_marginTop">17px</dimen>
<dimen name="module_services_panel_strategy_button_marginTop">60px</dimen>
<dimen name="module_services_panel_item_corner">12.5px</dimen>
</resources>

View File

@@ -22,4 +22,35 @@
<dimen name="module_service_content_minWidth">64px</dimen>
<dimen name="module_service_id_marker_content_paddingRight">6.5px</dimen>
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">10px</dimen>
<dimen name="module_services_online_car_panel_marginTop">2px</dimen>
<dimen name="module_services_online_car_panel_marginBottom">2px</dimen>
<dimen name="module_services_online_car_panel_marginRight">8px</dimen>
<dimen name="module_services_online_car_panel_paddingLeft">28px</dimen>
<dimen name="module_services_online_car_panel_paddingBottom">16px</dimen>
<dimen name="module_services_online_car_panel_close_margin_top">20px</dimen>
<dimen name="module_services_online_car_panel_title_margin_top">28px</dimen>
<dimen name="module_services_online_car_panel_title_text_size">20px</dimen>
<dimen name="module_services_online_car_panel_recycler_view_margin_top">84px</dimen>
<dimen name="module_services_load_strategy_textSize">18px</dimen>
<dimen name="module_services_panel_item_avatar_size">58px</dimen>
<dimen name="module_services_panel_item_detail_textSize">14px</dimen>
<dimen name="module_services_panel_item_distance_textSize">16px</dimen>
<dimen name="module_services_panel_item_nickname_textSize">18px</dimen>
<dimen name="module_services_id_panel_item_avatar_border_width">5px</dimen>
<dimen name="module_services_panel_item_padding">20px</dimen>
<dimen name="module_services_panel_item_nickname_marginLeft">13px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">42px</dimen>
<dimen name="module_services_panel_item_detail_bkg_corner">8.89px</dimen>
<dimen name="module_services_panel_item_detail_padding">13px</dimen>
<dimen name="module_services_panel_item_marginBottom">16px</dimen>
<dimen name="module_services_panel_strategy_button_bkg_corner">25px</dimen>
<dimen name="module_services_load_strategy_paddingTop">13px</dimen>
<dimen name="module_services_load_strategy_paddingLeft">26px</dimen>
<dimen name="module_services_load_strategy_marginRight">40px</dimen>
<dimen name="module_services_empty_tip_textSize">18px</dimen>
<dimen name="module_services_empty_tip_marginTop">28px</dimen>
<dimen name="module_services_panel_strategy_button_marginTop">108px</dimen>
<dimen name="module_services_panel_item_corner">12.5px</dimen>
</resources>

View File

@@ -22,4 +22,35 @@
<dimen name="module_service_tag_textSize">20px</dimen>
<dimen name="module_service_content_minWidth">120px</dimen>
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">20px</dimen>
<dimen name="module_services_online_car_panel_marginTop">20px</dimen>
<dimen name="module_services_online_car_panel_marginBottom">20px</dimen>
<dimen name="module_services_online_car_panel_marginRight">20px</dimen>
<dimen name="module_services_online_car_panel_paddingLeft">50px</dimen>
<dimen name="module_services_online_car_panel_paddingBottom">28px</dimen>
<dimen name="module_services_online_car_panel_close_margin_top">36px</dimen>
<dimen name="module_services_online_car_panel_title_margin_top">50px</dimen>
<dimen name="module_services_online_car_panel_title_text_size">36px</dimen>
<dimen name="module_services_online_car_panel_recycler_view_margin_top">151px</dimen>
<dimen name="module_services_load_strategy_textSize">33px</dimen>
<dimen name="module_services_panel_item_avatar_size">102px</dimen>
<dimen name="module_services_panel_item_detail_textSize">26px</dimen>
<dimen name="module_services_panel_item_distance_textSize">30px</dimen>
<dimen name="module_services_panel_item_nickname_textSize">34px</dimen>
<dimen name="module_services_id_panel_item_avatar_border_width">9px</dimen>
<dimen name="module_services_panel_item_padding">40px</dimen>
<dimen name="module_services_panel_item_nickname_marginLeft">20px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">70px</dimen>
<dimen name="module_services_panel_item_detail_bkg_corner">16px</dimen>
<dimen name="module_services_panel_item_detail_padding">21px</dimen>
<dimen name="module_services_panel_item_marginBottom">28px</dimen>
<dimen name="module_services_panel_strategy_button_bkg_corner">45px</dimen>
<dimen name="module_services_load_strategy_paddingTop">22px</dimen>
<dimen name="module_services_load_strategy_paddingLeft">42px</dimen>
<dimen name="module_services_load_strategy_marginRight">40px</dimen>
<dimen name="module_services_empty_tip_textSize">34px</dimen>
<dimen name="module_services_empty_tip_marginTop">17px</dimen>
<dimen name="module_services_panel_strategy_button_marginTop">108px</dimen>
<dimen name="module_services_panel_item_corner">22.5px</dimen>
</resources>

View File

@@ -22,4 +22,35 @@
<dimen name="module_service_tag_textSize">20px</dimen>
<dimen name="module_service_content_minWidth">120px</dimen>
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">20px</dimen>
<dimen name="module_services_online_car_panel_marginTop">20px</dimen>
<dimen name="module_services_online_car_panel_marginBottom">20px</dimen>
<dimen name="module_services_online_car_panel_marginRight">20px</dimen>
<dimen name="module_services_online_car_panel_paddingLeft">50px</dimen>
<dimen name="module_services_online_car_panel_paddingBottom">28px</dimen>
<dimen name="module_services_online_car_panel_close_margin_top">36px</dimen>
<dimen name="module_services_online_car_panel_title_margin_top">50px</dimen>
<dimen name="module_services_online_car_panel_title_text_size">36px</dimen>
<dimen name="module_services_online_car_panel_recycler_view_margin_top">151px</dimen>
<dimen name="module_services_load_strategy_textSize">33px</dimen>
<dimen name="module_services_panel_item_avatar_size">102px</dimen>
<dimen name="module_services_panel_item_detail_textSize">26px</dimen>
<dimen name="module_services_panel_item_distance_textSize">30px</dimen>
<dimen name="module_services_panel_item_nickname_textSize">34px</dimen>
<dimen name="module_services_id_panel_item_avatar_border_width">9px</dimen>
<dimen name="module_services_panel_item_padding">40px</dimen>
<dimen name="module_services_panel_item_nickname_marginLeft">20px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">70px</dimen>
<dimen name="module_services_panel_item_detail_bkg_corner">16px</dimen>
<dimen name="module_services_panel_item_detail_padding">21px</dimen>
<dimen name="module_services_panel_item_marginBottom">28px</dimen>
<dimen name="module_services_panel_strategy_button_bkg_corner">45px</dimen>
<dimen name="module_services_load_strategy_paddingTop">22px</dimen>
<dimen name="module_services_load_strategy_paddingLeft">42px</dimen>
<dimen name="module_services_load_strategy_marginRight">20px</dimen>
<dimen name="module_services_empty_tip_textSize">34px</dimen>
<dimen name="module_services_empty_tip_marginTop">28px</dimen>
<dimen name="module_services_panel_strategy_button_marginTop">60px</dimen>
<dimen name="module_services_panel_item_corner">22.5px</dimen>
</resources>

View File

@@ -1,4 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_service_info_window_content_textColor">#ffffff</color>
<color name="module_services_online_car_panel_title_textColor">#FFFFFFFF</color>
<color name="module_services_load_strategy_textColor">#FFFFFF</color>
<color name="module_services_panel_item_nickname_textColor">#FFFFFF</color>
<color name="module_services_panel_item_distance_textColor">#7FFFFFFF</color>
<color name="module_services_panel_item_detail_textColor">#FFFFFF</color>
<color name="module_services_id_panel_item_avatar_border_color">#3081A4DC</color>
<color name="module_services_empty_tip_textColor">#B2FFFFFF</color>
</resources>

View File

@@ -22,4 +22,35 @@
<dimen name="module_service_tag_textSize">20px</dimen>
<dimen name="module_service_content_minWidth">120px</dimen>
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">20px</dimen>
<dimen name="module_services_online_car_panel_marginTop">2px</dimen>
<dimen name="module_services_online_car_panel_marginBottom">2px</dimen>
<dimen name="module_services_online_car_panel_marginRight">8px</dimen>
<dimen name="module_services_online_car_panel_paddingLeft">28px</dimen>
<dimen name="module_services_online_car_panel_paddingBottom">16px</dimen>
<dimen name="module_services_online_car_panel_close_margin_top">20px</dimen>
<dimen name="module_services_online_car_panel_title_margin_top">28px</dimen>
<dimen name="module_services_online_car_panel_title_text_size">20px</dimen>
<dimen name="module_services_online_car_panel_recycler_view_margin_top">84px</dimen>
<dimen name="module_services_load_strategy_textSize">18px</dimen>
<dimen name="module_services_panel_item_avatar_size">58px</dimen>
<dimen name="module_services_panel_item_detail_textSize">14px</dimen>
<dimen name="module_services_panel_item_distance_textSize">16px</dimen>
<dimen name="module_services_panel_item_nickname_textSize">18px</dimen>
<dimen name="module_services_id_panel_item_avatar_border_width">5px</dimen>
<dimen name="module_services_panel_item_padding">20px</dimen>
<dimen name="module_services_panel_item_nickname_marginLeft">13px</dimen>
<dimen name="module_services_id_panel_item_distance_marginLeft">42px</dimen>
<dimen name="module_services_panel_item_detail_bkg_corner">8.89px</dimen>
<dimen name="module_services_panel_item_detail_padding">13px</dimen>
<dimen name="module_services_panel_item_marginBottom">16px</dimen>
<dimen name="module_services_panel_strategy_button_bkg_corner">25px</dimen>
<dimen name="module_services_load_strategy_paddingTop">13px</dimen>
<dimen name="module_services_load_strategy_paddingLeft">26px</dimen>
<dimen name="module_services_load_strategy_marginRight">20px</dimen>
<dimen name="module_services_empty_tip_textSize">18px</dimen>
<dimen name="module_services_empty_tip_marginTop">17px</dimen>
<dimen name="module_services_panel_strategy_button_marginTop">60px</dimen>
<dimen name="module_services_panel_item_corner">12.5px</dimen>
</resources>

View File

@@ -4,4 +4,8 @@
<string name="module_service_launcher_card_tips">你的周围有%d个%s请点击查看你也可以对我说打开蘑菇出行</string>
<string name="module_service_launcher_card_info">周围有%d个%s</string>
<string name="module_service_open_app_tip">建议开启蘑菇出行,守护你的每一段行程,你可以直接对我说,打开蘑菇出行</string>
<string name="module_services_str_20Km_radius">扩大到20KM半径</string>
<string name="module_services_str_40Km_radius">扩大到40KM半径</string>
<string name="module_services_panel_item_distance_tag_text">距离导航目的地</string>
<string name="module_services_panel_item_detail_text">查看车友信息</string>
</resources>

View File

@@ -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<String, Object> 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() );
}
}

View File

@@ -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();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:bottomLeftRadius="@dimen/module_widgets_app_bkg_corner" android:bottomRightRadius="@dimen/module_widgets_app_bkg_corner" android:topLeftRadius="0px" android:topRightRadius="0px" />
<solid android:color="#3D3F44" />
</shape>
</item>
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:bottomLeftRadius="0px" android:bottomRightRadius="0px" android:topLeftRadius="@dimen/module_widgets_app_bkg_corner" android:topRightRadius="@dimen/module_widgets_app_bkg_corner" />
<solid android:color="#3D3F44" />
</shape>
</item>
</selector>

View File

@@ -1,17 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/module_widgets_app_entrance_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/module_widgets_app_entrance_img_bkg"
android:gravity="center"
android:orientation="vertical">
<TextView
<LinearLayout
android:id="@+id/module_widgets_app_handler_container"
android:layout_width="wrap_content"
android:layout_height="@dimen/module_widgets_app_entrance_size"
android:gravity="center"
android:text="@string/module_widgets_app_entrance_text"
android:textColor="#FFFFFF"
android:textSize="@dimen/module_widgets_app_entrance_textSize" />
android:layout_height="wrap_content"
android:background="@drawable/module_widgets_app_handler_bkg">
<ImageView
android:id="@+id/module_widgets_app_handler"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/ic_1" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/module_widgets_app_body_bkg">
<TextView
android:id="@+id/module_widgets_app_entrance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="@dimen/module_widgets_app_entrance_paddingLeft"
android:paddingTop="@dimen/module_widgets_app_entrance_paddingTop"
android:paddingRight="@dimen/module_widgets_app_entrance_paddingLeft"
android:paddingBottom="@dimen/module_widgets_app_entrance_paddingTop"
android:text="@string/module_widgets_app_entrance_text"
android:textColor="@color/module_widgets_app_entrance_textColor"
android:textSize="@dimen/module_widgets_app_entrance_textSize"
android:textStyle="bold" />
<View
android:layout_width="1px"
android:layout_height="50px"
android:layout_gravity="center_vertical"
android:background="#7FFFFFFF" />
<TextView
android:id="@+id/module_widgets_app_consult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="@dimen/module_widgets_app_entrance_paddingLeft"
android:paddingTop="@dimen/module_widgets_app_entrance_paddingTop"
android:paddingRight="@dimen/module_widgets_app_entrance_paddingLeft"
android:paddingBottom="@dimen/module_widgets_app_entrance_paddingTop"
android:text="@string/module_widgets_app_entrance_consult"
android:textColor="@color/module_widgets_app_entrance_textColor"
android:textSize="@dimen/module_widgets_app_entrance_textSize"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>

View File

@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_widgets_app_entrance_textSize">20px</dimen>
<dimen name="module_widgets_app_entrance_textSize">22px</dimen>
<dimen name="module_widgets_app_entrance_padding">15px</dimen>
<dimen name="module_widgets_app_entrance_corner_size">2px</dimen>
<dimen name="module_widgets_app_entrance_y">505px</dimen>
<dimen name="module_widgets_app_entrance_x">501px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">10px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">15px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">20px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">27px</dimen>
<dimen name="module_widgets_app_entrance_size">71px</dimen>
<dimen name="module_widgets_app_bkg_corner">4px</dimen>
</resources>

View File

@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_widgets_app_entrance_textSize">20px</dimen>
<dimen name="module_widgets_app_entrance_textSize">22px</dimen>
<dimen name="module_widgets_app_entrance_padding">15px</dimen>
<dimen name="module_widgets_app_entrance_corner_size">2px</dimen>
<dimen name="module_widgets_app_entrance_y">505px</dimen>
<dimen name="module_widgets_app_entrance_x">501px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">10px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">15px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">20px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">27px</dimen>
<dimen name="module_widgets_app_entrance_size">71px</dimen>
<dimen name="module_widgets_app_bkg_corner">4px</dimen>
</resources>

View File

@@ -5,7 +5,8 @@
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
<dimen name="module_widgets_app_entrance_y">48px</dimen>
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">10px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">15px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">37px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">50px</dimen>
<dimen name="module_widgets_app_entrance_size">71px</dimen>
<dimen name="module_widgets_app_bkg_corner">8px</dimen>
</resources>

View File

@@ -5,7 +5,8 @@
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
<dimen name="module_widgets_app_entrance_y">48px</dimen>
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">10px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">15px</dimen>
<dimen name="module_widgets_app_entrance_paddingTop">37px</dimen>
<dimen name="module_widgets_app_entrance_paddingLeft">50px</dimen>
<dimen name="module_widgets_app_entrance_size">71px</dimen>
<dimen name="module_widgets_app_bkg_corner">8px</dimen>
</resources>

Some files were not shown because too many files have changed in this diff Show More