opt
This commit is contained in:
1
modules/mogo-module-apps/README.md
Normal file
1
modules/mogo-module-apps/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# 应用列表 + Launcher 模式下的左侧导航按钮
|
||||
@@ -45,7 +45,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.material
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.guideshowprovider
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogomap
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#-----AppModule-----
|
||||
-keep class com.mogo.module.apps.model.AppEnum
|
||||
-keep class com.mogo.module.apps.view.**{*;}
|
||||
-keep class com.mogo.module.apps.AppFilter
|
||||
5
modules/mogo-module-apps/proguard-rules.pro
vendored
5
modules/mogo-module-apps/proguard-rules.pro
vendored
@@ -19,3 +19,8 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file mName.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----AppModule-----
|
||||
-keep class com.mogo.module.apps.model.AppEnum
|
||||
-keep class com.mogo.module.apps.view.** {*;}
|
||||
-keep class com.mogo.module.apps.AppFilter
|
||||
|
||||
@@ -4,15 +4,11 @@ import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
|
||||
import com.mogo.module.apps.model.AppEnum;
|
||||
import com.mogo.module.apps.model.AppEnumHelper;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
|
||||
@@ -10,12 +10,14 @@ import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.apps.adapter.AppIndicatorAdapter;
|
||||
import com.mogo.module.apps.anim.AnimWrapper;
|
||||
import com.mogo.module.apps.applaunch.AppLauncher;
|
||||
import com.mogo.module.apps.applaunch.BaseAppLauncher;
|
||||
import com.mogo.module.apps.applaunch.InternalFunctionLauncher;
|
||||
import com.mogo.module.apps.model.AppEnum;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.NavigatorApps;
|
||||
import com.mogo.module.apps.view.OnAiAssistClickListener;
|
||||
@@ -128,7 +130,15 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
properties.put( "appname", appLabel );
|
||||
}
|
||||
if ( !TextUtils.equals( "全部应用", app.getName() ) ) {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext(), app.getPackageName() ) );
|
||||
if ( TextUtils.equals( "com.zhidao.music", app.getPackageName() ) ) {
|
||||
if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), AppEnum.KwMusic.getPkg() ) ) {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext(), AppEnum.KwMusic.getPkg() ) );
|
||||
} else if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), AppEnum.QQMusic.getPkg() ) ) {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext(), AppEnum.QQMusic.getPkg() ) );
|
||||
}
|
||||
} else {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext(), app.getPackageName() ) );
|
||||
}
|
||||
} else {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext() ) );
|
||||
}
|
||||
|
||||
@@ -4,22 +4,10 @@ import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.guideshow.provider.GuideShowProviderConstant;
|
||||
import com.mogo.module.guideshow.provider.IGuideShowProvider;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
|
||||
/**
|
||||
* author : zyz
|
||||
@@ -35,13 +23,11 @@ public class AppServiceHandler {
|
||||
private static IMogoServiceApis mApis;
|
||||
private static IMogoCardManager mMogoCardManager;
|
||||
private static IMogoAnalytics mMogoAnalytics;
|
||||
private static IGuideShowProvider mMogoGuideShow;
|
||||
|
||||
public static void init( final Context context ) {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( context );
|
||||
mMogoCardManager = mApis.getCardManagerApi();
|
||||
mMogoAnalytics = mApis.getAnalyticsApi();
|
||||
mMogoGuideShow = ( IGuideShowProvider ) ARouter.getInstance().build( GuideShowProviderConstant.GUIDE_SHOW_PROVIDER ).navigation( context );
|
||||
|
||||
}
|
||||
|
||||
@@ -53,10 +39,6 @@ public class AppServiceHandler {
|
||||
return mMogoAnalytics;
|
||||
}
|
||||
|
||||
public static IGuideShowProvider getMogoGuideShow() {
|
||||
return mMogoGuideShow;
|
||||
}
|
||||
|
||||
public static IMogoServiceApis getApis() {
|
||||
if ( mApis == null ) {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( AbsMogoApplication.getApp() );
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.apps;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
@@ -30,7 +31,7 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent
|
||||
private BottomSheetBehavior mBottomSheetBehavior;
|
||||
private IMogoFragmentManager mMogoFragmentManager;
|
||||
|
||||
public static void start( Activity context ) {
|
||||
public static void start( Context context ) {
|
||||
Intent starter = new Intent( context, AppsListActivity.class );
|
||||
context.startActivity( starter );
|
||||
}
|
||||
@@ -46,6 +47,24 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent
|
||||
AppServiceHandler.getApis().getStatusManagerApi().setAppListUIShow( TAG, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
try {
|
||||
AppServiceHandler.getApis().getAdasControllerApi().closeADAS();
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
try {
|
||||
AppServiceHandler.getApis().getAdasControllerApi().closeADAS();
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_apps_activity_list;
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package com.mogo.module.apps;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
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;
|
||||
@@ -24,7 +22,6 @@ import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.sql.ClientInfoStatus;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -54,11 +51,13 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
super( view );
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||
mCardManager = mApis.getCardManagerApi();
|
||||
InternalFunctionLauncher internalFunctionLauncher = new InternalFunctionLauncher( getContext() );
|
||||
CardAppLauncher cardAppLauncher = new CardAppLauncher( this, mCardManager );
|
||||
GuideShowLauncher guideShowLauncher = new GuideShowLauncher( mApis.getMapServiceApi().getNavi( getContext() ) );
|
||||
internalFunctionLauncher.setNext( cardAppLauncher );
|
||||
cardAppLauncher.setNext( guideShowLauncher );
|
||||
guideShowLauncher.setNext( new AppLauncher() );
|
||||
mLauncher = cardAppLauncher;
|
||||
mLauncher = internalFunctionLauncher;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,7 +129,7 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
if ( appInfo == null ) {
|
||||
continue;
|
||||
}
|
||||
if ( TextUtils.equals( appInfo.getPackageName(), app.getPackageName() ) ) {
|
||||
if ( appInfo.equals( app ) ) {
|
||||
addFlag = false;
|
||||
break;
|
||||
}
|
||||
@@ -145,14 +144,6 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
}
|
||||
}
|
||||
}
|
||||
// growthCapacity( result )
|
||||
// // 添加介绍入口
|
||||
// result.get( result.size() - 1 ).add( new AppInfo( GuideShowLauncher.APP_INFO_NAME_GUIDE_SHOW, getContext().getPackageName(), null, 0, null, R.drawable.module_apps_ic_guide_show ) );
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
// 添加测试入口
|
||||
growthCapacity( result );
|
||||
result.get( result.size() - 1 ).add( new AppInfo( "包管理程序", "com.mogo.packages.manager", null, 0, null, -1 ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,5 +14,7 @@ public interface AppLaunchFilter {
|
||||
|
||||
void launch( Context context, AppInfo appInfo );
|
||||
|
||||
void launch( Context context, String pkg );
|
||||
|
||||
void destroy();
|
||||
}
|
||||
|
||||
@@ -21,15 +21,7 @@ public class AppLauncher extends BaseAppLauncher {
|
||||
|
||||
@Override
|
||||
public void launch( Context context, AppInfo appInfo ) {
|
||||
try {
|
||||
if ( LaunchUtils.getLaunchIntentForPackage( context, appInfo.getPackageName() ) != null ) {
|
||||
AppServiceHandler.getApis().getAdasControllerApi().closeADAS();
|
||||
}
|
||||
LaunchUtils.launchByPkg( context, appInfo.getPackageName() );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
}
|
||||
launch( context, appInfo.getPackageName() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package com.mogo.module.apps.applaunch;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-09
|
||||
@@ -8,6 +16,8 @@ package com.mogo.module.apps.applaunch;
|
||||
*/
|
||||
public abstract class BaseAppLauncher implements AppLaunchFilter {
|
||||
|
||||
private static final String TAG = "BaseAppLauncher";
|
||||
|
||||
private AppLaunchFilter mNext;
|
||||
|
||||
public AppLaunchFilter getNext() {
|
||||
@@ -17,4 +27,17 @@ public abstract class BaseAppLauncher implements AppLaunchFilter {
|
||||
public void setNext( AppLaunchFilter next ) {
|
||||
this.mNext = next;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch( Context context, String pkg ) {
|
||||
try {
|
||||
if ( LaunchUtils.getLaunchIntentForPackage( context, pkg ) != null ) {
|
||||
AppServiceHandler.getApis().getAdasControllerApi().closeADAS();
|
||||
}
|
||||
LaunchUtils.launchByPkg( context, pkg );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,34 @@
|
||||
package com.mogo.module.apps.applaunch;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.AppsListActivity;
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.apps.model.AppEnum;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.common.map.CustomNaviInterrupter;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-05-14
|
||||
* <p>
|
||||
* 描述
|
||||
* 处理一些特殊的跳转
|
||||
*/
|
||||
public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
|
||||
private Activity mActivity;
|
||||
private Context mContext;
|
||||
|
||||
public InternalFunctionLauncher( Activity activity ) {
|
||||
this.mActivity = activity;
|
||||
public InternalFunctionLauncher( Context activity ) {
|
||||
this.mContext = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,7 +37,7 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
case "com.autonavi.amapauto":
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
try {
|
||||
LaunchUtils.launchByPkg( context, "com.autonavi.amapauto" );
|
||||
launch( context, AppEnum.AUTO_NAVI.getPkg() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -39,7 +46,31 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
}
|
||||
break;
|
||||
case "com.mogo.launcher.applist":
|
||||
AppsListActivity.start( mActivity );
|
||||
AppsListActivity.start( mContext );
|
||||
break;
|
||||
case "com.zhidao.bluetooth":
|
||||
if ( TextUtils.equals( "蓝牙音乐", appInfo.getName() ) ) {
|
||||
startActivity( context, appInfo, "com.zhidao.bluetooth.ui.MusicActivity" );
|
||||
} else if ( TextUtils.equals( "蓝牙电话", appInfo.getName() ) ) {
|
||||
startActivity( context, appInfo, "com.zhidao.bluetooth.ui.MainActivity" );
|
||||
}
|
||||
break;
|
||||
case "com.zhidao.music":
|
||||
if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), AppEnum.KwMusic.getPkg() ) ) {
|
||||
try {
|
||||
launch( context, AppEnum.KwMusic.getPkg() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), AppEnum.QQMusic.getPkg() ) ) {
|
||||
try {
|
||||
launch( context, AppEnum.QQMusic.getPkg() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ( getNext() != null ) {
|
||||
@@ -48,6 +79,26 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
}
|
||||
}
|
||||
|
||||
private void startActivity( Context context, AppInfo target, String page ) {
|
||||
if ( context == null || target == null ) {
|
||||
return;
|
||||
}
|
||||
if ( TextUtils.isEmpty( page ) ) {
|
||||
if ( getNext() != null ) {
|
||||
getNext().launch( context, target );
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent( new ComponentName( target.getPackageName(), page ) );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
context.startActivity( intent );
|
||||
} catch ( Exception e ) {
|
||||
TipToast.shortTip( "APP未安装" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if ( getNext() != null ) {
|
||||
|
||||
@@ -86,7 +86,8 @@ public enum AppEnum {
|
||||
CanBus( "车辆信息", "com.nwd.can.setting", R.drawable.module_apps_ic_canbus ),
|
||||
|
||||
// 蓝牙电话
|
||||
BT_PHONE( "蓝牙电话", "com.nwd.android.phone", R.drawable.module_apps_ic_bt_phone ),
|
||||
BT_PHONE_NWD( "蓝牙电话", "com.nwd.android.phone", R.drawable.module_apps_ic_bt_phone ),
|
||||
BT_PHONE( "蓝牙电话", "com.zhidao.bluetooth", R.drawable.module_apps_ic_bt_phone ),
|
||||
|
||||
// 本地音乐
|
||||
LOCAL_MUSIC( "本地音乐", "com.nwd.android.music.ui", R.drawable.module_apps_ic_local_music ),
|
||||
@@ -95,7 +96,8 @@ public enum AppEnum {
|
||||
WEATHER( "天气", "com.zhidao.weather", R.drawable.module_apps_ic_weather ),
|
||||
|
||||
// 蓝牙音乐
|
||||
BT_MUSIC( "蓝牙音乐", "com.nwd.bt.music", R.drawable.module_apps_ic_bt_music ),
|
||||
BT_MUSIC_NWD( "蓝牙音乐", "com.nwd.bt.music", R.drawable.module_apps_ic_bt_music ),
|
||||
BT_MUSIC( "蓝牙音乐", "com.zhidao.bluetooth", R.drawable.module_apps_ic_bt_music ),
|
||||
|
||||
// 高德地图
|
||||
AUTO_NAVI( "高德地图", "com.autonavi.amapauto", R.drawable.module_apps_ic_auto_navi ),
|
||||
|
||||
@@ -68,7 +68,8 @@ public class AppInfo {
|
||||
if ( this == o ) return true;
|
||||
if ( o == null || getClass() != o.getClass() ) return false;
|
||||
AppInfo appInfo = ( AppInfo ) o;
|
||||
return TextUtils.equals( mPackageName, appInfo.mPackageName );
|
||||
return TextUtils.equals( mPackageName, appInfo.mPackageName )
|
||||
&& TextUtils.equals( mName, appInfo.mName );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,7 @@ public class NavigatorApps {
|
||||
private static AppInfo app = new AppInfo( "高德地图", "com.autonavi.amapauto", "", 0, null, R.drawable.module_apps_ic_navigator_navi, 1 );
|
||||
private static AppInfo app_ = new AppInfo( "高德地图", "com.autonavi.amapauto", "", 0, null, R.drawable.module_apps_ic_navigator_navi_disable, 1 );
|
||||
// private static AppInfo app2 = new AppInfo( "音乐", "com.tencent.wecarflow", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 );
|
||||
private static AppInfo app2 = new AppInfo( "酷我音乐", "cn.kuwo.kwmusiccar", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 );
|
||||
private static AppInfo app2 = new AppInfo( "音乐", "com.zhidao.music", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 );
|
||||
private static AppInfo app3 = new AppInfo( "车聊聊", "com.zhidao.imdemo", "", 0, null, R.drawable.module_apps_ic_navigator_im, 6 );
|
||||
private static AppInfo app4 = new AppInfo( "全部应用", "com.mogo.launcher.applist", "", 0, null, R.drawable.module_apps_ic_navigator_applist, 4 );
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.module.apps.model;
|
||||
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,11 +16,17 @@ public class UnScannedApps {
|
||||
private static List< AppInfo > sUnScannedApps = new ArrayList<>();
|
||||
|
||||
static {
|
||||
sUnScannedApps.add( new AppInfo( AppEnum.BT_PHONE.getName(), AppEnum.BT_PHONE.getPkg(), null, 0, null, AppEnum.BT_PHONE.getIconResId() ) );
|
||||
sUnScannedApps.add( new AppInfo( AppEnum.CanBus.getName(), AppEnum.CanBus.getPkg(), null, 0, null, AppEnum.CanBus.getIconResId() ) );
|
||||
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
|
||||
sUnScannedApps.add( new AppInfo( AppEnum.BT_PHONE.getName(), AppEnum.BT_PHONE.getPkg(), null, 0, null, AppEnum.BT_PHONE.getIconResId() ) );
|
||||
sUnScannedApps.add( new AppInfo( AppEnum.BT_MUSIC.getName(), AppEnum.BT_MUSIC.getPkg(), null, 0, null, AppEnum.BT_PHONE.getIconResId() ) );
|
||||
} else {
|
||||
sUnScannedApps.add( new AppInfo( AppEnum.BT_PHONE_NWD.getName(), AppEnum.BT_PHONE_NWD.getPkg(), null, 0, null, AppEnum.BT_PHONE_NWD.getIconResId() ) );
|
||||
sUnScannedApps.add( new AppInfo( AppEnum.CanBus.getName(), AppEnum.CanBus.getPkg(), null, 0, null, AppEnum.CanBus.getIconResId() ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static List< AppInfo > getUnScannedApps() {
|
||||
return sUnScannedApps;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
<item>com.iflytek.inputmethod.pad</item>
|
||||
<item>com.nwd.tools.reboot</item>
|
||||
<item>com.android.car.setting</item>
|
||||
<item>com.zhidao.bootmanager</item>
|
||||
<item>com.zhidao.services</item>
|
||||
<item>com.android.settings</item>
|
||||
<item>com.android.documentsui</item>
|
||||
<item>com.android.messaging</item>
|
||||
<item>com.android.contacts</item>
|
||||
<item>com.android.dialer</item>
|
||||
</string-array>
|
||||
<string-array name="module_apps_array_filter_packages">
|
||||
<item>com.mogo.launcher</item>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
apply plugin: 'android-aspectjx'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
@@ -51,7 +50,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.aspectj
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
#-----AuthorizeModule-----
|
||||
-keep class com.mogo.module.authorize.module.bean.**{*;}
|
||||
@@ -19,3 +19,6 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----AuthorizeModule-----
|
||||
-keep class com.mogo.module.authorize.module.bean.**{*;}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.module.authorize.aspectj
|
||||
|
||||
import org.aspectj.lang.annotation.Aspect
|
||||
import org.aspectj.lang.annotation.Pointcut
|
||||
|
||||
@Aspect
|
||||
class VoiceForbiddenWhenAuthorize {
|
||||
|
||||
companion object{
|
||||
const val TAG = "VoiceForbiddenWhenAuthorize"
|
||||
}
|
||||
|
||||
@Pointcut()
|
||||
fun authorizeTrackPoint(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -131,6 +131,7 @@ open class IMogoAuthorizeController {
|
||||
}
|
||||
}
|
||||
onError {
|
||||
//todo
|
||||
Logger.d(TAG, it.message ?: "checkIfNeedAuthorize onError, message is null")
|
||||
setAuthorizeStatus(agreementType, true)
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListen
|
||||
import com.mogo.module.authorize.model.proxy.AuthorizeProxy
|
||||
import com.mogo.module.authorize.model.proxy.toAuthorizeType
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.needAuthorization
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.setAuthorizeStatus
|
||||
import com.mogo.module.authorize.util.isDeviceOfD
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
open abstract class MogoAuthorizeManagerImpl : IMogoAuthorizeInvoke {
|
||||
@@ -19,13 +17,9 @@ open abstract class MogoAuthorizeManagerImpl : IMogoAuthorizeInvoke {
|
||||
private val baseController: IMogoAuthorizeController by lazy { IMogoAuthorizeController() }
|
||||
|
||||
override fun needAuthorize(tag: String): Boolean {
|
||||
return if (isDeviceOfD()) {
|
||||
Logger.d(TAG, "===== needAuthorize update agreement in background")
|
||||
baseController.checkIfNeedAuthorize(tag.toAuthorizeType())
|
||||
needAuthorization(tag.toAuthorizeType())
|
||||
} else {
|
||||
false
|
||||
}
|
||||
Logger.d(TAG, "===== needAuthorize update agreement in background")
|
||||
baseController.checkIfNeedAuthorize(tag.toAuthorizeType())
|
||||
return needAuthorization(tag.toAuthorizeType())
|
||||
}
|
||||
|
||||
override fun updateAuthorizeStatus(tag: String) {
|
||||
|
||||
@@ -9,24 +9,24 @@ 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.authorize.authprovider.invoke.AuthorizeConstant.Companion.PATH_AGREEMENT_FRAGMENT
|
||||
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.Companion.mogoAuthShow
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.hasGuide
|
||||
import com.mogo.module.authorize.util.isDeviceOfD
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.auth.IMogoAuthManager
|
||||
import com.mogo.service.module.IMogoModuleLifecycle
|
||||
import com.mogo.service.module.IMogoModuleProvider
|
||||
import com.mogo.service.module.ModuleType
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
@Route(path = PATH_AGREEMENT_FRAGMENT)
|
||||
class MogoAuthorizeProvider : IMogoModuleProvider {
|
||||
@Route(path = MogoServicePaths.PATH_AGREEMENT)
|
||||
class MogoAuthorizeProvider : IMogoAuthManager {
|
||||
|
||||
companion object {
|
||||
const val TAG = "MogoAuthorizeProvider"
|
||||
}
|
||||
|
||||
private var mContext:Context? = null
|
||||
|
||||
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
|
||||
return null
|
||||
}
|
||||
@@ -48,7 +48,7 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
|
||||
}
|
||||
|
||||
override fun getType(): Int {
|
||||
return ModuleType.TYPE_SERVICE
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun getNaviListener(): IMogoNaviListener? {
|
||||
@@ -63,11 +63,10 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
//todo 引导判断暂时去掉 后续引导流程更改完再放开
|
||||
// todo if (isDeviceOfD() && hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
if (isDeviceOfD() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
mogoAuthShow.invokeAuthorizeForShow(context)
|
||||
override fun resetContext(context: Context?) {
|
||||
mContext = context
|
||||
if (mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
mogoAuthShow.invokeAuthorizeForShow(mContext!!)
|
||||
} else {
|
||||
//首次进入Launcher同步一下授权状态,防止由于用户清除数据造成首次加载还会出现授权状态不同步问题
|
||||
mogoAuthShow.updateAuthorizeStatus(AUTHORIZE_TYPE_LAUNCHER_MAIN)
|
||||
@@ -75,6 +74,13 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
|
||||
}
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
//todo 引导判断暂时去掉 后续引导流程更改完再放开
|
||||
// todo if (isDeviceOfD() && hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
// todo F系列暂时没有授权功能 1.1需求中添加 全量上
|
||||
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String? {
|
||||
return null
|
||||
}
|
||||
@@ -82,4 +88,5 @@ class MogoAuthorizeProvider : IMogoModuleProvider {
|
||||
override fun getAppName(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,11 +6,6 @@ class AuthorizeConstant {
|
||||
const val PROVIDER_MODULE = "/authorize/biz"
|
||||
const val PROVIDER_LAUNCHER = "/authorize/showbiz"
|
||||
|
||||
/**
|
||||
* 展示用户协议模块地址
|
||||
*/
|
||||
const val PATH_AGREEMENT_FRAGMENT = "/agreement/showFragment"
|
||||
|
||||
/**
|
||||
* provider模块实例名称(暂时仅有卡片用到)
|
||||
*/
|
||||
|
||||
@@ -2,15 +2,12 @@ package com.mogo.module.authorize.authprovider.launcher
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Looper
|
||||
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.invoke.AuthorizeInvokerConstant
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
|
||||
import com.mogo.module.authorize.layout.AuthorizeLayout
|
||||
import com.mogo.module.authorize.layout.AuthorizeDialog
|
||||
import com.mogo.module.authorize.model.proxy.toAuthorizeType
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.hasAuth
|
||||
import com.mogo.module.common.wm.WindowManagerView
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMogoAuthorizeMainProvider {
|
||||
@@ -24,7 +21,9 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
|
||||
}
|
||||
}
|
||||
|
||||
private var windowManagerView: WindowManagerView? = null
|
||||
private var mContext: Context? = null
|
||||
|
||||
private var authorizeDialog: AuthorizeDialog? = null
|
||||
|
||||
override fun hasRegister(tag: String): Boolean {
|
||||
if (tag.isNullOrBlank()) return false
|
||||
@@ -41,7 +40,8 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
|
||||
}
|
||||
|
||||
fun invokeAuthorizeForShow(context: Context) {
|
||||
pushLayoutToMainWindow(context, AUTHORIZE_TYPE_LAUNCHER_MAIN)
|
||||
mContext = context
|
||||
pushLayoutToMainWindow(AUTHORIZE_TYPE_LAUNCHER_MAIN)
|
||||
}
|
||||
|
||||
fun showAuthorizeView(tag: String, forbiddenVoice: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
@@ -64,25 +64,26 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
|
||||
Logger.d(TAG, "ready to forbidden voice")
|
||||
forbiddenVoice.invoke()
|
||||
Logger.d(TAG, "ready to push fragment")
|
||||
pushLayoutToMainWindow(AbsMogoApplication.getApp().applicationContext,tag)
|
||||
pushLayoutToMainWindow(tag)
|
||||
}
|
||||
|
||||
fun hideAuthorizeView() {
|
||||
windowManagerView?.dismiss()
|
||||
authorizeDialog?.dismiss()
|
||||
}
|
||||
|
||||
private fun pushLayoutToMainWindow(context: Context,tag: String) {
|
||||
if (windowManagerView == null) {
|
||||
val authorizeLayout = AuthorizeLayout(tag)
|
||||
val view = authorizeLayout.getLayoutView()
|
||||
windowManagerView = WindowManagerView.Builder(context).contentView(view).build()
|
||||
private fun pushLayoutToMainWindow(tag: String) {
|
||||
if (authorizeDialog == null) {
|
||||
authorizeDialog = AuthorizeDialog(tag, mContext!!)
|
||||
authorizeDialog!!.setOnDismissListener {
|
||||
authorizeDialog = null
|
||||
}
|
||||
}
|
||||
if (windowManagerView!!.isShowing) {
|
||||
if (authorizeDialog!!.isShowing) {
|
||||
Logger.d(TAG, "User is operation authorization, do not repeat invoke")
|
||||
return
|
||||
} else {
|
||||
Logger.d(TAG, "pushLayoutToMainWindow")
|
||||
windowManagerView!!.show()
|
||||
authorizeDialog!!.show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
package com.mogo.module.authorize.layout
|
||||
|
||||
import android.content.Context
|
||||
import android.text.Html
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.module.authorize.R
|
||||
import com.mogo.module.authorize.util.AnalyticsUtil
|
||||
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.utils.TipToast
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class AuthorizeDialog : BaseFloatDialog, View.OnClickListener, IVoiceCommandListener, IVoiceAuthorizeIntentListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizeDialog"
|
||||
}
|
||||
|
||||
private var mContext: Context? = null
|
||||
private var invokeTag: String? = null
|
||||
|
||||
private var agreementId: Long = 0L
|
||||
|
||||
private var clTopParent: ConstraintLayout? = null
|
||||
private var clErrorContainer: ConstraintLayout? = null
|
||||
private var clLoadAuthorizeContainer: ConstraintLayout? = null
|
||||
private var clContainer: ConstraintLayout? = null
|
||||
private var clAuthorizeLoading: ConstraintLayout? = null
|
||||
private var btnAgree: Button? = null
|
||||
private var btnDisAgree: Button? = null
|
||||
private var btnLoadingError: Button? = null
|
||||
private var tvTitle: TextView? = null
|
||||
private var tvContent: TextView? = null
|
||||
private var tvButtonContent: TextView? = null
|
||||
private var tvLastContent: TextView? = null
|
||||
|
||||
private var authorizeController: AuthorizeController? = null
|
||||
|
||||
constructor(invokeTag: String, context: Context) : super(context) {
|
||||
mContext = context
|
||||
this.invokeTag = invokeTag
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
setContentView(R.layout.module_authorize_fragment)
|
||||
setWrapContent()
|
||||
initViews()
|
||||
}
|
||||
|
||||
private fun setWrapContent() {
|
||||
val mWindow = window
|
||||
if(DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD){
|
||||
if (mWindow != null) {
|
||||
val lp = mWindow.attributes
|
||||
lp.width = 1024
|
||||
lp.height = 600
|
||||
mWindow.attributes = lp
|
||||
}
|
||||
}else{
|
||||
if (mWindow != null) {
|
||||
val lp = mWindow.attributes
|
||||
lp.width = 1920
|
||||
lp.height = 1000
|
||||
mWindow.attributes = lp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun initViews() {
|
||||
Logger.d(TAG, "initView ")
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_SHOW)
|
||||
init()
|
||||
Logger.d(TAG, "invokeTag :$invokeTag")
|
||||
authorizeController = AuthorizeController(invokeTag!!)
|
||||
invokeAuthorizationContent()
|
||||
VoiceUtil.registerAll(this, this)
|
||||
}
|
||||
|
||||
private fun init() {
|
||||
clTopParent = findViewById(R.id.clAuthorizeTopParent)
|
||||
clErrorContainer = findViewById(R.id.clLoadingErrorContainer)
|
||||
clLoadAuthorizeContainer = findViewById(R.id.clLoadingAuthorizeContainer)
|
||||
clContainer = findViewById(R.id.clAuthorizeContainer)
|
||||
clAuthorizeLoading = findViewById(R.id.clAuthorizeLoading)
|
||||
btnAgree = findViewById(R.id.btnAuthorizeAgree)
|
||||
btnDisAgree = findViewById(R.id.btnAuthorizeDisAgree)
|
||||
btnLoadingError = findViewById(R.id.btnAuthorizeLoadingError)
|
||||
tvTitle = findViewById(R.id.tvAuthorizeTitle)
|
||||
tvContent = findViewById(R.id.tvAuthorizeContent)
|
||||
tvButtonContent = findViewById(R.id.tvAuthorizeButtonContent)
|
||||
tvLastContent = findViewById(R.id.tvAuthorizeLastContent)
|
||||
btnAgree?.setOnClickListener(this)
|
||||
btnDisAgree?.setOnClickListener(this)
|
||||
btnLoadingError?.setOnClickListener(this)
|
||||
clTopParent?.setOnClickListener(this)
|
||||
clContainer?.setOnClickListener(this)
|
||||
clErrorContainer?.setOnClickListener(this)
|
||||
clLoadAuthorizeContainer?.setOnClickListener(this)
|
||||
clAuthorizeLoading?.setOnClickListener(this)
|
||||
}
|
||||
|
||||
private fun readyToAuthorize() {
|
||||
clErrorContainer?.visibility = View.GONE
|
||||
clLoadAuthorizeContainer?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun showAuthorizationAgreementContent(
|
||||
agreementId: Long,
|
||||
agreementContent: String,
|
||||
agreementTitle: String,
|
||||
agreementBottom: String,
|
||||
agreementLast: String) {
|
||||
VoiceUtil.speak(AbsMogoApplication.getApp().applicationContext.resources.getString(R.string.module_authorize_agreement_tip), AbsMogoApplication.getApp().applicationContext, this)
|
||||
this.agreementId = agreementId
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clContainer?.visibility = View.VISIBLE
|
||||
tvTitle?.text = Html.fromHtml(agreementTitle)
|
||||
GlobalScope.async(Dispatchers.IO) {
|
||||
val spannable = Html.fromHtml(agreementContent)
|
||||
withContext(Dispatchers.Main) {
|
||||
tvContent?.text = spannable
|
||||
}
|
||||
}
|
||||
tvButtonContent?.text = Html.fromHtml(agreementBottom)
|
||||
tvLastContent?.text = Html.fromHtml(agreementLast)
|
||||
}
|
||||
|
||||
private fun showAuthorizationError() {
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clErrorContainer?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun voiceAuthorizeError() {
|
||||
TipToast.shortTip("授权失败,请稍后重试")
|
||||
VoiceUtil.speak(AbsMogoApplication.getApp().applicationContext.getString(R.string.module_authorize_failed), AbsMogoApplication.getApp().applicationContext, this)
|
||||
Logger.d(TAG, "onDestroy")
|
||||
VoiceUtil.unregisterAll(AbsMogoApplication.getApp().applicationContext, this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.btnAuthorizeAgree -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 1, "operation_result" to 1))
|
||||
agreeAuthorize()
|
||||
}
|
||||
R.id.btnAuthorizeDisAgree -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 1, "operation_result" to 2))
|
||||
disAgreeAuthorize()
|
||||
}
|
||||
R.id.clLoadingErrorContainer, R.id.btnAuthorizeLoadingError -> {
|
||||
invokeAuthorizationContent()
|
||||
}
|
||||
R.id.clAuthorizeTopParent -> {
|
||||
Logger.i(TAG, "dismiss authorizeView")
|
||||
authorizeController?.onDestroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVoiceCmdAgree() {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 2, "operation_result" to 1))
|
||||
agreeAuthorize()
|
||||
}
|
||||
|
||||
override fun onVoiceCmdDisAgree() {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 2, "operation_result" to 2))
|
||||
disAgreeAuthorize()
|
||||
}
|
||||
|
||||
private fun agreeAuthorize() {
|
||||
authorizeController?.agreeAuthorize(invokeTag!!, agreementId) {
|
||||
voiceAuthorizeError()
|
||||
}
|
||||
}
|
||||
|
||||
private fun disAgreeAuthorize() {
|
||||
authorizeController?.disAgreeAuthorize(invokeTag!!, agreementId) {
|
||||
voiceAuthorizeError()
|
||||
}
|
||||
}
|
||||
|
||||
private fun invokeAuthorizationContent() {
|
||||
authorizeController?.invokeAuthorizationContent(invokeTag!!, {
|
||||
readyToAuthorize()
|
||||
}, { id: Long, content: String, title: String, bottomContent: String, lastContent: String ->
|
||||
showAuthorizationAgreementContent(id, content, title, bottomContent, lastContent)
|
||||
}, {
|
||||
showAuthorizationError()
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -50,11 +50,11 @@ class AuthorizeLayout(private val invokeTag: String) : View.OnClickListener, IVo
|
||||
return layoutInflater
|
||||
}
|
||||
|
||||
private fun getLayoutId(): Int {
|
||||
fun getLayoutId(): Int {
|
||||
return R.layout.module_authorize_fragment
|
||||
}
|
||||
|
||||
private fun initViews(mRootView: View) {
|
||||
fun initViews(mRootView: View) {
|
||||
Logger.d(TAG, "initView ")
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_SHOW)
|
||||
init(mRootView)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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_59" />
|
||||
<gradient android:endColor="#805CC1FF" android:startColor="#803E7FFC" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_59" />
|
||||
<gradient android:endColor="#5CC1FF" android:startColor="#3E7FFC" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -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:bottomLeftRadius="@dimen/dp_30" />
|
||||
<gradient android:endColor="#805CC1FF" android:startColor="#803E7FFC" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:bottomLeftRadius="@dimen/dp_30" />
|
||||
<gradient android:endColor="#5CC1FF" android:startColor="#3E7FFC" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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:endColor="#3F4057"
|
||||
android:startColor="#50526E " />
|
||||
</shape>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,210 @@
|
||||
<?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="#CC000000">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clLoadingAuthorizeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_301"
|
||||
android:layout_marginTop="@dimen/dp_100"
|
||||
android:layout_marginRight="@dimen/dp_301"
|
||||
android:layout_marginBottom="@dimen/dp_100"
|
||||
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_154"
|
||||
android:layout_height="@dimen/dp_154"
|
||||
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_40"
|
||||
android:text="@string/module_authorize_agreement_loading"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:textSize="@dimen/dp_40"
|
||||
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_301"
|
||||
android:layout_marginTop="@dimen/dp_100"
|
||||
android:layout_marginRight="@dimen/dp_301"
|
||||
android:layout_marginBottom="@dimen/dp_100"
|
||||
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_400"
|
||||
android:layout_height="@dimen/dp_110"
|
||||
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_40"
|
||||
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_125"
|
||||
android:layout_height="@dimen/dp_125"
|
||||
android:layout_marginTop="@dimen/dp_155"
|
||||
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_29"
|
||||
android:text="@string/module_authorize_agreement_error"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_40"
|
||||
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_301"
|
||||
android:layout_marginTop="@dimen/dp_110"
|
||||
android:layout_marginRight="@dimen/dp_301"
|
||||
android:layout_marginBottom="@dimen/dp_110"
|
||||
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_123"
|
||||
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:textSize="@dimen/dp_40"
|
||||
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_123"
|
||||
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:textSize="@dimen/dp_40"
|
||||
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:layout_marginBottom="@dimen/dp_139"
|
||||
android:scrollbarSize="@dimen/dp_442"
|
||||
android:layout_marginTop="@dimen/dp_35"
|
||||
android:scrollbarTrackHorizontal="@drawable/module_authorize_scrollbar"
|
||||
android:scrollbarThumbVertical="@drawable/module_authorize_scrollbar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvAuthorizeTitle">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
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="@android:color/white"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeButtonContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
|
||||
<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="@android:color/white"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
</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>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
1
modules/mogo-module-back/README.md
Normal file
1
modules/mogo-module-back/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# Launcher 模式下分体机F系列的返回桌面悬浮按钮 和 "返回桌面"语音指令
|
||||
@@ -1,6 +1,6 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
|
||||
android {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
#-----ModuleBack-----
|
||||
-keep class com.mogo.module.back.BackToLauncherConst.*{*;}
|
||||
3
modules/mogo-module-back/proguard-rules.pro
vendored
3
modules/mogo-module-back/proguard-rules.pro
vendored
@@ -19,3 +19,6 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----ModuleBack-----
|
||||
-keep class com.mogo.module.back.BackToLauncherConst.*{*;}
|
||||
11
modules/mogo-module-common/README.md
Normal file
11
modules/mogo-module-common/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 基础框架
|
||||
|
||||
## 基于 WindowManger.addView 方式实现的弹窗
|
||||
|
||||
## 大而全数据定义
|
||||
|
||||
## 地图中心点控制策略
|
||||
|
||||
## 自研车机类型判断
|
||||
|
||||
## 模块加载类
|
||||
@@ -0,0 +1,8 @@
|
||||
#-----CommonModule-----
|
||||
-keep class com.mogo.module.common.entity.** {*;}
|
||||
-keep class com.mogo.module.common.map.Interrupter
|
||||
-keep class com.mogo.module.common.map.Scene
|
||||
-keep class com.mogo.module.common.wm.** {*;}
|
||||
-keep class com.mogo.module.common.ModuleNames
|
||||
-keep class com.mogo.module.common.ModuleType
|
||||
-keep class com.mogo.module.common.MogoModulePaths
|
||||
@@ -19,3 +19,10 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----CommonModule-----
|
||||
-keep class com.mogo.module.common.entity.** {*;}
|
||||
-keep class com.mogo.module.common.map.Interrupter
|
||||
-keep class com.mogo.module.common.map.Scene
|
||||
-keep class com.mogo.module.common.wm.** {*;}
|
||||
-keep class com.mogo.module.common.MogoModulePaths
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.R;
|
||||
|
||||
/**
|
||||
@@ -20,7 +21,9 @@ public class BaseFloatDialog extends Dialog {
|
||||
|
||||
public BaseFloatDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
addFlag();
|
||||
if(DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD) {
|
||||
addFlag();
|
||||
}
|
||||
}
|
||||
|
||||
private void addFlag() {
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:25 PM
|
||||
* desc : V2X事件列表展示
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XEventShowEntity implements Serializable {
|
||||
|
||||
// 0---默认展示详情,1--直播,4--道路事件详情
|
||||
private int viewType;
|
||||
|
||||
// 道路事件详情
|
||||
private V2XRoadEventEntity v2XRoadEventEntity;
|
||||
// 直播车机 @see viewType = 1
|
||||
private V2XLiveCarInfoEntity v2XLiveCarInfoRes;
|
||||
// 直播车机列表
|
||||
private List<V2XLiveCarInfoEntity> v2XLiveCarList;
|
||||
|
||||
public int getViewType() {
|
||||
return viewType;
|
||||
}
|
||||
|
||||
public void setViewType(int viewType) {
|
||||
this.viewType = viewType;
|
||||
}
|
||||
|
||||
public V2XRoadEventEntity getV2XRoadEventEntity() {
|
||||
return v2XRoadEventEntity;
|
||||
}
|
||||
|
||||
public void setV2XRoadEventEntity(V2XRoadEventEntity v2XRoadEventEntity) {
|
||||
this.v2XRoadEventEntity = v2XRoadEventEntity;
|
||||
}
|
||||
|
||||
public V2XLiveCarInfoEntity getV2XLiveCarInfoRes() {
|
||||
return v2XLiveCarInfoRes;
|
||||
}
|
||||
|
||||
public void setV2XLiveCarInfoRes(V2XLiveCarInfoEntity v2XLiveCarInfoRes) {
|
||||
this.v2XLiveCarInfoRes = v2XLiveCarInfoRes;
|
||||
}
|
||||
|
||||
public List<V2XLiveCarInfoEntity> getV2XLiveCarList() {
|
||||
return v2XLiveCarList;
|
||||
}
|
||||
|
||||
public void setV2XLiveCarList(List<V2XLiveCarInfoEntity> v2XLiveCarList) {
|
||||
this.v2XLiveCarList = v2XLiveCarList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
V2XEventShowEntity that = (V2XEventShowEntity) o;
|
||||
return viewType == that.viewType &&
|
||||
Objects.equals(v2XRoadEventEntity, that.v2XRoadEventEntity) &&
|
||||
Objects.equals(v2XLiveCarInfoRes, that.v2XLiveCarInfoRes) &&
|
||||
Objects.equals(v2XLiveCarList, that.v2XLiveCarList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(viewType, v2XRoadEventEntity, v2XLiveCarInfoRes, v2XLiveCarList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XEventShowEntity{" +
|
||||
"viewType=" + viewType +
|
||||
", v2XRoadEventEntity=" + v2XRoadEventEntity +
|
||||
", v2XLiveCarInfoRes=" + v2XLiveCarInfoRes +
|
||||
", v2XLiveCarList=" + v2XLiveCarList +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 可直播车机基本信息,再通过 appDataService/integratedServices/app/push/no/livePush/v1
|
||||
* 获取直播信息
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XLiveCarInfoEntity {
|
||||
private String sn;
|
||||
private double lon;
|
||||
private double lat;
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
V2XLiveCarInfoEntity that = (V2XLiveCarInfoEntity) o;
|
||||
return Double.compare(that.lon, lon) == 0 &&
|
||||
Double.compare(that.lat, lat) == 0 &&
|
||||
Objects.equals(sn, that.sn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sn, lon, lat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XLiveCarEntity{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 4:35 PM
|
||||
* desc : V2X 场景消息聚合
|
||||
* version: 1.0
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XMessageEntity<T> implements Serializable {
|
||||
|
||||
/**
|
||||
* 场景类型
|
||||
*
|
||||
* @see V2XTypeEnum
|
||||
*/
|
||||
@MessageType
|
||||
int type;
|
||||
|
||||
/**
|
||||
* 是否展示对话框
|
||||
* true-展示,false-不展示
|
||||
*/
|
||||
boolean showState;
|
||||
|
||||
/**
|
||||
* 场景具体的数据内容
|
||||
*/
|
||||
T content;
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(@MessageType int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isShowState() {
|
||||
return showState;
|
||||
}
|
||||
|
||||
public void setShowState(boolean showState) {
|
||||
this.showState = showState;
|
||||
}
|
||||
|
||||
public T getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(T content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
V2XMessageEntity<?> that = (V2XMessageEntity<?>) o;
|
||||
return type == that.type &&
|
||||
content.equals(that.content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(type, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* V2X 场景类型
|
||||
*/
|
||||
public interface V2XTypeEnum {
|
||||
// 道路事件预警
|
||||
int ALERT_ROAD_WARNING = 1_000;
|
||||
// 他车求助预警
|
||||
int ALERT_SEEK_WARNING = 1_001;
|
||||
// 疲劳驾驶预警
|
||||
int ALERT_FATIGUE_DRIVING = 1_002;
|
||||
// 后台推送展示 Window
|
||||
int ALERT_PUSH_WINDOW_WARNING = 1_003;
|
||||
// 后台推送展示 Toast
|
||||
int ALERT_PUSH_TOAST_WARNING = 1_004;
|
||||
// 后台推送展示 展示的直播
|
||||
int ALERT_PUSH_LIVE_CAR_WARNING = 1_005;
|
||||
// V2X场景动画展示
|
||||
int ALERT_ANIMATION_WARNING = 1_006;
|
||||
// 道路事件直播预警
|
||||
int ALERT_ROAD_LIVE_CAR_WARNING = 1_007;
|
||||
// 道路事件违章停车
|
||||
int ALERT_ILLEGAL_PARK_WARNING = 1_008;
|
||||
// 自车求助
|
||||
int ALERT_CAR_FOR_HELP = 8_000;
|
||||
}
|
||||
|
||||
@IntDef(value = {
|
||||
V2XTypeEnum.ALERT_ROAD_WARNING,
|
||||
V2XTypeEnum.ALERT_SEEK_WARNING,
|
||||
V2XTypeEnum.ALERT_FATIGUE_DRIVING,
|
||||
V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING,
|
||||
V2XTypeEnum.ALERT_PUSH_TOAST_WARNING,
|
||||
V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING,
|
||||
V2XTypeEnum.ALERT_ANIMATION_WARNING,
|
||||
V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING,
|
||||
V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
|
||||
V2XTypeEnum.ALERT_CAR_FOR_HELP,
|
||||
})
|
||||
@Target({
|
||||
ElementType.PARAMETER,
|
||||
ElementType.FIELD,
|
||||
ElementType.METHOD,
|
||||
}) //表示注解作用范围,参数注解,成员注解,方法注解
|
||||
@Retention(RetentionPolicy.SOURCE) //表示注解所存活的时间,在运行时,而不会存在 .class 文件中
|
||||
public @interface MessageType { //接口,定义新的注解类型
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/31 4:53 PM
|
||||
* desc : V2X 道路事件类型
|
||||
* version: 1.0
|
||||
*/
|
||||
public interface V2XPoiTypeEnum extends MarkerPoiTypeEnum {
|
||||
// 前方静止or慢速车辆报警
|
||||
String ALERT_FRONT_CAR = "99999";
|
||||
// 限行管理
|
||||
String ALERT_TRAFFIC_CONTROL = "99998";
|
||||
// 红绿灯事件、是建议以多少速度驶过
|
||||
String ALERT_TRAFFIC_LIGHT_SUGGEST = "99997";
|
||||
// 红绿灯事件、一种是绿灯不足3秒
|
||||
String ALERT_TRAFFIC_LIGHT_WARNING = "99996";
|
||||
// 故障车辆
|
||||
int ALERT_CAR_TROUBLE_WARNING = 20007;
|
||||
|
||||
// TODO 这里目前是演示DEMO会用到,想着是打算商用,先这么处理的
|
||||
// 取快递
|
||||
String ALERT_TRAFFIC_EXPRESS = "99995";
|
||||
// 顺风车
|
||||
String ALERT_TRAFFIC_TAXI = "99994";
|
||||
// 疲劳驾驶
|
||||
String ALERT_FATIGUE_DRIVING = "99993";
|
||||
// 违章停车
|
||||
String ALERT_ILLEGAL_PARK = "99992";
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-02-0315:49
|
||||
* desc : V2X警报数据
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushMessageEntity implements Serializable {
|
||||
// 0---默认展示详情,1--直播,2--停车场,3--加油站,4--道路事件详情
|
||||
private int viewType;
|
||||
private String sceneId;
|
||||
private String sceneName;
|
||||
private short sceneCategory;
|
||||
private short sceneLevel;
|
||||
private String sceneDescription;
|
||||
private boolean zoom;
|
||||
private int zoomScale;
|
||||
private String alarmContent;
|
||||
private String tts;
|
||||
private String videoUrl;
|
||||
private String videoSn;
|
||||
private String videoChannel;
|
||||
private int expireTime;
|
||||
private double lat;
|
||||
private double lon;
|
||||
private String sn;
|
||||
private String headImgUrl;
|
||||
private String msgImgUrl;
|
||||
private String address;
|
||||
private double distance;
|
||||
private boolean isShowWindow;
|
||||
|
||||
public int getViewType() {
|
||||
return viewType;
|
||||
}
|
||||
|
||||
public void setViewType(int viewType) {
|
||||
this.viewType = viewType;
|
||||
}
|
||||
|
||||
public String getSceneId() {
|
||||
return sceneId;
|
||||
}
|
||||
|
||||
public void setSceneId(String sceneId) {
|
||||
this.sceneId = sceneId;
|
||||
}
|
||||
|
||||
public String getSceneName() {
|
||||
return sceneName;
|
||||
}
|
||||
|
||||
public void setSceneName(String sceneName) {
|
||||
this.sceneName = sceneName;
|
||||
}
|
||||
|
||||
public short getSceneCategory() {
|
||||
return sceneCategory;
|
||||
}
|
||||
|
||||
public void setSceneCategory(short sceneCategory) {
|
||||
this.sceneCategory = sceneCategory;
|
||||
}
|
||||
|
||||
public short getSceneLevel() {
|
||||
return sceneLevel;
|
||||
}
|
||||
|
||||
public void setSceneLevel(short sceneLevel) {
|
||||
this.sceneLevel = sceneLevel;
|
||||
}
|
||||
|
||||
public String getSceneDescription() {
|
||||
return sceneDescription;
|
||||
}
|
||||
|
||||
public void setSceneDescription(String sceneDescription) {
|
||||
this.sceneDescription = sceneDescription;
|
||||
}
|
||||
|
||||
public boolean isZoom() {
|
||||
return zoom;
|
||||
}
|
||||
|
||||
public void setZoom(boolean zoom) {
|
||||
this.zoom = zoom;
|
||||
}
|
||||
|
||||
public String getAlarmContent() {
|
||||
if (TextUtils.isEmpty(alarmContent)) {
|
||||
return "";
|
||||
}
|
||||
return alarmContent;
|
||||
}
|
||||
|
||||
public void setAlarmContent(String alarmContent) {
|
||||
this.alarmContent = alarmContent;
|
||||
}
|
||||
|
||||
public String getTts() {
|
||||
if (TextUtils.isEmpty(tts)) {
|
||||
return "";
|
||||
}
|
||||
return tts;
|
||||
}
|
||||
|
||||
public void setTts(String tts) {
|
||||
this.tts = tts;
|
||||
}
|
||||
|
||||
public String getVideoUrl() {
|
||||
return videoUrl;
|
||||
}
|
||||
|
||||
public void setVideoUrl(String videoUrl) {
|
||||
this.videoUrl = videoUrl;
|
||||
}
|
||||
|
||||
public String getVideoSn() {
|
||||
return videoSn;
|
||||
}
|
||||
|
||||
public void setVideoSn(String videoSn) {
|
||||
this.videoSn = videoSn;
|
||||
}
|
||||
|
||||
public String getVideoChannel() {
|
||||
return videoChannel;
|
||||
}
|
||||
|
||||
public void setVideoChannel(String videoChannel) {
|
||||
this.videoChannel = videoChannel;
|
||||
}
|
||||
|
||||
public int getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public void setExpireTime(int expireTime) {
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
|
||||
public int getZoomScale() {
|
||||
return zoomScale;
|
||||
}
|
||||
|
||||
public void setZoomScale(int zoomScale) {
|
||||
this.zoomScale = zoomScale;
|
||||
}
|
||||
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getHeadImgUrl() {
|
||||
return headImgUrl;
|
||||
}
|
||||
|
||||
public void setHeadImgUrl(String headImgUrl) {
|
||||
this.headImgUrl = headImgUrl;
|
||||
}
|
||||
|
||||
public String getMsgImgUrl() {
|
||||
return msgImgUrl;
|
||||
}
|
||||
|
||||
public void setMsgImgUrl(String msgImgUrl) {
|
||||
this.msgImgUrl = msgImgUrl;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public boolean isShowWindow() {
|
||||
return isShowWindow;
|
||||
}
|
||||
|
||||
public void setShowWindow(boolean showWindow) {
|
||||
isShowWindow = showWindow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
V2XPushMessageEntity that = (V2XPushMessageEntity) o;
|
||||
return Objects.equals(sceneId, that.sceneId) &&
|
||||
Objects.equals(tts, that.tts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sceneId, tts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XPushMessageEntity{" +
|
||||
"viewType=" + viewType +
|
||||
", sceneId='" + sceneId + '\'' +
|
||||
", sceneName='" + sceneName + '\'' +
|
||||
", sceneCategory=" + sceneCategory +
|
||||
", sceneLevel=" + sceneLevel +
|
||||
", sceneDescription='" + sceneDescription + '\'' +
|
||||
", zoom=" + zoom +
|
||||
", zoomScale=" + zoomScale +
|
||||
", alarmContent='" + alarmContent + '\'' +
|
||||
", tts='" + tts + '\'' +
|
||||
", videoUrl='" + videoUrl + '\'' +
|
||||
", videoSn='" + videoSn + '\'' +
|
||||
", videoChannel='" + videoChannel + '\'' +
|
||||
", expireTime=" + expireTime +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", sn='" + sn + '\'' +
|
||||
", headImgUrl='" + headImgUrl + '\'' +
|
||||
", msgImgUrl='" + msgImgUrl + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
", distance=" + distance +
|
||||
", isShowWindow=" + isShowWindow +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/13 11:17 AM
|
||||
* desc : 道路事件的聚合,位置、详情,用于V2X情况下展示
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XRoadEventEntity implements Serializable {
|
||||
/**
|
||||
* @see MarkerPoiTypeEnum
|
||||
*/
|
||||
// 事件类型
|
||||
private String poiType;
|
||||
// 事件位置
|
||||
private MarkerLocation location;
|
||||
// 具体的信息
|
||||
private MarkerExploreWay noveltyInfo;
|
||||
// tts 提示
|
||||
private String tts;
|
||||
// ADAS 展示文案
|
||||
private String alarmContent;
|
||||
// 距离当前车辆的距离
|
||||
private double distance;
|
||||
// 默认展示时间
|
||||
private int expireTime;
|
||||
// 展示Button
|
||||
private boolean isShowEventButton;
|
||||
// 绑定 MarkerView 的数据, 业务需要啥数据就传入啥数据
|
||||
private Object bindObj;
|
||||
|
||||
public MarkerLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(MarkerLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getPoiType() {
|
||||
if (TextUtils.isEmpty(poiType)) {
|
||||
return "";
|
||||
}
|
||||
return poiType;
|
||||
}
|
||||
|
||||
public void setPoiType(String poiType) {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public String getTts(boolean haveLiveCar) {
|
||||
tts = "前方#" + (int) getDistance() + "米#";
|
||||
switch (getPoiType()) {
|
||||
// 停车场
|
||||
case V2XPoiTypeEnum.FOURS_PARKING:
|
||||
tts += "停车场";
|
||||
break;
|
||||
// 加油站
|
||||
case V2XPoiTypeEnum.GAS_STATION:
|
||||
tts += "加油站";
|
||||
break;
|
||||
// 交通检查
|
||||
case V2XPoiTypeEnum.TRAFFIC_CHECK:
|
||||
tts += "交通检查";
|
||||
break;
|
||||
// 封路
|
||||
case V2XPoiTypeEnum.ROAD_CLOSED:
|
||||
tts += "道路封路";
|
||||
break;
|
||||
// 施工
|
||||
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
tts += "道路施工";
|
||||
break;
|
||||
// 拥堵
|
||||
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
tts += "道路拥堵";
|
||||
break;
|
||||
// 积水
|
||||
case V2XPoiTypeEnum.FOURS_PONDING:
|
||||
tts += "道路积水";
|
||||
break;
|
||||
// 浓雾
|
||||
case V2XPoiTypeEnum.FOURS_FOG:
|
||||
tts += "出现浓雾";
|
||||
break;
|
||||
// 结冰
|
||||
case V2XPoiTypeEnum.FOURS_ICE:
|
||||
tts += "路面结冰";
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
tts += "交通事故";
|
||||
break;
|
||||
default:
|
||||
tts += "道路事件";
|
||||
break;
|
||||
}
|
||||
if (haveLiveCar) {
|
||||
tts += ",查看实况请说确定。";
|
||||
setShowEventButton(true);
|
||||
} else {
|
||||
tts += ",请注意躲避。";
|
||||
setShowEventButton(false);
|
||||
}
|
||||
return tts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测到附近#道路施工#,确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。
|
||||
*/
|
||||
public String getTtsWithFeedback() {
|
||||
tts = "检测到附近";
|
||||
switch (getPoiType()) {
|
||||
// 停车场
|
||||
case V2XPoiTypeEnum.FOURS_PARKING:
|
||||
tts += "有停车场";
|
||||
break;
|
||||
// 加油站
|
||||
case V2XPoiTypeEnum.GAS_STATION:
|
||||
tts += "有加油站";
|
||||
break;
|
||||
// 交通检查
|
||||
case V2XPoiTypeEnum.TRAFFIC_CHECK:
|
||||
tts += "交通检查";
|
||||
break;
|
||||
// 封路
|
||||
case V2XPoiTypeEnum.ROAD_CLOSED:
|
||||
tts += "封路";
|
||||
break;
|
||||
// 施工
|
||||
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
tts += "施工";
|
||||
break;
|
||||
// 拥堵
|
||||
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
tts += "道路拥堵";
|
||||
break;
|
||||
// 积水
|
||||
case V2XPoiTypeEnum.FOURS_PONDING:
|
||||
tts += "道路积水";
|
||||
break;
|
||||
// 浓雾
|
||||
case V2XPoiTypeEnum.FOURS_FOG:
|
||||
tts += "出现浓雾";
|
||||
break;
|
||||
// 结冰
|
||||
case V2XPoiTypeEnum.FOURS_ICE:
|
||||
tts += "路面结冰";
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
tts += "交通事故";
|
||||
break;
|
||||
default:
|
||||
tts += "道路事件";
|
||||
break;
|
||||
}
|
||||
tts += ",确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。";
|
||||
return tts;
|
||||
}
|
||||
|
||||
public String getTts() {
|
||||
return tts;
|
||||
}
|
||||
|
||||
public void setTts(String tts) {
|
||||
this.tts = tts;
|
||||
}
|
||||
|
||||
public boolean isShowEventButton() {
|
||||
return isShowEventButton;
|
||||
}
|
||||
|
||||
public void setShowEventButton(boolean showEventButton) {
|
||||
isShowEventButton = showEventButton;
|
||||
}
|
||||
|
||||
public String getAlarmContent() {
|
||||
switch (getPoiType()) {
|
||||
// 停车场
|
||||
case V2XPoiTypeEnum.FOURS_PARKING:
|
||||
alarmContent = "停车场附近";
|
||||
break;
|
||||
// 加油站
|
||||
case V2XPoiTypeEnum.GAS_STATION:
|
||||
alarmContent = "加油站附近";
|
||||
break;
|
||||
// 交通检查
|
||||
case V2XPoiTypeEnum.TRAFFIC_CHECK:
|
||||
alarmContent = "前方交通检查";
|
||||
break;
|
||||
// 封路
|
||||
case V2XPoiTypeEnum.ROAD_CLOSED:
|
||||
alarmContent = "前方封路";
|
||||
break;
|
||||
// 施工
|
||||
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
alarmContent = "前方施工";
|
||||
break;
|
||||
// 拥堵
|
||||
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
alarmContent = "前方道路拥堵";
|
||||
break;
|
||||
// 积水
|
||||
case V2XPoiTypeEnum.FOURS_PONDING:
|
||||
alarmContent = "前方道路积水";
|
||||
break;
|
||||
// 浓雾
|
||||
case V2XPoiTypeEnum.FOURS_FOG:
|
||||
alarmContent = "前方出现浓雾";
|
||||
break;
|
||||
// 结冰
|
||||
case V2XPoiTypeEnum.FOURS_ICE:
|
||||
alarmContent = "前方路面结冰";
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
alarmContent = "前方交通事故";
|
||||
break;
|
||||
default:
|
||||
tts += "道路事件";
|
||||
break;
|
||||
}
|
||||
return alarmContent;
|
||||
}
|
||||
|
||||
public void setAlarmContent(String alarmContent) {
|
||||
this.alarmContent = alarmContent;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public int getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public void setExpireTime(int expireTime) {
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
|
||||
public MarkerExploreWay getNoveltyInfo() {
|
||||
return noveltyInfo;
|
||||
}
|
||||
|
||||
public void setNoveltyInfo(MarkerExploreWay noveltyInfo) {
|
||||
this.noveltyInfo = noveltyInfo;
|
||||
}
|
||||
|
||||
public Object getBindObj() {
|
||||
return bindObj;
|
||||
}
|
||||
|
||||
public void setBindObj(Object bindObj) {
|
||||
this.bindObj = bindObj;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
V2XRoadEventEntity that = (V2XRoadEventEntity) o;
|
||||
return Objects.equals(noveltyInfo.getInfoId(), that.noveltyInfo.getInfoId()) &&
|
||||
Objects.equals(poiType, that.poiType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(poiType, noveltyInfo.getInfoId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XRoadEventEntity{" +
|
||||
"poiType='" + poiType + '\'' +
|
||||
", location=" + location +
|
||||
", noveltyInfo=" + noveltyInfo +
|
||||
", tts='" + tts + '\'' +
|
||||
", alarmContent='" + alarmContent + '\'' +
|
||||
", distance=" + distance +
|
||||
", expireTime=" + expireTime +
|
||||
", isShowEventButton=" + isShowEventButton +
|
||||
", bindObj=" + bindObj +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/31 4:53 PM
|
||||
* desc : V2X 道路提醒类型
|
||||
* version: 1.0
|
||||
*/
|
||||
public interface V2XWindowTypeEnum {
|
||||
// 默认展示详情
|
||||
int DEFAULT_WINDOW = 0;
|
||||
// 直播
|
||||
int LIVE_CAR_WINDOW = 1;
|
||||
// 道路事件详情
|
||||
int ROAD_EVENT_WINDOW = 2;
|
||||
// 推送事件详情
|
||||
int PUSH_EVENT_WINDOW = 3;
|
||||
// 演示动画场景
|
||||
int ANIMATION_WINDOW = 4;
|
||||
// 疲劳驾驶
|
||||
int FATIGUE_DRIVING_WINDOW = 5;
|
||||
// 他人故障求助
|
||||
int SEEK_HELP_WINDOW = 6;
|
||||
// 违章停车
|
||||
int ILLEGAL_PARK_WINDOW = 7;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mogo.module.common.wm;
|
||||
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* 采用Dialog实现接口
|
||||
*/
|
||||
class DialogImpl implements IWindowManagerView {
|
||||
private Dialog dialog;
|
||||
@Override
|
||||
public void init(WindowManagerView.WMViewParams params) {
|
||||
Logger.d("DialogImpl", "init====");
|
||||
dialog = new BaseFloatDialog(params.mContext);
|
||||
Logger.d("DialogImpl","params view : " + params.mContentView);
|
||||
dialog.setContentView(params.mContentView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowing() {
|
||||
return dialog.isShowing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mogo.module.common.wm;
|
||||
|
||||
interface IWindowManagerView {
|
||||
/**
|
||||
* 初始化
|
||||
* @param params contentView包装类
|
||||
*/
|
||||
void init(WindowManagerView.WMViewParams params);
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
* @return true - 显示中
|
||||
*/
|
||||
boolean isShowing();
|
||||
|
||||
/**
|
||||
* 显示
|
||||
*/
|
||||
void show();
|
||||
|
||||
/**
|
||||
* 隐藏
|
||||
*/
|
||||
void hide();
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.mogo.module.common.wm;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
|
||||
/**
|
||||
* 采用windowManager实现接口
|
||||
*/
|
||||
class WindowManagerImpl implements IWindowManagerView {
|
||||
private WindowManager mWindowManager;
|
||||
private WindowManager.LayoutParams mLayoutParams;
|
||||
private WindowManagerView.WMViewParams mParams;
|
||||
private boolean isShowing;
|
||||
@Override
|
||||
public void init(WindowManagerView.WMViewParams params) {
|
||||
mParams = params;
|
||||
mWindowManager = (WindowManager) mParams.mContext.getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
mLayoutParams = new WindowManager.LayoutParams();
|
||||
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ) {
|
||||
mLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
} else {
|
||||
mLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
}
|
||||
mLayoutParams.format = PixelFormat.TRANSLUCENT;
|
||||
mLayoutParams.gravity = Gravity.CENTER;
|
||||
mLayoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
|
||||
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
|
||||
mLayoutParams.width = 1920;
|
||||
mLayoutParams.height = 1080;
|
||||
} else {
|
||||
mLayoutParams.width = WindowUtils.getScreenWidth( mParams.mContext );
|
||||
mLayoutParams.height = WindowUtils.getScreenHeight( mParams.mContext );
|
||||
}
|
||||
mLayoutParams.dimAmount = 0.5f;
|
||||
mLayoutParams.x = 0;
|
||||
mLayoutParams.y = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowing() {
|
||||
return isShowing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if(!isShowing){
|
||||
isShowing = true;
|
||||
mWindowManager.addView(mParams.mContentView,mLayoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
if (isShowing && mParams != null) {
|
||||
mWindowManager.removeView(mParams.mContentView);
|
||||
isShowing = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import android.view.WindowManager;
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.LayoutRes;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
|
||||
@@ -23,89 +24,57 @@ import com.mogo.utils.WindowUtils;
|
||||
public class WindowManagerView {
|
||||
|
||||
private WMViewParams mParams;
|
||||
private boolean mIsShowing;
|
||||
private WindowManager mWindowManager;
|
||||
private WindowManager.LayoutParams mLayoutParams;
|
||||
|
||||
private WindowManagerView( WMViewParams params ) {
|
||||
private IWindowManagerView managerView;
|
||||
|
||||
private WindowManagerView(WMViewParams params) {
|
||||
this.mParams = params;
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
mWindowManager = ( WindowManager ) mParams.mContext.getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
mLayoutParams = new WindowManager.LayoutParams();
|
||||
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ) {
|
||||
mLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
} else {
|
||||
mLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
}
|
||||
mLayoutParams.format = PixelFormat.TRANSLUCENT;
|
||||
mLayoutParams.gravity = Gravity.CENTER;
|
||||
mLayoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
|
||||
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
|
||||
mLayoutParams.width = 1920;
|
||||
mLayoutParams.height = 1080;
|
||||
} else {
|
||||
mLayoutParams.width = WindowUtils.getScreenWidth( mParams.mContext );
|
||||
mLayoutParams.height = WindowUtils.getScreenHeight( mParams.mContext );
|
||||
}
|
||||
mLayoutParams.dimAmount = 0.5f;
|
||||
mLayoutParams.x = 0;
|
||||
mLayoutParams.y = 0;
|
||||
managerView = new DialogImpl();
|
||||
managerView.init(params);
|
||||
// init();
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
return mIsShowing;
|
||||
return managerView.isShowing();
|
||||
}
|
||||
|
||||
public < T extends View > T findViewById( @IdRes int id ) {
|
||||
return mParams.mContentView.findViewById( id );
|
||||
public <T extends View> T findViewById(@IdRes int id) {
|
||||
return mParams.mContentView.findViewById(id);
|
||||
}
|
||||
|
||||
public void show() {
|
||||
if ( mIsShowing ) {
|
||||
return;
|
||||
}
|
||||
mIsShowing = true;
|
||||
mWindowManager.addView( mParams.mContentView, mLayoutParams );
|
||||
managerView.show();
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
if ( !mIsShowing ) {
|
||||
return;
|
||||
}
|
||||
if ( mParams != null ) {
|
||||
mWindowManager.removeViewImmediate( mParams.mContentView );
|
||||
}
|
||||
mIsShowing = false;
|
||||
managerView.hide();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private WMViewParams mParams = null;
|
||||
|
||||
public Builder( Context context ) {
|
||||
public Builder(Context context) {
|
||||
mParams = new WMViewParams();
|
||||
mParams.mContext = context;
|
||||
}
|
||||
|
||||
public Builder contentView( View contentView ) {
|
||||
public Builder contentView(View contentView) {
|
||||
mParams.mContentView = contentView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder contentView( @LayoutRes int contentViewId ) {
|
||||
mParams.mContentView = LayoutInflater.from( mParams.mContext ).inflate( contentViewId, null );
|
||||
public Builder contentView(@LayoutRes int contentViewId) {
|
||||
mParams.mContentView = LayoutInflater.from(mParams.mContext).inflate(contentViewId,
|
||||
null);
|
||||
return this;
|
||||
}
|
||||
|
||||
public WindowManagerView build() {
|
||||
if ( mParams.mContentView == null ) {
|
||||
throw new NullPointerException( "WMViewParams#mContentView must not be null." );
|
||||
if (mParams.mContentView == null) {
|
||||
throw new NullPointerException("WMViewParams#mContentView must not be null.");
|
||||
}
|
||||
return new WindowManagerView( mParams );
|
||||
return new WindowManagerView(mParams);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1016,7 +1016,9 @@
|
||||
<dimen name="dp_997">997px</dimen>
|
||||
<dimen name="dp_998">998px</dimen>
|
||||
<dimen name="dp_999">999px</dimen>
|
||||
<dimen name="dp_1000">1000px</dimen>
|
||||
<dimen name="dp_1300">1300px</dimen>
|
||||
<dimen name="dp_1920">1920px</dimen>
|
||||
|
||||
|
||||
|
||||
|
||||
1
modules/mogo-module-event-panel-noop/.gitignore
vendored
Normal file
1
modules/mogo-module-event-panel-noop/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
55
modules/mogo-module-event-panel-noop/build.gradle
Normal file
55
modules/mogo-module-event-panel-noop/build.gradle
Normal file
@@ -0,0 +1,55 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
targetCompatibility 1.8
|
||||
sourceCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
compileOnly rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
compileOnly project(':modules:mogo-module-common')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
1
modules/mogo-module-event-panel-noop/consumer-rules.pro
Normal file
1
modules/mogo-module-event-panel-noop/consumer-rules.pro
Normal file
@@ -0,0 +1 @@
|
||||
-keep class com.zhidao.mogo.module.event.panel.EventPanelConstants
|
||||
3
modules/mogo-module-event-panel-noop/gradle.properties
Normal file
3
modules/mogo-module-event-panel-noop/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-event-panel-noop
|
||||
VERSION_CODE=1
|
||||
23
modules/mogo-module-event-panel-noop/proguard-rules.pro
vendored
Normal file
23
modules/mogo-module-event-panel-noop/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
-keep class com.zhidao.mogo.module.event.panel.EventPanelConstants
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.zhidao.mogo.module.event.panel
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.zhidao.mogo.module.event.panel.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.event.panel">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.zhidao.mogo.module.event.panel
|
||||
|
||||
/**
|
||||
* 事件面板相关常量
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
object EventPanelConstants {
|
||||
const val MODULE_NAME = "MODULE_EVENT_PANEL"
|
||||
const val PATH_NAME = "/event/panel"
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.zhidao.mogo.module.event.panel
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
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.MogoServicePaths
|
||||
import com.mogo.service.eventpanel.IEventPanelProvider
|
||||
import com.mogo.service.module.IMogoModuleLifecycle
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
|
||||
|
||||
/**
|
||||
* 事件面板provider的空方法实现
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
|
||||
|
||||
const val TAG = "EventPanelNoopModule"
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_EVENT_PANEL)
|
||||
class EventPanelModuleProvider : IEventPanelProvider {
|
||||
override fun init(context: Context) {
|
||||
Logger.d(TAG, "模块初始化====")
|
||||
}
|
||||
|
||||
override fun createFragment(context: Context, data: Bundle?): Fragment? {
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示面板
|
||||
*/
|
||||
override fun showPanel() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 隐藏面板
|
||||
*/
|
||||
override fun hidePanel() {
|
||||
}
|
||||
|
||||
override fun createView(context: Context): View? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getModuleName(): String {
|
||||
return MODULE_NAME
|
||||
}
|
||||
|
||||
override fun getCardLifecycle(): IMogoModuleLifecycle? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getMapListener(): IMogoMapListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getType(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun getNaviListener(): IMogoNaviListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getLocationListener(): IMogoLocationListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppName(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun isPanelShow(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zhidao.mogo.module.event.panel
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
1
modules/mogo-module-event-panel/.gitignore
vendored
Normal file
1
modules/mogo-module-event-panel/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
63
modules/mogo-module-event-panel/build.gradle
Normal file
63
modules/mogo-module-event-panel/build.gradle
Normal file
@@ -0,0 +1,63 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
targetCompatibility 1.8
|
||||
sourceCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.androidxviewpager2
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.room
|
||||
kapt rootProject.ext.dependencies.roomAnnotationProcessor
|
||||
implementation rootProject.ext.dependencies.roomRxjava
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
compileOnly rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
compileOnly project(':modules:mogo-module-common')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
5
modules/mogo-module-event-panel/consumer-rules.pro
Normal file
5
modules/mogo-module-event-panel/consumer-rules.pro
Normal file
@@ -0,0 +1,5 @@
|
||||
#-----EventPanel------
|
||||
-keep class com.zhidao.mogo.module.event.panel.bean.** {*;}
|
||||
-keep class com.zhidao.mogo.module.event.panel.dao.** {*;}
|
||||
-keep class com.zhidao.mogo.module.event.panel.listener.** {*;}
|
||||
-keep class com.zhidao.mogo.module.event.panel.EventPanelConstants
|
||||
3
modules/mogo-module-event-panel/gradle.properties
Normal file
3
modules/mogo-module-event-panel/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-event-panel
|
||||
VERSION_CODE=1
|
||||
27
modules/mogo-module-event-panel/proguard-rules.pro
vendored
Normal file
27
modules/mogo-module-event-panel/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----EventPanel------
|
||||
-keep class com.zhidao.mogo.module.event.panel.bean.** {*;}
|
||||
-keep class com.zhidao.mogo.module.event.panel.dao.** {*;}
|
||||
-keep class com.zhidao.mogo.module.event.panel.listener.** {*;}
|
||||
-keep class com.zhidao.mogo.module.event.panel.EventPanelConstants
|
||||
@@ -0,0 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.event.panel">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zhidao.mogo.module.event.panel
|
||||
|
||||
/**
|
||||
* 事件面板相关常量
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
object EventPanelConstants {
|
||||
const val MODULE_NAME = "MODULE_EVENT_PANEL"
|
||||
const val PATH_NAME = "/event/panel"
|
||||
|
||||
const val ROAD_EVENT_USEFUL = "2"
|
||||
const val ROAD_EVENT_UNUSEFUL = "1"
|
||||
const val ROAD_EVENT_USEFUL_STATUS_UNSET = "0"
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.zhidao.mogo.module.event.panel
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
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.eventpanel.IEventPanelProvider
|
||||
import com.mogo.service.module.IMogoModuleLifecycle
|
||||
import com.mogo.service.module.IMogoModuleProvider
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
|
||||
import com.zhidao.mogo.module.event.panel.EventPanelConstants.PATH_NAME
|
||||
import com.zhidao.mogo.module.event.panel.fragment.EventPanelFragment
|
||||
import com.zhidao.mogo.module.event.panel.util.MogoApiManager
|
||||
import com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
|
||||
|
||||
/**
|
||||
* 事件面板provider
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = PATH_NAME)
|
||||
class EventPanelModuleProvider : IEventPanelProvider {
|
||||
/**
|
||||
* Do your init work in this method, it well be call when processor has been load.
|
||||
*
|
||||
* @param context ctx
|
||||
*/
|
||||
override fun init(context: Context) {
|
||||
Logger.d(MODULE_NAME, "模块初始化====")
|
||||
MogoApiManager.init(context)
|
||||
TripRecordDataManager.init(context)
|
||||
}
|
||||
|
||||
override fun createFragment(context: Context, data: Bundle?): Fragment? {
|
||||
return EventPanelFragment.getInstance()
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示面板
|
||||
*/
|
||||
override fun showPanel() {
|
||||
EventPanelFragment.getInstance().showPanel()
|
||||
}
|
||||
|
||||
override fun isPanelShow(): Boolean {
|
||||
return EventPanelFragment.getInstance().isPanelShow()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 隐藏面板
|
||||
*/
|
||||
override fun hidePanel() {
|
||||
EventPanelFragment.getInstance().hidePanel()
|
||||
}
|
||||
|
||||
override fun createView(context: Context): View? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getModuleName(): String {
|
||||
return MODULE_NAME
|
||||
}
|
||||
|
||||
override fun getCardLifecycle(): IMogoModuleLifecycle? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getMapListener(): IMogoMapListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getType(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun getNaviListener(): IMogoNaviListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getLocationListener(): IMogoLocationListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppName(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zhidao.mogo.module.event.panel.adapter
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.zhidao.mogo.module.event.panel.fragment.MyShareFragment
|
||||
import com.zhidao.mogo.module.event.panel.fragment.SurroundingEventFragment
|
||||
import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment
|
||||
|
||||
/**
|
||||
* 事件面板viewpager2的adapter
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class EventPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
|
||||
private val fragments:Array<Fragment> = arrayOf(TripRecordFragment(), SurroundingEventFragment(), MyShareFragment())
|
||||
|
||||
/**
|
||||
* 目前一共就三个fragment
|
||||
*/
|
||||
override fun getItemCount(): Int = fragments.size
|
||||
|
||||
override fun createFragment(position: Int): Fragment = fragments[position]
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.zhidao.mogo.module.event.panel.bean
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import com.zhidao.mogo.module.event.panel.EventPanelConstants.ROAD_EVENT_USEFUL_STATUS_UNSET
|
||||
|
||||
/**
|
||||
* 出行记录本地存储封装类,此类标识了数据库表名以及字段名
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Entity
|
||||
data class TripRecord(@PrimaryKey(autoGenerate = false)
|
||||
var id: Int,
|
||||
var eventId: String = "",
|
||||
var eventType: Int,
|
||||
/**
|
||||
* 是否有用
|
||||
* 1 - 没用
|
||||
* 2 - 有用
|
||||
* 0 - 未设置
|
||||
*/
|
||||
var usefulStatus: String = ROAD_EVENT_USEFUL_STATUS_UNSET,
|
||||
var entity: String = "",
|
||||
var recordTime: Long = System.currentTimeMillis())
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.zhidao.mogo.module.event.panel.dao
|
||||
|
||||
import androidx.room.*
|
||||
import com.zhidao.mogo.module.event.panel.bean.TripRecord
|
||||
|
||||
/**
|
||||
* 出行动态dao,全部使用同步方法,在线程中执行
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Dao
|
||||
interface TripRecordDao {
|
||||
/**
|
||||
* 查询当日数据
|
||||
* @param limitTime 当日0点的时间戳
|
||||
*/
|
||||
@Query(value = "SELECT * FROM TripRecord WHERE recordTime > :limitTime ORDER BY recordTime DESC")
|
||||
fun queryAllTripRecord(limitTime: Long): List<TripRecord>
|
||||
|
||||
/**
|
||||
* 根据事件id获取出行动态
|
||||
*
|
||||
* @param eventId 事件id [com.mogo.module.common.entity.V2XRoadEventEntity.noveltyInfo.infoId]
|
||||
*/
|
||||
@Query(value = "SELECT * FROM TripRecord WHERE eventId = :eventId")
|
||||
fun queryTripRecordByEventId(eventId: String): TripRecord?
|
||||
|
||||
@Query(value = "SELECT * FROM TripRecord WHERE id = :id")
|
||||
fun queryTripRecordById(id: Int): TripRecord?
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insert(vararg tripRecord: TripRecord)
|
||||
|
||||
@Update
|
||||
fun update(vararg tripRecord: TripRecord)
|
||||
|
||||
@Delete
|
||||
fun delete(vararg tripRecord: TripRecord)
|
||||
|
||||
/**
|
||||
* 删除超时的数据,即当天0时以前的数据
|
||||
* 虽然注解是Query,但是目的是执行后面的sql语句,所以就不要在意这些细节了
|
||||
*
|
||||
* @param limitTime 当日0点的时间戳
|
||||
*/
|
||||
@Query(value = "DELETE FROM TripRecord WHERE recordTime < :limitTime")
|
||||
fun deleteOvertimeTripRecord(limitTime: Long)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.zhidao.mogo.module.event.panel.dao
|
||||
|
||||
import android.content.Context
|
||||
import androidx.room.Database
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import com.zhidao.mogo.module.event.panel.bean.TripRecord
|
||||
|
||||
@Database(entities = [TripRecord::class], version = 1, exportSchema = false)
|
||||
abstract class TripRecordDatabase : RoomDatabase() {
|
||||
companion object{
|
||||
private var instance:TripRecordDatabase? = null
|
||||
fun getInstance(context: Context):TripRecordDatabase{
|
||||
if (instance == null) {
|
||||
synchronized(TripRecordDatabase::class.java) {
|
||||
if (instance == null) {
|
||||
instance = Room.databaseBuilder(context, TripRecordDatabase::class.java, "TripRecordDatabase.db").build()
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance!!
|
||||
}
|
||||
}
|
||||
abstract fun getTripRecordDao():TripRecordDao
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.zhidao.mogo.module.event.panel.fragment
|
||||
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
|
||||
import com.zhidao.mogo.module.event.panel.R
|
||||
import com.zhidao.mogo.module.event.panel.adapter.EventPagerAdapter
|
||||
import com.zhidao.mogo.module.event.panel.presenter.EventPanelPresenter
|
||||
import kotlinx.android.synthetic.main.module_event_panel_fragment_event_panel.*
|
||||
|
||||
/**
|
||||
* 事件面板主fragment
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class EventPanelFragment : MvpFragment<EventPanelFragment, EventPanelPresenter>() {
|
||||
|
||||
companion object{
|
||||
private val fragment = EventPanelFragment()
|
||||
fun getInstance():EventPanelFragment{
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_event_panel_fragment_event_panel
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
Logger.d(MODULE_NAME, "EventPanelFragment init view===")
|
||||
vpEventPanel.adapter = EventPagerAdapter(this)
|
||||
btnShowOrHidePanels.setOnClickListener {
|
||||
if (vpEventPanel.visibility == View.GONE) {
|
||||
showPanel()
|
||||
}else{
|
||||
hidePanel()
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun createPresenter(): EventPanelPresenter {
|
||||
return EventPanelPresenter(this)
|
||||
}
|
||||
|
||||
fun showPanel(){
|
||||
Logger.d(MODULE_NAME,"in fragment show panel")
|
||||
vpEventPanel.visibility = View.VISIBLE
|
||||
btnShowOrHidePanels.text = "隐藏面板"
|
||||
}
|
||||
|
||||
fun hidePanel(){
|
||||
Logger.d(MODULE_NAME,"in fragment hide panel")
|
||||
vpEventPanel.visibility = View.GONE
|
||||
btnShowOrHidePanels.text = "显示面板"
|
||||
}
|
||||
|
||||
fun isPanelShow():Boolean{
|
||||
return vpEventPanel.visibility == View.VISIBLE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.zhidao.mogo.module.event.panel.fragment
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.zhidao.mogo.module.event.panel.R
|
||||
import com.zhidao.mogo.module.event.panel.presenter.MySharePresenter
|
||||
|
||||
class MyShareFragment : MvpFragment<MyShareFragment, MySharePresenter>() {
|
||||
/**
|
||||
* 布局资源
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_my_share
|
||||
|
||||
/**
|
||||
* 初始化控件,必须在初始化完成之后才可以实例化presenter,避免
|
||||
* presenter 生命周期错乱
|
||||
*/
|
||||
override fun initViews() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 presenter 实例
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
override fun createPresenter(): MySharePresenter = MySharePresenter(this)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.zhidao.mogo.module.event.panel.fragment
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.zhidao.mogo.module.event.panel.R
|
||||
import com.zhidao.mogo.module.event.panel.presenter.SurroundingEventPresenter
|
||||
import kotlinx.android.synthetic.main.module_event_panel_fragment_surrounding_event.*
|
||||
|
||||
class SurroundingEventFragment:MvpFragment<SurroundingEventFragment,SurroundingEventPresenter>(){
|
||||
/**
|
||||
* 布局资源
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_surrounding_event
|
||||
|
||||
/**
|
||||
* 初始化控件,必须在初始化完成之后才可以实例化presenter,避免
|
||||
* presenter 生命周期错乱
|
||||
*/
|
||||
override fun initViews() {
|
||||
tvTitle.setOnClickListener {
|
||||
EventPanelFragment.getInstance().hidePanel()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 presenter 实例
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
override fun createPresenter(): SurroundingEventPresenter = SurroundingEventPresenter(this)
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.zhidao.mogo.module.event.panel.fragment
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
|
||||
import com.zhidao.mogo.module.event.panel.R
|
||||
import com.zhidao.mogo.module.event.panel.bean.TripRecord
|
||||
import com.zhidao.mogo.module.event.panel.presenter.TripRecordPresenter
|
||||
import com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
|
||||
import kotlinx.android.synthetic.main.module_event_panel_fragment_trip_record.*
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
* 出行动态fragment
|
||||
*/
|
||||
class TripRecordFragment : MvpFragment<TripRecordFragment, TripRecordPresenter>() {
|
||||
private val tripRecordList = ArrayList<TripRecord>()
|
||||
override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_trip_record
|
||||
|
||||
override fun initViews() {
|
||||
btnInsert.setOnClickListener {
|
||||
TripRecordDataManager.insertTripRecord(TripRecord(id = 456, eventType = 456,eventId = "456"))
|
||||
}
|
||||
btnUpdate.setOnClickListener {
|
||||
TripRecordDataManager.syncRoadEventModifyState(eventId = "456", modifyType = "2")
|
||||
}
|
||||
btnQuery.setOnClickListener {
|
||||
Log.d(MODULE_NAME, "local list: $tripRecordList")
|
||||
mPresenter.queryAllTripRecord()
|
||||
}
|
||||
}
|
||||
|
||||
override fun createPresenter(): TripRecordPresenter = TripRecordPresenter(this)
|
||||
|
||||
fun refreshTripRecordList(tripRecords: List<TripRecord>) {
|
||||
Logger.d(MODULE_NAME, "刷新出行动态列表:$tripRecords")
|
||||
tripRecordList.clear()
|
||||
tripRecordList.addAll(tripRecords)
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新单个出行动态,如果无此动态,新增动态
|
||||
*/
|
||||
fun refreshTripRecord(tripRecord: TripRecord) {
|
||||
Logger.d(MODULE_NAME, "刷新单个出行动态: $tripRecord")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.zhidao.mogo.module.event.panel.listener
|
||||
|
||||
import com.zhidao.mogo.module.event.panel.bean.TripRecord
|
||||
|
||||
/**
|
||||
* 数据库异步操作数据回调
|
||||
*/
|
||||
interface ITripRecordCallback {
|
||||
/**
|
||||
* 查询全部出行动态成功
|
||||
*/
|
||||
fun queryTripRecordListSuccess(tripRecordList:List<TripRecord>)
|
||||
|
||||
/**
|
||||
* 有出行动态新增或更新后,回调此接口
|
||||
*/
|
||||
fun insertOrUpdateTripRecordSuccess(tripRecord:TripRecord)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.zhidao.mogo.module.event.panel.presenter
|
||||
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.zhidao.mogo.module.event.panel.fragment.EventPanelFragment
|
||||
|
||||
/**
|
||||
* 事件面板presenter
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class EventPanelPresenter(view: EventPanelFragment) : Presenter<EventPanelFragment>(view)
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.zhidao.mogo.module.event.panel.presenter
|
||||
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.zhidao.mogo.module.event.panel.fragment.MyShareFragment
|
||||
|
||||
class MySharePresenter(view: MyShareFragment) : Presenter<MyShareFragment>(view) {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.zhidao.mogo.module.event.panel.presenter
|
||||
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.zhidao.mogo.module.event.panel.fragment.SurroundingEventFragment
|
||||
|
||||
class SurroundingEventPresenter(view: SurroundingEventFragment) : Presenter<SurroundingEventFragment>(view) {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zhidao.mogo.module.event.panel.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.zhidao.mogo.module.event.panel.bean.TripRecord
|
||||
import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment
|
||||
import com.zhidao.mogo.module.event.panel.listener.ITripRecordCallback
|
||||
import com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
|
||||
|
||||
class TripRecordPresenter(view: TripRecordFragment) : Presenter<TripRecordFragment>(view),ITripRecordCallback {
|
||||
|
||||
init {
|
||||
TripRecordDataManager.addTripRecordCallback(this)
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
TripRecordDataManager.removeTripRecordCallback(this)
|
||||
}
|
||||
|
||||
fun queryAllTripRecord(){
|
||||
TripRecordDataManager.queryAllTripRecord()
|
||||
}
|
||||
|
||||
override fun queryTripRecordListSuccess(tripRecordList: List<TripRecord>) {
|
||||
mView.refreshTripRecordList(tripRecordList)
|
||||
}
|
||||
|
||||
override fun insertOrUpdateTripRecordSuccess(tripRecord: TripRecord) {
|
||||
mView.refreshTripRecord(tripRecord)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.zhidao.mogo.module.event.panel.util
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
|
||||
object MogoApiManager {
|
||||
lateinit var serviceApis:IMogoServiceApis
|
||||
|
||||
fun init(context: Context) {
|
||||
serviceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.zhidao.mogo.module.event.panel.util
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.Handler
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.*
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity
|
||||
import com.mogo.utils.ThreadPoolService
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.network.utils.GsonUtil
|
||||
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
|
||||
import com.zhidao.mogo.module.event.panel.bean.TripRecord
|
||||
import com.zhidao.mogo.module.event.panel.dao.TripRecordDao
|
||||
import com.zhidao.mogo.module.event.panel.dao.TripRecordDatabase
|
||||
import com.zhidao.mogo.module.event.panel.listener.ITripRecordCallback
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
|
||||
private const val BROADCAST_SCENE_EVENT_ACTION = "com.v2x.scene_local_broadcast"
|
||||
private const val BROADCAST_SCENE_MODIFY_ACTION = "com.zhidao.tanlu.dataerror"
|
||||
|
||||
private const val BROADCAST_SCENE_EXTRA_KEY = "V2XMessageEntity"
|
||||
private const val BORADCAST_SCENE_MODIFY_EVENT_ID_KEY = "id"
|
||||
private const val BROADCAST_SCENE_MODIFY_EVENT_UPDATE_TYPE_KEY = "updateType"
|
||||
|
||||
/**
|
||||
* 出行动态的数据管理类,由于TripRecordFragment初始化时机较晚,所以封装一个单例类,提早初始化
|
||||
*/
|
||||
object TripRecordDataManager {
|
||||
private lateinit var context: Context
|
||||
private val sceneEventReceiver = SceneEventReceiver()
|
||||
private lateinit var tripRecordDao: TripRecordDao
|
||||
|
||||
private val tripRecordCallbackList = ArrayList<ITripRecordCallback>()
|
||||
|
||||
fun init(context: Context) {
|
||||
this.context = context
|
||||
LocalBroadcastManager.getInstance(context).registerReceiver(sceneEventReceiver, IntentFilter(BROADCAST_SCENE_EVENT_ACTION))
|
||||
context.registerReceiver(sceneEventReceiver, IntentFilter(BROADCAST_SCENE_MODIFY_ACTION))
|
||||
tripRecordDao = TripRecordDatabase.getInstance(TripRecordDataManager.context).getTripRecordDao()
|
||||
}
|
||||
|
||||
fun addTripRecordCallback(callback: ITripRecordCallback) {
|
||||
tripRecordCallbackList.add(callback)
|
||||
}
|
||||
|
||||
fun removeTripRecordCallback(callback: ITripRecordCallback) {
|
||||
tripRecordCallbackList.remove(callback)
|
||||
}
|
||||
|
||||
private val handler = Handler()
|
||||
fun queryAllTripRecord() {
|
||||
ThreadPoolService.singleExecute {
|
||||
val limitTime = countLimitTime()
|
||||
// 查询所有的出行动态
|
||||
val tripRecordList = tripRecordDao.queryAllTripRecord(limitTime)
|
||||
Logger.d(MODULE_NAME, "查询所有出行动态,limitTime: $limitTime, list: $tripRecordList")
|
||||
// 删除超时的出行动态
|
||||
tripRecordDao.deleteOvertimeTripRecord(limitTime)
|
||||
// 切换线程回调
|
||||
handler.post {
|
||||
tripRecordCallbackList.forEach { callback ->
|
||||
callback.queryTripRecordListSuccess(tripRecordList)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun insertTripRecord(record: TripRecord) {
|
||||
ThreadPoolService.singleExecute {
|
||||
// 先查一下此数据是否存在
|
||||
Logger.d(MODULE_NAME, "出行动态入库===$record")
|
||||
|
||||
var check = tripRecordDao.queryTripRecordById(record.id)
|
||||
|
||||
if (check == null) {
|
||||
Logger.d(MODULE_NAME, "数据库中不存在此数据,直接插入")
|
||||
check = record
|
||||
tripRecordDao.insert(record)
|
||||
} else {
|
||||
Logger.d(MODULE_NAME, "数据库中存在此数据,更新recordTime即可,其他参数不变")
|
||||
check.recordTime = System.currentTimeMillis()
|
||||
tripRecordDao.update(check)
|
||||
}
|
||||
// 为了防止只进不出,所以在插入新数据时,进行过期数据删除操作
|
||||
tripRecordDao.deleteOvertimeTripRecord(countLimitTime())
|
||||
// 切换线程回调
|
||||
handler.post {
|
||||
tripRecordCallbackList.forEach { callback ->
|
||||
callback.insertOrUpdateTripRecordSuccess(check)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算约束时间,即当日0时
|
||||
*/
|
||||
private fun countLimitTime(): Long {
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.time = Date()
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0)
|
||||
calendar.set(Calendar.MINUTE, 0)
|
||||
calendar.set(Calendar.SECOND, 0)
|
||||
return calendar.timeInMillis
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理道路事件推送,保存到本地数据库
|
||||
* 目前只处理道路事件,违章提醒,他车求助,其他事件暂不处理
|
||||
*/
|
||||
private fun dealSceneMessage(type: Int, content: Any) {
|
||||
if (type in arrayOf(ALERT_ROAD_WARNING, ALERT_ILLEGAL_PARK_WARNING, ALERT_SEEK_WARNING)) {
|
||||
val eventId = if (type == ALERT_ROAD_WARNING) {
|
||||
val event = content as V2XRoadEventEntity
|
||||
event.noveltyInfo.infoId
|
||||
} else {
|
||||
""
|
||||
}
|
||||
Logger.d(MODULE_NAME, "处理场景事件,准备插入数据库===eventId: $eventId")
|
||||
insertTripRecord(TripRecord(id = content.hashCode(), eventId = eventId, eventType = type, entity = GsonUtil.jsonFromObject(content)))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地数据库同步v2x传过来的纠错信息
|
||||
*/
|
||||
fun syncRoadEventModifyState(eventId: String, modifyType: String) {
|
||||
Logger.d(MODULE_NAME, "准备同步纠错信息: $eventId, $modifyType")
|
||||
ThreadPoolService.singleExecute {
|
||||
// 找出需要纠错的数据
|
||||
val willModify = tripRecordDao.queryTripRecordByEventId(eventId)
|
||||
if (willModify != null) {
|
||||
// 查到数据进行修改,如果查不到数据,就不做操作了
|
||||
Logger.d(MODULE_NAME, "准备修改纠错状态:$willModify")
|
||||
willModify.usefulStatus = modifyType
|
||||
tripRecordDao.update(willModify)
|
||||
// 切线程回调
|
||||
handler.post {
|
||||
tripRecordCallbackList.forEach { callback ->
|
||||
callback.insertOrUpdateTripRecordSuccess(willModify)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SceneEventReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
Logger.d(MODULE_NAME, "收到V2X事件推送===")
|
||||
when (intent.action) {
|
||||
BROADCAST_SCENE_EVENT_ACTION -> {
|
||||
// 道路事件推送
|
||||
val message = intent.getSerializableExtra(BROADCAST_SCENE_EXTRA_KEY) as V2XMessageEntity<*>
|
||||
Logger.d(MODULE_NAME, "道路事件推送 type: ${message.type}, content: ${message.content}")
|
||||
dealSceneMessage(message.type, message.content)
|
||||
}
|
||||
BROADCAST_SCENE_MODIFY_ACTION -> {
|
||||
// 纠错推送
|
||||
syncRoadEventModifyState(intent.getStringExtra(BORADCAST_SCENE_MODIFY_EVENT_ID_KEY), intent.getStringExtra(BROADCAST_SCENE_MODIFY_EVENT_UPDATE_TYPE_KEY))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?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/clPanelContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/vpEventPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btnShowOrHidePanels"
|
||||
android:text="显示面板"
|
||||
android:textSize="20sp"
|
||||
android:textColor="#000"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/clPanelContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="My Share"
|
||||
android:textColor="#fff"
|
||||
android:textSize="40sp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/clPanelContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="Surrounding Event"
|
||||
android:textColor="#fff"
|
||||
android:textSize="40sp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?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/clPanelContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="Trip Record"
|
||||
android:textColor="#000"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnInsert"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Insert"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnUpdate"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnUpdate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Update"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnInsert"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnDelete"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDelete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Delete"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnUpdate"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnQuery"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnQuery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Query"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnDelete"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGenerate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="GenerateLimitTime"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnInsert" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
@@ -1,9 +1,9 @@
|
||||
# launcher头部模块
|
||||
|
||||
## 小智语音
|
||||
|
||||
## 通知
|
||||
|
||||
## 天气
|
||||
|
||||
## 时间
|
||||
## 时间
|
||||
|
||||
## 入口按钮,高德SDK导航控制
|
||||
@@ -53,6 +53,7 @@ dependencies {
|
||||
api rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
implementation rootProject.ext.dependencies.moduleshare
|
||||
// implementation rootProject.ext.dependencies.moduleventpanel
|
||||
// implementation rootProject.ext.dependencies.mogomoduleauth
|
||||
} else {
|
||||
api project(":libraries:mogo-map")
|
||||
@@ -62,6 +63,7 @@ dependencies {
|
||||
api project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':modules:mogo-module-share')
|
||||
// implementation project(':modules:mogo-module-event-panel')
|
||||
// implementation project(':modules:mogo-module-authorize')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#-----ExtensionModule-----
|
||||
-keep class com.mogo.module.extensions.userinfo.**{*;}
|
||||
-keep class com.mogo.module.extensions.weather.Phenomena
|
||||
-keep class com.mogo.module.extensions.weather.WeatherCallback
|
||||
-keep interface com.mogo.module.extensions.net.UserInfoNetApiServices
|
||||
-keep class com.mogo.module.extensions.utils.TopViewAnimHelper
|
||||
-keep class com.mogo.module.extensions.ExtensionsView
|
||||
-keep class com.mogo.module.extensions.ExtensionsModuleConst
|
||||
@@ -19,3 +19,12 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----ExtensionModule-----
|
||||
-keep class com.mogo.module.extensions.userinfo.**{*;}
|
||||
-keep class com.mogo.module.extensions.weather.Phenomena
|
||||
-keep class com.mogo.module.extensions.weather.WeatherCallback
|
||||
-keep interface com.mogo.module.extensions.net.UserInfoNetApiServices
|
||||
-keep class com.mogo.module.extensions.utils.TopViewAnimHelper
|
||||
-keep class com.mogo.module.extensions.ExtensionsView
|
||||
-keep class com.mogo.module.extensions.ExtensionsModuleConst
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user