opt
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user