[工控机监控] 清扫车后摄像头预览优化
This commit is contained in:
@@ -27,6 +27,7 @@ import com.mogo.support.obu.model.advance.VehControl;
|
||||
import com.mogo.support.obu.model.advance.VehSize;
|
||||
import com.mogo.support.obu.model.advance.VerticalLLV;
|
||||
import com.mogo.support.obu.model.advance.WarningData;
|
||||
import com.mogo.support.obu.model.result.BaseResult;
|
||||
import com.zhidao.support.adas.high.common.ThreadPoolManager;
|
||||
import com.zhidao.support.obu.ObuManager;
|
||||
import com.zhidao.support.obu.OnObuListener;
|
||||
@@ -294,6 +295,11 @@ public class ObuTest {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onObuCallResult(BaseResult result) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onObuSystemStatus(MogoObuSystemStatusData data) {
|
||||
|
||||
|
||||
@@ -39,9 +39,17 @@ public class BackCameraFloatWindow implements View.OnTouchListener {
|
||||
private float mInScreenX;
|
||||
private float mInScreenY;
|
||||
private ImageView image_view;
|
||||
private final boolean isFullScreen;
|
||||
private final OnBackCameraFloatWindowListener onBackCameraFloatWindowListener;
|
||||
|
||||
public BackCameraFloatWindow(Activity context) {
|
||||
public interface OnBackCameraFloatWindowListener {
|
||||
void onClose();
|
||||
}
|
||||
|
||||
public BackCameraFloatWindow(Activity context, boolean isFullScreen, OnBackCameraFloatWindowListener onBackCameraFloatWindowListener) {
|
||||
this.mContext = context;
|
||||
this.isFullScreen = isFullScreen;
|
||||
this.onBackCameraFloatWindowListener = onBackCameraFloatWindowListener;
|
||||
initHandler();
|
||||
initFloatWindow();
|
||||
}
|
||||
@@ -53,6 +61,15 @@ public class BackCameraFloatWindow implements View.OnTouchListener {
|
||||
return;
|
||||
mFloatLayout = (View) inflater.inflate(R.layout.layout_back_camera, null);
|
||||
image_view = mFloatLayout.findViewById(R.id.image_view);
|
||||
ImageView btn_close = mFloatLayout.findViewById(R.id.btn_close);
|
||||
btn_close.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onBackCameraFloatWindowListener != null) {
|
||||
onBackCameraFloatWindowListener.onClose();
|
||||
}
|
||||
}
|
||||
});
|
||||
mFloatLayout.setOnTouchListener(this);
|
||||
mWindowParams = new WindowManager.LayoutParams();
|
||||
// mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
|
||||
@@ -67,10 +84,13 @@ public class BackCameraFloatWindow implements View.OnTouchListener {
|
||||
mWindowParams.format = PixelFormat.RGBA_8888;
|
||||
mWindowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
|
||||
mWindowParams.gravity = Gravity.START | Gravity.TOP;
|
||||
// mWindowParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
// mWindowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
mWindowParams.width = 1280;
|
||||
mWindowParams.height = 720;
|
||||
if (isFullScreen) {
|
||||
mWindowParams.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
mWindowParams.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
} else {
|
||||
mWindowParams.width = 1280;
|
||||
mWindowParams.height = 720;
|
||||
}
|
||||
// mWindowParams.alpha = 0.9F;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,19 +99,20 @@ public class InfoFragment extends BaseFragment {
|
||||
}
|
||||
tvTitle.setGravity(Gravity.CENTER);
|
||||
if (Constants.TITLE.RECEIVE_BACK_CAMERA_VIDEO.equals(title)) {
|
||||
Button button_full_screen = view.findViewById(R.id.btn_render_full_screen);
|
||||
Button button = view.findViewById(R.id.btn_render);
|
||||
button.setVisibility(View.VISIBLE);
|
||||
button_full_screen.setVisibility(View.VISIBLE);
|
||||
button_full_screen.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showBackCameraFloatWindow(button_full_screen, true);
|
||||
}
|
||||
});
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (backCameraFloatWindow == null) {
|
||||
backCameraFloatWindow = new BackCameraFloatWindow(getActivity());
|
||||
final int[] location = new int[2];
|
||||
button.getLocationOnScreen(location);
|
||||
backCameraFloatWindow.showFloatWindow(location[1]);
|
||||
} else {
|
||||
hideFloatWindow();
|
||||
}
|
||||
showBackCameraFloatWindow(button, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -154,6 +155,25 @@ public class InfoFragment extends BaseFragment {
|
||||
rvInfo.setAdapter(adapter);
|
||||
}
|
||||
|
||||
private void showBackCameraFloatWindow(View v, boolean isFullScreen) {
|
||||
if (isFullScreen) {
|
||||
hideFloatWindow();
|
||||
}
|
||||
if (backCameraFloatWindow == null) {
|
||||
backCameraFloatWindow = new BackCameraFloatWindow(getActivity(), isFullScreen, new BackCameraFloatWindow.OnBackCameraFloatWindowListener() {
|
||||
@Override
|
||||
public void onClose() {
|
||||
hideFloatWindow();
|
||||
}
|
||||
});
|
||||
final int[] location = new int[2];
|
||||
v.getLocationOnScreen(location);
|
||||
backCameraFloatWindow.showFloatWindow(location[1]);
|
||||
} else {
|
||||
hideFloatWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private void setData() {
|
||||
if (Constants.TITLE.RECEIVE_GNSS_INFO.equals(title)) {
|
||||
adapter.setData(DataDistribution.getInstance().listGnssInfo);
|
||||
@@ -241,9 +261,11 @@ public class InfoFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public void onBackCameraVideo(byte[] data) {
|
||||
public boolean onBackCameraVideo(byte[] data) {
|
||||
if (backCameraFloatWindow != null) {
|
||||
backCameraFloatWindow.onBackCameraVideo(data);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1114,12 +1114,15 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
|
||||
@Override
|
||||
public void onBackCameraVideo(@NotNull MessagePad.Header header, @NotNull byte[] data) {
|
||||
boolean isAddLog = true;
|
||||
if (fromFragment instanceof InfoFragment) {
|
||||
InfoFragment fragment = (InfoFragment) fromFragment;
|
||||
fragment.onBackCameraVideo(data);
|
||||
isAddLog = !fragment.onBackCameraVideo(data);
|
||||
}
|
||||
if (isAddLog) {
|
||||
ReceiveBytesData base = new ReceiveBytesData(header, data, sdf);
|
||||
DataDistribution.getInstance().addData(base);
|
||||
}
|
||||
ReceiveBytesData base = new ReceiveBytesData(header, data, sdf);
|
||||
DataDistribution.getInstance().addData(base);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
9
app_ipc_monitoring/src/main/res/drawable/ic_close.xml
Normal file
9
app_ipc_monitoring/src/main/res/drawable/ic_close.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M960,512c0,-249.6 -198.4,-448 -448,-448S64,262.4 64,512s198.4,448 448,448 448,-198.4 448,-448zM691.2,736L512,556.8 332.8,736c-12.8,12.8 -32,12.8 -44.8,0 -12.8,-12.8 -12.8,-32 0,-44.8L467.2,512 288,332.8c-12.8,-12.8 -12.8,-32 0,-44.8 12.8,-12.8 32,-12.8 44.8,0L512,467.2 691.2,288c12.8,-12.8 32,-12.8 44.8,0 12.8,12.8 12.8,32 0,44.8L556.8,512 736,691.2c12.8,12.8 12.8,32 0,44.8 -12.8,12.8 -32,12.8 -44.8,0z"
|
||||
android:fillColor="#AFFFFFFF"/>
|
||||
</vector>
|
||||
@@ -24,15 +24,28 @@
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btn_render"
|
||||
android:id="@+id/btn_render_full_screen"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="渲染(全屏)"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btn_render"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_toStartOf="@id/btn_render_full_screen"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="渲染"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#000" />
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorBlue2">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_close"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_close" />
|
||||
</FrameLayout>
|
||||
|
||||
Reference in New Issue
Block a user