Merge remote-tracking branch 'origin/dev_merge_shunyi_vr_map' into dev_merge_shunyi_vr_map
This commit is contained in:
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>
|
||||
@@ -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;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
protected void beforeSetContentView( Bundle savedInstanceState ) {
|
||||
init();
|
||||
installSkinManager( savedInstanceState );
|
||||
//installSkinManager( savedInstanceState );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.small.map">
|
||||
|
||||
<application>
|
||||
<service
|
||||
android:name=".SmallMapService"
|
||||
android:exported="false"
|
||||
android:process=":smallMap"/>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -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);
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
package com.mogo.module.small.map;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.view.Gravity;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.common.entity.MogoSnapshotSetData;
|
||||
import com.mogo.module.common.machinevision.IMachineVisionInterface;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/10/20 1:35 PM
|
||||
*/
|
||||
public class SmallMapService extends Service {
|
||||
private static final String TAG = "MachineVisionMapService";
|
||||
private IBinder mBinder;
|
||||
|
||||
private WindowManagerView mWindowManagerView;
|
||||
private SmallMapDirectionView mSmallMapDirectionView;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Logger.d(TAG, "onCreate");
|
||||
addSmallMapView();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
Logger.d(TAG, "onBind");
|
||||
mBinder = new SmallMapServiceBinder();
|
||||
return mBinder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRebind(Intent intent) {
|
||||
super.onRebind(intent);
|
||||
addSmallMapView();
|
||||
Logger.d(TAG, "onRebind");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUnbind(Intent intent) {
|
||||
Logger.d(TAG, "onUnbind");
|
||||
if (mWindowManagerView != null && mWindowManagerView.isShowing()) {
|
||||
mWindowManagerView.dismiss();
|
||||
}
|
||||
mWindowManagerView = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Logger.d(TAG, "onDestroy");
|
||||
if (mWindowManagerView != null) {
|
||||
mWindowManagerView.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加小地图View
|
||||
*/
|
||||
private void addSmallMapView() {
|
||||
Logger.d(TAG, "addSmallMapView");
|
||||
mWindowManagerView = new WindowManagerView.Builder(getApplicationContext())
|
||||
.contentView(R.layout.module_small_map_direction_view)
|
||||
.size(
|
||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
.position(
|
||||
getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_x),
|
||||
getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_y)
|
||||
)
|
||||
.gravity(Gravity.TOP | Gravity.LEFT)
|
||||
.showInWindowManager();
|
||||
mWindowManagerView.show();
|
||||
mSmallMapDirectionView = mWindowManagerView.findViewById(R.id.smallMapDirectionView);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小地图与大地图之间进程通讯
|
||||
*/
|
||||
public class SmallMapServiceBinder extends IMachineVisionInterface.Stub {
|
||||
|
||||
@Override
|
||||
public void linkToDeath(@NonNull DeathRecipient recipient, int flags) {
|
||||
super.linkToDeath(recipient, flags);
|
||||
Logger.d(TAG, "linkToDeath");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unlinkToDeath(@NonNull DeathRecipient recipient, int flags) {
|
||||
Logger.d(TAG, "unlinkToDeath");
|
||||
|
||||
return super.unlinkToDeath(recipient, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postData(MogoSnapshotSetData data) throws RemoteException {
|
||||
Logger.d(TAG, "postData");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideViewIfExist() throws RemoteException {
|
||||
Logger.d(TAG, "hideViewIfExist");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showViewIfExist() throws RemoteException {
|
||||
Logger.d(TAG, "showViewIfExist");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mogo.module.small.map;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/10/20 1:35 PM
|
||||
*/
|
||||
public class SmallMapViewHandler {
|
||||
}
|
||||
@@ -1,22 +1,24 @@
|
||||
package com.mogo.module.small.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoSmallMapProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
@@ -26,9 +28,11 @@ import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusChangedListener {
|
||||
private final String TAG = "SmallVisionProvider";
|
||||
|
||||
private Intent mSmallMapServiceIntent;
|
||||
private Context mContext;
|
||||
|
||||
private WindowManagerView mWindowManagerView;
|
||||
private SmallMapDirectionView mSmallMapDirectionView;
|
||||
|
||||
@Override
|
||||
public Fragment createFragment(Context context, Bundle data) {
|
||||
return null;
|
||||
@@ -76,22 +80,22 @@ public class SmallVisionProvider implements IMogoSmallMapProvider, IMogoStatusCh
|
||||
public void onDestroy() {
|
||||
Log.d(TAG, "小地图模块销毁……");
|
||||
hidePanel();
|
||||
// 释放组件内存
|
||||
mSmallMapDirectionView = null;
|
||||
mWindowManagerView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPanel() {
|
||||
Log.d(TAG, "小地图模块触发展示……");
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
mSmallMapServiceIntent = new Intent(mContext, SmallMapService.class);
|
||||
mContext.startService(mSmallMapServiceIntent);
|
||||
}
|
||||
addSmallMapView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hidePanel() {
|
||||
Log.d(TAG, "小地图模块触发隐藏……");
|
||||
if (mSmallMapServiceIntent != null) {
|
||||
AbsMogoApplication.getApp().stopService(mSmallMapServiceIntent);
|
||||
if (mWindowManagerView != null && mWindowManagerView.isShowing()) {
|
||||
mWindowManagerView.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,11 +116,43 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加小地图View
|
||||
*/
|
||||
private void addSmallMapView() {
|
||||
Logger.d(TAG, "addSmallMapView");
|
||||
// 初始化小地图控件
|
||||
if (mSmallMapDirectionView == null) {
|
||||
mSmallMapDirectionView = new SmallMapDirectionView(mContext);
|
||||
}
|
||||
|
||||
if (mWindowManagerView == null) {
|
||||
mWindowManagerView = new WindowManagerView.Builder(mContext)
|
||||
.contentView(mSmallMapDirectionView)
|
||||
.size(
|
||||
WindowManager.LayoutParams.WRAP_CONTENT,
|
||||
WindowManager.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
.position(
|
||||
mContext.getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_x),
|
||||
mContext.getResources().getDimensionPixelOffset(R.dimen.module_small_map_view_y)
|
||||
)
|
||||
.gravity(Gravity.TOP | Gravity.LEFT)
|
||||
.showInWindowManager();
|
||||
}
|
||||
mWindowManagerView.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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