This commit is contained in:
wangcongtao
2020-10-22 14:17:12 +08:00
1425 changed files with 31249 additions and 12020 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

@@ -14,21 +14,24 @@ public class AppsListChangedLiveData extends MutableLiveData {
private Observer mObserver;
private AppsListChangedLiveData(){
// private constructor
}
private static volatile AppsListChangedLiveData sInstance;
private static final class InstanceHolder{
private static final AppsListChangedLiveData INSTANCE = new AppsListChangedLiveData();
}
private AppsListChangedLiveData(){}
public static AppsListChangedLiveData getInstance(){
return InstanceHolder.INSTANCE;
if( sInstance == null ){
synchronized( AppsListChangedLiveData.class ) {
if( sInstance == null ){
sInstance = new AppsListChangedLiveData();
}
}
}
return sInstance;
}
private Object readResolve(){
// 阻止反序列化,必须实现 Serializable 接口
return InstanceHolder.INSTANCE;
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
@Override
@@ -37,7 +40,9 @@ public class AppsListChangedLiveData extends MutableLiveData {
mObserver = observer;
}
public void release(){
public synchronized void release(){
removeObserver( mObserver );
mObserver = null;
sInstance = null;
}
}

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;
}
@@ -174,12 +167,7 @@ public class AppsPresenter extends Presenter< AppsView > {
int page = 0;
int counter = 0;
for ( AppInfo appInfo : list ) {
if ( counter < AppsConst.TOTAL_SIZE_EACH_PAGE ) {
counter++;
} else {
page++;
counter = 0;
}
page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE;
if ( !result.containsKey( page ) ) {
result.put( page, new ArrayList<>() );
}
@@ -221,6 +209,11 @@ public class AppsPresenter extends Presenter< AppsView > {
AppsListChangedLiveData.getInstance().release();
mView = null;
mLauncher.destroy();
mAnalytics = null;
if ( mLauncher != null ) {
mLauncher.destroy();
}
mLauncher = null;
}
public void exit() {

View File

@@ -28,17 +28,8 @@ public class AnimWrapper implements Anim {
public void initAnim( ImageView target ) {
mTarget = target;
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
ThreadPoolService.execute( () -> {
final AnimationDrawable drawable = new AnimationDrawable();
for ( int i = 0; i < AnimRes.sRes.length; i++ ) {
drawable.addFrame( target.getResources().getDrawable( AnimRes.sRes[i] ), 100 );
}
UiThreadHandler.post( () -> {
target.setBackground( drawable );
mDelegate = new OthersAnim( drawable );
start();
} );
} );
mDelegate = new OthersAnim( target );
start();
} else {
mTarget.setImageResource( R.drawable.mogo_tts_icon_00000 );
}

View File

@@ -1,6 +1,9 @@
package com.mogo.module.apps.anim;
import android.graphics.drawable.AnimationDrawable;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.widget.ImageView;
/**
* @author congtaowang
@@ -8,25 +11,44 @@ import android.graphics.drawable.AnimationDrawable;
* <p>
* 描述
*/
public class OthersAnim implements Anim{
public class OthersAnim implements Anim {
private AnimationDrawable mDrawable;
private int mStartIndex = 0;
public OthersAnim( AnimationDrawable drawable ) {
this.mDrawable = drawable;
private final static int MSG_LOOP = 3003;
public static final long INTERVAL = 100L;
private boolean mStarted = false;
private final ImageView mImageView;
private Handler mHandler = new Handler( Looper.getMainLooper() ) {
@Override
public void handleMessage( Message msg ) {
super.handleMessage( msg );
switch ( msg.what ) {
case MSG_LOOP:
if ( mStarted ) {
mImageView.setImageResource( AnimRes.sRes[mStartIndex++ % AnimRes.sRes.length] );
mHandler.sendEmptyMessageDelayed( MSG_LOOP, INTERVAL );
}
break;
}
}
};
public OthersAnim( ImageView imageView ) {
this.mImageView = imageView;
}
@Override
public void start() {
if ( mDrawable != null ) {
mDrawable.start();
}
mStarted = true;
mHandler.sendEmptyMessage( MSG_LOOP );
}
@Override
public void stop() {
if ( mDrawable != null ) {
mDrawable.stop();
}
mStarted = false;
mHandler.removeMessages( MSG_LOOP );
}
}

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

@@ -103,6 +103,7 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
public void destroy() {
if ( getNext() != null ) {
getNext().destroy();
setNext( null );
}
}
}

View File

@@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
* 加载并保存 app 列表
*/
public class AppsModel {
private static final String TAG = "AppsModel";
private static volatile AppsModel sInstance;
@@ -36,7 +36,7 @@ public class AppsModel {
private Map< Integer, List< AppInfo > > mPagedApps = new HashMap<>();
private AppsModel( Context context ) {
mContext = context;
mContext = context.getApplicationContext();
}
public static AppsModel getInstance( Context context ) {
@@ -57,7 +57,6 @@ public class AppsModel {
if ( mPagedApps != null ) {
mPagedApps.clear();
}
mPagedApps = null;
mContext = null;
mAppFilter = null;
sInstance = null;
@@ -88,7 +87,7 @@ public class AppsModel {
continue;
}
int page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE;
if ( !mPagedApps.containsKey( page ) ) {
if ( mPagedApps.get( page ) == null ) {
mPagedApps.put( page, new ArrayList<>() );
}
String appName = getApplicationName( packageManager, packageInfo );
@@ -116,9 +115,12 @@ public class AppsModel {
if ( TextUtils.isEmpty( packageName ) ) {
return;
}
if ( mPagedApps.isEmpty() ) {
if ( mPagedApps == null || mPagedApps.isEmpty() ) {
return;
}
if ( mAppFilter == null ) {
mAppFilter = new AppFilterImpl( mContext );
}
try {
final PackageManager packageManager = mContext.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo( packageName, 0 );
@@ -129,7 +131,7 @@ public class AppsModel {
Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon, AppEnumHelper.getCustomizedAppIconResId( packageName ) );
int pageIndex = getPageIndex( packageName, true );
if ( !mPagedApps.containsKey( pageIndex ) ) {
if ( mPagedApps.get( pageIndex ) == null ) {
mPagedApps.put( pageIndex, new ArrayList<>() );
}
mPagedApps.get( pageIndex ).add( appInfo );
@@ -154,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;
@@ -183,6 +186,9 @@ public class AppsModel {
if ( TextUtils.isEmpty( packageName ) ) {
return;
}
if ( mPagedApps == null || mPagedApps.isEmpty() ) {
return;
}
try {
int pageIndex = getPageIndex( packageName, false );
if ( pageIndex == -1 ) {
@@ -200,7 +206,7 @@ public class AppsModel {
continue;
}
int page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE + pageIndex;
if ( !mPagedApps.containsKey( page ) ) {
if ( mPagedApps.get( page ) == null ) {
mPagedApps.put( page, new ArrayList<>() );
}
mPagedApps.get( page ).add( appInfo );

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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 880 B

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -4,7 +4,7 @@
android:id="@+id/module_apps_id_apps_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0C0C0C">
android:background="@color/module_app_page_bkg_color">
<ImageView
android:id="@+id/module_apps_id_apps_exit"

View File

@@ -20,6 +20,6 @@
android:layout_marginTop="@dimen/module_apps_app_name_marginTop"
android:gravity="center"
android:maxLines="2"
android:textColor="#FFFFFF"
android:textColor="@color/module_apps_id_app_name_textColor"
android:textSize="@dimen/module_apps_app_name_textSize" />
</LinearLayout>

View File

@@ -21,8 +21,8 @@
<dimen name="module_apps_all_icon_width">94px</dimen>
<dimen name="module_apps_all_icon_height">94px</dimen>
<dimen name="module_apps_navigator_icon_width">140px</dimen>
<dimen name="module_apps_navigator_icon_height">140px</dimen>
<dimen name="module_apps_navigator_icon_width">160px</dimen>
<dimen name="module_apps_navigator_icon_height">160px</dimen>
<dimen name="module_apps_navigator_icon_divider">30px</dimen>
<dimen name="module_apps_voice_icon_width">100px</dimen>
<dimen name="module_apps_voice_icon_height">100px</dimen>

View File

@@ -16,5 +16,7 @@
<color name="bg_common">#080625</color>
<color name="txt_blue">#3E7FFC</color>
<color name="module_app_page_bkg_color">#E6000000</color>
<color name="module_apps_id_app_name_textColor">#FFFFFF</color>
</resources>

View File

@@ -21,9 +21,9 @@
<dimen name="module_apps_all_icon_width">50px</dimen>
<dimen name="module_apps_all_icon_height">50px</dimen>
<dimen name="module_apps_navigator_icon_width">78px</dimen>
<dimen name="module_apps_navigator_icon_height">78px</dimen>
<dimen name="module_apps_navigator_icon_divider">17px</dimen>
<dimen name="module_apps_voice_icon_width">60px</dimen>
<dimen name="module_apps_voice_icon_height">60px</dimen>
<dimen name="module_apps_navigator_icon_width">94px</dimen>
<dimen name="module_apps_navigator_icon_height">94px</dimen>
<dimen name="module_apps_navigator_icon_divider">9px</dimen>
<dimen name="module_apps_voice_icon_width">55px</dimen>
<dimen name="module_apps_voice_icon_height">55px</dimen>
</resources>

View File

@@ -11,7 +11,9 @@ 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
import com.mogo.service.auth.IMogoAuthManager
import com.mogo.service.module.IMogoModuleLifecycle
@@ -24,7 +26,7 @@ class MogoAuthorizeProvider : IMogoAuthManager {
const val TAG = "MogoAuthorizeProvider"
}
private var mContext:Context? = null
private var mContext: Context? = null
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
return null
@@ -62,10 +64,11 @@ class MogoAuthorizeProvider : IMogoAuthManager {
return null
}
override fun showAuth(context: Context?) {
override fun showAuth(context: Context) {
mContext = context
if (mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
mogoAuthShow.invokeAuthorizeForShow(mContext!!)
mogoAuthShow.initContext(context)
if (hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
mogoAuthShow.invokeAuthorizeForShow()
} else {
//首次进入Launcher同步一下授权状态防止由于用户清除数据造成首次加载还会出现授权状态不同步问题
mogoAuthShow.updateAuthorizeStatus(AUTHORIZE_TYPE_LAUNCHER_MAIN)
@@ -78,9 +81,7 @@ class MogoAuthorizeProvider : IMogoAuthManager {
}
override fun init(context: Context) {
//todo 引导判断暂时去掉 后续引导流程更改完再放开
// todo if (isDeviceOfD() && hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
// todo F系列暂时没有授权功能 1.1需求中添加 全量上
}
override fun getAppPackage(): String? {
@@ -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
@@ -39,8 +40,11 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
MogoAuthorizeMainController.disAgreeAuthorize(tag, agrId, onSuccess, onError)
}
fun invokeAuthorizeForShow(context: Context) {
mContext = context
fun initContext(mContext: Context) {
this.mContext = mContext
}
fun invokeAuthorizeForShow() {
pushLayoutToMainWindow(AUTHORIZE_TYPE_LAUNCHER_MAIN)
}
@@ -74,12 +78,12 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
}
private fun pushLayoutToMainWindow(tag: String) {
if(mContext == null){
if (mContext == null) {
Logger.d(TAG, "Because of mContext has no init, the application has in background now")
return
}
if (authorizeDialog == null) {
authorizeDialog = AuthorizeDialog(tag, mContext!!)
authorizeDialog = AuthorizeDialog(tag, ContextHolderUtil.getContext() ?: mContext!!)
authorizeDialog!!.setOnDismissListener {
authorizeDialog = null
}
@@ -93,4 +97,8 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
}
}
fun release(){
mContext = null
}
}

View File

@@ -1,9 +1,12 @@
package com.mogo.module.authorize.authprovider.module
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.commons.AbsMogoApplication
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.service.module.IMogoModuleProvider
class MogoModuleAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMogoAuthorizeModuleProvider {
@@ -14,13 +17,21 @@ class MogoModuleAuthorize private constructor() : MogoAuthorizeManagerImpl(), IM
}
override fun invokeAuthorizeForShow() {
mogoAuthShow.invokeAuthorizeForShow(AbsMogoApplication.getApp().applicationContext)
mogoAuthShow.invokeAuthorizeForShow()
}
override fun invokeAuthorization(tag: String) {
if(!SharedPreferenceUtil.hasGuide()){
val guideService = ARouter.getInstance().build("/guide/showFragment").navigation()
if(guideService is IMogoModuleProvider){
guideService.init(AbsMogoApplication.getApp().applicationContext)
}
val listener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
listener?.authorizeFailed("需要先执行用户引导")
return
}
mogoAuthShow.showAuthorizeView(tag, {
//todo SP存储状态
}, { errorMsg ->
val listener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
listener?.authorizeFailed(errorMsg)

View File

@@ -14,6 +14,7 @@ import com.mogo.module.authorize.voice.IVoiceAuthorizeIntentListener
import com.mogo.module.authorize.voice.IVoiceCommandListener
import com.mogo.module.authorize.voice.VoiceUtil
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.module.common.utils.CarSeries
import com.mogo.utils.TipToast
import com.mogo.utils.logger.Logger
import kotlinx.coroutines.Dispatchers
@@ -62,7 +63,12 @@ class AuthorizeDialog : BaseFloatDialog, View.OnClickListener, IVoiceCommandList
private fun setWrapContent() {
val mWindow = window
if(DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD){
if (mWindow != null) {
if (mWindow != null && CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X) {
val lp = mWindow.attributes
lp.width = 1920
lp.height = 1080
mWindow.attributes = lp
}else{
val lp = mWindow.attributes
lp.width = 1024
lp.height = 600
@@ -78,7 +84,7 @@ class AuthorizeDialog : BaseFloatDialog, View.OnClickListener, IVoiceCommandList
}
}
fun initViews() {
private fun initViews() {
Logger.d(TAG, "initView ")
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_SHOW)
init()
@@ -200,4 +206,9 @@ class AuthorizeDialog : BaseFloatDialog, View.OnClickListener, IVoiceCommandList
showAuthorizationError()
})
}
override fun dismiss() {
super.dismiss()
mContext = null
}
}

View File

@@ -1,12 +1,12 @@
package com.mogo.module.authorize.util
import com.mogo.commons.AbsMogoApplication
import com.mogo.module.common.utils.SPConst.getSpGuide
import com.mogo.utils.storage.SharedPrefsMgr
object SharedPreferenceUtil {
private const val HAS_AUTH = "HAS_AUTH"
private const val HAS_GUIDE = "HAS_GUIDE"
private const val AUTHORIZE_UPDATE_TIME = "AUTHORIZE_UPDATE_TIME"
fun needAuthorization(type: Int): Boolean {
@@ -30,6 +30,6 @@ object SharedPreferenceUtil {
}
fun hasGuide(): Boolean {
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(HAS_GUIDE, false)
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(getSpGuide(), false)
}
}

View File

@@ -3,13 +3,13 @@
<item android:state_pressed="true">
<shape>
<corners android:radius="@dimen/dp_59" />
<gradient android:endColor="#805CC1FF" android:startColor="#803E7FFC" />
<gradient android:angle="0" android:endColor="#805CC1FF" android:startColor="#80256BFF" />
</shape>
</item>
<item>
<shape>
<corners android:radius="@dimen/dp_59" />
<gradient android:endColor="#5CC1FF" android:startColor="#3E7FFC" />
<gradient android:angle="0" android:endColor="#5CC1FF" android:startColor="#256BFF" />
</shape>
</item>
</selector>

View File

@@ -3,13 +3,13 @@
<item android:state_pressed="true">
<shape>
<corners android:bottomLeftRadius="@dimen/dp_30" />
<gradient android:endColor="#805CC1FF" android:startColor="#803E7FFC" />
<gradient android:endColor="#805CC1FF" android:startColor="#80256BFF" />
</shape>
</item>
<item>
<shape>
<corners android:bottomLeftRadius="@dimen/dp_30" />
<gradient android:endColor="#5CC1FF" android:startColor="#3E7FFC" />
<gradient android:endColor="#5CC1FF" android:startColor="#256BFF" />
</shape>
</item>
</selector>

View File

@@ -2,6 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_30" />
<gradient
android:angle="135"
android:endColor="#3F4057"
android:startColor="#50526E " />
android:startColor="#2A2B38 " />
</shape>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topLeftRadius="@dimen/dp_30" android:topRightRadius="@dimen/dp_30" />
<gradient
android:endColor="#2A2B38"
android:startColor="#3F4057" />
</shape>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<corners android:radius="@dimen/dp_45" />
<gradient android:angle="0" android:endColor="#805CC1FF" android:startColor="#80256BFF" />
</shape>
</item>
<item>
<shape>
<corners android:radius="@dimen/dp_45" />
<gradient android:angle="0" android:endColor="#5CC1FF" android:startColor="#256BFF" />
</shape>
</item>
</selector>

View File

@@ -2,14 +2,14 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<corners android:radius="@dimen/dp_53" />
<gradient android:endColor="#805CC1FF" android:startColor="#803E7FFC" />
<corners android:bottomLeftRadius="@dimen/dp_30" />
<gradient android:endColor="#805CC1FF" android:startColor="#80256BFF" />
</shape>
</item>
<item>
<shape>
<corners android:radius="@dimen/dp_53" />
<gradient android:endColor="#5CC1FF" android:startColor="#3E7FFC" />
<corners android:bottomLeftRadius="@dimen/dp_30" />
<gradient android:endColor="#5CC1FF" android:startColor="#256BFF" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_30" />
<gradient
android:angle="135"
android:endColor="#3F4057"
android:startColor="#2A2B38 " />
</shape>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<corners android:bottomRightRadius="@dimen/dp_30" />
<gradient android:endColor="#803F4057" android:startColor="#8050526E" />
</shape>
</item>
<item>
<shape>
<corners android:bottomRightRadius="@dimen/dp_30" />
<gradient android:endColor="#3F4057" android:startColor="#50526E " />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:topLeftRadius="@dimen/dp_30"
android:topRightRadius="@dimen/dp_30" />
<gradient
android:angle="135"
android:endColor="#19757DB9"
android:startColor="#19525681" />
</shape>

View File

@@ -2,14 +2,14 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<corners android:radius="@dimen/dp_59" />
<gradient android:endColor="#805CC1FF" android:startColor="#803E7FFC" />
<corners android:radius="@dimen/dp_45" />
<gradient android:angle="0" android:endColor="#805CC1FF" android:startColor="#80256BFF" />
</shape>
</item>
<item>
<shape>
<corners android:radius="@dimen/dp_59" />
<gradient android:endColor="#5CC1FF" android:startColor="#3E7FFC" />
<corners android:radius="@dimen/dp_45" />
<gradient android:angle="0" android:endColor="#5CC1FF" android:startColor="#256BFF" />
</shape>
</item>
</selector>

View File

@@ -3,13 +3,13 @@
<item android:state_pressed="true">
<shape>
<corners android:bottomLeftRadius="@dimen/dp_22" />
<gradient android:endColor="#805CC1FF" android:startColor="#803E7FFC" />
<gradient android:endColor="#805CC1FF" android:startColor="#80256BFF" />
</shape>
</item>
<item>
<shape>
<corners android:bottomLeftRadius="@dimen/dp_22" />
<gradient android:endColor="#5CC1FF" android:startColor="#3E7FFC" />
<gradient android:endColor="#5CC1FF" android:startColor="#256BFF" />
</shape>
</item>
</selector>

View File

@@ -2,6 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_22" />
<gradient
android:angle="135"
android:endColor="#3F4057"
android:startColor="#50526E " />
android:startColor="#2A2B38" />
</shape>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topLeftRadius="@dimen/dp_22" android:topRightRadius="@dimen/dp_22" />
<gradient
android:endColor="#2A2B38"
android:startColor="#3F4057" />
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:topLeftRadius="@dimen/dp_22"
android:topRightRadius="@dimen/dp_22" />
<gradient
android:angle="135"
android:endColor="#19757DB9"
android:startColor="#19525681" />
</shape>

View File

@@ -207,4 +207,4 @@
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,236 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/clAuthorizeTopParent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/module_authorize_color">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clLoadingAuthorizeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_275"
android:layout_marginTop="@dimen/dp_125"
android:layout_marginRight="@dimen/dp_275"
android:layout_marginBottom="@dimen/dp_125"
android:background="@drawable/module_authorize_selector_dark_corner"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clAuthorizeLoading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/ivAuthorizeLoading"
android:layout_width="@dimen/dp_147"
android:layout_height="@dimen/dp_147"
android:src="@mipmap/module_authorize_loading"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvAuthorizeLoading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_44"
android:text="@string/module_authorize_agreement_loading"
android:textColor="@color/module_authorize_loading_text"
android:textSize="@dimen/dp_31"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoading" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clLoadingErrorContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_275"
android:layout_marginTop="@dimen/dp_125"
android:layout_marginRight="@dimen/dp_275"
android:layout_marginBottom="@dimen/dp_125"
android:background="@drawable/module_authorize_selector_dark_corner"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/btnAuthorizeLoadingError"
android:layout_width="@dimen/dp_282"
android:layout_height="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_71"
android:background="@drawable/module_authorize_selector_blue_corner"
android:gravity="center"
android:text="@string/module_authorize_agreement_retry"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_34"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvAuthorizeLoadingError" />
<ImageView
android:id="@+id/ivAuthorizeLoadingError"
android:layout_width="@dimen/dp_94"
android:layout_height="@dimen/dp_94"
android:layout_marginTop="@dimen/dp_254"
android:src="@mipmap/module_authorize_loading_error"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvAuthorizeLoadingError"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:text="@string/module_authorize_agreement_error"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_32"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoadingError" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clAuthorizeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_275"
android:layout_marginTop="@dimen/dp_125"
android:layout_marginRight="@dimen/dp_275"
android:layout_marginBottom="@dimen/dp_125"
android:background="@drawable/module_authorize_selector_dark_corner"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/btnAuthorizeAgree"
android:layout_width="0px"
android:layout_height="@dimen/dp_156"
android:background="@drawable/module_authorize_selector_blue_left_corner"
android:gravity="center"
android:text="@string/module_authorize_agreement_agree"
android:textColor="@color/module_authorize_affirm_text"
android:textSize="@dimen/dp_55"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/btnAuthorizeDisAgree" />
<Button
android:id="@+id/btnAuthorizeDisAgree"
android:layout_width="0px"
android:layout_height="@dimen/dp_156"
android:background="@drawable/module_authorize_selector_dark_right_corner"
android:gravity="center"
android:text="@string/module_authorize_agreement_disagree"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_55"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="@+id/btnAuthorizeAgree"
app:layout_constraintRight_toRightOf="parent" />
<ScrollView
android:layout_width="0px"
android:layout_height="0px"
android:scrollbarSize="@dimen/dp_207"
android:scrollbarThumbVertical="@drawable/module_authorize_scrollbar"
android:scrollbarTrackHorizontal="@drawable/module_authorize_scrollbar"
app:layout_constraintBottom_toTopOf="@+id/btnAuthorizeDisAgree"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/clAuthorizeTitle">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_38"
android:layout_marginLeft="@dimen/dp_55"
android:layout_marginRight="@dimen/dp_55"
android:orientation="vertical">
<TextView
android:id="@+id/tvAuthorizeContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:lineSpacingExtra="@dimen/dp_15"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_44" />
<TextView
android:id="@+id/tvAuthorizeButtonContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_44" />
<TextView
android:id="@+id/tvAuthorizeLastContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_15"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_44" />
</LinearLayout>
</ScrollView>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clAuthorizeTitle"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_130"
android:background="@drawable/module_authorize_shape_top_corner"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_32"
android:layout_marginLeft="@dimen/dp_438"
android:layout_marginTop="@dimen/dp_49"
android:src="@mipmap/module_authorize_title_left_symbol"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_32"
android:layout_marginTop="@dimen/dp_49"
android:layout_marginRight="@dimen/dp_438"
android:src="@mipmap/module_authorize_title_right_symbol"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvAuthorizeTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_34"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_44"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -4,16 +4,16 @@
android:id="@+id/clAuthorizeTopParent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#CC000000">
android:background="@color/module_authorize_color">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clLoadingAuthorizeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_330"
android:layout_marginTop="@dimen/dp_90"
android:layout_marginRight="@dimen/dp_330"
android:layout_marginBottom="@dimen/dp_90"
android:layout_marginLeft="@dimen/dp_275"
android:layout_marginTop="@dimen/dp_125"
android:layout_marginRight="@dimen/dp_275"
android:layout_marginBottom="@dimen/dp_125"
android:background="@drawable/module_authorize_selector_dark_corner"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -43,8 +43,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_44"
android:text="@string/module_authorize_agreement_loading"
android:textColor="#99FFFFFF"
android:textSize="@dimen/dp_44"
android:textColor="@color/module_authorize_loading_text"
android:textSize="@dimen/dp_31"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoading" />
@@ -57,10 +57,10 @@
android:id="@+id/clLoadingErrorContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_330"
android:layout_marginTop="@dimen/dp_90"
android:layout_marginRight="@dimen/dp_330"
android:layout_marginBottom="@dimen/dp_90"
android:layout_marginLeft="@dimen/dp_275"
android:layout_marginTop="@dimen/dp_125"
android:layout_marginRight="@dimen/dp_275"
android:layout_marginBottom="@dimen/dp_125"
android:background="@drawable/module_authorize_selector_dark_corner"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
@@ -69,22 +69,22 @@
<Button
android:id="@+id/btnAuthorizeLoadingError"
android:layout_width="@dimen/dp_461"
android:layout_height="@dimen/dp_97"
android:layout_marginTop="@dimen/dp_33"
android:layout_width="@dimen/dp_282"
android:layout_height="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_71"
android:background="@drawable/module_authorize_selector_blue_corner"
android:gravity="center"
android:text="@string/module_authorize_agreement_retry"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
android:textSize="@dimen/dp_34"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvAuthorizeLoadingError" />
<ImageView
android:id="@+id/ivAuthorizeLoadingError"
android:layout_width="@dimen/dp_147"
android:layout_height="@dimen/dp_147"
android:layout_width="@dimen/dp_94"
android:layout_height="@dimen/dp_94"
android:layout_marginTop="@dimen/dp_254"
android:src="@mipmap/module_authorize_loading_error"
app:layout_constraintEnd_toEndOf="parent"
@@ -95,10 +95,10 @@
android:id="@+id/tvAuthorizeLoadingError"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_33"
android:layout_marginTop="@dimen/dp_20"
android:text="@string/module_authorize_agreement_error"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_32"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoadingError" />
@@ -108,10 +108,10 @@
android:id="@+id/clAuthorizeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_330"
android:layout_marginTop="@dimen/dp_90"
android:layout_marginRight="@dimen/dp_330"
android:layout_marginBottom="@dimen/dp_90"
android:layout_marginLeft="@dimen/dp_275"
android:layout_marginTop="@dimen/dp_125"
android:layout_marginRight="@dimen/dp_275"
android:layout_marginBottom="@dimen/dp_125"
android:background="@drawable/module_authorize_selector_dark_corner"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
@@ -125,7 +125,7 @@
android:background="@drawable/module_authorize_selector_blue_left_corner"
android:gravity="center"
android:text="@string/module_authorize_agreement_agree"
android:textColor="@android:color/white"
android:textColor="@color/module_authorize_affirm_text"
android:textSize="@dimen/dp_55"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"
@@ -139,7 +139,7 @@
android:background="@drawable/module_authorize_selector_dark_right_corner"
android:gravity="center"
android:text="@string/module_authorize_agreement_disagree"
android:textColor="@android:color/white"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_55"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"
@@ -149,19 +149,18 @@
<ScrollView
android:layout_width="0px"
android:layout_height="0px"
android:layout_marginBottom="@dimen/dp_160"
android:scrollbarSize="@dimen/dp_207"
android:layout_marginTop="@dimen/dp_54"
android:scrollbarTrackHorizontal="@drawable/module_authorize_scrollbar"
android:scrollbarThumbVertical="@drawable/module_authorize_scrollbar"
app:layout_constraintBottom_toBottomOf="parent"
android:scrollbarTrackHorizontal="@drawable/module_authorize_scrollbar"
app:layout_constraintBottom_toTopOf="@+id/btnAuthorizeDisAgree"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvAuthorizeTitle">
app:layout_constraintTop_toBottomOf="@+id/clAuthorizeTitle">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_38"
android:layout_marginLeft="@dimen/dp_55"
android:layout_marginRight="@dimen/dp_55"
android:orientation="vertical">
@@ -171,7 +170,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:lineSpacingExtra="@dimen/dp_15"
android:textColor="@android:color/white"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_44" />
<TextView
@@ -179,7 +178,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@android:color/white"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_44" />
<TextView
@@ -188,23 +187,50 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_15"
android:textColor="@android:color/white"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_44" />
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/tvAuthorizeTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_62"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_55"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clAuthorizeTitle"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_130"
android:background="@drawable/module_authorize_shape_top_corner"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_32"
android:layout_marginLeft="@dimen/dp_438"
android:layout_marginTop="@dimen/dp_49"
android:src="@mipmap/module_authorize_title_left_symbol"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_32"
android:layout_marginTop="@dimen/dp_49"
android:layout_marginRight="@dimen/dp_438"
android:src="@mipmap/module_authorize_title_right_symbol"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvAuthorizeTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_34"
android:textColor="@color/module_authorize_text"
android:textSize="@dimen/dp_44"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_authorize_loading_text">#99FFFFFF</color>
<color name="module_authorize_text">#FFFFFF</color>
<color name="module_authorize_affirm_text">#FFFFFF</color>
<color name="module_authorize_color">#7F000000</color>
</resources>

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

@@ -0,0 +1,70 @@
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.ProgressBar;
public class AnimationManager implements Animation {
private static final String TAG = "V2XAnimationManager";
private ProgressBar targetImageView;
private boolean isStarted = false;
private int mStartIndex = 0;
private final static int MSG_LOOP = 3004;
private long INTERVAL = 100L;
private Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case MSG_LOOP:
if (isStarted) {
// targetImageView.setImageResource( AnimationResources.loadingRes[mStartIndex++ % AnimationResources.loadingRes.length] );
mHandler.sendEmptyMessageDelayed(MSG_LOOP, INTERVAL);
}
break;
}
}
};
public void animationWithTarget(ProgressBar imageView, int[] resources, int duration) {
targetImageView = imageView;
INTERVAL = duration;
start();
}
@Override
synchronized public void start() {
isStarted = true;
mHandler.sendEmptyMessage(MSG_LOOP);
if (targetImageView != null) {
targetImageView.setVisibility(View.VISIBLE);
}
}
@Override
synchronized public void stop() {
isStarted = false;
mHandler.removeMessages(MSG_LOOP);
if (targetImageView != null) {
targetImageView.setVisibility(View.INVISIBLE);
}
}
public void soptWithError() {
stop();
if (targetImageView != null) {
targetImageView.setVisibility(View.VISIBLE);
}
}
public void release() {
stop();
}
}

View File

@@ -0,0 +1,36 @@
package com.mogo.module.common.animation;
import com.mogo.module.common.R;
public class AnimationResources {
public static final int loadingRes[] = {
// R.drawable.v_to_x_loading_car0000,
// R.drawable.v_to_x_loading_car0002,
// R.drawable.v_to_x_loading_car0004,
// R.drawable.v_to_x_loading_car0006,
// R.drawable.v_to_x_loading_car0008,
// R.drawable.v_to_x_loading_car0010,
// R.drawable.v_to_x_loading_car0012,
// R.drawable.v_to_x_loading_car0014,
// R.drawable.v_to_x_loading_car0016,
// R.drawable.v_to_x_loading_car0018,
// R.drawable.v_to_x_loading_car0020,
// R.drawable.v_to_x_loading_car0022,
// R.drawable.v_to_x_loading_car0024,
// R.drawable.v_to_x_loading_car0025,
// R.drawable.v_to_x_loading_car0027,
// R.drawable.v_to_x_loading_car0029,
// R.drawable.v_to_x_loading_car0031,
// R.drawable.v_to_x_loading_car0033,
// R.drawable.v_to_x_loading_car0035,
// R.drawable.v_to_x_loading_car0037,
// R.drawable.v_to_x_loading_car0039,
// R.drawable.v_to_x_loading_car0041,
// R.drawable.v_to_x_loading_car0043,
// R.drawable.v_to_x_loading_car0045,
// R.drawable.v_to_x_loading_car0047,
// R.drawable.v_to_x_loading_car0048,
};
}

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

@@ -27,7 +27,7 @@ public class BaseFloatDialog extends Dialog {
}
private void addFlag() {
getWindow().setType(WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW + 10);
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);

View File

@@ -40,4 +40,6 @@ public interface MarkerPoiTypeEnum {
String FOURS_LIVING = "10015";
//违章停车
String ILLEGAL_PARK_LIVING = "10016";
//路面湿滑
String ROAD_SLIPPERY = "10021";
}

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 场景类型
*/
@@ -100,8 +137,12 @@ public class V2XMessageEntity<T> implements Serializable {
int ALERT_ROAD_LIVE_CAR_WARNING = 1_007;
// 道路事件违章停车
int ALERT_ILLEGAL_PARK_WARNING = 1_008;
// 呼叫、请求直播事件
int ALERT_VOICE_CALL_FOR_LIVECAR_SHOW = 1_009;
// 自车求助
int ALERT_CAR_FOR_HELP = 8_000;
// obu事件
int ALERT_OBU_EVENT = 9_000;
}
@IntDef(value = {
@@ -115,6 +156,8 @@ public class V2XMessageEntity<T> implements Serializable {
V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING,
V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
V2XTypeEnum.ALERT_CAR_FOR_HELP,
V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW,
V2XTypeEnum.ALERT_OBU_EVENT,
})
@Target({
ElementType.PARAMETER,

View File

@@ -0,0 +1,35 @@
package com.mogo.module.common.entity;
/**
* obu事件封装
*
* @author tongchenfei
*/
public class V2XObuEventEntity {
private int type;
private String desc;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
@Override
public String toString() {
return "V2XObuEventEntity{" +
"type=" + type +
", desc='" + desc + '\'' +
'}';
}
}

View File

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

View File

@@ -0,0 +1,71 @@
package com.mogo.module.common.glide;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
public
/**
* @author congtaowang
* @since 2020/9/2
*
* 描述
*/
class SkinAbleBitmapTarget extends SimpleTarget< Bitmap > {
private ImageView mTarget;
private RequestOptions mOptions;
public SkinAbleBitmapTarget( ImageView mTarget, RequestOptions mOptions ) {
super();
this.mTarget = mTarget;
this.mOptions = mOptions;
}
@Override
public void onResourceReady( @NonNull Bitmap resource, @Nullable Transition< ? super Bitmap > transition ) {
try {
mTarget.setImageResource( 0 );
mTarget.setImageBitmap(resource);
} catch( Exception e ){
e.printStackTrace();
}
}
@Override
public void onLoadCleared( @Nullable Drawable placeholder ) {
super.onLoadCleared( placeholder );
try {
mTarget.setImageResource( mOptions.getPlaceholderId() );
} catch ( Exception e ) {
e.printStackTrace();
}
}
@Override
public void onLoadStarted( @Nullable Drawable placeholder ) {
super.onLoadStarted( placeholder );
try {
mTarget.setImageResource( mOptions.getPlaceholderId() );
} catch ( Exception e ) {
e.printStackTrace();
}
}
@Override
public void onLoadFailed( @Nullable Drawable errorDrawable ) {
super.onLoadFailed( errorDrawable );
try {
mTarget.setImageResource( mOptions.getErrorId() );
} catch ( Exception e ) {
e.printStackTrace();
}
}
}

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

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