Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0
This commit is contained in:
@@ -76,6 +76,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.moduleadcard
|
||||
|
||||
implementation rootProject.ext.dependencies.moduleonlinecar
|
||||
implementation rootProject.ext.dependencies.moduleV2x
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.modulemain
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.module.media.MediaConstants;
|
||||
import com.mogo.module.onlinecar.OnLineCarConstants;
|
||||
import com.mogo.module.push.PushUIConstants;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
|
||||
@@ -36,6 +37,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
//运营位卡片,需要默认显示,放在第一个加载
|
||||
// MogoModulePaths.addModule(new MogoModule(AdCardConstants.TAG, AdCardConstants.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(OnLineCarConstants.TAG, OnLineCarConstants.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI));
|
||||
MogoModulePaths.addModule(new MogoModule(TanluConstants.TAG, TanluConstants.MODEL_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
MogoModulePaths.addModule(new MogoModule(MediaConstants.TAG, MediaConstants.MODULE_TYPE));
|
||||
|
||||
@@ -100,6 +100,8 @@ ext {
|
||||
carcallprovider : "com.mogo.module.carchatting:module-carchatting-provider:${CARCHATTINGPROVIDER_VERSION}",
|
||||
// 在线车辆
|
||||
moduleonlinecar : "com.mogo.module:module-onlinecar:${MOGO_MODULE_ONLINECAR_VERSION}",
|
||||
// V2X
|
||||
moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}",
|
||||
modulemedia : "com.mogo.module:module-media:${MOGO_MODULE_MEDIA_VERSION}",
|
||||
modulesearch : "com.mogo.module:module-search:${MOGO_MODULE_SEARCH_VERSION}",
|
||||
modulepush : "com.mogo.module:module-push:${MOGO_MODULE_PUSH_VERSION}",
|
||||
|
||||
@@ -48,6 +48,7 @@ MOGO_MODULE_EXTENSIONS_VERSION=1.0.0-SNAPSHOT
|
||||
CARCHATTING_VERSION=1.0.0-SNAPSHOT
|
||||
CARCHATTINGPROVIDER_VERSION=1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_ONLINECAR_VERSION=1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_V2X_VERSION=1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_MEDIA_VERSION=1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_PUSH_VERSION=1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_SEARCH_VERSION=1.0.0-SNAPSHOT
|
||||
|
||||
@@ -8,15 +8,15 @@ import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.apps.utils.LaunchUtils;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -63,10 +63,20 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
|
||||
trackNavigatorClickEvent( 1 );
|
||||
} );
|
||||
mMediaCenter.setOnClickListener( view -> {
|
||||
trackNavigatorClickEvent( 2 );
|
||||
try {
|
||||
LaunchUtils.launchByPkg( getContext(), AppsConst.APP_PKG_MUSIC );
|
||||
trackNavigatorClickEvent( 2 );
|
||||
} catch ( Exception e ) {
|
||||
TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
}
|
||||
} );
|
||||
mCarSettings.setOnClickListener( view -> {
|
||||
trackNavigatorClickEvent( 3 );
|
||||
try {
|
||||
LaunchUtils.launchByPkg( getContext(), AppsConst.APP_PKG_CAR_SETTINGS );
|
||||
trackNavigatorClickEvent( 3 );
|
||||
} catch ( Exception e ) {
|
||||
TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
}
|
||||
} );
|
||||
mApps.setOnClickListener( view -> {
|
||||
openAppsPanel();
|
||||
|
||||
@@ -18,4 +18,13 @@ public class AppsConst {
|
||||
|
||||
public static final String CMD_CLOSE_APPS_PANEL = "CMD_CLOSE_APPS_PANEL";
|
||||
public static final String[] CMD_CLOSE_APPS_PANEL_UN_WAKEUP_WORDS = {"关闭全部应用"};
|
||||
|
||||
/**
|
||||
* 媒体跳转
|
||||
*/
|
||||
public static final String APP_PKG_MUSIC = "com.pvetec.musics";
|
||||
/**
|
||||
* 车辆设置跳转
|
||||
*/
|
||||
public static final String APP_PKG_CAR_SETTINGS = "com.zhidao.settings";
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.module.apps.utils.LaunchUtils;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
@@ -66,11 +67,8 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
}
|
||||
|
||||
trackAppClicked( appInfo );
|
||||
|
||||
try {
|
||||
Intent intent = getContext().getPackageManager().getLaunchIntentForPackage( appInfo.getPackageName() );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
getContext().startActivity( intent );
|
||||
LaunchUtils.launchByPkg( getContext(), appInfo.getPackageName() );
|
||||
} catch ( Exception e ) {
|
||||
TipToast.shortTip( R.string.module_apps_str_no_app );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.module.apps.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-03
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class LaunchUtils {
|
||||
|
||||
/**
|
||||
* 通过包名启动app
|
||||
*
|
||||
* @param context
|
||||
* @param pkg 包名
|
||||
*/
|
||||
public static void launchByPkg( Context context, String pkg ) throws Exception{
|
||||
Intent intent = context.getPackageManager().getLaunchIntentForPackage( pkg );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
context.startActivity( intent );
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class MarkerOnlineCar implements Serializable {
|
||||
private MarkerDynamicData dynamicData;//动态数据
|
||||
private MarkerHobbyDatum hobbyData;//爱好数据集合
|
||||
private List<MarkerActivitiesScope> activitiesScope;//活动范围数据集合
|
||||
private double compatibility;
|
||||
private int compatibility;//匹配度
|
||||
|
||||
public List<MarkerActivitiesScope> getActivitiesScope() {
|
||||
return activitiesScope;
|
||||
@@ -33,11 +33,11 @@ public class MarkerOnlineCar implements Serializable {
|
||||
this.carInfo = carInfo;
|
||||
}
|
||||
|
||||
public double getCompatibility() {
|
||||
public int getCompatibility() {
|
||||
return compatibility;
|
||||
}
|
||||
|
||||
public void setCompatibility(double compatibility) {
|
||||
public void setCompatibility(int compatibility) {
|
||||
this.compatibility = compatibility;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ public class CardModulesAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// return mProviders.size();
|
||||
return Integer.MAX_VALUE;
|
||||
return mProviders.size();
|
||||
// return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public IMogoModuleProvider getProvider( int position ) {
|
||||
|
||||
@@ -4,10 +4,13 @@ import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.entity.MarkerCarChat;
|
||||
@@ -57,6 +60,8 @@ public class MarkerServiceHandler {
|
||||
private static IMogoNavi mNavi;
|
||||
private static IMogoMapUIController mMapUIController;
|
||||
|
||||
private static IMogoLocationClient mLocationClient;
|
||||
|
||||
private static IMogoStatusManager mMogoStatusManager;
|
||||
private static IMogoImageloader mImageloader;
|
||||
private static IMogoSocketManager mMogoSocketManager;
|
||||
@@ -65,6 +70,9 @@ public class MarkerServiceHandler {
|
||||
|
||||
private static Context mContext;
|
||||
|
||||
// 第一次请求到地图的Marker数据
|
||||
private static boolean isFirstMarker = true;
|
||||
|
||||
public static void init(final Context context) {
|
||||
mContext = context;
|
||||
mMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation(context);
|
||||
@@ -78,6 +86,7 @@ public class MarkerServiceHandler {
|
||||
mMarkerManager = mMapService.getMarkerManager(context);
|
||||
mNavi = mMapService.getNavi(context);
|
||||
mMapUIController = mMapService.getMapUIController();
|
||||
mLocationClient = mMapService.getLocationClient(context);
|
||||
mogoMarkerClickListener = new MoGoMarkerClickListener();
|
||||
|
||||
// 长连接
|
||||
@@ -91,7 +100,8 @@ public class MarkerServiceHandler {
|
||||
@Override
|
||||
public void onMsgReceived(MarkerResponse response) {
|
||||
Logger.e(TAG, "======MarkerResponse:" + response);
|
||||
if (!getMogoStatusManager().isSearchUIShow()) {
|
||||
if (!getMogoStatusManager().isSearchUIShow() && !getMogoStatusManager().isV2XShow()) {
|
||||
isFirstMarker = true;
|
||||
drawMapMarker(response);
|
||||
}
|
||||
}
|
||||
@@ -279,7 +289,7 @@ public class MarkerServiceHandler {
|
||||
markerCardResult.getDataType().contains(ServiceConst.CARD_TYPE_USER_DATA)) {
|
||||
getMarkerManager().removeMarkers(ServiceConst.CARD_TYPE_USER_DATA);
|
||||
getMogoCardManager().switch2(ServiceConst.CARD_TYPE_USER_DATA);
|
||||
|
||||
isFirstMarker = true;
|
||||
} else {
|
||||
// 清空所有地图上绘制的Marker
|
||||
getMarkerManager().removeMarkers();
|
||||
@@ -307,6 +317,8 @@ public class MarkerServiceHandler {
|
||||
}
|
||||
|
||||
if (onlineCarList != null) {
|
||||
IMogoMarker nearlyMogoMarker = null;
|
||||
double nearlyDistance = Double.MAX_VALUE;
|
||||
for (MarkerOnlineCar markerOnlineCar : onlineCarList) {
|
||||
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
||||
|
||||
@@ -317,9 +329,36 @@ public class MarkerServiceHandler {
|
||||
markerShowEntity.setTextContent(markerOnlineCar.getUserInfo().getUserName());
|
||||
markerShowEntity.setIconUrl(markerOnlineCar.getUserInfo().getUserHead());
|
||||
|
||||
drawMapMarker(markerShowEntity);
|
||||
IMogoMarker iMogoMarker = drawMapMarker(markerShowEntity);
|
||||
// 计算在线车辆距离当前车辆的距离,每次都与最后一次距离最近的进行比较,保留距离最近的车辆,进行卡片展示
|
||||
try {
|
||||
double calculateDistance = Utils.calculateLineDistance(
|
||||
new MogoLatLng(markerLocation.getLat(), markerLocation.getLat()),
|
||||
new MogoLatLng(mLocationClient.getLastKnowLocation().getLatitude(), mLocationClient.getLastKnowLocation().getLongitude())
|
||||
);
|
||||
|
||||
// 进行比较,保留最近的一个数据
|
||||
if (calculateDistance < nearlyDistance) {
|
||||
nearlyMogoMarker = iMogoMarker;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
fillNumberTrackEventBody(array, 3, onlineCarList.size());
|
||||
|
||||
try {
|
||||
// 在ACC on 之后第一次获取到了在线车辆数据,选中最近的一个Marker
|
||||
if (isFirstMarker) {
|
||||
if (nearlyMogoMarker != null) {
|
||||
MogoMarkersHandler.getInstance().onMarkerClicked(nearlyMogoMarker);
|
||||
isFirstMarker = false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (exploreWayList != null) {
|
||||
|
||||
@@ -120,6 +120,8 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
case ServiceConst.MSG_TYPE_REFRESH_DECREASE:
|
||||
mRefreshRemainingTime -= ServiceConst.DECREASE_INTERVAL;
|
||||
if ( mRefreshRemainingTime == 0 ) {
|
||||
mStatusManager.setUserInteractionStatus(ServiceConst.TYPE, true, false );
|
||||
mUiController.moveToCenter(mLastAutoRefreshLocation);
|
||||
notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
|
||||
} else {
|
||||
mHandler.sendEmptyMessageDelayed( msg.what, ServiceConst.DECREASE_INTERVAL );
|
||||
@@ -235,6 +237,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
mStatusManager = ( IMogoStatusManager ) ARouter.getInstance().build( MogoServicePaths.PATH_STATUS_MANAGER ).navigation( context );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEARCH_UI, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.V2X_UI, this );
|
||||
|
||||
//TODO 初始化地图地图绘制大而全的Marker
|
||||
MarkerServiceHandler.init( mContext );
|
||||
@@ -513,7 +516,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
switch ( descriptor ) {
|
||||
case USER_INTERACTED:
|
||||
case USER_INTERACTED:
|
||||
if ( isTrue && !mRefreshRemainingTimeStatus ) {
|
||||
mRefreshRemainingTimeStatus = true;
|
||||
mRefreshRemainingTime += mAutoRefreshStrategy.getInterruptInterval();
|
||||
@@ -521,6 +524,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
}
|
||||
break;
|
||||
case SEARCH_UI:
|
||||
case V2X_UI:
|
||||
if ( isTrue ) {
|
||||
// 搜索时,不在自动刷新打点策略
|
||||
stopAutoRefreshStrategy();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.module.service;
|
||||
|
||||
import com.amap.api.maps.AMapException;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
/**
|
||||
@@ -12,8 +10,15 @@ import com.mogo.map.MogoLatLng;
|
||||
*/
|
||||
public class Utils {
|
||||
|
||||
public static float calculateLineDistance( MogoLatLng point1, MogoLatLng point2 ) {
|
||||
if ( point1 != null && point2 != null ) {
|
||||
/**
|
||||
* 距离半径计算方式
|
||||
*
|
||||
* @param point1 点一坐标
|
||||
* @param point2 点二坐标
|
||||
* @return 两坐标的距离 单位:米(M)
|
||||
*/
|
||||
public static float calculateLineDistance(MogoLatLng point1, MogoLatLng point2) {
|
||||
if (point1 != null && point2 != null) {
|
||||
try {
|
||||
double var2 = point1.lng;
|
||||
double var4 = point1.lat;
|
||||
@@ -23,14 +28,14 @@ public class Utils {
|
||||
var4 *= 0.01745329251994329D;
|
||||
var6 *= 0.01745329251994329D;
|
||||
var8 *= 0.01745329251994329D;
|
||||
double var10 = Math.sin( var2 );
|
||||
double var12 = Math.sin( var4 );
|
||||
double var14 = Math.cos( var2 );
|
||||
double var16 = Math.cos( var4 );
|
||||
double var18 = Math.sin( var6 );
|
||||
double var20 = Math.sin( var8 );
|
||||
double var22 = Math.cos( var6 );
|
||||
double var24 = Math.cos( var8 );
|
||||
double var10 = Math.sin(var2);
|
||||
double var12 = Math.sin(var4);
|
||||
double var14 = Math.cos(var2);
|
||||
double var16 = Math.cos(var4);
|
||||
double var18 = Math.sin(var6);
|
||||
double var20 = Math.sin(var8);
|
||||
double var22 = Math.cos(var6);
|
||||
double var24 = Math.cos(var8);
|
||||
double[] var28 = new double[3];
|
||||
double[] var29 = new double[3];
|
||||
var28[0] = var16 * var14;
|
||||
@@ -39,8 +44,8 @@ public class Utils {
|
||||
var29[0] = var24 * var22;
|
||||
var29[1] = var24 * var18;
|
||||
var29[2] = var20;
|
||||
return ( float ) ( Math.asin( Math.sqrt( ( var28[0] - var29[0] ) * ( var28[0] - var29[0] ) + ( var28[1] - var29[1] ) * ( var28[1] - var29[1] ) + ( var28[2] - var29[2] ) * ( var28[2] - var29[2] ) ) / 2.0D ) * 1.27420015798544E7D );
|
||||
} catch ( Throwable var26 ) {
|
||||
return (float) (Math.asin(Math.sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0D) * 1.27420015798544E7D);
|
||||
} catch (Throwable var26) {
|
||||
var26.printStackTrace();
|
||||
return 0.0F;
|
||||
}
|
||||
@@ -48,4 +53,9 @@ public class Utils {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
double calculateLineDistance = calculateLineDistance(new MogoLatLng(39.955533, 116.423262), new MogoLatLng(39.955385, 116.414604));
|
||||
System.out.println("距离点 calculateLineDistance:" + calculateLineDistance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.module.tanlu.callback;
|
||||
|
||||
import com.mogo.module.tanlu.model.NaviResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 导航沿途数据
|
||||
* @since 2020-01-09
|
||||
*/
|
||||
public interface NaviCallback {
|
||||
void onSuccess(NaviResult data);
|
||||
void onFail(String message, int code);
|
||||
}
|
||||
@@ -59,6 +59,7 @@ import com.mogo.module.share.ShareControl;
|
||||
import com.mogo.module.share.constant.ShareConstants;
|
||||
import com.mogo.module.tanlu.R;
|
||||
import com.mogo.module.tanlu.callback.AlongTheWayCallback;
|
||||
import com.mogo.module.tanlu.callback.NaviCallback;
|
||||
import com.mogo.module.tanlu.callback.RoadLineCallback;
|
||||
import com.mogo.module.tanlu.callback.UploadShareCallback;
|
||||
import com.mogo.module.tanlu.callback.VoiceSearchCallback;
|
||||
@@ -67,6 +68,7 @@ import com.mogo.module.tanlu.model.Center;
|
||||
import com.mogo.module.tanlu.model.Information;
|
||||
import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
|
||||
import com.mogo.module.tanlu.model.Items;
|
||||
import com.mogo.module.tanlu.model.NaviResult;
|
||||
import com.mogo.module.tanlu.model.PathLineResult;
|
||||
import com.mogo.module.tanlu.model.TanluModelData;
|
||||
import com.mogo.module.tanlu.model.VoiceSearchResult;
|
||||
@@ -196,13 +198,13 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
autoZoomInImageView.setVisibility(View.GONE);
|
||||
|
||||
//视频点击
|
||||
simpleCoverVideoPlayer.getStartButton().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Logger.d(TAG, "simpleCoverVideoPlayer onClick -------> ");
|
||||
FullMediaActivity.Companion.launch(getActivity(), mVideoUrl, mImageUrl, mTitle, mGenerateTime);
|
||||
}
|
||||
});
|
||||
// simpleCoverVideoPlayer.getStartButton().setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// Logger.d(TAG, "simpleCoverVideoPlayer onClick -------> ");
|
||||
// FullMediaActivity.Companion.launch(getActivity(), mVideoUrl, mImageUrl, mTitle, mGenerateTime);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
@@ -281,7 +283,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
Logger.e(TAG, "poi == null");
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "poi search result code = $p1");
|
||||
Logger.e(TAG, "poi search result p1 = " + p1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,9 +337,10 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() { //开始导航,这期先不做
|
||||
// initModelData();
|
||||
// getNavigationLineData();
|
||||
public void onStartNavi() { //开始导航
|
||||
Logger.d(TAG, "onStartNavi -------> ");
|
||||
initModelData();
|
||||
getNavigationData();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -398,19 +401,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
}
|
||||
|
||||
|
||||
private void handleMarkerExploreWay(MarkerExploreWay markerExploreWay) {
|
||||
if (markerExploreWay != null) {
|
||||
Log.d(TAG, "markerExploreWay.getFileType() =" + markerExploreWay.getFileType());
|
||||
if (markerExploreWay.getFileType() == 0) { //图片
|
||||
refreshPhotoData(markerExploreWay);
|
||||
} else if (markerExploreWay.getFileType() == 1) { //视频
|
||||
handleData(markerExploreWay);
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "handleMarkerExploreWay == null");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理关键词搜索
|
||||
*
|
||||
@@ -578,7 +568,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
currentPosition--;
|
||||
Log.d(TAG, " tv_previous_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition && currentPosition >= 0) {
|
||||
handleData(markerExploreWayList.get(currentPosition));
|
||||
handleMarkerExploreWay(markerExploreWayList.get(currentPosition));
|
||||
moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon());
|
||||
}
|
||||
} else if (id == R.id.tv_next_res) { //下一个
|
||||
@@ -590,7 +580,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
currentPosition++;
|
||||
Log.d(TAG, " tv_next_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition) {
|
||||
handleData(markerExploreWayList.get(currentPosition));
|
||||
handleMarkerExploreWay(markerExploreWayList.get(currentPosition));
|
||||
moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon());
|
||||
}
|
||||
|
||||
@@ -605,7 +595,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
mMApUIController.moveToCenter(latLng);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 执行图片动画
|
||||
*/
|
||||
@@ -635,17 +624,18 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
/**
|
||||
* 通用的处理数据逻辑
|
||||
*
|
||||
* @param exploreWay
|
||||
* @param markerExploreWay
|
||||
*/
|
||||
private void handleData(MarkerExploreWay exploreWay) {
|
||||
if (exploreWay != null) {
|
||||
if (exploreWay.getFileType() == 0) { //图片
|
||||
refreshPhotoData(exploreWay);
|
||||
} else if (exploreWay.getFileType() == 1) { //视频
|
||||
refreshVideoData(exploreWay);
|
||||
private void handleMarkerExploreWay(MarkerExploreWay markerExploreWay) {
|
||||
if (markerExploreWay != null) {
|
||||
Log.d(TAG, "markerExploreWay.getFileType() =" + markerExploreWay.getFileType());
|
||||
if (markerExploreWay.getFileType() == 0) { //图片
|
||||
refreshPhotoData(markerExploreWay);
|
||||
} else if (markerExploreWay.getFileType() == 1) { //视频
|
||||
refreshVideoData(markerExploreWay);
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "handleData exploreWay == null ");
|
||||
Log.e(TAG, "handleMarkerExploreWay == null");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,18 +656,23 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
mGenerateTime = markerExploreWay.getGenerateTime();
|
||||
mTitle = markerExploreWay.getAddr();
|
||||
mAddressTv.setText(markerExploreWay.getAddr());
|
||||
Log.d(TAG, "refreshVideoData addr = " + markerExploreWay.getAddr());
|
||||
mDistanceTv.setText(handleDistance(markerExploreWay.getDistance()));
|
||||
mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
|
||||
//判断是图片还是视频,第一个时,上一个不可点击
|
||||
autoZoomInImageView.setVisibility(View.GONE);
|
||||
simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||
//视频配置
|
||||
mVideoUrl = videoUrl;
|
||||
Log.d(TAG, "refreshVideoData mVideoUrl = " + mVideoUrl);
|
||||
simpleCoverVideoPlayer.loadCoverImage(mImageUrl, getContext());
|
||||
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
.build(simpleCoverVideoPlayer);
|
||||
simpleCoverVideoPlayer.getStartButton().performClick();
|
||||
if (mImageUrl == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -697,8 +692,8 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
|
||||
String thumbnailUrl = markerExploreWay.getItems().get(0).getUrl();
|
||||
Logger.d(TAG, "refreshPhoto thumbnailUrl ------>" + thumbnailUrl);
|
||||
autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||
simpleCoverVideoPlayer.setVisibility(View.GONE);
|
||||
autoZoomInImageView.setVisibility(View.VISIBLE);
|
||||
mogoImageloader.downloadImage(getActivity(), thumbnailUrl, new IMogoImageLoaderListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
@@ -728,14 +723,13 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
}
|
||||
|
||||
/**
|
||||
* C位事件,如何获取数据,需要有默认数据
|
||||
* C位事件,如何获取数据,需要有默认数据 TODO
|
||||
* 如果只有一个数据,不显示上下切换按钮,没有数据显示空页面
|
||||
*/
|
||||
@Override
|
||||
public void onPerform() {
|
||||
//免唤醒
|
||||
AIAssist.getInstance(getActivity()).registerUnWakeupCommand(TanluConstants.PLAY_VIDEO, TanluConstants.CMD_PLAY_ROAD_CONDITION, mogoVoiceListener);
|
||||
|
||||
isCurrentPage = true;
|
||||
Logger.d(TAG, "tanlu卡片 onPerform 有效 ---->");
|
||||
mMarkerManager = mMogoMapService.getMarkerManager(getActivity());
|
||||
@@ -753,7 +747,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
markerExploreWayList.add(exploreWay);
|
||||
}
|
||||
|
||||
Log.e("TAG", "tanlu卡片 onPerform 有效 markerExploreWayList.size() =" + markerExploreWayList.size());
|
||||
Log.d("TAG", "tanlu卡片 onPerform 有效 markerExploreWayList.size() =" + markerExploreWayList.size());
|
||||
if (markers.size() == 1) {
|
||||
mPreviousTv.setVisibility(View.GONE);
|
||||
mNextTv.setVisibility(View.GONE);
|
||||
@@ -764,13 +758,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
|
||||
//展示第一个数据
|
||||
MarkerExploreWay markerExploreWay = markerExploreWayList.get(0);
|
||||
if (markerExploreWay != null) {
|
||||
if (markerExploreWay.getFileType() == 0) { //图片
|
||||
refreshPhotoData(markerExploreWay);
|
||||
} else if (markerExploreWay.getFileType() == 1) { //视频
|
||||
refreshVideoData(markerExploreWay);
|
||||
}
|
||||
}
|
||||
handleMarkerExploreWay(markerExploreWay);
|
||||
} else {
|
||||
mEmptyLayout.setVisibility(View.VISIBLE);
|
||||
mRootLayout.setVisibility(View.GONE);
|
||||
@@ -954,23 +942,64 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
/**
|
||||
* 导航路线数据事件 TODO
|
||||
*/
|
||||
public void getNavigationLineData() {
|
||||
Double lat = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLatitude();
|
||||
Double lon = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLongitude();
|
||||
Logger.e(TAG, "getNavigationLineData lon = " + lon + ">>>>> lat= " + lat);
|
||||
mTanluModelData.getNavigationLineData(lon, lat, new AlongTheWayCallback() {
|
||||
public void getNavigationData() {
|
||||
// Double lat = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLatitude();
|
||||
// Double lon = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLongitude();
|
||||
// Logger.e(TAG, "getNavigationLine lon = " + lon + ">>>>> lat= " + lat);
|
||||
// mTanluModelData.getNavigationLineData(lon, lat, new AlongTheWayCallback() {
|
||||
// @Override
|
||||
// public void onSuccess(InformationAndLiveCarResult data) {
|
||||
// //不做任何处理,直接出发推送,重新请求接口,划线
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail(String message, int code) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
mTanluModelData.getNaviInformation(new NaviCallback() {
|
||||
@Override
|
||||
public void onSuccess(InformationAndLiveCarResult data) {
|
||||
Logger.d(TAG, "getNavigationLineData onSuccess ");
|
||||
//不做任何处理,直接出发推送,重新请求接口,划线
|
||||
public void onSuccess(NaviResult data) {
|
||||
Log.d(TAG, "getNavigationData onSuccess ----->");
|
||||
List<Information> informationList = data.getResult().getInformations();
|
||||
//清除探路之前的数据
|
||||
mMarkerManager.removeMarkers(TanluConstants.MODEL_NAME);
|
||||
|
||||
//打点
|
||||
ArrayList<MogoMarkerOptions> optionList = new ArrayList<>();
|
||||
for (int i = 0; i < informationList.size(); i++) {
|
||||
//根据type确定添加的图片
|
||||
String trafficType = informationList.get(i).trafficInfoType;
|
||||
if (trafficType.equals("traffic_jam")) { //拥堵
|
||||
multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_block_up);
|
||||
} else if (trafficType.equals("car_checking")) { //查车
|
||||
multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_traffic_check);
|
||||
} else if (trafficType.equals("0")) {
|
||||
multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_block_up);
|
||||
} else if (trafficType.equals("traffic_control")) {
|
||||
multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_road_closure);
|
||||
}
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.icon(multiMarkerIcon)
|
||||
.latitude(informationList.get(i).lat)
|
||||
.owner(TanluConstants.MODEL_NAME)
|
||||
.longitude(informationList.get(i).lon);
|
||||
|
||||
optionList.add(options);
|
||||
Log.d(TAG, "lat =" + informationList.get(i).lat + ">>>lon =" + informationList.get(i).lon);
|
||||
}
|
||||
Logger.d(TAG, "getNavigationData optionList.size() = " + optionList.size());
|
||||
mMarkerManager.addMarkers(TanluConstants.MODEL_NAME, optionList, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String message, int code) {
|
||||
Logger.e(TAG, "getNavigationLineData onFail message = " + message + ">>>code= " + code);
|
||||
|
||||
Log.d(TAG, "getNavigationData message = " + message + ">>>code =" + code);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,7 @@ public class Information extends BaseData implements Parcelable {
|
||||
public int distance;
|
||||
public String nickName;
|
||||
public String headImgUrl;
|
||||
public String phone;
|
||||
public String trafficInfoType;
|
||||
|
||||
|
||||
@@ -43,6 +44,7 @@ public class Information extends BaseData implements Parcelable {
|
||||
dest.writeInt(this.distance);
|
||||
dest.writeString(this.nickName);
|
||||
dest.writeString(this.headImgUrl);
|
||||
dest.writeString(this.phone);
|
||||
dest.writeString(this.trafficInfoType);
|
||||
}
|
||||
|
||||
@@ -60,6 +62,7 @@ public class Information extends BaseData implements Parcelable {
|
||||
this.distance = in.readInt();
|
||||
this.nickName = in.readString();
|
||||
this.headImgUrl = in.readString();
|
||||
this.phone = in.readString();
|
||||
this.trafficInfoType = in.readString();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 导航沿途数据
|
||||
* @since 2020-02-03
|
||||
*/
|
||||
public class NaviResult extends BaseData {
|
||||
|
||||
private Result result;
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class Result {
|
||||
private List<Information> informations;
|
||||
|
||||
public List<Information> getInformations() {
|
||||
return informations;
|
||||
}
|
||||
|
||||
public void setInformations(List<Information> informations) {
|
||||
this.informations = informations;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.module.tanlu.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020-02-03
|
||||
*/
|
||||
public class NaviRoadRequest {
|
||||
public List<Double> coordinates;
|
||||
public int limit;
|
||||
|
||||
public NaviRoadRequest(List<Double> coordinates, int limit) {
|
||||
this.coordinates = coordinates;
|
||||
this.limit = limit;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.module.tanlu.callback.AlongTheWayCallback;
|
||||
import com.mogo.module.tanlu.callback.NaviCallback;
|
||||
import com.mogo.module.tanlu.callback.RoadLineCallback;
|
||||
import com.mogo.module.tanlu.callback.UploadShareCallback;
|
||||
import com.mogo.module.tanlu.callback.VoiceSearchCallback;
|
||||
@@ -175,7 +176,7 @@ public class TanluModelData {
|
||||
|
||||
|
||||
/**
|
||||
* 导航路线数据事件
|
||||
* 导航路线数据事件 TODO
|
||||
*/
|
||||
public void getNavigationLineData(Double lon, Double lat, final AlongTheWayCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
@@ -221,7 +222,9 @@ public class TanluModelData {
|
||||
}
|
||||
|
||||
|
||||
//获取Location,如果没有location数据为空,则使用首次或者上次定位点,并且更新SP,需要抽取公共方法
|
||||
/**
|
||||
* 获取Location,如果没有location数据为空,则使用首次或者上次定位点,并且更新SP,需要抽取公共方法
|
||||
*/
|
||||
public NaviLatLngInfo getNaviInfo(Double lon, Double lat) {
|
||||
String naviInfo = SharedPrefsMgr.getInstance(mContext).getString(TanluConstants.NAVI_INFO);
|
||||
Log.d(TAG, " getNaviInfo naviInfo =" + naviInfo);
|
||||
@@ -283,5 +286,42 @@ public class TanluModelData {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导航沿途情报 TODO
|
||||
*/
|
||||
public void getNaviInformation(final NaviCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", Utils.getSn())
|
||||
// .append("data", uploadShareStr)
|
||||
.build();
|
||||
|
||||
mTanluApiService.getNaviInformation(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<NaviResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(NaviResult o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "getNaviInformation onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getNaviInformation onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
e.printStackTrace();
|
||||
Logger.d(TAG, "getNaviInformation onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.tanlu.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
|
||||
import com.mogo.module.tanlu.model.NaviResult;
|
||||
import com.mogo.module.tanlu.model.PathLineResult;
|
||||
import com.mogo.module.tanlu.model.VoiceSearchResult;
|
||||
|
||||
@@ -55,4 +56,12 @@ public interface TanluApiService {
|
||||
@POST("deva/car/poi/no/addNovelty/v1")
|
||||
Observable<BaseData> uploadCheckTrafficInfor(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
/**
|
||||
* 导航沿途情报
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/search/no/searchInforationByCoordinates/v1")
|
||||
Observable<NaviResult> getNaviInformation(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user