Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wangcongtao
2020-09-23 17:39:05 +08:00
5 changed files with 75 additions and 75 deletions

View File

@@ -200,18 +200,18 @@ class MainService : Service() {
}
private fun sendMarkerInfoReceiver(lat: Double, lon: Double, imageUrl: String?, type: String?) {
Log.e("MainService", "sendMarkerInfoReceiver ------> type = $type ")
Log.e("MainService", "sendMarkerInfoReceiver ------> fromType = $fromType ")
Log.e("MainService", "sendMarkerInfoReceiver ------> isCustom = $isCustom ")
var intent = Intent()
intent.action = "com.zhidao.roadcondition.marker.info"
intent.putExtra("type", type)
intent.putExtra("imageUrl", imageUrl)
intent.putExtra("lat", lat)
intent.putExtra("lon", lon)
intent.putExtra("custom", isCustom)
intent.putExtra("fromType", fromType)
sendBroadcast(intent)
// Log.e("MainService", "sendMarkerInfoReceiver ------> type = $type ")
// Log.e("MainService", "sendMarkerInfoReceiver ------> fromType = $fromType ")
// Log.e("MainService", "sendMarkerInfoReceiver ------> isCustom = $isCustom ")
// var intent = Intent()
// intent.action = "com.zhidao.roadcondition.marker.info"
// intent.putExtra("type", type)
// intent.putExtra("imageUrl", imageUrl)
// intent.putExtra("lat", lat)
// intent.putExtra("lon", lon)
// intent.putExtra("custom", isCustom)
// intent.putExtra("fromType", fromType)
// sendBroadcast(intent)
}
/**

View File

@@ -82,6 +82,7 @@ import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUID
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE_TIME;
import static com.mogo.module.share.constant.ShareConstants.ONE_DAY_TIME;
import static com.mogo.module.share.constant.ShareConstants.SEVEN_DAY_TIME;
import static com.mogo.module.share.constant.ShareConstants.VOICE_ALERT_COUNT;
/**
* @author congtaowang
@@ -352,10 +353,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
debugTopView();
UiThreadHandler.postDelayed(() -> {
playShareOuterGuideVoice();
}, 5_000L
);
boolean isShowGuide = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(DebugConfig.getSpGuide(), false);
Logger.d(TAG, " isShowGuide = " + isShowGuide);
if (isShowGuide) {
UiThreadHandler.postDelayed(() -> {
playShareOuterGuideVoice();
}, 5_000L
);
}
}
Random random = new Random();
@@ -366,25 +371,23 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private void playShareOuterGuideVoice() {
long intervalTime = SharedPrefsMgr.getInstance(getContext()).getLong(KEY_SHARE_OUTER_GUIDE_TIME, 0);
int shareItemSum = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_SHARE_OUTER_GUIDE, 0);
int serverIssueCount = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_SERVER_SHOW_DAY_COUNT, 0); //TODO 默认6
Log.d(TAG, " playShareOuterGuideVoice shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + "----serverIssueCount = " + serverIssueCount);
int serverIssueCount = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_SERVER_SHOW_DAY_COUNT, 6);
if (shareItemSum < serverIssueCount) {
long time = System.currentTimeMillis();
Log.d(TAG, "playShareOuterGuideVoice time = " + time);
Logger.d(TAG, " playShareOuterGuideVoice shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + "----serverIssueCount = " + serverIssueCount + "---time = " + time);
if (intervalTime == 0) {
Log.d(TAG, " playShareOuterGuideVoice -----1-----");
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_OUTER_GUIDE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_OUTER_GUIDE, ++shareItemSum);
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[random.nextInt(3)]);
} else {
Log.d(TAG, " playShareOuterGuideVoice else interval = " + (time - intervalTime));
Logger.d(TAG, " playShareOuterGuideVoice else interval = " + (time - intervalTime));
if ((time - intervalTime) > SEVEN_DAY_TIME) {
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_OUTER_GUIDE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_OUTER_GUIDE, ++shareItemSum);
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[random.nextInt(3)]);
} else {
Log.e(TAG, " playShareOuterGuideVoice else < ONE_DAY_TIME ");
Logger.e(TAG, " playShareOuterGuideVoice else < ONE_DAY_TIME ");
}
}
}
@@ -394,24 +397,21 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private void playShareGuideVoice() {
long intervalTime = SharedPrefsMgr.getInstance(getContext()).getLong(KEY_CLICK_SHARE_TIME, 0);
int shareItemSum = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_CLICK_SHARE_BUTTON, 0);
Log.d(TAG, " playShareGuideVoice shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime);
if (shareItemSum < 3) {
if (shareItemSum < VOICE_ALERT_COUNT) {
long time = System.currentTimeMillis();
Log.d(TAG, "playShareGuideVoice time = " + time);
Logger.d(TAG, " playShareGuideVoice shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + ">>> time = " + time);
if (intervalTime == 0) {
Log.d(TAG, " playShareGuideVoice -----1-----");
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_CLICK_SHARE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_CLICK_SHARE_BUTTON, ++shareItemSum);
AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[0]);
} else {
Log.d(TAG, " playShareGuideVoice else interval = " + (time - intervalTime));
Logger.d(TAG, " playShareGuideVoice else interval = " + (time - intervalTime));
if ((time - intervalTime) > ONE_DAY_TIME) {
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_CLICK_SHARE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_CLICK_SHARE_BUTTON, ++shareItemSum);
AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[1]);
} else {
Log.e(TAG, " playShareGuideVoice else < ONE_DAY_TIME ");
Logger.e(TAG, " playShareGuideVoice else < ONE_DAY_TIME ");
}
}
}
@@ -428,17 +428,15 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
public void onMapChanged(MogoLatLng latLng, float zoom, float tilt, float bearing) {
long intervalTime = SharedPrefsMgr.getInstance(getContext()).getLong(KEY_SHARE_INNER_GUIDE_TIME, 0);
int shareItemSum = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_SHARE_INNER_GUIDE, 0);
Log.d(TAG, " onMapChanged shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime);
if (shareItemSum < 3) {
if (shareItemSum < VOICE_ALERT_COUNT) {
long time = System.currentTimeMillis();
Log.d(TAG, "onMapChanged time = " + time);
Logger.d(TAG, " onMapChanged shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + "---time = " + time);
if (intervalTime == 0) {
Log.d(TAG, " onMapChanged -----1-----");
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_INNER_GUIDE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_INNER_GUIDE, ++shareItemSum);
AIAssist.getInstance(getContext()).speakTTSVoice(mInnerGuideVoiceStrings[0]);
} else {
Log.d(TAG, " onMapChanged else interval = " + (time - intervalTime));
Logger.d(TAG, " onMapChanged else interval = " + (time - intervalTime));
if ((time - intervalTime) > ONE_DAY_TIME) {
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_INNER_GUIDE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_INNER_GUIDE, ++shareItemSum);
@@ -448,7 +446,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
AIAssist.getInstance(getContext()).speakTTSVoice(mInnerGuideVoiceStrings[2]);
}
} else {
Log.e(TAG, " onMapChanged else < ONE_DAY_TIME ");
Logger.e(TAG, " onMapChanged else < ONE_DAY_TIME ");
}
}
}
@@ -473,6 +471,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
isClickShare = true;
mApis.getShareManager().showShareDialog();
traceData("1");
}
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =

View File

@@ -112,6 +112,8 @@ public class ShareConstants {
public static final String KEY_CLICK_SHARE_ITEM_BUTTON = "KEY_CLICK_SHARE_ITEM_BUTTON";
public static final String KEY_CLICK_SHARE_ITEM_TIME = "KEY_CLICK_SHARE_ITEM_TIME";
public static final int VOICE_ALERT_COUNT = 3;
//1天的毫秒 TODO
public static final long ONE_DAY_TIME = 86400000;
// public static final long ONE_DAY_TIME = 60000;

View File

@@ -2,12 +2,10 @@ package com.mogo.module.share.manager
import android.content.Context
import android.util.Log
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.voice.AIAssist
import com.mogo.map.MogoLatLng
import com.mogo.module.common.entity.MarkerPoiTypeEnum
import com.mogo.module.share.R
import com.mogo.module.share.constant.ShareConstants
import com.mogo.module.share.constant.ShareConstants.*
import com.mogo.service.share.TanluUploadParams
import com.mogo.utils.NetworkUtils
@@ -31,32 +29,7 @@ object UploadHelper {
// if (DebugConfig.getAIType() == DebugConfig.AI_TYPE_TXZ || forcePlayVoice) {
// // 因为思必驰语音分享时,语音助手会自己播报一段文字
//// AIAssist.getInstance(context).speakTTSVoice("感谢分享,正在上传")
//
// var shareItemSum = SharedPrefsMgr.getInstance(context).getInt(KEY_CLICK_SHARE_ITEM_BUTTON, 0)
// var intervalTime = SharedPrefsMgr.getInstance(context).getLong(KEY_CLICK_SHARE_ITEM_TIME, 0)
// Log.d("UploadHelper", "shareItemSum = $shareItemSum --- intervalTime = $intervalTime --type = ${type.eventType}")
//
// if (shareItemSum < 3) {
// var time = System.currentTimeMillis()
// Log.d("UploadHelper", "time = $time ")
// if (intervalTime == 0.toLong()) {
// Log.d("UploadHelper", " -----1-----")
// SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time)
// SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum)
// AIAssist.getInstance(context).speakTTSVoice("下次可以直接对我说 上报" + getTypeName(type.eventType))
// } else {
// Log.d("UploadHelper", " else interval = " + (time - intervalTime))
// if ((time - intervalTime) > ONE_DAY_TIME) {
// SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time)
// SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum)
// AIAssist.getInstance(context).speakTTSVoice("下次可以直接对我说 上报" + getTypeName(type.eventType))
// } else {
// Log.e("UploadHelper", " else < ONE_DAY_TIME ")
// }
// }
// }
// }
//
// val location = ServiceApisManager.serviceApis.mapServiceApi.getSingletonLocationClient(context).lastKnowLocation
// val latLon = MogoLatLng(location.latitude, location.longitude)
// type.location = latLon
@@ -79,6 +52,9 @@ object UploadHelper {
type.location = latLon
Logger.d("UploadHelper", "upload ----> $type")
ServiceApisManager.serviceApis.tanluApi.uploadRoadCondition(type)
//语音播报
showVoiceTip(context, type.eventType)
} else {
// 没网就直接提示失败
AIAssist.getInstance(context).speakTTSVoice("分享失败,请检查网络")
@@ -88,6 +64,31 @@ object UploadHelper {
// }
}
private fun showVoiceTip(context: Context, type: String) {
var shareItemSum = SharedPrefsMgr.getInstance(context).getInt(KEY_CLICK_SHARE_ITEM_BUTTON, 0)
var intervalTime = SharedPrefsMgr.getInstance(context).getLong(KEY_CLICK_SHARE_ITEM_TIME, 0)
if (shareItemSum < VOICE_ALERT_COUNT) {
Log.d("UploadHelper", "shareItemSum = $shareItemSum --- intervalTime = $intervalTime --type = ${type}")
var time = System.currentTimeMillis()
Log.d("UploadHelper", "time = $time ")
if (intervalTime == 0.toLong()) {
SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time)
SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum)
AIAssist.getInstance(context).speakTTSVoice("下次可以直接对我说 上报" + getTypeName(type))
} else {
Log.d("UploadHelper", " else interval = " + (time - intervalTime))
if ((time - intervalTime) > ONE_DAY_TIME) {
SharedPrefsMgr.getInstance(context).putLong(KEY_CLICK_SHARE_ITEM_TIME, time)
SharedPrefsMgr.getInstance(context).putInt(KEY_CLICK_SHARE_ITEM_BUTTON, ++shareItemSum)
AIAssist.getInstance(context).speakTTSVoice("下次可以直接对我说 上报" + getTypeName(type))
} else {
Log.e("UploadHelper", " else < ONE_DAY_TIME ")
}
}
}
}
private fun getTypeName(type: String): String? {
var typeName = ""
typeName = when (type) {

View File

@@ -13,17 +13,15 @@ import org.greenrobot.eventbus.EventBus
*/
class MarkerInfoReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == "com.zhidao.roadcondition.marker.info"){
var type = intent.getStringExtra("type")
var fromType = intent.getStringExtra("fromType")
var imageUrl = intent.getStringExtra("imageUrl")
var lat = intent.getDoubleExtra("lat",0.0)
var lon = intent.getDoubleExtra("lon",0.0) //经度
var custom = intent.getBooleanExtra("custom", false)
Log.d("MarkerInfoReceiver", "type =" + type + "---->lat =" + lat + "----lon =" + lon + " --custom = " + custom + "---imageUrl =" + imageUrl)
if(DebugConfig.isLauncher()) {
EventBus.getDefault().post(MarkerInfo(type, imageUrl, lon, lat, custom, fromType))
}
}
// if (intent.action == "com.zhidao.roadcondition.marker.info"){
// var type = intent.getStringExtra("type")
// var fromType = intent.getStringExtra("fromType")
// var imageUrl = intent.getStringExtra("imageUrl")
// var lat = intent.getDoubleExtra("lat",0.0)
// var lon = intent.getDoubleExtra("lon",0.0) //经度
// var custom = intent.getBooleanExtra("custom", false)
// Log.d("MarkerInfoReceiver", "type =" + type + "---->lat =" + lat + "----lon =" + lon + " --custom = " + custom + "---imageUrl =" + imageUrl)
// EventBus.getDefault().post(MarkerInfo(type, imageUrl, lon, lat, custom, fromType))
// }
}
}