合并1.1.2需求
This commit is contained in:
@@ -3,9 +3,15 @@ package com.mogo.module.apps;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.utils.FileUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -21,6 +27,8 @@ public class AppFilterImpl implements AppFilter {
|
||||
private final Context mContext;
|
||||
private List< String > mFilterPackages;
|
||||
|
||||
private static String sExternalPath = "/system/etc/packagesFilterList.txt";
|
||||
private static List< String > sExternalConfigPackages = new ArrayList<>();
|
||||
|
||||
public AppFilterImpl( Context context ) {
|
||||
mContext = context;
|
||||
@@ -42,6 +50,9 @@ public class AppFilterImpl implements AppFilter {
|
||||
// if ( isSystemApp( packageInfo ) ) {
|
||||
// return true;
|
||||
// }
|
||||
if ( isInExternalFilter( packageInfo ) ) {
|
||||
return true;
|
||||
}
|
||||
if ( isFilterPackages( packageInfo ) ) {
|
||||
return true;
|
||||
}
|
||||
@@ -63,4 +74,30 @@ public class AppFilterImpl implements AppFilter {
|
||||
return mContext.getPackageManager().getLaunchIntentForPackage( packageInfo.packageName ) == null;
|
||||
}
|
||||
|
||||
private boolean isInExternalFilter( PackageInfo packageInfo ) {
|
||||
return sExternalConfigPackages.contains( packageInfo.packageName );
|
||||
}
|
||||
|
||||
public static void loadExternalFilterPackagesList() throws Exception {
|
||||
sExternalConfigPackages.clear();
|
||||
File file = new File( sExternalPath );
|
||||
if ( !file.exists() || file.length() == 0 ) {
|
||||
return;
|
||||
}
|
||||
FileInputStream fis = new FileInputStream( file );
|
||||
InputStreamReader isr = new InputStreamReader( fis );
|
||||
BufferedReader br = new BufferedReader( isr );
|
||||
String line = "";
|
||||
while ( ( line = br.readLine() ) != null ) {
|
||||
line = line.trim();
|
||||
if ( TextUtils.isEmpty( line ) ) {
|
||||
continue;
|
||||
}
|
||||
sExternalConfigPackages.add( line );
|
||||
}
|
||||
br.close();
|
||||
isr.close();
|
||||
fis.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
} else {
|
||||
properties.put( "appversion", CommonUtils.getVersionName( getContext() ) );
|
||||
}
|
||||
AppServiceHandler.getMogoAnalytics().track( "Launcher_APP_Icon", properties );
|
||||
AppServiceHandler.getApis().getAnalyticsApi().track( "Launcher_APP_Icon", properties );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
package com.mogo.module.apps;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
|
||||
/**
|
||||
* author : zyz
|
||||
@@ -21,23 +17,6 @@ public class AppServiceHandler {
|
||||
private static final String TAG = "AppServiceHandler";
|
||||
|
||||
private static IMogoServiceApis mApis;
|
||||
private static IMogoCardManager mMogoCardManager;
|
||||
private static IMogoAnalytics mMogoAnalytics;
|
||||
|
||||
public static void init( final Context context ) {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( context );
|
||||
mMogoCardManager = mApis.getCardManagerApi();
|
||||
mMogoAnalytics = mApis.getAnalyticsApi();
|
||||
|
||||
}
|
||||
|
||||
public static IMogoCardManager getMogoCardManager() {
|
||||
return mMogoCardManager;
|
||||
}
|
||||
|
||||
public static IMogoAnalytics getMogoAnalytics() {
|
||||
return mMogoAnalytics;
|
||||
}
|
||||
|
||||
public static IMogoServiceApis getApis() {
|
||||
if ( mApis == null ) {
|
||||
|
||||
@@ -53,8 +53,6 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
|
||||
getActivity().overridePendingTransition( 0, R.anim.module_apps_anim_exit);
|
||||
}
|
||||
} );
|
||||
// mAppsList = findViewById( R.id.module_apps_id_apps );
|
||||
// mAppsList.setLayoutManager( new GridLayoutManager( getContext(), 8 ) );
|
||||
mLoadingView = findViewById( R.id.module_apps_id_loading );
|
||||
mLoadingView.setVisibility( View.VISIBLE );
|
||||
mIndicator = findViewById( R.id.module_apps_id_indicator );
|
||||
|
||||
@@ -74,7 +74,6 @@ public class AppsFragmentProvider implements IMogoModuleProvider {
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
AppServiceHandler.init( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -129,6 +129,11 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent
|
||||
overridePendingTransition( R.anim.module_apps_anim_enter, R.anim.module_apps_anim_exit );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeFinish() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -36,8 +37,9 @@ public class AppsListPresenter extends Presenter< AppsListView > implements IMog
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
mIntentManager = ( IMogoIntentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_INTENT_MANAGER ).navigation( getContext() );
|
||||
mIntentManager = AppServiceHandler.getApis().getIntentManagerApi();
|
||||
mIntentManager.registerIntentListener( AppsConst.COMMAND_OPERATION, this );
|
||||
mIntentManager.registerIntentListener( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this );
|
||||
AIAssist.getInstance( getContext() ).registerUnWakeupCommand( AppsConst.CMD_UN_WAKE_CLOSE_APP_LIST, AppsConst.CMD_UN_WAKE_WORDS_CLOSE_APP_LIST, this );
|
||||
}
|
||||
|
||||
@@ -56,6 +58,9 @@ public class AppsListPresenter extends Presenter< AppsListView > implements IMog
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if ( Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals( intentStr ) ) {
|
||||
Logger.d( TAG, "home 键导致 app 列表关闭" );
|
||||
mView.executeFinish();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +95,7 @@ public class AppsListPresenter extends Presenter< AppsListView > implements IMog
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
mIntentManager.unregisterIntentListener( AppsConst.COMMAND_OPERATION, this );
|
||||
mIntentManager.unregisterIntentListener( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this );
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( AppsConst.CMD_UN_WAKE_CLOSE_APP_LIST );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,6 @@ import com.mogo.commons.mvp.IView;
|
||||
public interface AppsListView extends IView {
|
||||
|
||||
void closeAppsPanel();
|
||||
|
||||
void executeFinish();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.module.apps;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.apps.applaunch.AppLaunchFilter;
|
||||
import com.mogo.module.apps.applaunch.AppLauncher;
|
||||
@@ -13,11 +12,8 @@ import com.mogo.module.apps.applaunch.InternalFunctionLauncher;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.module.apps.model.UnScannedApps;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -42,17 +38,14 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
private IMogoAnalytics mAnalytics;
|
||||
private AppLaunchFilter mLauncher;
|
||||
|
||||
private IMogoServiceApis mApis;
|
||||
|
||||
private IMogoCardManager mCardManager;
|
||||
|
||||
public AppsPresenter( AppsView view ) {
|
||||
super( view );
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||
mCardManager = mApis.getCardManagerApi();
|
||||
mCardManager = AppServiceHandler.getApis().getCardManagerApi();
|
||||
InternalFunctionLauncher internalFunctionLauncher = new InternalFunctionLauncher( getContext() );
|
||||
CardAppLauncher cardAppLauncher = new CardAppLauncher( this, mCardManager );
|
||||
GuideShowLauncher guideShowLauncher = new GuideShowLauncher( mApis.getMapServiceApi().getNavi( getContext() ) );
|
||||
GuideShowLauncher guideShowLauncher = new GuideShowLauncher( AppServiceHandler.getApis().getMapServiceApi().getNavi( getContext() ) );
|
||||
internalFunctionLauncher.setNext( cardAppLauncher );
|
||||
cardAppLauncher.setNext( guideShowLauncher );
|
||||
guideShowLauncher.setNext( new AppLauncher() );
|
||||
@@ -69,7 +62,7 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
}
|
||||
} );
|
||||
|
||||
mAnalytics = mApis.getAnalyticsApi();
|
||||
mAnalytics = AppServiceHandler.getApis().getAnalyticsApi();
|
||||
}
|
||||
|
||||
private void renderAppsList() {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.mogo.module.apps.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -12,6 +10,7 @@ import com.mogo.module.apps.AppFilter;
|
||||
import com.mogo.module.apps.AppFilterImpl;
|
||||
import com.mogo.module.apps.AppsConst;
|
||||
import com.mogo.module.apps.AppsListChangedLiveData;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -26,6 +25,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
* 加载并保存 app 列表
|
||||
*/
|
||||
public class AppsModel {
|
||||
|
||||
private static final String TAG = "AppsModel";
|
||||
|
||||
private static volatile AppsModel sInstance;
|
||||
private Context mContext;
|
||||
@@ -72,6 +73,12 @@ public class AppsModel {
|
||||
if ( mAppFilter == null ) {
|
||||
mAppFilter = new AppFilterImpl( mContext );
|
||||
}
|
||||
try {
|
||||
AppFilterImpl.loadExternalFilterPackagesList();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
e.printStackTrace();
|
||||
}
|
||||
final PackageManager packageManager = mContext.getPackageManager();
|
||||
List< PackageInfo > packages = packageManager.getInstalledPackages( 0 );
|
||||
int counter = 0;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<string name="module_apps_str_guide_warning">为了您的安全,导航中不可播放视频</string>
|
||||
<string-array name="module_apps_array_filter_packages_f">
|
||||
<item>com.mogo.launcher</item>
|
||||
<item>com.mogo.launcher.f</item>
|
||||
<item>com.mogo.launcher.app</item>
|
||||
<item>com.zhidao.launcher</item>
|
||||
<item>com.nwd.android.toolsmanager</item>
|
||||
@@ -28,6 +29,7 @@
|
||||
</string-array>
|
||||
<string-array name="module_apps_array_filter_packages">
|
||||
<item>com.mogo.launcher</item>
|
||||
<item>com.mogo.launcher.f</item>
|
||||
<item>com.mogo.launcher.app</item>
|
||||
<item>com.zhidao.launcher</item>
|
||||
<item>com.nwd.android.toolsmanager</item>
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.mogo.module.back;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-26
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class Back2LauncherFragment extends Fragment {
|
||||
|
||||
private static final String TAG = "Back2LauncherFragment";
|
||||
|
||||
@Override
|
||||
public void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
BackToMainHomeManager.addMainHomeView();
|
||||
Logger.d( TAG, "addMainHomeView" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
BackToMainHomeManager.removeMainHomeView();
|
||||
Logger.d( TAG, "removeMainHomeView" );
|
||||
}
|
||||
}
|
||||
@@ -49,46 +49,11 @@ public class BackToLauncherModuleProvider implements IMogoModuleProvider {
|
||||
return BackToLauncherConst.MODULE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoModuleLifecycle getCardLifecycle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapListener getMapListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return ModuleType.TYPE_SERVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNaviListener getNaviListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationListener getLocationListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
|
||||
|
||||
@@ -1,28 +1,20 @@
|
||||
package com.mogo.module.back;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.back.utils.WindowManagerViewHelper;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class BackToMainHomeManager {
|
||||
|
||||
private static final String TAG = "BackToMainHomeManager";
|
||||
|
||||
private static View mBackView;
|
||||
|
||||
private static IMogoFragmentManager mFragmentManager;
|
||||
private static IMogoStatusManager mStatusManager;
|
||||
private static IMogoServiceApis mApis;
|
||||
@@ -34,8 +26,8 @@ public class BackToMainHomeManager {
|
||||
}
|
||||
|
||||
public static void backToLauncher() {
|
||||
if (mStatusManager == null) {
|
||||
Logger.e(TAG,"未初始化完成");
|
||||
if ( mStatusManager == null ) {
|
||||
Logger.e( TAG, "未初始化完成" );
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
@@ -45,6 +37,10 @@ public class BackToMainHomeManager {
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent2 = new Intent();
|
||||
// 是否发自系统消息
|
||||
intent2.putExtra( "isHomeKeyDown", false );
|
||||
mApis.getIntentManagerApi().invoke( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intent2 );
|
||||
Logger.d( TAG, "返回桌面" );
|
||||
|
||||
Intent intent = new Intent();
|
||||
@@ -54,40 +50,34 @@ public class BackToMainHomeManager {
|
||||
AbsMogoApplication.getApp().startActivity( intent );
|
||||
}
|
||||
|
||||
private static WindowManagerView mWindowManagerView;
|
||||
|
||||
public static void addMainHomeView() {
|
||||
Logger.d( "BackToMainHomeManager", "addMainHomeView" );
|
||||
if ( mBackView != null ) WindowManagerViewHelper.removeView( mBackView );
|
||||
mBackView = LayoutInflater.from( AbsMogoApplication.getApp() ).inflate( R.layout.mogo_module_back_home_back_layout, null );
|
||||
final Context context = mBackView.getContext();
|
||||
if ( context == null || context.getApplicationContext() == null ) {
|
||||
return;
|
||||
|
||||
if ( mWindowManagerView == null ) {
|
||||
mWindowManagerView = new WindowManagerView.Builder( AbsMogoApplication.getApp() )
|
||||
.contentView( R.layout.mogo_module_back_home_back_layout )
|
||||
.position( AbsMogoApplication.getApp().getResources().getDimensionPixelOffset( R.dimen.module_back_main_home_icon_left ),
|
||||
AbsMogoApplication.getApp().getResources().getDimensionPixelOffset( R.dimen.module_back_main_home_icon_top ) )
|
||||
.size( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT )
|
||||
.gravity( Gravity.LEFT | Gravity.TOP )
|
||||
.showInWindowManager();
|
||||
mWindowManagerView.attachTouchEvent( view -> {
|
||||
backToLauncher();
|
||||
} );
|
||||
}
|
||||
WindowManager windowManager = ( WindowManager ) context.getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
if ( windowManager == null ) {
|
||||
return;
|
||||
try {
|
||||
mWindowManagerView.show();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mBackView.setOnClickListener( view -> {
|
||||
backToLauncher();
|
||||
} );
|
||||
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.x = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset( R.dimen.module_back_main_home_icon_left );
|
||||
params.y = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset( R.dimen.module_back_main_home_icon_top );
|
||||
params.gravity = Gravity.LEFT | Gravity.CENTER;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
|
||||
} else {
|
||||
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
}
|
||||
params.format = PixelFormat.RGBA_8888;
|
||||
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
||||
windowManager.addView( mBackView, params );
|
||||
WindowManagerViewHelper.attachMovementEvent( mBackView, params );
|
||||
}
|
||||
|
||||
public static void removeMainHomeView() {
|
||||
WindowManagerViewHelper.removeView( mBackView );
|
||||
if ( mWindowManagerView != null ) {
|
||||
mWindowManagerView.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.module.back.utils;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
|
||||
public class Utils {
|
||||
public static boolean isActivityExits( String packageName, String classStr ) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName( packageName, classStr );
|
||||
ResolveInfo resolveInfo = AbsMogoApplication.getApp().getPackageManager().resolveActivity( intent, PackageManager.MATCH_DEFAULT_ONLY );
|
||||
if ( resolveInfo != null ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,213 +0,0 @@
|
||||
package com.mogo.module.back.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-04-30
|
||||
* <p>
|
||||
* 向 window manager 添加 view
|
||||
*/
|
||||
public class WindowManagerViewHelper {
|
||||
|
||||
public static void addView( View view ) {
|
||||
|
||||
final Context context = view.getContext();
|
||||
if ( context == null || context.getApplicationContext() == null ) {
|
||||
return;
|
||||
}
|
||||
WindowManager windowManager = ( WindowManager ) context.getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
if ( windowManager == null ) {
|
||||
return;
|
||||
}
|
||||
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.LEFT | Gravity.CENTER;
|
||||
params.type = getFitWindowParamsType();
|
||||
params.format = PixelFormat.RGBA_8888;
|
||||
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
||||
windowManager.addView( view, params );
|
||||
|
||||
attachMovementEvent( view, params );
|
||||
}
|
||||
|
||||
private static int getFitWindowParamsType() {
|
||||
int type;
|
||||
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 ) {
|
||||
// Need request permission.
|
||||
type = WindowManager.LayoutParams.TYPE_PHONE;
|
||||
} else if ( Build.MODEL.equalsIgnoreCase( "MI 5" ) ) {
|
||||
// MI 5 phone not display crawler dot in android 7.0
|
||||
type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
} else {
|
||||
// It's will be dismissed automatically 3s after showing in Android 25.
|
||||
type = WindowManager.LayoutParams.TYPE_TOAST;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public static void removeView( View view ) {
|
||||
if ( view == null || view.getContext() == null || view.getContext().getApplicationContext() == null ) {
|
||||
return;
|
||||
}
|
||||
WindowManager windowManager = ( WindowManager ) view.getContext().getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
if ( windowManager == null ) {
|
||||
return;
|
||||
}
|
||||
windowManager.removeViewImmediate( view );
|
||||
DispatchTouchEventWrapper.getInstance().release();
|
||||
|
||||
}
|
||||
|
||||
public static void attachMovementEvent( View view, WindowManager.LayoutParams params ) {
|
||||
if ( view == null ) {
|
||||
return;
|
||||
}
|
||||
view.setOnTouchListener( ( v, event ) -> {
|
||||
DispatchTouchEventWrapper.getInstance()
|
||||
.attach( view, params )
|
||||
.handle( event );
|
||||
return false;
|
||||
} );
|
||||
}
|
||||
|
||||
static class DispatchTouchEventWrapper {
|
||||
|
||||
private WindowViewHandler mWindowViewHandler;
|
||||
|
||||
int mActionDownX = -1;
|
||||
int mActionDownY = -1;
|
||||
|
||||
/**
|
||||
* Flag whether move after touch down.
|
||||
*/
|
||||
boolean mMoveFlag = false;
|
||||
|
||||
private static volatile DispatchTouchEventWrapper INST;
|
||||
|
||||
private DispatchTouchEventWrapper() {
|
||||
}
|
||||
|
||||
public static DispatchTouchEventWrapper getInstance() {
|
||||
if ( INST == null ) {
|
||||
synchronized ( DispatchTouchEventWrapper.class ) {
|
||||
if ( INST == null ) {
|
||||
INST = new DispatchTouchEventWrapper();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INST;
|
||||
}
|
||||
|
||||
public DispatchTouchEventWrapper attach( View windowView, WindowManager.LayoutParams params ) {
|
||||
if ( mWindowViewHandler == null || mWindowViewHandler.getWindowView() != windowView ) {
|
||||
mWindowViewHandler = new WindowViewHandler.DefaultHandler( windowView, params );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean handle( MotionEvent event ) {
|
||||
switch ( event.getAction() & MotionEvent.ACTION_MASK ) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if ( onActionDown( event ) ) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if ( onActionMove( event ) ) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
if ( onActionUp( event ) ) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onActionDown( MotionEvent event ) {
|
||||
mActionDownX = ( ( int ) event.getRawX() );
|
||||
mActionDownY = ( ( int ) event.getRawY() );
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.recordNewPosition();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onActionMove( MotionEvent event ) {
|
||||
|
||||
if ( Math.abs( event.getRawX() - mActionDownX ) >= 20
|
||||
|| Math.abs( event.getRawY() - mActionDownY ) >= 20 ) {
|
||||
mMoveFlag = true;
|
||||
}
|
||||
|
||||
if ( isLastDownValueLegal() ) {
|
||||
moveWindowView( event );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean onActionUp( MotionEvent event ) {
|
||||
if ( isClickEventLike() ) {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.performClickLike();
|
||||
}
|
||||
} else {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.moveToEdge();
|
||||
mWindowViewHandler.recordNewPosition();
|
||||
}
|
||||
}
|
||||
mMoveFlag = false;
|
||||
clearLastDownAxisValue();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void clearLastDownAxisValue() {
|
||||
mActionDownX = mActionDownY = -1;
|
||||
}
|
||||
|
||||
private boolean isLastDownValueLegal() {
|
||||
return mActionDownX != -1 && mActionDownY != -1;
|
||||
}
|
||||
|
||||
private void moveWindowView( MotionEvent event ) {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.move( event, mActionDownX, mActionDownY );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate click event just like set {@link View.OnClickListener}
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isClickEventLike() {
|
||||
System.out.println( mMoveFlag );
|
||||
return isLastDownValueLegal() && !mMoveFlag;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
if ( mWindowViewHandler != null ) {
|
||||
mWindowViewHandler.release();
|
||||
}
|
||||
mWindowViewHandler = null;
|
||||
mActionDownX = -1;
|
||||
mActionDownY = -1;
|
||||
mMoveFlag = false;
|
||||
INST = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.mogo.module.back.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
|
||||
|
||||
/**
|
||||
* Created by congtaowang on 2017/6/20.
|
||||
*/
|
||||
|
||||
public interface WindowViewHandler {
|
||||
|
||||
View getWindowView();
|
||||
|
||||
void recordNewPosition();
|
||||
|
||||
void move(MotionEvent event, int downX, int downY);
|
||||
|
||||
void release();
|
||||
|
||||
void moveToEdge();
|
||||
|
||||
void performClickLike();
|
||||
|
||||
class DefaultHandler implements WindowViewHandler {
|
||||
|
||||
protected View mWindowView;
|
||||
|
||||
protected int mWindowViewLeft = -1;
|
||||
protected int mWindowViewTop = -1;
|
||||
|
||||
private WindowManager.LayoutParams mParams;
|
||||
|
||||
public DefaultHandler( View windowView, WindowManager.LayoutParams params ) {
|
||||
this.mWindowView = windowView;
|
||||
mParams = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getWindowView() {
|
||||
return mWindowView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordNewPosition() {
|
||||
mWindowViewLeft = mParams.x;
|
||||
mWindowViewTop = mParams.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move( MotionEvent event, int downX, int downY ) {
|
||||
move( ( ( int ) ( event.getRawX() - downX ) ),
|
||||
( ( int ) ( event.getRawY() - downY ) ) );
|
||||
}
|
||||
|
||||
private void move( int distanceX, int distanceY ) {
|
||||
if ( mWindowView == null ) {
|
||||
return;
|
||||
}
|
||||
mParams.x = mWindowViewLeft + distanceX;
|
||||
mParams.y = mWindowViewTop + distanceY;
|
||||
WindowManager wm = ( ( WindowManager ) mWindowView.getContext().getSystemService( Context.WINDOW_SERVICE ) );
|
||||
|
||||
if ( wm == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mWindowView instanceof WindowViewUIController ) {
|
||||
if ( mParams.x > WindowUtils.getScreenWidth( AbsMogoApplication.getApp() ) / 2 ) {
|
||||
( ( WindowViewUIController ) mWindowView ).rightMode();
|
||||
} else {
|
||||
( ( WindowViewUIController ) mWindowView ).leftMode();
|
||||
}
|
||||
}
|
||||
|
||||
wm.updateViewLayout( mWindowView, alignLayoutParamsBoundary( mParams ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToEdge() {
|
||||
if ( mWindowView == null ) {
|
||||
return;
|
||||
}
|
||||
WindowManager wm = ( ( WindowManager ) mWindowView.getContext().getSystemService( Context.WINDOW_SERVICE ) );
|
||||
|
||||
if ( mParams.x > WindowUtils.getScreenWidth( AbsMogoApplication.getApp() ) / 2 ) {
|
||||
mParams.x = WindowUtils.getScreenWidth( AbsMogoApplication.getApp() ) - mWindowView.getMeasuredWidth();
|
||||
} else {
|
||||
mParams.x = 0;
|
||||
}
|
||||
|
||||
wm.updateViewLayout( mWindowView, alignLayoutParamsBoundary( mParams ) );
|
||||
}
|
||||
|
||||
protected WindowManager.LayoutParams alignLayoutParamsBoundary( WindowManager.LayoutParams params ) {
|
||||
return params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performClickLike() {
|
||||
if ( mWindowView instanceof WindowViewUIController ) {
|
||||
( ( WindowViewUIController ) mWindowView ).performClickLike();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
mWindowView = null;
|
||||
mWindowViewLeft = -1;
|
||||
mWindowViewTop = -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.module.back.utils;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-05-12
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public interface WindowViewUIController {
|
||||
|
||||
void leftMode();
|
||||
|
||||
void rightMode();
|
||||
|
||||
void performClickLike();
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_back_main_home_icon_size">140px</dimen>
|
||||
<dimen name="module_back_main_home_icon_left">0px</dimen>
|
||||
<dimen name="module_back_main_home_icon_top">190px</dimen>
|
||||
<dimen name="module_back_main_home_icon_left">30px</dimen>
|
||||
<dimen name="module_back_main_home_icon_top">230px</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_back_main_home_icon_size">80px</dimen>
|
||||
<dimen name="module_back_main_home_icon_left">0px</dimen>
|
||||
<dimen name="module_back_main_home_icon_top">100px</dimen>
|
||||
<dimen name="module_back_main_home_icon_left">16px</dimen>
|
||||
<dimen name="module_back_main_home_icon_top">140px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -16,6 +16,7 @@ public class MarkerCardResult extends BaseData {
|
||||
|
||||
private List<MarkerOnlineCar> onlineCar;
|
||||
private List<MarkerExploreWay> exploreWay;
|
||||
private long messageTime;
|
||||
|
||||
public List<MarkerCarChat> getCarChat() {
|
||||
return carChat;
|
||||
@@ -65,15 +66,11 @@ public class MarkerCardResult extends BaseData {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerCardResult{" +
|
||||
"dataType=" + dataType +
|
||||
", carChat=" + carChat +
|
||||
", exploreWay=" + exploreWay +
|
||||
", onlineCar=" + onlineCar +
|
||||
", shareMusic=" + shareMusic +
|
||||
", noveltyInfo=" + noveltyInfo +
|
||||
'}';
|
||||
public long getMessageTime() {
|
||||
return messageTime;
|
||||
}
|
||||
|
||||
public void setMessageTime(long messageTime) {
|
||||
this.messageTime = messageTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class MarkerExploreWay implements Serializable {
|
||||
|
||||
public String getAddr() {
|
||||
if (TextUtils.isEmpty(addr)) {
|
||||
return "";
|
||||
return "未知道路";
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
@@ -114,6 +114,14 @@ public class MarkerUserInfo implements Serializable {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public void setGender(int gender) {
|
||||
if (gender == 0) {
|
||||
this.gender = "男";
|
||||
} else {
|
||||
this.gender = "女";
|
||||
}
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
if (TextUtils.isEmpty(sn)) {
|
||||
return "";
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
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.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -14,7 +20,8 @@ import java.util.Objects;
|
||||
*/
|
||||
public class V2XEventShowEntity implements Serializable {
|
||||
|
||||
// 0---默认展示详情,1--直播,4--道路事件详情
|
||||
// 0---默认展示详情,1--直播,
|
||||
@ViewType
|
||||
private int viewType;
|
||||
|
||||
// 道路事件详情
|
||||
@@ -23,6 +30,10 @@ public class V2XEventShowEntity implements Serializable {
|
||||
private V2XLiveCarInfoEntity v2XLiveCarInfoRes;
|
||||
// 直播车机列表
|
||||
private List<V2XLiveCarInfoEntity> v2XLiveCarList;
|
||||
// 推送信息,疲劳驾驶,他人发起故障求助
|
||||
private V2XPushMessageEntity v2XPushMessageEntity;
|
||||
// 违章停车
|
||||
private MarkerExploreWay v2XIllegalPark;
|
||||
|
||||
public int getViewType() {
|
||||
return viewType;
|
||||
@@ -56,6 +67,22 @@ public class V2XEventShowEntity implements Serializable {
|
||||
this.v2XLiveCarList = v2XLiveCarList;
|
||||
}
|
||||
|
||||
public V2XPushMessageEntity getV2XPushMessageEntity() {
|
||||
return v2XPushMessageEntity;
|
||||
}
|
||||
|
||||
public void setV2XPushMessageEntity(V2XPushMessageEntity v2XPushMessageEntity) {
|
||||
this.v2XPushMessageEntity = v2XPushMessageEntity;
|
||||
}
|
||||
|
||||
public MarkerExploreWay getV2XIllegalPark() {
|
||||
return v2XIllegalPark;
|
||||
}
|
||||
|
||||
public void setV2XIllegalPark(MarkerExploreWay v2XIllegalPark) {
|
||||
this.v2XIllegalPark = v2XIllegalPark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@@ -68,21 +95,37 @@ public class V2XEventShowEntity implements Serializable {
|
||||
return viewType == that.viewType &&
|
||||
Objects.equals(v2XRoadEventEntity, that.v2XRoadEventEntity) &&
|
||||
Objects.equals(v2XLiveCarInfoRes, that.v2XLiveCarInfoRes) &&
|
||||
Objects.equals(v2XLiveCarList, that.v2XLiveCarList);
|
||||
Objects.equals(v2XLiveCarList, that.v2XLiveCarList) &&
|
||||
Objects.equals(v2XPushMessageEntity, that.v2XPushMessageEntity) &&
|
||||
Objects.equals(v2XIllegalPark, that.v2XIllegalPark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(viewType, v2XRoadEventEntity, v2XLiveCarInfoRes, v2XLiveCarList);
|
||||
return Objects.hash(viewType, v2XRoadEventEntity,
|
||||
v2XLiveCarInfoRes, v2XLiveCarList,
|
||||
v2XPushMessageEntity, v2XIllegalPark);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XEventShowEntity{" +
|
||||
"viewType=" + viewType +
|
||||
", v2XRoadEventEntity=" + v2XRoadEventEntity +
|
||||
", v2XLiveCarInfoRes=" + v2XLiveCarInfoRes +
|
||||
", v2XLiveCarList=" + v2XLiveCarList +
|
||||
'}';
|
||||
|
||||
@IntDef(value = {
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_TOAST_WARNING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
|
||||
V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP,
|
||||
})
|
||||
@Target({
|
||||
ElementType.PARAMETER,
|
||||
ElementType.FIELD,
|
||||
ElementType.METHOD,
|
||||
}) //表示注解作用范围,参数注解,成员注解,方法注解
|
||||
@Retention(RetentionPolicy.SOURCE) //表示注解所存活的时间,在运行时,而不会存在 .class 文件中
|
||||
public @interface ViewType { //接口,定义新的注解类型
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.utils.sqlite.annotation.DbDatabase;
|
||||
import com.mogo.utils.sqlite.annotation.DbField;
|
||||
import com.mogo.utils.sqlite.annotation.DbTable;
|
||||
|
||||
/**
|
||||
* V2X 道路历史事件
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
@DbDatabase(dbName = "MoGoScenario.db")
|
||||
@DbTable(tableName = "tb_history_scenario")
|
||||
public class V2XHistoryScenarioData {
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@DbField(fieldName = "scenarioType")
|
||||
public Integer scenarioType;
|
||||
|
||||
/**
|
||||
* 事件触发时间
|
||||
*/
|
||||
@DbField(fieldName = "triggerTime")
|
||||
public Long triggerTime;
|
||||
|
||||
/**
|
||||
* 事件json
|
||||
*/
|
||||
@DbField(fieldName = "eventJsonData")
|
||||
public String eventJsonData;
|
||||
|
||||
/**
|
||||
* 事件是否被处理过了,true-处理过了。false-未处理过
|
||||
*/
|
||||
@DbField(fieldName = "isDispose")
|
||||
public Boolean isDispose;
|
||||
|
||||
public Integer getScenarioType() {
|
||||
return scenarioType;
|
||||
}
|
||||
|
||||
public void setScenarioType(Integer scenarioType) {
|
||||
this.scenarioType = scenarioType;
|
||||
}
|
||||
|
||||
public String getEventJsonData() {
|
||||
return eventJsonData;
|
||||
}
|
||||
|
||||
public void setEventJsonData(String eventJsonData) {
|
||||
this.eventJsonData = eventJsonData;
|
||||
}
|
||||
|
||||
public Long getTriggerTime() {
|
||||
return triggerTime;
|
||||
}
|
||||
|
||||
public void setTriggerTime(Long triggerTime) {
|
||||
this.triggerTime = triggerTime;
|
||||
}
|
||||
|
||||
public Boolean isDispose() {
|
||||
return isDispose;
|
||||
}
|
||||
|
||||
public void setDispose(Boolean dispose) {
|
||||
isDispose = dispose;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V2XHistoryScenarioData clone() throws CloneNotSupportedException {
|
||||
try {
|
||||
return (V2XHistoryScenarioData) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,8 @@ public class V2XMessageEntity<T> implements Serializable {
|
||||
* V2X 场景类型
|
||||
*/
|
||||
public interface V2XTypeEnum {
|
||||
// 默认展示详情
|
||||
int DEFAULT_WINDOW = 0;
|
||||
// 道路事件预警
|
||||
int ALERT_ROAD_WARNING = 1_000;
|
||||
// 他车求助预警
|
||||
|
||||
@@ -28,6 +28,7 @@ public class V2XPushMessageEntity implements Serializable {
|
||||
private String videoSn;
|
||||
private String videoChannel;
|
||||
private int expireTime;
|
||||
private long createTime;
|
||||
private double lat;
|
||||
private double lon;
|
||||
private String sn;
|
||||
@@ -37,6 +38,11 @@ public class V2XPushMessageEntity implements Serializable {
|
||||
private double distance;
|
||||
private boolean isShowWindow;
|
||||
|
||||
private int age;
|
||||
private String displayName;
|
||||
private int sex;
|
||||
private long userId;
|
||||
|
||||
public int getViewType() {
|
||||
return viewType;
|
||||
}
|
||||
@@ -220,10 +226,54 @@ public class V2XPushMessageEntity implements Serializable {
|
||||
isShowWindow = showWindow;
|
||||
}
|
||||
|
||||
public long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public int getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
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);
|
||||
@@ -234,31 +284,5 @@ public class V2XPushMessageEntity implements Serializable {
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -22,16 +22,9 @@ public class MapCenterPointStrategy {
|
||||
|
||||
public static final MapCenterPoint DEFAULT = new MapCenterPoint( 0.677734D, 0.5733333D );
|
||||
|
||||
public static void init() {
|
||||
// 普通场景,使用高德内部值
|
||||
{
|
||||
Map< Integer, MapCenterPoint > common = new HashMap<>();
|
||||
common.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.5D, 0.666666666D ) );
|
||||
common.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.5D, 0.666666666D ) );
|
||||
common.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.5D, 0.666666666D ) );
|
||||
common.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.5D, 0.666666666D ) );
|
||||
sStrategies.put( Scene.COMMON, common );
|
||||
}
|
||||
private static MapCenterPoint sLastPoint = DEFAULT;
|
||||
|
||||
public static void init() {
|
||||
|
||||
{
|
||||
// 选点场景,定位中心点
|
||||
@@ -112,6 +105,22 @@ public class MapCenterPointStrategy {
|
||||
categoryV2XEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.6963541D, 0.65D ) );
|
||||
sStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
|
||||
}
|
||||
|
||||
try {
|
||||
sLastPoint = sStrategies.get( Scene.AIMLESS ).get( CarSeries.getSeries() );
|
||||
} catch ( Exception e ) {
|
||||
sLastPoint = DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
public static void restoreLastScene( IMogoMapUIController controller ) {
|
||||
if ( sLastPoint == null ) {
|
||||
return;
|
||||
}
|
||||
if ( controller == null ) {
|
||||
return;
|
||||
}
|
||||
controller.setPointToCenter( sLastPoint.x, sLastPoint.y );
|
||||
}
|
||||
|
||||
public static void addScene( int scene, Map< Integer, MapCenterPoint > config ) {
|
||||
@@ -138,6 +147,7 @@ public class MapCenterPointStrategy {
|
||||
if ( !sStrategies.containsKey( scene ) ) {
|
||||
Logger.w( TAG, "no strategy for scene: %s, use DEFAULT", scene );
|
||||
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
|
||||
sLastPoint = DEFAULT;
|
||||
return;
|
||||
}
|
||||
Map< Integer, MapCenterPoint > points = sStrategies.get( scene );
|
||||
@@ -145,14 +155,17 @@ public class MapCenterPointStrategy {
|
||||
if ( !points.containsKey( car ) ) {
|
||||
Logger.w( TAG, "no strategy for series: %s, use DEFAULT", scene );
|
||||
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
|
||||
sLastPoint = DEFAULT;
|
||||
return;
|
||||
}
|
||||
MapCenterPoint point = points.get( car );
|
||||
if ( point == null ) {
|
||||
Logger.w( TAG, "no strategy config for series: %s, use DEFAULT", scene );
|
||||
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
|
||||
sLastPoint = DEFAULT;
|
||||
return;
|
||||
}
|
||||
sLastPoint = point;
|
||||
controller.setPointToCenter( point.x, point.y );
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ class DialogImpl implements IWindowManagerView {
|
||||
return dialog.isShowing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTouchEvent(OnViewClickListener listener) {
|
||||
// do nothings.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
dialog.show();
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
package com.mogo.module.common.wm;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
interface IWindowManagerView {
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @param params contentView包装类
|
||||
*/
|
||||
void init(WindowManagerView.WMViewParams params);
|
||||
void init( WindowManagerView.WMViewParams params );
|
||||
|
||||
/**
|
||||
* 是否显示
|
||||
*
|
||||
* @return true - 显示中
|
||||
*/
|
||||
boolean isShowing();
|
||||
|
||||
/**
|
||||
* 支持手势拖动,该操作只支持触发点击操作
|
||||
*/
|
||||
void handleTouchEvent(OnViewClickListener listener);
|
||||
|
||||
/**
|
||||
* 显示
|
||||
*/
|
||||
@@ -22,4 +31,8 @@ interface IWindowManagerView {
|
||||
* 隐藏
|
||||
*/
|
||||
void hide();
|
||||
|
||||
interface OnViewClickListener {
|
||||
void onClick( View view );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,24 +3,26 @@ 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.MotionEvent;
|
||||
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;
|
||||
|
||||
private float mLastX, mLastY;
|
||||
private int mOldOffsetX, mOldOffsetY;
|
||||
|
||||
@Override
|
||||
public void init(WindowManagerView.WMViewParams params) {
|
||||
public void init( WindowManagerView.WMViewParams params ) {
|
||||
mParams = params;
|
||||
mWindowManager = (WindowManager) mParams.mContext.getApplicationContext().getSystemService( Context.WINDOW_SERVICE );
|
||||
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;
|
||||
@@ -28,19 +30,14 @@ class WindowManagerImpl implements IWindowManagerView {
|
||||
mLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
|
||||
}
|
||||
mLayoutParams.format = PixelFormat.TRANSLUCENT;
|
||||
mLayoutParams.gravity = Gravity.CENTER;
|
||||
mLayoutParams.gravity = mParams.mGravity;
|
||||
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.width = mParams.mWidth;
|
||||
mLayoutParams.height = mParams.mHeight;
|
||||
mOldOffsetX = mLayoutParams.x = mParams.mX;
|
||||
mOldOffsetY = mLayoutParams.y = mParams.mY;
|
||||
mLayoutParams.dimAmount = 0.5f;
|
||||
mLayoutParams.x = 0;
|
||||
mLayoutParams.y = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,20 +45,47 @@ class WindowManagerImpl implements IWindowManagerView {
|
||||
return isShowing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTouchEvent(OnViewClickListener listener) {
|
||||
mParams.mContentView.setOnTouchListener( ( v, event ) -> {
|
||||
final int action = event.getAction();
|
||||
float x = event.getX();
|
||||
float y = event.getY();
|
||||
if ( action == MotionEvent.ACTION_DOWN ) {
|
||||
mLastX = x;
|
||||
mLastY = y;
|
||||
} else if ( action == MotionEvent.ACTION_MOVE ) {
|
||||
mLayoutParams.x += ( int ) ( x - mLastX ) / 3; // 减小偏移量,防止过度抖动
|
||||
mLayoutParams.y += ( int ) ( y - mLastY ) / 3; // 减小偏移量,防止过度抖动
|
||||
mWindowManager.updateViewLayout( mParams.mContentView, mLayoutParams );
|
||||
} else if ( action == MotionEvent.ACTION_UP ) {
|
||||
int newOffsetX = mLayoutParams.x;
|
||||
int newOffsetY = mLayoutParams.y;
|
||||
// 只要按钮一动位置不是很大,就认为是点击事件
|
||||
if ( Math.abs( mOldOffsetX - newOffsetX ) <= 20
|
||||
&& Math.abs( mOldOffsetY - newOffsetY ) <= 20 ) {
|
||||
listener.onClick( mParams.mContentView );
|
||||
}
|
||||
mOldOffsetX = newOffsetX;
|
||||
mOldOffsetY = newOffsetY;
|
||||
}
|
||||
return true;
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if(!isShowing){
|
||||
if ( !isShowing ) {
|
||||
isShowing = true;
|
||||
mWindowManager.addView(mParams.mContentView,mLayoutParams);
|
||||
mWindowManager.addView( mParams.mContentView, mLayoutParams );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
if (isShowing && mParams != null) {
|
||||
mWindowManager.removeView(mParams.mContentView);
|
||||
if ( isShowing && mParams != null ) {
|
||||
mWindowManager.removeView( mParams.mContentView );
|
||||
isShowing = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
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.LayoutInflater;
|
||||
import android.view.View;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-05-21
|
||||
@@ -25,56 +17,91 @@ public class WindowManagerView {
|
||||
|
||||
private WMViewParams mParams;
|
||||
|
||||
private IWindowManagerView managerView;
|
||||
private IWindowManagerView mManagerView;
|
||||
|
||||
private WindowManagerView(WMViewParams params) {
|
||||
private WindowManagerView( WMViewParams params, IWindowManagerView view ) {
|
||||
this.mParams = params;
|
||||
managerView = new DialogImpl();
|
||||
managerView.init(params);
|
||||
// init();
|
||||
mManagerView = view;
|
||||
view.init( params );
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
return managerView.isShowing();
|
||||
return mManagerView.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 attachTouchEvent( IWindowManagerView.OnViewClickListener listener ) {
|
||||
mManagerView.handleTouchEvent(listener);
|
||||
}
|
||||
|
||||
public void show() {
|
||||
managerView.show();
|
||||
mManagerView.show();
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
managerView.hide();
|
||||
mManagerView.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 Builder size( int width, int height ) {
|
||||
mParams.mWidth = width;
|
||||
mParams.mHeight = height;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder position( int x, int y ) {
|
||||
mParams.mX = x;
|
||||
mParams.mY = y;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder gravity( int gravity ) {
|
||||
mParams.mGravity = gravity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认dialog实现
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public WindowManagerView build() {
|
||||
if (mParams.mContentView == null) {
|
||||
throw new NullPointerException("WMViewParams#mContentView must not be null.");
|
||||
return showInDialog();
|
||||
}
|
||||
|
||||
public WindowManagerView showInDialog() {
|
||||
if ( mParams.mContentView == null ) {
|
||||
throw new NullPointerException( "WMViewParams#mContentView must not be null." );
|
||||
}
|
||||
return new WindowManagerView(mParams);
|
||||
return new WindowManagerView( mParams, new DialogImpl() );
|
||||
}
|
||||
|
||||
public WindowManagerView showInWindowManager() {
|
||||
if ( mParams.mContentView == null ) {
|
||||
throw new NullPointerException( "WMViewParams#mContentView must not be null." );
|
||||
}
|
||||
return new WindowManagerView( mParams, new WindowManagerImpl() );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,5 +110,10 @@ public class WindowManagerView {
|
||||
|
||||
public View mContentView;
|
||||
public Context mContext;
|
||||
public int mWidth;
|
||||
public int mHeight;
|
||||
public int mX;
|
||||
public int mY;
|
||||
public int mGravity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:backgroundDimAmount">0.85</item>
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:fullBright">@android:color/transparent</item>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
-keep class com.zhidao.mogo.module.event.panel.EventPanelConstants
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-event-panel-noop
|
||||
VERSION_CODE=1
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.zhidao.mogo.module.event.panel
|
||||
|
||||
/**
|
||||
* 事件面板相关常量
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
object EventPanelConstants {
|
||||
const val MODULE_NAME = "MODULE_EVENT_PANEL"
|
||||
const val PATH_NAME = "/event/panel"
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#-----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
|
||||
@@ -1,5 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.event.panel">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -1,15 +0,0 @@
|
||||
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"
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
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.ShareEventsFragment
|
||||
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(), ShareEventsFragment())
|
||||
|
||||
/**
|
||||
* 目前一共就三个fragment
|
||||
*/
|
||||
override fun getItemCount(): Int = fragments.size
|
||||
|
||||
override fun createFragment(position: Int): Fragment = fragments[position]
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
package com.zhidao.mogo.module.event.panel.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.zhidao.mogo.module.event.panel.R;
|
||||
import com.zhidao.mogo.module.event.panel.bean.ShareEventDescription;
|
||||
import com.zhidao.mogo.module.event.panel.bean.ShareEventItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ShareEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private Context context;
|
||||
private ArrayList<ShareEventItem> dataArrayList;
|
||||
private Object Tag = "ShareEventAdapter";
|
||||
private final LayoutInflater shareLayoutInflater;
|
||||
|
||||
public static enum ITEM_TYPE {
|
||||
ITEM_TYPE_NUM_DES,
|
||||
ITEM_TYPE_SHARE_LIST_ITEM,
|
||||
ITEM_TYPE_SHARE_EMPTY
|
||||
}
|
||||
|
||||
public ShareEventAdapter(Context context, ArrayList<ShareEventItem> dataArrayList) {
|
||||
this.context = context;
|
||||
this.dataArrayList = dataArrayList;
|
||||
shareLayoutInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
//根据viewType创建自定义布局
|
||||
if (viewType == ITEM_TYPE.ITEM_TYPE_NUM_DES.ordinal()) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_description, parent,
|
||||
false);
|
||||
shareDescriptionViewHolder holder = new shareDescriptionViewHolder(v);
|
||||
return holder;
|
||||
} else if ((viewType == ITEM_TYPE.ITEM_TYPE_SHARE_LIST_ITEM.ordinal())) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_item, parent,
|
||||
false);
|
||||
shareItemViewHolder holder = new shareItemViewHolder(v);
|
||||
return holder;
|
||||
} else {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_empty, parent,
|
||||
false);
|
||||
shareEmptyViewHolder holder = new shareEmptyViewHolder(v);
|
||||
return holder;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
|
||||
if (position == 0) {
|
||||
ShareEventDescription data = new ShareEventDescription();
|
||||
data.shareNum = "12";
|
||||
data.approveNum = "10";
|
||||
|
||||
((shareDescriptionViewHolder) holder).shareNumTextView.setText(data.shareNum);
|
||||
((shareDescriptionViewHolder) holder).approveNumTextView.setText(data.approveNum);
|
||||
|
||||
} else {
|
||||
if (dataArrayList.size() > 0) {
|
||||
ShareEventItem data = dataArrayList.get(position - 1);
|
||||
data.usefulNum = "2";
|
||||
data.uselessNum = "3";
|
||||
((shareItemViewHolder) holder).caseStyleTextView.setText(data.caseStyle);
|
||||
((shareItemViewHolder) holder).caseAddressTextView.setText(data.caseAddress);
|
||||
((shareItemViewHolder) holder).caseTimeTextView.setText(data.caseTime);
|
||||
((shareItemViewHolder) holder).caseUsefulTextView.setText(data.usefulNum);
|
||||
((shareItemViewHolder) holder).caseUselessTextView.setText(data.uselessNum);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataArrayList.size() + dataArrayList.size() > 0 ? 1 : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
switch (dataArrayList.size()) {
|
||||
case 0:
|
||||
return position == 0 ? ITEM_TYPE.ITEM_TYPE_NUM_DES.ordinal() : ITEM_TYPE.ITEM_TYPE_SHARE_EMPTY.ordinal();
|
||||
}
|
||||
|
||||
int type = position == 0 ? ITEM_TYPE.ITEM_TYPE_NUM_DES.ordinal() : ITEM_TYPE.ITEM_TYPE_SHARE_LIST_ITEM.ordinal();
|
||||
return type;
|
||||
}
|
||||
|
||||
/*
|
||||
* 分享列表
|
||||
* */
|
||||
class shareItemViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView caseStyleTextView;
|
||||
private TextView caseAddressTextView;
|
||||
private TextView caseTimeTextView;
|
||||
private TextView caseUsefulTextView;
|
||||
private TextView caseUselessTextView;
|
||||
|
||||
public shareItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
caseStyleTextView = itemView.findViewById(R.id.road_case_style);
|
||||
caseAddressTextView = itemView.findViewById(R.id.road_case_address);
|
||||
caseTimeTextView = itemView.findViewById(R.id.road_case_share_time);
|
||||
caseUsefulTextView = itemView.findViewById(R.id.road_case_useful_num);
|
||||
caseUselessTextView = itemView.findViewById(R.id.road_case_useless_num);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 分享次数,热心指数...
|
||||
* */
|
||||
class shareDescriptionViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView shareNumTextView;
|
||||
private TextView approveNumTextView;
|
||||
|
||||
public shareDescriptionViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
shareNumTextView = itemView.findViewById(R.id.share_num);
|
||||
approveNumTextView = itemView.findViewById(R.id.share_approve);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 去分享
|
||||
* */
|
||||
class shareEmptyViewHolder extends RecyclerView.ViewHolder {
|
||||
public shareEmptyViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.zhidao.mogo.module.event.panel.bean;
|
||||
|
||||
public class ShareEventDescription {
|
||||
public String shareNum;
|
||||
public String approveNum;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.zhidao.mogo.module.event.panel.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ShareEventItem implements Serializable {
|
||||
public String caseStyle;
|
||||
public String caseAddress;
|
||||
public String caseTime;
|
||||
public String usefulNum;
|
||||
public String uselessNum;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
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())
|
||||
@@ -1,48 +0,0 @@
|
||||
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)
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
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
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
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_share_item
|
||||
|
||||
/**
|
||||
* 初始化控件,必须在初始化完成之后才可以实例化presenter,避免
|
||||
* presenter 生命周期错乱
|
||||
*/
|
||||
override fun initViews() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 presenter 实例
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
override fun createPresenter(): MySharePresenter = MySharePresenter(this)
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.zhidao.mogo.module.event.panel.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.zhidao.mogo.module.event.panel.R;
|
||||
import com.zhidao.mogo.module.event.panel.adapter.ShareEventAdapter;
|
||||
import com.zhidao.mogo.module.event.panel.bean.ShareEventItem;
|
||||
import com.zhidao.mogo.module.event.panel.presenter.ShareEventsPresenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ShareEventsFragment extends MvpFragment<ShareEventsFragment, ShareEventsPresenter> {
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
private View view;
|
||||
private ShareEventAdapter adapter;
|
||||
private ArrayList<ShareEventItem> dataArrayList = new ArrayList<ShareEventItem>();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_event_panel_share_recylerview;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
view = inflater.inflate(R.layout.module_event_panel_share_recylerview, container, false);
|
||||
initRecyclerView();
|
||||
initData();
|
||||
return view;
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
recyclerView = view.findViewById(R.id.road_case_share_list);
|
||||
adapter = new ShareEventAdapter(getActivity(),dataArrayList);
|
||||
recyclerView.setAdapter(adapter);
|
||||
LinearLayoutManager linearLayoutManager =
|
||||
new LinearLayoutManager( getActivity(), LinearLayoutManager.VERTICAL, false );
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
// for (int i = 0; i < 12; i++) {
|
||||
// ShareEventItem data = new ShareEventItem();
|
||||
// data.caseStyle = "道路拥堵";
|
||||
// data.caseAddress = "环球贸易中心";
|
||||
// data.caseTime = "2020-07-21 12:00:00";
|
||||
// dataArrayList.add(data);
|
||||
// }
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected ShareEventsPresenter createPresenter() {
|
||||
return new ShareEventsPresenter(this);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
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)
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
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)
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
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)
|
||||
@@ -1,7 +0,0 @@
|
||||
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) {
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.zhidao.mogo.module.event.panel.presenter;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.zhidao.mogo.module.event.panel.fragment.ShareEventsFragment;
|
||||
|
||||
public class ShareEventsPresenter extends Presenter <ShareEventsFragment>{
|
||||
public ShareEventsPresenter(IView view) {
|
||||
super((ShareEventsFragment) view);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
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) {
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?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:id="@+id/btnShowOrHidePanels"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="200dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="显示面板"
|
||||
android:textColor="#000"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,77 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,95 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_num"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shre_num_des"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="分享次数"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="80dp"
|
||||
android:background="#FFFFFF" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_approve"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center"
|
||||
android:text="0"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_approve_des"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:gravity="center"
|
||||
android:text="车友认同次数"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="80dp"
|
||||
android:background="#FFFFFF" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_index"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/amap_ride" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_index_des"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:gravity="center"
|
||||
android:text="热心指数"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_event_guide_des"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:text="小窍门:分享路况、点赞其他车友,有助于提高热心指数"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="16sp">
|
||||
|
||||
</TextView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_event_null_des"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="100dp"
|
||||
android:layout_below="@+id/share_event_guide_des"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:text="你还没有分享过道路事件,快去试试吧" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/shre_event_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/share_event_null_des"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="#FFFFFF"
|
||||
android:text="去分享"
|
||||
android:textSize="25sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/road_case_liset_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/road_case_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="20dp"
|
||||
android:background="#1E90FF"
|
||||
android:text="道路类型"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/road_case_address"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/road_case_style"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="15dp"
|
||||
android:text="东城区北三环"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/road_case_share_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/road_case_address"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="20dp"
|
||||
android:text="时间:"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/road_case_useless"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/amap_bus" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/road_case_useless_num"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@id/road_case_useless"
|
||||
android:layout_alignLeft="@id/road_case_useless"
|
||||
android:layout_alignRight="@id/road_case_useless"
|
||||
android:gravity="center"
|
||||
android:text="10"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/road_case_uselful"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignTop="@id/road_case_useless"
|
||||
android:layout_alignBottom="@id/road_case_useless"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_toLeftOf="@id/road_case_useless"
|
||||
android:background="@drawable/amap_ride" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/road_case_useful_num"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@id/road_case_useless"
|
||||
android:layout_alignLeft="@id/road_case_uselful"
|
||||
android:layout_alignRight="@id/road_case_uselful"
|
||||
android:gravity="center"
|
||||
android:text="5"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/road_case_share_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:overScrollMode="never"
|
||||
android:background="#000000"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mogo.module.extensions.bean;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* 底层view封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BottomLayerViewWrapper {
|
||||
private View view;
|
||||
private int x;
|
||||
private int y;
|
||||
|
||||
public BottomLayerViewWrapper(){}
|
||||
|
||||
public BottomLayerViewWrapper(View view, int x, int y) {
|
||||
this.view = view;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public View getView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setView(View view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
@@ -8,6 +9,7 @@ import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -38,6 +40,7 @@ import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.navi.NaviInfoView;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.utils.EntranceViewHolder;
|
||||
import com.mogo.module.extensions.utils.TopViewAnimHelper;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
@@ -153,6 +156,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
mEntrancePresenter = new EntrancePresenter(getContext(), this);
|
||||
mMogoFragmentManager = mApis.getFragmentManagerApi();
|
||||
EntranceViewHolder.getInstance().initRootViewGroup(mRootView);
|
||||
|
||||
mStatusManager = mApis.getStatusManagerApi();
|
||||
|
||||
@@ -204,6 +208,11 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mApis.getSearchManagerApi().goSettings();
|
||||
return true;
|
||||
});
|
||||
|
||||
mUploadRoadCondition.setOnLongClickListener(view->{
|
||||
mApis.getMogoMonitorApi().showLogDebugDialog();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
|
||||
@@ -288,16 +297,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
});
|
||||
mMsgCounter = findViewById(R.id.module_ext_id_msg_counter);
|
||||
mUserHeadImg.setOnClickListener(view -> {
|
||||
// todo 测试代码
|
||||
// mApis.getEventPanelManager().showPanel();
|
||||
// 原始逻辑
|
||||
try {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
|
||||
// 埋点
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", 3);
|
||||
ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon",
|
||||
properties);
|
||||
ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon", properties);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "打开个人中心Exception");
|
||||
}
|
||||
@@ -305,8 +310,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
mUserHeadImg.setVisibility(DebugConfig.isLauncher() ? View.VISIBLE : View.GONE);
|
||||
|
||||
mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload,
|
||||
mStatusManager);
|
||||
mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload, mStatusManager);
|
||||
|
||||
debugTopView();
|
||||
}
|
||||
@@ -317,8 +321,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
traceData("1");
|
||||
}
|
||||
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
|
||||
"AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@@ -582,6 +585,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
findViewById(R.id.btnDebugAddBottomLayerView).setOnClickListener(v->{
|
||||
TextView tv = new TextView(getContext());
|
||||
tv.setText("entrance add");
|
||||
mApis.getEntranceButtonController().addBottomLayerView(tv, 50, 50);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.module.extensions.utils.EntranceViewHolder;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
@@ -22,6 +24,21 @@ public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonCont
|
||||
return MogoEntranceButtons.getButton( index );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBottomLayerView(View view) {
|
||||
EntranceViewHolder.getInstance().addBottomLayerView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBottomLayerView(View view, int x, int y) {
|
||||
EntranceViewHolder.getInstance().addBottomLayerView(view, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBottomLayerView(View view) {
|
||||
EntranceViewHolder.getInstance().removeBottomLayerView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.mogo.module.extensions.bean.BottomLayerViewWrapper;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 入口页view管理
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class EntranceViewHolder {
|
||||
private static final String TAG = "EntranceViewHolder";
|
||||
private List<BottomLayerViewWrapper> preAddView = new ArrayList<>();
|
||||
private EntranceViewHolder(){}
|
||||
private volatile static EntranceViewHolder instance = null;
|
||||
public static EntranceViewHolder getInstance(){
|
||||
if (instance == null) {
|
||||
synchronized (EntranceViewHolder.class) {
|
||||
if (instance == null) {
|
||||
instance = new EntranceViewHolder();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
private ViewGroup rootViewGroup = null;
|
||||
public void initRootViewGroup(View rootView) {
|
||||
Logger.i(TAG, "initRootViewGroup==");
|
||||
if(rootView instanceof ViewGroup) {
|
||||
Logger.d(TAG, "initRootViewGroup 赋值");
|
||||
rootViewGroup = (ViewGroup) rootView.getParent();
|
||||
if (!preAddView.isEmpty()) {
|
||||
Logger.d(TAG, "initRootViewGroup 增加底层view: " + preAddView.size());
|
||||
Iterator<BottomLayerViewWrapper> iterator = preAddView.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BottomLayerViewWrapper wrapper = iterator.next();
|
||||
realAddView(wrapper);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addBottomLayerView(View view) {
|
||||
Logger.d(TAG, "addBottomLayerView, rootViewGroup is null: " + (rootViewGroup == null));
|
||||
addBottomLayerView(view, 0, 0);
|
||||
}
|
||||
|
||||
public void addBottomLayerView(View view, int x, int y) {
|
||||
Logger.d(TAG, "addBottomLayerView, rootViewGroup is null: " + (rootViewGroup == null) +
|
||||
"\n x: " + x + ", y: " + y);
|
||||
BottomLayerViewWrapper wrapper = new BottomLayerViewWrapper(view, x, y);
|
||||
if(rootViewGroup == null) {
|
||||
preAddView.add(wrapper);
|
||||
}else{
|
||||
realAddView(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用的时候需要预先判断rootViewGroup是否为空,本方法默认rootViewGroup不为空
|
||||
*/
|
||||
private void realAddView(BottomLayerViewWrapper wrapper){
|
||||
FrameLayout.LayoutParams params =
|
||||
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
params.topMargin = wrapper.getY();
|
||||
params.leftMargin = wrapper.getX();
|
||||
View v = wrapper.getView();
|
||||
v.setLayoutParams(params);
|
||||
rootViewGroup.addView(v, 0);
|
||||
}
|
||||
|
||||
public void removeBottomLayerView(View view) {
|
||||
if (rootViewGroup != null) {
|
||||
rootViewGroup.removeView(view);
|
||||
}
|
||||
Iterator<BottomLayerViewWrapper> iterator = preAddView.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BottomLayerViewWrapper wrapper = iterator.next();
|
||||
if (wrapper.getView().equals(view)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -379,13 +379,14 @@ public class TopViewAnimHelper {
|
||||
// 约束设置需要在applyTo()方法之前执行,visiable设置需要在applyTo()
|
||||
// 方法之后执行才能生效,所以分开了两个判断,至于为什么这么做才能生效,不得而知
|
||||
constraintSet.connect(tvNextDistance.getId(), ConstraintSet.BOTTOM,
|
||||
ivTurnIcon.getId(), ConstraintSet.BOTTOM,(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_2));
|
||||
// constraintSet.connect(tvNextRoad.getId(), ConstraintSet.TOP,
|
||||
// ivTurnIcon.getId(), ConstraintSet.TOP);
|
||||
ivTurnIcon.getId(), ConstraintSet.BOTTOM);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.LEFT,
|
||||
naviBg.getId(), ConstraintSet.LEFT,
|
||||
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_small_marginLeft));
|
||||
// constraintSet.clear(tvNextRoad.getId(), ConstraintSet.BOTTOM);
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.BOTTOM,
|
||||
tvNextDistance.getId(), ConstraintSet.BOTTOM,
|
||||
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_6));
|
||||
(int) getDimen(R.dimen.module_map_id_navi_next_info_road_marginBottom_small));
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.LEFT,
|
||||
R.id.module_map_id_navi_next_info_turn_info, ConstraintSet.RIGHT,
|
||||
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_46));
|
||||
@@ -400,10 +401,8 @@ public class TopViewAnimHelper {
|
||||
computeNaviMarginTop(params.height));
|
||||
|
||||
// 动态改变相关字体大小
|
||||
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize_small));
|
||||
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize_small));
|
||||
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize_small));
|
||||
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize_small));
|
||||
|
||||
}
|
||||
constraintSet.applyTo(topMotionLayout);
|
||||
@@ -453,10 +452,8 @@ public class TopViewAnimHelper {
|
||||
remainDistanceGroup.setVisibility(View.VISIBLE);
|
||||
remainTimeGroup.setVisibility(View.VISIBLE);
|
||||
arriveTimeGroup.setVisibility(View.VISIBLE);
|
||||
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize));
|
||||
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize));
|
||||
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize));
|
||||
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize));
|
||||
|
||||
}
|
||||
constraintSet.clone(topMotionLayout);
|
||||
@@ -472,6 +469,9 @@ public class TopViewAnimHelper {
|
||||
// 方法之后执行才能生效,所以分开了两个判断,至于为什么这么做才能生效,不得而知
|
||||
constraintSet.clear(tvNextDistance.getId(), ConstraintSet.BOTTOM);
|
||||
// constraintSet.clear(tvNextRoad.getId(), ConstraintSet.BASELINE);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.LEFT,
|
||||
naviBg.getId(), ConstraintSet.LEFT,
|
||||
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_marginLeft));
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.BOTTOM,
|
||||
ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
(int) getDimen(R.dimen.module_map_id_navi_next_info_road_marginBottom));
|
||||
@@ -502,7 +502,6 @@ public class TopViewAnimHelper {
|
||||
Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public void showNaviView() {
|
||||
@@ -518,18 +517,18 @@ public class TopViewAnimHelper {
|
||||
remainDistanceGroup.setVisibility(View.VISIBLE);
|
||||
remainTimeGroup.setVisibility(View.VISIBLE);
|
||||
arriveTimeGroup.setVisibility(View.VISIBLE);
|
||||
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize));
|
||||
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize));
|
||||
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize));
|
||||
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize));
|
||||
|
||||
// 调整约束
|
||||
constraintSet.clone(topMotionLayout);
|
||||
constraintSet.clear(tvNextDistance.getId(), ConstraintSet.BOTTOM);
|
||||
// constraintSet.clear(tvNextRoad.getId(), ConstraintSet.BASELINE);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.LEFT,
|
||||
naviBg.getId(), ConstraintSet.LEFT,
|
||||
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_marginLeft));
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.BOTTOM, ivTurnIcon.getId(),
|
||||
ConstraintSet.BOTTOM,
|
||||
(int) getDimen(R.dimen.module_map_id_navi_next_info_road_marginBottom));
|
||||
ConstraintSet.BOTTOM);
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.LEFT,
|
||||
tvNextDistance.getId(), ConstraintSet.LEFT,
|
||||
0);
|
||||
@@ -553,19 +552,19 @@ public class TopViewAnimHelper {
|
||||
remainDistanceGroup.setVisibility(View.GONE);
|
||||
remainTimeGroup.setVisibility(View.GONE);
|
||||
arriveTimeGroup.setVisibility(View.GONE);
|
||||
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize_small));
|
||||
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize_small));
|
||||
tvNextDistance.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize_small));
|
||||
tvNextDistanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX,getDimen(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize_small));
|
||||
// 调整约束
|
||||
constraintSet.clone(topMotionLayout);
|
||||
constraintSet.connect(tvNextDistance.getId(), ConstraintSet.BOTTOM,
|
||||
ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_2));
|
||||
ivTurnIcon.getId(), ConstraintSet.BOTTOM);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.LEFT,
|
||||
naviBg.getId(), ConstraintSet.LEFT,
|
||||
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_small_marginLeft));
|
||||
// constraintSet.clear(tvNextRoad.getId(), ConstraintSet.BOTTOM);
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.BOTTOM,
|
||||
tvNextDistance.getId(), ConstraintSet.BOTTOM,
|
||||
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_6));
|
||||
(int) getDimen(R.dimen.module_map_id_navi_next_info_road_marginBottom_small));
|
||||
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.LEFT,
|
||||
R.id.module_map_id_navi_next_info_turn_info, ConstraintSet.RIGHT,
|
||||
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_46));
|
||||
|
||||
@@ -6,12 +6,8 @@ import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
|
||||
@@ -25,18 +21,10 @@ public class TopViewManager implements IMogoTopViewManager {
|
||||
|
||||
private Context context;
|
||||
private LayoutParams parentParams;
|
||||
private IMogoServiceApis serviceApis;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
this.context = context;
|
||||
serviceApis =
|
||||
(IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
|
||||
serviceApis.getStatusManagerApi().registerStatusChangedListener(MogoServicePaths.PATH_EXTENSIONS_TOP_VIEW_MANAGER, StatusDescriptor.MAIN_PAGE_RESUME, (descriptor, isTrue) -> {
|
||||
if (!isTrue) {
|
||||
TopViewAnimHelper.getInstance().removeAllView();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
android:id="@+id/module_map_id_arrive_time_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_95"
|
||||
android:layout_marginEnd="@dimen/module_ext_navi_extra_info_margin_right"
|
||||
android:src="@drawable/module_ext_ic_navi_info3"
|
||||
app:layout_constraintBottom_toTopOf="@id/module_map_id_arrive_time"
|
||||
app:layout_constraintRight_toRightOf="@+id/module_map_id_navi_bg"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<include
|
||||
layout="@layout/include_navi_info_panle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_north"
|
||||
@@ -30,17 +30,17 @@
|
||||
android:textSize="@dimen/module_ext_north_textSize"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintRight_toRightOf="@+id/module_entrance_id_upload_road_condition"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg"
|
||||
app:layout_goneMarginTop="@dimen/module_ext_north_goneMarginTop" />
|
||||
app:layout_goneMarginTop="@dimen/module_ext_north_goneMarginTop"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.mogo.module.extensions.navi.TopView
|
||||
android:id="@+id/module_entrance_id_top_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintBottom_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
@@ -51,12 +51,12 @@
|
||||
android:layout_height="@dimen/module_ext_button_height"
|
||||
android:layout_marginTop="@dimen/module_ext_camera_button_marginTop"
|
||||
android:background="@drawable/module_ext_dw_common_corner_bkg"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_map_id_navi_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg">
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg"
|
||||
tools:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_ext_id_display_overview_icon"
|
||||
@@ -175,35 +175,46 @@
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btnDebugCtrlTopView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="显示隐藏TopView"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textSize="20sp" />
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btnDebugCtrlSubView"
|
||||
android:text="显示隐藏SubView"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/btnDebugCtrlTopView"
|
||||
android:textSize="20sp" />
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="显示隐藏SubView"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/btnDebugCtrlTopView"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDebugCtrlNaviView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="显示隐藏导航view"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/btnDebugCtrlSubView"
|
||||
android:textSize="20sp" />
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDebugAddBottomLayerView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="增加底层view"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/btnDebugCtrlNaviView"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/groupTopViewDebug"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="btnDebugCtrlNaviView,btnDebugCtrlSubView,btnDebugCtrlTopView"
|
||||
android:id="@+id/groupTopViewDebug" />
|
||||
app:constraint_referenced_ids="btnDebugCtrlNaviView,btnDebugCtrlSubView,btnDebugCtrlTopView,btnDebugAddBottomLayerView" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -10,10 +10,11 @@
|
||||
android:layout_height="@dimen/module_ext_height"
|
||||
android:background="@drawable/module_ext_drawable_weather_bkg"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/module_ext_weather_container_paddingLeft"
|
||||
android:paddingRight="@dimen/module_ext_weather_container_paddingRight"
|
||||
android:paddingStart="@dimen/module_ext_weather_container_paddingLeft"
|
||||
android:paddingEnd="@dimen/module_ext_weather_container_paddingRight"
|
||||
android:layout_marginEnd="@dimen/module_ext_msg_marginRight"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/module_ext_id_msg"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible">
|
||||
|
||||
@@ -35,13 +36,13 @@
|
||||
android:id="@+id/module_ext_id_msg"
|
||||
android:layout_width="@dimen/module_ext_height"
|
||||
android:layout_height="@dimen/module_ext_height"
|
||||
android:layout_marginRight="@dimen/module_ext_msg_marginRight"
|
||||
android:layout_marginEnd="@dimen/module_ext_msg_marginRight"
|
||||
android:background="@drawable/module_ext_drawable_msg_container_bkg"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivUserHeadImg"
|
||||
app:layout_constraintRight_toLeftOf="@+id/ivUserHeadImg"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivUserHeadImg"
|
||||
tools:visibility="visible">
|
||||
tools:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -71,5 +72,6 @@
|
||||
android:src="@drawable/model_ext_default_user_head"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_ext_id_weather_container"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_ext_id_weather_container"/>
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_ext_id_weather_container"
|
||||
tools:visibility="gone"/>
|
||||
</merge>
|
||||
@@ -39,7 +39,7 @@
|
||||
<dimen name="module_ext_operation_panel_move2_height">120px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_width">120px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_height">120px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_marginBottom">40px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_marginBottom">30px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_textSize">30px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginBottom">32px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginRight">32px</dimen>
|
||||
@@ -84,7 +84,7 @@
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_height">159px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_width">70px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_height">70px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginLeft">24px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginLeft">56px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_marginLeft">83px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginTop">24px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_marginTop">40px</dimen>
|
||||
@@ -103,6 +103,7 @@
|
||||
<dimen name="module_ext_voice_msg_padding_left">36px</dimen>
|
||||
<dimen name="module_ext_voice_msg_padding_right">36px</dimen>
|
||||
<dimen name="module_ext_voice_msg_icon_margin_left">-2px</dimen>
|
||||
<dimen name="module_ext_navi_extra_info_margin_right">95px</dimen>
|
||||
|
||||
<dimen name="module_ext_weather_bkg_corner">30px</dimen>
|
||||
<dimen name="module_ext_weather_container_paddingLeft">40px</dimen>
|
||||
@@ -138,6 +139,7 @@
|
||||
<dimen name="module_entrance_id_uploading_height">90px</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_distance_marginTop">6dp</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_road_marginBottom">15px</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_road_marginBottom_small">4px</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_distance_marginStart">10px</dimen>
|
||||
<dimen name="module_ext_display_overview_icon_marginTop">20px</dimen>
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<dimen name="module_ext_operation_panel_move2_height">120px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_width">120px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_height">120px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_marginBottom">40px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_marginBottom">30px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_textSize">30px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginBottom">32px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginRight">32px</dimen>
|
||||
@@ -84,7 +84,7 @@
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_height">159px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_width">70px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_height">70px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginLeft">24px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginLeft">56px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_marginLeft">83px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginTop">24px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_marginTop">40px</dimen>
|
||||
@@ -103,6 +103,7 @@
|
||||
<dimen name="module_ext_voice_msg_padding_left">36px</dimen>
|
||||
<dimen name="module_ext_voice_msg_padding_right">36px</dimen>
|
||||
<dimen name="module_ext_voice_msg_icon_margin_left">-2px</dimen>
|
||||
<dimen name="module_ext_navi_extra_info_margin_right">95px</dimen>
|
||||
|
||||
<dimen name="module_ext_weather_bkg_corner">30px</dimen>
|
||||
<dimen name="module_ext_weather_container_paddingLeft">40px</dimen>
|
||||
@@ -138,6 +139,7 @@
|
||||
<dimen name="module_entrance_id_uploading_height">90px</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_distance_marginTop">6dp</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_road_marginBottom">15px</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_road_marginBottom_small">4px</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_distance_marginStart">10px</dimen>
|
||||
<dimen name="module_ext_display_overview_icon_marginTop">20px</dimen>
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<dimen name="module_ext_operation_panel_move2_height">66px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_width">66px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_height">66px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_marginBottom">21px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_marginBottom">16px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_textSize">16px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginBottom">34.5px</dimen>
|
||||
<dimen name="module_ext_operation_panel_share_goneMarginRight">20px</dimen>
|
||||
@@ -82,25 +82,26 @@
|
||||
<!-- module_map_layout_navi_info_panel.xml-->
|
||||
<dimen name="module_ext_navi_info_panel_width">544px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_height">117px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_small_height">60px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_small_height">80px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_width">85px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_height">85px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_width">38px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_height">38px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginLeft">13px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_width">40px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_height">40px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginLeft">30px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_small_marginLeft">44px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_turn_icon_marginTop">13px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_marginTop">20px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize">32px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize_small">32px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_textSize_small">28px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginLeft">7px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_marginBottom">5px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize">22px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize_small">22px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_distance_unit_textSize_small">16px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel_next_info_road_textSize">18px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px
|
||||
</dimen>
|
||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_textSize">15px</dimen>
|
||||
<dimen name="module_ext_navi_info_turn_icon_margin_bottom">5px</dimen>
|
||||
<dimen name="module_ext_navi_info_turn_icon_margin_bottom">13px</dimen>
|
||||
<dimen name="module_ext_navi_extra_info_margin_right">58px</dimen>
|
||||
|
||||
<dimen name="module_ext_voice_msg_padding_top">9px</dimen>
|
||||
<dimen name="module_ext_voice_msg_padding_bottom">9px</dimen>
|
||||
@@ -142,6 +143,7 @@
|
||||
<dimen name="module_entrance_id_uploading_height">58px</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_distance_marginTop">3dp</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_road_marginBottom">10px</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_road_marginBottom_small">4px</dimen>
|
||||
<dimen name="module_map_id_navi_next_info_distance_marginStart">6px</dimen>
|
||||
<dimen name="module_ext_display_overview_icon_marginTop">10px</dimen>
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.tanluupload
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogoutils
|
||||
@@ -51,7 +50,6 @@ dependencies {
|
||||
api rootProject.ext.dependencies.moduleservice
|
||||
api rootProject.ext.dependencies.moduleapps
|
||||
api rootProject.ext.dependencies.moduleextensions
|
||||
api rootProject.ext.dependencies.mogomoduleback
|
||||
} else {
|
||||
api project(":foudations:mogo-utils")
|
||||
api project(":foudations:mogo-commons")
|
||||
@@ -62,7 +60,6 @@ dependencies {
|
||||
api project(':services:mogo-service')
|
||||
api project(':modules:mogo-module-apps')
|
||||
api project(':modules:mogo-module-extensions')
|
||||
api project(':modules:mogo-module-back')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.monitor.IMogoMonitorProvider;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
@@ -45,8 +46,7 @@ import java.util.List;
|
||||
*/
|
||||
public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView,
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener,
|
||||
IMogoIntentListener {
|
||||
IMogoMarkerClickListener {
|
||||
|
||||
protected static final String TAG = MainActivity.class.getSimpleName();
|
||||
|
||||
@@ -59,11 +59,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
// protected View mHeader;
|
||||
protected View mApps;
|
||||
protected View mEntrance;
|
||||
protected View mEventPanel;
|
||||
protected FrameLayout mFloatingLayout;
|
||||
protected FrameLayout mCoverUpLayout;
|
||||
protected View mCoverUpLayout;
|
||||
protected FrameLayout mLeftPanelLayout;
|
||||
protected View mLeftShadowFrame;
|
||||
private boolean mIsHomeKeyDown = false;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -78,6 +78,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
// mHeader = findViewById( R.id.module_main_id_header_fragment_container );
|
||||
mApps = findViewById( R.id.module_main_id_apps_fragment_container );
|
||||
mEntrance = findViewById( R.id.module_main_id_entrance_fragment_container );
|
||||
mEventPanel = findViewById( R.id.module_main_id_event_panel_fragment_container );
|
||||
mFloatingLayout = findViewById( R.id.module_main_id_floating_view );
|
||||
mLeftShadowFrame = findViewById( R.id.module_main_id_map_left_shadow_frame );
|
||||
mCoverUpLayout = findViewById( R.id.module_main_id_cover_up );
|
||||
@@ -93,6 +94,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
protected void hideLayout() {
|
||||
// mHeader.setVisibility( View.GONE );
|
||||
mEntrance.setVisibility( View.GONE );
|
||||
mEventPanel.setVisibility( View.GONE );
|
||||
mFloatingLayout.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
@@ -100,6 +102,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
protected void showLayout() {
|
||||
// mHeader.setVisibility( View.VISIBLE );
|
||||
mEntrance.setVisibility( View.VISIBLE );
|
||||
mEventPanel.setVisibility( View.VISIBLE );
|
||||
mFloatingLayout.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@@ -149,7 +152,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mMogoMapUIController, Scene.AIMLESS );
|
||||
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
addModule();
|
||||
loadContainerModules();
|
||||
MogoModulesManager.getInstance().loadModules();
|
||||
mPresenter.delayOperations();
|
||||
@@ -170,6 +172,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
hideLayout();
|
||||
}
|
||||
} );
|
||||
|
||||
// 初始化MonitorModule
|
||||
// IMogoMonitorProvider monitorProvider = (IMogoMonitorProvider) ARouter.getInstance().build(MogoServicePaths.PATH_MOGO_MONITOR).navigation(this);
|
||||
// monitorProvider.resetActivityContext(this);
|
||||
mServiceApis.getMogoMonitorApi().resetActivityContext(this);
|
||||
}
|
||||
|
||||
private void startBaseService() {
|
||||
@@ -177,13 +184,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
startService( intent );
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加模块
|
||||
*/
|
||||
protected void addModule() {
|
||||
|
||||
}
|
||||
|
||||
protected void loadContainerModules() {
|
||||
// MogoModulesManager.getInstance().loadExtensionsModule( R.id.module_main_id_header_fragment_container );
|
||||
MogoModulesManager.getInstance().loadEntrancesModule( R.id.module_main_id_entrance_fragment_container );
|
||||
@@ -237,7 +237,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
if ( mCoverUpLayout.getVisibility() != View.VISIBLE ) {
|
||||
mServiceApis.getAdasControllerApi().showADAS();
|
||||
}
|
||||
getApis().getIntentManagerApi().registerIntentListener( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -246,24 +245,21 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoStatusManager.setMainPageResumeStatus( TAG, false );
|
||||
mMogoStatusManager.setMainPageLaunchedStatus( TAG, false );
|
||||
mServiceApis.getAuthManagerApi().dismiss();
|
||||
if ( shouldCloseADASPanel() ) {
|
||||
if ( shouldCloseADASPanelWhenPause() ) {
|
||||
mServiceApis.getAdasControllerApi().closeADAS();
|
||||
}
|
||||
mIsHomeKeyDown = false;
|
||||
}
|
||||
|
||||
private boolean shouldCloseADASPanel() {
|
||||
protected boolean shouldCloseADASPanelWhenPause(){
|
||||
// m4 系列因为按home键会造成页面pause后resume,造成adas panel 闪烁
|
||||
// f 系列加上上滑返回桌面后会走 mIsHomeKeyDown = true,但是不会造成页面pause
|
||||
// 独立 app 任何情况下都需要隐藏 adas
|
||||
return !mIsHomeKeyDown
|
||||
|| !DebugConfig.isLauncher();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getApis().getIntentManagerApi().unregisterIntentListener( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -302,13 +298,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
return mServiceApis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
if ( TextUtils.equals( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentStr ) ) {
|
||||
mIsHomeKeyDown = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
@@ -4,22 +4,12 @@ import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.main.constants.MainConstants;
|
||||
import com.mogo.module.main.livedata.CardSwitchLiveData;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.zhidao.roadcondition.service.MainService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
|
||||
@@ -14,6 +14,8 @@ import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.CommonUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -35,6 +37,8 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
|
||||
public static final String TYPE_NAVI = "navi";
|
||||
|
||||
public static final String TYPE_LAUNCH = "launch";
|
||||
|
||||
private IMogoServiceApis mApis;
|
||||
private Context mContext;
|
||||
|
||||
@@ -84,10 +88,10 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
handleSwitch2Action( target );
|
||||
break;
|
||||
case "/main/share":
|
||||
Logger.d(TAG,"收到打开分享框的scheme,准备打开分享框");
|
||||
Logger.d( TAG, "收到打开分享框的scheme,准备打开分享框" );
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "from", "1" );
|
||||
mApis.getAnalyticsApi().track("v2x_share_click", properties);
|
||||
mApis.getAnalyticsApi().track( "v2x_share_click", properties );
|
||||
mApis.getShareManager().showShareDialog();
|
||||
break;
|
||||
default:
|
||||
@@ -115,6 +119,10 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
case TYPE_NAVI:
|
||||
handleNaviIntent( target );
|
||||
break;
|
||||
case TYPE_LAUNCH:
|
||||
handleLaunchIntent( target );
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +153,15 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleLaunchIntent( Uri uri ) {
|
||||
String type = uri.getQueryParameter( "channelType" );
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "appname", CommonUtils.getAppName( mContext ) );
|
||||
properties.put( "appversion", CommonUtils.getVersionName( mContext ) );
|
||||
properties.put( "from", type );
|
||||
mApis.getAnalyticsApi().track( "appenterfront", properties );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( descriptor == StatusDescriptor.MAIN_PAGE_RESUME ) {
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.roadcondition.service.MainService;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -82,7 +81,7 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
private void startTanluService() {
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
Logger.d(TAG, "startTanluService ---------- ");
|
||||
MainService.Companion.launchService(getApplicationContext(), "0");
|
||||
mServiceApis.getTanluApi().startTanluService();
|
||||
}, 58_000L
|
||||
);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!--黑色矩形 作为背景色-->
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:centerX="0.6"
|
||||
android:endColor="#0B0F17"
|
||||
android:startColor="#171D2B"
|
||||
android:type="linear" />
|
||||
</shape>
|
||||
</item>
|
||||
<!--单独的slogan图片 并且设置下间距-->
|
||||
<!--如果使用svg可以直接 drawable-->
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/mogo_slogan"
|
||||
android:tileMode="disabled" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -66,13 +66,14 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<FrameLayout
|
||||
<ImageView
|
||||
android:id="@+id/module_main_id_cover_up"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/module_main_launcher_bg"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="@drawable/main_bitmap_splash_bg"
|
||||
android:visibility="visible"
|
||||
tools:visibility="gone" />
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_splash_container"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<item name="android:windowEnterAnimation">@null</item>
|
||||
<item name="android:windowExitAnimation">@null</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowBackground">@drawable/module_main_launcher_bg</item>
|
||||
<item name="android:windowBackground">@drawable/main_bitmap_splash_bg</item>
|
||||
<item name="android:windowTranslucentNavigation">false</item>
|
||||
<item name="android:windowAnimationStyle">@style/MainAnimation</item>
|
||||
<item name="checkboxStyle">@style/noCheckboxStyle</item>
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/30
|
||||
*
|
||||
* 接收高德地图车机版广播
|
||||
*/
|
||||
class AutoNaviBroadcastIntentHandler implements IMogoIntentListener {
|
||||
|
||||
public static final String TAG = "AutoNaviBroadcastReceiver";
|
||||
|
||||
public static final String AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
|
||||
public void register( IMogoIntentManager manager ) {
|
||||
manager.registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, this );
|
||||
}
|
||||
|
||||
public void unregister(IMogoIntentManager manager ) {
|
||||
mCallback = null;
|
||||
manager.unregisterIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, this );
|
||||
}
|
||||
|
||||
private OnMapControlCallback mCallback;
|
||||
|
||||
public void setCallback( OnMapControlCallback mCallback ) {
|
||||
this.mCallback = mCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
String action = intent.getAction();
|
||||
|
||||
int keyType = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int operaType = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
|
||||
Logger.d( TAG, "action = %s, keyType=%s, type=%s, operType=%s", action, keyType, type, operaType );
|
||||
|
||||
if ( !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_RECV ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mCallback == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( keyType == 10027 ) {
|
||||
if ( type == 0 ) {
|
||||
mCallback.onTrafficModeChanged( operaType == 0 );
|
||||
} else if ( type == 2 ) {
|
||||
if ( operaType == 0 ) {
|
||||
mCallback.onCameraModeChanged( EnumMapUI.CarUp_2D );
|
||||
} else if ( operaType == 1 ) {
|
||||
mCallback.onCameraModeChanged( EnumMapUI.NorthUP_2D );
|
||||
} else if ( operaType == 2 ) {
|
||||
mCallback.onCameraModeChanged( EnumMapUI.CarUp_3D );
|
||||
}
|
||||
}
|
||||
} else if ( keyType == 10048 ) {
|
||||
//0:自动; 1:白天; 2:黑夜;
|
||||
int dayNightMode = intent.getIntExtra( "EXTRA_DAY_NIGHT_MODE", -1 );
|
||||
if ( dayNightMode == 0 ) {
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
} else if ( dayNightMode == 1 ) {
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_Light );
|
||||
} else if ( dayNightMode == 2 ) {
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_Night );
|
||||
}
|
||||
} else if ( keyType == 10049 ) {
|
||||
//继续导航
|
||||
boolean extraEnduranceData = intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false );
|
||||
if ( extraEnduranceData ) {
|
||||
mCallback.onContinueNavi();
|
||||
}
|
||||
} else if ( keyType == 20009 ) {
|
||||
mCallback.onOpenNavi();
|
||||
} else if ( keyType == 10038 || keyType == 10007 ) {
|
||||
double lat;
|
||||
double lon;
|
||||
|
||||
if ( type == 10007 ) {
|
||||
lat = intent.getDoubleExtra( "ENTRY_LAT", 0.0 );
|
||||
lon = intent.getDoubleExtra( "ENTRY_LON", 0.0 );
|
||||
} else {
|
||||
lat = intent.getDoubleExtra( "LAT", 0.0 );
|
||||
lon = intent.getDoubleExtra( "LON", 0.0 );
|
||||
}
|
||||
mCallback.onCalculatePath( lon, lat );
|
||||
} else if ( keyType == 10021 ) {
|
||||
mCallback.onStopNaviInternal( intent );
|
||||
} else if ( keyType == 10005 ) {
|
||||
// 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
// 避免收费 | 1
|
||||
// 多策略算路 | 2
|
||||
// 不走高速 | 3
|
||||
// 躲避拥堵 | 4
|
||||
// 不走高速且避免收费 | 5
|
||||
// 不走高速且躲避拥堵 | 6
|
||||
// 躲避收费和拥堵 | 7
|
||||
// 不走高速躲避收费和拥堵 | 8
|
||||
// 高速优先 | 20
|
||||
// 躲避拥堵且高速优先 | 24
|
||||
int prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", 0 );
|
||||
MogoNaviConfig config = new MogoNaviConfig().congestion( prefer == 4 )
|
||||
.cost( prefer == 1 || prefer == 7 )
|
||||
.highSpeed( prefer == 20 )
|
||||
.avoidSpeed( prefer == 3 );
|
||||
mCallback.onReCalculatePath( config );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/30
|
||||
* <p>
|
||||
* 语音控制地图
|
||||
*/
|
||||
class MapControlCommandHandler {
|
||||
|
||||
private static final String TAG = "CustomVoiceCommandHandler";
|
||||
|
||||
private OnMapControlCallback mCallback;
|
||||
|
||||
public void setCallback( OnMapControlCallback mCallback ) {
|
||||
this.mCallback = mCallback;
|
||||
}
|
||||
|
||||
public void handleVoiceCommand( String cmd ) {
|
||||
Logger.d( TAG, cmd );
|
||||
switch ( cmd ) {
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE:
|
||||
mCallback.onTrafficModeChanged( true );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE:
|
||||
mCallback.onTrafficModeChanged( false );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN:
|
||||
mCallback.onZoomMap( true );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_ZOOM_OUT:
|
||||
mCallback.onZoomMap( false );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_2D_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_2D:
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE:
|
||||
mCallback.onCameraModeChanged( EnumMapUI.NorthUP_2D );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_3D_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_3D:
|
||||
mCallback.onCameraModeChanged( EnumMapUI.CarUp_3D );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE:
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_Light );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_HISTORY:
|
||||
mCallback.onOpenNavi();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE:
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE:
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_Night );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE:
|
||||
mCallback.onDayNightModeChanged( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE:
|
||||
mCallback.onDisplayOverview();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE:
|
||||
mCallback.onContinueNavi();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE:
|
||||
mCallback.onCameraModeChanged( EnumMapUI.CarUp_2D );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE:
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP:
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE:
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP:
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_REMAIN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,9 +39,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
//mMogoMapView = findViewById( R.id.module_map_id_map );
|
||||
//mMogoMap = mMogoMapView.getMap();
|
||||
//mMogoMap.getUIController().showMyLocation( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,9 +60,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
//if ( mMogoMapView != null ) {
|
||||
// mMogoMapView.onCreate( savedInstanceState );
|
||||
//}
|
||||
initMapView();
|
||||
}
|
||||
|
||||
@@ -125,7 +119,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
uiSettings.setZoomControlsEnabled( false );
|
||||
//设置双指缩放手势是否可用。
|
||||
uiSettings.setZoomGesturesEnabled( true );
|
||||
mMogoMap.getUIController().changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
mMogoMap.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Rect;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.UiThread;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
@@ -34,7 +30,6 @@ import com.mogo.service.launcher.IMogoLauncher;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
import com.mogo.utils.AppUtils;
|
||||
@@ -54,10 +49,10 @@ import java.util.Map;
|
||||
public class MapPresenter extends Presenter< MapView > implements
|
||||
IMogoIntentListener,
|
||||
IMogoVoiceCmdCallBack,
|
||||
IMogoNaviListener2 {
|
||||
IMogoNaviListener2,
|
||||
OnMapControlCallback {
|
||||
|
||||
private static final String TAG = "MapPresenter";
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
private IMogoMapService mMogoMapService;
|
||||
private IMogoIntentManager mMogoIntentManager;
|
||||
private IMogoSearchManager mSearchManager;
|
||||
@@ -66,7 +61,6 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
private IMogoRegisterCenter mRegisterCenter;
|
||||
private IMogoLauncher mLauncher;
|
||||
private IMogoSearchManager mMogoSearchManager;
|
||||
private IMogoSettingManager mSettingManager;
|
||||
private Rect mDisplayOverviewBounds;
|
||||
|
||||
|
||||
@@ -80,210 +74,33 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
mView.getUIController().recoverLockMode();
|
||||
}
|
||||
};
|
||||
private AutoNaviBroadcastIntentHandler mAutoNaviReceiver;
|
||||
private MapControlCommandHandler mCustomVoiceCommandHandler;
|
||||
|
||||
public MapPresenter( MapView view ) {
|
||||
super( view );
|
||||
initBroadcast();
|
||||
}
|
||||
|
||||
private BroadcastReceiver broadcastReceiver;
|
||||
|
||||
/**
|
||||
* opera type为0:0 实时路况开;1实时路况关 type为1:0 放大地图; 1缩小地图 type为2:0切换2d车上; 1切换2d北上;2切换3d车上支持
|
||||
*/
|
||||
private void initBroadcast() {
|
||||
// 高德地图免唤醒
|
||||
broadcastReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
String action = intent.getAction();
|
||||
Logger.d( TAG, "action = %s", action );
|
||||
|
||||
if ( !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_RECV ) ) {
|
||||
return;
|
||||
}
|
||||
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
Logger.d( TAG, "key_type" + key_type );
|
||||
if ( key_type == 10027 ) {
|
||||
if ( type == 0 ) {
|
||||
onChangeTrafficMode( opera_type );
|
||||
} else if ( type == 1 ) {
|
||||
zoomMap( opera_type == 0 );
|
||||
} else if ( type == 2 ) {
|
||||
onChangeCameraMode( opera_type );
|
||||
}
|
||||
} else if ( key_type == 10048 ) {
|
||||
//0:自动; 1:白天; 2:黑夜;
|
||||
int day_night_mode = intent.getIntExtra( "EXTRA_DAY_NIGHT_MODE", -1 );
|
||||
onChangeDayNightMode( day_night_mode );
|
||||
//继续导航
|
||||
} else if ( key_type == 10049 ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
boolean extra_endurance_data = intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false );
|
||||
if ( extra_endurance_data ) {
|
||||
onContinueNavigation();
|
||||
}
|
||||
} else if ( key_type == 10006 ) {
|
||||
// 避免冲突,会同时发送两个广播,这里不操作。
|
||||
//int extra_is_show = intent.getIntExtra( "EXTRA_IS_SHOW", 0 );
|
||||
//if ( extra_is_show == 0 ) {
|
||||
// onDisplayOverview();
|
||||
//} else {
|
||||
// onContinueNavigation();
|
||||
//}
|
||||
} else if ( key_type == 10005 ) {
|
||||
int navi_route_prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", type );
|
||||
} else if ( key_type == 20009 ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
onOpenNavi();
|
||||
} else if ( key_type == 10038 || key_type == 10007 ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
onChoosePath( intent, key_type );
|
||||
} else if ( key_type == 10021 ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
// 导航过程中语音指令退出导航,会出现 activity 不走 onResume 的情况
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
if ( isForeground( getContext() ) && !hasOthersActivity() && !mStatusManager.isMainPageOnResume() ) {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
}
|
||||
}, 500L );
|
||||
mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent );
|
||||
return;
|
||||
}
|
||||
onStopNaviInternal();
|
||||
} else if ( key_type == 10005 ) {
|
||||
// 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
// 避免收费 | 1
|
||||
// 多策略算路 | 2
|
||||
// 不走高速 | 3
|
||||
// 躲避拥堵 | 4
|
||||
// 不走高速且避免收费 | 5
|
||||
// 不走高速且躲避拥堵 | 6
|
||||
// 躲避收费和拥堵 | 7
|
||||
// 不走高速躲避收费和拥堵 | 8
|
||||
// 高速优先 | 20
|
||||
// 躲避拥堵且高速优先 | 24
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
int prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", 0 );
|
||||
MogoNaviConfig config = new MogoNaviConfig().congestion( prefer == 4 )
|
||||
.cost( prefer == 1 || prefer == 7 )
|
||||
.highSpeed( prefer == 20 )
|
||||
.avoidSpeed( prefer == 3 );
|
||||
mMogoMapService.getNavi( getContext() ).reCalculateRoute( config );
|
||||
|
||||
}
|
||||
mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent );
|
||||
}
|
||||
};
|
||||
|
||||
IntentFilter inputFilter = new IntentFilter();
|
||||
inputFilter.addAction( AUTONAVI_STANDARD_BROADCAST_RECV );
|
||||
getContext().registerReceiver( broadcastReceiver, inputFilter );
|
||||
@Override
|
||||
public void onTrafficModeChanged( boolean open ) {
|
||||
mView.getUIController().setTrafficEnabled( open );
|
||||
}
|
||||
|
||||
private boolean isForeground( Context context ) {
|
||||
if ( context != null ) {
|
||||
ActivityManager activityManager = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningAppProcessInfo > processes = activityManager.getRunningAppProcesses();
|
||||
for ( ActivityManager.RunningAppProcessInfo processInfo : processes ) {
|
||||
if ( processInfo.processName.equals( context.getPackageName() ) ) {
|
||||
if ( processInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onCameraModeChanged( EnumMapUI mode ) {
|
||||
mView.getUIController().changeMapMode( mode );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDayNightModeChanged( EnumMapUI mode ) {
|
||||
mView.getUIController().changeMapMode( mode );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContinueNavi() {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasOthersActivity() {
|
||||
ActivityManager am = ( ActivityManager ) getContext().getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningTaskInfo > list = am.getRunningTasks( 1 );
|
||||
if ( list != null && !list.isEmpty() ) {
|
||||
for ( ActivityManager.RunningTaskInfo runningTaskInfo : list ) {
|
||||
if ( TextUtils.equals( runningTaskInfo.topActivity.getPackageName(), getContext().getPackageName() ) ) {
|
||||
return runningTaskInfo.numActivities > 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换交通态势模式
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
private void onChangeTrafficMode( int mode ) {
|
||||
mView.getUIController().setTrafficEnabled( mode == 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换地图视图朝向模式
|
||||
*/
|
||||
private void onChangeCameraMode( int mode ) {
|
||||
if ( mode == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else if ( mode == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
} else if ( mode == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换白天黑夜模式
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
private void onChangeDayNightMode( int mode ) {
|
||||
if ( mode == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
} else if ( mode == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
} else if ( mode == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
|
||||
}
|
||||
}
|
||||
|
||||
private void onStopNaviInternal() {
|
||||
mMogoMapService.getNavi( getContext() ).stopNavi();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 唤醒指令导航去哪里
|
||||
*/
|
||||
private void onChoosePath( Intent intent, int type ) {
|
||||
double lat;
|
||||
double lon;
|
||||
|
||||
if ( type == 10007 ) {
|
||||
lat = intent.getDoubleExtra( "ENTRY_LAT", 0.0 );
|
||||
lon = intent.getDoubleExtra( "ENTRY_LON", 0.0 );
|
||||
} else {
|
||||
lat = intent.getDoubleExtra( "LAT", 0.0 );
|
||||
lon = intent.getDoubleExtra( "LON", 0.0 );
|
||||
}
|
||||
mMogoSearchManager.calculatePath( new MogoLatLng( lat, lon ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 继续导航
|
||||
*/
|
||||
private void onContinueNavigation() {
|
||||
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
mView.getUIController().recoverLockMode();
|
||||
@@ -304,7 +121,64 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
}
|
||||
}
|
||||
|
||||
private void onDisplayOverview() {
|
||||
@Override
|
||||
public void onOpenNavi() {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
if ( !mMogoMapService.getNavi( getContext() ).isNaviing() && !mStatusManager.isSearchUIShow() ) {
|
||||
mSearchManager.showSearch();
|
||||
}
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已打开" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculatePath( double lon, double lat ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
mMogoSearchManager.calculatePath( new MogoLatLng( lat, lon ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNaviInternal( Intent intent ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
// 导航过程中语音指令退出导航,会出现 activity 不走 onResume 的情况
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
if ( AppUtils.isAppForeground( getContext() ) && !hasOthersActivity() && !mStatusManager.isMainPageOnResume() ) {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
}
|
||||
}, 500L );
|
||||
return;
|
||||
}
|
||||
mMogoMapService.getNavi( getContext() ).stopNavi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReCalculatePath( MogoNaviConfig config ) {
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
return;
|
||||
}
|
||||
mMogoMapService.getNavi( getContext() ).reCalculateRoute( config );
|
||||
}
|
||||
|
||||
private boolean hasOthersActivity() {
|
||||
ActivityManager am = ( ActivityManager ) getContext().getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningTaskInfo > list = am.getRunningTasks( 1 );
|
||||
if ( list != null && !list.isEmpty() ) {
|
||||
for ( ActivityManager.RunningTaskInfo runningTaskInfo : list ) {
|
||||
if ( TextUtils.equals( runningTaskInfo.topActivity.getPackageName(), getContext().getPackageName() ) ) {
|
||||
return runningTaskInfo.numActivities > 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisplayOverview() {
|
||||
if ( !mMogoMapService.getNavi( getContext() ).isNaviing() ) {
|
||||
Logger.d( TAG, "未开始导航." );
|
||||
return;
|
||||
@@ -331,7 +205,8 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
UiThreadHandler.postDelayed( mLockCarRunnable, 20_000 );
|
||||
}
|
||||
|
||||
private void zoomMap( boolean zoomIn ) {
|
||||
@Override
|
||||
public void onZoomMap( boolean zoomIn ) {
|
||||
boolean isLocked = mMogoMapService.getMapUIController().isCarLocked();
|
||||
MapControlResult result = mView.getUIController().changeZoom( zoomIn );
|
||||
if ( !CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
@@ -358,14 +233,6 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
}
|
||||
}
|
||||
|
||||
private void onOpenNavi() {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
if ( !mMogoMapService.getNavi( getContext() ).isNaviing() && !mStatusManager.isSearchUIShow() ) {
|
||||
mSearchManager.showSearch();
|
||||
}
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已打开" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
@@ -380,7 +247,6 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
mRegisterCenter.registerMogoNaviListener( TAG, this );
|
||||
mLauncher = apis.getLauncherApi();
|
||||
mMogoSearchManager = apis.getSearchManagerApi();
|
||||
mSettingManager = apis.getSettingManagerApi();
|
||||
|
||||
IMogoNavi mogoNavi = mMogoMapService.getNavi( getContext() );
|
||||
mogoNavi.setCalculatePathDisplayBounds( new Rect(
|
||||
@@ -400,6 +266,16 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
for ( String cmd : VoiceConstants.sUnUnRegisterCmds ) {
|
||||
mMogoIntentManager.registerIntentListener( cmd, this );
|
||||
}
|
||||
|
||||
initBroadcast();
|
||||
mCustomVoiceCommandHandler = new MapControlCommandHandler();
|
||||
mCustomVoiceCommandHandler.setCallback( this );
|
||||
}
|
||||
|
||||
private void initBroadcast() {
|
||||
mAutoNaviReceiver = new AutoNaviBroadcastIntentHandler();
|
||||
mAutoNaviReceiver.setCallback( this );
|
||||
mAutoNaviReceiver.register( mMogoIntentManager );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -411,15 +287,14 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
@Override
|
||||
public void onPause( @NonNull LifecycleOwner owner ) {
|
||||
super.onPause( owner );
|
||||
|
||||
unregisterVoiceCmd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
if ( broadcastReceiver != null ) {
|
||||
getContext().unregisterReceiver( broadcastReceiver );
|
||||
if ( mAutoNaviReceiver != null ) {
|
||||
mAutoNaviReceiver.unregister( mMogoIntentManager );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,82 +331,7 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
Logger.d( TAG, cmd );
|
||||
switch ( cmd ) {
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_TRAFFIC_MODE:
|
||||
mView.getUIController().setTrafficEnabled( true );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE:
|
||||
mView.getUIController().setTrafficEnabled( false );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_ZOOM_IN:
|
||||
zoomMap( true );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_ZOOM_OUT:
|
||||
zoomMap( false );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_2D_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_2D:
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_NORTH_UP_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_3D_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_3D:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_DAY_TIME_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_HISTORY:
|
||||
onOpenNavi();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_STOP_NAVI_MODE:
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_NIGHT_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE:
|
||||
onDisplayOverview();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE:
|
||||
onContinueNavigation();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE:
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE:
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP:
|
||||
mSettingManager.speakDraft();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE:
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP:
|
||||
mSettingManager.speakDetail();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_REMAIN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mCustomVoiceCommandHandler.handleVoiceCommand( cmd );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
|
||||
public interface OnMapControlCallback {
|
||||
|
||||
// 交通态势
|
||||
void onTrafficModeChanged( boolean open );
|
||||
|
||||
// 2d、3d模式切换、正北、车头
|
||||
void onCameraModeChanged( EnumMapUI mode);
|
||||
|
||||
// 白天、黑夜模式切换
|
||||
void onDayNightModeChanged( EnumMapUI mode );
|
||||
|
||||
// 继续导航
|
||||
void onContinueNavi();
|
||||
|
||||
// 打开导航
|
||||
void onOpenNavi();
|
||||
|
||||
// 开始路径规划
|
||||
void onCalculatePath( double lon, double lat );
|
||||
|
||||
// 调用停止导航方法
|
||||
void onStopNaviInternal( Intent intent );
|
||||
|
||||
// 重新规划路线
|
||||
void onReCalculatePath( MogoNaviConfig config );
|
||||
|
||||
// 查看全程
|
||||
void onDisplayOverview();
|
||||
|
||||
// 缩放地图
|
||||
void onZoomMap( boolean zoomIn );
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class VoiceConstants {
|
||||
*/
|
||||
public static final String CMD_MAP_NORTH_UP_MODE = "com.ileja.traffic.north.up";
|
||||
public static final String CMD_MAP_NORTH_UP_MODE_UN_WAKEUP = "CMD_MAP_NORTH_UP_MODE_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS = {"北朝上"};
|
||||
public static final String[] CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS = {"正北朝上","北朝上"};
|
||||
/**
|
||||
* 简洁模式
|
||||
*/
|
||||
@@ -164,19 +164,19 @@ public class VoiceConstants {
|
||||
|
||||
static {
|
||||
// 免唤醒
|
||||
// sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_TRIGGER_WORDS );
|
||||
// sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_OUT_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_OUT_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_2D_UN_WAKEUP, VoiceConstants.CMD_MAP_2D_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_3D_UN_WAKEUP, VoiceConstants.CMD_MAP_3D_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_DAY_TIME_MODE_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NIGHT_MODE_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_TRAFFIC_MODE_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_DAY_TIME_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NIGHT_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_TRAFFIC_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_TRAFFIC_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_UN_TRAFFIC_MODE_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_DISPLAY_OVERVIEW_MODE_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE_MODE_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_CAR_UP_MODE_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_CAR_UP_MODE_TRIGGER_WORDS );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_NORTH_UP_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NORTH_UP_MODE_TRIGGER_WORDS );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_GO_HOME_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_GO_HOME );
|
||||
//sVoiceCmds.put( VoiceConstants.CMD_MAP_GO_COMPANY_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_GO_COMPANY );
|
||||
sVoiceCmds.put( VoiceConstants.CMD_MAP_HISTORY_UN_WAKEUP, VoiceConstants.CMD_MAP_HISTORY_TRIGGER_WORDS );
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user