1. 小智动画切换逻辑修改
2. 独立app卡片刷新次数限制 3. 其他优化
This commit is contained in:
@@ -30,7 +30,7 @@ dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
// 上报位置
|
||||
implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.3'
|
||||
implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.7'
|
||||
// 长链
|
||||
implementation 'com.zhidao.socket:built-in-socket:1.0.15'
|
||||
// passport
|
||||
|
||||
@@ -13,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.apps.adapter.AppIndicatorAdapter;
|
||||
import com.mogo.module.apps.anim.AnimRes;
|
||||
import com.mogo.module.apps.anim.AnimWrapper;
|
||||
import com.mogo.module.apps.applaunch.AppLauncher;
|
||||
import com.mogo.module.apps.applaunch.BaseAppLauncher;
|
||||
@@ -45,7 +46,7 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
|
||||
private ImageView mAIAssist;
|
||||
private View mAIAssistContainer;
|
||||
private AnimWrapper mAnim = new AnimWrapper();
|
||||
private AnimWrapper mAnim;
|
||||
|
||||
private BaseAppLauncher mLauncher;
|
||||
|
||||
@@ -71,7 +72,13 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
|
||||
mAIAssistContainer = findViewById( R.id.module_apps_id_ai_assist_container );
|
||||
mAIAssist = findViewById( R.id.module_apps_id_ai_assist );
|
||||
mAnim.initAnim( mAIAssist );
|
||||
|
||||
mAnim = new AnimWrapper( mAIAssist );
|
||||
boolean naviStatus = AppServiceHandler.getApis().getMapServiceApi().getNavi( getContext() ).isNaviing();
|
||||
if ( naviStatus ) {
|
||||
setCurrentXiaoZhiEmoji( AnimRes.EmojiType.Navigation );
|
||||
}
|
||||
|
||||
mAIAssist.setOnClickListener( new OnAiAssistClickListener() );
|
||||
mAIAssistContainer.setOnClickListener( view -> {
|
||||
mAIAssist.performClick();
|
||||
@@ -100,6 +107,16 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
mAppIndicatorAdapter.setDatas( NavigatorApps.getApps() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentXiaoZhiEmoji( AnimRes.EmojiType type ) {
|
||||
boolean started = mAnim.isStarted();
|
||||
mAnim.stop();
|
||||
mAnim.setCurrentAnim( type );
|
||||
if ( started ) {
|
||||
mAnim.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -157,6 +174,9 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
if ( mPresenter != null ) {
|
||||
mPresenter.onDestroy( getViewLifecycleOwner() );
|
||||
}
|
||||
if ( mAnim != null ) {
|
||||
mAnim.release();
|
||||
}
|
||||
AppServiceHandler.getApis().getFragmentManagerApi().removeMainFragmentStackTransactionListener( this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,11 @@ import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.module.apps.anim.AnimRes;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
@@ -26,7 +29,8 @@ import org.json.JSONObject;
|
||||
*/
|
||||
public class AppNavigatorPresenter extends Presenter< AppNavigatorView > implements IMogoIntentListener,
|
||||
IMogoVoiceCmdCallBack,
|
||||
IMogoNaviListener2 {
|
||||
IMogoNaviListener2,
|
||||
IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "AppNavigatorPresenter";
|
||||
|
||||
@@ -42,6 +46,7 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
|
||||
// 预加载应用列表,空间换时间
|
||||
AppsModel.getInstance( getContext() ).load( null );
|
||||
}
|
||||
AppServiceHandler.getApis().getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.MEDIA_PLAYER_STATUS, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,15 +122,38 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
|
||||
super.onDestroy( owner );
|
||||
AppServiceHandler.getApis().getRegisterCenterApi().unregisterMogoNaviListener( TAG );
|
||||
AppServiceHandler.getApis().getIntentManagerApi().unregisterIntentListener( AppsConst.COMMAND_OPERATION, this );
|
||||
AppServiceHandler.getApis().getStatusManagerApi().unregisterStatusChangedListener( TAG, StatusDescriptor.MEDIA_PLAYER_STATUS, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
mView.hideNavigationEntrance();
|
||||
mView.setCurrentXiaoZhiEmoji( AnimRes.EmojiType.Navigation );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
mView.showNavigationEntrance();
|
||||
if ( AppServiceHandler.getApis().getStatusManagerApi().isMediaPlaying() ) {
|
||||
mView.setCurrentXiaoZhiEmoji( AnimRes.EmojiType.Music );
|
||||
} else {
|
||||
mView.setCurrentXiaoZhiEmoji( AnimRes.EmojiType.Others );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( descriptor != StatusDescriptor.MEDIA_PLAYER_STATUS ) {
|
||||
return;
|
||||
}
|
||||
if ( AppServiceHandler.getApis().getMapServiceApi().getNavi( getContext() ).isNaviing() ) {
|
||||
// 导航优先级更高
|
||||
return;
|
||||
}
|
||||
if ( isTrue ) {
|
||||
mView.setCurrentXiaoZhiEmoji( AnimRes.EmojiType.Music );
|
||||
} else {
|
||||
mView.setCurrentXiaoZhiEmoji( AnimRes.EmojiType.Others );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.apps;
|
||||
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.module.apps.anim.AnimRes;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -19,4 +20,11 @@ public interface AppNavigatorView extends IView {
|
||||
void hideNavigationEntrance();
|
||||
|
||||
void showNavigationEntrance();
|
||||
|
||||
/**
|
||||
* 设置当前小智形象表情
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
void setCurrentXiaoZhiEmoji( AnimRes.EmojiType type );
|
||||
}
|
||||
|
||||
@@ -11,4 +11,8 @@ public interface Anim {
|
||||
void start();
|
||||
|
||||
void stop();
|
||||
|
||||
void setCurrentAnim( AnimRes.EmojiType type );
|
||||
|
||||
void release();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,21 @@ import com.mogo.module.apps.R;
|
||||
*/
|
||||
public class AnimRes {
|
||||
|
||||
public static final int sRes[] = {
|
||||
public enum EmojiType {
|
||||
Navigation,
|
||||
Music,
|
||||
Others
|
||||
}
|
||||
|
||||
public static final int sNavigation[] = {
|
||||
|
||||
};
|
||||
|
||||
public static final int sMusic[] = {
|
||||
|
||||
};
|
||||
|
||||
public static final int sAll[][] = new int[][]{{
|
||||
R.drawable.mogo_tts_icon_00000,
|
||||
R.drawable.mogo_tts_icon_00001,
|
||||
R.drawable.mogo_tts_icon_00002,
|
||||
@@ -23,7 +37,8 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00008,
|
||||
R.drawable.mogo_tts_icon_00009,
|
||||
R.drawable.mogo_tts_icon_00010,
|
||||
R.drawable.mogo_tts_icon_00011,
|
||||
R.drawable.mogo_tts_icon_00011
|
||||
}, {
|
||||
R.drawable.mogo_tts_icon_00012,
|
||||
R.drawable.mogo_tts_icon_00013,
|
||||
R.drawable.mogo_tts_icon_00014,
|
||||
@@ -35,7 +50,8 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00020,
|
||||
R.drawable.mogo_tts_icon_00021,
|
||||
R.drawable.mogo_tts_icon_00022,
|
||||
R.drawable.mogo_tts_icon_00023,
|
||||
R.drawable.mogo_tts_icon_00023
|
||||
}, {
|
||||
R.drawable.mogo_tts_icon_00024,
|
||||
R.drawable.mogo_tts_icon_00025,
|
||||
R.drawable.mogo_tts_icon_00026,
|
||||
@@ -47,7 +63,8 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00032,
|
||||
R.drawable.mogo_tts_icon_00033,
|
||||
R.drawable.mogo_tts_icon_00034,
|
||||
R.drawable.mogo_tts_icon_00035,
|
||||
R.drawable.mogo_tts_icon_00035
|
||||
}, {
|
||||
R.drawable.mogo_tts_icon_00036,
|
||||
R.drawable.mogo_tts_icon_00037,
|
||||
R.drawable.mogo_tts_icon_00038,
|
||||
@@ -59,7 +76,8 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00044,
|
||||
R.drawable.mogo_tts_icon_00045,
|
||||
R.drawable.mogo_tts_icon_00046,
|
||||
R.drawable.mogo_tts_icon_00047,
|
||||
R.drawable.mogo_tts_icon_00047
|
||||
}, {
|
||||
R.drawable.mogo_tts_icon_00048,
|
||||
R.drawable.mogo_tts_icon_00049,
|
||||
R.drawable.mogo_tts_icon_00050,
|
||||
@@ -71,7 +89,8 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00056,
|
||||
R.drawable.mogo_tts_icon_00057,
|
||||
R.drawable.mogo_tts_icon_00058,
|
||||
R.drawable.mogo_tts_icon_00059,
|
||||
R.drawable.mogo_tts_icon_00059
|
||||
}, {
|
||||
R.drawable.mogo_tts_icon_00060,
|
||||
R.drawable.mogo_tts_icon_00061,
|
||||
R.drawable.mogo_tts_icon_00062,
|
||||
@@ -80,5 +99,7 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00065,
|
||||
R.drawable.mogo_tts_icon_00066,
|
||||
R.drawable.mogo_tts_icon_00067
|
||||
};
|
||||
}};
|
||||
|
||||
public static int sRes[] = sAll[0];
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package com.mogo.module.apps.anim;
|
||||
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -18,20 +14,14 @@ import com.mogo.utils.logger.Logger;
|
||||
public class AnimWrapper implements Anim {
|
||||
|
||||
private static final String TAG = "AnimWrapper";
|
||||
private ImageView mTarget;
|
||||
private Anim mDelegate;
|
||||
private boolean mIsStarted = false;
|
||||
|
||||
public AnimWrapper() {
|
||||
}
|
||||
|
||||
public void initAnim( ImageView target ) {
|
||||
mTarget = target;
|
||||
public AnimWrapper( ImageView target ) {
|
||||
if ( CarSeries.isF8xxSeries() ) {
|
||||
mDelegate = new OthersAnim( target );
|
||||
start();
|
||||
} else {
|
||||
mTarget.setImageResource( R.drawable.mogo_tts_icon_00000 );
|
||||
mDelegate = new KitkatAnim( target );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +43,22 @@ public class AnimWrapper implements Anim {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentAnim( AnimRes.EmojiType type ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setCurrentAnim( type );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isStarted() {
|
||||
return mIsStarted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.release();
|
||||
}
|
||||
mDelegate = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,40 @@
|
||||
package com.mogo.module.apps.anim;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.module.apps.R;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-26
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class KitkatAnim implements Anim{
|
||||
public class KitkatAnim implements Anim {
|
||||
|
||||
private ImageView mTarget;
|
||||
|
||||
public KitkatAnim( ImageView target ) {
|
||||
this.mTarget = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
||||
mTarget.setImageResource( R.drawable.mogo_tts_icon_00000 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentAnim( AnimRes.EmojiType type ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
mTarget = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,17 +9,20 @@ import android.widget.ImageView;
|
||||
* @author congtaowang
|
||||
* @since 2020-02-26
|
||||
* <p>
|
||||
* 描述
|
||||
* 导航>音乐>其他(自己轮询)
|
||||
*/
|
||||
public class OthersAnim implements Anim {
|
||||
|
||||
private int mStartIndex = 0;
|
||||
|
||||
private final static int MSG_LOOP = 3003;
|
||||
public static final int MSG_CHANGE = 3004;
|
||||
public static final long INTERVAL = 100L;
|
||||
private boolean mStarted = false;
|
||||
|
||||
private final ImageView mImageView;
|
||||
private ImageView mImageView;
|
||||
|
||||
private int mEmojiIndex = 0;
|
||||
|
||||
private Handler mHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
@@ -28,27 +31,80 @@ public class OthersAnim implements Anim {
|
||||
switch ( msg.what ) {
|
||||
case MSG_LOOP:
|
||||
if ( mStarted ) {
|
||||
if ( AnimRes.sRes.length == 0 ) {
|
||||
return;
|
||||
}
|
||||
mImageView.setImageResource( AnimRes.sRes[mStartIndex++ % AnimRes.sRes.length] );
|
||||
mHandler.sendEmptyMessageDelayed( MSG_LOOP, INTERVAL );
|
||||
}
|
||||
break;
|
||||
case MSG_CHANGE:
|
||||
if ( mLastType == AnimRes.EmojiType.Others ) {
|
||||
boolean start = mStarted;
|
||||
stop();
|
||||
mEmojiIndex++;
|
||||
AnimRes.sRes = AnimRes.sAll[mEmojiIndex % AnimRes.sAll.length];
|
||||
mStartIndex = 0;
|
||||
if ( start ) {
|
||||
start();
|
||||
}
|
||||
mHandler.sendEmptyMessageDelayed( MSG_CHANGE, 60 * 1_000L );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private AnimRes.EmojiType mLastType;
|
||||
|
||||
public OthersAnim( ImageView imageView ) {
|
||||
this.mImageView = imageView;
|
||||
mLastType = AnimRes.EmojiType.Others;
|
||||
AnimRes.sRes = AnimRes.sAll[mEmojiIndex];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if ( mStarted ) {
|
||||
return;
|
||||
}
|
||||
mStarted = true;
|
||||
mHandler.sendEmptyMessage( MSG_LOOP );
|
||||
mHandler.sendEmptyMessageDelayed( MSG_CHANGE, 60 * 1_000L );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
mStarted = false;
|
||||
mHandler.removeMessages( MSG_LOOP );
|
||||
mHandler.removeMessages( MSG_CHANGE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentAnim( AnimRes.EmojiType type ) {
|
||||
if ( mLastType == type ) {
|
||||
return;
|
||||
}
|
||||
mLastType = type;
|
||||
switch ( type ) {
|
||||
case Navigation:
|
||||
mStartIndex = 0;
|
||||
AnimRes.sRes = AnimRes.sNavigation;
|
||||
break;
|
||||
case Music:
|
||||
mStartIndex = 0;
|
||||
AnimRes.sRes = AnimRes.sMusic;
|
||||
break;
|
||||
case Others:
|
||||
mHandler.sendEmptyMessageDelayed( MSG_CHANGE, 0 * 1_000L );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
stop();
|
||||
mHandler = null;
|
||||
mImageView = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ class StrategyShareProvider : IProvider {
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logger.e(S_TAG, e, "解析adas数据异常")
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -101,7 +101,11 @@ public class MogoADASController implements IMogoADASController {
|
||||
public void sendMsg(String msg) {
|
||||
Logger.d(TAG, "收到adas数据回调: " + msg);
|
||||
for (IMogoAdasDataCallback callback : adasDataCallbackList) {
|
||||
callback.onAdasDataCallback(msg);
|
||||
try {
|
||||
callback.onAdasDataCallback(msg);
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "sendMsg" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user