[2.13.0][change] 调试程序移除无用引用

This commit is contained in:
xinfengkun
2022-11-29 16:27:05 +08:00
parent 9ff67dc940
commit 4b46a48293
8 changed files with 81 additions and 27 deletions

View File

@@ -86,11 +86,12 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation rootProject.ext.dependencies.gson
implementation project(':libraries:mogo-adas')
implementation project(':libraries:mogo-adas-data')
implementation project(':libraries:mogo-adas-other')
// implementation 'com.zhidao.support.adas:high:2.8.0.0'
// implementation 'com.zhjt.mogo.adas.data:adas-data:2.6.6.0'
compileOnly project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
// compileOnly project(':core:mogo-core-data')
// implementation project(':core:mogo-core-utils')
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.mogo.cloud:telematic:1.3.59'

View File

@@ -1,7 +1,6 @@
package com.zhidao.adas.client.ui;
import android.app.Activity;
import android.content.Context;
import android.graphics.PixelFormat;
import android.util.DisplayMetrics;
import android.view.Gravity;
@@ -12,14 +11,12 @@ import android.view.WindowManager;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.eagle.core.utilcode.util.BarUtils;
import com.zhidao.adas.client.R;
import com.zhidao.adas.client.adapter.ConnectStatusAdapter;
import com.zhidao.adas.client.adapter.DataShowAdapter;
import com.zhidao.adas.client.bean.IPCConnectState;
import com.zhidao.adas.client.utils.MyLinearLayoutManager;
import com.zhidao.adas.client.utils.SysBarUtil;
import java.lang.reflect.Field;
import java.util.List;
/**
@@ -49,8 +46,9 @@ public class FloatWindow implements View.OnTouchListener {
this.list = list;
initFloatWindow();
}
public void refreshView(){
if (adapter!=null){
public void refreshView() {
if (adapter != null) {
adapter.refreshView();
}
}
@@ -109,14 +107,14 @@ public class FloatWindow implements View.OnTouchListener {
mInViewY = motionEvent.getY();
// 获取相对屏幕的坐标,即以屏幕左上角为原点
mDownInScreenX = motionEvent.getRawX();
mDownInScreenY = motionEvent.getRawY() - BarUtils.getStatusBarHeight();
mDownInScreenY = motionEvent.getRawY() - SysBarUtil.getSysBarHeight(mContext);
mInScreenX = motionEvent.getRawX();
mInScreenY = motionEvent.getRawY() - BarUtils.getStatusBarHeight();
mInScreenY = motionEvent.getRawY() - SysBarUtil.getSysBarHeight(mContext);
break;
case MotionEvent.ACTION_MOVE:
// 更新浮动窗口位置参数
mInScreenX = motionEvent.getRawX();
mInScreenY = motionEvent.getRawY() - BarUtils.getStatusBarHeight();
mInScreenY = motionEvent.getRawY() - SysBarUtil.getSysBarHeight(mContext);
mWindowParams.x = (int) (mInScreenX - mInViewX);
mWindowParams.y = (int) (mInScreenY - mInViewY);
// 手指移动的时候更新小悬浮窗的位置
@@ -156,6 +154,5 @@ public class FloatWindow implements View.OnTouchListener {
mFloatLayout.setAlpha(1);
}
private int sbar = -1;
}

View File

@@ -22,13 +22,12 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatButton;
import com.mogo.eagle.core.utilcode.util.BarUtils;
import com.zhidao.adas.client.R;
import com.zhidao.adas.client.bean.SpecialVehicleBean;
import com.zhidao.adas.client.bean.SpecialVehicleOption;
import com.zhidao.adas.client.utils.SysBarUtil;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
/**
@@ -130,9 +129,9 @@ public class SpecialVehicleFloatWindow extends LinearLayout {
mInViewY = event.getY();
// 获取相对屏幕的坐标,即以屏幕左上角为原点
mDownInScreenX = event.getRawX();
mDownInScreenY = event.getRawY() - BarUtils.getStatusBarHeight();
mDownInScreenY = event.getRawY() - SysBarUtil.getSysBarHeight(getContext());
mInScreenX = event.getRawX();
mInScreenY = event.getRawY() - BarUtils.getStatusBarHeight();
mInScreenY = event.getRawY() - SysBarUtil.getSysBarHeight(getContext());
if (!isMaximize) {
btn_maximize.setPressed(true);
@@ -143,7 +142,7 @@ public class SpecialVehicleFloatWindow extends LinearLayout {
case MotionEvent.ACTION_MOVE:
// 更新浮动窗口位置参数
mInScreenX = event.getRawX();
mInScreenY = event.getRawY() - BarUtils.getStatusBarHeight();
mInScreenY = event.getRawY() - SysBarUtil.getSysBarHeight(getContext());
wmParams.x = (int) (mInScreenX - mInViewX);
wmParams.y = (int) (mInScreenY - mInViewY);
updateViewLayout();
@@ -197,7 +196,6 @@ public class SpecialVehicleFloatWindow extends LinearLayout {
private int sbar = -1;
/*****************************业务逻辑*******************************************/

View File

@@ -0,0 +1,30 @@
package com.zhidao.adas.client.utils;
import android.content.Context;
import java.lang.reflect.Field;
public class SysBarUtil {
private static int sbar = -1;
// 获取系统状态栏高度
public static int getSysBarHeight(Context contex) {
if (sbar == -1) {
Class<?> c;
Object obj;
Field field;
int x;
sbar = 0;
try {
c = Class.forName("com.android.internal.R$dimen");
obj = c.newInstance();
field = c.getField("status_bar_height");
x = Integer.parseInt(field.get(obj).toString());
sbar = contex.getResources().getDimensionPixelSize(x);
} catch (Exception e1) {
e1.printStackTrace();
}
}
return sbar;
}
}

View File

@@ -65,8 +65,9 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation rootProject.ext.dependencies.gson
implementation project(':libraries:mogo-adas')
compileOnly project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':libraries:mogo-adas-data')
// compileOnly project(':core:mogo-core-data')
// implementation project(':core:mogo-core-utils')
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.android.support:multidex:1.0.3'
}

View File

@@ -1,7 +1,6 @@
package com.zhidao.adas.magic.ui;
import android.app.Activity;
import android.content.Context;
import android.graphics.PixelFormat;
import android.util.DisplayMetrics;
import android.view.Gravity;
@@ -12,13 +11,12 @@ import android.view.WindowManager;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.eagle.core.utilcode.util.BarUtils;
import com.zhidao.adas.magic.R;
import com.zhidao.adas.magic.adapter.ConnectStatusAdapter;
import com.zhidao.adas.magic.bean.IPCConnectState;
import com.zhidao.adas.magic.utils.MyLinearLayoutManager;
import com.zhidao.adas.magic.utils.SysBarUtil;
import java.lang.reflect.Field;
import java.util.List;
/**
@@ -109,14 +107,14 @@ public class FloatWindow implements View.OnTouchListener {
mInViewY = motionEvent.getY();
// 获取相对屏幕的坐标,即以屏幕左上角为原点
mDownInScreenX = motionEvent.getRawX();
mDownInScreenY = motionEvent.getRawY() - BarUtils.getStatusBarHeight();
mDownInScreenY = motionEvent.getRawY() - SysBarUtil.getSysBarHeight(mContext);
mInScreenX = motionEvent.getRawX();
mInScreenY = motionEvent.getRawY() - BarUtils.getStatusBarHeight();
mInScreenY = motionEvent.getRawY() - SysBarUtil.getSysBarHeight(mContext);
break;
case MotionEvent.ACTION_MOVE:
// 更新浮动窗口位置参数
mInScreenX = motionEvent.getRawX();
mInScreenY = motionEvent.getRawY() - BarUtils.getStatusBarHeight();
mInScreenY = motionEvent.getRawY() - SysBarUtil.getSysBarHeight(mContext);
mWindowParams.x = (int) (mInScreenX - mInViewX);
mWindowParams.y = (int) (mInScreenY - mInViewY);
// 手指移动的时候更新小悬浮窗的位置

View File

@@ -33,7 +33,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.zhidao.adas.magic.R;
import com.zhidao.adas.magic.adapter.InfoTitleAdapter;
import com.zhidao.adas.magic.base.BaseActivity;

View File

@@ -0,0 +1,30 @@
package com.zhidao.adas.magic.utils;
import android.content.Context;
import java.lang.reflect.Field;
public class SysBarUtil {
private static int sbar = -1;
// 获取系统状态栏高度
public static int getSysBarHeight(Context contex) {
if (sbar == -1) {
Class<?> c;
Object obj;
Field field;
int x;
sbar = 0;
try {
c = Class.forName("com.android.internal.R$dimen");
obj = c.newInstance();
field = c.getField("status_bar_height");
x = Integer.parseInt(field.get(obj).toString());
sbar = contex.getResources().getDimensionPixelSize(x);
} catch (Exception e1) {
e1.printStackTrace();
}
}
return sbar;
}
}