Merge remote-tracking branch 'origin/dev_1.1.9' into dev_1.1.9
This commit is contained in:
@@ -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