Merge remote-tracking branch 'origin/dev_1.1.9' into dev_1.1.9
This commit is contained in:
@@ -200,7 +200,6 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
IMogoOnWebSocketMessageListener listener = iterator.next();
|
||||
if (listener != null) {
|
||||
Logger.d(TAG, "received msgId = " + webSocketData.getSeq() + ", content = " + webSocketData.getData());
|
||||
Logger.d("CameraLiveNoticeHelper", "received msgId = " + webSocketData.getSeq() + ", content = " + webSocketData.getData());
|
||||
Object receiveObj = GsonUtil.objectFromJson(webSocketData.getData(),listener.target());
|
||||
listener.onMsgReceived(receiveObj);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.commons;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -10,10 +11,6 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.elegant.analytics.Analytics;
|
||||
import com.elegant.analytics.AnalyticsConfig;
|
||||
import com.elegant.analytics.IAnalyticsParamsProvider;
|
||||
import com.elegant.analytics.UploadMode;
|
||||
import com.mogo.commons.analytics.AnalyticsUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.device.Devices;
|
||||
@@ -28,10 +25,8 @@ import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.TipDrawable;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.network.NetConfig;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
@@ -48,6 +43,13 @@ public abstract class AbsMogoApplication extends Application {
|
||||
|
||||
private static final String TAG = "AbsMogoApplication";
|
||||
|
||||
// 没有换肤功能的LayoutInflater
|
||||
private static LayoutInflater mLayoutInflaterNoSkin;
|
||||
|
||||
public static LayoutInflater getLayoutInflaterNoSkin() {
|
||||
return mLayoutInflaterNoSkin;
|
||||
}
|
||||
|
||||
private static Application sApp;
|
||||
|
||||
public static Application getApp() {
|
||||
@@ -57,6 +59,8 @@ public abstract class AbsMogoApplication extends Application {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
// 在设置皮肤布局填充器之前进行克隆一个出来
|
||||
mLayoutInflaterNoSkin = LayoutInflater.from(new ContextThemeWrapper(this, R.style.Theme_AppCompat)).cloneInContext(new ContextThemeWrapper(this, R.style.Theme_AppCompat));
|
||||
sApp = this;
|
||||
initARouter();
|
||||
if ( shouldInit() ) {
|
||||
|
||||
@@ -252,7 +252,12 @@ public class AMapWrapper implements IMogoMap {
|
||||
if ( polylineOptions == null ) {
|
||||
return null;
|
||||
}
|
||||
Polyline polyline = mAMap.drawLine( polylineOptions );
|
||||
Polyline polyline = null;
|
||||
if (polylineOptions.getLineWidth() > 0){
|
||||
polyline = mAMap.drawThickLine(polylineOptions);
|
||||
}else {
|
||||
polyline = mAMap.drawLine(polylineOptions);
|
||||
}
|
||||
return new AMapPolylineWrapper( polyline, options );
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -17,6 +17,8 @@ import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.abs.marker.MarkerAnimationListener;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Animation;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerScaleAnimation;
|
||||
@@ -139,19 +141,19 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
if ( icons == null || icons.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
// ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
|
||||
// for ( Bitmap icon : icons ) {
|
||||
// if ( icon == null || icon.isRecycled() ) {
|
||||
// continue;
|
||||
// }
|
||||
// descriptors.add( BitmapDescriptorFactory.fromBitmap( icon ) );
|
||||
// }
|
||||
// if ( descriptors.isEmpty() ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( mMarker != null ) {
|
||||
// mMarker.setIcons( descriptors );
|
||||
// }
|
||||
ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
|
||||
for ( Bitmap icon : icons ) {
|
||||
if ( icon == null || icon.isRecycled() ) {
|
||||
continue;
|
||||
}
|
||||
descriptors.add( BitmapDescriptorFactory.INSTANCE.fromBitmap(icon));
|
||||
}
|
||||
if ( descriptors.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setIcons( descriptors );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,89 +52,89 @@ import java.util.List;
|
||||
*/
|
||||
public class ObjectUtils {
|
||||
|
||||
public static MarkerOptions fromMogo( MogoMarkerOptions opt ) {
|
||||
public static MarkerOptions fromMogo(MogoMarkerOptions opt) {
|
||||
|
||||
if ( opt == null ) {
|
||||
if (opt == null) {
|
||||
return null;
|
||||
}
|
||||
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
|
||||
final ArrayList< Bitmap > icons = opt.getIcons();
|
||||
if ( icons != null && !icons.isEmpty() ) {
|
||||
for ( Bitmap icon : icons ) {
|
||||
if ( icon == null || icon.isRecycled() ) {
|
||||
ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
|
||||
final ArrayList<Bitmap> icons = opt.getIcons();
|
||||
if (icons != null && !icons.isEmpty()) {
|
||||
for (Bitmap icon : icons) {
|
||||
if (icon == null || icon.isRecycled()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
descriptors.add( new BitmapDescriptor( icon ) );
|
||||
descriptors.add(new BitmapDescriptor(icon));
|
||||
}
|
||||
}
|
||||
|
||||
MarkerOptions markerOptions = new MarkerOptions()
|
||||
.position( new LonLatPoint( opt.getLongitude(), opt.getLatitude() ) )
|
||||
.anchor( opt.getU(), opt.getV() )
|
||||
.position(new LonLatPoint(opt.getLongitude(), opt.getLatitude()))
|
||||
.anchor(opt.getU(), opt.getV())
|
||||
// .icons( descriptors )
|
||||
// .period( opt.getPeriod() )
|
||||
.rotateAngle( opt.getRotate() )
|
||||
.setFlat( opt.isFlat() )
|
||||
.visible( opt.isVisible() )
|
||||
.infoWindowEnable( opt.isInifoWindowEnable() )
|
||||
.alpha( opt.getAlpha() )
|
||||
.setGps( opt.isGps() )
|
||||
.rotateAngle(opt.getRotate())
|
||||
.setFlat(opt.isFlat())
|
||||
.visible(opt.isVisible())
|
||||
.infoWindowEnable(opt.isInifoWindowEnable())
|
||||
.alpha(opt.getAlpha())
|
||||
.setGps(opt.isGps())
|
||||
// .draggable( opt.isDraggable() )
|
||||
.setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() )
|
||||
.zIndex( opt.getzIndex() );
|
||||
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo( opt );
|
||||
if ( descriptor != null ) {
|
||||
markerOptions.markerIcon( descriptor );
|
||||
.setInfoWindowOffset(opt.getOffsetX(), opt.getOffsetY())
|
||||
.zIndex(opt.getzIndex());
|
||||
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo(opt);
|
||||
if (descriptor != null) {
|
||||
markerOptions.markerIcon(descriptor);
|
||||
}
|
||||
if ( opt.getIcon3DRes() != 0 ) {
|
||||
markerOptions.marker3DIcon( opt.getIcon3DRes() );
|
||||
if (opt.getIcon3DRes() != 0) {
|
||||
markerOptions.marker3DIcon(opt.getIcon3DRes());
|
||||
}
|
||||
if ( !TextUtils.isEmpty( opt.getTitle() ) ) {
|
||||
markerOptions.title( opt.getTitle() );
|
||||
if (!TextUtils.isEmpty(opt.getTitle())) {
|
||||
markerOptions.title(opt.getTitle());
|
||||
}
|
||||
if ( !TextUtils.isEmpty( opt.getSnippet() ) ) {
|
||||
markerOptions.snippet( opt.getSnippet() );
|
||||
if (!TextUtils.isEmpty(opt.getSnippet())) {
|
||||
markerOptions.snippet(opt.getSnippet());
|
||||
}
|
||||
return markerOptions;
|
||||
}
|
||||
|
||||
private static BitmapDescriptor getBitmapDescriptorFromMogo( MogoMarkerOptions options ) {
|
||||
if ( options == null ) {
|
||||
private static BitmapDescriptor getBitmapDescriptorFromMogo(MogoMarkerOptions options) {
|
||||
if (options == null) {
|
||||
return null;
|
||||
}
|
||||
Bitmap icon = options.getIcon();
|
||||
if ( icon != null ) {
|
||||
return BitmapDescriptorFactory.INSTANCE.fromBitmap( icon );
|
||||
if (icon != null) {
|
||||
return BitmapDescriptorFactory.INSTANCE.fromBitmap(icon);
|
||||
}
|
||||
View view = options.getIconView();
|
||||
if ( view != null ) {
|
||||
return BitmapDescriptorFactory.INSTANCE.fromView( view );
|
||||
if (view != null) {
|
||||
return BitmapDescriptorFactory.INSTANCE.fromView(view);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static MogoLocation fromLocation( com.zhidaoauto.map.sdk.open.location.MogoLocation aLocation ) {
|
||||
if ( aLocation == null ) {
|
||||
public static MogoLocation fromLocation(com.zhidaoauto.map.sdk.open.location.MogoLocation aLocation) {
|
||||
if (aLocation == null) {
|
||||
return null;
|
||||
}
|
||||
MogoLocation location = new MogoLocation();
|
||||
// location.setLocType( aLocation.getLocationType() );
|
||||
location.setSpeed( aLocation.getSpeed() );
|
||||
location.setLatitude( aLocation.getLat() );
|
||||
location.setLongitude( aLocation.getLon() );
|
||||
location.setAltitude( aLocation.getAltitude() );
|
||||
location.setSpeed(aLocation.getSpeed());
|
||||
location.setLatitude(aLocation.getLat());
|
||||
location.setLongitude(aLocation.getLon());
|
||||
location.setAltitude(aLocation.getAltitude());
|
||||
// location.setTime( aLocation.getTime() );
|
||||
location.setBearing( aLocation.getHeading() );
|
||||
location.setBearing(aLocation.getHeading());
|
||||
// location.setAccuracy( aLocation.getAccuracy() );
|
||||
location.setCityCode( aLocation.getCityCode() );
|
||||
location.setCityName( aLocation.getCity() );
|
||||
location.setProvider( aLocation.getProvider() );
|
||||
location.setAddress( aLocation.getAddress() );
|
||||
location.setDistrict( aLocation.getDistrict() );
|
||||
location.setProvince( aLocation.getProvince() );
|
||||
location.setAdCode( aLocation.getAdCode() );
|
||||
location.setCityCode(aLocation.getCityCode());
|
||||
location.setCityName(aLocation.getCity());
|
||||
location.setProvider(aLocation.getProvider());
|
||||
location.setAddress(aLocation.getAddress());
|
||||
location.setDistrict(aLocation.getDistrict());
|
||||
location.setProvince(aLocation.getProvince());
|
||||
location.setAdCode(aLocation.getAdCode());
|
||||
// location.setLocationDetail( aLocation.getLocationDetail() );
|
||||
// location.setPoiName( aLocation.getPoiName() );
|
||||
// location.setAoiName( aLocation.getAoiName() );
|
||||
@@ -149,11 +149,11 @@ public class ObjectUtils {
|
||||
return location;
|
||||
}
|
||||
|
||||
public static LonLatPoint fromMogo( MogoLatLng latLng ) {
|
||||
if ( latLng == null ) {
|
||||
public static LonLatPoint fromMogo(MogoLatLng latLng) {
|
||||
if (latLng == null) {
|
||||
return null;
|
||||
}
|
||||
return new LonLatPoint( latLng.lon, latLng.lat );
|
||||
return new LonLatPoint(latLng.lon, latLng.lat);
|
||||
}
|
||||
|
||||
// public static NaviLatLng fromMogoAsNavi( MogoLatLng latLng ) {
|
||||
@@ -170,11 +170,11 @@ public class ObjectUtils {
|
||||
// return new LatLng( latLng.lat, latLng.lng );
|
||||
// }
|
||||
|
||||
public static MogoLatLng fromAMap( LonLatPoint point ) {
|
||||
if ( point == null ) {
|
||||
public static MogoLatLng fromAMap(LonLatPoint point) {
|
||||
if (point == null) {
|
||||
return null;
|
||||
}
|
||||
return new MogoLatLng( point.getLatitude(), point.getLongitude() );
|
||||
return new MogoLatLng(point.getLatitude(), point.getLongitude());
|
||||
}
|
||||
|
||||
// public static MogoLatLng CameraPositionfromAMap( LatLng point ) {
|
||||
@@ -184,19 +184,19 @@ public class ObjectUtils {
|
||||
// return new MogoLatLng( point.latitude, point.longitude );
|
||||
// }
|
||||
|
||||
public static GeocodeQuery fromMogo( MogoGeocodeQuery query ) {
|
||||
if ( query == null ) {
|
||||
public static GeocodeQuery fromMogo(MogoGeocodeQuery query) {
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
GeocodeQuery q = new GeocodeQuery( query.getLocationName(), query.getCity() );
|
||||
GeocodeQuery q = new GeocodeQuery(query.getLocationName(), query.getCity());
|
||||
return q;
|
||||
}
|
||||
|
||||
public static RegeocodeQuery fromMogo( MogoRegeocodeQuery query ) {
|
||||
if ( query == null ) {
|
||||
public static RegeocodeQuery fromMogo(MogoRegeocodeQuery query) {
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
RegeocodeQuery q = new RegeocodeQuery( fromMogo( query.getPoint() ), 1000 );
|
||||
RegeocodeQuery q = new RegeocodeQuery(fromMogo(query.getPoint()), 1000);
|
||||
return q;
|
||||
}
|
||||
|
||||
@@ -238,39 +238,39 @@ public class ObjectUtils {
|
||||
// return mogoCrossroad;
|
||||
// }
|
||||
|
||||
public static MogoGeocodeAddress fromAMap( GeocodeAddress address ) {
|
||||
if ( address == null ) {
|
||||
public static MogoGeocodeAddress fromAMap(GeocodeAddress address) {
|
||||
if (address == null) {
|
||||
return null;
|
||||
}
|
||||
MogoGeocodeAddress mogoGeocodeAddress = new MogoGeocodeAddress();
|
||||
mogoGeocodeAddress.setAdcode( address.getAdcode() );
|
||||
mogoGeocodeAddress.setBuilding( address.getBuilding() );
|
||||
mogoGeocodeAddress.setCity( address.getCity() );
|
||||
mogoGeocodeAddress.setDistrict( address.getDistrict() );
|
||||
mogoGeocodeAddress.setFormatAddress( address.getFormatAddress() );
|
||||
mogoGeocodeAddress.setLatlng( fromAMap( address.getLonlat() ) );
|
||||
mogoGeocodeAddress.setLevel( address.getLevel() );
|
||||
mogoGeocodeAddress.setNeighborhood( address.getNeighborhood() );
|
||||
mogoGeocodeAddress.setProvince( address.getProvince() );
|
||||
mogoGeocodeAddress.setTownship( address.getTownship() );
|
||||
mogoGeocodeAddress.setAdcode(address.getAdcode());
|
||||
mogoGeocodeAddress.setBuilding(address.getBuilding());
|
||||
mogoGeocodeAddress.setCity(address.getCity());
|
||||
mogoGeocodeAddress.setDistrict(address.getDistrict());
|
||||
mogoGeocodeAddress.setFormatAddress(address.getFormatAddress());
|
||||
mogoGeocodeAddress.setLatlng(fromAMap(address.getLonlat()));
|
||||
mogoGeocodeAddress.setLevel(address.getLevel());
|
||||
mogoGeocodeAddress.setNeighborhood(address.getNeighborhood());
|
||||
mogoGeocodeAddress.setProvince(address.getProvince());
|
||||
mogoGeocodeAddress.setTownship(address.getTownship());
|
||||
return mogoGeocodeAddress;
|
||||
}
|
||||
|
||||
public static MogoGeocodeResult fromAMap( GeocodeResult result ) {
|
||||
if ( result == null || result.getGeocodeAddressList() == null ) {
|
||||
public static MogoGeocodeResult fromAMap(GeocodeResult result) {
|
||||
if (result == null || result.getGeocodeAddressList() == null) {
|
||||
return null;
|
||||
}
|
||||
MogoGeocodeResult mogoGeocodeResult = new MogoGeocodeResult();
|
||||
final List< MogoGeocodeAddress > addresses = new ArrayList<>();
|
||||
List< GeocodeAddress > list = result.getGeocodeAddressList();
|
||||
for ( GeocodeAddress geocodeAddress : list ) {
|
||||
final MogoGeocodeAddress mogoGeocodeAddress = fromAMap( geocodeAddress );
|
||||
if ( mogoGeocodeAddress != null ) {
|
||||
addresses.add( mogoGeocodeAddress );
|
||||
final List<MogoGeocodeAddress> addresses = new ArrayList<>();
|
||||
List<GeocodeAddress> list = result.getGeocodeAddressList();
|
||||
for (GeocodeAddress geocodeAddress : list) {
|
||||
final MogoGeocodeAddress mogoGeocodeAddress = fromAMap(geocodeAddress);
|
||||
if (mogoGeocodeAddress != null) {
|
||||
addresses.add(mogoGeocodeAddress);
|
||||
}
|
||||
}
|
||||
|
||||
mogoGeocodeResult.setAddresses( addresses );
|
||||
mogoGeocodeResult.setAddresses(addresses);
|
||||
return mogoGeocodeResult;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ public class ObjectUtils {
|
||||
// }
|
||||
//
|
||||
// public static MogoPhoto fromAMap( Photo photo ) {
|
||||
// if ( photo == null ) {
|
||||
// if ( photo == null ) {f
|
||||
// return null;
|
||||
// }
|
||||
// MogoPhoto mogoPhoto = new MogoPhoto();
|
||||
@@ -346,23 +346,23 @@ public class ObjectUtils {
|
||||
// return mogoSubPoiItem;
|
||||
// }
|
||||
|
||||
public static MogoPoiItem fromAMap( PoiItem poiItem ) {
|
||||
if ( poiItem == null ) {
|
||||
public static MogoPoiItem fromAMap(PoiItem poiItem) {
|
||||
if (poiItem == null) {
|
||||
return null;
|
||||
}
|
||||
MogoPoiItem mogoPoiItem = new MogoPoiItem();
|
||||
mogoPoiItem.setAdCode( poiItem.getAdCode() );
|
||||
mogoPoiItem.setAdName( poiItem.getAdName() );
|
||||
mogoPoiItem.setBusinessArea( poiItem.getBusinessArea() );
|
||||
mogoPoiItem.setCityCode( poiItem.getCityCode() );
|
||||
mogoPoiItem.setCityName( poiItem.getCityName() );
|
||||
mogoPoiItem.setDirection( poiItem.getDirection() );
|
||||
mogoPoiItem.setDistance( poiItem.getDistance() );
|
||||
mogoPoiItem.setEmail( poiItem.getEmail() );
|
||||
mogoPoiItem.setEnter( fromAMap( poiItem.getEnter() ) );
|
||||
mogoPoiItem.setExit( fromAMap( poiItem.getExit() ) );
|
||||
mogoPoiItem.setAdCode(poiItem.getAdCode());
|
||||
mogoPoiItem.setAdName(poiItem.getAdName());
|
||||
mogoPoiItem.setBusinessArea(poiItem.getBusinessArea());
|
||||
mogoPoiItem.setCityCode(poiItem.getCityCode());
|
||||
mogoPoiItem.setCityName(poiItem.getCityName());
|
||||
mogoPoiItem.setDirection(poiItem.getDirection());
|
||||
mogoPoiItem.setDistance(poiItem.getDistance());
|
||||
mogoPoiItem.setEmail(poiItem.getEmail());
|
||||
mogoPoiItem.setEnter(fromAMap(poiItem.getEnter()));
|
||||
mogoPoiItem.setExit(fromAMap(poiItem.getExit()));
|
||||
// mogoPoiItem.setIndoorData( fromAMap( poiItem.getIndoorData() ) );
|
||||
mogoPoiItem.setParkingType( poiItem.getParkingType() );
|
||||
mogoPoiItem.setParkingType(poiItem.getParkingType());
|
||||
// mogoPoiItem.setIndoorMap( poiItem.isIndoorMap() );
|
||||
// if ( poiItem.getPhotos() != null ) {
|
||||
// List< MogoPhoto > mogoPhotos = new ArrayList<>();
|
||||
@@ -375,13 +375,13 @@ public class ObjectUtils {
|
||||
// mogoPoiItem.setPhotos( mogoPhotos );
|
||||
// }
|
||||
// mogoPoiItem.setPoiExtension( fromAMap( poiItem.getPoiExtension() ) );
|
||||
mogoPoiItem.setPoiId( poiItem.getPoiId() );
|
||||
mogoPoiItem.setPoint( fromAMap( poiItem.getLonLatPoint() ) );
|
||||
mogoPoiItem.setPostcode( poiItem.getPostcode() );
|
||||
mogoPoiItem.setProvinceCode( poiItem.getProvinceCode() );
|
||||
mogoPoiItem.setProvinceName( poiItem.getProvinceName() );
|
||||
mogoPoiItem.setShopID( poiItem.getShopID() );
|
||||
mogoPoiItem.setSnippet( poiItem.getSnippet() );
|
||||
mogoPoiItem.setPoiId(poiItem.getPoiId());
|
||||
mogoPoiItem.setPoint(fromAMap(poiItem.getLonLatPoint()));
|
||||
mogoPoiItem.setPostcode(poiItem.getPostcode());
|
||||
mogoPoiItem.setProvinceCode(poiItem.getProvinceCode());
|
||||
mogoPoiItem.setProvinceName(poiItem.getProvinceName());
|
||||
mogoPoiItem.setShopID(poiItem.getShopID());
|
||||
mogoPoiItem.setSnippet(poiItem.getSnippet());
|
||||
// if ( poiItem.getSubPois() != null ) {
|
||||
// List< MogoSubPoiItem > mogoSubPoiItems = new ArrayList<>();
|
||||
// for ( SubPoiItem subPois : poiItem.getSubPois() ) {
|
||||
@@ -392,20 +392,20 @@ public class ObjectUtils {
|
||||
// }
|
||||
// mogoPoiItem.setSubPois( mogoSubPoiItems );
|
||||
// }
|
||||
mogoPoiItem.setTel( poiItem.getTel() );
|
||||
mogoPoiItem.setTypeCode( poiItem.getTypeCode() );
|
||||
mogoPoiItem.setTitle( poiItem.getTitle() );
|
||||
mogoPoiItem.setTypeDes( poiItem.getTypeDes() );
|
||||
mogoPoiItem.setWebsite( poiItem.getWebsite() );
|
||||
mogoPoiItem.setTel(poiItem.getTel());
|
||||
mogoPoiItem.setTypeCode(poiItem.getTypeCode());
|
||||
mogoPoiItem.setTitle(poiItem.getTitle());
|
||||
mogoPoiItem.setTypeDes(poiItem.getTypeDes());
|
||||
mogoPoiItem.setWebsite(poiItem.getWebsite());
|
||||
return mogoPoiItem;
|
||||
}
|
||||
|
||||
public static MogoRegeocodeAddress fromAMap( RegeocodeAddress regeocodeAddress ) {
|
||||
if ( regeocodeAddress == null ) {
|
||||
public static MogoRegeocodeAddress fromAMap(RegeocodeAddress regeocodeAddress) {
|
||||
if (regeocodeAddress == null) {
|
||||
return null;
|
||||
}
|
||||
MogoRegeocodeAddress mogoRegeocodeAddress = new MogoRegeocodeAddress();
|
||||
mogoRegeocodeAddress.setAdCode( regeocodeAddress.getAdCode() );
|
||||
mogoRegeocodeAddress.setAdCode(regeocodeAddress.getAdCode());
|
||||
// if ( regeocodeAddress.getAois() != null ) {
|
||||
// List< MogoAoiItem > items = new ArrayList<>();
|
||||
// for ( AoiItem aois : regeocodeAddress.getAois() ) {
|
||||
@@ -417,7 +417,7 @@ public class ObjectUtils {
|
||||
// mogoRegeocodeAddress.setAois( items );
|
||||
// }
|
||||
|
||||
mogoRegeocodeAddress.setBuilding( regeocodeAddress.getBuilding() );
|
||||
mogoRegeocodeAddress.setBuilding(regeocodeAddress.getBuilding());
|
||||
// if ( regeocodeAddress.getBusinessAreas() != null ) {
|
||||
// List< MogoBusinessArea > mogoBusinessAreas = new ArrayList<>();
|
||||
// for ( BusinessArea businessArea : regeocodeAddress.getBusinessAreas() ) {
|
||||
@@ -429,9 +429,9 @@ public class ObjectUtils {
|
||||
// mogoRegeocodeAddress.setBusinessAreas( mogoBusinessAreas );
|
||||
// }
|
||||
|
||||
mogoRegeocodeAddress.setCity( regeocodeAddress.getCity() );
|
||||
mogoRegeocodeAddress.setCityCode( regeocodeAddress.getCityCode() );
|
||||
mogoRegeocodeAddress.setCountry( regeocodeAddress.getCountry() );
|
||||
mogoRegeocodeAddress.setCity(regeocodeAddress.getCity());
|
||||
mogoRegeocodeAddress.setCityCode(regeocodeAddress.getCityCode());
|
||||
mogoRegeocodeAddress.setCountry(regeocodeAddress.getCountry());
|
||||
// if ( regeocodeAddress.getCrossroads() != null ) {
|
||||
// List< MogoCrossroad > mogoCrossroads = new ArrayList<>();
|
||||
// for ( Crossroad crossroad : regeocodeAddress.getCrossroads() ) {
|
||||
@@ -443,19 +443,19 @@ public class ObjectUtils {
|
||||
// }
|
||||
// mogoRegeocodeAddress.setCrossroads( mogoCrossroads );
|
||||
// }
|
||||
mogoRegeocodeAddress.setDistrict( regeocodeAddress.getDistrict() );
|
||||
mogoRegeocodeAddress.setFormatAddress( regeocodeAddress.getFormatAddress() );
|
||||
mogoRegeocodeAddress.setNeighborhood( regeocodeAddress.getNeighborhood() );
|
||||
if ( regeocodeAddress.getPoiList() != null ) {
|
||||
List< MogoPoiItem > mogoPoiItems = new ArrayList<>();
|
||||
List< PoiItem > list = regeocodeAddress.getPoiList();
|
||||
for ( PoiItem pois : list ) {
|
||||
MogoPoiItem mogoPoiItem = fromAMap( pois );
|
||||
mogoPoiItems.add( mogoPoiItem );
|
||||
mogoRegeocodeAddress.setDistrict(regeocodeAddress.getDistrict());
|
||||
mogoRegeocodeAddress.setFormatAddress(regeocodeAddress.getFormatAddress());
|
||||
mogoRegeocodeAddress.setNeighborhood(regeocodeAddress.getNeighborhood());
|
||||
if (regeocodeAddress.getPoiList() != null) {
|
||||
List<MogoPoiItem> mogoPoiItems = new ArrayList<>();
|
||||
List<PoiItem> list = regeocodeAddress.getPoiList();
|
||||
for (PoiItem pois : list) {
|
||||
MogoPoiItem mogoPoiItem = fromAMap(pois);
|
||||
mogoPoiItems.add(mogoPoiItem);
|
||||
}
|
||||
mogoRegeocodeAddress.setPois( mogoPoiItems );
|
||||
mogoRegeocodeAddress.setPois(mogoPoiItems);
|
||||
}
|
||||
mogoRegeocodeAddress.setProvince( regeocodeAddress.getProvince() );
|
||||
mogoRegeocodeAddress.setProvince(regeocodeAddress.getProvince());
|
||||
// if ( regeocodeAddress.getRoads() != null ) {
|
||||
// List< MogoRegeocodeRoad > mogoRegeocodeRoads = new ArrayList<>();
|
||||
// for ( RegeocodeRoad road : regeocodeAddress.getRoads() ) {
|
||||
@@ -467,43 +467,43 @@ public class ObjectUtils {
|
||||
// mogoRegeocodeAddress.setRoads( mogoRegeocodeRoads );
|
||||
// }
|
||||
// mogoRegeocodeAddress.setStreetNumber( fromAMap( regeocodeAddress.getStreetNumber() ) );
|
||||
mogoRegeocodeAddress.setTowncode( regeocodeAddress.getTowncode() );
|
||||
mogoRegeocodeAddress.setTownship( regeocodeAddress.getTownship() );
|
||||
mogoRegeocodeAddress.setTowncode(regeocodeAddress.getTowncode());
|
||||
mogoRegeocodeAddress.setTownship(regeocodeAddress.getTownship());
|
||||
return mogoRegeocodeAddress;
|
||||
}
|
||||
|
||||
public static MogoRegeocodeResult fromAMap( RegeocodeResult regeocodeResult ) {
|
||||
if ( regeocodeResult == null ) {
|
||||
public static MogoRegeocodeResult fromAMap(RegeocodeResult regeocodeResult) {
|
||||
if (regeocodeResult == null) {
|
||||
return null;
|
||||
}
|
||||
MogoRegeocodeResult mogoRegeocodeResult = new MogoRegeocodeResult();
|
||||
mogoRegeocodeResult.setRegeocodeAddress( fromAMap( regeocodeResult.getRegeocodeAddress() ) );
|
||||
mogoRegeocodeResult.setRegeocodeAddress(fromAMap(regeocodeResult.getRegeocodeAddress()));
|
||||
return mogoRegeocodeResult;
|
||||
}
|
||||
|
||||
public static InputtipsQuery fromMogo( MogoInputtipsQuery query ) {
|
||||
if ( query == null ) {
|
||||
public static InputtipsQuery fromMogo(MogoInputtipsQuery query) {
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
InputtipsQuery inputtipsQuery = new InputtipsQuery( query.getKeyword(), query.getCity() );
|
||||
inputtipsQuery.setCityLimit( query.isCityLimit() );
|
||||
inputtipsQuery.setLocation( fromMogo( query.getLocation() ) );
|
||||
inputtipsQuery.setType( query.getType() );
|
||||
InputtipsQuery inputtipsQuery = new InputtipsQuery(query.getKeyword(), query.getCity());
|
||||
inputtipsQuery.setCityLimit(query.isCityLimit());
|
||||
inputtipsQuery.setLocation(fromMogo(query.getLocation()));
|
||||
inputtipsQuery.setType(query.getType());
|
||||
return inputtipsQuery;
|
||||
}
|
||||
|
||||
public static MogoTip fromAMap( Tip tip ) {
|
||||
if ( tip == null ) {
|
||||
public static MogoTip fromAMap(Tip tip) {
|
||||
if (tip == null) {
|
||||
return null;
|
||||
}
|
||||
MogoTip mogoTip = new MogoTip();
|
||||
mogoTip.setAdCode( tip.getAdcode() );
|
||||
mogoTip.setAddress( tip.getAddress() );
|
||||
mogoTip.setDistrict( tip.getDistrict() );
|
||||
mogoTip.setName( tip.getName() );
|
||||
mogoTip.setPoiID( tip.getPoiID() );
|
||||
mogoTip.setPoint( fromAMap( tip.getLatPoint() ) );
|
||||
mogoTip.setTypeCode( tip.getTypeCode() );
|
||||
mogoTip.setAdCode(tip.getAdcode());
|
||||
mogoTip.setAddress(tip.getAddress());
|
||||
mogoTip.setDistrict(tip.getDistrict());
|
||||
mogoTip.setName(tip.getName());
|
||||
mogoTip.setPoiID(tip.getPoiID());
|
||||
mogoTip.setPoint(fromAMap(tip.getLatPoint()));
|
||||
mogoTip.setTypeCode(tip.getTypeCode());
|
||||
return mogoTip;
|
||||
}
|
||||
|
||||
@@ -518,100 +518,100 @@ public class ObjectUtils {
|
||||
// return mogoPoi;
|
||||
// }
|
||||
|
||||
public static MogoPoiSearchQuery fromAMap( Query query ) {
|
||||
if ( query == null ) {
|
||||
public static MogoPoiSearchQuery fromAMap(Query query) {
|
||||
if (query == null) {
|
||||
return null;
|
||||
}
|
||||
MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery( query.getKeyword(), query.getCategory(), query.getCity() );
|
||||
MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery(query.getKeyword(), query.getCategory(), query.getCity());
|
||||
// mogoPoiSearchQuery.setBuilding( query.getBuilding() );
|
||||
mogoPoiSearchQuery.setCityLimit( query.getCityLimit() );
|
||||
mogoPoiSearchQuery.setDistanceSort( query.getDistanceSort() );
|
||||
mogoPoiSearchQuery.setLocation( fromAMap( query.getLocation() ) );
|
||||
mogoPoiSearchQuery.setPageNum( query.getPageNum() );
|
||||
mogoPoiSearchQuery.setPageSize( query.getPageSize() );
|
||||
mogoPoiSearchQuery.setCityLimit(query.getCityLimit());
|
||||
mogoPoiSearchQuery.setDistanceSort(query.getDistanceSort());
|
||||
mogoPoiSearchQuery.setLocation(fromAMap(query.getLocation()));
|
||||
mogoPoiSearchQuery.setPageNum(query.getPageNum());
|
||||
mogoPoiSearchQuery.setPageSize(query.getPageSize());
|
||||
return mogoPoiSearchQuery;
|
||||
}
|
||||
|
||||
public static Query fromMogo( MogoPoiSearchQuery query ) {
|
||||
if ( query == null || query.getQuery() == null ) {
|
||||
public static Query fromMogo(MogoPoiSearchQuery query) {
|
||||
if (query == null || query.getQuery() == null) {
|
||||
return null;
|
||||
}
|
||||
Query psq = new Query( query.getQuery(), "", "" );
|
||||
String category = getCategory( query.getQuery() );
|
||||
if ( !category.equals( "" ) )
|
||||
psq = new Query( "", "", getCategory( query.getQuery() ) );
|
||||
Query psq = new Query(query.getQuery(), "", "");
|
||||
String category = getCategory(query.getQuery());
|
||||
if (!category.equals(""))
|
||||
psq = new Query("", "", getCategory(query.getQuery()));
|
||||
// psq.setBuilding( query.getBuilding() );
|
||||
psq.setCityLimit( query.isCityLimit() );
|
||||
psq.setDistanceSort( query.isDistanceSort() );
|
||||
psq.setLocation( fromMogo( query.getLocation() ) );
|
||||
psq.setPageNum( query.getPageNum() );
|
||||
psq.setPageSize( query.getPageSize() );
|
||||
psq.setCityLimit(query.isCityLimit());
|
||||
psq.setDistanceSort(query.isDistanceSort());
|
||||
psq.setLocation(fromMogo(query.getLocation()));
|
||||
psq.setPageNum(query.getPageNum());
|
||||
psq.setPageSize(query.getPageSize());
|
||||
return psq;
|
||||
}
|
||||
|
||||
public static MogoSearchBound fromAMap( SearchBound bound ) {
|
||||
if ( bound == null ) {
|
||||
public static MogoSearchBound fromAMap(SearchBound bound) {
|
||||
if (bound == null) {
|
||||
return null;
|
||||
}
|
||||
if ( bound.getShape() == SearchBound.BOUND_SHAPE ) {
|
||||
return new MogoSearchBound( fromAMap( bound.getCenter() ), bound.getRange(), bound.isDistanceSort() );
|
||||
} else if ( bound.getShape() == SearchBound.POLYGON_SHAPE ) {
|
||||
return new MogoSearchBound( fromAMap( bound.getPolyGonList() ) );
|
||||
} else if ( bound.getShape() == SearchBound.RECTANGLE_SHAPE ) {
|
||||
return new MogoSearchBound( fromAMap( bound.getLowerLeft() ), fromAMap( bound.getUpperRight() ) );
|
||||
if (bound.getShape() == SearchBound.BOUND_SHAPE) {
|
||||
return new MogoSearchBound(fromAMap(bound.getCenter()), bound.getRange(), bound.isDistanceSort());
|
||||
} else if (bound.getShape() == SearchBound.POLYGON_SHAPE) {
|
||||
return new MogoSearchBound(fromAMap(bound.getPolyGonList()));
|
||||
} else if (bound.getShape() == SearchBound.RECTANGLE_SHAPE) {
|
||||
return new MogoSearchBound(fromAMap(bound.getLowerLeft()), fromAMap(bound.getUpperRight()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List< MogoLatLng > fromAMap( List< LonLatPoint > latLngs ) {
|
||||
if ( latLngs == null ) {
|
||||
public static List<MogoLatLng> fromAMap(List<LonLatPoint> latLngs) {
|
||||
if (latLngs == null) {
|
||||
return null;
|
||||
}
|
||||
List< MogoLatLng > result = new ArrayList<>( latLngs.size() );
|
||||
for ( LonLatPoint latLng : latLngs ) {
|
||||
result.add( fromAMap( latLng ) );
|
||||
List<MogoLatLng> result = new ArrayList<>(latLngs.size());
|
||||
for (LonLatPoint latLng : latLngs) {
|
||||
result.add(fromAMap(latLng));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List< LonLatPoint > fromMogo( List< MogoLatLng > latLngs ) {
|
||||
if ( latLngs == null ) {
|
||||
public static List<LonLatPoint> fromMogo(List<MogoLatLng> latLngs) {
|
||||
if (latLngs == null) {
|
||||
return null;
|
||||
}
|
||||
List< LonLatPoint > result = new ArrayList<>( latLngs.size() );
|
||||
for ( MogoLatLng latLng : latLngs ) {
|
||||
result.add( fromMogo( latLng ) );
|
||||
List<LonLatPoint> result = new ArrayList<>(latLngs.size());
|
||||
for (MogoLatLng latLng : latLngs) {
|
||||
result.add(fromMogo(latLng));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static SearchBound fromMogo( MogoSearchBound bound ) {
|
||||
if ( bound == null ) {
|
||||
public static SearchBound fromMogo(MogoSearchBound bound) {
|
||||
if (bound == null) {
|
||||
return null;
|
||||
}
|
||||
if ( bound.getShape() == MogoSearchBound.SHAPE_BOUND ) {
|
||||
return new SearchBound( fromMogo( bound.getCenterPoint() ), bound.getRadiusInMeters(), bound.isDistanceSort() );
|
||||
} else if ( bound.getShape() == MogoSearchBound.SHAPE_POLYGON ) {
|
||||
return new SearchBound( fromMogo( bound.getPolyGonList() ) );
|
||||
} else if ( bound.getShape() == MogoSearchBound.SHAPE_RECTANGLE ) {
|
||||
return new SearchBound( fromMogo( bound.getLowerLeft() ), fromMogo( bound.getUpperRight() ) );
|
||||
if (bound.getShape() == MogoSearchBound.SHAPE_BOUND) {
|
||||
return new SearchBound(fromMogo(bound.getCenterPoint()), bound.getRadiusInMeters(), bound.isDistanceSort());
|
||||
} else if (bound.getShape() == MogoSearchBound.SHAPE_POLYGON) {
|
||||
return new SearchBound(fromMogo(bound.getPolyGonList()));
|
||||
} else if (bound.getShape() == MogoSearchBound.SHAPE_RECTANGLE) {
|
||||
return new SearchBound(fromMogo(bound.getLowerLeft()), fromMogo(bound.getUpperRight()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MogoPoiResult fromAMap( PoiSearchResult result ) {
|
||||
if ( result == null ) {
|
||||
public static MogoPoiResult fromAMap(PoiSearchResult result) {
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
MogoPoiResult mogoPoiResult = new MogoPoiResult();
|
||||
if ( result.getItems() != null ) {
|
||||
final List< PoiSearchItem > poiItems = result.getItems();
|
||||
final ArrayList< MogoPoiItem > mogoPoiItems = new ArrayList<>( poiItems.size() );
|
||||
for ( PoiSearchItem poiItem : poiItems ) {
|
||||
mogoPoiItems.add( fromAMap( poiItem.getPoi() ) );
|
||||
if (result.getItems() != null) {
|
||||
final List<PoiSearchItem> poiItems = result.getItems();
|
||||
final ArrayList<MogoPoiItem> mogoPoiItems = new ArrayList<>(poiItems.size());
|
||||
for (PoiSearchItem poiItem : poiItems) {
|
||||
mogoPoiItems.add(fromAMap(poiItem.getPoi()));
|
||||
}
|
||||
mogoPoiResult.setPois( mogoPoiItems );
|
||||
mogoPoiResult.setPois(mogoPoiItems);
|
||||
}
|
||||
return mogoPoiResult;
|
||||
}
|
||||
@@ -690,27 +690,27 @@ public class ObjectUtils {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public static PolylineOptions fromMogo( MogoPolylineOptions options ) {
|
||||
if ( options == null ) {
|
||||
public static PolylineOptions fromMogo(MogoPolylineOptions options) {
|
||||
if (options == null) {
|
||||
return null;
|
||||
}
|
||||
PolylineOptions target = new PolylineOptions();
|
||||
if ( options.getPoints() != null ) {
|
||||
List< LonLatPoint > points = new ArrayList<>();
|
||||
for ( MogoLatLng point : options.getPoints() ) {
|
||||
points.add( fromMogo( point ) );
|
||||
if (options.getPoints() != null) {
|
||||
List<LonLatPoint> points = new ArrayList<>();
|
||||
for (MogoLatLng point : options.getPoints()) {
|
||||
points.add(fromMogo(point));
|
||||
}
|
||||
target.setLonLatPoints( points );
|
||||
target.lonLatPoints(points);
|
||||
}
|
||||
target.setLineWidth( options.getWidth() );
|
||||
target.setColor( options.getColor() );
|
||||
target.setLineWidth(options.getWidth());
|
||||
target.setColor(options.getColor());
|
||||
// target.zIndex( options.getWidth() );
|
||||
// target.visible( options.isVisible() );
|
||||
//// target.geodesic( options.isGeodesic() );
|
||||
// target.setDottedLine( options.isDottedLine() );
|
||||
target.useGradient( options.isGradient() );
|
||||
if ( options.getColorValues() != null ) {
|
||||
target.colorValues( options.getColorValues() );
|
||||
target.useGradient(options.isGradient());
|
||||
if (options.getColorValues() != null) {
|
||||
target.colorValues(options.getColorValues());
|
||||
}
|
||||
// target.transparency( options.getTransparency() );
|
||||
// target.aboveMaskLayer( options.isAboveMaskLayer() );
|
||||
@@ -727,24 +727,24 @@ public class ObjectUtils {
|
||||
// return new MogoLatLng( latLng.latitude, latLng.longitude );
|
||||
// }
|
||||
|
||||
public static MapCameraPosition fromAMap( CameraPosition position ) {
|
||||
if ( position == null ) {
|
||||
public static MapCameraPosition fromAMap(CameraPosition position) {
|
||||
if (position == null) {
|
||||
return null;
|
||||
}
|
||||
return new MapCameraPosition( fromAMap( position.getTarget() ), position.getBearing(), position.getTilt(), position.getZoom() );
|
||||
return new MapCameraPosition(fromAMap(position.getTarget()), position.getBearing(), position.getTilt(), position.getZoom());
|
||||
}
|
||||
|
||||
private static String getCategory( String key ) {
|
||||
private static String getCategory(String key) {
|
||||
String category = "";
|
||||
if ( key.equals( "加油站" ) ) {
|
||||
if (key.equals("加油站")) {
|
||||
category = "6";
|
||||
} else if ( key.equals( "停车场" ) ) {
|
||||
} else if (key.equals("停车场")) {
|
||||
category = "12";
|
||||
} else if ( key.equals( "餐馆" ) ) {
|
||||
} else if (key.equals("餐馆")) {
|
||||
category = "22";
|
||||
} else if ( key.equals( "洗车" ) ) {
|
||||
} else if (key.equals("洗车")) {
|
||||
category = "8";
|
||||
} else if ( key.equals( "厕所" ) ) {
|
||||
} else if (key.equals("厕所")) {
|
||||
|
||||
}
|
||||
return category;
|
||||
|
||||
@@ -34,6 +34,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.callchatprovider
|
||||
implementation "com.mogo.httpdns:httpdns-helper:1.0.1"
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
api rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.mogo.module.common.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.httpdnshelper.sdk.HttpDnsHelper;
|
||||
import com.mogo.httpdnshelper.sdk.IHttpDnsConfig;
|
||||
import com.mogo.httpdnshelper.sdk.bean.HttpDnsSimpleLocation;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* MogoHttpDnsHelper包装类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class MogoHttpDnsUtil {
|
||||
private MogoHttpDnsUtil(){
|
||||
|
||||
}
|
||||
private final static MogoHttpDnsUtil INSTANCE = new MogoHttpDnsUtil();
|
||||
public static MogoHttpDnsUtil getInstance(){
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void init(Context context){
|
||||
HttpDnsHelper.INSTANCE.init(context, new IHttpDnsConfig() {
|
||||
@NotNull
|
||||
@Override
|
||||
public HttpDnsSimpleLocation getCurrentLocation() {
|
||||
MogoLocation last = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
|
||||
if(last!=null){
|
||||
return new HttpDnsSimpleLocation(last.getCityCode(), last.getLatitude(), last.getLongitude());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDebugLog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getSn() {
|
||||
return Utils.getSn();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String getHttpAddress(){
|
||||
return HttpDnsHelper.INSTANCE.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_HTTP);
|
||||
}
|
||||
|
||||
public String getWsAddress(){
|
||||
return HttpDnsHelper.INSTANCE.getHttpDnsAddress(HttpDnsHelper.HTTP_DNS_TYPE_WS);
|
||||
}
|
||||
|
||||
public void release(){
|
||||
HttpDnsHelper.INSTANCE.release();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/module_common_icon_close_vr" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/module_common_icon_close_vr" android:state_pressed="false" />
|
||||
<item android:drawable="@drawable/module_common_icon_close_vr" />
|
||||
</selector>
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.module.extensions.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
* 时延验证相关接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface DelayCheckApiServices {
|
||||
|
||||
@GET("/yycp-test-service/net/delay/heartbeat")
|
||||
Observable<BaseData> emptyInterface();
|
||||
|
||||
@POST("/yycp-test-service/net/delay/log")
|
||||
@FormUrlEncoded
|
||||
Observable<BaseData> uploadDelayCheckData(@FieldMap Map<String, Object> params);
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener<M
|
||||
}
|
||||
} else {
|
||||
mCurrentUuid = mCloudRoadData.getUuid();
|
||||
if (isVrMode) { //TODO 是否需要延迟
|
||||
if (isVrMode) { // 是否需要延迟
|
||||
Log.d(TAG, "-------------4------------");
|
||||
addVrCameraMarker(mCloudRoadData);
|
||||
isVrModeMarker = true;
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.net.DelayCheckApiServices;
|
||||
import com.mogo.module.extensions.net.DztHttpConstant;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 延时验证工具类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckUtil implements Handler.Callback {
|
||||
|
||||
private final Handler handler = new Handler(this);
|
||||
|
||||
private static final int MSG_CHECK_NET_CONNECT_STATUS = 1001;
|
||||
private static final long FIRST_CHECK_NET_CONNECT_STATUS_DELAY = 10 * 60 * 1000;
|
||||
private static final long CHECK_NET_CONNECT_STATUS_DELAY = 5000L;
|
||||
|
||||
private static final int MSG_START_DELAY_CHECK = 1002;
|
||||
private static final long DELAY_CHECK_DELAY = 10 * 60 * 1000;
|
||||
|
||||
private final Context context;
|
||||
|
||||
public DelayCheckUtil(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每5s检查一下网络状态,网络状态为连接状态时,开始空接口请求以及后续的参数上报
|
||||
*/
|
||||
public void waitingForCheck() {
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, FIRST_CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
private long requestTime, netDelay, requestSystemTime;
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case MSG_CHECK_NET_CONNECT_STATUS:
|
||||
if (NetworkUtils.isConnected(context)) {
|
||||
handler.sendEmptyMessage(MSG_START_DELAY_CHECK);
|
||||
} else {
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
return true;
|
||||
case MSG_START_DELAY_CHECK:
|
||||
// 请求空接口
|
||||
startEmptyRequest();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void startEmptyRequest() {
|
||||
requestTime = SystemClock.elapsedRealtime();
|
||||
requestSystemTime = System.currentTimeMillis();
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(DelayCheckApiServices.class, DztHttpConstant.getBaseUrl())
|
||||
.emptyInterface().subscribeOn(Schedulers.io()).observeOn(Schedulers.io())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
netDelay = SystemClock.elapsedRealtime() - requestTime;
|
||||
startUpload();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void startUpload() {
|
||||
MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
|
||||
if (lastLocation == null) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY);
|
||||
return;
|
||||
}
|
||||
Map<String, Object> params = new HashMap<>(8);
|
||||
params.put("sn", Utils.getSn());
|
||||
params.put("startTime", requestSystemTime);
|
||||
params.put("endTime", System.currentTimeMillis());
|
||||
params.put("netState", NetworkUtils.netStrengthLevel);
|
||||
params.put("place", lastLocation.getAddress());
|
||||
params.put("cityCode", lastLocation.getCityCode());
|
||||
params.put("lat", lastLocation.getLatitude());
|
||||
params.put("lon", lastLocation.getLongitude());
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(DelayCheckApiServices.class, DztHttpConstant.getBaseUrl())
|
||||
.uploadDelayCheckData(params).observeOn(Schedulers.io()).subscribeOn(Schedulers.io())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -292,12 +292,12 @@ public class TopViewAnimHelper {
|
||||
int scene = 0;
|
||||
if (animNavInfoView.isVisible()) {
|
||||
scene = Scene.NAVI_WITH_ROAD_EVENT;
|
||||
animNavInfoView.animate().translationY(computeNaviMarginTop(child.getHeight())).start();
|
||||
animNavInfoView.animate().translationY(computeNaviMarginTop(params.height)).start();
|
||||
animNavInfoView.exchangeToSmall(true);
|
||||
} else {
|
||||
scene = Scene.AIMLESS_WITH_ROAD_EVENT;
|
||||
}
|
||||
topContainer.animate().translationY(child.getHeight()).setListener(mainAnimListener).start();
|
||||
topContainer.animate().translationY(params.height).setListener(mainAnimListener).start();
|
||||
Logger.d(TAG, "show top setMapCenterPointByScene: " + scene);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mogo.module.main.delaycheck;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
* 时延验证相关接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface DelayCheckApiServices {
|
||||
|
||||
/**
|
||||
* 空接口
|
||||
* @return 什么都不返回
|
||||
*/
|
||||
@GET("/yycp-test-service/net/delay/heartbeat")
|
||||
Observable<BaseData> emptyInterface();
|
||||
|
||||
/**
|
||||
* 时延上报接口 接口文档如下
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48967034
|
||||
* @param params 相关参数,详见文档
|
||||
* @return 相关返回值,详见文档
|
||||
*/
|
||||
@POST("/yycp-test-service/net/delay/log")
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
Observable<DelayCheckResponse> uploadDelayCheckData(@Body RequestBody params);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.module.main.delaycheck;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
/**
|
||||
* dzt base url
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckHttpConstant {
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaozhixing.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaozhixing.com";
|
||||
public static final String HOST_DEMO = "http://dzt-show.zhidaozhixing.com";
|
||||
public static final String HOST_PRODUCT = "http://dzt.zhidaozhixing.com";
|
||||
|
||||
public static String getBaseUrl(){
|
||||
switch ( DebugConfig.getNetMode() ) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
return HOST_DEV;
|
||||
case DebugConfig.NET_MODE_QA:
|
||||
return HOST_TEST;
|
||||
case DebugConfig.NET_MODE_DEMO:
|
||||
return HOST_DEMO;
|
||||
default:
|
||||
return HOST_PRODUCT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.module.main.delaycheck;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
/**
|
||||
* 延迟检测response
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckResponse extends BaseData {
|
||||
private DelayCheckResult result;
|
||||
|
||||
public DelayCheckResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(DelayCheckResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DelayCheckResponse{" +
|
||||
"result=" + result +
|
||||
", code=" + code +
|
||||
", msg='" + msg + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.module.main.delaycheck;
|
||||
|
||||
/**
|
||||
* 延迟检查返回结果
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckResult {
|
||||
/**
|
||||
* 是否保持心跳
|
||||
*/
|
||||
private boolean necessary;
|
||||
/**
|
||||
* 心跳间隔,单位 s
|
||||
*/
|
||||
private int beatSeconds;
|
||||
|
||||
public boolean isNecessary() {
|
||||
return necessary;
|
||||
}
|
||||
|
||||
public void setNecessary(boolean necessary) {
|
||||
this.necessary = necessary;
|
||||
}
|
||||
|
||||
public int getBeatSeconds() {
|
||||
return beatSeconds;
|
||||
}
|
||||
|
||||
public void setBeatSeconds(int beatSeconds) {
|
||||
this.beatSeconds = beatSeconds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DelayCheckResult{" +
|
||||
"necessary=" + necessary +
|
||||
", beatSeconds=" + beatSeconds +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.mogo.module.main.delaycheck;
|
||||
|
||||
/**
|
||||
* 时延检测上报请求参数
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckUploadRequest {
|
||||
private String sn;
|
||||
private long startTime;
|
||||
private long endTime;
|
||||
/**
|
||||
* 请求时长
|
||||
*/
|
||||
private long burning;
|
||||
/**
|
||||
* 信号强度
|
||||
*/
|
||||
private int netState;
|
||||
private String place;
|
||||
private String cityCode;
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(long startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public long getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(long endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public long getBurning() {
|
||||
return burning;
|
||||
}
|
||||
|
||||
public void setBurning(long burning) {
|
||||
this.burning = burning;
|
||||
}
|
||||
|
||||
public int getNetState() {
|
||||
return netState;
|
||||
}
|
||||
|
||||
public void setNetState(int netState) {
|
||||
this.netState = netState;
|
||||
}
|
||||
|
||||
public String getPlace() {
|
||||
return place;
|
||||
}
|
||||
|
||||
public void setPlace(String place) {
|
||||
this.place = place;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DelayCheckUploadRequest{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", startTime=" + startTime +
|
||||
", endTime=" + endTime +
|
||||
", burning=" + burning +
|
||||
", netState=" + netState +
|
||||
", place='" + place + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.mogo.module.main.delaycheck;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* 延时验证工具类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class DelayCheckUtil implements Handler.Callback {
|
||||
private static final String TAG = "DelayCheckUtil";
|
||||
private final Handler handler = new Handler(this);
|
||||
|
||||
private static final int MSG_CHECK_NET_CONNECT_STATUS = 1001;
|
||||
/**
|
||||
* 首次延时检测时间间隔,暂定10分钟,等待机器稳定后再做打算
|
||||
*/
|
||||
private static final long FIRST_CHECK_NET_CONNECT_STATUS_DELAY = 10 * 60 * 1000;
|
||||
private static final long CHECK_NET_CONNECT_STATUS_DELAY = 5000L;
|
||||
|
||||
private static final int MSG_START_DELAY_CHECK = 1002;
|
||||
/**
|
||||
* 默认检测时间间隔,若服务端正确返回,以服务端返回为主
|
||||
*/
|
||||
private static final long DELAY_CHECK_DELAY = 10 * 60 * 1000;
|
||||
|
||||
private final Context context;
|
||||
|
||||
public DelayCheckUtil(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每5s检查一下网络状态,网络状态为连接状态时,开始空接口请求以及后续的参数上报
|
||||
*/
|
||||
public void waitingForCheck() {
|
||||
Logger.d(TAG, "waitingForCheck===");
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, FIRST_CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
private long requestTime, netDelay, requestStartSystemTime,requestEndSystem;
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case MSG_CHECK_NET_CONNECT_STATUS:
|
||||
if (NetworkUtils.isConnected(context)) {
|
||||
handler.sendEmptyMessage(MSG_START_DELAY_CHECK);
|
||||
} else {
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
return true;
|
||||
case MSG_START_DELAY_CHECK:
|
||||
// 请求空接口
|
||||
startEmptyRequest();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void startEmptyRequest() {
|
||||
Logger.d(TAG, "start empty request");
|
||||
requestTime = SystemClock.elapsedRealtime();
|
||||
requestStartSystemTime = System.currentTimeMillis();
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(DelayCheckApiServices.class, DelayCheckHttpConstant.getBaseUrl())
|
||||
.emptyInterface().subscribeOn(Schedulers.io()).observeOn(Schedulers.io())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
requestEndSystem = System.currentTimeMillis();
|
||||
netDelay = SystemClock.elapsedRealtime() - requestTime;
|
||||
startUpload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void startUpload() {
|
||||
Logger.d(TAG, "start upload");
|
||||
MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
|
||||
if (lastLocation == null) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY);
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "lastLocation: " + lastLocation);
|
||||
DelayCheckUploadRequest request = new DelayCheckUploadRequest();
|
||||
request.setSn(Utils.getSn());
|
||||
request.setStartTime(requestStartSystemTime);
|
||||
request.setEndTime(requestEndSystem);
|
||||
request.setNetState(NetworkUtils.netStrengthLevel);
|
||||
request.setPlace(lastLocation.getAddress());
|
||||
request.setCityCode(lastLocation.getCityCode());
|
||||
request.setLat(lastLocation.getLatitude());
|
||||
request.setLon(lastLocation.getLongitude());
|
||||
request.setBurning(netDelay);
|
||||
|
||||
RequestBody params = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(request));
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(DelayCheckApiServices.class, DelayCheckHttpConstant.getBaseUrl())
|
||||
.uploadDelayCheckData(params).observeOn(Schedulers.io()).subscribeOn(Schedulers.io())
|
||||
.subscribe(new SubscribeImpl<DelayCheckResponse>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(DelayCheckResponse o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "上报时延成功 " + o);
|
||||
DelayCheckResult result = o.getResult();
|
||||
if(result.isNecessary()) {
|
||||
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, result.getBeatSeconds() * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,10 @@ import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.utils.MogoHttpDnsUtil;
|
||||
import com.mogo.module.main.EventDispatchCenter;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.delaycheck.DelayCheckUtil;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -48,6 +50,11 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
initGpsSimulatorListener();
|
||||
}, 2_000L
|
||||
);
|
||||
// 开启延时检测
|
||||
DelayCheckUtil delayCheckUtil = new DelayCheckUtil(this);
|
||||
delayCheckUtil.waitingForCheck();
|
||||
|
||||
MogoHttpDnsUtil.getInstance().init(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -104,5 +111,6 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
mLocationClient = null;
|
||||
}
|
||||
mServiceApis = null;
|
||||
MogoHttpDnsUtil.getInstance().release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,165 +1,174 @@
|
||||
package com.mogo.module.media.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.BlurMaskFilter;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.EmbossMaskFilter;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Align;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.SweepGradient;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.module.media.R;
|
||||
|
||||
/**
|
||||
* 环形进度条
|
||||
*/
|
||||
public class PercentageRingView extends View {
|
||||
private Paint mCirclePaint;
|
||||
private Paint mTextPaint;
|
||||
private Paint mArcPaint;
|
||||
private int mCircleX;
|
||||
private int mCircleY;
|
||||
private float mCurrentAngle;
|
||||
private RectF mArcRectF;
|
||||
private float mStartSweepValue;
|
||||
private float mTargetPercent;
|
||||
private float mCurrentPercent;
|
||||
|
||||
private int mRadius;
|
||||
private int mCircleBackground;
|
||||
private int mRingColor;
|
||||
private int mTextSize;
|
||||
private int mTextColor;
|
||||
private Paint pathPaint;
|
||||
private Paint fillArcPaint;
|
||||
// 设置光源的方向
|
||||
private float[] direction = new float[]{1, 1, 1};
|
||||
/**
|
||||
* 透明
|
||||
*/
|
||||
public static final int TRANSPARENT = 0x00000000;
|
||||
|
||||
/**
|
||||
* 红色
|
||||
*/
|
||||
public static final int RED = 0xffff0000;
|
||||
|
||||
// 设置环境光亮度
|
||||
private float light = 0.4f;
|
||||
//渐变数组
|
||||
private int[] arcColors = new int[]{RED, TRANSPARENT};
|
||||
|
||||
// 选择要应用的反射等级
|
||||
private float specular = 6;
|
||||
private EmbossMaskFilter emboss;
|
||||
private RectF oval;
|
||||
private BlurMaskFilter mBlur;
|
||||
// view重绘的标记
|
||||
private boolean reset = false;
|
||||
// 向 mask应用一定级别的模糊
|
||||
private float blur = 3.5f;
|
||||
private int arcradus = 30;
|
||||
//初始化进度
|
||||
private int progress = 0;
|
||||
//设置进度最大值
|
||||
private int max = 100;
|
||||
|
||||
public PercentageRingView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public PercentageRingView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
//自定义属性 values/attr
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PercentageRing);
|
||||
//中间圆的背景颜色 默认为浅紫色
|
||||
mCircleBackground = typedArray.getColor(R.styleable.PercentageRing_circleBackground, 0xffafb4db);
|
||||
//外圆环的颜色 默认为深紫色
|
||||
mRingColor = typedArray.getColor(R.styleable.PercentageRing_ringColor, 0xff6950a1);
|
||||
//中间圆的半径 默认为60
|
||||
mRadius = typedArray.getInt(R.styleable.PercentageRing_radius, 60);
|
||||
//字体颜色 默认为白色
|
||||
mTextColor = typedArray.getColor(R.styleable.PercentageRing_textColor, 0xffffffff);
|
||||
//最后一定要调用这个 释放掉TypedArray
|
||||
typedArray.recycle();
|
||||
//初始化数据
|
||||
init(context);
|
||||
initPaint();
|
||||
oval = new RectF();
|
||||
emboss = new EmbossMaskFilter(direction, light, specular, blur);
|
||||
mBlur = new BlurMaskFilter(20, BlurMaskFilter.Blur.NORMAL);
|
||||
}
|
||||
|
||||
public PercentageRingView(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
//初始化画笔操作
|
||||
private void initPaint() {
|
||||
//初始化画笔操作
|
||||
pathPaint = new Paint();
|
||||
// 设置是否抗锯齿
|
||||
pathPaint.setAntiAlias(true);
|
||||
// 帮助消除锯齿
|
||||
pathPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
// 设置中空的样式
|
||||
pathPaint.setStyle(Paint.Style.STROKE);
|
||||
pathPaint.setDither(true);
|
||||
pathPaint.setStrokeJoin(Paint.Join.ROUND);
|
||||
|
||||
fillArcPaint = new Paint();
|
||||
// 设置是否抗锯齿
|
||||
fillArcPaint.setAntiAlias(true);
|
||||
// 帮助消除锯齿
|
||||
fillArcPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
|
||||
// 设置中空的样式
|
||||
fillArcPaint.setStyle(Paint.Style.STROKE);
|
||||
fillArcPaint.setDither(true);
|
||||
fillArcPaint.setStrokeJoin(Paint.Join.ROUND);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
//圆环开始角度 -90° 正北方向
|
||||
mStartSweepValue = -90;
|
||||
//当前角度
|
||||
mCurrentAngle = 0;
|
||||
//当前百分比
|
||||
mCurrentPercent = 0;
|
||||
//设置中心园的画笔
|
||||
mCirclePaint = new Paint();
|
||||
mCirclePaint.setAntiAlias(true);
|
||||
mCirclePaint.setColor(mCircleBackground);
|
||||
mCirclePaint.setStyle(Paint.Style.FILL);
|
||||
//设置文字的画笔
|
||||
mTextPaint = new Paint();
|
||||
mTextPaint.setColor(mTextColor);
|
||||
mTextPaint.setAntiAlias(true);
|
||||
mTextPaint.setStyle(Paint.Style.FILL);
|
||||
mTextPaint.setStrokeWidth((float) (0.025 * mRadius));
|
||||
mTextPaint.setTextSize(mRadius / 2);
|
||||
mTextPaint.setTextAlign(Align.CENTER);
|
||||
//设置外圆环的画笔
|
||||
mArcPaint = new Paint();
|
||||
mArcPaint.setAntiAlias(true);
|
||||
mArcPaint.setColor(mRingColor);
|
||||
mArcPaint.setStyle(Paint.Style.STROKE);
|
||||
// mArcPaint.setStrokeWidth((float) (0.075 * mRadius));
|
||||
mArcPaint.setStrokeWidth((float) (0.17 * mRadius));
|
||||
//获得文字的字号 因为要设置文字在圆的中心位置
|
||||
mTextSize = (int) mTextPaint.getTextSize();
|
||||
}
|
||||
|
||||
//主要是测量wrap_content时候的宽和高,因为宽高一样,只需要测量一次宽即可,高等于宽
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
setMeasuredDimension(measure(widthMeasureSpec), measure(widthMeasureSpec));
|
||||
//设置圆心坐标
|
||||
mCircleX = getMeasuredWidth() / 2;
|
||||
mCircleY = getMeasuredHeight() / 2;
|
||||
//如果半径大于圆心横坐标,需要手动缩小半径的值,否则就画到外面去了
|
||||
if (mRadius > mCircleX) {
|
||||
//设置半径大小为圆心横坐标到原点的距离
|
||||
mRadius = mCircleX;
|
||||
mRadius = (int) (mCircleX - 0.075 * mRadius);
|
||||
//因为半径改变了,所以要重新设置一下字体宽度
|
||||
mTextPaint.setStrokeWidth((float) (0.025 * mRadius));
|
||||
//重新设置字号
|
||||
mTextPaint.setTextSize(mRadius / 2);
|
||||
//重新设置外圆环宽度
|
||||
// mArcPaint.setStrokeWidth((float) (0.075 * mRadius));
|
||||
mArcPaint.setStrokeWidth((float) (0.17 * mRadius));
|
||||
//重新获得字号大小
|
||||
mTextSize = (int) mTextPaint.getTextSize();
|
||||
}
|
||||
//画中心园的外接矩形,用来画圆环用
|
||||
mArcRectF = new RectF(mCircleX - mRadius, mCircleY - mRadius, mCircleX + mRadius, mCircleY + mRadius);
|
||||
}
|
||||
|
||||
//当wrap_content的时候,view的大小根据半径大小改变,但最大不会超过屏幕
|
||||
private int measure(int measureSpec) {
|
||||
int result = 0;
|
||||
int specMode = MeasureSpec.getMode(measureSpec);
|
||||
int specSize = MeasureSpec.getSize(measureSpec);
|
||||
if (specMode == MeasureSpec.EXACTLY) {
|
||||
result = specSize;
|
||||
} else {
|
||||
result = (int) (1.075 * mRadius * 2);
|
||||
if (specMode == MeasureSpec.AT_MOST) {
|
||||
result = Math.min(result, specSize);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
//开始画中间圆、文字和外圆环
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
//画中间圆
|
||||
canvas.drawCircle(mCircleX, mCircleY, mRadius, mCirclePaint);
|
||||
//画圆环
|
||||
canvas.drawArc(mArcRectF, mStartSweepValue, mCurrentAngle, false, mArcPaint);
|
||||
//画文字
|
||||
canvas.drawText(String.valueOf(mCurrentPercent) + "%", mCircleX, mCircleY + mTextSize / 4, mTextPaint);
|
||||
//判断当前百分比是否小于设置目标的百分比
|
||||
if (mCurrentPercent < mTargetPercent) {
|
||||
//当前百分比+1
|
||||
mCurrentPercent += 1;
|
||||
//当前角度+360
|
||||
mCurrentAngle += 3.6;
|
||||
//每10ms重画一次
|
||||
postInvalidateDelayed(10);
|
||||
if (reset) {
|
||||
canvas.drawColor(Color.TRANSPARENT);
|
||||
reset = false;
|
||||
}
|
||||
drawcircle(canvas);
|
||||
|
||||
}
|
||||
|
||||
//设置目标的百分比
|
||||
public void setTargetPercent(int percent) {
|
||||
this.mTargetPercent = percent;
|
||||
private void drawcircle(Canvas canvas) {
|
||||
int height = getMeasuredWidth();
|
||||
int width = getMeasuredWidth();
|
||||
//半径 = 宽/2-圆环的宽度
|
||||
int radius = width / 2 - arcradus;
|
||||
int cx = width / 2;
|
||||
int cy = height / 2;
|
||||
pathPaint.setColor(Color.BLUE);
|
||||
//绘制大圆
|
||||
canvas.drawCircle(width / 2, height / 2, radius + arcradus
|
||||
/ 2 + 0.5f, pathPaint);
|
||||
//绘制小圆
|
||||
canvas.drawCircle(width / 2, height / 2, radius - arcradus
|
||||
/ 2 - 0.5f, pathPaint);
|
||||
|
||||
// 环形颜色填充
|
||||
SweepGradient sweepGradient =
|
||||
new SweepGradient(width / 2, height / 2, arcColors, null);
|
||||
fillArcPaint.setShader(sweepGradient);
|
||||
// 设置画笔为白色
|
||||
|
||||
// 模糊效果
|
||||
fillArcPaint.setMaskFilter(mBlur);
|
||||
// 设置线的类型,边是圆的
|
||||
fillArcPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||
|
||||
//设置圆弧的宽度
|
||||
fillArcPaint.setStrokeWidth(arcradus + 1);
|
||||
// 确定圆弧的绘制位置,也就是里面圆弧坐标和外面圆弧坐标
|
||||
oval.set(width / 2 - radius, height / 2 - radius, width
|
||||
/ 2 + radius, height / 2 + radius);
|
||||
// 画圆弧,第二个参数为:起始角度,第三个为跨的角度,第四个为true的时候是实心,false的时候为空心
|
||||
canvas.drawArc(oval,
|
||||
0,
|
||||
((float) progress / max) * 360,
|
||||
false,
|
||||
fillArcPaint);
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(int progress) {
|
||||
this.progress = progress;
|
||||
this.invalidate();
|
||||
}
|
||||
|
||||
public int getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(int max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public int[] getArcColors() {
|
||||
return arcColors;
|
||||
}
|
||||
|
||||
public void setArcColors(int[] arcColors) {
|
||||
this.arcColors = arcColors;
|
||||
// this.invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:重置进度
|
||||
*
|
||||
* @throws
|
||||
*/
|
||||
public void reset() {
|
||||
reset = true;
|
||||
this.progress = 0;
|
||||
this.invalidate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.media.window;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -68,6 +69,7 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
|
||||
private ICallProviderResponse mCallProviderResponse;
|
||||
private CircleNumberProgress mPercentageRingView;
|
||||
// private PercentageRingView mPercentageRingView;
|
||||
private ImageView mPauseImage;
|
||||
private AnimCircleImageView mAnimCircleImageView;
|
||||
|
||||
@@ -149,6 +151,15 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
mAnimCircleImageView = mWindowView.findViewById(R.id.window_circle_img_new);
|
||||
mPauseImage = mWindowView.findViewById(R.id.window_play_pause_new);
|
||||
|
||||
// int[] arcColors = new int[]{
|
||||
// Color.parseColor("#1Affffff"),
|
||||
// Color.parseColor("#80ffffff"),
|
||||
// Color.parseColor("#BFffffff"),
|
||||
// Color.parseColor("#ffffff")
|
||||
// };
|
||||
//
|
||||
// mPercentageRingView.setArcColors(arcColors);
|
||||
|
||||
if (mPauseImage != null) {
|
||||
mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause_new);
|
||||
}
|
||||
@@ -366,7 +377,6 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
@Override
|
||||
public void onMusicPlaying() {
|
||||
Logger.d(TAG, "onMusicPlaying===" + mMediaInfoData);
|
||||
Log.d(TAG, "onMusicPlaying===" + mMediaInfoData);
|
||||
isFirstPlay = false;
|
||||
updateWindowUI(false);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
@@ -393,7 +403,6 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
@Override
|
||||
public void onMusicPause() {
|
||||
Logger.d(TAG, "onMusicPause: ===" + mMediaInfoData);
|
||||
Log.d(TAG, "onMusicPause: ===" + mMediaInfoData);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (mPauseImage != null) {
|
||||
mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause_new);
|
||||
@@ -418,7 +427,6 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
@Override
|
||||
public void onMusicStopped() {
|
||||
Logger.d(TAG, "onMusicStopped===" + mMediaInfoData);
|
||||
Log.d(TAG, "onMusicStopped===" + mMediaInfoData);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (mPauseImage != null) {
|
||||
mPauseImage.setImageResource(R.drawable.module_media_window_pop_pause_new);
|
||||
@@ -443,7 +451,6 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
@Override
|
||||
public void onMediaInfoChanged(MediaInfoData mediaInfoData) {
|
||||
Logger.d(TAG, "onMediaInfoChanged: " + mediaInfoData);
|
||||
Log.d(TAG, "onMediaInfoChanged:" + mediaInfoData);
|
||||
mMediaInfoData = mediaInfoData;
|
||||
addWindowView();
|
||||
updateWindowUI();
|
||||
@@ -458,7 +465,6 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
(int) ((current * 1.0f * 100) / (total * 1.0f));
|
||||
if (mPercentageRingView != null) {
|
||||
mPercentageRingView.setVisibility(View.VISIBLE);
|
||||
Log.d(TAG, "progress vr = " + progress);
|
||||
mPercentageRingView.setProgress(progress);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -477,7 +483,6 @@ public class MediaWindow2 implements IMusicView , IMogoStatusChangedListener {
|
||||
int progress =
|
||||
(int) ((current * 1.0f * 100) / (total * 1.0f));
|
||||
if (mWindowProgress != null) {
|
||||
// Log.d(TAG, "progress = " + progress);
|
||||
mWindowProgress.setProgress(progress);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -23,10 +23,7 @@
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- app:circleBackground="@color/modules_media_music_bg_color"-->
|
||||
<!-- app:radius="100"-->
|
||||
<!-- app:ringColor="@color/modules_media_music_circle_color" />-->
|
||||
<!-- android:layout_height="match_parent" />-->
|
||||
|
||||
<com.mogo.module.media.widget.AnimCircleImageView
|
||||
android:id="@+id/window_circle_img_new"
|
||||
|
||||
@@ -4,9 +4,9 @@ import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.amap.api.maps.UiSettings;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.amap.api.navi.AMapNaviViewOptions;
|
||||
import com.mogo.module.common.view.RoundLayout;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.small.map.animation.DirectionRotateAnimation;
|
||||
import com.mogo.utils.FileUtils;
|
||||
|
||||
@@ -30,11 +30,11 @@ import java.io.IOException;
|
||||
* @author donghongyu
|
||||
* @date 12/14/20 4:40 PM
|
||||
*/
|
||||
public class SmallMapDirectionView extends RoundLayout {
|
||||
public class SmallMapDirectionView extends RelativeLayout {
|
||||
private String styleFilePath = "/mnt/sdcard/amap/small_map_style.data";
|
||||
|
||||
private ImageView mIvMapBorder;
|
||||
private AMapNaviView mAMapNaviView;
|
||||
|
||||
private DirectionRotateAnimation mRotateAnimation;
|
||||
private int lastAngle = 0;
|
||||
|
||||
@@ -48,15 +48,17 @@ public class SmallMapDirectionView extends RoundLayout {
|
||||
|
||||
public SmallMapDirectionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
try {
|
||||
initView(context);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
String styleFilePath = "/mnt/sdcard/amap/small_map_style.data";
|
||||
|
||||
mRotateAnimation = new DirectionRotateAnimation(context, null);
|
||||
|
||||
LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
AbsMogoApplication.getLayoutInflaterNoSkin().inflate(R.layout.module_small_map_view, this);
|
||||
mIvMapBorder = findViewById(R.id.ivMapBorder);
|
||||
mAMapNaviView = findViewById(R.id.aMapNaviView);
|
||||
mAMapNaviView.onCreate(null);
|
||||
|
||||
@@ -72,8 +72,12 @@ public class SmallMapService extends Service {
|
||||
*/
|
||||
private void addSmallMapView() {
|
||||
Logger.d(TAG, "addSmallMapView");
|
||||
|
||||
// 初始化小地图控件
|
||||
mSmallMapDirectionView = new SmallMapDirectionView(getApplicationContext());
|
||||
|
||||
mWindowManagerView = new WindowManagerView.Builder(getApplicationContext())
|
||||
.contentView(R.layout.module_small_map_direction_view)
|
||||
.contentView(mSmallMapDirectionView)
|
||||
.size(
|
||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.WRAP_CONTENT
|
||||
@@ -85,7 +89,6 @@ public class SmallMapService extends Service {
|
||||
.gravity(Gravity.TOP | Gravity.LEFT)
|
||||
.showInWindowManager();
|
||||
mWindowManagerView.show();
|
||||
mSmallMapDirectionView = mWindowManagerView.findViewById(R.id.smallMapDirectionView);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mogo.module.small.map;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/10/20 1:35 PM
|
||||
*/
|
||||
public class SmallMapViewHandler {
|
||||
}
|
||||
@@ -112,10 +112,13 @@ public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusCh
|
||||
}
|
||||
}
|
||||
if (descriptor == StatusDescriptor.MAIN_PAGE_RESUME) {
|
||||
if (isTrue) {
|
||||
showPanel();
|
||||
} else {
|
||||
hidePanel();
|
||||
// 只有 VR 模式下才进行展示
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (isTrue) {
|
||||
showPanel();
|
||||
} else {
|
||||
hidePanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/module_small_map_border_view_width"
|
||||
android:layout_height="@dimen/module_small_map_border_view_width"
|
||||
tools:parentTag="RelativeLayout"
|
||||
app:roundLayoutRadius="360dp">
|
||||
|
||||
|
||||
@@ -33,4 +35,4 @@
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/module_small_map_view_border" />
|
||||
|
||||
</RelativeLayout>
|
||||
</merge>
|
||||
@@ -2,7 +2,6 @@ package com.mogo.module.v2x.alarm;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearchListener;
|
||||
@@ -253,6 +252,10 @@ public class V2XAlarmServer {
|
||||
//Logger.i(MODULE_NAME, "根据经纬度查询结果为:" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
|
||||
String keyword = "停车场";
|
||||
boolean isHighWay = false;
|
||||
if (regeocodeResult == null || regeocodeResult.getRegeocodeAddress() == null ||
|
||||
regeocodeResult.getRegeocodeAddress().getFormatAddress() == null) {
|
||||
return;
|
||||
}
|
||||
// 如果当前位置是高速则推荐服务区
|
||||
if (regeocodeResult.getRegeocodeAddress().getFormatAddress().contains("高速")) {
|
||||
keyword = "停车场|服务区";
|
||||
|
||||
@@ -269,7 +269,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
mAlarmInfoMarker.setInfoWindowAdapter(new RoadConditionInfoWindow3DAdapter(markerShowEntity, AbsMogoApplication.getApp(), mAlarmInfoMarker.getMogoMarkerOptions()));
|
||||
mAlarmInfoMarker.showInfoWindow();
|
||||
} else{
|
||||
optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));
|
||||
// optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));
|
||||
mAlarmInfoMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
|
||||
}
|
||||
// 当前Marker设置为最上面
|
||||
|
||||
@@ -47,9 +47,11 @@ public class MoGoV2XPolylineManager implements IMoGoV2XPolylineManager {
|
||||
case V2XPoiTypeEnum.ALERT_TRAFFIC_LIGHT_WARNING:
|
||||
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
case V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING + "":
|
||||
colors.add(0xFFFFA31A);
|
||||
colors.add(0xFFFFA31A);
|
||||
break;
|
||||
default:
|
||||
colors.add(0xFFE32F46);
|
||||
colors.add(0xFFE32F46);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,14 @@ public class RoundLayout extends RelativeLayout implements IMogoSkinCompatSuppor
|
||||
super.draw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundResource(int resId) {
|
||||
super.setBackgroundResource(resId);
|
||||
if (mBackgroundTintHelper != null) {
|
||||
mBackgroundTintHelper.onSetBackgroundResource(resId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySkin() {
|
||||
if (mBackgroundTintHelper != null) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget
|
||||
import com.mogo.module.v2x.R
|
||||
import com.mogo.module.v2x.V2XServiceManager
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
@@ -45,6 +46,9 @@ class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
if (V2XServiceManager.getMoGoStatusManager().isVrMode) {
|
||||
return R.layout.v2x_road_video_plyer_layout_vr
|
||||
}
|
||||
return R.layout.v2x_road_video_plyer_layout
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="135" android:endColor="#141C35" android:startColor="#344687" />
|
||||
<corners android:radius="@dimen/dp_20" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -119,8 +119,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventLive"
|
||||
android:layout_width="@dimen/module_v2x_event_button_size_detail_vr"
|
||||
android:layout_height="@dimen/module_v2x_event_button_size_detail_vr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:src="@drawable/selector_live_btn_vr"
|
||||
@@ -156,10 +156,10 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivEventCallChart"
|
||||
android:layout_width="@dimen/module_v2x_event_button_size_detail_vr"
|
||||
android:layout_height="@dimen/module_v2x_event_button_size_detail_vr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:src="@drawable/selector_talk_btn"
|
||||
android:src="@drawable/selector_talk_btn_vr"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivEventLive"
|
||||
app:layout_constraintStart_toEndOf="@id/ivEventReportErr"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:roundLayoutRadius="@dimen/dp_30" />
|
||||
app:roundLayoutRadius="@dimen/dp_20" />
|
||||
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/ivReportHead"
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/item_video_cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_394">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/surface_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/thumb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thumbImage"
|
||||
android:layout_width="@dimen/dp_110"
|
||||
android:layout_height="@dimen/dp_110"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!--局部播放器-->
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/dp_260"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@null"
|
||||
android:max="100"
|
||||
android:maxHeight="@dimen/dp_6"
|
||||
android:minHeight="@dimen/dp_6"
|
||||
android:thumb="@null"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fullscreen"
|
||||
android:layout_width="60px"
|
||||
android:layout_height="60px"
|
||||
android:scaleType="centerInside" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/start"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!--GSYVideoControlView mLoadingProgressBar-->
|
||||
//加载中圈圈
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="@dimen/dp_56"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:indeterminateTint="#256BFF"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -6,12 +6,12 @@
|
||||
android:layout_height="@dimen/dp_394"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_margin="@dimen/dp_3"
|
||||
android:background="@drawable/v2x_alert_window_bg">
|
||||
android:background="@drawable/v2x_bg_video_tip_vr">
|
||||
|
||||
<com.mogo.module.v2x.view.RoundLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:roundLayoutRadius="@dimen/dp_26">
|
||||
app:roundLayoutRadius="@dimen/dp_20">
|
||||
|
||||
<com.mogo.module.v2x.view.SimpleCoverVideoPlayer
|
||||
android:id="@+id/roadVideoView"
|
||||
@@ -47,7 +47,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:src="@drawable/module_common_close_selector" />
|
||||
android:src="@drawable/module_common_close_selector_vr" />
|
||||
</com.mogo.module.v2x.view.RoundLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
Reference in New Issue
Block a user