Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # modules/mogo-module-extensions/src/main/res/values-mdpi/dimens.xml # modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml # modules/mogo-module-extensions/src/main/res/values/dimens.xml
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.mogo.module.extensions.bean;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/9/22
|
||||
*/
|
||||
public class CommonConfig {
|
||||
|
||||
public Active active;//活动配置
|
||||
public Auth auth; //授权配置
|
||||
public Speech speech; //语音播报次数
|
||||
|
||||
public CommonConfig(Active active, Auth auth, Speech speech) {
|
||||
this.active = active;
|
||||
this.auth = auth;
|
||||
this.speech = speech;
|
||||
}
|
||||
|
||||
public class Active{
|
||||
public String imageUrl;
|
||||
public String webUrl;
|
||||
public int status;
|
||||
|
||||
Active(String imageUrl, String webUrl, int status) {
|
||||
this.imageUrl = imageUrl;
|
||||
this.webUrl = webUrl;
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Speech{
|
||||
public int count;
|
||||
|
||||
Speech(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
||||
public class Auth{
|
||||
int isNeedAuth;
|
||||
|
||||
Auth(int isNeedAuth) {
|
||||
this.isNeedAuth = isNeedAuth;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.module.extensions.bean;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/9/22
|
||||
*/
|
||||
public class CommonConfigResponse extends BaseData {
|
||||
|
||||
public CommonConfig result;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.Intent;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -21,6 +22,8 @@ import com.bumptech.glide.request.RequestOptions;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
@@ -64,11 +67,22 @@ import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE;
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_INNER_GUIDE_TIME;
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_SHARE_OUTER_GUIDE;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-07
|
||||
@@ -123,6 +137,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
private ImageView mUserHeadImg;
|
||||
|
||||
private String[] mClickShareVoiceStrings;
|
||||
|
||||
private String[] mInnerGuideVoiceStrings;
|
||||
|
||||
private String[] mOuterGuideVoiceStrings;
|
||||
|
||||
/**
|
||||
* 搜索莫模块
|
||||
*/
|
||||
@@ -170,6 +190,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mUploading = findViewById(R.id.module_entrance_id_uploading);
|
||||
mUploadRoadCondition.setOnClickListener(view -> {
|
||||
showShareDialog();
|
||||
playShareGuideVoice();
|
||||
});
|
||||
|
||||
mDisplayOverview = findViewById(R.id.module_ext_id_display_overview);
|
||||
@@ -330,8 +351,110 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
dealWeatherContainer();
|
||||
|
||||
debugTopView();
|
||||
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
playShareOuterGuideVoice();
|
||||
}, 5_000L
|
||||
);
|
||||
}
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
/**
|
||||
* 外部触发引导
|
||||
*/
|
||||
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);
|
||||
|
||||
if (shareItemSum < serverIssueCount) {
|
||||
long time = System.currentTimeMillis();
|
||||
Log.d(TAG, "playShareOuterGuideVoice 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));
|
||||
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 ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
long time = System.currentTimeMillis();
|
||||
Log.d(TAG, "playShareGuideVoice 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));
|
||||
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 ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图移动和缩放回调
|
||||
* @param latLng 中点的经纬度
|
||||
* @param zoom 缩放大小
|
||||
* @param tilt 倾斜度
|
||||
* @param bearing 旋转角度
|
||||
*/
|
||||
@Override
|
||||
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) {
|
||||
long time = System.currentTimeMillis();
|
||||
Log.d(TAG, "onMapChanged 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));
|
||||
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);
|
||||
if (shareItemSum == 1) {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mInnerGuideVoiceStrings[1]);
|
||||
} else {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mInnerGuideVoiceStrings[2]);
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, " onMapChanged else < ONE_DAY_TIME ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 由于Launcher和Independent对于天气的表现形式不太一样,所以通过此方法区分处理
|
||||
*/
|
||||
@@ -381,6 +504,13 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.DISPLAY_OVERVIEW, this);
|
||||
|
||||
TopViewAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
|
||||
|
||||
mClickShareVoiceStrings =
|
||||
getContext().getResources().getStringArray(R.array.click_share_voice_guide_array);
|
||||
mInnerGuideVoiceStrings =
|
||||
getContext().getResources().getStringArray(R.array.search_voice_guide_inner_array);
|
||||
mOuterGuideVoiceStrings =
|
||||
getContext().getResources().getStringArray(R.array.search_voice_guide_outer_array);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,9 @@ import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.bean.CommonConfig;
|
||||
import com.mogo.module.extensions.bean.CommonConfigResponse;
|
||||
import com.mogo.module.extensions.net.GetConfigApiServices;
|
||||
import com.mogo.module.extensions.net.UserInfoNetApiServices;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.userinfo.UserInfoConstant;
|
||||
@@ -27,6 +30,7 @@ import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
|
||||
import com.mogo.utils.digest.DigestUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -35,6 +39,9 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
|
||||
import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-07
|
||||
@@ -101,6 +108,7 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
|
||||
// 相当于每次onResume都会请求一下个人信息,目的是能够相对及时的同步手机端的个人信息修改
|
||||
requestUserInfo();
|
||||
}
|
||||
getCommonConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,6 +128,44 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
|
||||
}
|
||||
}
|
||||
|
||||
public void getCommonConfig() {
|
||||
Map<String, Object> params = new ArrayMap<>();
|
||||
params.put("sn", Utils.getSn());
|
||||
|
||||
mNetWork.create(GetConfigApiServices.class, UserInfoConstant.getUserInfoBaseUrl())
|
||||
.getConfig(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SingleObserver<CommonConfigResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CommonConfigResponse config) {
|
||||
Logger.d(TAG, "getCommonConfig onSuccess -----> ");
|
||||
if (config != null && config.result != null) {
|
||||
CommonConfig.Speech speech = config.result.speech;
|
||||
if (speech != null) {
|
||||
Logger.d(TAG, "getCommonConfig onSuccess speech.count = " + speech.count);
|
||||
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SERVER_SHOW_DAY_COUNT, speech.count);
|
||||
} else {
|
||||
Logger.e(TAG, "getCommonConfig onSuccess speech == null ");
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "getCommonConfig onSuccess config == null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
Logger.e(TAG,"getCommonConfig onError ---> e = " + e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private UserInfo userInfo;
|
||||
public void requestUserInfo() {
|
||||
Map<String, String> params = new ArrayMap<>();
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.module.extensions.net;
|
||||
|
||||
import com.mogo.module.extensions.bean.CommonConfig;
|
||||
import com.mogo.module.extensions.bean.CommonConfigResponse;
|
||||
import com.mogo.module.extensions.userinfo.UserInfoResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
/**
|
||||
* 获取配置信息
|
||||
*/
|
||||
public interface GetConfigApiServices {
|
||||
|
||||
@GET("dataService/car/customConfig/no/getAll/v1")
|
||||
Single<CommonConfigResponse> getConfig(@QueryMap Map<String, Object> parameters);
|
||||
|
||||
|
||||
}
|
||||
@@ -479,7 +479,8 @@ public class TopViewAnimHelper {
|
||||
tvNextDistance.getId(), ConstraintSet.LEFT,
|
||||
0);
|
||||
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP, 0);
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
||||
(int) getDimen(R.dimen.module_common_shadow_width_pos));
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.TOP, naviBg.getId(),
|
||||
ConstraintSet.TOP, 0);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
@@ -541,7 +542,7 @@ public class TopViewAnimHelper {
|
||||
// .module_ext_navi_info_panel_height);
|
||||
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
|
||||
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
|
||||
0);
|
||||
(int) getDimen(R.dimen.module_common_shadow_width_pos));
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.TOP, naviBg.getId(),
|
||||
ConstraintSet.TOP, 0);
|
||||
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
|
||||
|
||||
Reference in New Issue
Block a user