Merge branch 'qa_1.1.3' into dev
This commit is contained in:
@@ -9,7 +9,6 @@ import com.mogo.utils.NetworkUtils
|
||||
import com.zhidao.auto.carcorder.callback.TakePhotoCallback
|
||||
import com.zhidao.auto.carcorder.callback.TakeVideoCallback
|
||||
import com.zhidao.auto.carcorder.controller.ZdCarCoderController
|
||||
import com.zhidao.roadcondition.BuildConfig
|
||||
import com.zhidao.roadcondition.constant.*
|
||||
import com.zhidao.roadcondition.event.GetImageSuccessEvent
|
||||
import com.zhidao.roadcondition.event.LatLngStickyEventBus
|
||||
@@ -297,12 +296,6 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
getStrategyType("video")
|
||||
)
|
||||
var speed = LocationUtil.getInstance().getSpeed()
|
||||
//TODO
|
||||
if (BuildConfig.DEBUG) {
|
||||
//获取视频以及缩略图成功,开始上报
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
return
|
||||
}
|
||||
|
||||
if (entity?.isCustom) {
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
|
||||
@@ -31,8 +31,8 @@ fun getInformationBody(
|
||||
isShare:Boolean,
|
||||
poiType: String,
|
||||
mainInfoId: Long,
|
||||
latitude: Double,
|
||||
longitude: Double
|
||||
longitude: Double,
|
||||
latitude: Double
|
||||
): InformationBody {
|
||||
var jsonArray = JsonArray()
|
||||
var type: Int
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.mogo.service.intent.IMogoIntentListener;
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener {
|
||||
|
||||
protected boolean mIsHomeKeyDown = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
@@ -32,6 +32,10 @@ public class LauncherCardRefreshStrategy {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void next(){
|
||||
getType();
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return type.limit;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import android.text.TextUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
@@ -19,7 +18,6 @@ import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.network.ZhidaoApiService;
|
||||
import com.mogo.module.service.network.ZhidaoRefreshModel;
|
||||
import com.mogo.module.service.network.bean.LauncherCardAdvertisementData;
|
||||
import com.mogo.utils.AppUtils;
|
||||
@@ -29,12 +27,8 @@ import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@@ -64,12 +58,20 @@ class LauncherCardRefresher {
|
||||
public static final int MSG_REFRESH_ADVERTISEMENT = 2022;
|
||||
// 开始刷新广告数据
|
||||
public static final int MSG_START_REFRESH_ADVERTISEMENT = 2023;
|
||||
// 默认播报
|
||||
public static final int MSG_START_LOOP_DEFAULT_CARD = 2024;
|
||||
public static final long ONE_MINUTE = 60 * 1000L;
|
||||
public static final long ONE_DAY = 24 * 60 * ONE_MINUTE;
|
||||
private String mLaunchTTSText;
|
||||
private long mDefaultTTSPlayInterval = 3 * ONE_MINUTE;
|
||||
private LauncherCardAdvertisementData.LauncherCardAdvertisement mDefaultLauncherCardConfig;
|
||||
private List< LauncherCardAdvertisementData.LauncherCardAdvertisement > mAdvertisements;
|
||||
|
||||
/**
|
||||
* 默认播报/后台配置播报次数限制
|
||||
*/
|
||||
private int mDefaultConfigCounter = 0;
|
||||
|
||||
private LauncherCardRefresher( Context context ) {
|
||||
mContext = context;
|
||||
mRefreshModel = new RefreshModel( mContext );
|
||||
@@ -113,9 +115,14 @@ class LauncherCardRefresher {
|
||||
break;
|
||||
case MSG_REFRESH_DEFAULT_CARD:
|
||||
renderDefaultLauncherCardConfig();
|
||||
// 开启广告
|
||||
startLoopRenderAdvertisements();
|
||||
mRefreshStrategy = mRefreshStrategy.getNext();
|
||||
restart();
|
||||
break;
|
||||
case MSG_START_LOOP_DEFAULT_CARD:
|
||||
renderDefaultLauncherCardConfig();
|
||||
break;
|
||||
case MSG_REFRESH_ADVERTISEMENT:
|
||||
int index = msg.arg1;// 当前广告索引
|
||||
loopRenderAdvertisements( index );
|
||||
@@ -137,7 +144,7 @@ class LauncherCardRefresher {
|
||||
new LauncherCardRefreshStrategy(
|
||||
3 * ONE_MINUTE,
|
||||
new LauncherCardRefreshStrategy(
|
||||
20 * ONE_MINUTE,
|
||||
5 * ONE_MINUTE,
|
||||
null,
|
||||
MSG_REFRESH ),
|
||||
MSG_REFRESH ),
|
||||
@@ -156,36 +163,24 @@ class LauncherCardRefresher {
|
||||
startExplorerWayStrategy();
|
||||
// 延时一分钟加载数据,已保证accOn之后网络恢复正常
|
||||
mHandler.sendEmptyMessageDelayed( MSG_START_REFRESH_ADVERTISEMENT, ONE_MINUTE );
|
||||
mDefaultConfigCounter = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 道路事件和车友播报
|
||||
*/
|
||||
private void startExplorerWayStrategy() {
|
||||
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 < 10 * ONE_DAY ) {
|
||||
stop();
|
||||
return;
|
||||
} else {
|
||||
SharedPrefsMgr.getInstance( mContext ).putInt( KEY_LauncherCardTipCounter, 0 );
|
||||
counter = 0;
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LauncherCardTipLastTipTime, 0L );
|
||||
}
|
||||
}
|
||||
mHandler.sendEmptyMessageDelayed( mRefreshStrategy.getMsgType(), mRefreshStrategy.getInterval() );
|
||||
mRefreshStop = false;
|
||||
mStart = true;
|
||||
|
||||
SharedPrefsMgr.getInstance( mContext ).putInt( KEY_LauncherCardTipCounter, ++counter );
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LauncherCardTipLastTipTime, System.currentTimeMillis() );
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
mRefreshStop = true;
|
||||
mStart = false;
|
||||
mHandler.removeMessages( MSG_REFRESH );
|
||||
mHandler.removeMessages( MSG_REFRESH_DEFAULT_CARD );
|
||||
mHandler.removeMessages( MSG_START_LOOP_DEFAULT_CARD );
|
||||
Logger.d( TAG, "stop" );
|
||||
}
|
||||
|
||||
@@ -205,43 +200,17 @@ class LauncherCardRefresher {
|
||||
return;
|
||||
}
|
||||
MogoLatLng latLng = new MogoLatLng( location.getLatitude(), location.getLongitude() );
|
||||
if ( mRefreshStrategy.getType() == LauncherCardRefreshType.ExploreWay ) {
|
||||
handleRefreshExplorerWayData( latLng );
|
||||
} else {
|
||||
handleRefreshOnlineCarData( latLng );
|
||||
}
|
||||
handleRefreshData( latLng, mRefreshStrategy.getType() );
|
||||
}
|
||||
|
||||
private void handleRefreshExplorerWayData( MogoLatLng latLng ) {
|
||||
private void handleRefreshData( MogoLatLng latLng, LauncherCardRefreshType type ) {
|
||||
mRefreshModel.refreshDataSync( latLng,
|
||||
mRefreshStrategy.getRadius(),
|
||||
mRefreshStrategy.getLimit(),
|
||||
new RefreshCallback< MarkerResponse >() {
|
||||
@Override
|
||||
public void onSuccess( MarkerResponse response ) {
|
||||
notifyLauncherCardExplorerWayChanged( LauncherCardRefreshType.ExploreWay, response );
|
||||
mRefreshStrategy = mRefreshStrategy.getNext();
|
||||
restart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
mRefreshStrategy = mRefreshStrategy.getNext();
|
||||
restart();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private void handleRefreshOnlineCarData( MogoLatLng latLng ) {
|
||||
mRefreshModel.queryOnLineCarWithRoute( latLng,
|
||||
false,
|
||||
true,
|
||||
mRefreshStrategy.getRadius(),
|
||||
mRefreshStrategy.getLimit(),
|
||||
new RefreshCallback< MarkerResponse >() {
|
||||
@Override
|
||||
public void onSuccess( MarkerResponse response ) {
|
||||
notifyLauncherCardExplorerWayChanged( LauncherCardRefreshType.OnlineCar, response );
|
||||
notifyRefreshChanged( type, response );
|
||||
mRefreshStrategy = mRefreshStrategy.getNext();
|
||||
restart();
|
||||
}
|
||||
@@ -255,27 +224,43 @@ class LauncherCardRefresher {
|
||||
}
|
||||
|
||||
|
||||
private boolean notifyLauncherCardExplorerWayChanged( LauncherCardRefreshType type, MarkerResponse response ) {
|
||||
private boolean notifyRefreshChanged( LauncherCardRefreshType type, MarkerResponse response ) {
|
||||
if ( response == null || response.getResult() == null ) {
|
||||
return false;
|
||||
}
|
||||
String tts = mContext.getString( R.string.module_service_launcher_card_tips );
|
||||
String info = mContext.getString( R.string.module_service_launcher_card_info );
|
||||
|
||||
LauncherCardRefreshType target = null;
|
||||
int size = 0;
|
||||
if ( type == LauncherCardRefreshType.ExploreWay ) {
|
||||
if ( response.getResult().getExploreWay() == null || response.getResult().getExploreWay().isEmpty() ) {
|
||||
return false;
|
||||
if ( response.getResult().getExploreWay() != null && !response.getResult().getExploreWay().isEmpty() ) {
|
||||
target = type;
|
||||
size = response.getResult().getExploreWay().size();
|
||||
} else if ( response.getResult().getOnlineCar() != null && !response.getResult().getOnlineCar().isEmpty() ) {
|
||||
target = LauncherCardRefreshType.OnlineCar;
|
||||
size = response.getResult().getOnlineCar().size();
|
||||
}
|
||||
int size = response.getResult().getExploreWay().size();
|
||||
speakTTS( tts = String.format( tts, size, mRefreshStrategy.getDesc() ), true );
|
||||
notifyLauncherCardExplorerWayChanged( String.format( info, size, mRefreshStrategy.getDesc() ), size, tts );
|
||||
} else {
|
||||
if ( response.getResult().getOnlineCar() == null || response.getResult().getOnlineCar().isEmpty() ) {
|
||||
return false;
|
||||
} else if ( type == LauncherCardRefreshType.OnlineCar ) {
|
||||
if ( response.getResult().getOnlineCar() != null && !response.getResult().getOnlineCar().isEmpty() ) {
|
||||
target = type;
|
||||
size = response.getResult().getOnlineCar().size();
|
||||
} else if ( response.getResult().getExploreWay() != null && !response.getResult().getExploreWay().isEmpty() ) {
|
||||
target = LauncherCardRefreshType.ExploreWay;
|
||||
size = response.getResult().getExploreWay().size();
|
||||
}
|
||||
int size = response.getResult().getOnlineCar().size();
|
||||
speakTTS( tts = String.format( tts, size, mRefreshStrategy.getDesc() ), true );
|
||||
notifyLauncherCardExplorerWayChanged( String.format( info, size, mRefreshStrategy.getDesc() ), size, tts );
|
||||
}
|
||||
|
||||
if ( size == 0 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( target != type ) {
|
||||
mRefreshStrategy.next();// 本次请求到的数据类型和播报类型不一致,则下次再次请求本次类型~
|
||||
}
|
||||
|
||||
speakTTS( tts = String.format( tts, size, target.desc ), true );
|
||||
notifyRefreshChanged( String.format( info, size, target.desc ), size, tts );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -289,7 +274,7 @@ class LauncherCardRefresher {
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( msg );
|
||||
}
|
||||
|
||||
private void notifyLauncherCardExplorerWayChanged( String info, int amount, String tts ) {
|
||||
private void notifyRefreshChanged( String info, int amount, String tts ) {
|
||||
Intent intent = new Intent( "com.mogo.launcher.v2x" );
|
||||
intent.putExtra( "v2x_warning_type", "20000" );
|
||||
intent.putExtra( "v2x_warining_timeout", 20 * 1000 );
|
||||
@@ -321,14 +306,36 @@ class LauncherCardRefresher {
|
||||
if ( !TextUtils.isEmpty( mDefaultLauncherCardConfig.content ) ) {
|
||||
mLaunchTTSText = mDefaultLauncherCardConfig.content;
|
||||
}
|
||||
if ( mDefaultLauncherCardConfig.popupNum > 0 ) {
|
||||
mDefaultTTSPlayInterval = mDefaultLauncherCardConfig.popupNum * ONE_MINUTE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( mDefaultConfigCounter++ >= 3 ) {
|
||||
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 < 10 * ONE_MINUTE ) {
|
||||
return;
|
||||
} else {
|
||||
SharedPrefsMgr.getInstance( mContext ).putInt( KEY_LauncherCardTipCounter, 0 );
|
||||
counter = 0;
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LauncherCardTipLastTipTime, 0L );
|
||||
}
|
||||
}
|
||||
SharedPrefsMgr.getInstance( mContext ).putInt( KEY_LauncherCardTipCounter, ++counter );
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LauncherCardTipLastTipTime, System.currentTimeMillis() );
|
||||
|
||||
try {
|
||||
speakTTS( mLaunchTTSText, true );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
startLoopRenderAdvertisements();
|
||||
startLoopDefaultConfigStrategy();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -399,17 +406,33 @@ class LauncherCardRefresher {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认播报 / 后台配置默认项播报策略
|
||||
*/
|
||||
private void startLoopDefaultConfigStrategy() {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_START_LOOP_DEFAULT_CARD;
|
||||
mHandler.sendMessageDelayed( msg, mDefaultTTSPlayInterval );
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始按策略展示广告
|
||||
*/
|
||||
private void startLoopRenderAdvertisements() {
|
||||
Message msg = Message.obtain();
|
||||
if ( mAdvertisements == null || mAdvertisements.isEmpty() ) {
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
LauncherCardAdvertisementData.LauncherCardAdvertisement advertisement = mAdvertisements.get( 0 );
|
||||
msg.what = MSG_REFRESH_ADVERTISEMENT;
|
||||
msg.arg1 = 1;
|
||||
mHandler.sendMessageDelayed( msg, advertisement.popupNum * ONE_MINUTE );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_REFRESH_ADVERTISEMENT;
|
||||
msg.arg1 = 0;
|
||||
mHandler.sendMessage( msg );
|
||||
|
||||
}
|
||||
|
||||
private void loopRenderAdvertisements( int index ) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@@ -117,6 +118,7 @@ public class RefreshModel {
|
||||
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
|
||||
refreshBody.radius = radius;
|
||||
refreshBody.dataType.add( ServiceConst.CARD_TYPE_ROAD_CONDITION );
|
||||
refreshBody.dataType.add( ServiceConst.CARD_TYPE_USER_DATA );
|
||||
|
||||
String data = GsonUtil.jsonFromObject( refreshBody );
|
||||
query.put( "data", data );
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -15,6 +16,8 @@ public
|
||||
* 描述
|
||||
*/
|
||||
class AccStatusReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "AccStatusReceiver";
|
||||
|
||||
// 诺威达 acc 状态
|
||||
public static final String PARAM_ACC_STATUS = "extra_mcu_state";
|
||||
@@ -24,6 +27,7 @@ class AccStatusReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
Logger.d(TAG, "收到诺威达acc广播");
|
||||
MarkerServiceHandler.init( context );
|
||||
IntentHandlerFactory.getInstance().handle( context, intent.getAction(), intent );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user