Commit 42b4f006 authored by 姜天宇's avatar 姜天宇

feat(v1.0.2): 增加系统信息页

parent 719611fb
...@@ -11,8 +11,8 @@ android { ...@@ -11,8 +11,8 @@ android {
applicationId "com.wmdigit.cateringdetect" applicationId "com.wmdigit.cateringdetect"
minSdk 24 minSdk 24
targetSdk 33 targetSdk 33
versionCode 1000100 versionCode 1000200
versionName "1.0.1" versionName "v1.0.2"
ndk { ndk {
abiFilters 'armeabi-v7a' abiFilters 'armeabi-v7a'
...@@ -64,6 +64,7 @@ dependencies { ...@@ -64,6 +64,7 @@ dependencies {
implementation project(path: ':common') implementation project(path: ':common')
implementation project(path: ':core') implementation project(path: ':core')
implementation project(path: ':module-demo') implementation project(path: ':module-demo')
implementation project(path: ':module-setting')
implementation project(path: ':data-local') implementation project(path: ':data-local')
implementation 'com.alibaba:arouter-api:1.5.2' implementation 'com.alibaba:arouter-api:1.5.2'
......
...@@ -56,7 +56,7 @@ public class SplashActivity extends BaseMvvmActivity<SplashViewModel, ActivitySp ...@@ -56,7 +56,7 @@ public class SplashActivity extends BaseMvvmActivity<SplashViewModel, ActivitySp
mViewModel.grantedCameraPermission.observe(this, isGrand->{ mViewModel.grantedCameraPermission.observe(this, isGrand->{
if (isGrand){ if (isGrand){
// 已授权,跳转 // 已授权,跳转
routeToDemoActivity(); routeToSettingActivity();
} }
else{ else{
mViewModel.showToast(getString(R.string.please_granted_camera_permission)); mViewModel.showToast(getString(R.string.please_granted_camera_permission));
...@@ -121,6 +121,14 @@ public class SplashActivity extends BaseMvvmActivity<SplashViewModel, ActivitySp ...@@ -121,6 +121,14 @@ public class SplashActivity extends BaseMvvmActivity<SplashViewModel, ActivitySp
finish(); finish();
} }
/**
* 跳转到设置页
*/
private void routeToSettingActivity(){
ARouter.getInstance().build(RouteConstant.ROUTE_SETTING).navigation();
finish();
}
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
......
...@@ -81,4 +81,6 @@ dependencies { ...@@ -81,4 +81,6 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
api 'com.squareup.picasso:picasso:2.71828' api 'com.squareup.picasso:picasso:2.71828'
// 抽屉
api 'androidx.drawerlayout:drawerlayout:1.2.0'
} }
\ No newline at end of file
package com.wmdigit.common.adapter;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.wmdigit.common.R;
import com.wmdigit.common.adapter.diffutils.DrawerMenuDiffUtils;
import com.wmdigit.common.base.adapter.BaseDiffRecyclerViewAdapter;
import com.wmdigit.common.base.viewholder.BaseViewHolder;
import com.wmdigit.common.model.DrawerMenuItemModel;
import java.util.List;
/**
* 抽屉菜单适配器
* @author dizi
*/
public class DrawerMenuAdapter extends BaseDiffRecyclerViewAdapter<DrawerMenuAdapter.DrawerMenuViewHolder, DrawerMenuItemModel, DrawerMenuDiffUtils> {
public DrawerMenuAdapter(Context mContext, List<DrawerMenuItemModel> mList) {
super(mContext, mList);
}
@Override
protected DrawerMenuDiffUtils createDiffUtil(List oldList, List newList) {
return new DrawerMenuDiffUtils(oldList, newList);
}
@Override
protected int getItemLayoutResId() {
return R.layout.item_navi_menu;
}
@Override
protected DrawerMenuViewHolder createViewHolder(View itemView, BaseViewHolder.OnItemClickListener onItemClickListener) {
return new DrawerMenuViewHolder(itemView, onItemClickListener);
}
public static class DrawerMenuViewHolder extends BaseViewHolder<DrawerMenuItemModel> {
private ImageView imgMenu;
private TextView tvTitle;
private ConstraintLayout rootView;
public DrawerMenuViewHolder(@NonNull View itemView, OnItemClickListener itemListener) {
super(itemView, itemListener);
imgMenu = itemView.findViewById(R.id.img_menu);
tvTitle = itemView.findViewById(R.id.tv_menu_title);
rootView = (ConstraintLayout) (imgMenu.getParent());
}
@Override
public void bind(DrawerMenuItemModel item) {
if (item.isChecked()){
// 被选中
rootView.setBackgroundResource(R.drawable.sel_rect_10_orange_gray);
}
else{
// 未被选中
rootView.setBackgroundResource(R.drawable.sel_rect_10_green_gray);
}
// 加载图片
imgMenu.setImageResource(item.getIconResId());
// 设置标题
tvTitle.setText(item.getTitle());
}
}
}
package com.wmdigit.common.adapter.diffutils;
import com.wmdigit.common.base.diffutil.BaseDiffUtil;
import com.wmdigit.common.model.DrawerMenuItemModel;
import java.util.List;
/**
* 抽屉菜单差异比较器
* @author dizi
*/
public class DrawerMenuDiffUtils extends BaseDiffUtil<DrawerMenuItemModel> {
public DrawerMenuDiffUtils(List<DrawerMenuItemModel> oldList, List<DrawerMenuItemModel> newList) {
super(oldList, newList);
}
@Override
protected boolean checkContentsTheSame(DrawerMenuItemModel oldItem, DrawerMenuItemModel newItem) {
if (oldItem.isChecked() != newItem.isChecked()){
return false;
}
return true;
}
}
package com.wmdigit.common.base.adapter;
import android.content.Context;
import androidx.recyclerview.widget.DiffUtil;
import com.wmdigit.common.base.diffutil.BaseDiffUtil;
import com.wmdigit.common.base.diffutil.BaseDiffUtilModel;
import com.wmdigit.common.base.viewholder.BaseViewHolder;
import com.wmdigit.common.utils.CloneUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 带有数据比较器的RecyclerView适配器
* @author dizi
*/
public abstract class BaseDiffRecyclerViewAdapter<VH extends BaseViewHolder<T>, T extends BaseDiffUtilModel, DF extends BaseDiffUtil<T>> extends BaseRecyclerViewAdapter<VH, T>{
/**
* 旧的数据源
*/
private final List<T> mOldList;
public BaseDiffRecyclerViewAdapter(Context mContext, List<T> mList) {
super(mContext, mList);
mOldList = new ArrayList<>();
}
/**
* 比较新旧数据源并且刷新UI
*/
public void diffAndUpdate(){
// 比较新旧数据差异
DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(createDiffUtil(mOldList, mList));
// 通知更新
diffResult.dispatchUpdatesTo(this);
// 清空旧数据源
mOldList.clear();
// 将新数据源拷贝给旧数据源
for (T t : mList){
mOldList.add(CloneUtils.clone(t));
}
}
/**
* 创建
* @param oldList
* @param newList
* @return
*/
protected abstract DF createDiffUtil(List<T> oldList, List<T> newList);
}
package com.wmdigit.common.base.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.wmdigit.common.base.viewholder.BaseViewHolder;
import java.util.List;
/**
* 基础列表适配器
* @author dizi
*/
public abstract class BaseRecyclerViewAdapter<VH extends BaseViewHolder<T>, T> extends RecyclerView.Adapter<VH> {
protected Context mContext;
/**
* 数据源
*/
protected List<T> mList;
/**
* item点击事件
*/
protected BaseViewHolder.OnItemClickListener mOnItemClickListener;
public BaseRecyclerViewAdapter(Context mContext, List<T> mList) {
this.mContext = mContext;
this.mList = mList;
}
public void setOnItemClickListener(BaseViewHolder.OnItemClickListener mOnItemClickListener) {
this.mOnItemClickListener = mOnItemClickListener;
}
@NonNull
@Override
public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(mContext).inflate(getItemLayoutResId(), parent, false);
return createViewHolder(itemView, mOnItemClickListener);
}
@Override
public void onBindViewHolder(@NonNull VH holder, int position) {
T item = mList.get(position);
holder.bind(item);
}
@Override
public int getItemCount() {
if (mList == null) {
return 0;
}
else{
return mList.size();
}
}
/**
* 获取item的布局ID
* @return
*/
protected abstract int getItemLayoutResId();
/**
* 由子类new出ViewHolder
* @param itemView
* @param onItemClickListener
* @return
*/
protected abstract VH createViewHolder(View itemView, BaseViewHolder.OnItemClickListener onItemClickListener);
}
package com.wmdigit.common.base.mvvm; package com.wmdigit.common.base.mvvm;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.databinding.ViewDataBinding; import androidx.databinding.ViewDataBinding;
import androidx.navigation.NavController; import androidx.navigation.NavController;
import androidx.navigation.NavDestination;
import androidx.navigation.NavGraph;
import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.fragment.NavHostFragment;
import com.wmdigit.common.R;
/** /**
* MVVM框架带导航的Activity * MVVM框架带导航的Activity基类
* @author dizi * @author dizi
*/ */
public abstract class BaseMvvmNaviActivity<VM extends BaseViewModel, DB extends ViewDataBinding> extends BaseMvvmActivity<VM, DB>{ public abstract class BaseMvvmNaviActivity<VM extends BaseViewModel, DB extends ViewDataBinding> extends BaseMvvmActivity<VM, DB>{
protected NavHostFragment navHostFragment; /**
protected NavController navController; * 顶部标题栏
*/
protected Toolbar mToolbar;
protected NavHostFragment mNavHostFragment;
protected NavController mNavController;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
initToolbar();
initNavigation(); initNavigation();
} }
/**
* 初始化Toolbar
*/
private void initToolbar() {
mToolbar = getToolbar();
setSupportActionBar(mToolbar);
}
/** /**
* 获取FragmentContainerView的ID * 获取FragmentContainerView的ID
* @return * @return
*/ */
protected abstract int getFragmentContainerViewId(); protected abstract int getFragmentContainerViewId();
/**
* 获取Toolbar
* @return
*/
protected abstract Toolbar getToolbar();
/**
* 获取Toolbar菜单的资源ID
* @return
*/
protected abstract int getToolbarMenuResId();
private void initNavigation(){ private void initNavigation(){
navHostFragment = (NavHostFragment) getSupportFragmentManager().findFragmentById(getFragmentContainerViewId()); mNavHostFragment = (NavHostFragment) getSupportFragmentManager().findFragmentById(getFragmentContainerViewId());
assert navHostFragment != null; assert mNavHostFragment != null;
navController = navHostFragment.getNavController(); mNavController = mNavHostFragment.getNavController();
} }
/** /**
* 导航到上一页 * 导航到上一页
*/ */
protected void navigationUp(){ protected void navigationUp(){
if (navController != null){ if (mNavController != null){
navController.navigateUp(); mNavController.navigateUp();
} }
} }
...@@ -50,9 +78,25 @@ public abstract class BaseMvvmNaviActivity<VM extends BaseViewModel, DB extends ...@@ -50,9 +78,25 @@ public abstract class BaseMvvmNaviActivity<VM extends BaseViewModel, DB extends
* 导航到下一页 * 导航到下一页
*/ */
protected void navigation(int destinationId){ protected void navigation(int destinationId){
if (navController != null) { if (mNavController != null) {
navController.navigate(destinationId); mNavController.navigate(destinationId);
} }
} }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// 设置toolbar右侧按钮
getMenuInflater().inflate(getToolbarMenuResId(), menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.toolbar_close){
// 二次确认退出
confirmQuit();
return true;
}
return super.onOptionsItemSelected(item);
}
} }
package com.wmdigit.common.base.mvvm;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.GravityCompat;
import androidx.databinding.ViewDataBinding;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.wmdigit.common.adapter.DrawerMenuAdapter;
import com.wmdigit.common.model.DrawerMenuItemModel;
import java.util.List;
/**
* MVVM框架导航带抽屉的Activity基类
* @author dizi
*/
public abstract class BaseMvvmNaviDrawerActivity<VM extends BaseViewModel, DB extends ViewDataBinding> extends BaseMvvmNaviActivity<VM, DB>{
/**
* 抽屉布局
*/
protected DrawerLayout mDrawerLayout;
/**
* 抽屉菜单
*/
protected RecyclerView mDrawerMenu;
/**
* 抽屉菜单适配器
*/
protected DrawerMenuAdapter mDrawerMenuAdapter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 初始化抽屉
initDrawer();
// 初始化抽屉菜单列表
initDrawerMenu();
// 抽屉列表增加按键监听
initDrawerMenuListener();
}
/**
* 导航菜单列表增加监听
*/
private void initDrawerMenuListener() {
mDrawerMenuAdapter.setOnItemClickListener(position -> {
onDrawerMenuItemClickListener(position);
// 通知菜单刷新
mDrawerMenuAdapter.diffAndUpdate();
});
}
/**
* 初始化抽屉
*/
private void initDrawer() {
mDrawerLayout = getDrawerLayout();
mDrawerMenu = getDrawerMenu();
// 设置抽屉遮盖层透明
mDrawerLayout.setScrimColor(getResources().getColor(android.R.color.transparent));
// 关闭手势滑动
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
// 显示HOME键
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// 设置图标
getSupportActionBar().setHomeAsUpIndicator(com.wmdigit.common.R.drawable.ic_drawer_close);
// 抽屉设置状态监听
mDrawerLayout.addDrawerListener(new DrawerLayout.SimpleDrawerListener() {
@Override
public void onDrawerOpened(@NonNull View drawerView) {
super.onDrawerOpened(drawerView);
// 抽屉开启后
getSupportActionBar().setHomeAsUpIndicator(com.wmdigit.common.R.drawable.ic_drawer_close);
}
@Override
public void onDrawerClosed(@NonNull View drawerView) {
super.onDrawerClosed(drawerView);
// 抽屉关闭后
getSupportActionBar().setHomeAsUpIndicator(com.wmdigit.common.R.drawable.ic_drawer_open);
}
});
}
/**
* 初始化抽屉菜单
*/
private void initDrawerMenu() {
mDrawerMenuAdapter = new DrawerMenuAdapter(this, getMenuData());
mDrawerMenu.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mDrawerMenu.setAdapter(mDrawerMenuAdapter);
mDrawerMenu.setItemAnimator(null);
}
/**
* 获取菜单数据
* @return
*/
protected abstract List<DrawerMenuItemModel> getMenuData();
/**
* 获取DrawerLayout,一般是根布局
* @return
*/
protected abstract DrawerLayout getDrawerLayout();
/**
* 获取抽屉菜单的ID
* @return
*/
protected abstract RecyclerView getDrawerMenu();
/**
* 是否允许关闭抽屉
* @return
*/
protected abstract boolean allowCloseDrawer();
/**
* 抽屉菜单Item点击事件
* @param position
*/
protected abstract void onDrawerMenuItemClickListener(int position);
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home){
// HOME点击事件
if (mDrawerLayout.isOpen() && allowCloseDrawer()) {
// 关闭抽屉
mDrawerLayout.closeDrawer(GravityCompat.START);
} else {
// 打开抽屉
mDrawerLayout.openDrawer(GravityCompat.START);
}
}
return super.onOptionsItemSelected(item);
}
}
...@@ -37,7 +37,7 @@ public abstract class BaseViewHolder<T> extends RecyclerView.ViewHolder implemen ...@@ -37,7 +37,7 @@ public abstract class BaseViewHolder<T> extends RecyclerView.ViewHolder implemen
* 数据绑定方法 * 数据绑定方法
* @param item * @param item
*/ */
protected abstract void bind(T item); public abstract void bind(T item);
public interface OnItemClickListener{ public interface OnItemClickListener{
/** /**
......
...@@ -11,9 +11,13 @@ public class RouteConstant { ...@@ -11,9 +11,13 @@ public class RouteConstant {
*/ */
public static final String ROUTE_SPLASH = "/app/splash"; public static final String ROUTE_SPLASH = "/app/splash";
/** /**
* module-home模块下主页 * module-demo模块下主页
*/ */
public static final String ROUTE_DEMO = "/module/demo"; public static final String ROUTE_DEMO = "/module_demo/demo";
/**
* module-setting模块下主页
*/
public static final String ROUTE_SETTING = "/module_setting/setting";
} }
......
package com.wmdigit.common.model;
import com.wmdigit.common.base.diffutil.BaseDiffUtilModel;
/**
* 导航菜单Item
* @author dizi
*/
public class DrawerMenuItemModel extends BaseDiffUtilModel {
/**
* 图标资源ID
*/
private int iconResId;
/**
* 标题
*/
private String title;
/**
* 是否选中
*/
private boolean isChecked = false;
public DrawerMenuItemModel(int iconResId, String title, boolean isChecked) {
this.iconResId = iconResId;
this.title = title;
this.isChecked = isChecked;
}
public int getIconResId() {
return iconResId;
}
public void setIconResId(int iconResId) {
this.iconResId = iconResId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean isChecked() {
return isChecked;
}
public void setChecked(boolean checked) {
isChecked = checked;
}
}
package com.wmdigit.common.utils;
import android.content.Context;
import android.net.TrafficStats;
import com.elvishew.xlog.XLog;
/**
* 带宽统计工具
* @author dizi
*/
public class BandwidthStatisticsHelper {
private long startTime = 0L;
/**
* 接收流量
*/
private long startRxBytes = 0L;
/**
* 发送流量
*/
private long startTxBytes = 0L;
private int uid;
public BandwidthStatisticsHelper(Context context) {
uid = context.getApplicationInfo().uid;
}
public void start(){
XLog.i("统计开始");
startTime = System.currentTimeMillis();
startRxBytes = TrafficStats.getUidRxBytes(uid);
startTxBytes = TrafficStats.getUidTxBytes(uid);
}
public void stop(){
XLog.i("统计结束");
long endTime = System.currentTimeMillis();
long endRxBytes = TrafficStats.getUidRxBytes(uid);
long endTxBytes = TrafficStats.getUidTxBytes(uid);
// 计算差值
long deltaRxBytes = endRxBytes - startRxBytes;
long deltaTxBytes = endTxBytes - startTxBytes;
// 计算时间间隔(秒)
long deltaTime = (endTime - startTime) / 1000;
// 计算带宽(单位可以是bps或Mbps,此处以Mbps为例)
double downloadBandwidthMbps = (deltaRxBytes * 8.0) / (deltaTime * 1024 * 1024);
double uploadBandwidthMbps = (deltaTxBytes * 8.0) / (deltaTime * 1024 * 1024);
XLog.i("接收总流量:%s bytes, 上传总流量:%s bytes", deltaRxBytes, deltaTxBytes);
}
}
package com.wmdigit.common.utils;
import static android.Manifest.permission.ACCESS_WIFI_STATE;
import static android.Manifest.permission.CHANGE_WIFI_STATE;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Configuration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.provider.Settings;
import android.text.TextUtils;
import android.view.InputDevice;
import android.view.KeyEvent;
import androidx.annotation.RequiresPermission;
import com.elvishew.xlog.XLog;
import com.wmdigit.common.CommonModule;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
public final class DeviceUtils {
/**
* 检测输入设备是否是扫码器
*
* @param context
* @return 是的话返回true,否则返回false
*/
public static boolean isInputFromScanner(Context context, KeyEvent event) {
if (event.getDevice() == null) {
return false;
}
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK || event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN || event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP) {
//实体按键,若按键为返回、音量加减、返回false
return false;
}
if (event.getDevice().getSources() == (InputDevice.SOURCE_KEYBOARD | InputDevice.SOURCE_DPAD | InputDevice.SOURCE_CLASS_BUTTON)) {
//虚拟按键返回false
return false;
}
Configuration cfg = context.getResources().getConfiguration();
return cfg.keyboard != Configuration.KEYBOARD_UNDEFINED;
}
/**
* 获取AndroidID
* @return
*/
public static String getAndroidId() {
String androidId = "";
try {
androidId = Settings.System.getString(CommonModule.getAppContext().getContentResolver(), Settings.Secure.ANDROID_ID);
}
catch (Exception e){
XLog.e(e.toString());
androidId = "";
}
return androidId;
}
private static boolean getWifiEnabled() {
@SuppressLint("WifiManagerLeak")
WifiManager manager = (WifiManager) CommonModule.getAppContext().getSystemService(Context.WIFI_SERVICE);
if (manager == null) {
return false;
}
return manager.isWifiEnabled();
}
/**
* Enable or disable wifi.
* <p>Must hold {@code <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />}</p>
*
* @param enabled True to enabled, false otherwise.
*/
@RequiresPermission(CHANGE_WIFI_STATE)
private static void setWifiEnabled(final boolean enabled) {
@SuppressLint("WifiManagerLeak")
WifiManager manager = (WifiManager) CommonModule.getAppContext().getSystemService(Context.WIFI_SERVICE);
if (manager == null) {
return;
}
if (enabled == manager.isWifiEnabled()) {
return;
}
manager.setWifiEnabled(enabled);
}
/**
* 取本机IP地址
*
* @return
*/
public static String getLocalIpAddress() {
try {
for (Enumeration<NetworkInterface> enNetI = NetworkInterface
.getNetworkInterfaces(); enNetI.hasMoreElements(); ) {
NetworkInterface netI = enNetI.nextElement();
if (netI.getDisplayName().equals("wlan0") || netI.getDisplayName().equals("eth0")) {
for (Enumeration<InetAddress> enumIpAddr = netI
.getInetAddresses(); enumIpAddr.hasMoreElements(); ) {
InetAddress inetAddress = enumIpAddr.nextElement();
if (inetAddress instanceof Inet4Address && !inetAddress.isLoopbackAddress()) {
return inetAddress.getHostAddress();
}
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return "";
}
}
package com.wmdigit.common.view.drawerlayout;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.drawerlayout.widget.DrawerLayout;
/**
* 不抢占主布局焦点的抽屉菜单
* @author dizi
*/
public class NoFocusDrawerLayout extends DrawerLayout {
public NoFocusDrawerLayout(@NonNull Context context) {
super(context);
}
public NoFocusDrawerLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public NoFocusDrawerLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return false;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
return false;
}
}
...@@ -35,21 +35,11 @@ public abstract class BasePopupWindow extends PopupWindow implements PopupWindow ...@@ -35,21 +35,11 @@ public abstract class BasePopupWindow extends PopupWindow implements PopupWindow
initView(); initView();
initData(); initData();
initListener(); initListener();
} getContentView().setSystemUiVisibility(FULL_SCREEN_FLAG);
protected void addShadow(Activity activity) {
// WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
// lp.alpha = 0.2f;
// activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
// activity.getWindow().setAttributes(lp);
} }
@Override @Override
public void onDismiss() { public void onDismiss() {
// WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes();
// lp.alpha = 1.0f;
// getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
// getActivity().getWindow().setAttributes(lp);
} }
/** /**
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_10"/>
<solid android:color="@color/green_008e75"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_180"
android:layout_height="@dimen/dp_172"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/sel_rect_10_green_gray"
android:layout_marginHorizontal="@dimen/dp_20"
android:layout_marginVertical="@dimen/dp_10">
<!--图片-->
<ImageView
android:id="@+id/img_menu"
android:layout_width="@dimen/dp_90"
android:layout_height="@dimen/dp_90"
android:adjustViewBounds="true"
android:layout_marginTop="@dimen/dp_26"
android:padding="@dimen/dp_10"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<!--标题-->
<TextView
android:id="@+id/tv_menu_title"
style="@style/text_base.content"
android:textColor="@color/white"
android:layout_marginTop="@dimen/dp_10"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/img_menu"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/toolbar_close"
android:title="@string/close"
app:showAsAction="always"
/>
</menu>
\ No newline at end of file
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">436.1481dp</dimen> <dimen name="dp_460">436.1481dp</dimen>
<dimen name="dp_472">447.5259dp</dimen> <dimen name="dp_472">447.5259dp</dimen>
<dimen name="dp_480">455.1111dp</dimen> <dimen name="dp_480">455.1111dp</dimen>
<dimen name="dp_492">466.4889dp</dimen>
<dimen name="dp_500">474.0741dp</dimen> <dimen name="dp_500">474.0741dp</dimen>
<dimen name="dp_590">559.4074dp</dimen> <dimen name="dp_590">559.4074dp</dimen>
<dimen name="dp_600">568.8889dp</dimen> <dimen name="dp_600">568.8889dp</dimen>
......
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">460.0000dp</dimen> <dimen name="dp_460">460.0000dp</dimen>
<dimen name="dp_472">472.0000dp</dimen> <dimen name="dp_472">472.0000dp</dimen>
<dimen name="dp_480">480.0000dp</dimen> <dimen name="dp_480">480.0000dp</dimen>
<dimen name="dp_492">492.0000dp</dimen>
<dimen name="dp_500">500.0000dp</dimen> <dimen name="dp_500">500.0000dp</dimen>
<dimen name="dp_590">590.0000dp</dimen> <dimen name="dp_590">590.0000dp</dimen>
<dimen name="dp_600">600.0000dp</dimen> <dimen name="dp_600">600.0000dp</dimen>
......
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">545.1852dp</dimen> <dimen name="dp_460">545.1852dp</dimen>
<dimen name="dp_472">559.4074dp</dimen> <dimen name="dp_472">559.4074dp</dimen>
<dimen name="dp_480">568.8889dp</dimen> <dimen name="dp_480">568.8889dp</dimen>
<dimen name="dp_492">583.1111dp</dimen>
<dimen name="dp_500">592.5926dp</dimen> <dimen name="dp_500">592.5926dp</dimen>
<dimen name="dp_590">699.2593dp</dimen> <dimen name="dp_590">699.2593dp</dimen>
<dimen name="dp_600">711.1111dp</dimen> <dimen name="dp_600">711.1111dp</dimen>
......
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">581.3889dp</dimen> <dimen name="dp_460">581.3889dp</dimen>
<dimen name="dp_472">596.5556dp</dimen> <dimen name="dp_472">596.5556dp</dimen>
<dimen name="dp_480">606.6667dp</dimen> <dimen name="dp_480">606.6667dp</dimen>
<dimen name="dp_492">621.8333dp</dimen>
<dimen name="dp_500">631.9444dp</dimen> <dimen name="dp_500">631.9444dp</dimen>
<dimen name="dp_590">745.6944dp</dimen> <dimen name="dp_590">745.6944dp</dimen>
<dimen name="dp_600">758.3333dp</dimen> <dimen name="dp_600">758.3333dp</dimen>
......
This diff is collapsed.
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">136.2963dp</dimen> <dimen name="dp_460">136.2963dp</dimen>
<dimen name="dp_472">139.8519dp</dimen> <dimen name="dp_472">139.8519dp</dimen>
<dimen name="dp_480">142.2222dp</dimen> <dimen name="dp_480">142.2222dp</dimen>
<dimen name="dp_492">145.7778dp</dimen>
<dimen name="dp_500">148.1481dp</dimen> <dimen name="dp_500">148.1481dp</dimen>
<dimen name="dp_590">174.8148dp</dimen> <dimen name="dp_590">174.8148dp</dimen>
<dimen name="dp_600">177.7778dp</dimen> <dimen name="dp_600">177.7778dp</dimen>
......
This diff is collapsed.
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">166.9630dp</dimen> <dimen name="dp_460">166.9630dp</dimen>
<dimen name="dp_472">171.3185dp</dimen> <dimen name="dp_472">171.3185dp</dimen>
<dimen name="dp_480">174.2222dp</dimen> <dimen name="dp_480">174.2222dp</dimen>
<dimen name="dp_492">178.5778dp</dimen>
<dimen name="dp_500">181.4815dp</dimen> <dimen name="dp_500">181.4815dp</dimen>
<dimen name="dp_590">214.1481dp</dimen> <dimen name="dp_590">214.1481dp</dimen>
<dimen name="dp_600">217.7778dp</dimen> <dimen name="dp_600">217.7778dp</dimen>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">204.4444dp</dimen> <dimen name="dp_460">204.4444dp</dimen>
<dimen name="dp_472">209.7778dp</dimen> <dimen name="dp_472">209.7778dp</dimen>
<dimen name="dp_480">213.3333dp</dimen> <dimen name="dp_480">213.3333dp</dimen>
<dimen name="dp_492">218.6667dp</dimen>
<dimen name="dp_500">222.2222dp</dimen> <dimen name="dp_500">222.2222dp</dimen>
<dimen name="dp_590">262.2222dp</dimen> <dimen name="dp_590">262.2222dp</dimen>
<dimen name="dp_600">266.6667dp</dimen> <dimen name="dp_600">266.6667dp</dimen>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">272.5926dp</dimen> <dimen name="dp_460">272.5926dp</dimen>
<dimen name="dp_472">279.7037dp</dimen> <dimen name="dp_472">279.7037dp</dimen>
<dimen name="dp_480">284.4444dp</dimen> <dimen name="dp_480">284.4444dp</dimen>
<dimen name="dp_492">291.5556dp</dimen>
<dimen name="dp_500">296.2963dp</dimen> <dimen name="dp_500">296.2963dp</dimen>
<dimen name="dp_590">349.6296dp</dimen> <dimen name="dp_590">349.6296dp</dimen>
<dimen name="dp_600">355.5556dp</dimen> <dimen name="dp_600">355.5556dp</dimen>
......
This diff is collapsed.
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">306.6667dp</dimen> <dimen name="dp_460">306.6667dp</dimen>
<dimen name="dp_472">314.6667dp</dimen> <dimen name="dp_472">314.6667dp</dimen>
<dimen name="dp_480">320.0000dp</dimen> <dimen name="dp_480">320.0000dp</dimen>
<dimen name="dp_492">328.0000dp</dimen>
<dimen name="dp_500">333.3333dp</dimen> <dimen name="dp_500">333.3333dp</dimen>
<dimen name="dp_590">393.3333dp</dimen> <dimen name="dp_590">393.3333dp</dimen>
<dimen name="dp_600">400.0000dp</dimen> <dimen name="dp_600">400.0000dp</dimen>
......
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">327.1111dp</dimen> <dimen name="dp_460">327.1111dp</dimen>
<dimen name="dp_472">335.6444dp</dimen> <dimen name="dp_472">335.6444dp</dimen>
<dimen name="dp_480">341.3333dp</dimen> <dimen name="dp_480">341.3333dp</dimen>
<dimen name="dp_492">349.8667dp</dimen>
<dimen name="dp_500">355.5556dp</dimen> <dimen name="dp_500">355.5556dp</dimen>
<dimen name="dp_590">419.5556dp</dimen> <dimen name="dp_590">419.5556dp</dimen>
<dimen name="dp_600">426.6667dp</dimen> <dimen name="dp_600">426.6667dp</dimen>
......
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">340.7407dp</dimen> <dimen name="dp_460">340.7407dp</dimen>
<dimen name="dp_472">349.6296dp</dimen> <dimen name="dp_472">349.6296dp</dimen>
<dimen name="dp_480">355.5556dp</dimen> <dimen name="dp_480">355.5556dp</dimen>
<dimen name="dp_492">364.4444dp</dimen>
<dimen name="dp_500">370.3704dp</dimen> <dimen name="dp_500">370.3704dp</dimen>
<dimen name="dp_590">437.0370dp</dimen> <dimen name="dp_590">437.0370dp</dimen>
<dimen name="dp_600">444.4444dp</dimen> <dimen name="dp_600">444.4444dp</dimen>
......
This diff is collapsed.
This diff is collapsed.
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">383.3333dp</dimen> <dimen name="dp_460">383.3333dp</dimen>
<dimen name="dp_472">393.3333dp</dimen> <dimen name="dp_472">393.3333dp</dimen>
<dimen name="dp_480">400.0000dp</dimen> <dimen name="dp_480">400.0000dp</dimen>
<dimen name="dp_492">410.0000dp</dimen>
<dimen name="dp_500">416.6667dp</dimen> <dimen name="dp_500">416.6667dp</dimen>
<dimen name="dp_590">491.6667dp</dimen> <dimen name="dp_590">491.6667dp</dimen>
<dimen name="dp_600">500.0000dp</dimen> <dimen name="dp_600">500.0000dp</dimen>
......
...@@ -388,6 +388,7 @@ ...@@ -388,6 +388,7 @@
<dimen name="dp_460">408.8889dp</dimen> <dimen name="dp_460">408.8889dp</dimen>
<dimen name="dp_472">419.5556dp</dimen> <dimen name="dp_472">419.5556dp</dimen>
<dimen name="dp_480">426.6667dp</dimen> <dimen name="dp_480">426.6667dp</dimen>
<dimen name="dp_492">437.3333dp</dimen>
<dimen name="dp_500">444.4444dp</dimen> <dimen name="dp_500">444.4444dp</dimen>
<dimen name="dp_590">524.4444dp</dimen> <dimen name="dp_590">524.4444dp</dimen>
<dimen name="dp_600">533.3333dp</dimen> <dimen name="dp_600">533.3333dp</dimen>
......
This diff is collapsed.
...@@ -390,6 +390,7 @@ ...@@ -390,6 +390,7 @@
<dimen name="dp_460">460dp</dimen> <dimen name="dp_460">460dp</dimen>
<dimen name="dp_472">472dp</dimen> <dimen name="dp_472">472dp</dimen>
<dimen name="dp_480">480dp</dimen> <dimen name="dp_480">480dp</dimen>
<dimen name="dp_492">492dp</dimen>
<dimen name="dp_500">500dp</dimen> <dimen name="dp_500">500dp</dimen>
<dimen name="dp_590">590dp</dimen> <dimen name="dp_590">590dp</dimen>
<dimen name="dp_600">600dp</dimen> <dimen name="dp_600">600dp</dimen>
......
...@@ -10,6 +10,11 @@ ...@@ -10,6 +10,11 @@
<string name="operate">操作</string> <string name="operate">操作</string>
<string name="close">关闭</string> <string name="close">关闭</string>
<string name="symbol_rmb"></string> <string name="symbol_rmb"></string>
<string name="check_upgrade">检查更新</string>
<string name="activated">已激活</string>
<string name="not_active">未激活</string>
<string name="cropped">已标定</string>
<string name="not_crop">未标定</string>
<string name="please_confirm_whether_quit">请确认是否关闭页面</string> <string name="please_confirm_whether_quit">请确认是否关闭页面</string>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!--fragment根布局-->
<style name="fragment_root">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="android:background">@color/gray_d9d9d9</item>
<item name="android:paddingStart">@dimen/dp_240</item>
<item name="android:paddingEnd">@dimen/dp_20</item>
</style>
<!--设置模块-->
<style name="setting_module">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:background">@drawable/rect_10_white</item>
<item name="android:layout_marginTop">@dimen/dp_20</item>
<item name="android:padding">@dimen/dp_20</item>
</style>
<!--绿色标题图标-->
<style name="icon_title_green">
<item name="android:layout_width">@dimen/dp_8</item>
<item name="android:layout_height">@dimen/dp_20</item>
<item name="android:background">@drawable/rect_10_green</item>
</style>
<!--popupWindow左下取消按钮--> <!--popupWindow左下取消按钮-->
<style name="pop_window_lb_cancel_button"> <style name="pop_window_lb_cancel_button">
<item name="android:layout_width">0dp</item> <item name="android:layout_width">0dp</item>
...@@ -171,10 +196,10 @@ ...@@ -171,10 +196,10 @@
<item name="android:layout_width">0dp</item> <item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:background">@drawable/rect_4_gray</item> <item name="android:background">@drawable/rect_4_gray</item>
<item name="android:textSize">@dimen/sp_24</item> <item name="android:textSize">@dimen/sp_26</item>
<item name="android:textColor">@color/black</item> <item name="android:textColor">@color/black</item>
<item name="android:gravity">center|start</item> <item name="android:gravity">center|start</item>
<item name="android:paddingStart">@dimen/dp_10</item> <item name="android:paddingStart">@dimen/dp_14</item>
<item name="android:paddingTop">@dimen/dp_14</item> <item name="android:paddingTop">@dimen/dp_14</item>
<item name="android:paddingBottom">@dimen/dp_14</item> <item name="android:paddingBottom">@dimen/dp_14</item>
<item name="android:enabled">false</item> <item name="android:enabled">false</item>
...@@ -192,6 +217,11 @@ ...@@ -192,6 +217,11 @@
<item name="android:layout_width">@dimen/dp_400</item> <item name="android:layout_width">@dimen/dp_400</item>
</style> </style>
<!--EditText 宽度492dp-->
<style name="edittext_base.w492">
<item name="android:layout_width">@dimen/dp_492</item>
</style>
<!--EditText 宽度130dp--> <!--EditText 宽度130dp-->
<style name="edittext_base.w130"> <style name="edittext_base.w130">
<item name="android:layout_width">@dimen/dp_130</item> <item name="android:layout_width">@dimen/dp_130</item>
...@@ -226,6 +256,11 @@ ...@@ -226,6 +256,11 @@
<item name="singleLine">true</item> <item name="singleLine">true</item>
</style> </style>
<!--TextView 模块标题(前面带图标)-->
<style name="text_base.title.module_title">
<item name="android:layout_marginStart">@dimen/dp_14</item>
</style>
<!--TextView 角标--> <!--TextView 角标-->
<style name="text_base.subscript"> <style name="text_base.subscript">
<item name="android:textSize">@dimen/sp_22</item> <item name="android:textSize">@dimen/sp_22</item>
...@@ -316,5 +351,5 @@ ...@@ -316,5 +351,5 @@
<item name="android:layout_height">@dimen/dp_1</item> <item name="android:layout_height">@dimen/dp_1</item>
<item name="android:background">@color/gray_dfdfdf</item> <item name="android:background">@color/gray_dfdfdf</item>
</style> </style>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Theme.CateringDetect" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge" /> <style name="Theme.CateringDetect" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge" />
<!--Toolbar-->
<style name="ToolbarTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">?attr/actionBarSize</item>
<item name="android:background">@color/black_333b4b</item>
<item name="titleTextColor">?attr/colorOnPrimary</item>
<item name="theme">@style/ToolbarMenuTheme</item>
</style>
<!-- toolbar右侧菜单按钮字体样式 -->
<style name="ToolbarMenuTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar">
<item name="actionMenuTextColor">@color/white</item>
<item name="android:textSize">@dimen/sp_28</item>
</style>
<!--toolbar下拉菜单Style-->
<style name="OverflowMenuStyle" parent="@style/Widget.AppCompat.PopupMenu.Overflow">
<!-- 是否覆盖锚点,默认为true,即盖住Toolbar -->
<item name="overlapAnchor">false</item>
<item name="android:dropDownWidth">wrap_content</item>
<item name="android:paddingRight">0dp</item>
<!-- 弹出层背景颜色 -->
<!--<item name="android:background">@drawable/ic_menu_bg</item>-->
<!-- 弹出层垂直方向上的偏移,即在竖直方向上距离Toolbar的距离,值为负则会盖住Toolbar -->
<item name="android:dropDownVerticalOffset">0dp</item>
<!-- 弹出层水平方向上的偏移,即距离屏幕左边的距离,负值会导致右边出现空隙 -->
<item name="android:dropDownHorizontalOffset">0dp</item>
<!-- 设置弹出菜单文字颜色 -->
<item name="android:textColor">@color/white</item>
</style>
</resources> </resources>
\ No newline at end of file
...@@ -45,4 +45,6 @@ dependencies { ...@@ -45,4 +45,6 @@ dependencies {
testImplementation "androidx.room:room-testing:$room_version" testImplementation "androidx.room:room-testing:$room_version"
// optional - Paging 3 Integration // optional - Paging 3 Integration
implementation "androidx.room:room-paging:$room_version" implementation "androidx.room:room-paging:$room_version"
// mmkv
api 'com.tencent:mmkv:1.3.0'
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.wmdigit.data; ...@@ -2,6 +2,7 @@ package com.wmdigit.data;
import android.content.Context; import android.content.Context;
import com.tencent.mmkv.MMKV;
import com.wmdigit.data.database.AppDatabase; import com.wmdigit.data.database.AppDatabase;
/** /**
...@@ -16,6 +17,8 @@ public class LocalDataModule { ...@@ -16,6 +17,8 @@ public class LocalDataModule {
appContext = context.getApplicationContext(); appContext = context.getApplicationContext();
// 初始化数据库 // 初始化数据库
AppDatabase.getInstance(appContext); AppDatabase.getInstance(appContext);
// 初始化mmkv
MMKV.initialize(context);
} }
} }
......
package com.wmdigit.data.mmkv;
/**
* 存储MMKV主键
* @author dizi
*/
public class MmkvCons {
/**
* 是否激活,默认false
*/
public static final String MMKV_KEY_ACTIVATION = "MMKV_KEY_ACTIVATION";
/**
* 租户号
*/
public static final String MMKV_KEY_TENANT = "MMKV_KEY_TENANT";
/**
* 客户定义的设备编号
*/
public static final String MMKV_KEY_DEVICE_CODE = "MMKV_KEY_DEVICE_CODE";
/**
* 服务器生成的设备ID
*/
public static final String MMKV_KEY_DEVICE_ID = "MMKV_KEY_DEVICE_ID";
/**
* 激活密钥
*/
public static final String MMKV_KEY_SN_CODE = "MMKV_KEY_SN_CODE";
/**
* 裁剪框左偏移量
*/
public static final String MMKV_KEY_CROP_X = "MMKV_KEY_CROP_X";
/**
* 裁剪框上偏移量
*/
public static final String MMKV_KEY_CROP_Y = "MMKV_KEY_CROP_Y";
/**
* 裁剪框宽度
*/
public static final String MMKV_KEY_CROP_WIDTH = "MMKV_KEY_CROP_WIDTH";
/**
* 裁剪框高度
*/
public static final String MMKV_KEY_CROP_HEIGHT = "MMKV_KEY_CROP_HEIGHT";
}
v1.0.0 2024/07/18 1.演示Demo v1.0.0 2024/07/18 1.演示Demo
v1.0.1 2024/08/01 1.增加camerax v1.0.1 2024/08/01 1.增加camerax
2.增加3568视频流算法 2.增加3568视频流算法
\ No newline at end of file v1.0.2 2024/08/06 1.增加系统信息页
2.todo 增加设置-注册页
3.todo 对接注册、找回接口
4.todo 增加秤盘裁剪页
5.todo 增加AIDL服务
\ No newline at end of file
package com.wmdigit.cateringdetect.demo.ui; package com.wmdigit.cateringdetect.demo.ui;
import androidx.appcompat.widget.Toolbar;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
import com.wmdigit.cateringdetect.demo.R; import com.wmdigit.cateringdetect.demo.R;
import com.wmdigit.cateringdetect.demo.databinding.ActivityDemoBinding; import com.wmdigit.cateringdetect.demo.databinding.ActivityDemoBinding;
...@@ -47,4 +49,14 @@ public class DemoActivity extends BaseMvvmNaviActivity<DemoViewModel, ActivityDe ...@@ -47,4 +49,14 @@ public class DemoActivity extends BaseMvvmNaviActivity<DemoViewModel, ActivityDe
protected int getFragmentContainerViewId() { protected int getFragmentContainerViewId() {
return R.id.nav_host_fragment; return R.id.nav_host_fragment;
} }
@Override
protected Toolbar getToolbar() {
return null;
}
@Override
protected int getToolbarMenuResId() {
return 0;
}
} }
\ No newline at end of file
...@@ -67,7 +67,7 @@ public class DemoImagesAdapter extends RecyclerView.Adapter<DemoImagesAdapter.De ...@@ -67,7 +67,7 @@ public class DemoImagesAdapter extends RecyclerView.Adapter<DemoImagesAdapter.De
} }
@Override @Override
protected void bind(DemoImageItem item) { public void bind(DemoImageItem item) {
// 加载图片 // 加载图片
Picasso.get() Picasso.get()
.load(new File(item.getImagePath())) .load(new File(item.getImagePath()))
......
...@@ -90,7 +90,7 @@ public class ShoppingCartAdapter extends RecyclerView.Adapter<ShoppingCartAdapte ...@@ -90,7 +90,7 @@ public class ShoppingCartAdapter extends RecyclerView.Adapter<ShoppingCartAdapte
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
@Override @Override
protected void bind(ShoppingCartItem item) { public void bind(ShoppingCartItem item) {
tvProductName.setText(item.getProductName()); tvProductName.setText(item.getProductName());
tvUnitPrice.setText(itemView.getResources().getString(com.wmdigit.common.R.string.symbol_rmb) + item.getUnitPrice().setScale(2).toString()); tvUnitPrice.setText(itemView.getResources().getString(com.wmdigit.common.R.string.symbol_rmb) + item.getUnitPrice().setScale(2).toString());
tvQuantity.setText(item.getQuantity() + ""); tvQuantity.setText(item.getQuantity() + "");
......
/build
\ No newline at end of file
plugins {
id 'com.android.library'
}
android {
namespace 'com.wmdigit.setting'
compileSdk 33
// resourcePrefix "module_setting"
defaultConfig {
minSdk 24
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = [ AROUTER_MODULE_NAME : project.getName() ]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
dataBinding true
}
}
dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
implementation project(path: ':common')
implementation project(path: ':data-local')
implementation project(path: ':data-remote')
implementation project(path: ':camera')
implementation 'com.alibaba:arouter-api:1.5.2'
annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.CateringDetect">
<activity
android:name=".SettingActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.wmdigit.setting.fragment;
import android.graphics.Bitmap;
import com.elvishew.xlog.XLog;
import com.wmdigit.common.base.mvvm.BaseMvvmFragment;
import com.wmdigit.setting.R;
import com.wmdigit.setting.SettingActivity;
import com.wmdigit.setting.databinding.FragmentSystemInfoBinding;
import com.wmdigit.setting.viewmodel.SystemInfoViewModel;
/**
* 系统信息页
* @author dizi
*/
public class SystemInfoFragment extends BaseMvvmFragment<SystemInfoViewModel, FragmentSystemInfoBinding> {
@Override
protected int getLayoutId() {
return R.layout.fragment_system_info;
}
@Override
protected void initObserve() {
}
@Override
protected void initView() {
}
@Override
protected void initData() {
// 绑定ViewModel和DataBinding
mDataBinding.setViewModel(mViewModel);
}
@Override
protected void initListener() {
}
@Override
protected Class<SystemInfoViewModel> getViewModel() {
return SystemInfoViewModel.class;
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment