merge
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,11 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final String PATH_REFRESH_STRATEGY = "/strategy/refresh";
|
||||
|
||||
/**
|
||||
* tts语音配置
|
||||
*/
|
||||
public static final String PATH_TTS_CONFIG = "/ttsserver/tts";
|
||||
|
||||
/**
|
||||
* 倒计时消息
|
||||
*/
|
||||
|
||||
@@ -54,17 +54,19 @@ class ADASStatusIntentHandler implements IntentHandler {
|
||||
}
|
||||
int status = intent.getIntExtra( MogoReceiver.PARAM_ADAS_STATUS, 0 );
|
||||
MarkerServiceHandler.getMogoStatusManager().setADASUIShow( ServiceConst.TYPE, status == 1 );
|
||||
} else {
|
||||
String msg = intent.getStringExtra( "adasMsg" );
|
||||
if ( TextUtils.isEmpty( msg ) ) {
|
||||
return;
|
||||
}
|
||||
CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class );
|
||||
if ( stateInfo != null ) {
|
||||
changeCarHeadstockDirection( context, stateInfo.getValues().getHeading() );
|
||||
// changeMyLocation( stateInfo.getValues() );
|
||||
}
|
||||
}
|
||||
// 由于adas可能调高此处的调用频率,存在anr风险,且此处没有作用,所以暂时注释掉
|
||||
// else {
|
||||
// String msg = intent.getStringExtra( "adasMsg" );
|
||||
// if ( TextUtils.isEmpty( msg ) ) {
|
||||
// return;
|
||||
// }
|
||||
// CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class );
|
||||
// if ( stateInfo != null ) {
|
||||
// changeCarHeadstockDirection( context, stateInfo.getValues().getHeading() );
|
||||
// // changeMyLocation( stateInfo.getValues() );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void changeCarHeadstockDirection( final Context context, final double degree ) {
|
||||
|
||||
@@ -17,6 +17,5 @@ public class EmptyIntentHandler implements IntentHandler {
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
Logger.w( TAG, "空实现. %s", intent.getAction() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.module.service.launchercard;
|
||||
public class LauncherCardRefreshStrategy {
|
||||
|
||||
private long interval; // 间隔时间
|
||||
private LauncherCardRefreshType type = LauncherCardRefreshType.OnlineCar;
|
||||
|
||||
private LauncherCardRefreshStrategy next;
|
||||
|
||||
@@ -15,10 +14,6 @@ public class LauncherCardRefreshStrategy {
|
||||
this.msgType = msgType;
|
||||
}
|
||||
|
||||
public void setType( LauncherCardRefreshType type ) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return msgType;
|
||||
}
|
||||
@@ -27,31 +22,6 @@ public class LauncherCardRefreshStrategy {
|
||||
return interval;
|
||||
}
|
||||
|
||||
public LauncherCardRefreshType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public LauncherCardRefreshType getNextType() {
|
||||
if ( type == LauncherCardRefreshType.ExploreWay ) {
|
||||
type = LauncherCardRefreshType.OnlineCar;
|
||||
} else {
|
||||
type = LauncherCardRefreshType.ExploreWay;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public void next(){
|
||||
getNextType();
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return type.limit;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return type.desc;
|
||||
}
|
||||
|
||||
public int getRadius() {
|
||||
return 2_000;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,33 @@
|
||||
package com.mogo.module.service.launchercard;
|
||||
|
||||
public enum LauncherCardRefreshType {
|
||||
ExploreWay( 50, "道路事件" ),
|
||||
OnlineCar( 20, "车友" );
|
||||
|
||||
public int limit;
|
||||
public String desc;
|
||||
Weather( "News", "weather", "天气" ),
|
||||
News( "NearRoads", "news", "新闻" ),
|
||||
NearRoads( "ExplorerWay", "nearRoads", "近路" ),
|
||||
// TrafficRestriction( "NearRoads", "trafficRestriction" ),
|
||||
ExplorerWay( "OnlineCar", "friendAndPois", "道路事件" ),
|
||||
OnlineCar( "Weather", "friendAndPois", "车友" );
|
||||
|
||||
LauncherCardRefreshType( int limit, String desc ) {
|
||||
this.limit = limit;
|
||||
private String next;
|
||||
private String val;
|
||||
private String desc;
|
||||
|
||||
LauncherCardRefreshType( String next, String val, String desc ) {
|
||||
this.next = next;
|
||||
this.val = val;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getNext() {
|
||||
return next;
|
||||
}
|
||||
|
||||
public String getVal() {
|
||||
return val;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -10,21 +10,25 @@ 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;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
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.ZhidaoRefreshModel;
|
||||
import com.mogo.module.service.network.bean.LauncherCardAdvertisementData;
|
||||
import com.mogo.module.service.network.bean.TtsConfigBody;
|
||||
import com.mogo.module.service.network.bean.TtsConfigData;
|
||||
import com.mogo.service.passport.IMogoTicketCallback;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -49,15 +53,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";
|
||||
|
||||
public static final String KEY_LAST_LOAD_TTS_TYPE = "keyLastLoadTtsType";
|
||||
|
||||
private static volatile LauncherCardRefresher sInstance;
|
||||
|
||||
// 刷新道路事件/车友
|
||||
public static final int MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA = 2020;
|
||||
// 开始引导策略
|
||||
public static final int MSG_INDUCE = 2019;
|
||||
// 刷新卡片默认显示内容
|
||||
@@ -68,6 +67,10 @@ class LauncherCardRefresher {
|
||||
public static final int MSG_LOAD_NET_CONFIG = 2023;
|
||||
// 默认播报
|
||||
public static final int MSG_START_LOOP_DEFAULT_CARD = 2024;
|
||||
// 等待网络
|
||||
public static final int MSG_WAIT_NETWORK = 2025;
|
||||
|
||||
public static final long ONE_SECOND = 1000L;
|
||||
public static final long ONE_MINUTE = 60 * 1000L;
|
||||
public static final long ONE_DAY = 24 * 60 * ONE_MINUTE;
|
||||
private String mLaunchTTSText;
|
||||
@@ -80,11 +83,6 @@ class LauncherCardRefresher {
|
||||
*/
|
||||
private int mDefaultConfigCounter = 0;
|
||||
|
||||
/**
|
||||
* 事件/车友播报次数
|
||||
*/
|
||||
private int mMsgExplorerWayOrOnlineCarDataCounter = 0;
|
||||
|
||||
/**
|
||||
* 因为缓存ticket失效导致失败的情况,需要重新请求ticket然后再次获取数据,这里重试3次
|
||||
*/
|
||||
@@ -124,6 +122,8 @@ class LauncherCardRefresher {
|
||||
return;
|
||||
}
|
||||
switch ( msg.what ) {
|
||||
case MSG_WAIT_NETWORK:
|
||||
trtRequestNetworkConfigStrategy();
|
||||
case MSG_LOAD_NET_CONFIG:
|
||||
loadNetworkConfigStrategy();
|
||||
break;
|
||||
@@ -135,13 +135,6 @@ class LauncherCardRefresher {
|
||||
case MSG_INDUCE:
|
||||
handleInduceStrategy();
|
||||
break;
|
||||
case MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA:
|
||||
try {
|
||||
handleRefreshExplorerWayOrOnlineCarMsg();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error when refresh launcher card." );
|
||||
}
|
||||
break;
|
||||
case MSG_START_LOOP_DEFAULT_CARD:
|
||||
renderDefaultLauncherCardConfig( false );
|
||||
break;
|
||||
@@ -159,14 +152,8 @@ class LauncherCardRefresher {
|
||||
private RefreshModel mRefreshModel;
|
||||
private ZhidaoRefreshModel mZhidaoRefreshModel;
|
||||
|
||||
private LauncherCardRefreshStrategy mExplorerWayOrOnlineCarDataStrategy = new LauncherCardRefreshStrategy(
|
||||
18 * ONE_MINUTE, null, MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA
|
||||
);
|
||||
private LauncherCardRefreshStrategy mInduceStrategy = new LauncherCardRefreshStrategy(
|
||||
18 * ONE_MINUTE, mExplorerWayOrOnlineCarDataStrategy, MSG_INDUCE
|
||||
);
|
||||
private LauncherCardRefreshStrategy mLauncherCardConfigStrategy = new LauncherCardRefreshStrategy(
|
||||
2 * ONE_MINUTE, mExplorerWayOrOnlineCarDataStrategy, MSG_REFRESH_DEFAULT_CARD
|
||||
2 * ONE_MINUTE, null, MSG_REFRESH_DEFAULT_CARD
|
||||
);
|
||||
private LauncherCardRefreshStrategy mRefreshStrategy = mLauncherCardConfigStrategy;
|
||||
|
||||
@@ -178,24 +165,32 @@ class LauncherCardRefresher {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "start" );
|
||||
mLaunchTTSText = mContext.getString( R.string.module_service_open_app_tip );
|
||||
mDefaultConfigCounter = 0;
|
||||
mRefreshTicketCounter = 0;
|
||||
mMsgExplorerWayOrOnlineCarDataCounter = 0;
|
||||
mRefreshStrategy = mLauncherCardConfigStrategy;
|
||||
// 延时加载数据,已保证accOn之后网络恢复正常
|
||||
long delay = ONE_MINUTE;
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
delay = 0L;
|
||||
}
|
||||
mHandler.sendEmptyMessageDelayed( MSG_LOAD_NET_CONFIG, delay );
|
||||
trtRequestNetworkConfigStrategy();
|
||||
startInduceStrategy();
|
||||
}
|
||||
|
||||
private void trtRequestNetworkConfigStrategy() {
|
||||
if ( NetworkUtils.isConnected( mContext ) && MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
.getSingletonLocationClient( mContext )
|
||||
.getLastKnowLocation() != null ) {
|
||||
mHandler.sendEmptyMessageDelayed( MSG_LOAD_NET_CONFIG, 0L );
|
||||
} else {
|
||||
mHandler.sendEmptyMessageDelayed( MSG_WAIT_NETWORK, 10 * ONE_SECOND );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 引导策略:本地策略 & 网络策略
|
||||
*/
|
||||
private void startInduceStrategy() {
|
||||
if ( mRefreshStrategy == null ) {
|
||||
return;
|
||||
}
|
||||
mHandler.sendEmptyMessageDelayed( mRefreshStrategy.getMsgType(), mRefreshStrategy.getInterval() );
|
||||
mRefreshStop = false;
|
||||
mStart = true;
|
||||
@@ -205,11 +200,11 @@ class LauncherCardRefresher {
|
||||
mRefreshStop = true;
|
||||
mStart = false;
|
||||
mHandler.removeMessages( MSG_INDUCE );
|
||||
mHandler.removeMessages( MSG_EXPLORER_WAY_OR_ONLINE_CAR_DATA );
|
||||
mHandler.removeMessages( MSG_REFRESH_DEFAULT_CARD );
|
||||
mHandler.removeMessages( MSG_START_LOOP_DEFAULT_CARD );
|
||||
mHandler.removeMessages( MSG_REFRESH_ADVERTISEMENT );
|
||||
mHandler.removeMessages( MSG_LOAD_NET_CONFIG );
|
||||
mHandler.removeMessages( MSG_WAIT_NETWORK );
|
||||
Logger.d( TAG, "stop" );
|
||||
}
|
||||
|
||||
@@ -234,8 +229,6 @@ class LauncherCardRefresher {
|
||||
if ( mAdvertisements != null && !mAdvertisements.isEmpty() ) {
|
||||
loopRenderAdvertisements( 0 );
|
||||
startNextRefreshStrategy();
|
||||
} else {
|
||||
handleRefreshExplorerWayOrOnlineCarMsg();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,104 +239,10 @@ class LauncherCardRefresher {
|
||||
restart();
|
||||
}
|
||||
|
||||
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 > 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() );
|
||||
}
|
||||
|
||||
private void handleRefreshExplorerWayOrOnlineCarData( MogoLatLng latLng, LauncherCardRefreshType type ) {
|
||||
mRefreshModel.refreshLauncherCardDataSync( latLng,
|
||||
mRefreshStrategy.getRadius(),
|
||||
mRefreshStrategy.getLimit(),
|
||||
new RefreshCallback< MarkerResponse >() {
|
||||
@Override
|
||||
public void onSuccess( MarkerResponse response ) {
|
||||
notifyRefreshChanged( type, response );
|
||||
startNextRefreshStrategy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
startNextRefreshStrategy();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
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() ) {
|
||||
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();
|
||||
}
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
|
||||
Logger.d( TAG, "返回数据情况:道路事件:%s, 车友: %s", response.getResult().getExploreWay() == null ? 0 : response.getResult().getExploreWay().size(),
|
||||
response.getResult().getOnlineCar() == null ? 0 : response.getResult().getOnlineCar().size() );
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private void speakTTS( String msg, boolean checkAppForeground ) {
|
||||
if ( TextUtils.isEmpty( msg ) ) {
|
||||
return;
|
||||
}
|
||||
if ( checkAppForeground ) {
|
||||
if ( AppUtils.isAppForeground( mContext ) ) {
|
||||
return;
|
||||
@@ -427,6 +326,14 @@ class LauncherCardRefresher {
|
||||
* 请求广告数据
|
||||
*/
|
||||
private void loadNetworkConfigStrategy() {
|
||||
loadAdvertisementConfig();
|
||||
requestTtsStrategyConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求广告数据
|
||||
*/
|
||||
private void loadAdvertisementConfig() {
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext )
|
||||
.append( "modelType", 30 )
|
||||
.build();
|
||||
@@ -460,9 +367,238 @@ class LauncherCardRefresher {
|
||||
Logger.e( TAG, "获取配置失败 msg = %s, code = %s", message, code );
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求花式的tts播报内容
|
||||
*/
|
||||
private void requestTtsStrategyConfig() {
|
||||
|
||||
String name = SharedPrefsMgr.getInstance( mContext ).getString( KEY_LAST_LOAD_TTS_TYPE, LauncherCardRefreshType.Weather.name() );
|
||||
LauncherCardRefreshType type = LauncherCardRefreshType.valueOf( name );
|
||||
|
||||
MogoLocation location = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient( mContext ).getLastKnowLocation();
|
||||
TtsConfigBody body = new TtsConfigBody()
|
||||
.addType( LauncherCardRefreshType.NearRoads.getVal() )
|
||||
.addType( LauncherCardRefreshType.News.getVal() )
|
||||
.addType( LauncherCardRefreshType.ExplorerWay.getVal() )
|
||||
.addType( LauncherCardRefreshType.Weather.getVal() )
|
||||
.sn( Utils.getSn() )
|
||||
.location( new MogoLatLng( location.getLatitude(), location.getLongitude() ) );
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext )
|
||||
.append( "data", GsonUtil.jsonFromObject( body ) )
|
||||
.build();
|
||||
mRefreshModel.getRefreshApiService().queryBroadCastInfo( query )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< TtsConfigData >( RequestOptions.create( mContext ) ) {
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess( TtsConfigData data ) {
|
||||
super.onSuccess( data );
|
||||
if ( data == null || data.result == null ) {
|
||||
Logger.d( TAG, "获取数据为空" );
|
||||
return;
|
||||
}
|
||||
handleTtsConfig( data, type );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
if ( code == 100046 ) {
|
||||
refreshTicket();
|
||||
}
|
||||
Logger.e( TAG, "获取配置失败 msg = %s, code = %s", message, code );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 策略:
|
||||
* 优先车辆限行
|
||||
* 剩下的按顺序播报
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
private void handleTtsConfig( TtsConfigData data, LauncherCardRefreshType type ) {
|
||||
List< TtsConfigData.TrafficRestriction > trafficRestrictions = data.result.trafficRestriction;
|
||||
if ( trafficRestrictions != null && !trafficRestrictions.isEmpty() ) {
|
||||
for ( TtsConfigData.TrafficRestriction trafficRestriction : trafficRestrictions ) {
|
||||
if ( trafficRestriction == null || TextUtils.isEmpty( trafficRestriction.tts ) ) {
|
||||
continue;
|
||||
}
|
||||
speakTTS( trafficRestriction.tts, false );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TtsConfigNode weather = new TtsConfigNode( data.result.weather, LauncherCardRefreshType.Weather );
|
||||
TtsConfigNode news = new TtsConfigNode( data.result.news, LauncherCardRefreshType.News );
|
||||
TtsConfigNode nearRoads = new TtsConfigNode( data.result.nearRoads, LauncherCardRefreshType.NearRoads );
|
||||
TtsConfigNode explorerWay = new TtsConfigNode( data.result.friendAndPois, LauncherCardRefreshType.ExplorerWay );
|
||||
TtsConfigNode onlineCar = new TtsConfigNode( data.result.friendAndPois, LauncherCardRefreshType.OnlineCar );
|
||||
|
||||
weather.next = news;
|
||||
news.next = nearRoads;
|
||||
nearRoads.next = explorerWay;
|
||||
explorerWay.next = onlineCar;
|
||||
onlineCar.next = weather;
|
||||
|
||||
TtsConfigNode header = null;
|
||||
switch ( type ) {
|
||||
case News:
|
||||
header = news;
|
||||
break;
|
||||
case NearRoads:
|
||||
header = nearRoads;
|
||||
break;
|
||||
case OnlineCar:
|
||||
header = onlineCar;
|
||||
break;
|
||||
case Weather:
|
||||
header = weather;
|
||||
break;
|
||||
case ExplorerWay:
|
||||
header = explorerWay;
|
||||
break;
|
||||
}
|
||||
|
||||
TtsConfigNode pointer = header;
|
||||
|
||||
do {
|
||||
if ( handleTtsNode( pointer ) ) {
|
||||
writeNextLoadType( pointer.type );
|
||||
return;
|
||||
}
|
||||
pointer = pointer.next;
|
||||
} while ( pointer != header );
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理每个配置项
|
||||
*
|
||||
* @param node
|
||||
* @return
|
||||
*/
|
||||
private boolean handleTtsNode( TtsConfigNode node ) {
|
||||
if ( node.data == null || node.data.isEmpty() ) {
|
||||
return false;
|
||||
}
|
||||
for ( Object datum : node.data ) {
|
||||
boolean result = false;
|
||||
if ( datum instanceof TtsConfigData.Weather ) {
|
||||
result = handleWeatherTtsConfig( ( ( TtsConfigData.Weather ) datum ) );
|
||||
} else if ( datum instanceof TtsConfigData.News ) {
|
||||
result = handleNewsTtsConfig( ( ( TtsConfigData.News ) datum ) );
|
||||
} else if ( datum instanceof TtsConfigData.NearRoads ) {
|
||||
result = handleNearRoadsTtsConfig( ( ( TtsConfigData.NearRoads ) datum ) );
|
||||
} else if ( datum instanceof TtsConfigData.OnlineCarVsExplorerWay ) {
|
||||
result = handleExplorerWayTtsConfig( ( ( TtsConfigData.OnlineCarVsExplorerWay ) datum ) );
|
||||
if ( !result ) {
|
||||
result = handleOnlineCarTtsConfig( ( ( TtsConfigData.OnlineCarVsExplorerWay ) datum ) );
|
||||
}
|
||||
}
|
||||
if ( result ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 天气
|
||||
*
|
||||
* @param weather
|
||||
* @return
|
||||
*/
|
||||
private boolean handleWeatherTtsConfig( TtsConfigData.Weather weather ) {
|
||||
if ( weather == null ) {
|
||||
return false;
|
||||
}
|
||||
speakTTS( weather.tts, false );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新闻
|
||||
*
|
||||
* @param news
|
||||
* @return
|
||||
*/
|
||||
private boolean handleNewsTtsConfig( TtsConfigData.News news ) {
|
||||
if ( news == null ) {
|
||||
return false;
|
||||
}
|
||||
speakTTS( news.tts, false );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 常走道路
|
||||
*
|
||||
* @param nearRoads
|
||||
* @return
|
||||
*/
|
||||
private boolean handleNearRoadsTtsConfig( TtsConfigData.NearRoads nearRoads ) {
|
||||
if ( nearRoads == null ) {
|
||||
return false;
|
||||
}
|
||||
speakTTS( nearRoads.tts, false );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 道路事件
|
||||
*
|
||||
* @param explorerWay
|
||||
* @return
|
||||
*/
|
||||
private boolean handleExplorerWayTtsConfig( TtsConfigData.OnlineCarVsExplorerWay explorerWay ) {
|
||||
if ( explorerWay == null || explorerWay.pois == 0 ) {
|
||||
return false;
|
||||
}
|
||||
String tts = mContext.getString( R.string.module_service_launcher_card_tips );
|
||||
String info = mContext.getString( R.string.module_service_launcher_card_info );
|
||||
speakTTS( String.format( tts, explorerWay.pois, LauncherCardRefreshType.ExplorerWay.getDesc() ), false );
|
||||
notifyRefreshChanged( String.format( info, explorerWay.pois, LauncherCardRefreshType.ExplorerWay ), explorerWay.pois, tts );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车友
|
||||
*
|
||||
* @param onlineCar
|
||||
* @return
|
||||
*/
|
||||
private boolean handleOnlineCarTtsConfig( TtsConfigData.OnlineCarVsExplorerWay onlineCar ) {
|
||||
if ( onlineCar == null || onlineCar.friends == 0 ) {
|
||||
return false;
|
||||
}
|
||||
String tts = mContext.getString( R.string.module_service_launcher_card_tips );
|
||||
String info = mContext.getString( R.string.module_service_launcher_card_info );
|
||||
speakTTS( String.format( tts, onlineCar.friends, LauncherCardRefreshType.OnlineCar.getDesc() ), false );
|
||||
notifyRefreshChanged( String.format( info, onlineCar.friends, LauncherCardRefreshType.OnlineCar ), onlineCar.friends, tts );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存下次需要首先播报的内容类型
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
private void writeNextLoadType( LauncherCardRefreshType type ) {
|
||||
SharedPrefsMgr.getInstance( mContext ).putString( KEY_LAST_LOAD_TTS_TYPE, type.getNext() );
|
||||
Logger.d( TAG, "本次播报:%s,下次播报:%s", type.getVal(), LauncherCardRefreshType.valueOf( type.getNext() ).getVal() );
|
||||
}
|
||||
|
||||
|
||||
private void refreshTicket() {
|
||||
mRefreshTicketCounter++;
|
||||
Logger.d( TAG, "刷新ticket" );
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.module.service.launchercard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class TtsConfigNode {
|
||||
|
||||
public List data;
|
||||
public LauncherCardRefreshType type;
|
||||
public TtsConfigNode next;
|
||||
|
||||
public TtsConfigNode( List data, LauncherCardRefreshType type ) {
|
||||
this.data = data;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -288,7 +288,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
Logger.d( TAG, "draw marker" );
|
||||
|
||||
mLastDataResult = response.getResult();
|
||||
UiThreadHandler.post( () -> {
|
||||
@@ -419,7 +418,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
String sn = getPrimaryKeyFromEntity( markerExploreWay );
|
||||
IMogoMarker mogoMarker = existCarMap.get( sn );
|
||||
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
|
||||
Logger.d( TAG, "draw road condition, sn = %s", sn );
|
||||
try {
|
||||
if ( DebugConfig.isRoadEventAnimated() ) {
|
||||
post2AddAndStartAnimation( markerShowEntity, i * 100L );
|
||||
@@ -472,7 +470,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*/
|
||||
private Map< String, IMogoMarker > purgeMarkerData( List newList, String markerType ) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Map< String, IMogoMarker > existMap = new HashMap<>();
|
||||
List< IMogoMarker > allCarsList = MarkerServiceHandler.getMarkerManager().getMarkers( markerType );
|
||||
if ( allCarsList == null || allCarsList.isEmpty() ) {
|
||||
@@ -501,7 +498,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
}
|
||||
allMap.clear();
|
||||
Logger.i( "timer", "purge data cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
return existMap;
|
||||
}
|
||||
|
||||
@@ -742,7 +738,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
if ( ignoreDrawRequest() ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "接收到了地图大而全数据" );
|
||||
runOnTargetThread( () -> {
|
||||
drawMapMarker( response );
|
||||
} );
|
||||
@@ -776,7 +771,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
private Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Logger.d( TAG, "内部 - 自动刷新在线车辆" );
|
||||
getOnlineCarDataImpl( mCarLatLng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false );
|
||||
}
|
||||
};
|
||||
@@ -813,20 +807,15 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
mCarLatLng = latLng;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "内部 - 请求执行" );
|
||||
|
||||
if ( latLng == null ) {
|
||||
Logger.d( TAG, "内部 - 定位为空" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ignoreOnlineCarRequest() ) {
|
||||
Logger.d( TAG, "内部 - 忽略请求" );
|
||||
removeCarMarkers();
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "内部 - 请求开始" );
|
||||
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit, false, new RefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object o ) {
|
||||
@@ -851,9 +840,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
);
|
||||
}
|
||||
|
||||
Logger.d( TAG, "内部 - 请求完毕" );
|
||||
runOnTargetThread( () -> {
|
||||
Logger.d( TAG, "内部 - 请求完毕开始处理" );
|
||||
trackData( size );
|
||||
drawOnlineCarMarkers( onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng );
|
||||
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.network.bean.DemoUserInfoEntity;
|
||||
import com.mogo.module.service.network.bean.HomeCompanyDistanceForPushResponse;
|
||||
import com.mogo.module.service.network.bean.TtsConfigData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -40,6 +41,10 @@ public interface RefreshApiService {
|
||||
Observable< DemoUserInfoEntity > getMockUsers();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-travel-condition/trajectoryPrediction/calculationNotHomeCompanyDistanceForPush")
|
||||
Observable< HomeCompanyDistanceForPushResponse > calculationNotHomeCompanyDistanceForPush( @FieldMap Map< String, Object > parameters);
|
||||
@POST( "/yycp-travel-condition/trajectoryPrediction/calculationNotHomeCompanyDistanceForPush" )
|
||||
Observable< HomeCompanyDistanceForPushResponse > calculationNotHomeCompanyDistanceForPush( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/appCard/queryBroadCastInfo" )
|
||||
Observable< TtsConfigData > queryBroadCastInfo( @FieldMap Map< String, Object > parameters );
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@ public class RefreshModel {
|
||||
|
||||
private static final String TAG = "RefreshModel";
|
||||
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_DEMO = "http://dzt-show.zhidaohulian.com";
|
||||
public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com";
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaozhixing.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaozhixing.com";
|
||||
public static final String HOST_DEMO = "http://dzt-show.zhidaozhixing.com";
|
||||
public static final String HOST_PRODUCT = "http://dzt.zhidaozhixing.com";
|
||||
|
||||
private final Context mContext;
|
||||
private RefreshApiService mRefreshApiService;
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/17
|
||||
*
|
||||
* 请求参数
|
||||
*/
|
||||
class TtsConfigBody implements Parcelable {
|
||||
|
||||
private MogoLatLng location;
|
||||
private List< String > dataType;
|
||||
private String sn;
|
||||
|
||||
public TtsConfigBody addType( String type ) {
|
||||
if ( dataType == null ) {
|
||||
dataType = new ArrayList<>();
|
||||
}
|
||||
dataType.add( type );
|
||||
return this;
|
||||
}
|
||||
|
||||
public TtsConfigBody sn( String sn ) {
|
||||
this.sn = sn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TtsConfigBody location( MogoLatLng location ) {
|
||||
this.location = location;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeParcelable( this.location, flags );
|
||||
dest.writeStringList( this.dataType );
|
||||
dest.writeString( this.sn );
|
||||
}
|
||||
|
||||
public TtsConfigBody() {
|
||||
}
|
||||
|
||||
protected TtsConfigBody( Parcel in ) {
|
||||
this.location = in.readParcelable( MogoLatLng.class.getClassLoader() );
|
||||
this.dataType = in.createStringArrayList();
|
||||
this.sn = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator< TtsConfigBody > CREATOR = new Creator< TtsConfigBody >() {
|
||||
@Override
|
||||
public TtsConfigBody createFromParcel( Parcel source ) {
|
||||
return new TtsConfigBody( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TtsConfigBody[] newArray( int size ) {
|
||||
return new TtsConfigBody[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/17
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class TtsConfigData extends BaseData {
|
||||
|
||||
public Result result;
|
||||
|
||||
public static class Result {
|
||||
public String sn;
|
||||
public List< String > dataType;
|
||||
public List< Weather > weather;
|
||||
public List< News > news;
|
||||
public List< NearRoads > nearRoads;
|
||||
public List< TrafficRestriction > trafficRestriction;
|
||||
public List< OnlineCarVsExplorerWay > friendAndPois;
|
||||
}
|
||||
|
||||
public static class BaseConfig {
|
||||
public String tts;
|
||||
}
|
||||
|
||||
public static class Weather extends BaseConfig {
|
||||
|
||||
public String time;
|
||||
public String date;
|
||||
public String ymd;
|
||||
public String week;
|
||||
public String sunrise;
|
||||
public String high;
|
||||
public String low;
|
||||
public String sunset;
|
||||
public int aqi;
|
||||
public String fx;
|
||||
public String fl;
|
||||
public String type;
|
||||
public String notice;
|
||||
}
|
||||
|
||||
public static class News extends BaseConfig {
|
||||
|
||||
public String title;
|
||||
public String content;
|
||||
@SerializedName( "img_width" )
|
||||
public String imgWidth;
|
||||
@SerializedName( "full_title" )
|
||||
public String fullTitle;
|
||||
@SerializedName( "pdate" )
|
||||
public String time;
|
||||
public String src;
|
||||
@SerializedName( "img_length" )
|
||||
public String imgLength;
|
||||
public String img;
|
||||
public String url;
|
||||
@SerializedName( "pdate_src" )
|
||||
public String date;
|
||||
}
|
||||
|
||||
public static class NearRoads extends BaseConfig {
|
||||
|
||||
}
|
||||
|
||||
public static class TrafficRestriction extends BaseConfig {
|
||||
}
|
||||
|
||||
public static class OnlineCarVsExplorerWay extends BaseConfig {
|
||||
|
||||
/**
|
||||
* 车友数量
|
||||
*/
|
||||
public int friends;
|
||||
|
||||
/**
|
||||
* 道路事件数量
|
||||
*/
|
||||
public int pois;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mogo.module.service.network.bean;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
/**
|
||||
* @author :zhuangyan
|
||||
* @date : 2020/11/17 11:43
|
||||
* @desc :分体机tts播报信息返回
|
||||
*/
|
||||
public class TtsConfigEntity extends BaseData {
|
||||
public Result result;
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class Result {
|
||||
private String word;
|
||||
|
||||
public String getWord() {
|
||||
return word;
|
||||
}
|
||||
|
||||
public void setWord(String word) {
|
||||
this.word = word;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,15 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.carchattingprovider.ICarsChattingProvider;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
@@ -23,8 +26,11 @@ import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -32,34 +38,50 @@ import java.util.List;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class OnlineCarPanelAdapter extends RecyclerView.Adapter< OnlineCarPanelAdapter.VH > {
|
||||
class OnlineCarPanelAdapter extends RecyclerView.Adapter<OnlineCarPanelAdapter.VH> {
|
||||
|
||||
private static final String TAG = "OnlineCarPanelAdapter";
|
||||
|
||||
private List< MarkerOnlineCar > mDatums;
|
||||
private List<MarkerOnlineCar> mDatums;
|
||||
private double mToLon;
|
||||
private double mToLat;
|
||||
|
||||
public OnlineCarPanelAdapter( List< MarkerOnlineCar > mDatums, double mToLon, double mToLat ) {
|
||||
public OnlineCarPanelAdapter(List<MarkerOnlineCar> mDatums, double mToLon, double mToLat) {
|
||||
this.mDatums = mDatums;
|
||||
this.mToLon = mToLon;
|
||||
this.mToLat = mToLat;
|
||||
}
|
||||
|
||||
public void setDatums( List< MarkerOnlineCar > mDatums ) {
|
||||
public void setDatums(List<MarkerOnlineCar> mDatums) {
|
||||
this.mDatums = mDatums;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public OnlineCarPanelAdapter.VH onCreateViewHolder( @NonNull ViewGroup parent, int viewType ) {
|
||||
return new VH( LayoutInflater.from( parent.getContext() ).inflate( R.layout.module_services_online_car_panel_item, null ) );
|
||||
public OnlineCarPanelAdapter.VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new VH(LayoutInflater.from(parent.getContext()).inflate(R.layout.module_services_online_car_panel_item, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder( @NonNull OnlineCarPanelAdapter.VH holder, int position ) {
|
||||
holder.bind( mDatums.get( position ), mToLon, mToLat );
|
||||
public void onBindViewHolder(@NonNull OnlineCarPanelAdapter.VH holder, int position) {
|
||||
holder.bind(mDatums.get(position), mToLon, mToLat);
|
||||
holder.call.setOnClickListener(view -> {
|
||||
//TODO 拨打电话
|
||||
Map<String, String> params = new HashMap<>();
|
||||
MarkerUserInfo userInfo = mDatums.get(position).getUserInfo();
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_SN, userInfo.getSn());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_USER_IMG, userInfo.getUserHead());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_USER_AGE, userInfo.getAgeNumber() + "");
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_NICK_NAME, userInfo.getUserName());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_USER_SEX, userInfo.getGender() + "");
|
||||
MarkerLocation location = mDatums.get(position).getLocation();
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_ADDRESS, location.getAddress());
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_LAT, location.getLat() + "");
|
||||
params.put(CallChattingProviderConstant.CCPROVIDER_LON, location.getLon() + "");
|
||||
ICarsChattingProvider carChatting = MarkerServiceHandler.getCarChatting();
|
||||
carChatting.call(params);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,43 +95,50 @@ class OnlineCarPanelAdapter extends RecyclerView.Adapter< OnlineCarPanelAdapter.
|
||||
private TextView nickname;
|
||||
private TextView distance;
|
||||
private TextView detail;
|
||||
private TextView call;
|
||||
|
||||
public VH( @NonNull View itemView ) {
|
||||
super( itemView );
|
||||
RecyclerView.LayoutParams params = new RecyclerView.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT );
|
||||
params.bottomMargin = ResourcesHelper.getDimensionPixelSize( itemView.getContext(), R.dimen.module_services_panel_item_marginBottom );
|
||||
itemView.setLayoutParams( params );
|
||||
avatar = itemView.findViewById( R.id.module_services_id_panel_item_avatar );
|
||||
nickname = itemView.findViewById( R.id.module_services_id_panel_item_nickname );
|
||||
distance = itemView.findViewById( R.id.module_services_id_panel_item_distance );
|
||||
detail = itemView.findViewById( R.id.module_services_id_panel_item_detail );
|
||||
public VH(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.bottomMargin = ResourcesHelper.getDimensionPixelSize(itemView.getContext(), R.dimen.module_services_panel_item_marginBottom);
|
||||
itemView.setLayoutParams(params);
|
||||
avatar = itemView.findViewById(R.id.module_services_id_panel_item_avatar);
|
||||
nickname = itemView.findViewById(R.id.module_services_id_panel_item_nickname);
|
||||
distance = itemView.findViewById(R.id.module_services_id_panel_item_distance);
|
||||
detail = itemView.findViewById(R.id.module_services_id_panel_item_detail);
|
||||
call = itemView.findViewById(R.id.module_services_id_panel_item_call);
|
||||
}
|
||||
|
||||
public void bind( MarkerOnlineCar car, double lon, double lat ) {
|
||||
RequestOptions options = new RequestOptions().circleCrop().placeholder( R.drawable.module_common_default_user_head ).error( R.drawable.module_common_default_user_head );
|
||||
GlideApp.with( itemView.getContext() ).asBitmap().apply( options ).load( car.getUserInfo().getUserHead() ).into( new SkinAbleBitmapTarget( avatar, options ) );
|
||||
nickname.setText( car.getUserInfo().getUserName() );
|
||||
String content = getDistanceStr( car.getLocation(), lon, lat );
|
||||
distance.setText( content );
|
||||
detail.setOnClickListener( view -> {
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "Mogoer_List_click", null );
|
||||
public void bind(MarkerOnlineCar car, double lon, double lat) {
|
||||
RequestOptions options = new RequestOptions().circleCrop().placeholder(R.drawable.module_common_default_user_head).error(R.drawable.module_common_default_user_head);
|
||||
GlideApp.with(itemView.getContext()).asBitmap().apply(options).load(car.getUserInfo().getUserHead()).into(new SkinAbleBitmapTarget(avatar, options));
|
||||
nickname.setText(car.getUserInfo().getUserName());
|
||||
String content = getDistanceStr(car.getLocation(), lon, lat);
|
||||
distance.setText(content);
|
||||
detail.setOnClickListener(view -> {
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track("Mogoer_List_click", null);
|
||||
try {
|
||||
CallChatApi.getInstance().showUserWindow( itemView.getContext(), car );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "detail.OnClick" );
|
||||
CallChatApi.getInstance().showUserWindow(itemView.getContext(), car);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "detail.OnClick");
|
||||
}
|
||||
} );
|
||||
});
|
||||
// call.setOnClickListener(view -> {
|
||||
// //TODO 拨打电话
|
||||
//
|
||||
//
|
||||
// });
|
||||
}
|
||||
|
||||
private String getDistanceStr( MarkerLocation location, double lon, double lat ) {
|
||||
if ( location == null ) {
|
||||
private String getDistanceStr(MarkerLocation location, double lon, double lat) {
|
||||
if (location == null) {
|
||||
return "未知";
|
||||
}
|
||||
float distance = Utils.calculateLineDistance( location.getLon(), location.getLat(), lon, lat );
|
||||
if ( distance >= 1000 ) {
|
||||
return String.format( "%.1fKM", distance / 1000 );
|
||||
float distance = Utils.calculateLineDistance(location.getLon(), location.getLat(), lon, lat);
|
||||
if (distance >= 1000) {
|
||||
return String.format("%.1f千米", distance / 1000);
|
||||
} else {
|
||||
return String.format( "%.1fM", distance );
|
||||
return String.format("%.1f米", distance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,16 +104,17 @@ public class CarIconDisplayStrategy {
|
||||
private static volatile CarIconDisplayStrategy sInstance;
|
||||
|
||||
private IMogoMarker mSeekHelpingMarker;
|
||||
private ArrayList< Bitmap > mBitmapFrames = new ArrayList<>();
|
||||
private ArrayList<Bitmap> mBitmapFrames = new ArrayList<>();
|
||||
|
||||
private CarIconDisplayStrategy() {
|
||||
mOption = new CarCursorOption.Builder().carCursorRes( R.drawable.module_service_ic_seek_helping ).build();
|
||||
mOption =
|
||||
new CarCursorOption.Builder().carCursorRes(R.drawable.module_service_ic_seek_helping).build();
|
||||
}
|
||||
|
||||
public static CarIconDisplayStrategy getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( CarIconDisplayStrategy.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (CarIconDisplayStrategy.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new CarIconDisplayStrategy();
|
||||
}
|
||||
}
|
||||
@@ -127,19 +128,41 @@ public class CarIconDisplayStrategy {
|
||||
|
||||
private Handler mSeekHelpingHandler;
|
||||
private CarCursorOption mOption;
|
||||
private MogoMarkerOptions seekHelpMarkerOptions;
|
||||
// private IMogoMarker seekHelpMarker;
|
||||
|
||||
public void changeCarIconStatus( boolean seekHelpingStatus ) {
|
||||
if ( CarSeries.isF8xxSeries() ) {
|
||||
if ( seekHelpingStatus ) {
|
||||
|
||||
public void changeCarIconStatus(boolean seekHelpingStatus) {
|
||||
if (CarSeries.isF8xxSeries()) {
|
||||
if (seekHelpingStatus) {
|
||||
playSeekHelpingAnim();
|
||||
} else {
|
||||
stopSeekHelpingAnim();
|
||||
}
|
||||
} else {
|
||||
if ( seekHelpingStatus ) {
|
||||
MarkerServiceHandler.getMapUIController().setCarCursorOption( mOption );
|
||||
if (seekHelpingStatus) {
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(false);
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(
|
||||
TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icon(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.module_service_ic_seek_helping))
|
||||
.period(1)
|
||||
.zIndex(1000)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption( mOption );
|
||||
} else {
|
||||
MarkerServiceHandler.getMapUIController().setCarCursorOption( null );
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(true);
|
||||
try {
|
||||
if (mSeekHelpingMarker != null) {
|
||||
mSeekHelpingMarker.destroy();
|
||||
mSeekHelpingMarker = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,29 +171,29 @@ public class CarIconDisplayStrategy {
|
||||
initHandler();
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_SEEK_HELPING_ANIM;
|
||||
mSeekHelpingHandler.sendMessageDelayed( msg, 0 );
|
||||
mSeekHelpingHandler.sendMessageDelayed(msg, 0);
|
||||
}
|
||||
|
||||
private void initHandler() {
|
||||
if ( mSeekHelpingHandler != null ) {
|
||||
if (mSeekHelpingHandler != null) {
|
||||
return;
|
||||
}
|
||||
mSeekHelpingHandler = new Handler( WorkThreadHandler.getInstance().getLooper() ) {
|
||||
mSeekHelpingHandler = new Handler(WorkThreadHandler.getInstance().getLooper()) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
switch ( msg.what ) {
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case MSG_SEEK_HELPING_ANIM:
|
||||
try {
|
||||
playAnim();
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case MSG_STOP_SEEK_HELPING_ANIM:
|
||||
try {
|
||||
stopAnim();
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
@@ -183,48 +206,59 @@ public class CarIconDisplayStrategy {
|
||||
initHandler();
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_STOP_SEEK_HELPING_ANIM;
|
||||
mSeekHelpingHandler.sendMessageDelayed( msg, 0 );
|
||||
mSeekHelpingHandler.sendMessageDelayed(msg, 0);
|
||||
}
|
||||
|
||||
private void playAnim() {
|
||||
try {
|
||||
for ( int i : sFrame ) {
|
||||
mBitmapFrames.add( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), i ) );
|
||||
for (int i : sFrame) {
|
||||
mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i));
|
||||
}
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker( TAG, new MogoMarkerOptions()
|
||||
.icons( mBitmapFrames )
|
||||
.period( 1 )
|
||||
.zIndex( 1000 )
|
||||
.autoManager( false )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.position( MarkerServiceHandler.getMapService().getNavi( AbsMogoApplication.getApp() ).getCarLocation2() ) );
|
||||
} catch ( Exception e ) {
|
||||
MarkerServiceHandler.getMapUIController().setCarCursorOption( new CarCursorOption.Builder().carCursorRes( R.drawable.module_service_ic_seek_helping_00036 ).build() );
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icons(mBitmapFrames)
|
||||
.period(1)
|
||||
.zIndex(1000)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(
|
||||
TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icon(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.module_service_ic_seek_helping))
|
||||
.period(1)
|
||||
.zIndex(1000)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption(new CarCursorOption.Builder().carCursorRes(R.drawable.module_service_ic_seek_helping_00036).build());
|
||||
}
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation( false );
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(false);
|
||||
}
|
||||
|
||||
private void stopAnim() {
|
||||
try {
|
||||
if ( mSeekHelpingMarker != null ) {
|
||||
if (mSeekHelpingMarker != null) {
|
||||
mSeekHelpingMarker.destroy();
|
||||
mSeekHelpingMarker = null;
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
if ( !mBitmapFrames.isEmpty() ) {
|
||||
for ( Bitmap bitmapFrame : mBitmapFrames ) {
|
||||
if ( bitmapFrame != null && !bitmapFrame.isRecycled() ) {
|
||||
if (!mBitmapFrames.isEmpty()) {
|
||||
for (Bitmap bitmapFrame : mBitmapFrames) {
|
||||
if (bitmapFrame != null && !bitmapFrame.isRecycled()) {
|
||||
bitmapFrame.recycle();
|
||||
}
|
||||
}
|
||||
mBitmapFrames.clear();
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation( true );
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.module.service.ttsConfig;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.module.service.network.bean.TtsConfigEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
* @author :zhuangyan
|
||||
* @date : 2020/11/16 15:09
|
||||
* @desc :
|
||||
*/
|
||||
public interface TtsConfigApiService {
|
||||
/**
|
||||
* 查询语音Tts 的
|
||||
*
|
||||
*/
|
||||
@GET("/yycp-carDataService/car/ttsWord/no/getTTSWord/v1")
|
||||
Observable<TtsConfigEntity> inquireForTts();
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.mogo.module.service.ttsConfig;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.network.bean.TtsConfigEntity;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.commons.AbsMogoApplication.getApp;
|
||||
|
||||
/**
|
||||
* @author :zhuangyan
|
||||
* @date : 2020/11/16 15:04
|
||||
* @desc :
|
||||
*/
|
||||
public class TtsConfigModleData {
|
||||
private static final String TAG = "TrafficModelData";
|
||||
private final TtsConfigApiService mTtsConfigApiService;
|
||||
|
||||
|
||||
public TtsConfigModleData() {
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(getApp().getApplicationContext());
|
||||
mTtsConfigApiService = network.create(TtsConfigApiService.class, RefreshModel.getNetHost());
|
||||
}
|
||||
|
||||
/**
|
||||
* 独立app根据后台配置 播放tts
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @param
|
||||
*/
|
||||
public void playTts() {
|
||||
|
||||
if (DebugConfig.isLauncher()) {
|
||||
return;
|
||||
}
|
||||
mTtsConfigApiService.inquireForTts()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<TtsConfigEntity>(RequestOptions.create(getApp().getApplicationContext())) {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Log.e("zytest", e.toString());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(TtsConfigEntity o) {
|
||||
super.onSuccess(o);
|
||||
Log.e("zytest", "播放语音了====" + o.getResult().getWord());
|
||||
if (!TextUtils.isEmpty(o.getResult().getWord())) {
|
||||
AIAssist.getInstance(getApp().getApplicationContext()).speakTTSVoice(o.getResult().getWord());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mogo.module.service.ttsConfig;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.bean.TtsConfigEntity;
|
||||
|
||||
/**
|
||||
* @author :zhuangyan
|
||||
* @date : 2020/11/16 15:01
|
||||
* @desc :进入页面的时候 根据配置 播放tts语音
|
||||
*/
|
||||
@Route(path = ServiceConst.PATH_TTS_CONFIG)
|
||||
public class TtsConfigProvider implements IProvider {
|
||||
private final String TAG = "TtsConfigProvider";
|
||||
private Context mContext;
|
||||
private TtsConfigModleData mTtsModleData;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
mContext = context;
|
||||
Log.d(TAG, "TtsConfigProvider provider init……");
|
||||
if (mTtsModleData == null) {
|
||||
mTtsModleData = new TtsConfigModleData();
|
||||
}
|
||||
|
||||
mTtsModleData.playTts();
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,14 @@ public class GlobalUnwakeConst {
|
||||
*/
|
||||
public static final String UNWAKE_UPLOAD_REAL_TIME_TRAFFIC = "command_upload_real_time_traffic";
|
||||
|
||||
/**
|
||||
* 唤醒词查询出行动态
|
||||
*/
|
||||
public static final String VOICE_QUERY_HISTORY_INDEX = "com.zhidao.query.trip.event";
|
||||
/**
|
||||
* 唤醒词查询周边事件
|
||||
*/
|
||||
public static final String VOICE_QUERY_SURROUNDING_INDEX = "com.zhidao.query.nearby.event";
|
||||
/**
|
||||
* 唤醒词查询热心指数
|
||||
*/
|
||||
|
||||
@@ -23,6 +23,8 @@ import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_PUB_ROA
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_PUB_TROUBLE_HELP;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_SHARE_DIALOG_CLOSE;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_HEART_INDEX;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_HISTORY_INDEX;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_SURROUNDING_INDEX;
|
||||
|
||||
/**
|
||||
* 全局免唤醒管理
|
||||
@@ -48,6 +50,8 @@ public class GlobalUnwakeManager implements IProvider, IMogoIntentListener, IMog
|
||||
intentManager.registerIntentListener(VOICE_CMD_NO_REPLY_SHARE_DIALOG_CLOSE, this);
|
||||
intentManager.registerIntentListener(UNWAKE_UPLOAD_ROAD_CONDITION, this);
|
||||
intentManager.registerIntentListener(VOICE_QUERY_HEART_INDEX, this);
|
||||
intentManager.registerIntentListener(VOICE_QUERY_HISTORY_INDEX, this);
|
||||
intentManager.registerIntentListener(VOICE_QUERY_SURROUNDING_INDEX, this);
|
||||
|
||||
// 免唤醒词注册,全局免唤醒
|
||||
AIAssist.getInstance(context).registerUnWakeupCommand(UNWAKE_UPLOAD_REAL_TIME_TRAFFIC,
|
||||
@@ -68,6 +72,16 @@ public class GlobalUnwakeManager implements IProvider, IMogoIntentListener, IMog
|
||||
case UNWAKE_UPLOAD_ROAD_CONDITION:
|
||||
MogoApisHandler.getInstance().getApis().getShareManager().onGlobalUnwake(intentStr, intent);
|
||||
break;
|
||||
case VOICE_QUERY_HISTORY_INDEX:
|
||||
Intent startForHis = new Intent( Intent.ACTION_VIEW );
|
||||
startForHis.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
startForHis.setData( Uri.parse( "mogo://launcher/main/switch2?type=showHistoryPanel" ) );
|
||||
context.startActivity( startForHis );
|
||||
case VOICE_QUERY_SURROUNDING_INDEX:
|
||||
Intent startForSurrounding = new Intent( Intent.ACTION_VIEW );
|
||||
startForSurrounding.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
startForSurrounding.setData( Uri.parse( "mogo://launcher/main/switch2?type=showSurroundingPanel" ) );
|
||||
context.startActivity( startForSurrounding );
|
||||
case VOICE_QUERY_HEART_INDEX:
|
||||
Intent start = new Intent( Intent.ACTION_VIEW );
|
||||
start.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
|
||||
Reference in New Issue
Block a user