[add] TTS播报我的分享-每天首次开启
This commit is contained in:
@@ -24,8 +24,8 @@ import com.mogo.module.v2x.view.V2XEventPanelHistoryCountView
|
||||
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener
|
||||
import com.mogo.module.v2x.voice.V2XVoiceConstants
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager
|
||||
import com.mogo.service.eventpanel.IEventPanelProvider
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
|
||||
|
||||
/**
|
||||
@@ -52,6 +52,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
private var mRbScenarioHistory: RadioButton? = null
|
||||
private var mRbSurroundingEvent: RadioButton? = null
|
||||
private var mRbShareEvents: RadioButton? = null
|
||||
private var todayFirstForShared: String? = ""
|
||||
|
||||
private val mV2XScenarioHistoryFragment = V2XScenarioHistoryFragment()
|
||||
private val mV2XShareEventsFragment = V2XShareEventsFragment()
|
||||
|
||||
@@ -87,7 +87,7 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
animatioonAction(View.VISIBLE);
|
||||
animationAction(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -144,7 +144,7 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
int shareNum = resultData.getResult().getEnthusiasmIndex().getShareNum();
|
||||
int approveNum = resultData.getResult().getEnthusiasmIndex().getLikeNum();
|
||||
double enthusiasm = resultData.getResult().getEnthusiasmIndex().getEnthusiasmIndex();
|
||||
Log.d(TAG, String.valueOf(enthusiasm)+"TTS播报热心指数个数");
|
||||
Log.d(TAG, String.valueOf(enthusiasm) + "TTS播报热心指数个数");
|
||||
String ttsString = "";
|
||||
if (enthusiasm <= 2) {
|
||||
ttsString = "您目前已完成" + shareNum + "次分享,获得" + approveNum + "次车友认同,热心指数" + enthusiasm
|
||||
@@ -164,7 +164,8 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
* 我的分享列表数据处理
|
||||
* */
|
||||
private void loadSuccessWithShareEventList(Object result) {
|
||||
animatioonAction(View.GONE);
|
||||
|
||||
animationAction(View.GONE);
|
||||
V2XShareEventItem resultData = (V2XShareEventItem) result;
|
||||
V2XShareEventLoadMoreItem item = new V2XShareEventLoadMoreItem();
|
||||
if (resultData != null && resultData.getResult() != null) {
|
||||
@@ -211,7 +212,7 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
|
||||
}
|
||||
|
||||
private void animatioonAction(int visible) {
|
||||
private void animationAction(int visible) {
|
||||
if (visible == View.VISIBLE) {
|
||||
if (loadingView != null) {
|
||||
loadingView.start();
|
||||
@@ -227,13 +228,22 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
@Override
|
||||
protected ShareEventsPresenter createPresenter() {
|
||||
Log.d(TAG, "createPresenter");
|
||||
ttsForSharedFirstToday();
|
||||
return new ShareEventsPresenter(this);
|
||||
}
|
||||
|
||||
private void ttsForSharedFirstToday() {
|
||||
boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_SHARED_SELECTED");
|
||||
Log.d(TAG,"shouldBroadTts"+hasBroadTts);
|
||||
if (hasBroadTts == false) {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("您可以在这里查看历史的分享记录", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadMoreShareEventList() {
|
||||
Log.d(TAG, "page--" + pageNum);
|
||||
animatioonAction(View.VISIBLE);
|
||||
animationAction(View.VISIBLE);
|
||||
pageNum += 1;
|
||||
v2XShareNetworkModel.getShareEventList(pageNum, 10, new V2XRefreshCallback() {
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,7 @@ import androidx.core.content.FileProvider;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -31,11 +32,15 @@ import java.io.FileReader;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Time;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -315,6 +320,21 @@ public class V2XUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 当天第一次
|
||||
* */
|
||||
public static boolean isFirstTodayWithKey(String key) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.US);
|
||||
String formatString = format.format(new Date());
|
||||
String value = SharedPrefsMgr.getInstance(V2XUtils.getApp()).getString(key);
|
||||
if (value.equals(formatString)) {
|
||||
return true;
|
||||
} else {
|
||||
SharedPrefsMgr.getInstance(V2XUtils.getApp()).putString(key, formatString);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// TransActivity
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Reference in New Issue
Block a user