From 7a621d952fb83005ce7b6db82f9b2206746562be Mon Sep 17 00:00:00 2001 From: lizhanwei <Dana_Lee1016@126.com> Date: 星期一, 02 三月 2020 15:47:12 +0800 Subject: [PATCH] 提交根据协处理器给的gpio信号来查看车载信号情况 --- app/src/main/res/layout/layout_check_signal.xml | 105 ++++---- im_lib/src/main/java/com/anyun/im_lib/util/ByteUtil.java | 14 + app/src/main/java/safeluck/drive/evaluation/fragment/InspectSignalFragment.java | 72 ++++- app/src/main/res/layout/layout_signal_slice.xml | 473 ++++++++++++++++++++------------------- app/src/main/java/safeluck/drive/evaluation/fragment/BaseDatasFragment.java | 5 app/src/main/res/layout/toolbar.xml | 33 +- app/build.gradle | 3 7 files changed, 387 insertions(+), 318 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 65e4132..757bef6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,6 +16,9 @@ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + dataBinding{ + enabled = true + } signingConfigs { release { storeFile file("../key/key.jks") diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/BaseDatasFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/BaseDatasFragment.java index fa69236..731f010 100644 --- a/app/src/main/java/safeluck/drive/evaluation/fragment/BaseDatasFragment.java +++ b/app/src/main/java/safeluck/drive/evaluation/fragment/BaseDatasFragment.java @@ -35,6 +35,7 @@ import java.util.List; import me.yokeyword.fragmentation.SupportFragment; +import safeluck.drive.evaluation.BuildConfig; import safeluck.drive.evaluation.Constant; import safeluck.drive.evaluation.DB.appstatusdb.AppStatus; import safeluck.drive.evaluation.DB.appstatusdb.AppStatusViewModel; @@ -83,7 +84,7 @@ if (fields[i].getName().equalsIgnoreCase("version")){ String version = (String) fields[i].get(mcuInfo); version = new String(BytesUtils.hexStringToBytes(version),"GBK"); - datas.add("鐗堟湰鍙凤細" + version); + datas.add("鐗堟湰鍙凤細" + version+"#"+ BuildConfig.VERSION_NAME); }else if(fields[i].getName().equalsIgnoreCase("sn")){ datas.add( "璁惧搴忓垪鍙凤細" + fields[i].get(mcuInfo)); }else if(fields[i].getName().equalsIgnoreCase("selftest")){ @@ -103,7 +104,7 @@ if (mRtkConfig != null){ datas.add("鐪両D锛�"+mRtkConfig.getProvince()); datas.add("甯侷D锛�"+mRtkConfig.getCity()); - datas.add("鐢佃瘽锛�"+mRtkConfig.getPhone()); + datas.add("鐢佃瘽锛�"+mRtkConfig.getSn()); datas.add("RTK骞冲彴鍦板潃锛�"+mRtkConfig.getIp()+":"+mRtkConfig.getPort()); datas.add("鑰冭瘯骞冲彴鍦板潃锛�"+ExamPlatformData.getInstance().getPlatformIP()+":"+ExamPlatformData.getInstance().getPlatformPort()); diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/InspectSignalFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/InspectSignalFragment.java index d869c7b..6fafe5d 100644 --- a/app/src/main/java/safeluck/drive/evaluation/fragment/InspectSignalFragment.java +++ b/app/src/main/java/safeluck/drive/evaluation/fragment/InspectSignalFragment.java @@ -5,6 +5,7 @@ import android.os.Bundle; import android.os.Handler; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -13,8 +14,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; +import androidx.databinding.DataBindingUtil; +import com.anyun.im_lib.util.ByteUtil; import com.google.gson.Gson; + +import java.util.ArrayList; +import java.util.List; import me.yokeyword.fragmentation.SupportFragment; import safeluck.drive.evaluation.Constant; @@ -22,6 +28,8 @@ import safeluck.drive.evaluation.bean.MCUInfo; import safeluck.drive.evaluation.cEventCenter.CEventCenter; import safeluck.drive.evaluation.cEventCenter.ICEventListener; +import safeluck.drive.evaluation.databinding.LayoutCheckSignalBinding; +import safeluck.drive.evaluation.databinding.LayoutSignalSliceBinding; /** * MyApplication2 @@ -31,20 +39,52 @@ */ public class InspectSignalFragment extends SupportFragment { + + private static final String TAG = "InspectSignalFragment"; + private static final int VALIAD_NUM = 1;//1楂樼數骞虫湁鏁� + private TextView textView_turnLight,tv_speed,tv_engine; private Toolbar toolbar; private Gson gson= new Gson(); + private LayoutCheckSignalBinding bingding; + private List<Integer> gpios = new ArrayList<>(); + Drawable leftGreen ; + Drawable leftGray ; private ICEventListener icEventListener = new ICEventListener() { @Override public void onCEvent(String topic, int msgCode, int resultCode, Object obj) { if (msgCode==Constant.MCU_SN){ final MCUInfo mcuInfo = gson.fromJson((String)obj, MCUInfo.class); if (mcuInfo != null){ - tv_engine.post(new Runnable() { + bingding.getRoot().post(new Runnable() { @Override public void run() { - tv_engine.setText(String.valueOf(mcuInfo.getEngine())); - tv_speed.setText(String.valueOf(mcuInfo.getSpeed())); + + for (int i = 0; i < 16; i++) { + gpios.add( ByteUtil.getBitStatus(mcuInfo.getGpio(),i)); + } + + bingding.tvRoateSpeed.setText(String.valueOf(mcuInfo.getEngine())); + bingding.tvDangweiNum.setText(String.valueOf(mcuInfo.getSpeed())); + + + bingding.inpsetSignalSlice.tvSeatBelt.setCompoundDrawablesWithIntrinsicBounds(gpios.get(0)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvTrunLeft.setCompoundDrawablesWithIntrinsicBounds(gpios.get(1)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvTurnRight.setCompoundDrawablesWithIntrinsicBounds(gpios.get(2)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvParkingBrake.setCompoundDrawablesWithIntrinsicBounds(gpios.get(3)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvFootBrake.setCompoundDrawablesWithIntrinsicBounds(gpios.get(4)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvLowLamp.setCompoundDrawablesWithIntrinsicBounds(gpios.get(5)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvHighBeam.setCompoundDrawablesWithIntrinsicBounds(gpios.get(6)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + + bingding.inpsetSignalSlice.tvGateLock.setCompoundDrawablesWithIntrinsicBounds(gpios.get(7)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvNullEngine.setCompoundDrawablesWithIntrinsicBounds(gpios.get(8)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvGearOne.setCompoundDrawablesWithIntrinsicBounds(gpios.get(9)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvGearTwo.setCompoundDrawablesWithIntrinsicBounds(gpios.get(10)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvGearThree.setCompoundDrawablesWithIntrinsicBounds(gpios.get(11)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvGearFour.setCompoundDrawablesWithIntrinsicBounds(gpios.get(12)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvGearFive.setCompoundDrawablesWithIntrinsicBounds(gpios.get(13)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvWindingOne.setCompoundDrawablesWithIntrinsicBounds(gpios.get(14)==VALIAD_NUM?leftGreen:leftGray,null,null,null); + bingding.inpsetSignalSlice.tvWindingTwo.setCompoundDrawablesWithIntrinsicBounds(gpios.get(15)==VALIAD_NUM?leftGreen:leftGray,null,null,null); } }); } @@ -60,15 +100,18 @@ @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.layout_check_signal,container,false); - initView(view); - return view; + bingding = DataBindingUtil.inflate(inflater,R.layout.layout_check_signal,container,false); + initView(); + + leftGreen = getResources().getDrawable(R.drawable.green_light,null); + leftGray = getResources().getDrawable(R.drawable.gray_light,null); + + + return bingding.getRoot(); } - private void initView(View view) { - tv_engine = view.findViewById(R.id.tv_roate_speed); - tv_speed = view.findViewById(R.id.tv_dangwei_num); - toolbar =view.findViewById(R.id.toolbar); + private void initView() { + toolbar = bingding.inpsectSignalToolbar.toolbar; toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp,null)); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override @@ -77,14 +120,7 @@ } }); toolbar.setTitle("鏌ョ湅杞﹁浇淇″彿杈撳叆"); - textView_turnLight = view.findViewById(R.id.tv_fog_lamp); - final Drawable left = getResources().getDrawable(R.drawable.green_light,null); - new Handler().postDelayed(new Runnable() { - @Override - public void run() { - textView_turnLight.setCompoundDrawablesWithIntrinsicBounds(left,null,null,null); - } - },5*1000); + } @Override diff --git a/app/src/main/res/layout/layout_check_signal.xml b/app/src/main/res/layout/layout_check_signal.xml index 368e098..7c45702 100644 --- a/app/src/main/res/layout/layout_check_signal.xml +++ b/app/src/main/res/layout/layout_check_signal.xml @@ -1,58 +1,61 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:background="@android:color/white" - > - <include layout="@layout/toolbar"/> - <FrameLayout +<layout> + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent" > - <include layout="@layout/layout_signal_slice"/> -<RelativeLayout - android:layout_gravity="end" - android:padding="10dp" - android:layout_width="wrap_content" - android:layout_height="wrap_content"> - <TextView - android:layout_width="70dp" - android:layout_height="25dp" - android:textColor="@android:color/black" - android:id="@+id/tv_dangwei" + android:layout_height="match_parent" + android:orientation="vertical" + android:background="@android:color/white" + > + <include layout="@layout/toolbar" android:id="@+id/inpsect_signal_toolbar"/> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent" > + <include layout="@layout/layout_signal_slice" android:id="@+id/inpset_signal_slice"/> + <RelativeLayout + android:layout_gravity="end" + android:padding="10dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + <TextView + android:layout_width="70dp" + android:layout_height="25dp" + android:textColor="@android:color/black" + android:id="@+id/tv_dangwei" - android:gravity="center" - android:text="@string/chesu"/> - <TextView - android:layout_width="35dp" - android:layout_height="25dp" - android:layout_toRightOf="@id/tv_dangwei" - android:id="@+id/tv_dangwei_num" - android:text="0" - android:gravity="center" - android:background="@drawable/dangwei_bg"/> - <TextView - android:layout_width="70dp" - android:layout_height="25dp" - android:textColor="@android:color/black" + android:gravity="center" + android:text="@string/chesu"/> + <TextView + android:layout_width="35dp" + android:layout_height="25dp" + android:layout_toRightOf="@id/tv_dangwei" + android:id="@+id/tv_dangwei_num" + android:text="0" + android:gravity="center" + android:background="@drawable/dangwei_bg"/> + <TextView + android:layout_width="70dp" + android:layout_height="25dp" + android:textColor="@android:color/black" - android:gravity="center" - android:layout_marginTop="15dp" + android:gravity="center" + android:layout_marginTop="15dp" - android:layout_below="@+id/tv_dangwei" - android:text="@string/engine"/> - <TextView - android:layout_width="70dp" - android:layout_height="25dp" - android:gravity="center" - android:layout_marginTop="15dp" - android:text="-1.32332" - android:id="@+id/tv_roate_speed" - android:layout_toRightOf="@id/tv_dangwei" - android:layout_below="@+id/tv_dangwei_num" - android:background="@drawable/dangwei_bg"/> -</RelativeLayout> - </FrameLayout> + android:layout_below="@+id/tv_dangwei" + android:text="@string/engine"/> + <TextView + android:layout_width="70dp" + android:layout_height="25dp" + android:gravity="center" + android:layout_marginTop="15dp" + android:text="-1.32332" + android:id="@+id/tv_roate_speed" + android:layout_toRightOf="@id/tv_dangwei" + android:layout_below="@+id/tv_dangwei_num" + android:background="@drawable/dangwei_bg"/> + </RelativeLayout> + </FrameLayout> -</LinearLayout> + </LinearLayout> + +</layout> diff --git a/app/src/main/res/layout/layout_signal_slice.xml b/app/src/main/res/layout/layout_signal_slice.xml index 3614f4e..3034050 100644 --- a/app/src/main/res/layout/layout_signal_slice.xml +++ b/app/src/main/res/layout/layout_signal_slice.xml @@ -1,254 +1,265 @@ <?xml version="1.0" encoding="utf-8"?> +<layout> + <data> +<variable + name="gpio" + type="safeluck.drive.evaluation.bean.MCUInfo" /> + </data> + <TableLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="10dp"> + <TableRow android:layout_marginBottom="10dp"> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鍠囧彮" + android:id="@+id/tv_loudspeaker" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" -<TableLayout -xmlns:android="http://schemas.android.com/apk/res/android" -android:layout_width="match_parent" -android:layout_height="match_parent" -android:padding="10dp"> -<TableRow android:layout_marginBottom="10dp"> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="鍠囧彮" - android:id="@+id/tv_loudspeaker" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="杩滃厜鐏�" - android:layout_marginLeft="30dp" - android:id="@+id/tv_high_beam" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="妗d綅涓�" - android:layout_marginLeft="30dp" - android:id="@+id/tv_gear_one" - android:layout_toRightOf="@+id/tv_high_beam" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> -</TableRow> -<TableRow android:layout_marginBottom="10dp" > + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="杩滃厜鐏�" + android:layout_marginLeft="30dp" + android:id="@+id/tv_high_beam" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="妗d綅涓�" + android:layout_marginLeft="30dp" + android:id="@+id/tv_gear_one" + android:layout_toRightOf="@+id/tv_high_beam" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + </TableRow> + <TableRow android:layout_marginBottom="10dp" > - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="瀹夊叏甯�" - android:id="@+id/tv_seat_belt" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="闆剧伅" - android:layout_marginLeft="30dp" - android:id="@+id/tv_fog_lamp" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="妗d綅浜�" - android:layout_marginLeft="30dp" - android:id="@+id/tv_gear_two" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> -</TableRow> -<TableRow android:layout_marginBottom="10dp" > + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="瀹夊叏甯�" + android:id="@+id/tv_seat_belt" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="绌烘。" + android:layout_marginLeft="30dp" + android:id="@+id/tv_null_engine" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="妗d綅浜�" + android:layout_marginLeft="30dp" + android:id="@+id/tv_gear_two" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + </TableRow> + <TableRow android:layout_marginBottom="10dp" > - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="鐔勭伀" - android:id="@+id/tv_cut_off" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="绀哄鐏�" - android:id="@+id/tv_width_lamp" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:layout_marginLeft="30dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="妗d綅涓�" - android:layout_marginLeft="30dp" - android:id="@+id/tv_gear_three" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> -</TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鐔勭伀" + android:id="@+id/tv_cut_off" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="绀哄鐏�" + android:id="@+id/tv_width_lamp" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:layout_marginLeft="30dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="妗d綅涓�" + android:layout_marginLeft="30dp" + android:id="@+id/tv_gear_three" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + </TableRow> -<TableRow android:layout_marginBottom="10dp" > + <TableRow android:layout_marginBottom="10dp" > - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="闂ㄩ攣" - android:id="@+id/tv_gate_lock" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="鍙岄棯" - android:layout_marginLeft="30dp" - android:id="@+id/tv_emergency_flasher" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="妗d綅鍥�" - android:layout_marginLeft="30dp" - android:id="@+id/tv_gear_four" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> -</TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="闂ㄩ攣" + android:id="@+id/tv_gate_lock" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鍙岄棯" + android:layout_marginLeft="30dp" + android:id="@+id/tv_emergency_flasher" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="妗d綅鍥�" + android:layout_marginLeft="30dp" + android:id="@+id/tv_gear_four" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + </TableRow> -<TableRow android:layout_marginBottom="10dp" > + <TableRow android:layout_marginBottom="10dp" > - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="鎵嬪埞" - android:id="@+id/tv_parking_brake" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="鑴氬埞" - android:layout_marginLeft="30dp" - android:id="@+id/tv_foot_brake" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Signal3-5" - android:layout_marginLeft="30dp" - android:id="@+id/tv_signal3_5" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> -</TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鎵嬪埞" + android:id="@+id/tv_parking_brake" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鑴氬埞" + android:layout_marginLeft="30dp" + android:id="@+id/tv_foot_brake" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="妗d綅浜�" + android:layout_marginLeft="30dp" + android:id="@+id/tv_gear_five" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + </TableRow> -<TableRow android:layout_marginBottom="10dp" > + <TableRow android:layout_marginBottom="10dp" > - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="宸﹁浆鍚�" - android:id="@+id/tv_trun_left" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="缁曡溅涓�" - android:layout_marginLeft="30dp" - android:id="@+id/tv_winding_one" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Signal3-6" - android:layout_marginLeft="30dp" - android:id="@+id/tv_signal3_6" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> -</TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="宸﹁浆鍚�" + android:id="@+id/tv_trun_left" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鍊掓尅" + android:layout_marginLeft="30dp" + android:id="@+id/tv_winding_one" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Signal3-6" + android:layout_marginLeft="30dp" + android:id="@+id/tv_signal3_6" + android:visibility="gone" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + </TableRow> -<TableRow android:layout_marginBottom="10dp" > + <TableRow android:layout_marginBottom="10dp" > - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="鍙宠浆鍚�" - android:id="@+id/tv_turn_right" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="缁曡溅浜�" - android:layout_marginLeft="30dp" - android:id="@+id/tv_winding_two" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Signal3-7" - android:id="@+id/tv_signal3_7" - android:layout_marginLeft="30dp" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> -</TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鍙宠浆鍚�" + android:id="@+id/tv_turn_right" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="閽ュ寵START浣�" + android:layout_marginLeft="30dp" + android:id="@+id/tv_winding_two" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Signal3-7" + android:id="@+id/tv_signal3_7" + android:visibility="gone" + android:layout_marginLeft="30dp" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + </TableRow> -<TableRow android:layout_marginBottom="10dp" > + <TableRow android:layout_marginBottom="10dp" > - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="杩戝厜鐏�" - android:id="@+id/tv_low_lamp" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="绂诲悎" - android:layout_marginLeft="30dp" - android:id="@+id/tv_clutch_pedal" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Signal3-8" - android:layout_marginLeft="30dp" - android:id="@+id/tv_signal3_8" - android:drawableLeft="@drawable/gray_light" - android:drawablePadding="5dp" - android:textColor="@android:color/black"/> -</TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="杩戝厜鐏�" + android:id="@+id/tv_low_lamp" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="绂诲悎" + android:layout_marginLeft="30dp" + android:id="@+id/tv_clutch_pedal" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Signal3-8" + android:visibility="gone" + android:layout_marginLeft="30dp" + android:id="@+id/tv_signal3_8" + android:drawableLeft="@drawable/gray_light" + android:drawablePadding="5dp" + android:textColor="@android:color/black"/> + </TableRow> -</TableLayout> \ No newline at end of file + </TableLayout> +</layout> + diff --git a/app/src/main/res/layout/toolbar.xml b/app/src/main/res/layout/toolbar.xml index ab01cf4..684ff6a 100644 --- a/app/src/main/res/layout/toolbar.xml +++ b/app/src/main/res/layout/toolbar.xml @@ -1,18 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> - -<com.google.android.material.appbar.AppBarLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:theme="@style/AppTheme.AppBarOverlay"> - - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" +<layout> + <com.google.android.material.appbar.AppBarLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - android:background="?attr/colorPrimary" - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" - app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay" - app:titleTextAppearance="@style/Toolbar_TextAppearance_White"/> -</com.google.android.material.appbar.AppBarLayout> \ No newline at end of file + android:layout_height="wrap_content" + android:theme="@style/AppTheme.AppBarOverlay"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay" + app:titleTextAppearance="@style/Toolbar_TextAppearance_White"/> + </com.google.android.material.appbar.AppBarLayout> +</layout> diff --git a/im_lib/src/main/java/com/anyun/im_lib/util/ByteUtil.java b/im_lib/src/main/java/com/anyun/im_lib/util/ByteUtil.java index be515e4..00d363b 100644 --- a/im_lib/src/main/java/com/anyun/im_lib/util/ByteUtil.java +++ b/im_lib/src/main/java/com/anyun/im_lib/util/ByteUtil.java @@ -268,4 +268,18 @@ Log.i(TAG, "getShort: "+s); return s ; } + + /** + * 鍒ゆ柇1涓�涓猧nt鍙橀噺 鏌愪綅bit鐨勫�� + * + * @param num + * @param pos =0 鏄涓�涓� 1.銆� 2.銆� + * @return + */ + public static int getBitStatus(int num,int pos){ + if ((num&(1<<pos))!=0){ + return 1; + }else + return 0; + } } -- Gitblit v1.8.0