Merge branch 'dev' into demo/shunyi_v2v_merge

# Conflicts:
#	app/src/main/java/com/mogo/launcher/MogoApplication.java
#	config.gradle
#	foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java
#	modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
#	modules/mogo-module-extensions/src/main/res/values-mdpi/dimens.xml
#	modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml
#	modules/mogo-module-extensions/src/main/res/values/dimens.xml
#	modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java
#	modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help.xml
#	modules/mogo-module-v2x/src/main/res/values-xhdpi/dimens.xml
#	modules/mogo-module-v2x/src/main/res/values/dimens.xml
#	services/mogo-service-api/src/main/java/com/mogo/service/IMogoServiceApis.java
#	services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java
#	upload.sh
This commit is contained in:
wangcongtao
2020-10-18 16:40:27 +08:00
479 changed files with 7101 additions and 8317 deletions

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

@@ -6,14 +6,12 @@ import androidx.lifecycle.LifecycleOwner;
import com.mogo.commons.mvp.Presenter;
import com.mogo.module.apps.applaunch.AppLaunchFilter;
import com.mogo.module.apps.applaunch.AppLauncher;
import com.mogo.module.apps.applaunch.CardAppLauncher;
import com.mogo.module.apps.applaunch.GuideShowLauncher;
import com.mogo.module.apps.applaunch.InternalFunctionLauncher;
import com.mogo.module.apps.model.AppInfo;
import com.mogo.module.apps.model.AppsModel;
import com.mogo.module.apps.model.UnScannedApps;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.utils.ThreadPoolService;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
@@ -38,16 +36,11 @@ public class AppsPresenter extends Presenter< AppsView > {
private IMogoAnalytics mAnalytics;
private AppLaunchFilter mLauncher;
private IMogoCardManager mCardManager;
public AppsPresenter( AppsView view ) {
super( view );
mCardManager = AppServiceHandler.getApis().getCardManagerApi();
InternalFunctionLauncher internalFunctionLauncher = new InternalFunctionLauncher( getContext() );
CardAppLauncher cardAppLauncher = new CardAppLauncher( this, mCardManager );
GuideShowLauncher guideShowLauncher = new GuideShowLauncher( AppServiceHandler.getApis().getMapServiceApi().getNavi( getContext() ) );
internalFunctionLauncher.setNext( cardAppLauncher );
cardAppLauncher.setNext( guideShowLauncher );
internalFunctionLauncher.setNext( guideShowLauncher );
guideShowLauncher.setNext( new AppLauncher() );
mLauncher = internalFunctionLauncher;
}
@@ -217,7 +210,6 @@ public class AppsPresenter extends Presenter< AppsView > {
mView = null;
mLauncher.destroy();
mAnalytics = null;
mCardManager = null;
if ( mLauncher != null ) {
mLauncher.destroy();
}

View File

@@ -1,52 +0,0 @@
package com.mogo.module.apps.applaunch;
import android.content.Context;
import com.mogo.module.apps.AppsPresenter;
import com.mogo.module.apps.model.AppInfo;
import com.mogo.service.cardmanager.IMogoCardManager;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
* @since 2020-02-09
* <p>
* 描述
*/
public class CardAppLauncher extends BaseAppLauncher {
private static Map< String, String > sCardApps = new HashMap<>();
static {
sCardApps.put( "com.zhidao.roadcondition.split", "CARD_TYPE_ROAD_CONDITION" );
sCardApps.put( "com.zhidao.roadcondition", "CARD_TYPE_ROAD_CONDITION" );
sCardApps.put( "com.zhidao.imdemo", "CARD_TYPE_CARS_CHATTING" );
}
private AppsPresenter mAppsPresenter;
private IMogoCardManager mCardManager;
public CardAppLauncher( AppsPresenter mAppsPresenter, IMogoCardManager mCardManager ) {
this.mAppsPresenter = mAppsPresenter;
this.mCardManager = mCardManager;
}
@Override
public void launch( Context context, AppInfo appInfo ) {
if ( getNext() != null ) {
getNext().launch( context, appInfo );
}
}
@Override
public void destroy() {
mAppsPresenter = null;
mCardManager = null;
if ( getNext() != null ) {
getNext().destroy();
setNext( null );
}
}
}

View File

@@ -156,7 +156,8 @@ public class AppsModel {
if ( totalPages == 0 ) {
return 0;
} else {
if ( mPagedApps.get( totalPages - 1 ).size() == AppsConst.TOTAL_SIZE_EACH_PAGE ) {
if ( mPagedApps.get( totalPages - 1 ) == null
|| mPagedApps.get( totalPages - 1 ).size() == AppsConst.TOTAL_SIZE_EACH_PAGE ) {
return totalPages;
} else {
return totalPages - 1;

View File

@@ -27,10 +27,10 @@ class OnAiAssistClickListener implements View.OnClickListener {
@Override
public void onClick( View v ) {
if ( Devices.isBind() || !DebugConfig.isActiveAIAssistFlag() ) {
AIAssist.startAssistant( v.getContext() );
AIAssist.getInstance( v.getContext() ).startAssistant( v.getContext() );
} else {
if ( mDebugModeOpen ) {
AIAssist.startAssistant( v.getContext(), 1 );
AIAssist.getInstance( v.getContext() ).startAssistant( v.getContext(), 1 );
return;
}
if ( mClickCounter == 0 ) {
@@ -38,7 +38,7 @@ class OnAiAssistClickListener implements View.OnClickListener {
mClickCounter++;
} else {
if ( mClickCounter == TOTAL_CLICK_AMOUNT ) {
AIAssist.startAssistant( v.getContext(), 2 );
AIAssist.getInstance( v.getContext() ).startAssistant( v.getContext(), 2 );
TipToast.shortTip( "开启语音调试" );
mClickCounter = 0;
mLastClickTime = 0L;

View File

@@ -11,6 +11,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener
import com.mogo.map.navi.IMogoNaviListener
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant.Companion.PATH_AGREEMENT_MODULE_NAME
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
import com.mogo.module.authorize.authprovider.launcher.MogoMainAuthorize
import com.mogo.module.authorize.authprovider.launcher.MogoMainAuthorize.Companion.mogoAuthShow
import com.mogo.module.authorize.util.SharedPreferenceUtil.hasGuide
import com.mogo.service.MogoServicePaths
@@ -91,4 +92,8 @@ class MogoAuthorizeProvider : IMogoAuthManager {
return null
}
override fun onDestroy() {
mContext = null
mogoAuthShow.release()
}
}

View File

@@ -2,6 +2,7 @@ package com.mogo.module.authorize.authprovider.launcher
import android.content.Context
import android.os.Looper
import com.mogo.commons.context.ContextHolderUtil
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeManagerImpl
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeRegisterHandler
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
@@ -82,7 +83,7 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
return
}
if (authorizeDialog == null) {
authorizeDialog = AuthorizeDialog(tag, mContext!!)
authorizeDialog = AuthorizeDialog(tag, ContextHolderUtil.getContext() ?: mContext!!)
authorizeDialog!!.setOnDismissListener {
authorizeDialog = null
}
@@ -96,4 +97,8 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
}
}
fun release(){
mContext = null
}
}

View File

@@ -6,7 +6,6 @@ import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeManagerImpl
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeRegisterHandler
import com.mogo.module.authorize.authprovider.launcher.MogoMainAuthorize.Companion.mogoAuthShow
import com.mogo.module.authorize.util.SharedPreferenceUtil
import com.mogo.module.authorize.util.isDeviceOfD
import com.mogo.service.module.IMogoModuleProvider
class MogoModuleAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMogoAuthorizeModuleProvider {
@@ -22,7 +21,7 @@ class MogoModuleAuthorize private constructor() : MogoAuthorizeManagerImpl(), IM
}
override fun invokeAuthorization(tag: String) {
if(isDeviceOfD() && !SharedPreferenceUtil.hasGuide()){
if(!SharedPreferenceUtil.hasGuide()){
val guideService = ARouter.getInstance().build("/guide/showFragment").navigation()
if(guideService is IMogoModuleProvider){
guideService.init(AbsMogoApplication.getApp().applicationContext)

View File

@@ -1,7 +1,6 @@
package com.mogo.module.authorize.layout
import android.content.Context
import android.graphics.drawable.ColorDrawable
import android.text.Html
import android.view.View
import android.widget.Button
@@ -207,4 +206,9 @@ class AuthorizeDialog : BaseFloatDialog, View.OnClickListener, IVoiceCommandList
showAuthorizationError()
})
}
override fun dismiss() {
super.dismiss()
mContext = null
}
}

View File

@@ -1,10 +0,0 @@
package com.mogo.module.authorize.util
import com.mogo.module.common.utils.CarSeries.*
fun isDeviceOfD(): Boolean {
return when (getSeries()) {
CAR_SERIES_D80X, CAR_SERIES_D81X, CAR_SERIES_D82X, CAR_SERIES_D84X -> true
else -> false
}
}

View File

@@ -1,7 +1,7 @@
package com.mogo.module.authorize.util
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.debug.DebugConfig.getSpGuide
import com.mogo.module.common.utils.SPConst.getSpGuide
import com.mogo.utils.storage.SharedPrefsMgr
object SharedPreferenceUtil {

View File

@@ -8,15 +8,10 @@ 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.commons.debug.DebugConfig;
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;
@@ -56,10 +51,21 @@ public class BackToLauncherModuleProvider implements IMogoModuleProvider {
@Override
public void init( Context context ) {
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
BackToMainHomeManager.addMainHomeView();
final String product = DebugConfig.getProductFlavor();
if ( product != null ) {
switch ( product ) {
case "f80x":
case "f8xx":
BackToMainHomeManager.addMainHomeView();
break;
case "changanauto":
if ( DebugConfig.isDebug() ) {
BackToMainHomeManager.addMainHomeView();
}
break;
}
}
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,8 @@ dependencies {
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.carcallprovider
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

@@ -1,4 +1,4 @@
package com.mogo.module.v2x.utils.animation;
package com.mogo.module.common.animation;
interface Animation {

View File

@@ -1,13 +1,12 @@
package com.mogo.module.v2x.utils.animation;
package com.mogo.module.common.animation;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
public class V2XAnimationManager implements Animation {
public class AnimationManager implements Animation {
private static final String TAG = "V2XAnimationManager";
private ProgressBar targetImageView;

View File

@@ -1,7 +1,7 @@
package com.mogo.module.v2x.utils.animation;
package com.mogo.module.common.animation;
import com.mogo.module.v2x.R;
import com.mogo.module.common.R;
public class AnimationResources {
public static final int loadingRes[] = {

View File

@@ -1,4 +1,4 @@
package com.mogo.module.v2x.utils.animation;
package com.mogo.module.common.animation;
import android.graphics.drawable.AnimationDrawable;

View File

@@ -0,0 +1,81 @@
package com.mogo.module.common.api;
import android.content.Context;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.module.carchattingprovider.ICarsChattingProvider;
import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.utils.logger.Logger;
import com.zhidao.carchattingprovider.MogoDriverInfo;
public
/**
* @author congtaowang
* @since 2020/9/24
*
* 车聊聊接口
*/
class CallChatApi {
private static final String TAG = "CallChatApi";
private static volatile CallChatApi sInstance;
private CallChatApi() {
mApiProvider = ARouter.getInstance().navigation( ICarsChattingProvider.class );
}
public static CallChatApi getInstance() {
if ( sInstance == null ) {
synchronized ( CallChatApi.class ) {
if ( sInstance == null ) {
sInstance = new CallChatApi();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
public ICarsChattingProvider getApiProvider() {
return mApiProvider;
}
private ICarsChattingProvider mApiProvider;
public void showUserWindow( Context context, MarkerOnlineCar onlineCar ) throws Exception {
if ( mApiProvider == null ) {
Logger.e( TAG, "no call chat api instance." );
return;
}
MogoDriverInfo driverInfo = new MogoDriverInfo();
driverInfo.setAge( onlineCar.getUserInfo().getAgeNumber() );
driverInfo.setCarTypeName( onlineCar.getCarInfo().getCarTypeName() );
driverInfo.setGender( onlineCar.getUserInfo().getGender() );
driverInfo.setLat( onlineCar.getLocation().getLat() );
driverInfo.setLon( onlineCar.getLocation().getLon() );
driverInfo.setLocationInfo( onlineCar.getLocation().getAddress() );
driverInfo.setSn( onlineCar.getUserInfo().getSn() );
driverInfo.setUserHead( onlineCar.getUserInfo().getUserHead() );
driverInfo.setUserName( onlineCar.getUserInfo().getUserName() );
mApiProvider.showUserWindow( TAG, driverInfo, context );
}
public void hideUserWindow( Context context ) {
if ( mApiProvider != null ) {
if ( mApiProvider == null ) {
Logger.e( TAG, "no call chat api instance." );
return;
}
}
mApiProvider.hideUserWindow( TAG, context, null );
}
}

View File

@@ -33,6 +33,19 @@ public class V2XMessageEntity<T> implements Serializable {
*/
boolean showState;
/**
* 是否需要判断重复事件
* true-判断false-不判断
* 默认需要判断
*/
boolean isNeedCompareSameScenario = true;
//是否播报tts
private boolean onlyShow = false;
//本机与事件是否连线
private boolean needAddLine = true;
/**
* 场景具体的数据内容
*/
@@ -54,6 +67,14 @@ public class V2XMessageEntity<T> implements Serializable {
this.showState = showState;
}
public boolean isNeedCompareSameScenario() {
return isNeedCompareSameScenario;
}
public void setNeedCompareSameScenario(boolean needCompareSameScenario) {
isNeedCompareSameScenario = needCompareSameScenario;
}
public T getContent() {
return content;
}
@@ -76,6 +97,22 @@ public class V2XMessageEntity<T> implements Serializable {
return Objects.hash(type, content);
}
public boolean isOnlyShow() {
return onlyShow;
}
public void setOnlyShow(boolean onlyShow) {
this.onlyShow = onlyShow;
}
public boolean isNeedAddLine() {
return needAddLine;
}
public void setNeedAddLine(boolean needAddLine) {
this.needAddLine = needAddLine;
}
/**
* V2X 场景类型
*/

View File

@@ -24,6 +24,7 @@ public class V2XRoadEventEntity implements Serializable {
private MarkerExploreWay noveltyInfo;
// tts 提示
private String tts;
// ADAS 展示文案
private String alarmContent;
// 距离当前车辆的距离

View File

@@ -1,7 +1,7 @@
package com.mogo.module.common.map;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.utils.CarSeries;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
@@ -18,112 +18,102 @@ public class MapCenterPointStrategy {
private static final String TAG = "MapCenterPointStrategy";
private static Map< Integer, Map< Integer, MapCenterPoint > > sStrategies = new HashMap<>();
private static Map< Integer, Map< String, MapCenterPoint > > sStrategies = new HashMap<>();
public static final MapCenterPoint DEFAULT = new MapCenterPoint( 0.677734D, 0.5733333D );
private static MapCenterPoint sLastPoint = DEFAULT;
public static void init() {
{
// 选点场景,定位中心点
Map< Integer, MapCenterPoint > choosePoint = new HashMap<>();
choosePoint.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.5D, 0.5D ) );
Map< String, MapCenterPoint > choosePoint = new HashMap<>();
choosePoint.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( "f80x", new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( "f8xx", new MapCenterPoint( 0.5D, 0.5D ) );
sStrategies.put( Scene.CHOOSE_POINT, choosePoint );
}
{
// 导航场景,定位视图右下角偏下
Map< Integer, MapCenterPoint > navi = new HashMap<>();
navi.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.573333333333D ) );
navi.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.573333333333D ) );
navi.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.573333333333D ) );
navi.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.705208333D, 0.575D ) );
Map< String, MapCenterPoint > navi = new HashMap<>();
navi.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.573333333333D ) );
navi.put( "em4", new MapCenterPoint( 0.734375D, 0.573333333333D ) );
navi.put( "e8xx", new MapCenterPoint( 0.734375D, 0.573333333333D ) );
navi.put( "f80x", new MapCenterPoint( 0.705208333D, 0.575D ) );
navi.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.575D ) );
sStrategies.put( Scene.NAVI, navi );
}
{
// 导航场景 vs 道路事件展示场景,定位视图右下角偏下
Map< Integer, MapCenterPoint > naviWithRoadEvent = new HashMap<>();
naviWithRoadEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.73936170212766D ) );
naviWithRoadEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.73936170212766D ) );
naviWithRoadEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.73936170212766D ) );
naviWithRoadEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.705208333D, 0.683333333333D ) );
Map< String, MapCenterPoint > naviWithRoadEvent = new HashMap<>();
naviWithRoadEvent.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.73936170212766D ) );
naviWithRoadEvent.put( "em4", new MapCenterPoint( 0.734375D, 0.73936170212766D ) );
naviWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.734375D, 0.73936170212766D ) );
naviWithRoadEvent.put( "f80x", new MapCenterPoint( 0.705208333D, 0.683333333333D ) );
naviWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.683333333333D ) );
sStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent );
}
{
// 巡航场景
Map< Integer, MapCenterPoint > aimless = new HashMap<>();
aimless.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.5D ) );
aimless.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.5D ) );
aimless.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.5D ) );
aimless.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.705208333D, 0.5D ) );
Map< String, MapCenterPoint > aimless = new HashMap<>();
aimless.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.5D ) );
aimless.put( "em4", new MapCenterPoint( 0.734375D, 0.5D ) );
aimless.put( "e8xx", new MapCenterPoint( 0.734375D, 0.5D ) );
aimless.put( "f80x", new MapCenterPoint( 0.705208333D, 0.5D ) );
aimless.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.5D ) );
sStrategies.put( Scene.AIMLESS, aimless );
}
{
// 巡航场景 vs 道路事件展示场景
Map< Integer, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>();
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.68617 ) );
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.734375D, 0.68617 ) );
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.734375D, 0.68617 ) );
aimlessWithRoadEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.705208333D, 0.599074074D ) );
Map< String, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>();
aimlessWithRoadEvent.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.68617 ) );
aimlessWithRoadEvent.put( "em4", new MapCenterPoint( 0.734375D, 0.68617 ) );
aimlessWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.734375D, 0.68617 ) );
aimlessWithRoadEvent.put( "f80x", new MapCenterPoint( 0.705208333D, 0.599074074D ) );
aimlessWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.599074074D ) );
sStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent );
}
{
// 规划路线,定位视图右边
Map< Integer, MapCenterPoint > calculatePath = new HashMap<>();
calculatePath.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.733398D, 0.610833D ) );
calculatePath.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.733398D, 0.610833D ) );
calculatePath.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.733398D, 0.610833D ) );
calculatePath.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.703125D, 0.6083333D ) );
Map< String, MapCenterPoint > calculatePath = new HashMap<>();
calculatePath.put( "d80x", new MapCenterPoint( 0.733398D, 0.610833D ) );
calculatePath.put( "em4", new MapCenterPoint( 0.733398D, 0.610833D ) );
calculatePath.put( "e8xx", new MapCenterPoint( 0.733398D, 0.610833D ) );
calculatePath.put( "f80x", new MapCenterPoint( 0.703125D, 0.6083333D ) );
calculatePath.put( "f8xx", new MapCenterPoint( 0.703125D, 0.6083333D ) );
sStrategies.put( Scene.CALCULATE_PATH, calculatePath );
}
{
// 分类搜索,定位视图右边
Map< Integer, MapCenterPoint > categorySearch = new HashMap<>();
categorySearch.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.733398D, 0.5D ) );
categorySearch.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.733398D, 0.5D ) );
categorySearch.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.733398D, 0.5D ) );
categorySearch.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.733594D, 0.5D ) );
Map< String, MapCenterPoint > categorySearch = new HashMap<>();
categorySearch.put( "d80x", new MapCenterPoint( 0.733398D, 0.5D ) );
categorySearch.put( "em4", new MapCenterPoint( 0.733398D, 0.5D ) );
categorySearch.put( "e8xx", new MapCenterPoint( 0.733398D, 0.5D ) );
categorySearch.put( "f80x", new MapCenterPoint( 0.733594D, 0.5D ) );
categorySearch.put( "f8xx", new MapCenterPoint( 0.733594D, 0.5D ) );
sStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
}
{
// V2X场景视图右边
Map< Integer, MapCenterPoint > categoryV2XEvent = new HashMap<>();
categoryV2XEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.669444444444444, 0.7D ) );
categoryV2XEvent.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.677734375D, 0.7D ) );
categoryV2XEvent.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.677734375D, 0.7D ) );
categoryV2XEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.6963541D, 0.65D ) );
Map< String, MapCenterPoint > categoryV2XEvent = new HashMap<>();
categoryV2XEvent.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.7D ) );
categoryV2XEvent.put( "em4", new MapCenterPoint( 0.677734375D, 0.7D ) );
categoryV2XEvent.put( "e8xx", new MapCenterPoint( 0.677734375D, 0.7D ) );
categoryV2XEvent.put( "f80x", new MapCenterPoint( 0.6963541D, 0.65D ) );
categoryV2XEvent.put( "f8xx", new MapCenterPoint( 0.6963541D, 0.65D ) );
sStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
}
try {
sLastPoint = sStrategies.get( Scene.AIMLESS ).get( CarSeries.getSeries() );
} catch ( Exception e ) {
sLastPoint = DEFAULT;
}
}
public static void restoreLastScene( IMogoMapUIController controller ) {
if ( sLastPoint == null ) {
return;
}
if ( controller == null ) {
return;
}
controller.setPointToCenter( sLastPoint.x, sLastPoint.y );
}
public static void addScene( int scene, Map< Integer, MapCenterPoint > config ) {
public static void addScene( int scene, Map< String, MapCenterPoint > config ) {
if ( sStrategies.containsKey( scene ) ) {
Logger.w( TAG, "scene has already defined, append config..." );
}
@@ -147,25 +137,21 @@ public class MapCenterPointStrategy {
if ( !sStrategies.containsKey( scene ) ) {
Logger.w( TAG, "no strategy for scene: %s, use DEFAULT", scene );
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
sLastPoint = DEFAULT;
return;
}
Map< Integer, MapCenterPoint > points = sStrategies.get( scene );
int car = CarSeries.getSeries();
Map< String, MapCenterPoint > points = sStrategies.get( scene );
String car = DebugConfig.getProductFlavor();
if ( !points.containsKey( car ) ) {
Logger.w( TAG, "no strategy for series: %s, use DEFAULT", scene );
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
sLastPoint = DEFAULT;
return;
}
MapCenterPoint point = points.get( car );
if ( point == null ) {
Logger.w( TAG, "no strategy config for series: %s, use DEFAULT", scene );
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
sLastPoint = DEFAULT;
return;
}
sLastPoint = point;
controller.setPointToCenter( point.x, point.y );
}

View File

@@ -0,0 +1,10 @@
package com.mogo.module.common.utils;
public class Const {
/**
* V2X 场景广播 Action
*/
public static final String BROADCAST_SCENE_HANDLER_ACTION = "com.v2x.scene_handler_broadcast";
public static final String BROADCAST_SCENE_EXTRA_KEY = "V2XMessageEntity";
}

View File

@@ -0,0 +1,22 @@
package com.mogo.module.common.utils;
/**
* 多模块之间SP状态公共类
*/
public class SPConst {
private static String SP_GUIDE = "SP_GUIDE_2020_09_09";
//用于多模块之间引导状态判断
public static String getSpGuide() {
return SP_GUIDE;
}
private static String SP_GUIDE_FIRST_TIME_RECORD = "SP_GUIDE_FIRST_TIME_RECORD";
//用于多模块之间首次引导时间记录
public static String getSPGuideRecord(){
return SP_GUIDE_FIRST_TIME_RECORD;
}
}

View File

@@ -0,0 +1,298 @@
package com.mogo.module.common.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.mogo.module.common.R;
import java.math.BigDecimal;
public class CustomRatingBar extends LinearLayout {
private Context mContext;
/*
是否可点击
* */
private boolean mClickable;
/*
* 单元总数(心形/星星)
* */
private int elementCount;
/*
* 单元点击事件
* */
private OnRatingChangeListener mOnRatingBarChangeListener;
/*
* 每个单元的大小
* */
private float elementWidth;
private float elementHeight;
public float getElementWidth() {
return elementWidth;
}
public void setElementWidth(float elementWidth) {
this.elementWidth = elementWidth;
}
public float getElementHeight() {
return elementHeight;
}
public void setElementHeight(float elementHeight) {
this.elementHeight = elementHeight;
}
/*
* 每个单元间的距离
* */
private float elementPadding;
/*
*单元的显示数量,支持小数点
* */
private float elementStep;
/*
* 空白的默认单元图片
* */
private Drawable elementEmptyDrawable;
/*
* 选中后的单元图片
* */
private Drawable elementFillDrawable;
/*
* 半颗单元图片
* */
private Drawable elementHarfDrawable;
/*
* 每次点击单元所增加的量是半个还是整个
* */
private StepSize stepSize;
@Override
public boolean isClickable() {
return mClickable;
}
@Override
public void setClickable(boolean clickable) {
mClickable = clickable;
}
public int getElementCount() {
return elementCount;
}
public void setElementCount(int elementCount) {
this.elementCount = elementCount;
}
public OnRatingChangeListener getOnRatingBarChangeListener() {
return mOnRatingBarChangeListener;
}
public void setOnRatingChangeListener(OnRatingChangeListener onRatingBarChangeListener) {
mOnRatingBarChangeListener = onRatingBarChangeListener;
}
public float getElementPadding() {
return elementPadding;
}
public void setElementPadding(float elementPadding) {
this.elementPadding = elementPadding;
}
public float getElementStep() {
return elementStep;
}
public void setElementStep(float elementStep) {
this.elementStep = elementStep;
}
public Drawable getElementEmptyDrawable() {
return elementEmptyDrawable;
}
public void setElementEmptyDrawable(Drawable elementEmptyDrawable) {
this.elementEmptyDrawable = elementEmptyDrawable;
}
public Drawable getElementFillDrawable() {
return elementFillDrawable;
}
public void setElementFillDrawable(Drawable elementFillDrawable) {
this.elementFillDrawable = elementFillDrawable;
}
public Drawable getElementHarfDrawable() {
return elementHarfDrawable;
}
public void setElementHarfDrawable(Drawable elementHarfDrawable) {
this.elementHarfDrawable = elementHarfDrawable;
}
public void setStepSize(StepSize stepSize) {
this.stepSize = stepSize;
}
public CustomRatingBar(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
mContext = context;
setOrientation(LinearLayout.HORIZONTAL);
TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.CustomRatingBar);
elementWidth = mTypedArray.getDimension(R.styleable.CustomRatingBar_elenmentWidth,
context.getResources().getDimension(R.dimen.heart_ratingbar_width));
elementHeight = mTypedArray.getDimension(R.styleable.CustomRatingBar_elenmentHeight,
context.getResources().getDimension(R.dimen.heart_ratingbar_height));
elementPadding = mTypedArray.getDimension(R.styleable.CustomRatingBar_elenmentPadding, 10);
elementStep = mTypedArray.getFloat(R.styleable.CustomRatingBar_elenmentStep, 1.0f);
stepSize = StepSize.fromStep(mTypedArray.getInt(R.styleable.CustomRatingBar_stepSize, 1));
elementCount = mTypedArray.getInteger(R.styleable.CustomRatingBar_elenmentCount, 5);
stepSize = StepSize.Half;
Drawable drawable_empty_default = ContextCompat.getDrawable(context, R.drawable.icon_heart_unchoose);
Drawable drawable_harf_default = ContextCompat.getDrawable(context, R.drawable.icon_heart_second);
Drawable drawable_fill_default = ContextCompat.getDrawable(context, R.drawable.icon_heart_choose);
Drawable drawable_empty = mTypedArray.getDrawable(R.styleable.CustomRatingBar_elenmentEmpty);
Drawable drawable_harf = mTypedArray.getDrawable(R.styleable.CustomRatingBar_elenmentHarf);
Drawable drawable_fill = mTypedArray.getDrawable(R.styleable.CustomRatingBar_elenmentFill);
elementEmptyDrawable = drawable_empty != null ? drawable_empty : drawable_empty_default;
elementFillDrawable = drawable_harf != null ? drawable_harf : drawable_fill_default;
elementHarfDrawable = drawable_fill != null ? drawable_fill : drawable_harf_default;
mClickable = mTypedArray.getBoolean(R.styleable.CustomRatingBar_clickable, false);
mTypedArray.recycle();
for (int i = 0; i < elementCount; ++i) {
final ImageView imageView = getElenmentImageView();
imageView.setImageDrawable(elementEmptyDrawable);
imageView.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
if (mClickable) {
//浮点数的整数部分
int fint = (int) elementStep;
BigDecimal b1 = new BigDecimal(Float.toString(elementStep));
BigDecimal b2 = new BigDecimal(Integer.toString(fint));
//浮点数的小数部分
float fPoint = b1.subtract(b2).floatValue();
if (fPoint == 0) {
fint -= 1;
}
if (indexOfChild(v) > fint) {
setRating(indexOfChild(v) + 1);
} else if (indexOfChild(v) == fint) {
if (stepSize == StepSize.Full) {//如果是满星 就不考虑半颗星了
return;
}
//点击之后默认每次先增加一颗星,再次点击变为半颗星
if (imageView.getDrawable().getCurrent().getConstantState().
equals(elementHarfDrawable.getConstantState())) {
setRating(indexOfChild(v) + 1);
} else {
setRating(indexOfChild(v) + 0.5f);
}
} else {
setRating(indexOfChild(v) + 1f);
}
}
}
}
);
addView(imageView);
}
setRating(elementStep);
}
private ImageView getElenmentImageView() {
ImageView imageView = new ImageView(getContext());
LayoutParams layout = new LayoutParams(
Math.round(mContext.getResources().getDimension(R.dimen.heart_ratingbar_width)),
Math.round(mContext.getResources().getDimension(R.dimen.heart_ratingbar_width)));//设置每个单元格在线性布局的大小
layout.setMargins(0, 0, Math.round(elementPadding), 0);//设置每颗星星在线性布局的间距
imageView.setLayoutParams(layout);
imageView.setAdjustViewBounds(true);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setImageDrawable(elementEmptyDrawable);
imageView.setMinimumWidth((int) elementWidth);
imageView.setMaxWidth((int) elementWidth);
imageView.setMinimumHeight((int) elementHeight);
imageView.setMaxHeight((int) elementHeight);
return imageView;
}
public void setRating(float rating) {
if (rating > elementCount)
rating = elementCount;
if (mOnRatingBarChangeListener != null) {
mOnRatingBarChangeListener.onRatingChange(rating);
}
this.elementStep = rating;
//浮点数的整数部分
int fint = (int) rating;
BigDecimal b1 = new BigDecimal(Float.toString(rating));
BigDecimal b2 = new BigDecimal(Integer.toString(fint));
//浮点数的小数部分
float fPoint = b1.subtract(b2).floatValue();
//设置选中的单元
for (int i = 0; i < fint; ++i) {
((ImageView) getChildAt(i)).setImageDrawable(elementFillDrawable);
}
//设置没有选中的单元
for (int i = fint; i < elementCount; i++) {
((ImageView) getChildAt(i)).setImageDrawable(elementEmptyDrawable);
}
//小数点默认增加半个
if (fPoint > 0) {
((ImageView) getChildAt(fint)).setImageDrawable(elementHarfDrawable);
}
}
public interface OnRatingChangeListener {
void onRatingChange(float ratingCount);
}
/**
* 每次增加的方式整颗还是半颗,枚举类型
* 类似于View.GONE
*/
public enum StepSize {
Half(0), Full(1);
int step;
StepSize(int step) {
this.step = step;
}
public static StepSize fromStep(int step) {
for (StepSize f : values()) {
if (f.step == step) {
return f;
}
}
throw new IllegalArgumentException();
}
}
}

View File

@@ -1,37 +1,36 @@
package com.mogo.module.v2x.view;
package com.mogo.module.common.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.utils.animation.AnimationResources;
import com.mogo.module.v2x.utils.animation.V2XAnimationManager;
import com.mogo.module.common.R;
import com.mogo.module.common.animation.AnimationResources;
import com.mogo.module.common.animation.AnimationManager;
public class V2XNetworkLoadingView extends RelativeLayout {
public class NetworkLoadingView extends RelativeLayout {
private ProgressBar loadView;
private TextView textView;
private V2XAnimationManager v2XAnimationManager;
private AnimationManager mAnimationManager;
public Button refresButton;
private String loadingText = "正在获取信息…";
public V2XNetworkLoadingView(Context context) {
public NetworkLoadingView(Context context) {
super(context);
}
public V2XNetworkLoadingView(Context context, @Nullable AttributeSet attrs) {
public NetworkLoadingView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.v2x_network_loading_item, this);
LayoutInflater.from(context).inflate(R.layout.network_loading_item, this);
initView();
/*
添加动画图片资源
@@ -39,12 +38,12 @@ public class V2XNetworkLoadingView extends RelativeLayout {
setLoadingImage(AnimationResources.loadingRes);
}
public V2XNetworkLoadingView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
public NetworkLoadingView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void initView() {
v2XAnimationManager = new V2XAnimationManager();
mAnimationManager = new AnimationManager();
loadView = findViewById(R.id.loading_imageview);
textView = findViewById(R.id.loading_text);
refresButton = findViewById(R.id.refresh_button);
@@ -57,12 +56,12 @@ public class V2XNetworkLoadingView extends RelativeLayout {
}
public void setLoadingImage(int[] resources) {
v2XAnimationManager.animationWithTarget(loadView, resources, 100);
mAnimationManager.animationWithTarget(loadView, resources, 100);
}
public void start() {
if (v2XAnimationManager != null) {
v2XAnimationManager.start();
if (mAnimationManager != null) {
mAnimationManager.start();
this.setVisibility(View.VISIBLE);
}
if (refresButton != null) {
@@ -74,15 +73,15 @@ public class V2XNetworkLoadingView extends RelativeLayout {
}
public void stop() {
if (v2XAnimationManager != null) {
v2XAnimationManager.stop();
if (mAnimationManager != null) {
mAnimationManager.stop();
this.setVisibility(GONE);
}
}
public void stopWithError(String errormsg, int showRefreshButton) {
if (v2XAnimationManager != null) {
v2XAnimationManager.soptWithError();
if (mAnimationManager != null) {
mAnimationManager.soptWithError();
}
if (textView != null) {
textView.setText(errormsg);

View File

@@ -0,0 +1,39 @@
package com.mogo.module.common.view;
import android.view.View;
public
/**
* @author congtaowang
* @since 2020/9/25
*
* 防止短时间内多次点击
*/
abstract class OnPreventFastClickListener implements View.OnClickListener {
public static final long INTERVAL = 1_000L;
private long mInterval;
private long mLastClickTime = 0L;
public OnPreventFastClickListener() {
this( INTERVAL );
}
public OnPreventFastClickListener( long interval ) {
if ( interval < 0L ) {
interval = INTERVAL;
}
this.mInterval = interval;
}
@Override
public final void onClick( View v ) {
if ( System.currentTimeMillis() - mLastClickTime > mInterval ) {
onClickImpl( v );
mLastClickTime = System.currentTimeMillis();
}
}
public abstract void onClickImpl( View v );
}

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: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 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

@@ -2,15 +2,15 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:drawable="@drawable/icon_enthusiasm_unchoose">
android:drawable="@drawable/icon_heart_unchoose">
</item>
<item
android:id="@android:id/secondaryProgress"
android:drawable="@drawable/icon_enthusiasm_second">
android:drawable="@drawable/icon_heart_second">
</item>
<item
android:id="@android:id/progress"
android:drawable="@drawable/icon_enthusiasm_choose">
android:drawable="@drawable/icon_heart_choose">
</item>
</layer-list>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/customRatingBar">
</RelativeLayout>

View File

@@ -45,7 +45,7 @@
android:layout_centerHorizontal="true"
android:layout_gravity="top|center"
android:layout_marginTop="@dimen/dp_40"
android:background="@drawable/v2xt_dw_common_corner_bkg_light"
android:background="@drawable/module_dw_common_corner_bkg_light"
android:gravity="center"
android:text="刷新"
android:textColor="#FFFFFF"

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="heart_ratingbar_width">20px</dimen>
<dimen name="heart_ratingbar_height">16px</dimen>
<dimen name="v2x_panel_loading_top">120px</dimen>
<dimen name="v2x_share_btn_width">150px</dimen>
<dimen name="v2x_share_btn_height">48px</dimen>
<dimen name="share_item_address">17.5000px</dimen>
</resources>

View File

@@ -1054,5 +1054,12 @@
<dimen name="sp_48">48px</dimen>
<dimen name="module_common_shadow_width">-10px</dimen>
<dimen name="module_common_shadow_width_pos">10px</dimen>
<dimen name="heart_ratingbar_width">40px</dimen>
<dimen name="heart_ratingbar_height">43px</dimen>
<dimen name="v2x_panel_loading_top">300px</dimen>
<dimen name="v2x_share_btn_width">281px</dimen>
<dimen name="v2x_share_btn_height">90px</dimen>
<dimen name="share_item_address">32px</dimen>
<dimen name="panel_list_item_title_size">28px</dimen>
</resources>

View File

@@ -6,4 +6,38 @@
<enum name="vertical" value="1" />
</attr>
</declare-styleable>
<declare-styleable name="CustomCircleImageView">
<attr name="civ_border_width" format="dimension" />
<attr name="civ_border_color" format="color" />
<attr name="civ_border_overlay" format="boolean" />
<attr name="civ_fill_color" format="color" />
</declare-styleable>
<declare-styleable name="CustomRatingBar">
<!---->
<attr name="elenmentWidth" format="dimension" />
<!---->
<attr name="elenmentHeight" format="dimension" />
<!--单元间距-->
<attr name="elenmentPadding" format="dimension" />
<!--单元总数-->
<attr name="elenmentCount" format="integer" />
<!--空资源-->
<attr name="elenmentEmpty" format="reference" />
<!--满资源-->
<attr name="elenmentFill" format="reference" />
<!--半资源-->
<attr name="elenmentHarf" format="reference" />
<!--是否可点击-->
<attr name="clickable" format="boolean" />
<!--当前进度-->
<attr name="elenmentStep" format="float" />
<!--进度方式 半个还是整个-->
<attr name="stepSize">
<enum name="Half" value="0" />
<enum name="Full" value="1" />
</attr>
</declare-styleable>
</resources>

View File

@@ -2,4 +2,5 @@
<resources>
<color name="module_commons_dlg_bkg">#7f000000</color>
<color name="module_commons_wm_dialog_text_textColor">#FFFFFF</color>
<color name="v2x_FFF_666">#FFFFFF</color>
</resources>

View File

@@ -1045,4 +1045,12 @@
<dimen name="sp_48">26.2500px</dimen>
<dimen name="module_common_shadow_width">-8px</dimen>
<dimen name="module_common_shadow_width_pos">8px</dimen>
<dimen name="heart_ratingbar_width">20px</dimen>
<dimen name="heart_ratingbar_height">16px</dimen>
<dimen name="v2x_panel_loading_top">120px</dimen>
<dimen name="v2x_share_btn_width">150px</dimen>
<dimen name="v2x_share_btn_height">48px</dimen>
<dimen name="share_item_address">17.5000px</dimen>
<dimen name="panel_list_item_title_size">15.3125px</dimen>
</resources>

View File

@@ -14,4 +14,19 @@
<item name="android:topDark">@android:color/transparent</item>
<item name="android:borderlessButtonStyle">@android:color/transparent</item>
</style>
<style name="customHeartHeartRatingBarStyle" parent="@style/Widget.AppCompat.RatingBar">
<item name="android:maxWidth">@dimen/heart_ratingbar_width</item>
<item name="android:minWidth">@dimen/heart_ratingbar_width</item>
<item name="android:minHeight">@dimen/heart_ratingbar_height</item>
<item name="android:maxHeight">@dimen/heart_ratingbar_height</item>
<item name="android:numStars">5</item>
<item name="android:rating">1</item>
<item name="android:stepSize">0.5</item>
<item name="android:progressDrawable">@drawable/module_commons_heart_ratingbar_drawable</item>
</style>
</resources>

View File

@@ -1,132 +0,0 @@
package com.mogo.module.extensions;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.share.manager.ServiceApisManager;
import com.mogo.utils.LaunchUtils;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.logger.Logger;
import java.util.HashMap;
import java.util.Map;
/**
* 天气,消息,个人头像
*
* @author congtaowang
* @since 2020-01-05
* <p>
* 描述
*/
public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsPresenter > implements ExtensionsView {
private static final String TAG = "ExtensionsFragment";
public static final int MAX_DISPLAY_MSG_AMOUNT = 99;
private View mWeatherContainer;
private ImageView mWeatherIcon;
private TextView mWeatherTemp;
private View mMsgContainer;
private TextView mMsgCounter;
private ImageView mUserHeadImg;
@Override
protected int getLayoutId() {
return R.layout.module_ext_layout_extensions;
}
@Override
protected void initViews() {
mWeatherContainer = findViewById( R.id.module_ext_id_weather_container );
mWeatherIcon = findViewById( R.id.module_ext_id_weather_icon );
mWeatherTemp = findViewById( R.id.module_ext_id_weather_temp );
mUserHeadImg = findViewById(R.id.ivUserHeadImg);
mMsgContainer = findViewById( R.id.module_ext_id_msg );
mMsgContainer.setOnClickListener( view -> {
ARouter.getInstance().build( "/push/ui/message" ).navigation( getContext() );
} );
mMsgCounter = findViewById( R.id.module_ext_id_msg_counter );
mUserHeadImg.setOnClickListener(view ->{
try {
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
// 埋点
final Map<String, Object> properties = new HashMap<>();
properties.put("type", 3);
ServiceApisManager.serviceApis.getAnalyticsApi().track( "Launcher_APP_Icon", properties );
} catch (Exception e) {
Logger.e(TAG, e, "打开个人中心Exception");
}
});
mUserHeadImg.setVisibility(DebugConfig.isLauncher()?View.VISIBLE:View.GONE);
}
@NonNull
@Override
protected ExtensionsPresenter createPresenter() {
return new ExtensionsPresenter( this );
}
@Override
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
super.onActivityCreated( savedInstanceState );
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void renderWeatherInfo( String temp, String desc, int iconId ) {
boolean hidden = false;
if ( iconId != 0 ) {
mWeatherIcon.setImageResource( iconId );
mWeatherIcon.setVisibility( View.VISIBLE );
} else {
mWeatherIcon.setVisibility( View.GONE );
hidden |= true;
}
hidden |= TextUtils.isEmpty( temp );
hidden |= TextUtils.isEmpty( desc );
mWeatherTemp.setText( temp );
mWeatherContainer.setVisibility( hidden ? View.GONE : View.VISIBLE );
}
@Override
public void renderMsgInfo( boolean hasMsg, int amount ) {
mMsgContainer.setVisibility( hasMsg ? View.VISIBLE : View.GONE );
mMsgCounter.setText( amount > MAX_DISPLAY_MSG_AMOUNT ? getString( R.string.module_ext_str_dots ) : String.valueOf( amount ) );
}
@Override
public void renderUserInfo(UserInfo userInfo) {
if(userInfo != null){
Logger.d(TAG, "renderUserInfo: " + userInfo);
GlideApp.with(getContext()).load(userInfo.getHeadImgurl()).placeholder(R.drawable.model_ext_default_user_head).circleCrop().into(mUserHeadImg);
}
}
}

View File

@@ -8,11 +8,6 @@ package com.mogo.module.extensions;
*/
public class ExtensionsModuleConst {
/**
* 顶部UI
*/
public static final String PATH_EXTENSION = "/extension/ui";
/**
* 快捷操作入口:定位、
*/

View File

@@ -1,90 +0,0 @@
package com.mogo.module.extensions;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.service.module.ModuleType;
/**
* @author congtaowang
* @since 2020-01-05
* <p>
* 描述
*/
@Route( path = ExtensionsModuleConst.PATH_EXTENSION )
public class ExtensionsModuleProvider implements IMogoModuleProvider {
@Override
public Fragment createFragment( Context context, Bundle data ) {
ExtensionsFragment fragment = new ExtensionsFragment();
fragment.setArguments( data );
return fragment;
}
@Override
public View createView( Context context ) {
return null;
}
@NonNull
@Override
public String getModuleName() {
return ExtensionsModuleConst.TYPE;
}
@Override
public IMogoModuleLifecycle getCardLifecycle() {
return null;
}
@Override
public IMogoMapListener getMapListener() {
return null;
}
@Override
public int getType() {
return ModuleType.TYPE_EXTENSION;
}
@Override
public IMogoNaviListener getNaviListener() {
return null;
}
@Override
public IMogoLocationListener getLocationListener() {
return null;
}
@Override
public void init( Context context ) {
}
@Override
public IMogoMarkerClickListener getMarkerClickListener() {
return null;
}
@Override
public String getAppPackage() {
return null;
}
@Override
public String getAppName() {
return null;
}
}

View File

@@ -1,161 +0,0 @@
package com.mogo.module.extensions;
import android.util.ArrayMap;
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.network.Utils;
import com.mogo.module.extensions.net.UserInfoNetApiServices;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.extensions.userinfo.UserInfoConstant;
import com.mogo.module.extensions.userinfo.UserInfoResponse;
import com.mogo.module.extensions.utils.ExtensionsConfig;
import com.mogo.module.extensions.weather.Phenomena;
import com.mogo.module.extensions.weather.WeatherCallback;
import com.mogo.module.extensions.weather.WeatherInfo;
import com.mogo.module.extensions.weather.WeatherModel;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.network.IMogoNetwork;
import com.mogo.service.statusmanager.IMogoMsgCenter;
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
import com.mogo.utils.digest.DigestUtils;
import com.mogo.utils.logger.Logger;
import java.util.Map;
import io.reactivex.SingleObserver;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* @author congtaowang
* @since 2020-01-05
* <p>
* 描述
*/
public class ExtensionsPresenter extends Presenter< ExtensionsView > implements WeatherCallback,
IMogoMsgCenterListener {
private static final String TAG = "ExtensionsPresenter";
private WeatherModel mWeatherModel;
private IMogoMsgCenter mMsgCenter;
private IMogoNetwork mNetWork;
public ExtensionsPresenter( ExtensionsView view ) {
super( view );
mWeatherModel = new WeatherModel( getContext() );
mNetWork =
((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi();
}
@Override
public void onCreate( @NonNull LifecycleOwner owner ) {
super.onCreate( owner );
mWeatherModel.init( this );
mWeatherModel.queryWeatherInformation();
mMsgCenter = ( IMogoMsgCenter ) ARouter.getInstance().build( MogoServicePaths.PATH_MSG_CENTER ).navigation();
mMsgCenter.registerMsgCenterListener( this );
}
@Override
public void onWeatherLoaded( WeatherInfo weatherInfo ) {
if ( weatherInfo == null ) {
return;
}
String temp = getContext().getResources().getString( R.string.module_ext_str_weather_temp_format, weatherInfo.getTemperature() );
Phenomena phenomena = Phenomena.getById( weatherInfo.getPhenomena() );
String desc = phenomena == null ? "" : phenomena.nameCn;
int resId = phenomena.resId;
mView.renderWeatherInfo( temp, desc, resId );
}
@Override
public void onMsgChanged( boolean hasMsg, int amount ) {
if ( mView != null ) {
mView.renderMsgInfo( hasMsg, amount );
}
}
@Override
public void onResume( @NonNull LifecycleOwner owner ) {
super.onResume( owner );
if(ExtensionsConfig.needRequestUserInfo()){
// 相当于每次onResume都会请求一下个人信息目的是能够相对及时的同步手机端的个人信息修改
requestUserInfo();
}
}
@Override
public void onPause( @NonNull LifecycleOwner owner ) {
super.onPause( owner );
}
@Override
public void onDestroy( @NonNull LifecycleOwner owner ) {
super.onDestroy( owner );
if ( mWeatherModel != null ) {
mWeatherModel.destroy();
}
if ( mMsgCenter != null ) {
mMsgCenter.unregisterMsgCenterListener( this );
}
}
private UserInfo userInfo;
public void requestUserInfo() {
Map<String, String> params = new ArrayMap<>();
params.put("sn", Utils.getSn());
params.put("source", "2");
String sign = createSign(params, "JGqZw9");
params.put("sig", sign);
mNetWork.create(UserInfoNetApiServices.class, UserInfoConstant.getUserInfoBaseUrl()).requestUserInfo(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<UserInfoResponse>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(UserInfoResponse userInfoBaseResponse) {
userInfo = userInfoBaseResponse.getResult();
if(userInfo!=null) {
Logger.d(TAG, "获取个人信息成功: " + userInfo);
mView.renderUserInfo(userInfo);
}else{
Logger.e(TAG,"获取个人信息失败");
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
Logger.e(TAG, e, "获取个人信息失败==");
}
});
}
private String createSign(Map<String, String> map, String salt) {
try {
StringBuilder queryString = new StringBuilder();
for (Map.Entry<String, String> entry : map.entrySet()) {
queryString.append(entry.getKey())
.append("=")
.append(entry.getValue())
.append("&");
}
queryString.append("key=").append(DigestUtils.shaHex(salt));
return DigestUtils.shaHex(queryString.toString()).toUpperCase();
} catch (Exception e) {
e.printStackTrace();
Logger.e(TAG, e, "createSign()");
return "";
}
}
}

View File

@@ -0,0 +1,59 @@
package com.mogo.module.extensions.bean;
import com.mogo.commons.data.BaseData;
/**
* @author lixiaopeng
* @description
* @since 2020/9/22
*/
public class CommonConfig {
public Active active;//活动配置
public Auth auth; //授权配置
public Speech speech; //语音播报次数
public ReportStrategy reportStrategy; //被动上报策略开关
public CommonConfig(Active active, Auth auth, Speech speech, ReportStrategy reportStrategy) {
this.active = active;
this.auth = auth;
this.speech = speech;
this.reportStrategy = reportStrategy;
}
public class Active{
public String imageUrl;
public String webUrl;
public int status;
Active(String imageUrl, String webUrl, int status) {
this.imageUrl = imageUrl;
this.webUrl = webUrl;
this.status = status;
}
}
public class Speech{
public int count;
Speech(int count) {
this.count = count;
}
}
public class Auth{
int isNeedAuth;
Auth(int isNeedAuth) {
this.isNeedAuth = isNeedAuth;
}
}
public class ReportStrategy {
public boolean open;
ReportStrategy(boolean open) {
this.open = open;
}
}
}

View File

@@ -0,0 +1,13 @@
package com.mogo.module.extensions.bean;
import com.mogo.commons.data.BaseData;
/**
* @author lixiaopeng
* @description
* @since 2020/9/22
*/
public class CommonConfigResponse extends BaseData {
public CommonConfig result;
}

View File

@@ -6,6 +6,7 @@ import android.os.Bundle;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
@@ -22,6 +23,8 @@ import com.bumptech.glide.request.RequestOptions;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.MogoLocation;
@@ -33,11 +36,13 @@ 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;
import com.mogo.module.common.map.MapCenterPointStrategy;
import com.mogo.module.common.map.Scene;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.module.extensions.ExtensionsModuleConst;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.navi.NaviInfoView;
@@ -46,7 +51,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;
@@ -65,6 +69,7 @@ import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.storage.SharedPrefsMgr;
import com.zhidao.manager.ts.TsThreshold;
import java.util.HashMap;
@@ -72,6 +77,19 @@ import java.util.Locale;
import java.util.Map;
import java.util.Random;
import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
import static com.mogo.module.common.utils.SPConst.getSpGuide;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE_TIME;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE;
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE_TIME;
import static com.mogo.module.share.constant.ShareConstants.ONE_DAY_TIME;
import static com.mogo.module.share.constant.ShareConstants.SEVEN_DAY_TIME;
import static com.mogo.module.share.constant.ShareConstants.VOICE_ALERT_COUNT;
/**
* @author congtaowang
* @since 2020-01-07
@@ -131,6 +149,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private EditText topEditS, frontLeftEditS, frontRightEditS, backLeftEditS, backRightEditS,
bottomEditS;
private String[] mClickShareVoiceStrings;
private String[] mInnerGuideVoiceStrings;
private String[] mOuterGuideVoiceStrings;
private boolean isShowGuide;
/**
* 搜索莫模块
*/
@@ -143,6 +169,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private boolean toggle = false;
private View mOnlineCarEntrance;
private Runnable mLockCarRunnable = new Runnable() {
@Override
public void run() {
@@ -156,6 +184,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private UploadButtonAnimatorController mUploadButtonAnimatorController;
private IFragmentProvider mMessageHistoryPanelProvider;
@Override
protected int getLayoutId() {
return R.layout.module_ext_layout_entrance;
@@ -163,7 +193,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();
@@ -174,40 +204,50 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mUploadRoadCondition = findViewById(R.id.module_entrance_id_upload_road_condition);
mUpload = findViewById(R.id.module_entrance_id_upload);
mUploading = findViewById(R.id.module_entrance_id_uploading);
mUploadRoadCondition.setOnClickListener(view -> {
showShareDialog();
});
mUploadRoadCondition.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
showShareDialog();
playShareGuideVoice();
}
} );
mDisplayOverview = findViewById(R.id.module_ext_id_display_overview);
mDisplayOverviewText = findViewById(R.id.module_ext_id_display_overview_text);
mDisplayOverviewIcon = findViewById(R.id.module_ext_id_display_overview_icon);
mDisplayOverview.setOnClickListener(view -> {
if (getContext() != null) {
// 加此判断是解决下面setDisplayOverview后本Fragment回调中出现not attached to a context问题
if (!mStatusManager.isDisplayOverview()) {
mMApUIController.displayOverview(mDisplayOverviewBounds);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
UiThreadHandler.postDelayed(mLockCarRunnable, 20_000);
} else {
mMApUIController.recoverLockMode();
UiThreadHandler.removeCallbacks(mLockCarRunnable);
mDisplayOverview.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
if (getContext() != null) {
// 加此判断是解决下面setDisplayOverview后本Fragment回调中出现not attached to a context问题
if (!mStatusManager.isDisplayOverview()) {
mMApUIController.displayOverview(mDisplayOverviewBounds);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
UiThreadHandler.postDelayed(mLockCarRunnable, 20_000);
} else {
mMApUIController.recoverLockMode();
UiThreadHandler.removeCallbacks(mLockCarRunnable);
}
mStatusManager.setDisplayOverview(TAG, !mStatusManager.isDisplayOverview());
}
mStatusManager.setDisplayOverview(TAG, !mStatusManager.isDisplayOverview());
}
});
} );
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
mMove2CurrentLocation.setOnClickListener(view -> {
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
if (location != null) {
if (mStatusManager.isDisplayOverview()) {
mStatusManager.setDisplayOverview(TAG, false);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
mMove2CurrentLocation.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
if (location != null) {
if (mStatusManager.isDisplayOverview()) {
mStatusManager.setDisplayOverview(TAG, false);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
}
mStatusManager.setUserInteractionStatus(TAG, true, false);
mMApUIController.recoverLockMode();
}
mStatusManager.setUserInteractionStatus(TAG, true, false);
mMApUIController.recoverLockMode();
}
});
} );
if (DebugConfig.isDebug()) {
mMove2CurrentLocation.setOnLongClickListener(view -> {
@@ -227,46 +267,47 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
mExitNavi = findViewById(R.id.module_entrance_id_exit_navi);
mExitNavi.setOnClickListener(view -> {
if (mMogoNavi != null) {
if (mIsLock) {
new WMDialog.Builder(getContext())
.setOkButton(R.string.module_commons_button_ok, (dlg, which) -> {
dlg.dismiss();
mMogoNavi.stopNavi();
})
.setCancelButton(R.string.module_commons_button_cancel,
(dlg, which) -> {
dlg.dismiss();
})
.setContent(R.string.module_commons_exit_navi_content)
.build()
.show();
} else {
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.NAVI);
mMApUIController.recoverLockMode();
mExitNavi.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
if (mMogoNavi != null) {
if (mIsLock) {
new WMDialog.Builder(getContext())
.setOkButton(R.string.module_commons_button_ok, (dlg, which) -> {
dlg.dismiss();
mMogoNavi.stopNavi();
})
.setCancelButton(R.string.module_commons_button_cancel,
(dlg, which) -> {
dlg.dismiss();
})
.setContent(R.string.module_commons_exit_navi_content)
.build()
.show();
} else {
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.NAVI);
mMApUIController.recoverLockMode();
}
}
}
});
} );
mCameraMode = findViewById(R.id.module_ext_id_north);
mCameraMode.setOnClickListener(view -> {
if (mCameraMode.isSelected()) {
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
} else {
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
mCameraMode.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
if (mCameraMode.isSelected()) {
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
} else {
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
}
}
// mCameraMode.setSelected(!mCameraMode.isSelected());
// mCameraMode.setText(getString(mCameraMode.isSelected() ? R.string.mode_car_up :
// R.string.mode_north_up));
});
} );
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
MogoEntranceButtons.save(ButtonIndex.BUTTON1,
findViewById(R.id.module_entrance_id_button1));
MogoEntranceButtons.save(ButtonIndex.BUTTON2,
findViewById(R.id.module_entrance_id_button2));
MogoEntranceButtons.save(ButtonIndex.BUTTON1, findViewById(R.id.module_entrance_id_button1));
MogoEntranceButtons.save(ButtonIndex.BUTTON2, findViewById(R.id.module_entrance_id_button2));
mDisplayOverviewBounds = new Rect(
ResourcesHelper.getDimensionPixelSize(getContext(),
@@ -282,13 +323,16 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mNaviInfo = new NaviInfoView();
mNaviInfo.inflate(rootView);
findViewById(R.id.module_map_id_navi_bg).setOnClickListener(view -> {
try {
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
} catch (Exception e) {
e.printStackTrace();
findViewById(R.id.module_map_id_navi_bg).setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
try {
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
} catch (Exception e) {
e.printStackTrace();
}
}
});
} );
mWeatherContainer = findViewById(R.id.module_ext_id_weather_container);
mWeatherIcon = findViewById(R.id.module_ext_id_weather_icon);
@@ -298,33 +342,52 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mMsgContainer = findViewById(R.id.module_ext_id_msg);
mMsgContainer.setOnClickListener(view -> {
try {
IFragmentProvider provider = (IFragmentProvider)ARouter.getInstance().build("/push/ui/message").navigation(getContext());
provider.createFragment( getActivity(), mMogoFragmentManager.getMessageHistoryContainerId(), null );
} catch( Exception e ){
mMsgContainer.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
try {
if ( mMessageHistoryPanelProvider == null ) {
mMessageHistoryPanelProvider = (IFragmentProvider)ARouter.getInstance().build("/push/ui/message").navigation(getContext());
}
mMessageHistoryPanelProvider.createFragment( getActivity(), mMogoFragmentManager.getMessageHistoryContainerId(), null );
} catch( Exception e ){
}
}
});
} );
mMsgCounter = findViewById(R.id.module_ext_id_msg_counter);
mUserHeadImg.setOnClickListener(view -> {
try {
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
// 埋点
final Map<String, Object> properties = new HashMap<>();
properties.put("type", 3);
ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon",
properties);
} catch (Exception e) {
Logger.e(TAG, e, "打开个人中心Exception");
mUserHeadImg.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
try {
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
// 埋点
final Map<String, Object> properties = new HashMap<>();
properties.put("type", 3);
ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon",
properties);
} catch (Exception e) {
Logger.e(TAG, e, "打开个人中心Exception");
}
}
});
} );
mUserHeadImg.setVisibility(DebugConfig.isLauncher() ? View.VISIBLE : View.GONE);
mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload,
mStatusManager);
mOnlineCarEntrance = findViewById( R.id.module_ext_id_destination_online_car );
mOnlineCarEntrance.setOnClickListener( new OnPreventFastClickListener() {
@Override
public void onClickImpl( View v ) {
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();
@@ -389,6 +452,161 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
thresholdSetContainer.setVisibility(View.GONE);
mApis.getAdasControllerApi().showADAS();
});
isShowGuide = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(getSpGuide(), false);
Logger.d(TAG, " isShowGuide = " + isShowGuide + " --isGreaterThanOneDay = " + isGreaterThanOneDay());
if (isShowGuide && isGreaterThanOneDay()) {
UiThreadHandler.postDelayed(() -> {
playShareOuterGuideVoice();
}, 5_000L
);
}
}
private boolean isGreaterThanOneDay() {
boolean isGreaterThanOneDay;
long guideRecordTime = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getLong(getSPGuideRecord(), 0);
Logger.d(TAG, " isGreaterThanOneDay interval = " + (System.currentTimeMillis() - guideRecordTime) + "---currentTime = " + System.currentTimeMillis() + "---guideRecordTime =" + guideRecordTime);
if ((System.currentTimeMillis() - guideRecordTime) > ONE_DAY_TIME) {
isGreaterThanOneDay = true;
} else {
isGreaterThanOneDay = false;
}
return isGreaterThanOneDay;
}
Random random = new Random();
/**
* 外部触发引导
*/
private void playShareOuterGuideVoice() {
long intervalTime = SharedPrefsMgr.getInstance(getContext()).getLong(KEY_SHARE_OUTER_GUIDE_TIME, 0);
int shareItemSum = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_SHARE_OUTER_GUIDE, 0);
int serverIssueCount = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_SERVER_SHOW_DAY_COUNT, 6);
if (shareItemSum < serverIssueCount) {
long time = System.currentTimeMillis();
Logger.d(TAG, " playShareOuterGuideVoice shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + "----serverIssueCount = " + serverIssueCount + "---time = " + time);
if (intervalTime == 0) {
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_OUTER_GUIDE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_OUTER_GUIDE, ++shareItemSum);
// AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[random.nextInt(3)]);
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[0]);
} else {
Logger.d(TAG, " playShareOuterGuideVoice else interval = " + (time - intervalTime));
if ((time - intervalTime) > SEVEN_DAY_TIME) {
if (shareItemSum == 1) {
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[1]);
} else if (shareItemSum == 2) {
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[2]);
} else if (shareItemSum == 3) {
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[0]);
} else if (shareItemSum == 4) {
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[1]);
} else if (shareItemSum == 5) {
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[2]);
}
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_OUTER_GUIDE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_OUTER_GUIDE, ++shareItemSum);
} else {
Logger.e(TAG, " playShareOuterGuideVoice else < ONE_DAY_TIME ");
}
}
}
}
private void playShareGuideVoice() {
long intervalTime = SharedPrefsMgr.getInstance(getContext()).getLong(KEY_CLICK_SHARE_TIME, 0);
int shareItemSum = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_CLICK_SHARE_BUTTON, 0);
if (shareItemSum < VOICE_ALERT_COUNT) {
long time = System.currentTimeMillis();
Logger.d(TAG, " playShareGuideVoice shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + ">>> time = " + time);
if (intervalTime == 0) {
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_CLICK_SHARE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_CLICK_SHARE_BUTTON, ++shareItemSum);
AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[0]);
} else {
Logger.d(TAG, " playShareGuideVoice else interval = " + (time - intervalTime));
if ((time - intervalTime) > ONE_DAY_TIME) {
if (shareItemSum == 1) {
AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[1]);
} else {
AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[0]);
}
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_CLICK_SHARE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_CLICK_SHARE_BUTTON, ++shareItemSum);
} else {
Logger.e(TAG, " playShareGuideVoice else < ONE_DAY_TIME ");
}
}
}
}
/**
* 地图移动和缩放回调
* @param latLng 中点的经纬度
* @param zoom 缩放大小
* @param tilt 倾斜度
* @param bearing 旋转角度
*/
@Override
public void onMapChanged(MogoLatLng latLng, float zoom, float tilt, float bearing) {
}
private void showSlideMapVoiceGuide() {
long intervalTime = SharedPrefsMgr.getInstance(getContext()).getLong(KEY_SHARE_INNER_GUIDE_TIME, 0);
int shareItemSum = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_SHARE_INNER_GUIDE, 0);
if (shareItemSum < VOICE_ALERT_COUNT) {
long time = System.currentTimeMillis();
Logger.d(TAG, " showSlideMapVoiceGuide shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + "---time = " + time);
if (intervalTime == 0) {
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_INNER_GUIDE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_INNER_GUIDE, ++shareItemSum);
AIAssist.getInstance(getContext()).speakTTSVoice(mInnerGuideVoiceStrings[0]);
} else {
Logger.d(TAG, " showSlideMapVoiceGuide else interval = " + (time - intervalTime));
if ((time - intervalTime) > ONE_DAY_TIME) {
if (shareItemSum == 1) {
AIAssist.getInstance(getContext()).speakTTSVoice(mInnerGuideVoiceStrings[1]);
} else {
AIAssist.getInstance(getContext()).speakTTSVoice(mInnerGuideVoiceStrings[2]);
}
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_INNER_GUIDE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_INNER_GUIDE, ++shareItemSum);
} else {
Logger.e(TAG, " showSlideMapVoiceGuide else < ONE_DAY_TIME ");
}
}
}
}
@Override
public void onTouch(MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
break;
case MotionEvent.ACTION_UP:
if (isShowGuide && isGreaterThanOneDay()) {
if (motionEvent.getX() > 200) {
showSlideMapVoiceGuide();
}
}
break;
case MotionEvent.ACTION_MOVE:
break;
}
}
/**
@@ -409,6 +627,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
isClickShare = true;
mApis.getShareManager().showShareDialog();
traceData("1");
}
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
@@ -440,6 +659,13 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.DISPLAY_OVERVIEW, this);
TopViewAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
mClickShareVoiceStrings =
getContext().getResources().getStringArray(R.array.click_share_voice_guide_array);
mInnerGuideVoiceStrings =
getContext().getResources().getStringArray(R.array.search_voice_guide_inner_array);
mOuterGuideVoiceStrings =
getContext().getResources().getStringArray(R.array.search_voice_guide_outer_array);
}
@Override
@@ -447,6 +673,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
super.onDestroyView();
isClickShare = false;
TopViewAnimHelper.getInstance().removeAllView();
TopViewAnimHelper.getInstance().clear();
EntranceViewHolder.getInstance().release();
}
@Override
@@ -462,6 +690,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
mCameraMode.setText(getString(mCameraMode.isSelected() ?
R.string.mode_car_up : R.string.mode_north_up));
} else if( key_type == 10021 ){
try {
onStopNavi();
} catch ( Exception e ) {
Logger.e( TAG, e, "onIntentReceived -> 10021" );
}
}
}
@@ -498,6 +732,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
@@ -507,6 +746,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);
}
@@ -707,8 +947,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
return;
}
mCameraMode.setSelected(ui == EnumMapUI.NorthUP_2D);
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up :
R.string.mode_north_up));
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up : R.string.mode_north_up));
}
@Override

View File

@@ -9,7 +9,11 @@ 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.bean.CommonConfig;
import com.mogo.module.extensions.bean.CommonConfigResponse;
import com.mogo.module.extensions.net.GetConfigApiServices;
import com.mogo.module.extensions.net.UserInfoNetApiServices;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.extensions.userinfo.UserInfoConstant;
@@ -26,6 +30,7 @@ import com.mogo.service.statusmanager.IMogoMsgCenter;
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
import com.mogo.utils.digest.DigestUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.storage.SharedPrefsMgr;
import java.util.Map;
@@ -34,6 +39,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
/**
* @author congtaowang
* @since 2020-01-07
@@ -55,8 +62,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
@@ -101,6 +107,7 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
// 相当于每次onResume都会请求一下个人信息目的是能够相对及时的同步手机端的个人信息修改
requestUserInfo();
}
getCommonConfig();
}
@Override
@@ -120,6 +127,51 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
}
}
public void getCommonConfig() {
Map<String, Object> params = new ArrayMap<>();
params.put("sn", Utils.getSn());
mNetWork.create(GetConfigApiServices.class, UserInfoConstant.getUserInfoBaseUrl())
.getConfig(params)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SingleObserver<CommonConfigResponse>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(CommonConfigResponse config) {
Logger.d(TAG, "getCommonConfig onSuccess -----> ");
if (config != null && config.result != null) {
CommonConfig.Speech speech = config.result.speech;
CommonConfig.ReportStrategy strategy = config.result.reportStrategy;
if (speech != null) {
Logger.d(TAG, "getCommonConfig onSuccess speech.count = " + speech.count);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SERVER_SHOW_DAY_COUNT, speech.count);
} else {
Logger.e(TAG, "getCommonConfig onSuccess speech == null ");
}
if (strategy != null) {
Logger.d(TAG, "getCommonConfig onSuccess strategy.open = " + strategy.open);
SharedPrefsMgr.getInstance(getContext()).putBoolean("KEY_SERVER_REPORTSTRATEGY_SWITCH", strategy.open);
} else {
Logger.e(TAG, "getCommonConfig onSuccess strategy == null ");
}
} else {
Logger.e(TAG, "getCommonConfig onSuccess config == null");
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
Logger.e(TAG,"getCommonConfig onError ---> e = " + e);
}
});
}
private UserInfo userInfo;
public void requestUserInfo() {
Map<String, String> params = new ArrayMap<>();

View File

@@ -0,0 +1,20 @@
package com.mogo.module.extensions.net;
import com.mogo.module.extensions.bean.CommonConfigResponse;
import java.util.Map;
import io.reactivex.Single;
import retrofit2.http.GET;
import retrofit2.http.QueryMap;
/**
* 获取配置信息
*/
public interface GetConfigApiServices {
@GET("dataService/car/customConfig/no/getAll/v1")
Single<CommonConfigResponse> getConfig(@QueryMap Map<String, Object> parameters);
}

View File

@@ -105,4 +105,8 @@ public class EntranceViewHolder {
}
}
public void release(){
rootViewGroup = null;
}
}

View File

@@ -49,8 +49,8 @@ public class TopViewAnimHelper {
private TextView tvTurnInfo;
private TopView topContainer;
private ConstraintSet constraintSet = new ConstraintSet();
private Transition transition = new AutoTransition();
private ConstraintSet constraintSet;
private Transition transition;
private TextView cameraMode;
private float topHeight = 0f;
@@ -84,6 +84,10 @@ public class TopViewAnimHelper {
}
public void init(ConstraintLayout rootView, OnTopViewAnimSimpleListener listener) {
constraintSet = new ConstraintSet();
transition = new AutoTransition();
topMotionLayout = rootView;
naviBg = rootView.findViewById(R.id.module_map_id_navi_bg);
remainTimeGroup = rootView.findViewById(R.id.remainTimeGroup);
@@ -680,4 +684,20 @@ public class TopViewAnimHelper {
hideNaviView();
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
}
public void clear(){
topMotionLayout = null;
remainTimeGroup = null;
remainDistanceGroup = null;
arriveTimeGroup = null;
naviBg = null;
ivTurnIcon = null;
tvNextDistance = null;
tvNextRoad = null;
tvNextDistanceUnit = null;
tvTurnInfo = null;
topContainer = null;
cameraMode = null;
transition = null;
}
}

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -36,6 +36,29 @@
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:drawablePadding="@dimen/module_ext_destination_online_car_drawablePadding"
android:gravity="center_vertical"
android:text="@string/module_ext_destination_online_car_text"
android:visibility="gone"
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:layout_marginLeft="@dimen/module_common_shadow_width_pos"
android:paddingLeft="@dimen/module_ext_destination_online_car_paddingLeft"
app:layout_constraintLeft_toLeftOf="parent"
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 +81,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,5 +5,8 @@
<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>
<dimen name="module_common_shadow_width_pos">8px</dimen>
</resources>

View File

@@ -131,7 +131,7 @@
<dimen name="module_ext_common_corner">30px</dimen>
<dimen name="module_ext_button_width">120px</dimen>
<dimen name="module_ext_button_height">120px</dimen>
<dimen name="module_ext_camera_button_marginTop">30px</dimen>
<dimen name="module_ext_camera_button_marginTop">10px</dimen>
<dimen name="module_ext_display_overview_textSize">22px</dimen>
<dimen name="module_ext_display_overview_textSize_large">28px</dimen>
<dimen name="module_ext_north_textSize">28px</dimen>
@@ -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

@@ -131,7 +131,7 @@
<dimen name="module_ext_common_corner">30px</dimen>
<dimen name="module_ext_button_width">120px</dimen>
<dimen name="module_ext_button_height">120px</dimen>
<dimen name="module_ext_camera_button_marginTop">30px</dimen>
<dimen name="module_ext_camera_button_marginTop">10px</dimen>
<dimen name="module_ext_display_overview_textSize">22px</dimen>
<dimen name="module_ext_display_overview_textSize_large">28px</dimen>
<dimen name="module_ext_north_textSize">28px</dimen>
@@ -152,6 +152,9 @@
<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>
<dimen name="module_common_shadow_width_pos">10px</dimen>
</resources>

View File

@@ -137,7 +137,7 @@
<dimen name="module_ext_north_goneMarginTop">142px</dimen>
<dimen name="module_ext_button_width">66px</dimen>
<dimen name="module_ext_button_height">66px</dimen>
<dimen name="module_ext_camera_button_marginTop">16px</dimen>
<dimen name="module_ext_camera_button_marginTop">10px</dimen>
<dimen name="module_ext_display_overview_textSize">12px</dimen>
<dimen name="module_ext_display_overview_textSize_large">14px</dimen>
<dimen name="module_ext_north_textSize">14px</dimen>
@@ -146,7 +146,7 @@
<dimen name="module_entrance_id_uploading_height">58px</dimen>
<dimen name="module_map_id_navi_next_info_distance_marginTop">3dp</dimen>
<dimen name="module_map_id_navi_next_info_road_marginBottom">10px</dimen>
<dimen name="module_map_id_navi_next_info_road_marginBottom_small">4px</dimen>
<dimen name="module_map_id_navi_next_info_road_marginBottom_small">6px</dimen>
<dimen name="module_map_id_navi_next_info_distance_marginStart">6px</dimen>
<dimen name="module_ext_display_overview_icon_marginTop">10px</dimen>
@@ -157,6 +157,9 @@
<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>
<dimen name="module_common_shadow_width_pos">8px</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>
@@ -47,4 +48,25 @@
<item>你好小智,打开全部应用</item>
<item>你好小智,返回桌面</item>
</string-array>
<!--内部触发-->
<string-array name="search_voice_guide_inner_array">
<item>查询路况,唤醒小智说“天安门附近路况怎么样”</item>
<item>想知道出行路况,唤醒小智说“中关村堵车吗”</item>
<item>出行路况早知道,唤醒小智说“长安街路况怎么样”</item>
</string-array>
<!--点击分享按钮-->
<string-array name="click_share_voice_guide_array">
<item>您可以将当前的路况分享给其他车友,帮助他们获得最新的路况信息,试试对我说“上报路况”</item>
<item>您的分享信息将会帮助更多车友,当您发现以下交通事件,可以直接对我说上报路况</item>
</string-array>
<!--外部触发-->
<string-array name="search_voice_guide_outer_array">
<item>查路况您可以直接唤醒小智说“天安门附近堵不堵”</item>
<item>出行路况早知道,试试唤醒小智说,“附近路况怎么样”</item>
<item>提前看看出行路况,试试唤醒小智说,“中关村路况怎么样”</item>
</string-array>
</resources>

View File

@@ -11,6 +11,7 @@ import com.mogo.module.guide.GuideConstant.Companion.PATH_GUIDE_MODULE_NAME
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.SharedPreferenceUtil.hasGuide
import com.mogo.module.guide.util.SharedPreferenceUtil.setGuideFinish
import com.mogo.module.guide.util.SharedPreferenceUtil.setGuideRecord
import com.mogo.service.IMogoServiceApis
import com.mogo.service.MogoServicePaths
import com.mogo.service.fragmentmanager.FragmentDescriptor
@@ -48,6 +49,7 @@ object GuideBizManager {
fun removeGuideFragmentToStack() {
Logger.d("GuideBizManager", "removeGuideFragmentToStack")
setGuideFinish()
setGuideRecord()
serviceApi?.let {
it.fragmentManagerApi.pop()
}

View File

@@ -5,17 +5,14 @@ import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.debug.DebugConfig
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.guide.GuideConstant.Companion.PATH_GUIDE_FRAGMENT
import com.mogo.module.guide.GuideConstant.Companion.PATH_GUIDE_MODULE_NAME
import com.mogo.module.guide.util.isDeviceOfD
import com.mogo.service.module.IMogoModuleProvider
import com.mogo.service.module.ModuleType
import com.mogo.utils.UiThreadHandler
import com.mogo.utils.logger.Logger
@Route(path = PATH_GUIDE_FRAGMENT)
@@ -58,12 +55,7 @@ class MogoGuideProvider : IMogoModuleProvider {
override fun init(context: Context?) {
Logger.d("MogoGuideProvider", "init====")
// if (DebugConfig.isLoadGuideModule()) {
GuideBizManager.init()
// } else {
// Logger.d("MogoGuideProvider", "device type is not D")
// }
}
override fun getAppPackage(): String? {

View File

@@ -10,6 +10,7 @@ import com.mogo.module.guide.util.AnalyticsUtil
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_PASS_TIME
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_PLAY_PASS_ID
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_PLAY_TIME
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import com.mogo.utils.logger.Logger
import com.zhpan.indicator.enums.IndicatorSlideMode
@@ -104,11 +105,6 @@ class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideC
}
private fun destroy() {
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_end), object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
}
})
GuideBizManager.removeGuideFragmentToStack()
}
@@ -124,6 +120,12 @@ class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideC
override fun onDestroy() {
super.onDestroy()
track()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_end), object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
}
})
invokeAuthorize()
}
}

View File

@@ -1,12 +1,16 @@
package com.mogo.module.guide.guide
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_five.*
import kotlinx.android.synthetic.main.module_guide_item_stage_four.*
class GuideStageFiveFragment : MvpFragment<IView, Presenter<IView>> {
@@ -25,12 +29,15 @@ class GuideStageFiveFragment : MvpFragment<IView, Presenter<IView>> {
}
override fun initViews() {
if(!DebugConfig.isLauncher()){
moduleGuidePageFive.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_five)
}
}
override fun onResume() {
super.onResume()
containerFragment?.invisibleRight()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_five), object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
if(!isVisible){

View File

@@ -1,12 +1,16 @@
package com.mogo.module.guide.guide
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_four.*
import kotlinx.android.synthetic.main.module_guide_item_stage_three.*
class GuideStageFourFragment : MvpFragment<IView, Presenter<IView>> {
@@ -25,13 +29,16 @@ class GuideStageFourFragment : MvpFragment<IView, Presenter<IView>> {
}
override fun initViews() {
if(!DebugConfig.isLauncher()){
moduleGuidePageFour.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_four)
}
}
override fun onResume() {
super.onResume()
containerFragment?.visibleLeft()
containerFragment?.visibleRight()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_four), object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
if(!isVisible){

View File

@@ -1,12 +1,15 @@
package com.mogo.module.guide.guide
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_one.*
class GuideStageOneFragment : MvpFragment<IView, Presenter<IView>> {
@@ -27,11 +30,15 @@ class GuideStageOneFragment : MvpFragment<IView, Presenter<IView>> {
override fun initViews() {
containerFragment?.visibleRight()
if(!DebugConfig.isLauncher()){
moduleGuidePageOne.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_one)
}
}
override fun onResume() {
super.onResume()
containerFragment?.invisibleLeft()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_one), object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
if (!isVisible) {

View File

@@ -1,12 +1,16 @@
package com.mogo.module.guide.guide
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_three.*
import kotlinx.android.synthetic.main.module_guide_item_stage_two.*
class GuideStageThreeFragment : MvpFragment<IView, Presenter<IView>> {
@@ -25,13 +29,16 @@ class GuideStageThreeFragment : MvpFragment<IView, Presenter<IView>> {
}
override fun initViews() {
if(!DebugConfig.isLauncher()){
moduleGuidePageThree.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_three)
}
}
override fun onResume() {
super.onResume()
containerFragment?.visibleLeft()
containerFragment?.visibleRight()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_three), object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
if(!isVisible){

View File

@@ -1,12 +1,16 @@
package com.mogo.module.guide.guide
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_one.*
import kotlinx.android.synthetic.main.module_guide_item_stage_two.*
class GuideStageTwoFragment : MvpFragment<IView, Presenter<IView>> {
@@ -25,13 +29,16 @@ class GuideStageTwoFragment : MvpFragment<IView, Presenter<IView>> {
}
override fun initViews() {
if(!DebugConfig.isLauncher()){
moduleGuidePageTwo.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_two)
}
}
override fun onResume() {
super.onResume()
containerFragment?.visibleLeft()
containerFragment?.visibleRight()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_two), object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
if(!isVisible){

View File

@@ -1,10 +0,0 @@
package com.mogo.module.guide.util
import com.mogo.module.common.utils.CarSeries.*
fun isDeviceOfD(): Boolean {
return when (getSeries()) {
CAR_SERIES_D80X, CAR_SERIES_D81X, CAR_SERIES_D82X, CAR_SERIES_D84X -> true
else -> false
}
}

View File

@@ -1,17 +1,22 @@
package com.mogo.module.guide.util
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.debug.DebugConfig
import com.mogo.module.common.utils.SPConst.getSPGuideRecord
import com.mogo.module.common.utils.SPConst.getSpGuide
import com.mogo.utils.storage.SharedPrefsMgr
object SharedPreferenceUtil {
fun hasGuide(): Boolean {
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(DebugConfig.getSpGuide(), false)
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(getSpGuide(), false)
}
fun setGuideFinish() {
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putBoolean(DebugConfig.getSpGuide(), true)
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putBoolean(getSpGuide(), true)
}
fun setGuideRecord() {
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putLong(getSPGuideRecord(), System.currentTimeMillis())
}
}

View File

@@ -7,4 +7,8 @@ import com.mogo.commons.voice.VoicePreemptType
fun speak(context: Context, text: String, callBack: IMogoVoiceCmdCallBack?) {
AIAssist.getInstance(context).speakTTSVoice(text, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, callBack)
}
fun breakOffSpeak(context: Context){
AIAssist.getInstance(context).breakOffSpeak()
}

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/moduleGuidePageFive"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_five">
android:background="@mipmap/module_guide_item_stage_five_launcher">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/moduleGuidePageFour"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_four">
android:background="@mipmap/module_guide_item_stage_four_launcher">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/moduleGuidePageOne"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_one">
android:background="@mipmap/module_guide_item_stage_one_launcher">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/moduleGuidePageThree"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_three">
android:background="@mipmap/module_guide_item_stage_three_launcher">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/moduleGuidePageTwo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_two">
android:background="@mipmap/module_guide_item_stage_two_launcher">
</androidx.constraintlayout.widget.ConstraintLayout>

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