@@ -217,7 +217,7 @@ | |||
android:value="1920" /> | |||
<meta-data | |||
android:name="design_height_in_dp" | |||
android:value="1080" /> | |||
android:value="1008" /> | |||
</application> | |||
</manifest> |
@@ -61,12 +61,11 @@ public class ProcessValueUtil { | |||
}else if(name.equals("烤箱温度")){ | |||
val = val+"°C"; | |||
} | |||
stringBuilder.append(val); | |||
stringBuilder.append(val).append(","); | |||
} | |||
} | |||
} | |||
stringBuilder.append(")"); | |||
} | |||
return stringBuilder.toString(); | |||
return stringBuilder.substring(0,stringBuilder.length()-1)+")"; | |||
} | |||
} |
@@ -83,7 +83,7 @@ public class WelcomeActivity extends BaseActivity { | |||
*/ | |||
private void initScaleViewDefaultValue() | |||
{ | |||
DisplayManager.setReferenceMaxWidthHeight(1920, 1080); | |||
DisplayManager.setReferenceMaxWidthHeight(1920, 1008); | |||
DisplayManager.updateDisplayInfo(this); | |||
} | |||
@@ -65,11 +65,6 @@ public abstract class HomeGoodsAdapter extends BaseAdapter<BPA_GOODS, HomeGoodsA | |||
} | |||
} | |||
@Override | |||
public int getItemCount() { | |||
return mData.size(); | |||
} | |||
public static class GoodsViewHolder extends RecyclerView.ViewHolder { | |||
private ItemHomeGoodsBinding binding; | |||
@@ -132,12 +132,12 @@ public class OvenControlDialog extends DialogFragment { | |||
boolean model4 = (boolean) ModbusCenter.ReadPlc("模式旋钮在档位4"); | |||
short[] read = (short[]) ModbusCenter.ReadPlc("");//todo | |||
byte[] bytes = DataConvertLib.shorts2Bytes(read); | |||
if(bytes.length>=2){ | |||
int ovenWendu = bytes[0] & 0xFF; | |||
viewBinding.tvWendu.setText("温度位置:"+ovenWendu); | |||
} | |||
// short[] read = (short[]) ModbusCenter.ReadPlc("");//todo | |||
// byte[] bytes = DataConvertLib.shorts2Bytes(read); | |||
// if(bytes.length>=2){ | |||
// int ovenWendu = bytes[0] & 0xFF; | |||
// viewBinding.tvWendu.setText("温度位置:"+ovenWendu); | |||
// } | |||
// boolean wendu0 = (boolean) ModbusCenter.ReadPlc("温度旋钮在档位0"); | |||
// boolean wendu1 = (boolean) ModbusCenter.ReadPlc("温度旋钮在档位1"); | |||
@@ -0,0 +1,48 @@ | |||
package com.bonait.bnframework.newui.widget; | |||
import android.content.Context; | |||
import android.util.AttributeSet; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import androidx.viewpager.widget.ViewPager; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/7/24 11:02. | |||
*/ | |||
public class NonSwipeableViewPager extends ViewPager { | |||
public NonSwipeableViewPager(Context context) { | |||
super(context); | |||
init(); | |||
} | |||
public NonSwipeableViewPager(Context context, AttributeSet attrs) { | |||
super(context, attrs); | |||
init(); | |||
} | |||
private void init() { | |||
// 禁止ViewPager拦截事件 | |||
setOnTouchListener(new OnTouchListener() { | |||
@Override | |||
public boolean onTouch(View v, MotionEvent event) { | |||
return true; | |||
} | |||
}); | |||
} | |||
@Override | |||
public boolean onInterceptTouchEvent(MotionEvent ev) { | |||
// 忽略触摸事件 | |||
return false; | |||
} | |||
@Override | |||
public boolean onTouchEvent(MotionEvent event) { | |||
// 忽略触摸事件 | |||
return false; | |||
} | |||
} |
@@ -34,9 +34,7 @@ public class SystemSetActivity extends BaseActivity { | |||
super.onCreate(savedInstanceState); | |||
viewBinding = ActivitySystemSetBinding.inflate(getLayoutInflater()); | |||
setContentView(viewBinding.getRoot()); | |||
DisplayManager.scaleViewGroup(viewBinding.rlQuanxian); | |||
DisplayManager.scaleView(viewBinding.topbar); | |||
DisplayManager.scaleViewGroup(viewBinding.topbar); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
initTopBar(); | |||
initView(); | |||
} | |||
@@ -45,8 +43,20 @@ public class SystemSetActivity extends BaseActivity { | |||
initFragment(); | |||
viewBinding.viewpager.addOnPageChangeListener(pageChangeListener); | |||
// 设置viewPager缓存多少个fragment | |||
viewBinding.viewpager.setOffscreenPageLimit(1); | |||
viewBinding.navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); | |||
viewBinding.viewpager.setOffscreenPageLimit(4); | |||
// viewBinding.navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); | |||
updateTopBar(1); | |||
} | |||
private void updateTopBar(int pos){ | |||
viewBinding.img1.setSelected(pos==1); | |||
viewBinding.tvTitle1.setSelected(pos==1); | |||
viewBinding.img2.setSelected(pos==2); | |||
viewBinding.tvTitle2.setSelected(pos==2); | |||
viewBinding.img3.setSelected(pos==3); | |||
viewBinding.tvTitle3.setSelected(pos==3); | |||
viewBinding.img4.setSelected(pos==4); | |||
viewBinding.tvTitle4.setSelected(pos==4); | |||
} | |||
private void initTopBar(){ | |||
@@ -92,31 +102,31 @@ public class SystemSetActivity extends BaseActivity { | |||
viewBinding.viewpager.setAdapter(fragmentAdapter); | |||
} | |||
/** | |||
* 配置bottom底部菜单栏监听器,手指点击底部菜单监听 | |||
*/ | |||
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener | |||
= new BottomNavigationView.OnNavigationItemSelectedListener() { | |||
@Override | |||
public boolean onNavigationItemSelected(@NonNull MenuItem item) { | |||
switch (item.getItemId()) { | |||
case R.id.bottom_navigation_1: | |||
viewBinding.viewpager.setCurrentItem(0); | |||
return true; | |||
case R.id.bottom_navigation_2: | |||
viewBinding.viewpager.setCurrentItem(1); | |||
return true; | |||
case R.id.bottom_navigation_3: | |||
viewBinding.viewpager.setCurrentItem(2); | |||
return true; | |||
case R.id.bottom_navigation_4: | |||
viewBinding.viewpager.setCurrentItem(3); | |||
return true; | |||
} | |||
return false; | |||
} | |||
}; | |||
// /** | |||
// * 配置bottom底部菜单栏监听器,手指点击底部菜单监听 | |||
// */ | |||
// private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener | |||
// = new BottomNavigationView.OnNavigationItemSelectedListener() { | |||
// | |||
// @Override | |||
// public boolean onNavigationItemSelected(@NonNull MenuItem item) { | |||
// switch (item.getItemId()) { | |||
// case R.id.bottom_navigation_1: | |||
// viewBinding.viewpager.setCurrentItem(0); | |||
// return true; | |||
// case R.id.bottom_navigation_2: | |||
// viewBinding.viewpager.setCurrentItem(1); | |||
// return true; | |||
// case R.id.bottom_navigation_3: | |||
// viewBinding.viewpager.setCurrentItem(2); | |||
// return true; | |||
// case R.id.bottom_navigation_4: | |||
// viewBinding.viewpager.setCurrentItem(3); | |||
// return true; | |||
// } | |||
// return false; | |||
// } | |||
// }; | |||
/** | |||
@@ -130,7 +140,8 @@ public class SystemSetActivity extends BaseActivity { | |||
@Override | |||
public void onPageSelected(int position) { | |||
viewBinding.navigation.getMenu().getItem(position).setChecked(true); | |||
// viewBinding.navigation.getMenu().getItem(position).setChecked(true); | |||
updateTopBar(position+1); | |||
} | |||
@Override | |||
@@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<!--选择状态下的图片--> | |||
<item android:drawable="@mipmap/sbxx_selected" android:state_checked="true"/> | |||
<item android:drawable="@mipmap/sbxx_selected" android:state_selected="true"/> | |||
<!--未选择状态下的图片--> | |||
<item android:drawable="@mipmap/sbxx" android:state_checked="false"/> | |||
<item android:drawable="@mipmap/sbxx" /> | |||
</selector> |
@@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<!--选择状态下的图片--> | |||
<item android:drawable="@mipmap/wl_selected" android:state_checked="true"/> | |||
<item android:drawable="@mipmap/wl_selected" android:state_selected="true"/> | |||
<!--未选择状态下的图片--> | |||
<item android:drawable="@mipmap/wl" android:state_checked="false"/> | |||
<item android:drawable="@mipmap/wl" /> | |||
</selector> |
@@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<!--选择状态下的图片--> | |||
<item android:drawable="@mipmap/xtsz_selected" android:state_checked="true"/> | |||
<item android:drawable="@mipmap/xtsz_selected" android:state_selected="true"/> | |||
<!--未选择状态下的图片--> | |||
<item android:drawable="@mipmap/xtsz" android:state_checked="false"/> | |||
<item android:drawable="@mipmap/xtsz" /> | |||
</selector> |
@@ -0,0 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item android:state_selected="true" android:color="@color/blue_primary"/> | |||
<item android:color="@color/black"/> | |||
</selector> |
@@ -44,26 +44,129 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<com.google.android.material.bottomnavigation.BottomNavigationView | |||
android:id="@+id/navigation" | |||
<!-- <com.google.android.material.bottomnavigation.BottomNavigationView--> | |||
<!-- android:id="@+id/navigation"--> | |||
<!-- android:layout_width="match_parent"--> | |||
<!-- android:layout_height="@dimen/dp_56"--> | |||
<!-- android:layout_gravity="top"--> | |||
<!-- app:layout_constraintTop_toTopOf="parent"--> | |||
<!-- app:layout_constraintLeft_toLeftOf="parent"--> | |||
<!-- android:background="@drawable/qmui_list_item_bg_with_border_bottom"--> | |||
<!-- app:itemHorizontalTranslationEnabled="false"--> | |||
<!-- app:labelVisibilityMode="labeled"--> | |||
<!-- style="@style/BottomNavigationTextStyle"--> | |||
<!-- app:menu="@menu/system"--> | |||
<!-- android:fitsSystemWindows="true"/>--> | |||
<LinearLayout | |||
android:id="@+id/ll_top_bar" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_56" | |||
android:layout_gravity="top" | |||
android:layout_height="90dp" | |||
android:orientation="horizontal" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:background="@drawable/qmui_list_item_bg_with_border_bottom" | |||
app:itemHorizontalTranslationEnabled="false" | |||
app:labelVisibilityMode="labeled" | |||
style="@style/BottomNavigationTextStyle" | |||
app:menu="@menu/system" | |||
android:fitsSystemWindows="true"/> | |||
android:background="@color/white" | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
> | |||
<LinearLayout | |||
android:layout_width="150dp" | |||
android:orientation="vertical" | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
android:layout_marginTop="5dp" | |||
android:layout_height="match_parent"> | |||
<ImageView | |||
android:id="@+id/img1" | |||
android:layout_width="40dp" | |||
android:src="@drawable/icon_networkmanagement" | |||
android:layout_height="40dp"/> | |||
<TextView | |||
android:id="@+id/tv_title1" | |||
android:layout_width="match_parent" | |||
android:text="资源管理" | |||
android:textSize="28sp" | |||
android:gravity="center" | |||
android:textColor="@drawable/selector_bop_bar_textcolor" | |||
android:layout_height="match_parent"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="150dp" | |||
android:orientation="vertical" | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
android:layout_marginStart="50dp" | |||
android:layout_marginTop="5dp" | |||
android:layout_height="match_parent"> | |||
<ImageView | |||
android:id="@+id/img2" | |||
android:layout_width="40dp" | |||
android:src="@drawable/icon_deviceinformation" | |||
android:layout_height="40dp"/> | |||
<TextView | |||
android:id="@+id/tv_title2" | |||
android:layout_width="match_parent" | |||
android:text="设备信息" | |||
android:textSize="28sp" | |||
android:textColor="@drawable/selector_bop_bar_textcolor" | |||
android:gravity="center" | |||
android:layout_height="match_parent"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="150dp" | |||
android:orientation="vertical" | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
android:layout_marginStart="50dp" | |||
android:layout_marginTop="5dp" | |||
android:layout_height="match_parent"> | |||
<ImageView | |||
android:id="@+id/img3" | |||
android:layout_width="40dp" | |||
android:src="@drawable/icon_systemsettings" | |||
android:layout_height="40dp"/> | |||
<TextView | |||
android:id="@+id/tv_title3" | |||
android:layout_width="match_parent" | |||
android:text="系统设置" | |||
android:textSize="28sp" | |||
android:textColor="@drawable/selector_bop_bar_textcolor" | |||
android:gravity="center" | |||
android:layout_height="match_parent"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="150dp" | |||
android:orientation="vertical" | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
android:layout_marginStart="50dp" | |||
android:layout_marginTop="5dp" | |||
android:layout_height="match_parent"> | |||
<ImageView | |||
android:id="@+id/img4" | |||
android:layout_width="40dp" | |||
android:src="@drawable/icon_systemsettings" | |||
android:layout_height="40dp"/> | |||
<TextView | |||
android:id="@+id/tv_title4" | |||
android:layout_width="match_parent" | |||
android:text="PLC地址" | |||
android:textSize="28sp" | |||
android:textColor="@drawable/selector_bop_bar_textcolor" | |||
android:gravity="center" | |||
android:layout_height="match_parent"/> | |||
</LinearLayout> | |||
</LinearLayout> | |||
<com.qmuiteam.qmui.widget.QMUIViewPager | |||
android:id="@+id/viewpager" | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/navigation" | |||
app:layout_constraintTop_toBottomOf="@id/ll_top_bar" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:visibility="gone" | |||
android:background="?attr/app_content_bg_color" /> | |||
@@ -84,7 +187,7 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/ll_top_bar" | |||
android:focusableInTouchMode="true" | |||
android:background="#90BEAA6A"> | |||
<LinearLayout | |||
@@ -206,7 +206,7 @@ | |||
android:textSize="32sp" | |||
android:maxLines="2" | |||
android:ellipsize="end" | |||
android:text="烤箱温度:" | |||
android:text="温度位置:" | |||
android:textColor="@color/black" | |||
/> | |||
@@ -24,7 +24,7 @@ | |||
<include | |||
android:id="@+id/content2" | |||
android:layout_width="1800dp" | |||
android:layout_height="980dp" | |||
android:layout_height="900dp" | |||
layout="@layout/layout_root_tip2" | |||
android:visibility="gone" | |||
/> | |||
@@ -6,12 +6,13 @@ | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
android:background="@color/transparent" | |||
tools:layout_height="1008dp" | |||
android:layout_height="wrap_content"> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:background="@drawable/bg_round25_white" | |||
android:layout_width="1800dp" | |||
android:layout_height="980dp"> | |||
android:layout_height="900dp"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
@@ -415,7 +416,7 @@ | |||
app:layout_constraintEnd_toEndOf="parent" | |||
android:layout_height="100dp" | |||
android:layout_marginBottom="20dp" | |||
android:layout_marginEnd="50dp" | |||
android:layout_marginEnd="200dp" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_last" | |||
@@ -427,7 +428,7 @@ | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
app:layout_constraintStart_toStartOf="parent" | |||
android:layout_marginStart="50dp" | |||
android:layout_marginStart="200dp" | |||
android:layout_height="100dp" | |||
android:layout_marginBottom="20dp" | |||
/> | |||