Merge branch 'dev' into demo/shunyi_v2v_merge
# Conflicts: # app/src/main/java/com/mogo/launcher/MogoApplication.java # config.gradle # foudations/mogo-commons/src/main/java/com/mogo/commons/debug/DebugConfig.java # modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java # 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 # modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow2.java # modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help.xml # modules/mogo-module-v2x/src/main/res/values-xhdpi/dimens.xml # modules/mogo-module-v2x/src/main/res/values/dimens.xml # services/mogo-service-api/src/main/java/com/mogo/service/IMogoServiceApis.java # services/mogo-service/src/main/java/com/mogo/service/impl/MogoServiceApis.java # upload.sh
This commit is contained in:
@@ -1,132 +0,0 @@
|
||||
package com.mogo.module.extensions;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 天气,消息,个人头像
|
||||
*
|
||||
* @author congtaowang
|
||||
* @since 2020-01-05
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsPresenter > implements ExtensionsView {
|
||||
|
||||
private static final String TAG = "ExtensionsFragment";
|
||||
|
||||
public static final int MAX_DISPLAY_MSG_AMOUNT = 99;
|
||||
|
||||
private View mWeatherContainer;
|
||||
private ImageView mWeatherIcon;
|
||||
private TextView mWeatherTemp;
|
||||
|
||||
private View mMsgContainer;
|
||||
private TextView mMsgCounter;
|
||||
|
||||
private ImageView mUserHeadImg;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_ext_layout_extensions;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
mWeatherContainer = findViewById( R.id.module_ext_id_weather_container );
|
||||
mWeatherIcon = findViewById( R.id.module_ext_id_weather_icon );
|
||||
mWeatherTemp = findViewById( R.id.module_ext_id_weather_temp );
|
||||
|
||||
mUserHeadImg = findViewById(R.id.ivUserHeadImg);
|
||||
|
||||
mMsgContainer = findViewById( R.id.module_ext_id_msg );
|
||||
|
||||
mMsgContainer.setOnClickListener( view -> {
|
||||
ARouter.getInstance().build( "/push/ui/message" ).navigation( getContext() );
|
||||
} );
|
||||
mMsgCounter = findViewById( R.id.module_ext_id_msg_counter );
|
||||
mUserHeadImg.setOnClickListener(view ->{
|
||||
try {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
|
||||
// 埋点
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", 3);
|
||||
ServiceApisManager.serviceApis.getAnalyticsApi().track( "Launcher_APP_Icon", properties );
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "打开个人中心Exception");
|
||||
}
|
||||
});
|
||||
|
||||
mUserHeadImg.setVisibility(DebugConfig.isLauncher()?View.VISIBLE:View.GONE);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected ExtensionsPresenter createPresenter() {
|
||||
return new ExtensionsPresenter( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderWeatherInfo( String temp, String desc, int iconId ) {
|
||||
boolean hidden = false;
|
||||
if ( iconId != 0 ) {
|
||||
mWeatherIcon.setImageResource( iconId );
|
||||
mWeatherIcon.setVisibility( View.VISIBLE );
|
||||
} else {
|
||||
mWeatherIcon.setVisibility( View.GONE );
|
||||
hidden |= true;
|
||||
}
|
||||
hidden |= TextUtils.isEmpty( temp );
|
||||
hidden |= TextUtils.isEmpty( desc );
|
||||
mWeatherTemp.setText( temp );
|
||||
mWeatherContainer.setVisibility( hidden ? View.GONE : View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderMsgInfo( boolean hasMsg, int amount ) {
|
||||
mMsgContainer.setVisibility( hasMsg ? View.VISIBLE : View.GONE );
|
||||
mMsgCounter.setText( amount > MAX_DISPLAY_MSG_AMOUNT ? getString( R.string.module_ext_str_dots ) : String.valueOf( amount ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderUserInfo(UserInfo userInfo) {
|
||||
if(userInfo != null){
|
||||
Logger.d(TAG, "renderUserInfo: " + userInfo);
|
||||
GlideApp.with(getContext()).load(userInfo.getHeadImgurl()).placeholder(R.drawable.model_ext_default_user_head).circleCrop().into(mUserHeadImg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,6 @@ package com.mogo.module.extensions;
|
||||
*/
|
||||
public class ExtensionsModuleConst {
|
||||
|
||||
/**
|
||||
* 顶部UI
|
||||
*/
|
||||
public static final String PATH_EXTENSION = "/extension/ui";
|
||||
|
||||
/**
|
||||
* 快捷操作入口:定位、
|
||||
*/
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.mogo.module.extensions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-05
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = ExtensionsModuleConst.PATH_EXTENSION )
|
||||
public class ExtensionsModuleProvider implements IMogoModuleProvider {
|
||||
|
||||
@Override
|
||||
public Fragment createFragment( Context context, Bundle data ) {
|
||||
ExtensionsFragment fragment = new ExtensionsFragment();
|
||||
fragment.setArguments( data );
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView( Context context ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
return ExtensionsModuleConst.TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoModuleLifecycle getCardLifecycle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapListener getMapListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return ModuleType.TYPE_EXTENSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNaviListener getNaviListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationListener getLocationListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
package com.mogo.module.extensions;
|
||||
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.module.extensions.net.UserInfoNetApiServices;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.userinfo.UserInfoConstant;
|
||||
import com.mogo.module.extensions.userinfo.UserInfoResponse;
|
||||
import com.mogo.module.extensions.utils.ExtensionsConfig;
|
||||
import com.mogo.module.extensions.weather.Phenomena;
|
||||
import com.mogo.module.extensions.weather.WeatherCallback;
|
||||
import com.mogo.module.extensions.weather.WeatherInfo;
|
||||
import com.mogo.module.extensions.weather.WeatherModel;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
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 java.util.Map;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-05
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class ExtensionsPresenter extends Presenter< ExtensionsView > implements WeatherCallback,
|
||||
IMogoMsgCenterListener {
|
||||
|
||||
private static final String TAG = "ExtensionsPresenter";
|
||||
|
||||
private WeatherModel mWeatherModel;
|
||||
|
||||
private IMogoMsgCenter mMsgCenter;
|
||||
|
||||
private IMogoNetwork mNetWork;
|
||||
|
||||
public ExtensionsPresenter( ExtensionsView view ) {
|
||||
super( view );
|
||||
mWeatherModel = new WeatherModel( getContext() );
|
||||
mNetWork =
|
||||
((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
mWeatherModel.init( this );
|
||||
mWeatherModel.queryWeatherInformation();
|
||||
mMsgCenter = ( IMogoMsgCenter ) ARouter.getInstance().build( MogoServicePaths.PATH_MSG_CENTER ).navigation();
|
||||
mMsgCenter.registerMsgCenterListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWeatherLoaded( WeatherInfo weatherInfo ) {
|
||||
if ( weatherInfo == null ) {
|
||||
return;
|
||||
}
|
||||
String temp = getContext().getResources().getString( R.string.module_ext_str_weather_temp_format, weatherInfo.getTemperature() );
|
||||
Phenomena phenomena = Phenomena.getById( weatherInfo.getPhenomena() );
|
||||
String desc = phenomena == null ? "" : phenomena.nameCn;
|
||||
int resId = phenomena.resId;
|
||||
mView.renderWeatherInfo( temp, desc, resId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgChanged( boolean hasMsg, int amount ) {
|
||||
if ( mView != null ) {
|
||||
mView.renderMsgInfo( hasMsg, amount );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume( @NonNull LifecycleOwner owner ) {
|
||||
super.onResume( owner );
|
||||
if(ExtensionsConfig.needRequestUserInfo()){
|
||||
// 相当于每次onResume都会请求一下个人信息,目的是能够相对及时的同步手机端的个人信息修改
|
||||
requestUserInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause( @NonNull LifecycleOwner owner ) {
|
||||
super.onPause( owner );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
if ( mWeatherModel != null ) {
|
||||
mWeatherModel.destroy();
|
||||
}
|
||||
if ( mMsgCenter != null ) {
|
||||
mMsgCenter.unregisterMsgCenterListener( this );
|
||||
}
|
||||
}
|
||||
|
||||
private UserInfo userInfo;
|
||||
public void requestUserInfo() {
|
||||
Map<String, String> params = new ArrayMap<>();
|
||||
params.put("sn", Utils.getSn());
|
||||
params.put("source", "2");
|
||||
String sign = createSign(params, "JGqZw9");
|
||||
params.put("sig", sign);
|
||||
mNetWork.create(UserInfoNetApiServices.class, UserInfoConstant.getUserInfoBaseUrl()).requestUserInfo(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<UserInfoResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(UserInfoResponse userInfoBaseResponse) {
|
||||
userInfo = userInfoBaseResponse.getResult();
|
||||
if(userInfo!=null) {
|
||||
Logger.d(TAG, "获取个人信息成功: " + userInfo);
|
||||
mView.renderUserInfo(userInfo);
|
||||
}else{
|
||||
Logger.e(TAG,"获取个人信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
Logger.e(TAG, e, "获取个人信息失败==");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String createSign(Map<String, String> map, String salt) {
|
||||
try {
|
||||
StringBuilder queryString = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
queryString.append(entry.getKey())
|
||||
.append("=")
|
||||
.append(entry.getValue())
|
||||
.append("&");
|
||||
}
|
||||
queryString.append("key=").append(DigestUtils.shaHex(salt));
|
||||
return DigestUtils.shaHex(queryString.toString()).toUpperCase();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Logger.e(TAG, e, "createSign()");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
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 ReportStrategy reportStrategy; //被动上报策略开关
|
||||
|
||||
public CommonConfig(Active active, Auth auth, Speech speech, ReportStrategy reportStrategy) {
|
||||
this.active = active;
|
||||
this.auth = auth;
|
||||
this.speech = speech;
|
||||
this.reportStrategy = reportStrategy;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public class ReportStrategy {
|
||||
public boolean open;
|
||||
ReportStrategy(boolean open) {
|
||||
this.open = open;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
@@ -22,6 +23,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;
|
||||
@@ -33,11 +36,13 @@ import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
|
||||
import com.mogo.module.common.map.CustomNaviInterrupter;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.navi.NaviInfoView;
|
||||
@@ -46,7 +51,6 @@ import com.mogo.module.extensions.utils.EntranceViewHolder;
|
||||
import com.mogo.module.extensions.utils.TopViewAnimHelper;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.service.fragmentmanager.IFragmentProvider;
|
||||
@@ -65,6 +69,7 @@ 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 com.zhidao.manager.ts.TsThreshold;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -72,6 +77,19 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
|
||||
import static com.mogo.module.common.utils.SPConst.getSpGuide;
|
||||
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;
|
||||
import static com.mogo.module.share.constant.ShareConstants.VOICE_ALERT_COUNT;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-07
|
||||
@@ -131,6 +149,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
private EditText topEditS, frontLeftEditS, frontRightEditS, backLeftEditS, backRightEditS,
|
||||
bottomEditS;
|
||||
|
||||
private String[] mClickShareVoiceStrings;
|
||||
|
||||
private String[] mInnerGuideVoiceStrings;
|
||||
|
||||
private String[] mOuterGuideVoiceStrings;
|
||||
|
||||
private boolean isShowGuide;
|
||||
|
||||
/**
|
||||
* 搜索莫模块
|
||||
*/
|
||||
@@ -143,6 +169,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
private boolean toggle = false;
|
||||
|
||||
private View mOnlineCarEntrance;
|
||||
|
||||
private Runnable mLockCarRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -156,6 +184,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
private UploadButtonAnimatorController mUploadButtonAnimatorController;
|
||||
|
||||
private IFragmentProvider mMessageHistoryPanelProvider;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_ext_layout_entrance;
|
||||
@@ -163,7 +193,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext());
|
||||
mApis = MogoApisHandler.getInstance().getApis();
|
||||
|
||||
mEntrancePresenter = new EntrancePresenter(getContext(), this);
|
||||
mMogoFragmentManager = mApis.getFragmentManagerApi();
|
||||
@@ -174,40 +204,50 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mUploadRoadCondition = findViewById(R.id.module_entrance_id_upload_road_condition);
|
||||
mUpload = findViewById(R.id.module_entrance_id_upload);
|
||||
mUploading = findViewById(R.id.module_entrance_id_uploading);
|
||||
mUploadRoadCondition.setOnClickListener(view -> {
|
||||
showShareDialog();
|
||||
});
|
||||
mUploadRoadCondition.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
showShareDialog();
|
||||
playShareGuideVoice();
|
||||
}
|
||||
} );
|
||||
|
||||
mDisplayOverview = findViewById(R.id.module_ext_id_display_overview);
|
||||
mDisplayOverviewText = findViewById(R.id.module_ext_id_display_overview_text);
|
||||
mDisplayOverviewIcon = findViewById(R.id.module_ext_id_display_overview_icon);
|
||||
mDisplayOverview.setOnClickListener(view -> {
|
||||
if (getContext() != null) {
|
||||
// 加此判断是解决下面setDisplayOverview后,本Fragment回调中出现not attached to a context问题
|
||||
if (!mStatusManager.isDisplayOverview()) {
|
||||
mMApUIController.displayOverview(mDisplayOverviewBounds);
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
UiThreadHandler.postDelayed(mLockCarRunnable, 20_000);
|
||||
} else {
|
||||
mMApUIController.recoverLockMode();
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
mDisplayOverview.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
if (getContext() != null) {
|
||||
// 加此判断是解决下面setDisplayOverview后,本Fragment回调中出现not attached to a context问题
|
||||
if (!mStatusManager.isDisplayOverview()) {
|
||||
mMApUIController.displayOverview(mDisplayOverviewBounds);
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
UiThreadHandler.postDelayed(mLockCarRunnable, 20_000);
|
||||
} else {
|
||||
mMApUIController.recoverLockMode();
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
}
|
||||
mStatusManager.setDisplayOverview(TAG, !mStatusManager.isDisplayOverview());
|
||||
}
|
||||
mStatusManager.setDisplayOverview(TAG, !mStatusManager.isDisplayOverview());
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
|
||||
mMove2CurrentLocation.setOnClickListener(view -> {
|
||||
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
|
||||
if (location != null) {
|
||||
if (mStatusManager.isDisplayOverview()) {
|
||||
mStatusManager.setDisplayOverview(TAG, false);
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
mMove2CurrentLocation.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
|
||||
if (location != null) {
|
||||
if (mStatusManager.isDisplayOverview()) {
|
||||
mStatusManager.setDisplayOverview(TAG, false);
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
}
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
if (DebugConfig.isDebug()) {
|
||||
mMove2CurrentLocation.setOnLongClickListener(view -> {
|
||||
@@ -227,46 +267,47 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
|
||||
mExitNavi = findViewById(R.id.module_entrance_id_exit_navi);
|
||||
mExitNavi.setOnClickListener(view -> {
|
||||
if (mMogoNavi != null) {
|
||||
if (mIsLock) {
|
||||
new WMDialog.Builder(getContext())
|
||||
.setOkButton(R.string.module_commons_button_ok, (dlg, which) -> {
|
||||
dlg.dismiss();
|
||||
mMogoNavi.stopNavi();
|
||||
})
|
||||
.setCancelButton(R.string.module_commons_button_cancel,
|
||||
(dlg, which) -> {
|
||||
dlg.dismiss();
|
||||
})
|
||||
.setContent(R.string.module_commons_exit_navi_content)
|
||||
.build()
|
||||
.show();
|
||||
} else {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.NAVI);
|
||||
mMApUIController.recoverLockMode();
|
||||
mExitNavi.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
if (mMogoNavi != null) {
|
||||
if (mIsLock) {
|
||||
new WMDialog.Builder(getContext())
|
||||
.setOkButton(R.string.module_commons_button_ok, (dlg, which) -> {
|
||||
dlg.dismiss();
|
||||
mMogoNavi.stopNavi();
|
||||
})
|
||||
.setCancelButton(R.string.module_commons_button_cancel,
|
||||
(dlg, which) -> {
|
||||
dlg.dismiss();
|
||||
})
|
||||
.setContent(R.string.module_commons_exit_navi_content)
|
||||
.build()
|
||||
.show();
|
||||
} else {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.NAVI);
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mCameraMode = findViewById(R.id.module_ext_id_north);
|
||||
mCameraMode.setOnClickListener(view -> {
|
||||
if (mCameraMode.isSelected()) {
|
||||
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
|
||||
} else {
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
mCameraMode.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
if (mCameraMode.isSelected()) {
|
||||
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
|
||||
} else {
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
}
|
||||
}
|
||||
// mCameraMode.setSelected(!mCameraMode.isSelected());
|
||||
// mCameraMode.setText(getString(mCameraMode.isSelected() ? R.string.mode_car_up :
|
||||
// R.string.mode_north_up));
|
||||
});
|
||||
} );
|
||||
|
||||
|
||||
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
|
||||
MogoEntranceButtons.save(ButtonIndex.BUTTON1,
|
||||
findViewById(R.id.module_entrance_id_button1));
|
||||
MogoEntranceButtons.save(ButtonIndex.BUTTON2,
|
||||
findViewById(R.id.module_entrance_id_button2));
|
||||
MogoEntranceButtons.save(ButtonIndex.BUTTON1, findViewById(R.id.module_entrance_id_button1));
|
||||
MogoEntranceButtons.save(ButtonIndex.BUTTON2, findViewById(R.id.module_entrance_id_button2));
|
||||
|
||||
mDisplayOverviewBounds = new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize(getContext(),
|
||||
@@ -282,13 +323,16 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mNaviInfo = new NaviInfoView();
|
||||
mNaviInfo.inflate(rootView);
|
||||
|
||||
findViewById(R.id.module_map_id_navi_bg).setOnClickListener(view -> {
|
||||
try {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
findViewById(R.id.module_map_id_navi_bg).setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
try {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mWeatherContainer = findViewById(R.id.module_ext_id_weather_container);
|
||||
mWeatherIcon = findViewById(R.id.module_ext_id_weather_icon);
|
||||
@@ -298,33 +342,52 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
mMsgContainer = findViewById(R.id.module_ext_id_msg);
|
||||
|
||||
mMsgContainer.setOnClickListener(view -> {
|
||||
try {
|
||||
IFragmentProvider provider = (IFragmentProvider)ARouter.getInstance().build("/push/ui/message").navigation(getContext());
|
||||
provider.createFragment( getActivity(), mMogoFragmentManager.getMessageHistoryContainerId(), null );
|
||||
} catch( Exception e ){
|
||||
mMsgContainer.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
try {
|
||||
if ( mMessageHistoryPanelProvider == null ) {
|
||||
mMessageHistoryPanelProvider = (IFragmentProvider)ARouter.getInstance().build("/push/ui/message").navigation(getContext());
|
||||
}
|
||||
mMessageHistoryPanelProvider.createFragment( getActivity(), mMogoFragmentManager.getMessageHistoryContainerId(), null );
|
||||
} catch( Exception e ){
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
mMsgCounter = findViewById(R.id.module_ext_id_msg_counter);
|
||||
mUserHeadImg.setOnClickListener(view -> {
|
||||
try {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
|
||||
// 埋点
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", 3);
|
||||
ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon",
|
||||
properties);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "打开个人中心Exception");
|
||||
mUserHeadImg.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
try {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
|
||||
// 埋点
|
||||
final Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", 3);
|
||||
ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon",
|
||||
properties);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "打开个人中心Exception");
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mUserHeadImg.setVisibility(DebugConfig.isLauncher() ? View.VISIBLE : View.GONE);
|
||||
|
||||
mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload,
|
||||
mStatusManager);
|
||||
|
||||
mOnlineCarEntrance = findViewById( R.id.module_ext_id_destination_online_car );
|
||||
mOnlineCarEntrance.setOnClickListener( new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl( View v ) {
|
||||
MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().showPanel();
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put( "type", 1 );
|
||||
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "APP_Find_Mogoer", properties );
|
||||
}
|
||||
} );
|
||||
|
||||
dealWeatherContainer();
|
||||
|
||||
debugTopView();
|
||||
@@ -389,6 +452,161 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
thresholdSetContainer.setVisibility(View.GONE);
|
||||
mApis.getAdasControllerApi().showADAS();
|
||||
});
|
||||
|
||||
isShowGuide = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(getSpGuide(), false);
|
||||
Logger.d(TAG, " isShowGuide = " + isShowGuide + " --isGreaterThanOneDay = " + isGreaterThanOneDay());
|
||||
if (isShowGuide && isGreaterThanOneDay()) {
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
playShareOuterGuideVoice();
|
||||
}, 5_000L
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isGreaterThanOneDay() {
|
||||
boolean isGreaterThanOneDay;
|
||||
long guideRecordTime = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getLong(getSPGuideRecord(), 0);
|
||||
Logger.d(TAG, " isGreaterThanOneDay interval = " + (System.currentTimeMillis() - guideRecordTime) + "---currentTime = " + System.currentTimeMillis() + "---guideRecordTime =" + guideRecordTime);
|
||||
if ((System.currentTimeMillis() - guideRecordTime) > ONE_DAY_TIME) {
|
||||
isGreaterThanOneDay = true;
|
||||
} else {
|
||||
isGreaterThanOneDay = false;
|
||||
}
|
||||
|
||||
return isGreaterThanOneDay;
|
||||
}
|
||||
|
||||
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, 6);
|
||||
|
||||
if (shareItemSum < serverIssueCount) {
|
||||
long time = System.currentTimeMillis();
|
||||
Logger.d(TAG, " playShareOuterGuideVoice shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + "----serverIssueCount = " + serverIssueCount + "---time = " + time);
|
||||
if (intervalTime == 0) {
|
||||
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)]);
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[0]);
|
||||
} else {
|
||||
Logger.d(TAG, " playShareOuterGuideVoice else interval = " + (time - intervalTime));
|
||||
if ((time - intervalTime) > SEVEN_DAY_TIME) {
|
||||
if (shareItemSum == 1) {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[1]);
|
||||
} else if (shareItemSum == 2) {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[2]);
|
||||
} else if (shareItemSum == 3) {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[0]);
|
||||
} else if (shareItemSum == 4) {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[1]);
|
||||
} else if (shareItemSum == 5) {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mOuterGuideVoiceStrings[2]);
|
||||
}
|
||||
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_OUTER_GUIDE_TIME, time);
|
||||
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_OUTER_GUIDE, ++shareItemSum);
|
||||
} else {
|
||||
Logger.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);
|
||||
if (shareItemSum < VOICE_ALERT_COUNT) {
|
||||
long time = System.currentTimeMillis();
|
||||
Logger.d(TAG, " playShareGuideVoice shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + ">>> time = " + time);
|
||||
if (intervalTime == 0) {
|
||||
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 {
|
||||
Logger.d(TAG, " playShareGuideVoice else interval = " + (time - intervalTime));
|
||||
if ((time - intervalTime) > ONE_DAY_TIME) {
|
||||
if (shareItemSum == 1) {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[1]);
|
||||
} else {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[0]);
|
||||
}
|
||||
|
||||
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_CLICK_SHARE_TIME, time);
|
||||
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_CLICK_SHARE_BUTTON, ++shareItemSum);
|
||||
} else {
|
||||
Logger.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) {
|
||||
|
||||
}
|
||||
|
||||
private void showSlideMapVoiceGuide() {
|
||||
long intervalTime = SharedPrefsMgr.getInstance(getContext()).getLong(KEY_SHARE_INNER_GUIDE_TIME, 0);
|
||||
int shareItemSum = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_SHARE_INNER_GUIDE, 0);
|
||||
if (shareItemSum < VOICE_ALERT_COUNT) {
|
||||
long time = System.currentTimeMillis();
|
||||
Logger.d(TAG, " showSlideMapVoiceGuide shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + "---time = " + time);
|
||||
if (intervalTime == 0) {
|
||||
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 {
|
||||
Logger.d(TAG, " showSlideMapVoiceGuide else interval = " + (time - intervalTime));
|
||||
if ((time - intervalTime) > ONE_DAY_TIME) {
|
||||
if (shareItemSum == 1) {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mInnerGuideVoiceStrings[1]);
|
||||
} else {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(mInnerGuideVoiceStrings[2]);
|
||||
}
|
||||
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_SHARE_INNER_GUIDE_TIME, time);
|
||||
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SHARE_INNER_GUIDE, ++shareItemSum);
|
||||
|
||||
} else {
|
||||
Logger.e(TAG, " showSlideMapVoiceGuide else < ONE_DAY_TIME ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouch(MotionEvent motionEvent) {
|
||||
switch (motionEvent.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (isShowGuide && isGreaterThanOneDay()) {
|
||||
if (motionEvent.getX() > 200) {
|
||||
showSlideMapVoiceGuide();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -409,6 +627,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
isClickShare = true;
|
||||
mApis.getShareManager().showShareDialog();
|
||||
traceData("1");
|
||||
|
||||
}
|
||||
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
|
||||
@@ -440,6 +659,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
|
||||
@@ -447,6 +673,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
super.onDestroyView();
|
||||
isClickShare = false;
|
||||
TopViewAnimHelper.getInstance().removeAllView();
|
||||
TopViewAnimHelper.getInstance().clear();
|
||||
EntranceViewHolder.getInstance().release();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -462,6 +690,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
mCameraMode.setText(getString(mCameraMode.isSelected() ?
|
||||
R.string.mode_car_up : R.string.mode_north_up));
|
||||
} else if( key_type == 10021 ){
|
||||
try {
|
||||
onStopNavi();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onIntentReceived -> 10021" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,6 +732,11 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mCameraMode.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mApis.getAnalyticsApi().track("Navigation_begin", new HashMap<>());
|
||||
if ( DebugConfig.isSupportedSearchDestinationOnlineCarList() ) {
|
||||
mOnlineCarEntrance.setVisibility( View.VISIBLE );
|
||||
} else {
|
||||
mOnlineCarEntrance.setVisibility( View.GONE );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -507,6 +746,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
mDisplayOverview.setVisibility(View.GONE);
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
mOnlineCarEntrance.setVisibility( View.GONE );
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.AIMLESS);
|
||||
}
|
||||
|
||||
@@ -707,8 +947,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
return;
|
||||
}
|
||||
mCameraMode.setSelected(ui == EnumMapUI.NorthUP_2D);
|
||||
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up :
|
||||
R.string.mode_north_up));
|
||||
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up : R.string.mode_north_up));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,7 +9,11 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
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;
|
||||
@@ -26,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;
|
||||
|
||||
@@ -34,6 +39,8 @@ 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_SERVER_SHOW_DAY_COUNT;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-07
|
||||
@@ -55,8 +62,7 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
|
||||
public EntrancePresenter(Context context, EntranceView view) {
|
||||
super(view);
|
||||
mWeatherModel = new WeatherModel( getContext() );
|
||||
mNetWork =
|
||||
((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi();
|
||||
mNetWork = MogoApisHandler.getInstance().getApis().getNetworkApi();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,6 +107,7 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
|
||||
// 相当于每次onResume都会请求一下个人信息,目的是能够相对及时的同步手机端的个人信息修改
|
||||
requestUserInfo();
|
||||
}
|
||||
getCommonConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,6 +127,51 @@ 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;
|
||||
CommonConfig.ReportStrategy strategy = config.result.reportStrategy;
|
||||
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 ");
|
||||
}
|
||||
|
||||
if (strategy != null) {
|
||||
Logger.d(TAG, "getCommonConfig onSuccess strategy.open = " + strategy.open);
|
||||
SharedPrefsMgr.getInstance(getContext()).putBoolean("KEY_SERVER_REPORTSTRATEGY_SWITCH", strategy.open);
|
||||
} else {
|
||||
Logger.e(TAG, "getCommonConfig onSuccess strategy == 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,20 @@
|
||||
package com.mogo.module.extensions.net;
|
||||
|
||||
import com.mogo.module.extensions.bean.CommonConfigResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
@@ -105,4 +105,8 @@ public class EntranceViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
public void release(){
|
||||
rootViewGroup = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ public class TopViewAnimHelper {
|
||||
private TextView tvTurnInfo;
|
||||
private TopView topContainer;
|
||||
|
||||
private ConstraintSet constraintSet = new ConstraintSet();
|
||||
private Transition transition = new AutoTransition();
|
||||
private ConstraintSet constraintSet;
|
||||
private Transition transition;
|
||||
private TextView cameraMode;
|
||||
|
||||
private float topHeight = 0f;
|
||||
@@ -84,6 +84,10 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
|
||||
public void init(ConstraintLayout rootView, OnTopViewAnimSimpleListener listener) {
|
||||
|
||||
constraintSet = new ConstraintSet();
|
||||
transition = new AutoTransition();
|
||||
|
||||
topMotionLayout = rootView;
|
||||
naviBg = rootView.findViewById(R.id.module_map_id_navi_bg);
|
||||
remainTimeGroup = rootView.findViewById(R.id.remainTimeGroup);
|
||||
@@ -680,4 +684,20 @@ public class TopViewAnimHelper {
|
||||
hideNaviView();
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
topMotionLayout = null;
|
||||
remainTimeGroup = null;
|
||||
remainDistanceGroup = null;
|
||||
arriveTimeGroup = null;
|
||||
naviBg = null;
|
||||
ivTurnIcon = null;
|
||||
tvNextDistance = null;
|
||||
tvNextRoad = null;
|
||||
tvNextDistanceUnit = null;
|
||||
tvTurnInfo = null;
|
||||
topContainer = null;
|
||||
cameraMode = null;
|
||||
transition = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user