opt
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package com.mogo.commons.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.Scroller;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/19
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class ViewPagerSpeedScroller extends Scroller {
|
||||
|
||||
private int mFixedDuration = 1500;
|
||||
|
||||
public ViewPagerSpeedScroller( Context context ) {
|
||||
super( context );
|
||||
}
|
||||
|
||||
public ViewPagerSpeedScroller( Context context, Interpolator interpolator ) {
|
||||
super( context, interpolator );
|
||||
}
|
||||
|
||||
public ViewPagerSpeedScroller( Context context, Interpolator interpolator, boolean flywheel ) {
|
||||
super( context, interpolator, flywheel );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScroll( int startX, int startY, int dx, int dy ) {
|
||||
startScroll( startX, startY, dx, dy, mFixedDuration );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScroll( int startX, int startY, int dx, int dy, int duration ) {
|
||||
super.startScroll( startX, startY, dx, dy, mFixedDuration );
|
||||
}
|
||||
|
||||
public void setFixedDuration( int duration ) {
|
||||
this.mFixedDuration = duration;
|
||||
}
|
||||
|
||||
public static void attach( Context context, Object pager, int duration ) {
|
||||
try {
|
||||
Field filed = pager.getClass().getDeclaredField( "mScroller" );
|
||||
filed.setAccessible( true );
|
||||
ViewPagerSpeedScroller scroller = new ViewPagerSpeedScroller( context, new DecelerateInterpolator() );
|
||||
scroller.setFixedDuration( duration );
|
||||
filed.set( pager, scroller );
|
||||
|
||||
Field field = pager.getClass().getDeclaredField( "mTouchSlop" );
|
||||
field.setAccessible( true );
|
||||
field.setInt( pager, 4 );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,14 @@ public class SharedPrefsMgr {
|
||||
}
|
||||
}
|
||||
|
||||
public String getString( String tag, String defVal ) {
|
||||
try {
|
||||
return sSharedPrefs.getString( tag, defVal );
|
||||
} catch ( Exception e ) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getBoolean( String key, boolean defaultValue ) {
|
||||
try {
|
||||
return sSharedPrefs.getBoolean( key, defaultValue );
|
||||
|
||||
@@ -92,11 +92,13 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
|
||||
private BnHooker bnHooker;
|
||||
|
||||
public AMapNaviViewWrapper( AMapNaviView mapView ) {
|
||||
this.mMapView = mapView;
|
||||
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView.getContext(), this );
|
||||
try {
|
||||
new BnHooker( mMapView.getMap(), mapView.getContext() );
|
||||
bnHooker = new BnHooker( mMapView.getMap(), mapView.getContext() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -279,6 +281,12 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
if ( motionEvent.getAction() == MotionEvent.ACTION_DOWN ) {
|
||||
changeMyLocationType2UnFollow();
|
||||
}
|
||||
|
||||
try {
|
||||
bnHooker.print();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -580,6 +588,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
if ( !checkAMapView() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
switch ( mCurrentUIMode ) {
|
||||
case NorthUP_2D:
|
||||
@@ -650,8 +659,8 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
Logger.d( TAG, "解锁锁车" );
|
||||
mockTouchEvent();
|
||||
mIsCarLocked = false;
|
||||
mockTouchEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -674,7 +683,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
Logger.d( TAG, "Zoom锁定锁车比例尺 %s", var1 );
|
||||
mMapView.setLockZoom( var1 );
|
||||
// mMapView.setLockZoom( var1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.autonavi.amap.mapcore.interfaces.IAMap;
|
||||
import com.autonavi.base.ae.gmap.GLMapEngine;
|
||||
import com.autonavi.base.amap.api.mapcore.IAMapDelegate;
|
||||
import com.autonavi.base.amap.mapcore.interfaces.IAMapListener;
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
@@ -13,6 +14,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -48,6 +50,19 @@ public class BnHooker implements InvocationHandler {
|
||||
this
|
||||
);
|
||||
field.set( map, object );
|
||||
|
||||
}
|
||||
|
||||
public void print() throws Exception {
|
||||
Method method = host.getClass().getDeclaredMethod( "getGLMapEngine" );
|
||||
method.setAccessible( true );
|
||||
GLMapEngine glMapEngine = ( GLMapEngine ) method.invoke( host );
|
||||
glMapEngine.clearAllMessages( 0 );
|
||||
|
||||
Field stateMessageListField = glMapEngine.getClass().getDeclaredField( "mStateMessageList" );
|
||||
stateMessageListField.setAccessible( true );
|
||||
List valList = ( List ) stateMessageListField.get( glMapEngine );
|
||||
valList.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
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.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.utils.FileUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -22,34 +21,28 @@ import java.util.List;
|
||||
* <p>
|
||||
* 过滤 app
|
||||
*/
|
||||
public class AppFilterImpl implements AppFilter {
|
||||
public class AppFilterImpl {
|
||||
|
||||
private final Context mContext;
|
||||
private List< String > mFilterPackages;
|
||||
private static List< String > mFilterPackages;
|
||||
|
||||
private static String sExternalPath = "/system/etc/packagesFilterList.txt";
|
||||
private static List< String > sExternalConfigPackages = new ArrayList<>();
|
||||
|
||||
public AppFilterImpl( Context context ) {
|
||||
mContext = context;
|
||||
static {
|
||||
if ( CarSeries.getSeries() != CarSeries.CAR_SERIES_F80X ) {
|
||||
final String[] values = context.getResources().getStringArray( R.array.module_apps_array_filter_packages );
|
||||
final String[] values = AbsMogoApplication.getApp().getResources().getStringArray( R.array.module_apps_array_filter_packages );
|
||||
if ( values != null ) {
|
||||
mFilterPackages = new ArrayList( Arrays.asList( values ) );
|
||||
}
|
||||
} else {
|
||||
final String[] values = context.getResources().getStringArray( R.array.module_apps_array_filter_packages_f );
|
||||
final String[] values = AbsMogoApplication.getApp().getResources().getStringArray( R.array.module_apps_array_filter_packages_f );
|
||||
if ( values != null ) {
|
||||
mFilterPackages = new ArrayList( Arrays.asList( values ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean filter( PackageInfo packageInfo ) {
|
||||
// if ( isSystemApp( packageInfo ) ) {
|
||||
// return true;
|
||||
// }
|
||||
public static boolean sFilter( PackageInfo packageInfo ) {
|
||||
if ( isInExternalFilter( packageInfo ) ) {
|
||||
return true;
|
||||
}
|
||||
@@ -62,19 +55,19 @@ public class AppFilterImpl implements AppFilter {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isSystemApp( PackageInfo packageInfo ) {
|
||||
private static boolean isSystemApp( PackageInfo packageInfo ) {
|
||||
return ( packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM ) != 0;
|
||||
}
|
||||
|
||||
private boolean isFilterPackages( PackageInfo packageInfo ) {
|
||||
private static boolean isFilterPackages( PackageInfo packageInfo ) {
|
||||
return mFilterPackages.contains( packageInfo.packageName );
|
||||
}
|
||||
|
||||
private boolean noLaunchIntent( PackageInfo packageInfo ) {
|
||||
return mContext.getPackageManager().getLaunchIntentForPackage( packageInfo.packageName ) == null;
|
||||
private static boolean noLaunchIntent( PackageInfo packageInfo ) {
|
||||
return AbsMogoApplication.getApp().getPackageManager().getLaunchIntentForPackage( packageInfo.packageName ) == null;
|
||||
}
|
||||
|
||||
private boolean isInExternalFilter( PackageInfo packageInfo ) {
|
||||
private static boolean isInExternalFilter( PackageInfo packageInfo ) {
|
||||
return sExternalConfigPackages.contains( packageInfo.packageName );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,17 @@ package com.mogo.module.apps;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.utils.ViewPagerSpeedScroller;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.view.GridViewPagerScroller;
|
||||
import com.mogo.module.apps.view.PagerSlidingTabStripV2;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -36,8 +34,6 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
|
||||
private View mLoadingView;
|
||||
private PagerSlidingTabStripV2 mIndicator;
|
||||
|
||||
private GridViewPagerScroller mScroller;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_apps_fragment_apps;
|
||||
@@ -58,19 +54,7 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
|
||||
mIndicator = findViewById( R.id.module_apps_id_indicator );
|
||||
mIndicator.setOpenPadding( true );
|
||||
|
||||
try {
|
||||
Field mField = ViewPager.class.getDeclaredField("mScroller");
|
||||
mField.setAccessible(true);
|
||||
mScroller = new GridViewPagerScroller(getContext(), new DecelerateInterpolator());
|
||||
mField.set(mAppsPager, mScroller);
|
||||
mScroller.setDuration(160);
|
||||
|
||||
Field field = ViewPager.class.getDeclaredField("mTouchSlop");
|
||||
field.setAccessible(true);
|
||||
field.setInt(mAppsPager, 4);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ViewPagerSpeedScroller.attach(getContext(), mAppsPager, 1000);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -109,34 +93,6 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Animation onCreateAnimation( int transit, boolean enter, int nextAnim ) {
|
||||
// TranslateAnimation animation = null;
|
||||
// if ( transit == FragmentTransaction.TRANSIT_FRAGMENT_OPEN ) {
|
||||
// if ( enter ) {
|
||||
// animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0,
|
||||
// Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0 );
|
||||
// } else {
|
||||
// animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -1,
|
||||
// Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0 );
|
||||
// }
|
||||
// } else if ( FragmentTransaction.TRANSIT_FRAGMENT_CLOSE == transit ) {
|
||||
// if ( enter ) {
|
||||
// animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, -1, Animation.RELATIVE_TO_SELF, 0,
|
||||
// Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0 );
|
||||
// } else {
|
||||
// animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1,
|
||||
// Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0 );
|
||||
// }
|
||||
// }
|
||||
// if ( animation == null ) {
|
||||
// animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0,
|
||||
// Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1 );
|
||||
// }
|
||||
// animation.setDuration( 300 );
|
||||
// return animation;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.apps.AppFilter;
|
||||
import com.mogo.module.apps.AppFilterImpl;
|
||||
import com.mogo.module.apps.AppsConst;
|
||||
import com.mogo.module.apps.AppsListChangedLiveData;
|
||||
@@ -31,8 +30,6 @@ public class AppsModel {
|
||||
private static volatile AppsModel sInstance;
|
||||
private Context mContext;
|
||||
|
||||
private AppFilter mAppFilter;
|
||||
|
||||
private Map< Integer, List< AppInfo > > mPagedApps = new HashMap<>();
|
||||
|
||||
private AppsModel( Context context ) {
|
||||
@@ -58,7 +55,6 @@ public class AppsModel {
|
||||
mPagedApps.clear();
|
||||
}
|
||||
mContext = null;
|
||||
mAppFilter = null;
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@@ -69,9 +65,6 @@ public class AppsModel {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( mAppFilter == null ) {
|
||||
mAppFilter = new AppFilterImpl( mContext );
|
||||
}
|
||||
try {
|
||||
AppFilterImpl.loadExternalFilterPackagesList();
|
||||
} catch ( Exception e ) {
|
||||
@@ -83,7 +76,7 @@ public class AppsModel {
|
||||
int counter = 0;
|
||||
for ( int i = 0; i < packages.size(); ++i ) {
|
||||
PackageInfo packageInfo = packages.get( i );
|
||||
if ( mAppFilter.filter( packageInfo ) ) {
|
||||
if ( AppFilterImpl.sFilter( packageInfo ) ) {
|
||||
continue;
|
||||
}
|
||||
int page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE;
|
||||
@@ -118,13 +111,10 @@ public class AppsModel {
|
||||
if ( mPagedApps == null || mPagedApps.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
if ( mAppFilter == null ) {
|
||||
mAppFilter = new AppFilterImpl( mContext );
|
||||
}
|
||||
try {
|
||||
final PackageManager packageManager = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo( packageName, 0 );
|
||||
if ( !mAppFilter.filter( packageInfo ) ) {
|
||||
if ( !AppFilterImpl.sFilter( packageInfo ) ) {
|
||||
String appName = getApplicationName( packageManager, packageInfo );
|
||||
String versionName = packageInfo.versionName;
|
||||
int versionCode = packageInfo.versionCode;
|
||||
@@ -157,7 +147,7 @@ public class AppsModel {
|
||||
return 0;
|
||||
} else {
|
||||
if ( mPagedApps.get( totalPages - 1 ) == null
|
||||
|| mPagedApps.get( totalPages - 1 ).size() == AppsConst.TOTAL_SIZE_EACH_PAGE ) {
|
||||
|| mPagedApps.get( totalPages - 1 ).size() == AppsConst.TOTAL_SIZE_EACH_PAGE ) {
|
||||
return totalPages;
|
||||
} else {
|
||||
return totalPages - 1;
|
||||
|
||||
@@ -7,35 +7,19 @@ import android.view.WindowManager;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
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.logger.Logger;
|
||||
|
||||
public class BackToMainHomeManager {
|
||||
|
||||
private static final String TAG = "BackToMainHomeManager";
|
||||
|
||||
private static IMogoFragmentManager mFragmentManager;
|
||||
private static IMogoStatusManager mStatusManager;
|
||||
private static IMogoServiceApis mApis;
|
||||
|
||||
public static void init( IMogoServiceApis apis ) {
|
||||
mApis = apis;
|
||||
mFragmentManager = apis.getFragmentManagerApi();
|
||||
mStatusManager = apis.getStatusManagerApi();
|
||||
}
|
||||
|
||||
public static void backToLauncher() {
|
||||
if ( mStatusManager == null ) {
|
||||
Logger.e( TAG, "未初始化完成" );
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
mFragmentManager.clearAll();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent2 = new Intent();
|
||||
// 是否发自系统消息
|
||||
@@ -63,21 +47,22 @@ public class BackToMainHomeManager {
|
||||
.size( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT )
|
||||
.gravity( Gravity.LEFT | Gravity.TOP )
|
||||
.showInWindowManager();
|
||||
mWindowManagerView.attachTouchEvent( (view, xPos, yPos) -> {
|
||||
mWindowManagerView.attachTouchEvent( ( view, xPos, yPos ) -> {
|
||||
backToLauncher();
|
||||
} );
|
||||
}
|
||||
try {
|
||||
}
|
||||
|
||||
public static void showFloatButton() {
|
||||
if ( mWindowManagerView != null && !mWindowManagerView.isShowing() ) {
|
||||
mWindowManagerView.show();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeMainHomeView() {
|
||||
if ( mWindowManagerView != null ) {
|
||||
|
||||
public static void hideFloatButton() {
|
||||
if ( mWindowManagerView != null && mWindowManagerView.isShowing() ) {
|
||||
mWindowManagerView.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,15 @@ public class MogoLauncher implements IMogoLauncher {
|
||||
BackToMainHomeManager.backToLauncher();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFloatButtonVisible( boolean visible ) {
|
||||
if ( visible ) {
|
||||
BackToMainHomeManager.showFloatButton();
|
||||
} else {
|
||||
BackToMainHomeManager.hideFloatButton();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
@@ -233,9 +233,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mStatusManager.setDisplayOverview(TAG, false);
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
}
|
||||
mMApUIController.changeZoom( 16 );
|
||||
// mMApUIController.recoverLockMode();
|
||||
// mApis.getRefreshStrategyControllerApi().restartAutoRefreshAtTime( 0 );
|
||||
mApis.getRefreshStrategyControllerApi().restartAutoRefreshAtTime( 0 );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
@@ -282,6 +282,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
if ( mCoverUpLayout.getVisibility() != View.VISIBLE ) {
|
||||
mServiceApis.getAdasControllerApi().showADAS();
|
||||
}
|
||||
mServiceApis.getLauncherApi().setFloatButtonVisible( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -293,6 +294,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
if ( shouldCloseADASPanelWhenPause() ) {
|
||||
mServiceApis.getAdasControllerApi().closeADAS();
|
||||
}
|
||||
mServiceApis.getLauncherApi().setFloatButtonVisible( true );
|
||||
}
|
||||
|
||||
protected boolean shouldCloseADASPanelWhenPause() {
|
||||
|
||||
@@ -224,7 +224,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false );
|
||||
mUiController.changeZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL );
|
||||
mUiController.setLockZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL );
|
||||
// mUiController.setLockZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL );
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mUiController.recoverLockMode();
|
||||
notifyRefreshData( mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback );
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.module.service.launchercard;
|
||||
public class LauncherCardRefreshStrategy {
|
||||
|
||||
private long interval; // 间隔时间
|
||||
private static LauncherCardRefreshType type = LauncherCardRefreshType.OnlineCar;
|
||||
private LauncherCardRefreshType type = LauncherCardRefreshType.OnlineCar;
|
||||
|
||||
private LauncherCardRefreshStrategy next;
|
||||
|
||||
@@ -15,6 +15,10 @@ public class LauncherCardRefreshStrategy {
|
||||
this.msgType = msgType;
|
||||
}
|
||||
|
||||
public void setType( LauncherCardRefreshType type ) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return msgType;
|
||||
}
|
||||
@@ -24,6 +28,10 @@ public class LauncherCardRefreshStrategy {
|
||||
}
|
||||
|
||||
public LauncherCardRefreshType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public LauncherCardRefreshType getNextType() {
|
||||
if ( type == LauncherCardRefreshType.ExploreWay ) {
|
||||
type = LauncherCardRefreshType.OnlineCar;
|
||||
} else {
|
||||
@@ -33,7 +41,7 @@ public class LauncherCardRefreshStrategy {
|
||||
}
|
||||
|
||||
public void next(){
|
||||
getType();
|
||||
getNextType();
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
|
||||
@@ -49,6 +49,10 @@ class LauncherCardRefresher {
|
||||
public static final String KEY_LauncherCardTipCounter = "LauncherCardTipCounter";
|
||||
public static final String KEY_LauncherCardTipLastTipTime = "LauncherCardTipLastTipTime";
|
||||
|
||||
public static final String KEY_LauncherCardExplorerWayAndOnlineCarTipCounter = "LauncherCardExplorerWayAndOnlineCarTipCounter";
|
||||
public static final String KEY_LauncherCardExplorerWayAndOnlineCarTipLastTipTime = "LauncherCardExplorerWayAndOnlineCarTipLastTipTime";
|
||||
public static final String KEY_LauncherCardExplorerWayAndOnlineCarTipLastTipType = "LauncherCardExplorerWayAndOnlineCarTipLastTipType";
|
||||
|
||||
|
||||
private static volatile LauncherCardRefresher sInstance;
|
||||
|
||||
@@ -159,10 +163,10 @@ class LauncherCardRefresher {
|
||||
40 * ONE_MINUTE, null, MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA
|
||||
);
|
||||
private LauncherCardRefreshStrategy mInduceStrategy = new LauncherCardRefreshStrategy(
|
||||
3 * ONE_MINUTE, mExplorerWayOrOnlineCarDataStrategy, MSG_INDUCE
|
||||
18 * ONE_MINUTE, mExplorerWayOrOnlineCarDataStrategy, MSG_INDUCE
|
||||
);
|
||||
private LauncherCardRefreshStrategy mLauncherCardConfigStrategy = new LauncherCardRefreshStrategy(
|
||||
2 * ONE_MINUTE, mInduceStrategy, MSG_REFRESH_DEFAULT_CARD
|
||||
2 * ONE_MINUTE, mExplorerWayOrOnlineCarDataStrategy, MSG_REFRESH_DEFAULT_CARD
|
||||
);
|
||||
private LauncherCardRefreshStrategy mRefreshStrategy = mLauncherCardConfigStrategy;
|
||||
|
||||
@@ -239,15 +243,36 @@ class LauncherCardRefresher {
|
||||
}
|
||||
|
||||
private void handleRefreshExplorerWayOrOnlineCarMsg() {
|
||||
|
||||
int counter = SharedPrefsMgr.getInstance( mContext ).getInt( KEY_LauncherCardExplorerWayAndOnlineCarTipCounter, 0 );
|
||||
if ( counter >= 1 ) {
|
||||
long lastTipTime = SharedPrefsMgr.getInstance( mContext ).getLong( KEY_LauncherCardExplorerWayAndOnlineCarTipLastTipTime, 0L );
|
||||
if ( System.currentTimeMillis() - lastTipTime < 3 * ONE_DAY ) {
|
||||
return;
|
||||
} else {
|
||||
SharedPrefsMgr.getInstance( mContext ).putInt( KEY_LauncherCardExplorerWayAndOnlineCarTipCounter, 0 );
|
||||
counter = 0;
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LauncherCardExplorerWayAndOnlineCarTipLastTipTime, 0L );
|
||||
}
|
||||
}
|
||||
SharedPrefsMgr.getInstance( mContext ).putInt( KEY_LauncherCardExplorerWayAndOnlineCarTipCounter, ++counter );
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LauncherCardExplorerWayAndOnlineCarTipLastTipTime, System.currentTimeMillis() );
|
||||
|
||||
MogoLocation location = MarkerServiceHandler.getMogoLocationClient().getLastKnowLocation();
|
||||
if ( location == null ) {
|
||||
restart();
|
||||
return;
|
||||
}
|
||||
mMsgExplorerWayOrOnlineCarDataCounter++;
|
||||
if ( mMsgExplorerWayOrOnlineCarDataCounter > 2 ) {
|
||||
if ( mMsgExplorerWayOrOnlineCarDataCounter > 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
String type = SharedPrefsMgr.getInstance( mContext ).getString( KEY_LauncherCardExplorerWayAndOnlineCarTipLastTipType, LauncherCardRefreshType.ExploreWay.name() );
|
||||
LauncherCardRefreshType strategy = LauncherCardRefreshType.valueOf( type );
|
||||
mRefreshStrategy.setType( strategy );
|
||||
SharedPrefsMgr.getInstance( mContext ).putString( KEY_LauncherCardExplorerWayAndOnlineCarTipLastTipType, mRefreshStrategy.getNextType().name() );
|
||||
|
||||
MogoLatLng latLng = new MogoLatLng( location.getLatitude(), location.getLongitude() );
|
||||
handleRefreshExplorerWayOrOnlineCarData( latLng, mRefreshStrategy.getType() );
|
||||
}
|
||||
@@ -369,14 +394,14 @@ class LauncherCardRefresher {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mDefaultConfigCounter++ >= 3 ) {
|
||||
if ( mDefaultConfigCounter++ >= 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
int counter = SharedPrefsMgr.getInstance( mContext ).getInt( KEY_LauncherCardTipCounter, 0 );
|
||||
if ( counter >= 5 ) {
|
||||
long lastTipTime = SharedPrefsMgr.getInstance( mContext ).getLong( KEY_LauncherCardTipLastTipTime, 0L );
|
||||
if ( System.currentTimeMillis() - lastTipTime < 1 * ONE_DAY ) {
|
||||
if ( System.currentTimeMillis() - lastTipTime < 7 * ONE_DAY ) {
|
||||
return;
|
||||
} else {
|
||||
SharedPrefsMgr.getInstance( mContext ).putInt( KEY_LauncherCardTipCounter, 0 );
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<string name="module_service_app_entrance_text">辅助\n驾驶</string>
|
||||
<string name="module_service_launcher_card_tips">你的周围有%d个%s,请点击查看,你也可以对我说打开蘑菇出行</string>
|
||||
<string name="module_service_launcher_card_info">周围有%d个%s</string>
|
||||
<string name="module_service_open_app_tip">建议开启蘑菇出行,守护你的每一段行程,你可以直接对我说,打开蘑菇出行</string>
|
||||
<string name="module_service_open_app_tip">亲,建议您使用蘑菇出行</string>
|
||||
<string name="module_services_str_20Km_radius">扩大到20KM半径</string>
|
||||
<string name="module_services_str_40Km_radius">扩大到40KM半径</string>
|
||||
<string name="module_services_panel_item_distance_tag_text">距离导航目的地</string>
|
||||
|
||||
@@ -18,4 +18,11 @@ public interface IMogoLauncher extends IProvider {
|
||||
* @param context
|
||||
*/
|
||||
void backToLauncher( Context context );
|
||||
|
||||
/**
|
||||
* 设置可见性
|
||||
*
|
||||
* @param visible true - 可见、false - 不可见
|
||||
*/
|
||||
void setFloatButtonVisible( boolean visible );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user