删除旧版本的功能代码

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-01-19 15:59:52 +08:00
parent 705f58849e
commit 52cc747749
345 changed files with 91 additions and 4705 deletions

View File

@@ -10,34 +10,31 @@ import androidx.recyclerview.widget.RecyclerView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.eagle.core.function.notice.R;
import com.mogo.eagle.core.function.notice.utils.AnimatorUtilsKt;
import com.mogo.eagle.core.function.notice.view.GlobalToolsKt;
import com.mogo.eagle.core.function.notice.view.PushItemAnimator;
import com.mogo.eagle.core.function.notice.view.SwipeItemLayout;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.eagle.core.function.notice.Config;
import com.mogo.eagle.core.function.notice.R;
import com.mogo.eagle.core.function.notice.adapter.PushMessageAdapter;
import com.mogo.eagle.core.function.notice.model.PushBean;
import com.mogo.eagle.core.function.notice.repository.PushRepository;
import com.mogo.eagle.core.function.notice.utils.AnimatorUtilsKt;
import com.mogo.eagle.core.function.notice.utils.HandlerUtils;
import com.mogo.eagle.core.function.notice.view.PushItemAnimator;
import com.mogo.eagle.core.function.notice.view.SwipeItemLayout;
import com.mogo.eagle.core.function.notice.viewmodel.MessageViewModel;
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.module.common.view.OnPreventFastClickListener;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Map;
public
/**
* @author congtaowang
* @since 2020/9/1
*
* 描述
*/
class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHistoryPresenter > implements MessageHistoryView, IMogoMsgCenterListener {
public class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHistoryPresenter > implements MessageHistoryView {
private static final String TAG = "MessageHistoryFragment";
@@ -143,7 +140,6 @@ class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHis
mRootView.setOnClickListener( view -> {
} );
GlobalToolsKt.getApis( getContext() ).getMsgCenterApi().registerMsgCenterListener( this );
}
private void exitSelf() {
@@ -178,13 +174,6 @@ class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHis
} );
}
@Override
public void onMsgChanged( boolean hasMsg, int amount ) {
HandlerUtils.INSTANCE.getMBgHandler().post( () -> {
mViewModel.setList( PushRepository.Companion.getPushRepository().getAll() );
} );
}
@Override
public void onResume() {
super.onResume();
@@ -199,6 +188,5 @@ class MessageHistoryFragment extends MvpFragment< MessageHistoryView, MessageHis
@Override
public void onDestroyView() {
super.onDestroyView();
GlobalToolsKt.getApis( getContext() ).getMsgCenterApi().unregisterMsgCenterListener( this );
}
}

View File

@@ -43,7 +43,6 @@ class PushRepository(mContext: Context) {
private val pushViewModel: PushViewModel = PushViewModel(mContext, this)
private val pushBeanQueue: Queue<PushBean> = LinkedList()
private val statusManager = getApis(mContext).statusManagerApi
private val msgCenter = getApis(mContext).msgCenterApi
val pushBeanDao by lazy {
Room.databaseBuilder(appContext, PushBeanDatabase::class.java, "database_push").build()
.pushBeanDao()
@@ -59,37 +58,6 @@ class PushRepository(mContext: Context) {
}
init {
// 注册push通道监听 type 100时为push消息 lixp TODO
// getApis(mContext).getSocketManagerApi(mContext)
// .registerOnMessageListener(Config.PUSH_TYPE, object : IMogoOnMessageListener<PushBean> {
// override fun target(): Class<PushBean> {
// return PushBean::class.java
// }
//
// override fun onMsgReceived(bean: PushBean?) {
// Log.d("PushRepository", "pushBean = $bean")
// if (bean != null) {
// AnalyticsUtils.track(Config.NEWS_ARRIVE, "title", bean.title)
// if (bean.mainSchema.isBlank()) {
// bean.mainSchema = ""
// }
// if (bean.imageUrl.isBlank()) {
// bean.imageUrl = ""
// }
// if (bean.appIcon.isBlank()) {
// bean.appIcon = ""
// }
// pushBeanQueue.offer(bean)
// }
// if ( bean != null) {
// HandlerUtils.mBgHandler.post {
// pushBeanDao.insertAll(bean)
// updateMsgNum()
// }
// }
// startIterate()
// }
// })
HandlerUtils.mBgHandler.postDelayed({
updateMsgNum()
}, 5000)
@@ -102,9 +70,7 @@ class PushRepository(mContext: Context) {
updateMsgNum()
return
}
mHandler.post {
msgCenter.setMsgStatus(num > 0, num)
}
}
private fun startIterate() {
@@ -215,9 +181,6 @@ class PushRepository(mContext: Context) {
fun deleteAll() {
HandlerUtils.mBgHandler.post {
pushBeanDao.deleteAll()
mHandler.post {
msgCenter.setMsgStatus(false, 0)
}
}
}

View File

@@ -66,13 +66,6 @@ public class MogoServicePaths {
@Deprecated
public static final String PATH_STATUS_MANAGER = "/statusmanager/api";
/**
* 消息中心
*/
@Keep
@Deprecated
public static final String PATH_MSG_CENTER = "/msgcenter/api";
/**
* 消息中心
*/

View File

@@ -61,65 +61,71 @@ public class OnAdasListenerAdapter implements OnAdasListener {
@Override
public void onCarStateData(CarStateInfo carStateInfo) {
if (HdMapBuildConfig.isMapLoaded) {
// Logger.d(TAG, "--------carStateInfo.toString() = " + carStateInfo.toString());
//can数据转发
CarStateInfo.ValuesBean bean = carStateInfo.getValues();
//can数据转发
CarStateInfo.ValuesBean bean = carStateInfo.getValues();
// Log.w("DHY-location", bean.getLon() + "," + bean.getLat() + " OnAdasListenerAdapter-onCarStateData");
if (bean != null) {
int turnLight = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转
AmiClientManager.getInstance().setTurnLightState(turnLight);
int brakeLight = bean.getBrake_light(); //TODO
if (bean != null) {
int turnLight = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转
AmiClientManager.getInstance().setTurnLightState(turnLight);
int brakeLight = bean.getBrake_light(); //TODO
// Logger.d(TAG, "onCarStateData ---- turnLight = " + turnLight + "---brakeLight = " + brakeLight);
//设置转向灯
CallerHmiManager.INSTANCE.showTurnLight(turnLight);
//设置转向灯
CallerHmiManager.INSTANCE.showTurnLight(turnLight);
//设置刹车信息
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
} else {
Logger.e(TAG, "bean == null ");
//设置刹车信息
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
} else {
Logger.e(TAG, "bean == null ");
}
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
}
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
}
@Override
public void autopilotStatus(AutopilotStatus autopilotStatus) {
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
if (HdMapBuildConfig.isMapLoaded) {
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
if (autopilotStatusValues != null) {
// 初始化自动驾驶状态信息
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setState(autopilotStatusValues.getState());
autopilotStatusInfo.setPilotmode(autopilotStatusValues.getPilotmode());
autopilotStatusInfo.setControl_pilotmode(autopilotStatusValues.getControl_pilotmode());
autopilotStatusInfo.setReason(autopilotStatusValues.getReason());
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
// 初始化自动驾驶状态信息
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
autopilotStatusInfo.setDockVersion(AdasManager.getInstance().getAdasConfig().getDockVersion());
if (autopilotStatusValues != null) {
// 初始化自动驾驶状态信息
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setState(autopilotStatusValues.getState());
autopilotStatusInfo.setPilotmode(autopilotStatusValues.getPilotmode());
autopilotStatusInfo.setControl_pilotmode(autopilotStatusValues.getControl_pilotmode());
autopilotStatusInfo.setReason(autopilotStatusValues.getReason());
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
// 初始化自动驾驶状态信息
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
autopilotStatusInfo.setDockVersion(AdasManager.getInstance().getAdasConfig().getDockVersion());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
}
}
}
@Override
public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) {
Logger.d(TAG, "autopilotArrive : " + autopilotWayArrive);
if (autopilotWayArrive != null) {
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
if (result != null) {
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
if (endLatLon != null) {
AutopilotStationInfo stationInfo = new AutopilotStationInfo(result.getCarType(), endLatLon.getLon(), endLatLon.getLat());
if (HdMapBuildConfig.isMapLoaded) {
Logger.d(TAG, "autopilotArrive : " + autopilotWayArrive);
if (autopilotWayArrive != null) {
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
if (result != null) {
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
if (endLatLon != null) {
AutopilotStationInfo stationInfo = new AutopilotStationInfo(result.getCarType(), endLatLon.getLon(), endLatLon.getLat());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeArriveAtStation(stationInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeArriveAtStation(stationInfo);
}
}
}
}
@@ -127,32 +133,36 @@ public class OnAdasListenerAdapter implements OnAdasListener {
@Override
public void onAutopilotRoute(AutopilotRoute route) {
Logger.d(TAG, "onAutopilotRoute : " + route.toString());
AutopilotRouteInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAdasAutopilotRoute(route);
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotRotting(autopilotRoute);
if (HdMapBuildConfig.isMapLoaded) {
Logger.d(TAG, "onAutopilotRoute : " + route.toString());
AutopilotRouteInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAdasAutopilotRoute(route);
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotRotting(autopilotRoute);
}
}
@Override
public void onAutopilotTrajectory(List<TrajectoryInfo> trajectoryList) {
Logger.d(TAG, "onAutopilotTrajectory : " + trajectoryList);
ArrayList<ADASTrajectoryInfo> trajectoryInfoArrayList = new ArrayList<>();
if (trajectoryList != null && trajectoryList.size() > 0) {
for (TrajectoryInfo trajectory : trajectoryList) {
ADASTrajectoryInfo adasTrajectoryInfo = new ADASTrajectoryInfo();
adasTrajectoryInfo.setLat(trajectory.getLat());
adasTrajectoryInfo.setLon(trajectory.getLon());
adasTrajectoryInfo.setAcceleration(trajectory.getAcceleration());
adasTrajectoryInfo.setAccumulatedDis(trajectory.getAccumulatedDis());
adasTrajectoryInfo.setTime(trajectory.getTime());
adasTrajectoryInfo.setVelocity(trajectory.getVelocity());
adasTrajectoryInfo.setAlt(trajectory.getAlt());
adasTrajectoryInfo.setKappa(trajectory.getKappa());
adasTrajectoryInfo.setTheta(trajectory.getTheta());
trajectoryInfoArrayList.add(adasTrajectoryInfo);
if (HdMapBuildConfig.isMapLoaded) {
Logger.d(TAG, "onAutopilotTrajectory : " + trajectoryList);
ArrayList<ADASTrajectoryInfo> trajectoryInfoArrayList = new ArrayList<>();
if (trajectoryList != null && trajectoryList.size() > 0) {
for (TrajectoryInfo trajectory : trajectoryList) {
ADASTrajectoryInfo adasTrajectoryInfo = new ADASTrajectoryInfo();
adasTrajectoryInfo.setLat(trajectory.getLat());
adasTrajectoryInfo.setLon(trajectory.getLon());
adasTrajectoryInfo.setAcceleration(trajectory.getAcceleration());
adasTrajectoryInfo.setAccumulatedDis(trajectory.getAccumulatedDis());
adasTrajectoryInfo.setTime(trajectory.getTime());
adasTrajectoryInfo.setVelocity(trajectory.getVelocity());
adasTrajectoryInfo.setAlt(trajectory.getAlt());
adasTrajectoryInfo.setKappa(trajectory.getKappa());
adasTrajectoryInfo.setTheta(trajectory.getTheta());
trajectoryInfoArrayList.add(adasTrajectoryInfo);
}
Log.e(TAG, "time:" + System.currentTimeMillis() + "trajectoryInfoArrayList:" + trajectoryInfoArrayList);
}
Log.e(TAG, "time:" + System.currentTimeMillis() + "trajectoryInfoArrayList:" + trajectoryInfoArrayList);
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotTrajectory(trajectoryInfoArrayList);
}
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotTrajectory(trajectoryInfoArrayList);
}
@Override
@@ -162,8 +172,10 @@ public class OnAdasListenerAdapter implements OnAdasListener {
@Override
public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) {
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
if (HdMapBuildConfig.isMapLoaded) {
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
}
}
@Override

View File

@@ -3,7 +3,5 @@
-keep class com.mogo.module.extensions.live.PushCameraLiveWindow{*;}
-keep class com.mogo.module.extensions.navi.*{*;}
-keep class com.mogo.module.extensions.userinfo.*{*;}
-keep class com.mogo.module.extensions.weather.Phenomena{*;}
-keep class com.mogo.module.extensions.weather.StrokeTextView{*;}
-keep class com.mogo.module.extensions.view.*{*;}
-keep class com.mogo.module.extensions.bean.*{*;}

View File

@@ -23,8 +23,6 @@
#-----ExtensionModule-----
-keep class com.mogo.module.extensions.userinfo.**{*;}
-keep class com.mogo.module.extensions.weather.Phenomena
-keep class com.mogo.module.extensions.weather.WeatherCallback
-keep interface com.mogo.module.extensions.net.UserInfoNetApiServices
-keep class com.mogo.module.extensions.utils.TopViewAnimHelper
-keep class com.mogo.module.extensions.ExtensionsView
-keep class com.mogo.module.extensions.ExtensionsModuleConst

View File

@@ -8,56 +8,6 @@ package com.mogo.module.extensions;
*/
public class ExtensionsModuleConst {
public static final String TYPE = "extension";
public static final String TYPE_ENTRANCE = "entrance";
/*** 分享 开始 **/
//免唤醒语音命令
public static final String[] CMD_CANCLE_SHARE = {"取消分享"};
public static final String[] CMD_CLOSE_PAGE = {"关闭页面"};
public static final String[] CMD_CLOSE = {"关闭"};
public static final String CANCLE_SHARE = "com.zhidao.launcher.cancle.share";
public static final String CLOSE_PAGE = "com.zhidao.launcher.close.page";
public static final String CLOSE = "com.zhidao.launcher.close";
//唤醒指令
//分享路况/上报路况/上报拥堵/上报交通检查/上报封路 唤醒
public static final String UPLOAD_ROAD_CONDITION_AWAKEN = "com.zhidao.pathfinder.report.roadCondition";
public static final String UPLOAD_ROAD_CONDITION = "command_upload_roadcondition";
//关闭分享框 唤醒
public static final String SHARE_DIALOG_CLOSE = "com.zhidao.share.close";
// 两次未回复关闭分享对话框
public static final String NO_REPLY_SHARE_DIALOG_CLOSE = "com.zhidao.share.dialog.close";
//我要分享
public static final String GO_TO_SHARE = "com.zhidao.share";
/*** 分享 结束 **/
/*** 探路 开始 免唤醒 **/
public static final String[] CMD_UPLOAD_BLOCK = {"上报拥堵"};
public static final String[] CMD_TRAFFIC_CHECK = {"上报交通检查"};
public static final String[] CMD_ROAD_CLOSURE = {"上报封路"};
// public static final String[] CMD_SHARE_OIL_PRICE = {"分享油价"};
//上报拥堵
public static final String UPLOAD_ROAD_BLOCK = "command_upload_block";
//上报交通检查
public static final String UPLOAD_TRAFFIC_CHECK = "command_upload_traffic_check";
//上报封路
public static final String UPLOAD_ROAD_CLOSURE = "command_upload_road_closure";
//分享油价
// public static final String SHARE_OIL_PRICE = "command_share_oil_price";
/*** 探路 结束 **/
//埋点
//分享分类 1路况2油价3交通检查4封路
public static final String LAUNCHER_SHARE_TYPE = "v2x_share_type";
//分享/上报按钮点击 from=1 手动点击 from=2 语音打开
public static final String LAUNCHER_SHARE_CLICK = "v2x_share_click";
public static final String CARNET_USER_UPLOAD = "CarNet_user_upload";
}

View File

@@ -1,8 +1,6 @@
package com.mogo.module.extensions;
import com.mogo.commons.mvp.IView;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.extensions.weather.WeatherInfo;
/**
* @author congtaowang
@@ -12,21 +10,4 @@ import com.mogo.module.extensions.weather.WeatherInfo;
*/
public interface ExtensionsView extends IView {
/**
* 天气信息
*
* @param desc 天气描述:晴转多云
* @param temp 温度
* @param iconId 图标
*/
void renderWeatherInfo( String temp, String desc, int iconId );
/**
* 刷新消息信息
*
* @param hasMsg 是否有消息
* @param amount 消息数量
*/
void renderMsgInfo( boolean hasMsg, int amount );
}

View File

@@ -1,68 +0,0 @@
package com.mogo.module.extensions.bean;
import android.view.View;
import java.util.Objects;
/**
* 底层view封装
*
* @author tongchenfei
*/
public class BottomLayerViewWrapper {
private View view;
private int x;
private int y;
public BottomLayerViewWrapper() {
}
public BottomLayerViewWrapper(View view, int x, int y) {
this.view = view;
this.x = x;
this.y = y;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BottomLayerViewWrapper wrapper = (BottomLayerViewWrapper) o;
return x == wrapper.x &&
y == wrapper.y &&
view.equals(wrapper.view);
}
@Override
public int hashCode() {
return Objects.hash(view);
}
public View getView() {
return view;
}
public void setView(View view) {
this.view = view;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}

View File

@@ -1,78 +1,43 @@
package com.mogo.module.extensions.entrance;
import static com.mogo.module.extensions.ExtensionsModuleConst.TYPE_ENTRANCE;
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.ONE_DAY_TIME;
import static com.mogo.module.share.constant.ShareConstants.VOICE_ALERT_COUNT;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.Group;
import com.alibaba.android.arouter.launcher.ARouter;
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.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.navi.IMogoAimlessModeListener;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.navi.IMogoNaviListener;
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.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.MogoApisHandler;
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.R;
import com.mogo.module.extensions.utils.CameraLiveNoticeHelper;
import com.mogo.module.extensions.utils.NoMapTopViewShaderHelper;
import com.mogo.module.extensions.utils.TopViewAnimHelper;
import com.mogo.module.extensions.utils.TopViewNoLinkageAnimHelper;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
import com.mogo.service.fragmentmanager.IFragmentProvider;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.map.IMogoMapService;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.statusmanager.StatusDescriptor;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
@@ -90,49 +55,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private static final String TAG = "EntranceFragment";
private ImageButton mMove2CurrentLocation;
private View mDisplayOverview;
private TextView mDisplayOverviewText;
private IMogoServiceApis mApis;
private IMogoMapService mService;
private IMogoMapUIController mMApUIController;
private IMogoNavi mMogoNavi;
private IMogoFragmentManager mMogoFragmentManager;
private IMogoRegisterCenter mMogoRegisterCenter;
private IMogoAnalytics mAnalytics;
private EntrancePresenter mEntrancePresenter;
private IMogoStatusManager mStatusManager;
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 String[] mClickShareVoiceStrings;
private boolean isShowGuide;
/**
* 搜索模块
*/
private boolean mIsLock = true;
private TextView mCameraMode;
public static boolean isClickShare;
private Rect mDisplayOverviewBounds;
private TextView tvExitVrMode;
/**
* 内部变量标识是否在vrMode用于方法执行过滤避免重复或异常调用
*/
@@ -145,17 +75,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
return;
}
mStatusManager.setDisplayOverview(TAG, false);
mMApUIController.recoverLockMode();
}
};
private Group seekHelpGroup;
private UploadButtonAnimatorController mUploadButtonAnimatorController;
private IFragmentProvider mMessageHistoryPanelProvider;
private TextView seekHelpNum;
private final CameraLiveNoticeHelper mCameraLiveNoticeHelper = new CameraLiveNoticeHelper();
@@ -176,136 +98,20 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mCameraLiveNoticeHelper.init(getContext());
mEntrancePresenter = new EntrancePresenter(getContext(), this);
mMogoFragmentManager = mApis.getFragmentManagerApi();
mStatusManager = mApis.getStatusManagerApi();
seekHelpGroup = findViewById(R.id.module_ext_id_seek_help_notice_group);
seekHelpNum = findViewById(R.id.module_ext_id_seek_help_notice_number);
NoMapTopViewShaderHelper.getInstance().initShaderView(findViewById(R.id.module_ext_id_top_container_shader));
mDisplayOverview = findViewById(R.id.module_ext_id_display_overview);
mDisplayOverviewText = findViewById(R.id.module_ext_id_display_overview_text);
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
groupFix = findViewById(R.id.groupFix);
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
if (rootView != null) {
TopViewAnimHelper.getInstance().init(rootView);
TopViewNoLinkageAnimHelper.getInstance().init(rootView);
}
mCameraMode = findViewById(R.id.module_ext_id_north);
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
mDisplayOverviewBounds = new Rect(
ResourcesHelper.getDimensionPixelSize(getContext(),
R.dimen.module_map_display_overview_left_margin),
ResourcesHelper.getDimensionPixelSize(getContext(),
R.dimen.module_map_display_overview_top_margin),
ResourcesHelper.getDimensionPixelSize(getContext(),
R.dimen.module_map_display_overview_right_margin),
ResourcesHelper.getDimensionPixelSize(getContext(),
R.dimen.module_map_display_overview_bottom_margin)
);
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);
mMsgContainer = findViewById(R.id.module_ext_id_msg);
mMsgCounter = findViewById(R.id.module_ext_id_msg_counter);
tvExitVrMode = findViewById(R.id.module_ext_exit_vr_mode);
tvExitVrMode.setOnClickListener(clickListener);
mMsgContainer.setOnClickListener(clickListener);
mMove2CurrentLocation.setOnClickListener(clickListener);
mDisplayOverview.setOnClickListener(clickListener);
mCameraMode.setOnClickListener(clickListener);
dealWeatherContainer();
listenSeekNumber();
debugCrashWarn();
etTimes = findViewById(R.id.etTimes);
findViewById(R.id.btnFix).setOnClickListener(clickListener);
findViewById(R.id.debugPanel).setOnClickListener(clickListener);
initDebugPanel();
// 检查是否在vr模式
if (mStatusManager.isVrMode()) {
enterVrMode();
localIsVrMode = true;
}
}
private int debugPanelClickCount = 0;
private long lastDebugPanelClickTime = 0;
private EditText etTimes;
private Group groupFix;
private void enterVrMode() {
mMove2CurrentLocation.setVisibility(View.GONE);
mWeatherContainer.setVisibility(View.GONE);
mMsgContainer.setVisibility(View.GONE);
// tvExitVrMode.setVisibility(View.VISIBLE);
TopViewAnimHelper.getInstance().enterVrMode();
TopViewNoLinkageAnimHelper.getInstance().enterVrMode();
mCameraLiveNoticeHelper.enterVrMode();
localIsVrMode = true;
}
private void exitVrMode() {
mMove2CurrentLocation.setVisibility(View.VISIBLE);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSeekHelping()) {
seekHelpGroup.setVisibility(View.VISIBLE);
}
TopViewAnimHelper.getInstance().exitVrMode();
TopViewNoLinkageAnimHelper.getInstance().exitVrMode();
mCameraLiveNoticeHelper.exitVrMode();
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoLocationListener(TAG);
localIsVrMode = false;
}
private void debugCrashWarn() {
if (!DebugConfig.isMapBased()) {
// 不基于地图的版本需要隐藏一些按钮
mMove2CurrentLocation.setVisibility(View.GONE);
mWeatherContainer.setVisibility(View.GONE);
mMsgContainer.setVisibility(View.GONE);
}
}
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 ");
}
}
}
}
/**
* 地图移动和缩放回调
@@ -338,20 +144,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
}
/**
* 由于Launcher和Independent对于天气的表现形式不太一样所以通过此方法区分处理
*/
private void dealWeatherContainer() {
if (!DebugConfig.isLauncher()) {
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone((ConstraintLayout) getView());
constraintSet.clear(R.id.module_ext_id_weather_container, ConstraintSet.START);
constraintSet.connect(R.id.module_ext_id_weather_container, ConstraintSet.END,
getView().getId(), ConstraintSet.END);
constraintSet.applyTo((ConstraintLayout) getView());
}
}
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
"AUTONAVI_STANDARD_BROADCAST_RECV";
@@ -364,11 +156,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mService = mApis.getMapServiceApi();
mMogoRegisterCenter = mApis.getRegisterCenterApi();
mMApUIController = mService.getMapUIController();
mMogoNavi = mService.getNavi(getContext());
mAnalytics = mApis.getAnalyticsApi();
mMogoRegisterCenter.registerMogoNaviListener(TYPE_ENTRANCE, this);
mMogoRegisterCenter.registerMogoMapListener(TYPE_ENTRANCE, this);
@@ -377,16 +165,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.DISPLAY_OVERVIEW, this);
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
TopViewAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
TopViewNoLinkageAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
mClickShareVoiceStrings =
getContext().getResources().getStringArray(R.array.click_share_voice_guide_array);
//TODO 因为衡阳6.30交付没有2D模式临时方案进入vr模式不可缩放地图
// 进入鹰眼模式,设置手势缩放地图失效
Logger.d(TAG, "进入vr模式");
mMApUIController.changeMapMode(EnumMapUI.Type_VR);
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.Type_VR);
@@ -418,17 +199,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
public void onIntentReceived(String intentStr, Intent intent) {
int key_type = intent.getIntExtra("KEY_TYPE", 0);
int type = intent.getIntExtra("EXTRA_TYPE", -1);
int opera_type = intent.getIntExtra("EXTRA_OPERA", -1);
if (key_type == 10027) {
if (opera_type == 0) {
mCameraMode.setSelected(false);
} else if (opera_type == 1) {
mCameraMode.setSelected(true);
}
mCameraMode.setText(getString(mCameraMode.isSelected() ?
R.string.mode_car_up : R.string.mode_north_up));
} else if (key_type == 10021) {
if (key_type == 10021) {
try {
onStopNavi();
} catch (Exception e) {
@@ -439,9 +210,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
if (naviinfo == null) {
return;
}
}
@Override
@@ -450,17 +219,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
return;
}
TopViewAnimHelper.getInstance().showNaviView();
mMApUIController.changeMapMode(mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D :
EnumMapUI.CarUp_2D);
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay(mMApUIController, Scene.NAVI, 500
, () -> !mMogoNavi.isNaviing());
if (CustomNaviInterrupter.getInstance().interrupt()) {
mDisplayOverview.setVisibility(View.GONE);
mCameraMode.setVisibility(View.GONE);
} else {
mDisplayOverview.setVisibility(View.VISIBLE);
mCameraMode.setVisibility(View.VISIBLE);
}
mApis.getAnalyticsApi().track("Navigation_begin", new HashMap<>());
}
@@ -470,10 +228,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
return;
}
TopViewAnimHelper.getInstance().hideNaviView();
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
mDisplayOverview.setVisibility(View.GONE);
mCameraMode.setVisibility(View.GONE);
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.AIMLESS);
}
@Override
@@ -482,109 +236,21 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
public void onLockMap(boolean isLock) {
mIsLock = isLock;
if (isLock) {
if (mStatusManager.isDisplayOverview()) {
mStatusManager.setDisplayOverview(TAG, false);
}
} else {
}
}
private void traceData(String from) {
Map<String, Object> properties = new HashMap<>();
properties.put("from", from);
mAnalytics.track("v2x_share_click", properties);
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
Logger.d(TAG, "descriptor=" + descriptor + " isTrue=" + isTrue);
if (descriptor == StatusDescriptor.UPLOADING && DebugConfig.isLauncher()) {
if (isTrue) {
mUploadButtonAnimatorController.doFrameAnimOnUploadButton();
} else {
mUploadButtonAnimatorController.stopAnimation();
}
} else if (descriptor == StatusDescriptor.DISPLAY_OVERVIEW) {
if (!mMogoNavi.isNaviing()) {
return;
}
if (isTrue) {
mDisplayOverviewText.setText("退出全览");
mDisplayOverviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
AbsMogoApplication.getApp().getResources().getDimensionPixelSize(R.dimen.module_ext_display_overview_textSize));
mCameraMode.setVisibility(View.GONE);
} else {
mDisplayOverviewText.setText("全览");
mDisplayOverviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
AbsMogoApplication.getApp().getResources().getDimensionPixelSize(R.dimen.module_ext_display_overview_textSize_large));
if (CustomNaviInterrupter.getInstance().interrupt()) {
mCameraMode.setVisibility(View.GONE);
} else {
mCameraMode.setVisibility(View.VISIBLE);
}
}
} else if (descriptor == StatusDescriptor.SEEK_HELPING) {
if (!isTrue) {
handler.post(() -> seekHelpGroup.setVisibility(View.GONE));
}
} else if (descriptor == StatusDescriptor.VR_MODE) {
try {
if (isTrue) {
enterVrMode();
} else {
exitVrMode();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void renderWeatherInfo(String temp, String desc, int iconId) {
if (!DebugConfig.isMapBased()) {
return;
}
if (mApis.getStatusManagerApi().isVrMode()) {
return;
}
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.INVISIBLE : View.VISIBLE);
}
@Override
public void renderMsgInfo(boolean hasMsg, int amount) {
if (!DebugConfig.isMapBased()) {
return;
}
if (mApis.getStatusManagerApi().isVrMode()) {
return;
}
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 onMapModeChanged(EnumMapUI ui) {
if (mCameraMode == null) {
return;
}
mCameraMode.setSelected(ui == EnumMapUI.NorthUP_2D);
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up : R.string.mode_north_up));
}
@Override
@@ -592,33 +258,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
private static final int SEEK_HELP_NOTICE_NUM_MSG_TYPE = 401015;
//求助已通知周围XX位车主
private final IMogoOnMessageListener<String> seekHelpNoticeListener =
new IMogoOnMessageListener<String>() {
@Override
public Class<String> target() {
return String.class;
}
@Override
public void onMsgReceived(String obj) {
if (mStatusManager.isSeekHelping()) {
int seekNum = SharedPrefsMgr.getInstance(getContext()).getInt("seek_help_num", 0);
final int finalSeekNum = ++seekNum;
SharedPrefsMgr.getInstance(getContext()).putInt("seek_help_num", seekNum);
handler.post(() -> {
seekHelpGroup.setVisibility(localIsVrMode ? View.INVISIBLE : View.VISIBLE);
seekHelpNum.setText("" + finalSeekNum);
});
}
}
};
private final Handler handler = new Handler();
private void listenSeekNumber() {
mApis.getSocketManagerApi(getContext()).registerOnMessageListener(SEEK_HELP_NOTICE_NUM_MSG_TYPE, seekHelpNoticeListener);
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this);
}
@@ -641,159 +283,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
if (mApis.getIntentManagerApi() != null) {
mApis.getIntentManagerApi().unregisterIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
}
mApis.getSocketManagerApi(getContext()).unregisterOnMessageListener(SEEK_HELP_NOTICE_NUM_MSG_TYPE, seekHelpNoticeListener);
}
}
private Group debugPanelGroup;
private void initDebugPanel() {
debugPanelGroup = findViewById(R.id.groupDebugPanel);
ImageButton ibDebugPanelClose = findViewById(R.id.ibDebugPanelClose);
Button btnOpenLog = findViewById(R.id.btnOpenLog);
Button btnCloseLog = findViewById(R.id.btnCloseLog);
Button btnOpenV2XPanel = findViewById(R.id.btnOpenV2xPanel);
RadioButton rbCidi = findViewById(R.id.rbCidiObu);
RadioButton rbHuali = findViewById(R.id.rbHualiObu);
RadioButton rbGohigh = findViewById(R.id.rbGoHighObu);
ibDebugPanelClose.setOnClickListener(v -> debugPanelGroup.setVisibility(View.GONE));
btnOpenLog.setOnClickListener(v -> {
Intent intent = new Intent("com.mogo.ACTION");
intent.putExtra("oper", 1);
getContext().sendBroadcast(intent);
debugPanelGroup.setVisibility(View.GONE);
});
btnCloseLog.setOnClickListener(v -> {
Intent intent = new Intent("com.mogo.ACTION");
intent.putExtra("oper", 2);
getContext().sendBroadcast(intent);
debugPanelGroup.setVisibility(View.GONE);
});
btnOpenV2XPanel.setOnClickListener(v -> {
Intent intent = new Intent("com.v2x.test_panel_control");
intent.putExtra("TextPanelOpenStatus", true);
getContext().sendBroadcast(intent);
debugPanelGroup.setVisibility(View.GONE);
});
switch (DebugConfig.getObuType()) {
case DebugConfig.OBU_TYPE_CIDI:
rbCidi.setChecked(true);
break;
case DebugConfig.OBU_TYPE_HUALI:
rbHuali.setChecked(true);
break;
default:
rbGohigh.setChecked(true);
break;
}
rbCidi.setOnClickListener(v -> exchangeObuType(DebugConfig.OBU_TYPE_CIDI));
rbHuali.setOnClickListener(v -> exchangeObuType(DebugConfig.OBU_TYPE_HUALI));
rbGohigh.setOnClickListener(v -> exchangeObuType(DebugConfig.OBU_TYPE_GOHIGH));
}
private void exchangeObuType(int obuType) {
SharedPrefsMgr.getInstance(getContext()).putInt("OBU_TYPE", obuType);
DebugConfig.setObuType(obuType);
Intent intent = new Intent("com.mogo.launcher.v2x.action.EXCHANGE_OBU_TYPE");
intent.putExtra("obuType", obuType);
getContext().sendBroadcast(intent);
}
private final OnPreventFastClickListener clickListener = new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
if (v.getId() == R.id.module_ext_id_display_overview) {
// 全览按钮点击
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());
}
} else if (v.getId() == R.id.module_entrance_id_move2_current_location) {
// 回到自车位置
if (mStatusManager.isDisplayOverview()) {
mStatusManager.setDisplayOverview(TAG, false);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
}
if (!mApis.getStatusManagerApi().isVrMode()) {
if (!mApis.getRefreshStrategyControllerApi().restartAutoRefreshAtTime(0)) {
mStatusManager.setUserInteractionStatus(TAG, true, false);
mMApUIController.recoverLockMode();
}
} else {
mMApUIController.recoverLockMode();
}
} else if (v.getId() == R.id.module_ext_id_north) {
// 车头朝上 正北朝上
if (mCameraMode.isSelected()) {
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
} else {
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
}
} else if (v.getId() == R.id.module_ext_id_msg) {
// 消息框
try {
if (mMessageHistoryPanelProvider == null) {
mMessageHistoryPanelProvider = (IFragmentProvider) ARouter.getInstance().build("/push/ui/message").navigation(getContext());
}
mMessageHistoryPanelProvider.createFragment(getActivity(), mMogoFragmentManager.getMessageHistoryContainerId(), null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (v.getId() == R.id.module_ext_exit_vr_mode) {
// 退出vr模式
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
} else if (v.getId() == R.id.btnFix) {
// 修改上报时间间隔
try {
String times = etTimes.getText().toString().trim();
int fixTime = Integer.parseInt(times);
Logger.d(TAG, "修改上报时间间隔: " + times + " fixTime: " + fixTime);
if (fixTime > 0) {
Intent intent = new Intent("com.mogo.launcher.action.FIX_UPLOAT_DELAY");
intent.putExtra("fixTime", fixTime);
getContext().sendBroadcast(intent);
TipToast.tip("已经发送修改广播");
} else {
TipToast.tip("fixTime为0不发送广播");
}
} catch (Exception e) {
TipToast.tip("fixTime异常");
e.printStackTrace();
}
} else if (v.getId() == R.id.debugPanel) {
// 简易调试面板
long diff = SystemClock.elapsedRealtime() - lastDebugPanelClickTime;
Logger.d("DebugPanel", "diff: " + diff);
if (diff > 3000) {
debugPanelClickCount = 1;
} else {
debugPanelClickCount++;
}
lastDebugPanelClickTime = SystemClock.elapsedRealtime();
if (debugPanelClickCount == 10) {
// show panel
debugPanelGroup.setVisibility(View.VISIBLE);
}
}
}
};
}

View File

@@ -8,26 +8,16 @@ import android.util.ArrayMap;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.network.utils.digest.DigestUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.HostConst;
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.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.network.IMogoNetwork;
import com.mogo.service.statusmanager.IMogoMsgCenter;
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
import java.util.Map;
@@ -42,85 +32,22 @@ import io.reactivex.schedulers.Schedulers;
* <p>
* 描述
*/
public class EntrancePresenter extends Presenter<EntranceView> implements WeatherCallback,
IMogoMsgCenterListener {
public class EntrancePresenter extends Presenter<EntranceView> {
private static final String TAG = "EntrancePresenter";
private WeatherModel mWeatherModel;
private IMogoMsgCenter mMsgCenter;
private IMogoNetwork mNetWork;
private Context context;
private boolean isResumed = false;
public EntrancePresenter(Context context, EntranceView view) {
super(view);
this.context = context;
mWeatherModel = new WeatherModel(getContext());
mNetWork = MogoApisHandler.getInstance().getApis().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;
}
Phenomena phenomena = Phenomena.getById(weatherInfo.getPhenomena());
if (phenomena == null) {
return;
}
String temp =
getContext().getResources().getString(R.string.module_ext_str_weather_temp_format
, weatherInfo.getTemperature());
String desc = 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);
isResumed = true;
getCommonConfig();
}
@Override
public void onPause(@NonNull LifecycleOwner owner) {
super.onPause(owner);
isResumed = false;
}
@Override
public void onDestroy(@NonNull LifecycleOwner owner) {
super.onDestroy(owner);
if (mWeatherModel != null) {
mWeatherModel.destroy();
}
if (mMsgCenter != null) {
mMsgCenter.unregisterMsgCenterListener(this);
}
}
public void getCommonConfig() {
Map<String, Object> params = new ArrayMap<>();
params.put("sn", MoGoAiCloudClientConfig.getInstance().getSn());

View File

@@ -1,8 +1,6 @@
package com.mogo.module.extensions.entrance;
import com.mogo.commons.mvp.IView;
import com.mogo.module.extensions.ExtensionsView;
import com.mogo.module.extensions.userinfo.UserInfo;
/**
* @author congtaowang

View File

@@ -1,130 +0,0 @@
package com.mogo.module.extensions.entrance;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.DrawableRes;
import com.mogo.module.extensions.R;
import com.mogo.service.statusmanager.IMogoStatusManager;
public
/**
* @author congtaowang
* @since 2020/7/16
*
* 上传按钮动画
*/
class UploadButtonAnimatorController {
private static final String TAG = "UploadButtonAnimator";
private ImageView mUploading;
private TextView mUpload;
private IMogoStatusManager mStatusManager;
private int mCurrentUploadFrame = 0;
public static final int MSG_FRAME_ANIM = 307;
public static final int MSG_STOP_ANIM = 308;
public static final long TIME_FRAME_INTERVAL_TIME = 80;
private Handler mUploadFrameAnimHandler = new Handler( Looper.getMainLooper() ) {
@Override
public void handleMessage( Message msg ) {
super.handleMessage( msg );
if ( msg.what == MSG_FRAME_ANIM ) {
if ( mUploadingFrameRes == null || mUploadingFrameRes.length == 0 ) {
if ( mUploading != null ) {
mUploading.setVisibility( View.GONE );
}
if ( mUpload != null ) {
mUpload.setVisibility( View.VISIBLE );
}
return;
}
if ( !mStatusManager.isUploading() ) {
mCurrentUploadFrame = 0;
return;
}
if ( mUploading != null ) {
if ( mCurrentUploadFrame == mUploadingFrameRes.length ) {
mCurrentUploadFrame = 12;
}
mUploading.setImageResource( mUploadingFrameRes[mCurrentUploadFrame++ % mUploadingFrameRes.length] );
}
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_FRAME_ANIM,
TIME_FRAME_INTERVAL_TIME );
} else if ( msg.what == MSG_STOP_ANIM ) {
mStatusManager.setUploadingStatus( TAG, false );
}
}
};
@DrawableRes
private int[] mUploadingFrameRes = {
R.drawable.module_ext_ic_uploading_00000,
R.drawable.module_ext_ic_uploading_00001,
R.drawable.module_ext_ic_uploading_00002,
R.drawable.module_ext_ic_uploading_00003,
R.drawable.module_ext_ic_uploading_00004,
R.drawable.module_ext_ic_uploading_00005,
R.drawable.module_ext_ic_uploading_00006,
R.drawable.module_ext_ic_uploading_00007,
R.drawable.module_ext_ic_uploading_00008,
R.drawable.module_ext_ic_uploading_00009,
R.drawable.module_ext_ic_uploading_00010,
R.drawable.module_ext_ic_uploading_00011,
R.drawable.module_ext_ic_uploading_00012,
R.drawable.module_ext_ic_uploading_00013,
R.drawable.module_ext_ic_uploading_00014,
R.drawable.module_ext_ic_uploading_00015,
R.drawable.module_ext_ic_uploading_00016,
R.drawable.module_ext_ic_uploading_00017,
R.drawable.module_ext_ic_uploading_00018,
R.drawable.module_ext_ic_uploading_00019,
R.drawable.module_ext_ic_uploading_00020,
R.drawable.module_ext_ic_uploading_00021,
R.drawable.module_ext_ic_uploading_00022,
R.drawable.module_ext_ic_uploading_00023,
R.drawable.module_ext_ic_uploading_00024,
R.drawable.module_ext_ic_uploading_00025,
R.drawable.module_ext_ic_uploading_00026,
R.drawable.module_ext_ic_uploading_00027,
R.drawable.module_ext_ic_uploading_00028,
R.drawable.module_ext_ic_uploading_00029,
R.drawable.module_ext_ic_uploading_00030,
R.drawable.module_ext_ic_uploading_00031,
R.drawable.module_ext_ic_uploading_00032,
R.drawable.module_ext_ic_uploading_00033,
R.drawable.module_ext_ic_uploading_00034,
R.drawable.module_ext_ic_uploading_00035,
R.drawable.module_ext_ic_uploading_00036,
R.drawable.module_ext_ic_uploading_00037,
R.drawable.module_ext_ic_uploading_00038,
R.drawable.module_ext_ic_uploading_00039,
R.drawable.module_ext_ic_uploading_00040
};
public UploadButtonAnimatorController( ImageView mUploading, TextView mUpload, IMogoStatusManager mStatusManager ) {
this.mUploading = mUploading;
this.mUpload = mUpload;
this.mStatusManager = mStatusManager;
}
public void doFrameAnimOnUploadButton() {
mUploadFrameAnimHandler.removeMessages( MSG_STOP_ANIM );
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
mUploadFrameAnimHandler.sendEmptyMessage( MSG_FRAME_ANIM );
// 30s 后无论成功与否,停止动画
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_STOP_ANIM, 30_000 );
}
public void stopAnimation() {
mCurrentUploadFrame = 0;
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
}
}

View File

@@ -2,8 +2,6 @@ package com.mogo.module.extensions.live.impl;
import android.view.View;
import com.mogo.module.extensions.live.listener.CameraLiveWindowStatusListener;
public interface ICameraWindow<T> {
/**

View File

@@ -1,7 +0,0 @@
package com.mogo.module.extensions.live.listener;
public interface CameraLiveWindowStatusListener {
void onViewShow();
void onViewClose();
}

View File

@@ -1,237 +0,0 @@
package com.mogo.module.extensions.navi;
import android.content.Context;
import android.transition.TransitionManager;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.Group;
import com.mogo.eagle.core.utilcode.util.LaunchUtils;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.module.extensions.R;
import java.util.HashMap;
import java.util.Map;
/**
* 带动画的导航框
*
* @author tongchenfei
*/
public class AnimNavInfoView extends BaseNaviInfoView {
private final ImageView turnIcon;
private final TextView distance;
private final TextView distanceUnit;
private final TextView nextRoad;
private final TextView remainingDistance;
private final TextView remainingDistanceUnit;
private final TextView remainingTime;
private final TextView remainingTimeUnit;
private final TextView arriveTime;
private final View naviBg;
private final TextView tvDestinationOnlineCar;
private final Group remainTimeGroup, remainDistanceGroup, arriveTimeGroup;
private final ConstraintSet constraintSet = new ConstraintSet();
public AnimNavInfoView(Context context) {
this(context, null);
}
public AnimNavInfoView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public AnimNavInfoView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LayoutInflater.from(context).inflate(R.layout.include_navi_info_panle, this);
naviBg = findViewById(R.id.module_map_id_navi_bg);
turnIcon = findViewById(R.id.module_map_id_navi_next_info_road_turn_icon);
distance = findViewById(R.id.module_map_id_navi_next_info_distance);
distanceUnit = findViewById(R.id.module_map_id_navi_next_info_distance_unit);
nextRoad = findViewById(R.id.module_map_id_navi_next_info_road);
remainingDistance = findViewById(R.id.module_map_id_remaining_distance);
remainingDistanceUnit = findViewById(R.id.module_map_id_remaining_distance_unit);
remainingTime = findViewById(R.id.module_map_id_remaining_time);
remainingTimeUnit = findViewById(R.id.module_map_id_remaining_time_unit);
arriveTime = findViewById(R.id.module_map_id_arrive_time);
remainTimeGroup = findViewById(R.id.remainTimeGroup);
remainDistanceGroup = findViewById(R.id.remainDistanceGroup);
arriveTimeGroup = findViewById(R.id.arriveTimeGroup);
tvDestinationOnlineCar = findViewById(R.id.module_ext_id_destination_online_car);
if ( tvDestinationOnlineCar != null ) {
tvDestinationOnlineCar.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);
}
});
}
naviBg.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
try {
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
@Override
public boolean isVisible() {
return getVisibility() == View.VISIBLE;
}
@Override
public void notifyChanged(MogoNaviInfo naviInfo) {
if (naviInfo == null) {
return;
}
fillNextCrossDistance(distance, distanceUnit, naviInfo.getCurStepRetainDistance());
fillNextCrossIconType(turnIcon, naviInfo.getIconResId());
nextRoad.setText(naviInfo.getNextRoadName());
remainingDistance.setText(getFormatSurplusDistance(naviInfo.getPathRetainDistance()));
remainingDistanceUnit.setText(getFormatSurplusDistanceUnit());
remainingTime.setText(getFormatSurplusTime(naviInfo.getPathRetainTime()));
remainingTimeUnit.setText(getFormatSurplusTimeUnit());
arriveTime.setText(getArriveTime(naviInfo.getPathRetainTime()));
}
public void exchangeToSmall(boolean smooth) {
if (!isVisible()) {
return;
}
if (smooth) {
TransitionManager.beginDelayedTransition(this);
}
remainDistanceGroup.setVisibility(View.GONE);
remainTimeGroup.setVisibility(View.GONE);
arriveTimeGroup.setVisibility(View.GONE);
distance.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize_small));
distanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize_small));
// 调整约束
constraintSet.clone(this);
constraintSet.connect(distance.getId(), ConstraintSet.BOTTOM,
turnIcon.getId(), ConstraintSet.BOTTOM);
constraintSet.connect(turnIcon.getId(), ConstraintSet.LEFT,
naviBg.getId(), ConstraintSet.LEFT,
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_small_marginLeft));
constraintSet.connect(nextRoad.getId(), ConstraintSet.BOTTOM,
distance.getId(), ConstraintSet.BOTTOM,
getResources().getDimensionPixelSize(R.dimen.module_map_id_navi_next_info_road_marginBottom_small));
constraintSet.connect(nextRoad.getId(), ConstraintSet.LEFT,
R.id.module_map_id_navi_next_info_turn_info, ConstraintSet.RIGHT,
getResources().getDimensionPixelSize(R.dimen.dp_46));
constraintSet.clear(turnIcon.getId(), ConstraintSet.TOP);
constraintSet.connect(turnIcon.getId(), ConstraintSet.BOTTOM,
naviBg.getId(), ConstraintSet.BOTTOM,
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_turn_icon_margin_bottom));
// 目的地车友
constraintSet.clear(tvDestinationOnlineCar.getId(), ConstraintSet.LEFT);
constraintSet.clear(tvDestinationOnlineCar.getId(), ConstraintSet.TOP);
constraintSet.connect(tvDestinationOnlineCar.getId(),
ConstraintSet.BOTTOM, naviBg.getId(), ConstraintSet.BOTTOM,
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_small_margin_bottom));
constraintSet.connect(tvDestinationOnlineCar.getId(),
ConstraintSet.RIGHT, naviBg.getId(), ConstraintSet.RIGHT,
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_small_margin_right));
constraintSet.applyTo(this);
turnIcon.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_small_height);
turnIcon.getLayoutParams().width =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_small_width);
naviBg.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_small_height);
tvDestinationOnlineCar.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_button_height_small);
tvDestinationOnlineCar.setBackgroundResource(R.drawable.module_ext_dw_navi_info_panel_small_bkg);
}
public void exchangeToBig(boolean smooth) {
if (!isVisible()) {
return;
}
if (smooth) {
TransitionManager.beginDelayedTransition(this);
}
remainDistanceGroup.setVisibility(View.VISIBLE);
remainTimeGroup.setVisibility(View.VISIBLE);
arriveTimeGroup.setVisibility(View.VISIBLE);
distance.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize));
distanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize));
// 调整约束
constraintSet.clone(this);
constraintSet.clear(distance.getId(), ConstraintSet.BOTTOM);
constraintSet.connect(turnIcon.getId(), ConstraintSet.LEFT,
naviBg.getId(), ConstraintSet.LEFT,
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_marginLeft));
constraintSet.connect(nextRoad.getId(), ConstraintSet.BOTTOM, turnIcon.getId(),
ConstraintSet.BOTTOM);
constraintSet.connect(nextRoad.getId(), ConstraintSet.LEFT,
distance.getId(), ConstraintSet.LEFT,
0);
constraintSet.connect(turnIcon.getId(), ConstraintSet.TOP, naviBg.getId(),
ConstraintSet.TOP, 0);
constraintSet.connect(turnIcon.getId(), ConstraintSet.BOTTOM,
naviBg.getId(), ConstraintSet.BOTTOM, 0);
// 目的地车友
constraintSet.clear(tvDestinationOnlineCar.getId(), ConstraintSet.RIGHT);
constraintSet.clear(tvDestinationOnlineCar.getId(), ConstraintSet.BOTTOM);
constraintSet.connect(tvDestinationOnlineCar.getId(), ConstraintSet.LEFT,
naviBg.getId(), ConstraintSet.LEFT);
constraintSet.connect(tvDestinationOnlineCar.getId(), ConstraintSet.TOP,
naviBg.getId(), ConstraintSet.BOTTOM,
getResources().getDimensionPixelSize(R.dimen.module_ext_camera_button_marginTop));
constraintSet.applyTo(this);
turnIcon.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_height);
turnIcon.getLayoutParams().width =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_width);
naviBg.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_height);
tvDestinationOnlineCar.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_button_height);
tvDestinationOnlineCar.setBackgroundResource(R.drawable.module_ext_dw_navi_info_panel_bkg);
}
}

View File

@@ -1,162 +0,0 @@
package com.mogo.module.extensions.navi;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.map.navi.MogoNaviInfo;
import java.text.SimpleDateFormat;
import java.util.Calendar;
/**
* @author congtaowang
* @since 2019-10-03
* <p>
* 描述
*/
public abstract class BaseNaviInfoView extends ConstraintLayout {
public BaseNaviInfoView(Context context) {
this(context,null);
}
public BaseNaviInfoView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public BaseNaviInfoView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public abstract void notifyChanged(MogoNaviInfo naviInfo );
protected void fillNextCrossIconType( ImageView target, int iconId ) {
if ( iconId > 0 ) {
target.setImageResource( iconId );
}
}
protected void fillNextCrossDistance( TextView target, TextView unit, int distance ) {
if ( distance >= 1000 ) {
target.setText( String.format( "%.1f", distance / 1000f ) );
unit.setText( "公里" );
} else {
target.setText( distance + "" );
unit.setText( "" );
}
}
protected void fillFormatSurplusDistance( int m, StringBuilder builder ) {
if ( m >= 1000 ) {
builder.append( String.format( "%.1f公里", m / 1000f ) );
} else {
builder.append( m ).append( "" );
}
}
protected String getFormatSurplusDistance( int m ) {
if ( m >= 1000 ) {
mFormatSurplusDistanceUnit = "公里";
return String.format( "%.1f", m / 1000f );
} else {
mFormatSurplusDistanceUnit = "";
return String.format( "%d", m );
}
}
private String mFormatSurplusDistanceUnit = "";
protected String getFormatSurplusDistanceUnit() {
return mFormatSurplusDistanceUnit;
}
protected String getFormatSurplusTime( int seconds ) {
if ( seconds > 60 * 60 ) {
mFormatSurplusTimeUnit = "小时";
return String.format( "%.1f", ( ( float ) seconds ) / ( 60 * 60 ) );
}
if ( seconds > 60 ) {
mFormatSurplusTimeUnit = "分钟";
return String.format( "%.1f", ( ( float ) seconds ) / 60 );
}
mFormatSurplusTimeUnit = "";
return String.format( "%d", seconds );
}
private String mFormatSurplusTimeUnit = "";
protected String getFormatSurplusTimeUnit() {
return mFormatSurplusTimeUnit;
}
protected void fillFormatTime( int seconds, StringBuilder builder ) {
int days = seconds / ( 24 * 60 * 60 );
if ( days > 0 ) {
builder.append( days ).append( "" );
}
seconds -= days * 24 * 60 * 60;
int hours = seconds / ( 60 * 60 );
if ( hours > 0 ) {
builder.append( hours ).append( "小时" );
}
seconds -= hours * 60 * 60;
int min = seconds / 60;
builder.append( min > 1 ? min : 1 ).append( "分钟" );
}
protected String getArriveTime( int seconds ) {
int days = seconds / ( 24 * 60 * 60 );
if ( days > 0 ) {
return String.format( "%d天后", days );
} else {
seconds -= days * 24 * 60 * 60;
int hours = seconds / ( 60 * 60 );
seconds -= hours * 60 * 60;
int min = seconds / 60;
Calendar calendar = Calendar.getInstance();
int curHour = calendar.get( Calendar.HOUR_OF_DAY );
int curMin = calendar.get( Calendar.MINUTE );
if ( curHour + hours + ( curMin + min ) / 60 > 24 ) {
return "一天后";
} else {
calendar.add( Calendar.HOUR_OF_DAY, hours );
calendar.add( Calendar.MINUTE, min );
SimpleDateFormat dateFormat = new SimpleDateFormat( "HH:mm" );
return dateFormat.format( calendar.getTime() );
}
}
}
protected void fillArriveTime( int seconds, StringBuilder builder ) {
int days = seconds / ( 24 * 60 * 60 );
if ( days > 0 ) {
builder.append( days ).append( "天后" );
} else {
seconds -= days * 24 * 60 * 60;
int hours = seconds / ( 60 * 60 );
seconds -= hours * 60 * 60;
int min = seconds / 60;
Calendar calendar = Calendar.getInstance();
int curHour = calendar.get( Calendar.HOUR_OF_DAY );
int curMin = calendar.get( Calendar.MINUTE );
if ( curHour + hours + ( curMin + min ) / 60 > 24 ) {
builder.append( "一天后" );
} else {
calendar.add( Calendar.HOUR_OF_DAY, hours );
calendar.add( Calendar.MINUTE, min );
SimpleDateFormat dateFormat = new SimpleDateFormat( "HH:mm" );
builder.append( dateFormat.format( calendar.getTime() ) );
}
}
builder.append( "到达" );
}
public abstract boolean isVisible();
}

View File

@@ -1,83 +0,0 @@
package com.mogo.module.extensions.navi;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.module.extensions.R;
/**
* @author congtaowang
* @since 2019-09-29
* <p>
* 导航信息
*
* @deprecated 已经废弃
*/
@Deprecated
public class NaviInfoView extends BaseNaviInfoView {
private ImageView turnIcon;
private TextView distance;
private TextView distanceUnit;
private TextView nextRoad;
private TextView remainingDistance;
private TextView remainingDistanceUnit;
private TextView remainingTime;
private TextView remainingTimeUnit;
private TextView arriveTime;
public NaviInfoView(Context context) {
this(context,null);
}
public NaviInfoView(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public NaviInfoView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
// public NaviInfoView(View view) {
// super(view);
// turnIcon = view.findViewById( R.id.module_map_id_navi_next_info_road_turn_icon );
// distance = view.findViewById( R.id.module_map_id_navi_next_info_distance );
// distanceUnit = view.findViewById( R.id.module_map_id_navi_next_info_distance_unit );
// nextRoad = view.findViewById( R.id.module_map_id_navi_next_info_road );
//
// remainingDistance = view.findViewById( R.id.module_map_id_remaining_distance );
// remainingDistanceUnit = view.findViewById( R.id.module_map_id_remaining_distance_unit );
// remainingTime = view.findViewById( R.id.module_map_id_remaining_time );
// remainingTimeUnit = view.findViewById( R.id.module_map_id_remaining_time_unit );
// arriveTime = view.findViewById( R.id.module_map_id_arrive_time );
// }
@Override
public boolean isVisible() {
return turnIcon != null && turnIcon.getVisibility() == View.VISIBLE;
}
@Override
public void notifyChanged( MogoNaviInfo naviInfo ) {
if ( naviInfo == null ) {
return;
}
fillNextCrossDistance( distance, distanceUnit, naviInfo.getCurStepRetainDistance() );
fillNextCrossIconType( turnIcon, naviInfo.getIconResId() );
nextRoad.setText( naviInfo.getNextRoadName() );
remainingDistance.setText( getFormatSurplusDistance( naviInfo.getPathRetainDistance() ) );
remainingDistanceUnit.setText( getFormatSurplusDistanceUnit() );
remainingTime.setText( getFormatSurplusTime( naviInfo.getPathRetainTime() ) );
remainingTimeUnit.setText( getFormatSurplusTimeUnit() );
arriveTime.setText( getArriveTime( naviInfo.getPathRetainTime() ) );
}
}

View File

@@ -1,25 +0,0 @@
package com.mogo.module.extensions.net;
import com.mogo.module.extensions.weather.WebWeatherData;
import io.reactivex.Observer;
import retrofit2.http.GET;
import retrofit2.http.Query;
/**
* @author congtaowang
* @since 2020-01-07
* <p>
* 描述
*/
public interface NetApiServices {
/**
* 天气接口
*
* @param area 城市Id
* @return
*/
@GET( "/common/?type=observe&key=a2c37c5b84a29761bf0abf8b98e6b708" )
Observer< WebWeatherData > requestWeatherData( @Query( "area" ) String area );
}

View File

@@ -1,25 +0,0 @@
package com.mogo.module.extensions.net;
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;
/**
* 个人信息的获取api接口baseUrl跟其他不太一样
*
* @author tongchenfei
*/
public interface UserInfoNetApiServices {
/**
* 获取用户个人信息
* @param params 参数
* @return Observer
*/
@GET("carlife/carMachine/getAccountInfo")
Single<UserInfoResponse> requestUserInfo(@QueryMap Map<String, String> params);
}

View File

@@ -1,27 +0,0 @@
package com.mogo.module.extensions.userinfo;
/**
* 用户的家和公司位置信息封装,用于接口获取
*
* @author tongchenfei
*/
public class Address {
private String companyAddress;
private String homeAddress;
public String getCompanyAddress() {
return companyAddress;
}
public void setCompanyAddress(String companyAddress) {
this.companyAddress = companyAddress;
}
public String getHomeAddress() {
return homeAddress;
}
public void setHomeAddress(String homeAddress) {
this.homeAddress = homeAddress;
}
}

View File

@@ -1,113 +0,0 @@
package com.mogo.module.extensions.userinfo;
/**
* 用户的个人信息
*
* @author tongchenfei
*/
public class UserInfo {
private String userId;
private String phone;
private String displayName;
private Address additionalOne;
private String headImgurl;
private int ownerAuthState;
private int score;
private String memberLevel;
private String activeTime;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public Address getAdditionalOne() {
return additionalOne;
}
public void setAdditionalOne(Address additionalOne) {
this.additionalOne = additionalOne;
}
public String getHeadImgurl() {
return headImgurl;
}
public void setHeadImgurl(String headImgurl) {
this.headImgurl = headImgurl;
}
public int getOwnerAuthState() {
return ownerAuthState;
}
public void setOwnerAuthState(int ownerAuthState) {
this.ownerAuthState = ownerAuthState;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String getMemberLevel() {
return memberLevel;
}
public void setMemberLevel(String memberLevel) {
this.memberLevel = memberLevel;
}
public String getActiveTime() {
return activeTime;
}
public void setActiveTime(String activeTime) {
this.activeTime = activeTime;
}
@Override
public String toString() {
return "UserInfo{" +
"userId='" + userId + '\'' +
", phone='" + phone + '\'' +
", displayName='" + displayName + '\'' +
", additionalOne=" + additionalOne +
", headImgurl='" + headImgurl + '\'' +
", ownerAuthState=" + ownerAuthState +
", score=" + score +
", memberLevel='" + memberLevel + '\'' +
", activeTime='" + activeTime + '\'' +
'}';
}
}

View File

@@ -1,36 +0,0 @@
package com.mogo.module.extensions.userinfo;
/**
* 用户信息响应封装类
*
* @author tongchenfei
*/
public class UserInfoResponse {
private String errmsg;
private int errno;
private UserInfo result;
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public int getErrno() {
return errno;
}
public void setErrno(int errno) {
this.errno = errno;
}
public UserInfo getResult() {
return result;
}
public void setResult(UserInfo result) {
this.result = result;
}
}

View File

@@ -63,16 +63,6 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
mContext = null;
}
public void enterVrMode() {
Logger.d(TAG, "进入vr模式=========");
isVrMode = true;
}
public void exitVrMode() {
Logger.d(TAG, "退出vr模式=========");
isVrMode = false;
}
/**
* PushRoadConditionDrawer
* vr模式

View File

@@ -1,19 +1,15 @@
package com.mogo.module.extensions.utils;
import android.animation.Animator;
import android.os.Handler;
import android.util.ArrayMap;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.map.MapCenterPointStrategy;
import com.mogo.module.common.map.Scene;
import com.mogo.module.extensions.ExtensionsModuleConst;
import com.mogo.module.extensions.R;
@@ -54,11 +50,6 @@ public class TopViewAnimHelper {
return instance;
}
private IMogoMapUIController mogoMapUIController;
public void setIMogoMapUIController(IMogoMapUIController mogoMapUIController) {
this.mogoMapUIController = mogoMapUIController;
}
public void init(ConstraintLayout rootView) {
init(rootView, null);
@@ -314,7 +305,6 @@ public class TopViewAnimHelper {
scene = Scene.AIMLESS_WITH_ROAD_EVENT;
topContainer.animate().translationY(params.height).setListener(mainAnimListener).start();
Logger.d(TAG, "show top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
} catch (Exception e) {
Logger.e(TAG, e, "添加view异常");
e.printStackTrace();
@@ -364,7 +354,6 @@ public class TopViewAnimHelper {
int scene = 0;
scene = Scene.AIMLESS;
Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, false);
}
}
@@ -383,7 +372,6 @@ public class TopViewAnimHelper {
scene = Scene.NAVI;
}
Logger.d(TAG, "navi show setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
checkCameraModePosition(true);
}
@@ -400,7 +388,6 @@ public class TopViewAnimHelper {
scene = Scene.AIMLESS_WITH_ROAD_EVENT;
}
Logger.d(TAG, "hide navi setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
checkCameraModePosition(true);
}
@@ -448,8 +435,6 @@ public class TopViewAnimHelper {
topContainer.setTranslationY(0);
topContainer.removeAllViews();
hideNaviView();
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
}
public void removeAllView() {

View File

@@ -16,6 +16,7 @@ import com.mogo.module.extensions.ExtensionsModuleConst;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.navi.TopView;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import java.util.Map;
@@ -167,16 +168,6 @@ public class TopViewNoLinkageAnimHelper {
topContainerNoLinkage = null;
}
public void enterVrMode() {
removeAllView();
topContainerNoLinkage.getLayoutParams().width = (int) getDimen(R.dimen.module_ext_top_view_no_link_width_in_vr_mode);
}
public void exitVrMode() {
removeAllView();
topContainerNoLinkage.getLayoutParams().width = LayoutParams.MATCH_PARENT;
}
private final Animator.AnimatorListener mainAnimListener = new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {

View File

@@ -1,141 +0,0 @@
package com.mogo.module.extensions.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.IntDef;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Group;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.module.common.constants.TrafficLightConst;
import com.mogo.module.extensions.R;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_GRAY;
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_GREEN;
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_RED;
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_YELLOW;
/**
* vr模式下的纵向显示的红绿灯封装
*
* @author tongchenfei
*/
public class VerticalTrafficLightView extends ConstraintLayout {
private static final String TAG = "VerticalTrafficLightView";
private ImageView ivTrafficLight, ivNoLeftTime;
private TextView tvLeftTime, tvLeftTimeUnit;
private Group groupLeftTime;
private static final int[] TURN_AROUND_ICON_RES = new int[]{R.drawable.module_ext_dw_traffic_turn_around_gray, R.drawable.module_ext_dw_traffic_turn_around_red, R.drawable.module_ext_dw_traffic_turn_around_yellow, R.drawable.module_ext_dw_traffic_turn_around_green};
private static final int[] TURN_LEFT_ICON_RES = new int[]{R.drawable.module_ext_dw_traffic_turn_left_gray, R.drawable.module_ext_dw_traffic_turn_left_red, R.drawable.module_ext_dw_traffic_turn_left_yellow, R.drawable.module_ext_dw_traffic_turn_left_green};
private static final int[] STRAIGHT_ICON_RES = new int[]{R.drawable.module_ext_dw_traffic_straight_gray, R.drawable.module_ext_dw_traffic_straight_red, R.drawable.module_ext_dw_traffic_straight_yellow, R.drawable.module_ext_dw_traffic_straight_green};
private static final int[] TURN_RIGHT_ICON_RES = new int[]{R.drawable.module_ext_dw_traffic_turn_right_gray, R.drawable.module_ext_dw_traffic_turn_right_red, R.drawable.module_ext_dw_traffic_turn_right_yellow, R.drawable.module_ext_dw_traffic_turn_right_green};
private final int[] iconRes;
private final int[] colorRes = new int[]{-1, Color.parseColor("#F63A35"), Color.parseColor("#FFA71F"), Color.parseColor("#11FF89")};
public VerticalTrafficLightView(Context context) {
this(context, null);
}
public VerticalTrafficLightView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public VerticalTrafficLightView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LayoutInflater.from(context).inflate(R.layout.merge_vertical_traffic_light_in_vr, this);
TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.VerticalTrafficLightView, 0, 0);
int lightType = typedArray.getInt(R.styleable.VerticalTrafficLightView_iconRes, 0);
typedArray.recycle();
switch (lightType) {
case 1:
// turn left
iconRes = TURN_LEFT_ICON_RES;
break;
case 2:
// straight
iconRes = STRAIGHT_ICON_RES;
break;
case 3:
// turn right
iconRes = TURN_RIGHT_ICON_RES;
break;
default:
// turn around
iconRes = TURN_AROUND_ICON_RES;
break;
}
initView();
}
private void initView() {
ivTrafficLight = findViewById(R.id.module_ext_id_traffic_light_icon);
ivNoLeftTime = findViewById(R.id.module_ext_id_traffic_light_no_left_time);
tvLeftTime = findViewById(R.id.module_ext_id_traffic_light_left_time);
tvLeftTimeUnit = findViewById(R.id.module_ext_id_traffic_light_left_time_unit);
groupLeftTime = findViewById(R.id.module_ext_id_group_left_time);
ivTrafficLight.setImageResource(iconRes[0]);
}
/**
* 设置红绿灯的颜色,根据颜色来展示不同的效果
*
* @param color 红绿灯颜色{@link TrafficLightConst#TRAFFIC_LIGHT_COLOR_GRAY},{@link TrafficLightConst#TRAFFIC_LIGHT_COLOR_RED}等四个颜色
*/
private void setTrafficLightColor(@TrafficLightColor int color) {
if (iconRes == null) {
Logger.e(TAG, "红绿灯Icon数据为空无法进行设置");
return;
}
ivTrafficLight.setImageResource(iconRes[color]);
if (color != TRAFFIC_LIGHT_COLOR_GRAY) {
tvLeftTime.setTextColor(colorRes[color]);
tvLeftTimeUnit.setTextColor(colorRes[color]);
}
}
/**
* 设置红绿灯剩余时长
*
* @param leftTime 剩余时长null或者empty表示没有时长数据
*/
private void setTrafficLightLeftTime(String leftTime) {
if (leftTime == null || leftTime.isEmpty()) {
groupLeftTime.setVisibility(View.GONE);
ivNoLeftTime.setVisibility(View.VISIBLE);
} else {
groupLeftTime.setVisibility(View.VISIBLE);
ivNoLeftTime.setVisibility(View.GONE);
tvLeftTime.setText(leftTime);
}
}
/**
* 设置红绿灯状态,需设置颜色及时长
*
* @param color 红绿灯颜色,使用{@link TrafficLightConst#TRAFFIC_LIGHT_COLOR_RED}等四个值
* @param leftTime 剩余时长null或者empty表示没有时长数据
*/
public void setTrafficLightStatus(@TrafficLightColor int color, String leftTime) {
setTrafficLightColor(color);
setTrafficLightLeftTime(leftTime);
}
@IntDef({TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GREEN, TRAFFIC_LIGHT_COLOR_RED, TRAFFIC_LIGHT_COLOR_YELLOW})
@Retention(RetentionPolicy.SOURCE)
public @interface TrafficLightColor {
}
}

View File

@@ -1,101 +0,0 @@
package com.mogo.module.extensions.weather;
import android.text.TextUtils;
import com.mogo.module.extensions.R;
import java.util.HashMap;
import java.util.Map;
/**
* @author Lzq
*/
public enum Phenomena {
Sunny( "00", "", "Sunny", R.drawable.module_ext_ic_sunny ),
Cloudy( "01", "多云", "Cloudy", R.drawable.module_ext_ic_cloudy ),
Overcast( "02", "", "Overcast", R.drawable.module_ext_ic_overcast ),
Shower( "03", "阵雨", "Shower", R.drawable.module_ext_ic_shower ),
Thundershower( "04", "雷阵雨", "Thundershower", R.drawable.module_ext_ic_thundershower ),
ThundershowerWithHail( "05", "雷阵雨伴有冰雹", "Thundershower with hail", R.drawable.module_ext_ic_thundershower ),
Sleet( "06", "雨夹雪", "Sleet", R.drawable.module_ext_ic_snow ),
LightRain( "07", "小雨", "Light rain", R.drawable.module_ext_ic_light_rain ),
ModerateRain( "08", "中雨", "Moderate rain", R.drawable.module_ext_ic_light_rain ),
HeavyRain( "09", "大雨", "Heavy rain", R.drawable.module_ext_ic_heavy_rain ),
Storm( "10", "暴雨", "Storm", R.drawable.module_ext_ic_heavy_rain ),
HeavyStorm( "11", "大暴雨", "Heavy storm", R.drawable.module_ext_ic_heavy_rain ),
SevereStorm( "12", "特大暴雨", "Severe storm", R.drawable.module_ext_ic_severe_storm ),
SnowFlurry( "13", "阵雪", "Snow flurry", R.drawable.module_ext_ic_snow ),
LightSnow( "14", "小雪", "Light snow", R.drawable.module_ext_ic_snow ),
ModerateSnow( "15", "中雪", "Moderate snow", R.drawable.module_ext_ic_snow ),
HeavySnow( "16", "大雪", "Heavy snow", R.drawable.module_ext_ic_snow ),
Snowstorm( "17", "暴雪", "Snowstorm", R.drawable.module_ext_ic_snow ),
Foggy( "18", "", "Foggy", R.drawable.module_ext_ic_fog ),
IceRain( "19", "冻雨", "Ice rain", R.drawable.module_ext_ic_heavy_rain ),
Duststorm( "20", "沙尘暴", "Duststorm", R.drawable.module_ext_ic_duststorm ),
LightToModerateRain( "21", "小到中雨", "Light to moderate rain", R.drawable.module_ext_ic_moderate_rain ),
ModerateToHeavyRain( "22", "中到大雨", "Moderate to heavy rain", R.drawable.module_ext_ic_heavy_rain ),
HeavyRainToStorm( "23", "大到大雨", "Heavy rain to storm", R.drawable.module_ext_ic_heavy_rain ),
StormToHeavyStorm( "24", "暴雨到大暴雨", "Storm to heavy storm", R.drawable.module_ext_ic_severe_storm ),
HeavyToSevereStorm( "25", "大暴雨到特大暴雨", "Heavy to severe storm", R.drawable.module_ext_ic_severe_storm ),
LightToModerateSnow( "26", "小到中雪", "Light to moderate snow", R.drawable.module_ext_ic_snow ),
ModerateToHeavySnow( "27", "中到大雪", "Moderate to heavy snow", R.drawable.module_ext_ic_snow ),
HeavySnowToSnowStorm( "28", "大到暴雪", "Heavy snow to snowstorm", R.drawable.module_ext_ic_snow ),
Dust( "29", "浮尘", "Dust", R.drawable.module_ext_ic_dust_sand ),
Sand( "30", "扬沙", "Sand", R.drawable.module_ext_ic_dust_sand ),
SandStorm( "31", "强沙尘暴", "Sandstorm", R.drawable.module_ext_ic_duststorm ),
Densefog( "32", "浓雾", "Dense fog", R.drawable.module_ext_ic_fog ),
StrongFog( "49", "强浓雾", "Strong fog", R.drawable.module_ext_ic_fog ),
DenseFog( "57", "大雾", "Dense fog", R.drawable.module_ext_ic_fog ),
ExtraHeavyFog( "58", "特强浓雾", "Extra heavy fog", R.drawable.module_ext_ic_fog ),
Haze( "53", "", "Haze", R.drawable.module_ext_ic_haze ),
ModerateHaze( "54", "中度霾", "Moderate haze", R.drawable.module_ext_ic_haze ),
Severehaze( "55", "重度霾", "Severe haze", R.drawable.module_ext_ic_haze ),
SevereHaze( "56", "严重霾", "Severe haze", R.drawable.module_ext_ic_haze ),
Unknown( "99", "", "Unknown", R.drawable.module_ext_ic_unknown ),
Rain( "301", "", "rain", R.drawable.module_ext_ic_heavy_rain ),
Snow( "302", "", "snow", R.drawable.module_ext_ic_snow );
public final String id;
public final String nameCn;
public final String nameEn;
public final int resId;
Phenomena( String id, String nameCn, String nameEn, int resId ) {
this.id = id;
this.nameCn = nameCn;
this.nameEn = nameEn;
this.resId = resId;
}
static Map< String, Phenomena > mPhenomenas;
static {
if ( mPhenomenas == null ) {
synchronized ( Phenomena.class ) {
if ( mPhenomenas == null ) {
mPhenomenas = new HashMap<>();
for ( Phenomena weather : Phenomena.values() ) {
mPhenomenas.put( weather.id, weather );
}
}
}
}
}
public static synchronized Phenomena getById( String id ) {
if ( TextUtils.isEmpty( id ) ) {
return null;
}
return mPhenomenas.get( id );
}
}

View File

@@ -1,91 +0,0 @@
package com.mogo.module.extensions.weather;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.Layout;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import java.lang.reflect.Field;
/**
* 带边框的textView
*
* @author tongchenfei
*/
public class StrokeTextView extends AppCompatTextView {
public StrokeTextView(Context context) {
this(context,null);
}
public StrokeTextView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public StrokeTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void setTextAppearance(Context context, int resId) {
super.setTextAppearance(context, resId);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSize = getMeasuredWidth();
if (widthMode == MeasureSpec.AT_MOST) {
widthSize += 20;
Layout mLayout = getLayout();
if (mLayout != null) {
mLayout.increaseWidthTo(widthSize);
}
setMeasuredDimension(widthSize, getMeasuredHeight());
}
}
@Override
protected void onDraw(Canvas canvas) {
int oriColor = getCurrentTextColor();
// 先画边框
TextPaint paint = getPaint();
setCurTextColor(Color.YELLOW);
paint.setStyle(Paint.Style.STROKE);
paint.setShadowLayer(10F, 0F, 0F, Color.YELLOW);
float b = getTextSize() / 20;
float shadowWidth = Math.max(b, 2f);
paint.setStrokeWidth(shadowWidth);
super.onDraw(canvas);
// 再画文字
setCurTextColor(oriColor);
paint.setStyle(Paint.Style.FILL);
super.onDraw(canvas);
}
/**
* 通过反射直接设置mCurTextColor这个变量直接调用{@link #setTextColor(int)}会出现重复递归的问题
*
* @param color 要设置的颜色值
*/
private void setCurTextColor(int color) {
try {
Field mCurTextColor = TextView.class.getDeclaredField("mCurTextColor");
mCurTextColor.setAccessible(true);
mCurTextColor.set(this,color);
mCurTextColor.setAccessible(false);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
}

View File

@@ -1,5 +0,0 @@
package com.mogo.module.extensions.weather;
public interface WeatherCallback {
void onWeatherLoaded( WeatherInfo weatherInfo );
}

View File

@@ -1,32 +0,0 @@
package com.mogo.module.extensions.weather;
/**
* 天气
*/
public class WeatherConstants {
public final static String WEATHER_URI = "content://com.zhidao.weather/weatherinfo";
/**
* 天气
*/
public static final String TEMPERATURE = "observetemperature";
/**
* 气象
*/
public static final String PHENOMENA = "observephenomena";
/**
* 风向
*/
public static final String WIND_DIRECTION = "observewinddirection";
/**
* 风力
*/
public static final String WIND_FORCE = "observewindforce";
/**
* 天气消息加载完毕
*/
public static final int MSG_WEATHER_LOADED = 0x1000;
}

View File

@@ -1,142 +0,0 @@
package com.mogo.module.extensions.weather;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import java.util.Objects;
/**
* 天气
*/
public class WeatherInfo implements Parcelable {
/**
* 温度
*/
private String temperature;
/**
* 描述信息
*/
private String phenomena;
/**
* 风向
*/
private String windDirection;
/**
* 风力
*/
private String windForce;
@Override
public String toString() {
return "WeatherInfo{" +
"temperature='" + temperature + '\'' +
", phenomena='" + phenomena + '\'' +
", windDirection='" + windDirection + '\'' +
", windForce='" + windForce + '\'' +
'}';
}
@Override
public boolean equals( Object o ) {
if ( this == o ) {
return true;
}
if ( !( o instanceof WeatherInfo ) ) {
return false;
}
WeatherInfo that = ( WeatherInfo ) o;
return Objects.equals( temperature, that.temperature ) &&
Objects.equals( phenomena, that.phenomena ) &&
Objects.equals( windDirection, that.windDirection ) &&
Objects.equals( windForce, that.windForce );
}
@Override
public int hashCode() {
return Objects.hash( temperature, phenomena, windDirection, windForce );
}
public WeatherInfo() {
}
public WeatherInfo( String temperature, String phenomena, String windDirection, String windForce ) {
this.temperature = temperature;
this.phenomena = phenomena;
this.windDirection = windDirection;
this.windForce = windForce;
}
public String getTemperature() {
return temperature;
}
public void setTemperature( String temperature ) {
this.temperature = temperature;
}
public String getPhenomena() {
return phenomena;
}
public void setPhenomena( String phenomena ) {
this.phenomena = phenomena;
}
public String getWindDirection() {
return windDirection;
}
public void setWindDirection( String windDirection ) {
this.windDirection = windDirection;
}
public String getWindForce() {
return windForce;
}
public void setWindForce( String windForce ) {
this.windForce = windForce;
}
public boolean isLegal() {
return !TextUtils.isEmpty( phenomena )
&& !TextUtils.isEmpty( temperature );
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.temperature );
dest.writeString( this.phenomena );
dest.writeString( this.windDirection );
dest.writeString( this.windForce );
}
protected WeatherInfo( Parcel in ) {
this.temperature = in.readString();
this.phenomena = in.readString();
this.windDirection = in.readString();
this.windForce = in.readString();
}
public static final Creator< WeatherInfo > CREATOR = new Creator< WeatherInfo >() {
@Override
public WeatherInfo createFromParcel( Parcel source ) {
return new WeatherInfo( source );
}
@Override
public WeatherInfo[] newArray( int size ) {
return new WeatherInfo[size];
}
};
}

View File

@@ -1,137 +0,0 @@
package com.mogo.module.extensions.weather;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.ThreadPoolService;
import androidx.annotation.NonNull;
/**
* @author congtaowang
* @since 2020-01-05
* <p>
* 描述
*/
public class WeatherModel {
private static final String TAG = "WeatherModel";
private Context mContext;
private Uri mWeatherUri;
private Handler mHandler;
private ContentResolver mContentResolver;
private ContentObserver mContentObserver;
private WeatherCallback mCallback;
public WeatherModel( Context context ) {
this.mContext = context;
}
public void init( WeatherCallback callback ) {
mCallback = callback;
mWeatherUri = Uri.parse( WeatherConstants.WEATHER_URI );
mContentResolver = mContext.getContentResolver();
mHandler = new Handler( Looper.getMainLooper() ) {
@Override
public void handleMessage( @NonNull Message msg ) {
if ( msg.what == WeatherConstants.MSG_WEATHER_LOADED ) {
if ( mCallback != null ) {
mCallback.onWeatherLoaded( ( ( WeatherInfo ) msg.obj ) );
}
}
}
};
mContentObserver = new ContentObserver( mHandler ) {
@Override
public void onChange( boolean selfChange, Uri uri ) {
super.onChange( selfChange, uri );
try {
queryWeatherInformation();
} catch ( Exception e ) {
Logger.e( TAG, e, "error. " );
}
}
};
try {
mContentResolver.registerContentObserver( mWeatherUri, false, mContentObserver );
} catch ( Exception e ) {
Logger.e( TAG, e, "error when query weather info." );
}
}
public void queryWeatherInformation() {
if ( mCallback == null ) {
Logger.e( TAG, "WeatherModel#init should invoked " );
return;
}
startNewThreadToQuery();
}
private void startNewThreadToQuery() {
ThreadPoolService.execute(new Runnable() {
@Override
public void run() {
if ( mContentResolver == null ) {
return;
}
Cursor cursor = null;
try {
cursor = mContentResolver.query( mWeatherUri, null, null, null, null, null );
} catch ( Exception e ) {
return;
}
if ( cursor == null ) {
return;
}
WeatherInfo weatherInfo = new WeatherInfo();
if ( cursor.moveToFirst() ) {
int index = cursor.getColumnIndex( WeatherConstants.TEMPERATURE );
if ( index != -1 ) {
weatherInfo.setTemperature( cursor.getString( index ) );
}
index = cursor.getColumnIndex( WeatherConstants.PHENOMENA );
if ( index != -1 ) {
weatherInfo.setPhenomena( cursor.getString( index ) );
}
index = cursor.getColumnIndex( WeatherConstants.WIND_DIRECTION );
if ( index != -1 ) {
weatherInfo.setWindDirection( cursor.getString( index ) );
}
index = cursor.getColumnIndex( WeatherConstants.WIND_FORCE );
if ( index != -1 ) {
weatherInfo.setWindForce( cursor.getString( index ) );
}
Message msg = Message.obtain();
msg.obj = weatherInfo;
msg.what = WeatherConstants.MSG_WEATHER_LOADED;
mHandler.sendMessage( msg );
}
cursor.close();
}
} );
}
public void destroy() {
if ( mContentResolver != null && mContentObserver != null ) {
mContentResolver.unregisterContentObserver( mContentObserver );
}
mContext = null;
mWeatherUri = null;
mHandler = null;
mContentResolver = null;
mContentObserver = null;
mCallback = null;
}
}

View File

@@ -1,47 +0,0 @@
package com.mogo.module.extensions.weather;
import com.google.gson.annotations.SerializedName;
/**
* @author congtaowang
* @since 2020-01-07
* <p>
* 天气数据描述
*/
public class WebWeatherData {
@SerializedName( "observe" )
public ObserveDataType observe;
/**
* 实时数据
*/
public static class ObserveDataType {
@SerializedName( "101010200" )
public ObserveData data;
}
/**
* 实时数据对象
*/
public static class ObserveData {
@SerializedName( "1001002" )
public Data data;
}
/**
* what the fuck.
*/
public static class Data {
@SerializedName( "000" )
public String time;
@SerializedName( "001" )
public String phenomena;
@SerializedName( "002" )
public String temperature;
@SerializedName( "003" )
public String windForce;
@SerializedName( "004" )
public String windDirection;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1013 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1009 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More