1. 小智动画切换逻辑修改
2. 独立app卡片刷新次数限制 3. 其他优化
This commit is contained in:
@@ -25,7 +25,6 @@ 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;
|
||||
@@ -33,6 +32,7 @@ import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -54,6 +54,8 @@ class LauncherCardRefresher {
|
||||
public static final String KEY_LauncherCardTipLastTipTime = "LauncherCardTipLastTipTime";
|
||||
|
||||
public static final String KEY_LAST_LOAD_TTS_TYPE = "keyLastLoadTtsType";
|
||||
public static final String KEY_LAST_LOAD_TTS_DATE = "keyLastLoadTtsDate";
|
||||
|
||||
|
||||
private static volatile LauncherCardRefresher sInstance;
|
||||
|
||||
@@ -374,9 +376,20 @@ class LauncherCardRefresher {
|
||||
*/
|
||||
private void requestTtsStrategyConfig() {
|
||||
|
||||
long lastPlayDateTime = SharedPrefsMgr.getInstance( mContext ).getLong( KEY_LAST_LOAD_TTS_DATE, 0L );
|
||||
if ( lastPlayDateTime != 0 ) {
|
||||
Date lastPlayDate = new Date( lastPlayDateTime );
|
||||
if ( lastPlayDate.getDate() == new Date( System.currentTimeMillis() ).getDate() ) {
|
||||
Logger.d( TAG, "一天只播报一次" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String name = SharedPrefsMgr.getInstance( mContext ).getString( KEY_LAST_LOAD_TTS_TYPE, LauncherCardRefreshType.Weather.name() );
|
||||
LauncherCardRefreshType type = LauncherCardRefreshType.valueOf( name );
|
||||
|
||||
Logger.d( TAG, "本次播报:%s", name );
|
||||
|
||||
MogoLocation location = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient( mContext ).getLastKnowLocation();
|
||||
TtsConfigBody body = new TtsConfigBody()
|
||||
.addType( LauncherCardRefreshType.NearRoads.getVal() )
|
||||
@@ -395,6 +408,7 @@ class LauncherCardRefresher {
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "queryBroadCastInfo" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -469,6 +483,7 @@ class LauncherCardRefresher {
|
||||
break;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "header = %s", header.type.getVal() );
|
||||
TtsConfigNode pointer = header;
|
||||
|
||||
do {
|
||||
@@ -561,13 +576,13 @@ class LauncherCardRefresher {
|
||||
* @return
|
||||
*/
|
||||
private boolean handleExplorerWayTtsConfig( TtsConfigData.OnlineCarVsExplorerWay explorerWay ) {
|
||||
if ( explorerWay == null || explorerWay.pois == 0 ) {
|
||||
if ( explorerWay == null || explorerWay.poiTotal == 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 );
|
||||
speakTTS( String.format( tts, explorerWay.poiTotal, LauncherCardRefreshType.ExplorerWay.getDesc() ), false );
|
||||
notifyRefreshChanged( String.format( info, explorerWay.poiTotal, LauncherCardRefreshType.ExplorerWay ), explorerWay.poiTotal, tts );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -578,13 +593,13 @@ class LauncherCardRefresher {
|
||||
* @return
|
||||
*/
|
||||
private boolean handleOnlineCarTtsConfig( TtsConfigData.OnlineCarVsExplorerWay onlineCar ) {
|
||||
if ( onlineCar == null || onlineCar.friends == 0 ) {
|
||||
if ( onlineCar == null || onlineCar.carTotal == 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 );
|
||||
speakTTS( String.format( tts, onlineCar.carTotal, LauncherCardRefreshType.OnlineCar.getDesc() ), false );
|
||||
notifyRefreshChanged( String.format( info, onlineCar.carTotal, LauncherCardRefreshType.OnlineCar ), onlineCar.carTotal, tts );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -595,7 +610,8 @@ class LauncherCardRefresher {
|
||||
*/
|
||||
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() );
|
||||
Logger.d( TAG, "本次播报:%s,下次播报:%s", type.name(), LauncherCardRefreshType.valueOf( type.getNext() ).name() );
|
||||
SharedPrefsMgr.getInstance( mContext ).putLong( KEY_LAST_LOAD_TTS_DATE, System.currentTimeMillis() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,6 @@ public interface RefreshApiService {
|
||||
Observable< HomeCompanyDistanceForPushResponse > calculationNotHomeCompanyDistanceForPush( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/appCard/queryBroadCastInfo" )
|
||||
@POST( "/yycp-launcherSnapshot/appCard/queryAppCardData" )
|
||||
Observable< TtsConfigData > queryBroadCastInfo( @FieldMap Map< String, Object > parameters );
|
||||
}
|
||||
|
||||
@@ -31,20 +31,14 @@ class TtsConfigData extends BaseData {
|
||||
}
|
||||
|
||||
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 String cityName;
|
||||
public String cityId;
|
||||
public String weather;
|
||||
public int hour;
|
||||
public int weatherCode;
|
||||
public double weatherTime;
|
||||
public int alarmLevel;
|
||||
public int alarmType;
|
||||
}
|
||||
|
||||
public static class News extends BaseConfig {
|
||||
@@ -78,12 +72,12 @@ class TtsConfigData extends BaseData {
|
||||
/**
|
||||
* 车友数量
|
||||
*/
|
||||
public int friends;
|
||||
public int carTotal;
|
||||
|
||||
/**
|
||||
* 道路事件数量
|
||||
*/
|
||||
public int pois;
|
||||
public int poiTotal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user