diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ee170c81..c135851e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,6 +8,7 @@ + @@ -29,6 +30,7 @@ android:label="@string/app_name" android:largeHeap="true" android:networkSecurityConfig="@xml/network_security_config" + android:requestLegacyExternalStorage="true" android:roundIcon="@mipmap/ico" android:supportsRtl="true" android:theme="@style/AppTheme" diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java index cc4e62e8..2f0fc356 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -277,6 +277,12 @@ public class ConfigData { case -204: ConfigName.getInstance().IsAutoInit = Boolean.parseBoolean(item.value); break; + case -205: + ConfigName.getInstance().silosAuto = Boolean.parseBoolean(item.value); + break; + case -206: + ConfigName.getInstance().silosNum = Integer.parseInt(item.value); + break; case 1: ConfigName.getInstance().Address = item.value; break; diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java index a1dd38de..2d01bd16 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -1585,7 +1585,9 @@ public class ExecuteTheRecipe { * 自提设备监听 */ public static void Listening() { - + if(ConfigName.getInstance().isPhoneVersion){ + return; + } ConfigName.getInstance().PLC_Address.clear(); ArrayList address = QueryDB.GetPlcaddressALL(); for (BPA_PLCADDRESS item : address) { @@ -1686,6 +1688,9 @@ public class ExecuteTheRecipe { * 主控设备监听 */ public static void MainListening() { + if(ConfigName.getInstance().isPhoneVersion){ + return; + } new Thread(new Runnable() { @Override public void run() { diff --git a/app/src/main/java/com/bonait/bnframework/business/MainInit.java b/app/src/main/java/com/bonait/bnframework/business/MainInit.java index cd19c7d5..bda2db13 100644 --- a/app/src/main/java/com/bonait/bnframework/business/MainInit.java +++ b/app/src/main/java/com/bonait/bnframework/business/MainInit.java @@ -76,6 +76,9 @@ public class MainInit { */ public static void Init(Application app) { + if(ConfigName.getInstance().isPhoneVersion){ + ConfigName.getInstance().scale = 1.5; + } //0.全局异常捕获,保存为SD卡本级目录 crash CrashHandler.getInstance().init(app); diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java index dade58b0..0880314e 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java @@ -2,6 +2,7 @@ package com.bonait.bnframework.common.constant; import android.app.Application; import android.content.Context; +import android.os.Environment; import android.widget.Switch; import com.bonait.bnframework.R; @@ -18,6 +19,7 @@ import com.bonait.bnframework.common.model.mode.ResALLData; import com.bonait.bnframework.common.model.mode.VersionSelectionEnum; import com.bonait.bnframework.common.utils.ScreenUtils; +import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.Dictionary; @@ -34,6 +36,8 @@ import java.util.concurrent.ConcurrentHashMap; public class ConfigName { public static boolean isTEST = false; public boolean is800WithFeeding = false;//是否是800带投料版 有5个投料位 + public boolean isPhoneVersion = true;//是否适配手机 + public double scale = 1; //region 单例模式 private static ConfigName mInstance; //实例变量设置私有,防止直接通过类名访问 @@ -142,6 +146,12 @@ public class ConfigName { */ public boolean IsAutoInit=true; + /** + * 是否动态配置料仓 + */ + public boolean silosAuto = false; + public int silosNum = 4; + /** * 设备id */ @@ -406,6 +416,14 @@ public class ConfigName { add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1)); add(new Res_PLCADDRESS("料仓4校准开关", "M13.5", 0, 1)); add(new Res_PLCADDRESS("料仓4校准值", "VW120", 1, 1)); + //todo + add(new Res_PLCADDRESS("料仓5校准开关", "M13.5", 0, 1)); + add(new Res_PLCADDRESS("料仓5校准值", "VW120", 1, 1)); + add(new Res_PLCADDRESS("料仓6校准开关", "M13.5", 0, 1)); + add(new Res_PLCADDRESS("料仓6校准值", "VW120", 1, 1)); + add(new Res_PLCADDRESS("料仓7校准开关", "M13.5", 0, 1)); + add(new Res_PLCADDRESS("料仓7校准值", "VW120", 1, 1)); + add(new Res_PLCADDRESS("开始校正", "M12.6", 0, 1)); add(new Res_PLCADDRESS("料仓自动", "-------------", 0, 0)); @@ -417,12 +435,24 @@ public class ConfigName { add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1)); add(new Res_PLCADDRESS("料仓4需求值", "VW122", 1, 1)); add(new Res_PLCADDRESS("料仓4下料", "M13.4", 0, 1)); + //todo + add(new Res_PLCADDRESS("料仓5需求值", "VW122", 1, 1)); + add(new Res_PLCADDRESS("料仓5下料", "M13.4", 0, 1)); + add(new Res_PLCADDRESS("料仓6需求值", "VW122", 1, 1)); + add(new Res_PLCADDRESS("料仓6下料", "M13.4", 0, 1)); + add(new Res_PLCADDRESS("料仓7需求值", "VW122", 1, 1)); + add(new Res_PLCADDRESS("料仓7下料", "M13.4", 0, 1)); add(new Res_PLCADDRESS("料仓手动", "-------------", 0, 0)); add(new Res_PLCADDRESS("料仓1手动开关", "M13.1", 1, 1)); add(new Res_PLCADDRESS("料仓2手动开关", "M13.2", 1, 1)); add(new Res_PLCADDRESS("料仓3手动开关", "M13.3", 1, 1)); add(new Res_PLCADDRESS("料仓4手动开关", "M10.7", 1, 1)); + //todo + add(new Res_PLCADDRESS("料仓5手动开关", "M13.3", 1, 1)); + add(new Res_PLCADDRESS("料仓6手动开关", "M10.7", 1, 1)); + add(new Res_PLCADDRESS("料仓7手动开关", "M13.3", 1, 1)); + //上下限 add(new Res_PLCADDRESS("位置上下限", "-------------", 0, 0)); add(new Res_PLCADDRESS("原点位置下限", "VD150", 1, 1)); @@ -474,6 +504,11 @@ public class ConfigName { add(new Res_PLCADDRESS("料仓2下料完成", "M41.3", 1, 0)); add(new Res_PLCADDRESS("料仓3下料完成", "M41.4", 1, 0)); add(new Res_PLCADDRESS("料仓4下料完成", "M42.0", 1, 0)); + //todo + add(new Res_PLCADDRESS("料仓5下料完成", "M42.0", 1, 0)); + add(new Res_PLCADDRESS("料仓6下料完成", "M42.0", 1, 0)); + add(new Res_PLCADDRESS("料仓7下料完成", "M42.0", 1, 0)); + add(new Res_PLCADDRESS("炒锅清洗反馈", "M41.5", 1, 0)); add(new Res_PLCADDRESS("出餐启动反馈", "M41.6", 1, 0)); add(new Res_PLCADDRESS("炒锅倒菜减速位", "M41.7", 1, 0)); @@ -2068,4 +2103,15 @@ public class ConfigName { */ public int AutoQXTime=10; //endregion + + public static String getFileRoot(Context context) { + if (android.os.Environment.getExternalStorageState().equals( + android.os.Environment.MEDIA_MOUNTED)) { + File external = context.getExternalFilesDir(null); + if (external != null) { + return external.getAbsolutePath(); + } + } + return context.getFilesDir().getAbsolutePath(); + } } diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/FileAllFragment.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/FileAllFragment.java index 53d88eb2..6bb9645d 100644 --- a/app/src/main/java/com/bonait/bnframework/common/filepicker/FileAllFragment.java +++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/FileAllFragment.java @@ -13,7 +13,9 @@ import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.bonait.bnframework.MainApplication; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.filepicker.adapter.AllFileAdapter; import com.bonait.bnframework.common.filepicker.adapter.OnFileItemClickListener; import com.bonait.bnframework.common.filepicker.model.FileEntity; @@ -97,8 +99,8 @@ public class FileAllFragment extends Fragment { Toast.makeText(getContext(), R.string.not_available, Toast.LENGTH_SHORT).show(); return; } - mPath = Environment.getExternalStorageDirectory().getAbsolutePath(); - rootPath = Environment.getExternalStorageDirectory().getAbsolutePath(); + mPath = ConfigName.getFileRoot(MainApplication.getContext()); + rootPath = ConfigName.getFileRoot(MainApplication.getContext()); mFilter = new FileSelectFilter(mFileTypes); mListFiles = getFileList(mPath); mAllFileAdapter = new AllFileAdapter(getContext(),mListFiles,mFilter); diff --git a/app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java b/app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java index f33a8f4b..2b45f3c1 100644 --- a/app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java +++ b/app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java @@ -13,6 +13,9 @@ import android.os.SystemClock; import android.util.Log; import android.widget.Toast; +import com.bonait.bnframework.MainApplication; +import com.bonait.bnframework.common.constant.ConfigName; + import java.io.File; import java.io.FileOutputStream; import java.io.FilenameFilter; @@ -203,7 +206,7 @@ public class CrashHandler implements UncaughtExceptionHandler { } public static String getGlobalpath() { - return Environment.getExternalStorageDirectory().getAbsolutePath() + return ConfigName.getFileRoot(MainApplication.getContext()) + File.separator + "crash" + File.separator; } diff --git a/app/src/main/java/com/bonait/bnframework/common/helper/LogcatHelper.java b/app/src/main/java/com/bonait/bnframework/common/helper/LogcatHelper.java index 3833c4fe..77e647c5 100644 --- a/app/src/main/java/com/bonait/bnframework/common/helper/LogcatHelper.java +++ b/app/src/main/java/com/bonait/bnframework/common/helper/LogcatHelper.java @@ -4,6 +4,9 @@ import android.content.Context; import android.os.Environment; import android.os.StatFs; +import com.bonait.bnframework.MainApplication; +import com.bonait.bnframework.common.constant.ConfigName; + import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; @@ -38,7 +41,7 @@ public class LogcatHelper { public void init(Context context) { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { // 优先保存到SD卡中 - pathLogcat = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "HBL_Log"; + pathLogcat = ConfigName.getFileRoot(MainApplication.getContext()) + File.separator + "HBL_Log"; } else { // 如果SD卡不存在,就保存到本应用的目录下 pathLogcat = context.getFilesDir().getAbsolutePath() + File.separator + "HBL_Log"; diff --git a/app/src/main/java/com/bonait/bnframework/common/helper/SdCart.java b/app/src/main/java/com/bonait/bnframework/common/helper/SdCart.java index cb85892a..ee4e15eb 100644 --- a/app/src/main/java/com/bonait/bnframework/common/helper/SdCart.java +++ b/app/src/main/java/com/bonait/bnframework/common/helper/SdCart.java @@ -1,9 +1,11 @@ package com.bonait.bnframework.common.helper; +import android.app.Application; import android.content.Context; import android.os.Environment; import android.util.Log; +import com.bonait.bnframework.MainApplication; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.file.DBHelper; @@ -30,25 +32,37 @@ public class SdCart { //endregion + private static String getFileRoot(Context context) { + if (Environment.getExternalStorageState().equals( + Environment.MEDIA_MOUNTED)) { + File external = context.getExternalFilesDir(null); + if (external != null) { + return external.getAbsolutePath(); + } + } + return context.getFilesDir().getAbsolutePath(); + } /** * 初始化数据库到SD卡 */ public void initSD() { - File sdDir = null; - boolean sdCardExist = Environment.getExternalStorageState().equals( - Environment.MEDIA_MOUNTED); - if (sdCardExist) { - sdDir = Environment.getExternalStorageDirectory(); - ConfigName.getInstance().sdCardPath = sdDir.toString(); - } +// File sdDir = null; +// boolean sdCardExist = Environment.getExternalStorageState().equals( +// Environment.MEDIA_MOUNTED); +// if (sdCardExist) { +// sdDir = Environment.getExternalStorageDirectory(); +// ConfigName.getInstance().sdCardPath = sdDir.toString(); +// } + ConfigName.getInstance().sdCardPath = ConfigName.getFileRoot(MainApplication.getContext()); ConfigName.getInstance().appResRoot = ConfigName.getInstance().sdCardPath +ConfigName.dataPath; ConfigName.getInstance().dbPath = ConfigName.getInstance().appResRoot + "/hbl.db"; File rootFile = new File(ConfigName.getInstance().appResRoot); if (!rootFile.exists()) //创建目录 - { Log.i("日志",ConfigName.getInstance().sdCardPath); - rootFile.mkdirs(); + { + boolean res = rootFile.mkdirs(); + Log.i("日志",ConfigName.getInstance().appResRoot+" 创建目录 "+res); } File file = new File(ConfigName.getInstance().dbPath); if(!file.exists())//文件不存在那么创建数据库 diff --git a/app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java b/app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java index 991e485f..a5e008d3 100644 --- a/app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java +++ b/app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java @@ -24,7 +24,7 @@ import java.io.FileOutputStream; */ public class LocalCacheUtils { - private static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+ConfigName.dataPath+"/WebImage"; +// private static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+ConfigName.dataPath+"/WebImage"; //region 私有单例 private static volatile LocalCacheUtils _instance; @@ -42,10 +42,11 @@ public class LocalCacheUtils { * @return */ public boolean SetBitmapFile(ImageView ivPic, String name, String url) { + String CACHE_PATH = ConfigName.getFileRoot(MainApplication.getContext())+ConfigName.dataPath+"/WebImage"; if(name.contains(CACHE_PATH)){ name = name.replace(CACHE_PATH,""); } - File file = new File(CACHE_PATH, name); + File file = new File(ConfigName.getFileRoot(MainApplication.getContext())+ConfigName.dataPath+"/WebImage", name); String imgUrl = null; if(url!=null && url.startsWith("http")){ if(NetworkUtils.isNetworkConnected(MainApplication.getContext())){ @@ -61,8 +62,8 @@ public class LocalCacheUtils { // .thumbnail(0.1f) // 加载原始图片的10%作为缩略图 .fitCenter() // 缩放图片以适应ImageView的尺寸 // .override(150, 75) // 设置目标图片的宽度和高度 - .placeholder(R.mipmap.loading3) -// .error(R.mipmap.loadingerror) + .placeholder(R.mipmap.loading123) + .error(R.mipmap.loading123) .skipMemoryCache(true) // 禁用内存缓存 .diskCacheStrategy(DiskCacheStrategy.NONE) .apply(new RequestOptions().transform(new FitXYRoundRadiusTransform(10))) @@ -79,29 +80,6 @@ public class LocalCacheUtils { return false; } - /** - * 从本地读取图片 - * @param url - */ - public Bitmap getBitmapFromLocal(String url){ - String fileName = null;//把图片的url当做文件名,并进行MD5加密 - try { - fileName = url;//MD5Encoder.encode(url);//AES.Encrypt(url);//MD5Encoder.encode(url); - File file=new File(CACHE_PATH,fileName); - Bitmap bitmap=null; - if(file.exists())// - { - bitmap = BitmapFactory.decodeStream(new FileInputStream(file)); - } - return bitmap; - } catch (Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** * 从网络获取图片后,保存至本地缓存 * @@ -113,7 +91,7 @@ public class LocalCacheUtils { String fileName = url.substring(url.lastIndexOf('/') + 1); ;//MD5Encoder.encode(url);;//AES.Encrypt(url);//;MD5Encoder.encode(url);//把图片的url当做文件名,并进行MD5加密 - File file = new File(CACHE_PATH, fileName); + File file = new File(ConfigName.getFileRoot(MainApplication.getContext())+ConfigName.dataPath+"/WebImage", fileName); //通过得到文件的父文件,判断父文件是否存在 File parentFile = file.getParentFile(); if (!parentFile.exists()) { diff --git a/app/src/main/java/com/bonait/bnframework/common/modbus/ModbusTcpMainServer.java b/app/src/main/java/com/bonait/bnframework/common/modbus/ModbusTcpMainServer.java index 816f7894..cb9f72bf 100644 --- a/app/src/main/java/com/bonait/bnframework/common/modbus/ModbusTcpMainServer.java +++ b/app/src/main/java/com/bonait/bnframework/common/modbus/ModbusTcpMainServer.java @@ -183,6 +183,9 @@ public class ModbusTcpMainServer { */ public static void ConnectPLC() { + if(ConfigName.getInstance().isPhoneVersion){ + return; + } String host=ConfigName.getInstance().MainAddress; int port=ConfigName.getInstance().MainPost; param = TcpParam.create(host, port) diff --git a/app/src/main/java/com/bonait/bnframework/common/oss/OssHelper.java b/app/src/main/java/com/bonait/bnframework/common/oss/OssHelper.java index dee2b637..3723fc56 100644 --- a/app/src/main/java/com/bonait/bnframework/common/oss/OssHelper.java +++ b/app/src/main/java/com/bonait/bnframework/common/oss/OssHelper.java @@ -17,6 +17,7 @@ import com.alibaba.sdk.android.oss.common.auth.OSSPlainTextAKSKCredentialProvide import com.alibaba.sdk.android.oss.internal.OSSAsyncTask; import com.alibaba.sdk.android.oss.model.PutObjectRequest; import com.alibaba.sdk.android.oss.model.PutObjectResult; +import com.bonait.bnframework.MainApplication; import com.bonait.bnframework.business.ConfigData; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.helper.I.IRun; @@ -66,7 +67,6 @@ public class OssHelper { * 上传完成通知 */ public IRunT OnCharge; - private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath()+ConfigName.dataPath + "/WebImage"; /** * 上传文件 @@ -84,7 +84,7 @@ public class OssHelper { OnCharge.Run(res); return; } else { - File file = new File(CACHE_PATH, fileurl); + File file = new File(ConfigName.getFileRoot(MainApplication.getContext()), fileurl); String name = "Franchisee/" + ConfigName.getInstance().organizeMode.store_Name + "/goods/android/"; String filename = "https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com/" + name + file.getName(); // 第一个参数:在【RAM访问控制】创建用户时分配的accessKeyId diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java index be17c155..cbb3b07a 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java @@ -86,20 +86,20 @@ public class BottomNavigation2Activity extends BaseActivity { String guid = UUID.randomUUID().toString(); // Date dt = new Date(); - LocalDate currentDate=LocalDate.now(); - String info2 = info+"@"+currentDate.getYear()+";"+currentDate.getMonthValue()+";"+currentDate.getDayOfMonth(); - String s1 = AuthorizeHelper.encrypt(info2,5); - String s2 = AuthorizeHelper.decrypt(s1,5); - - if(ConfigName.getInstance().versionSelectionEnum.contains("一拖")){ - hs = new HttpServer(); - new Thread(()->{ - try { - Thread.sleep(3000); - ConfigData.getInstance().GetMainConsoleData(); - }catch (Exception e){} - }).start(); - } +// LocalDate currentDate=LocalDate.now(); +// String info2 = info+"@"+currentDate.getYear()+";"+currentDate.getMonthValue()+";"+currentDate.getDayOfMonth(); +// String s1 = AuthorizeHelper.encrypt(info2,5); +// String s2 = AuthorizeHelper.decrypt(s1,5); +// +// if(ConfigName.getInstance().versionSelectionEnum.contains("一拖")){ +// hs = new HttpServer(); +// new Thread(()->{ +// try { +// Thread.sleep(3000); +// ConfigData.getInstance().GetMainConsoleData(); +// }catch (Exception e){} +// }).start(); +// } } @@ -239,6 +239,9 @@ public class BottomNavigation2Activity extends BaseActivity { */ public void ReconnectModbus() { try { + if(ConfigName.getInstance().isPhoneVersion){ + return; + } ConfigName.getInstance().IsShow=true; ConfigName.getInstance().IsShowNew=false; ThreadManager.Get().StartLong("PLC断线重连线程", true, new IThread() { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java index f3f1c7a4..59617a9c 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java @@ -313,6 +313,9 @@ public class BottomNavigationNewActivity extends BaseActivity { */ public void ReconnectModbus() { try { + if(ConfigName.getInstance().isPhoneVersion){ + return; + } ConfigName.getInstance().IsShowNew=true; ConfigName.getInstance().IsShow=false; ThreadManager.Get().StartLong("PLC断线重连线程新界面", true, new IThread() { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentSBKZ.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentSBKZ.java index d3f47b72..61062d8a 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentSBKZ.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentSBKZ.java @@ -1,9 +1,12 @@ package com.bonait.bnframework.modules.home.fragment; +import static com.bonait.bnframework.MainApplication.getContext; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; +import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.os.Bundle; @@ -15,10 +18,12 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; +import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; +import android.widget.Spinner; import android.widget.TextView; import com.bonait.bnframework.R; @@ -30,6 +35,7 @@ import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; import com.bonait.bnframework.common.db.mode.BPA_SILOS; +import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; import com.bonait.bnframework.common.db.res.lcMode; import com.bonait.bnframework.common.helper.AuthorizeHelper; import com.bonait.bnframework.common.helper.I.IRun; @@ -41,6 +47,8 @@ import com.bonait.bnframework.common.model.mode.SpeedEnum; import com.bonait.bnframework.common.model.mode.SpeedEnum_en; import com.bonait.bnframework.common.utils.AlertDialogUtils; import com.bonait.bnframework.common.utils.ToastUtils; +import com.bonait.bnframework.databinding.ActivityEditProcessBinding; +import com.bonait.bnframework.databinding.FragmentHomeSbkzBinding; import com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3; import com.bonait.bnframework.modules.home.fragment.mode.newhuoli_control; import com.bonait.bnframework.ui.widget.NewToastUtil; @@ -98,6 +106,8 @@ public class HomeFragmentSBKZ extends BaseFragment { @BindView(R.id.guokoucaoxiang_1) LinearLayout guokoucaoxiang_1; + @BindView(R.id.guokoucaoxiang_2) + LinearLayout guokoucaoxiang_2; @BindView(R.id.guokoucaoxiang) imagebuttom3 guokoucaoxiang; @@ -153,6 +163,8 @@ public class HomeFragmentSBKZ extends BaseFragment { imagebuttom3 yeliao2; @BindView(R.id.yeliao3) imagebuttom3 yeliao3; + @BindView(R.id.btn_silos_open) + Button btn_silos_open; @BindView(R.id.chuchan) imagebuttom3 chuchan; @@ -162,11 +174,14 @@ public class HomeFragmentSBKZ extends BaseFragment { @BindView(R.id.device_image) ImageView device_image; + @BindView(R.id.spinner_silos) + Spinner spinner_silos; //endregion //region 界面 private Context context; public Activity activity = null; + private FragmentHomeSbkzBinding binding; private Handler handler = new Handler(Looper.getMainLooper()){ @Override @@ -199,6 +214,7 @@ public class HomeFragmentSBKZ extends BaseFragment { protected View onCreateView() { View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home_sbkz, null); ButterKnife.bind(this, root); + binding= FragmentHomeSbkzBinding.bind(root); return root; } @@ -284,6 +300,48 @@ public class HomeFragmentSBKZ extends BaseFragment { touliao4.mListener = myClickListener; touliao5.mListener = myClickListener; + if(ConfigName.getInstance().silosAuto){ + binding.llSilos3.setVisibility(View.GONE); + binding.llSilosAuto.setVisibility(View.VISIBLE); + ArrayList silosArrayList = QueryDB.GetSilosALL(); + List nameList = new ArrayList<>(); + if(!silosArrayList.isEmpty()){ + for(BPA_SILOS silos : silosArrayList){ + List materials = QueryDB.GetMaterialBySilosID(silos.id); + if(!materials.isEmpty()){ + nameList.add(silos.num+"料仓:"+materials.get(0).name); + }else { + nameList.add(silos.num+"料仓:未设置"); + } + } + ArrayAdapter adapter_kk = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item20, nameList); + adapter_kk.setDropDownViewResource(R.layout.spinner_dropdown_item20); + spinner_silos.setAdapter(adapter_kk); + + btn_silos_open.setOnTouchListener(new View.OnTouchListener() { + @SuppressLint("ClickableViewAccessibility") + @Override + public boolean onTouch(View view, MotionEvent motionEvent) { + Object ob = ExecuteTheRecipe.getListingValue("抽料位反馈"); + if (ob != null && (boolean) ob) { + if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { + SetIDTouch(R.id.btn_silos_open, true); + } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) { + SetIDTouch(R.id.btn_silos_open, false); + } + } else { + ToastUtils.warning(getString(R.string.text_potdirection_1)); + SetIDTouch(R.id.yeliao3, false); + } + return false; + } + }); + } + }else { + binding.llSilos3.setVisibility(View.VISIBLE); + binding.llSilosAuto.setVisibility(View.GONE); + } + chushui.SetOnTounch(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { @@ -370,6 +428,7 @@ public class HomeFragmentSBKZ extends BaseFragment { } }); + huoli.mListener = myClickListener; chuchan.mListener = myClickListener; DataBus.getInstance().SilosRefresh = new IRun() { @@ -540,6 +599,7 @@ public class HomeFragmentSBKZ extends BaseFragment { break; case R.id.guokoucaoxiang: guokoucaoxiang_1.setVisibility(isclick ? View.VISIBLE : View.GONE); + guokoucaoxiang_2.setVisibility(isclick ? View.VISIBLE : View.GONE); break; case R.id.guokoucaoxiang_cc: SetMouthFacing(MouthFacingEnum.炒菜位); @@ -635,6 +695,10 @@ public class HomeFragmentSBKZ extends BaseFragment { Pumping(3, ismode); Log.e("液料3号", ismode ? "按下" : "松开"); break; + case R.id.btn_silos_open: + String[] res = spinner_silos.getSelectedItem().toString().split("料"); + Pumping(Integer.parseInt(res[0]), ismode); + break; } } //endregion @@ -767,6 +831,7 @@ public class HomeFragmentSBKZ extends BaseFragment { break; } guokoucaoxiang_1.setVisibility(View.GONE); + guokoucaoxiang_2.setVisibility(View.GONE); guokoucaoxiang.Init(); switch (getString(R.string.language)){ case "en": diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/BunkerSetupActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/BunkerSetupActivity.java index 37287ffb..9e8b556a 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/BunkerSetupActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/BunkerSetupActivity.java @@ -11,6 +11,7 @@ import android.view.View; import com.bonait.bnframework.R; import com.bonait.bnframework.business.ExecuteTheRecipe; import com.bonait.bnframework.common.base.BaseActivity; +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.constant.DataBus; import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; @@ -18,6 +19,7 @@ import com.bonait.bnframework.common.db.mode.BPA_SILOS; import com.bonait.bnframework.common.db.res.lcMode; import com.bonait.bnframework.common.helper.I.MyClickListener; import com.bonait.bnframework.common.utils.ToastUtils; +import com.bonait.bnframework.databinding.ActivityBunkersetupBinding; import com.bonait.bnframework.modules.home.fragment.mode.add_silos_message; import com.bonait.bnframework.modules.home.fragment.mode.imagebuttom; import com.bonait.bnframework.modules.home.fragment.mode.jingdutiao1; @@ -55,13 +57,15 @@ public class BunkerSetupActivity extends BaseActivity { add_silos_message silos_control; public Context context; public Activity activity=null; + private ActivityBunkersetupBinding binding; //endregion //region 界面实例 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_bunkersetup); + binding = ActivityBunkersetupBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); ButterKnife.bind(this); context = this; activity=this; @@ -76,6 +80,16 @@ public class BunkerSetupActivity extends BaseActivity { * 初始化顶部弹框 */ private void initTopBar() { + if(ConfigName.getInstance().silosAuto){ + binding.llSilos.setVisibility(View.GONE); + binding.llSilos3.setVisibility(View.GONE); + binding.llSilosAuto.setVisibility(View.VISIBLE); + }else { + binding.llSilos.setVisibility(View.VISIBLE); + binding.llSilos3.setVisibility(View.VISIBLE); + binding.llSilosAuto.setVisibility(View.GONE); + } + mTopBar.setBackgroundColor(ContextCompat.getColor(context, R.color.topbj1)); mTopBar.setTitle(getString(R.string.text_home_SZ)); mTopBar.addLeftImageButton(R.mipmap.fanhui, R.id.topbar).setOnClickListener(new View.OnClickListener() { @@ -126,17 +140,27 @@ public class BunkerSetupActivity extends BaseActivity { */ public void InitData() { DataBus.getInstance().GetLc(); - for (lcMode item : DataBus.getInstance().lcModes) { - if (item.num == 1) { - silos1.SetValue(item, myClickListener); - } else if (item.num == 2) { - silos2.SetValue(item, myClickListener); - } else if (item.num == 3) { - silos3.SetValue(item, myClickListener); - }else if (item.num == 4) { - silos4.SetValue(item, myClickListener); + if(ConfigName.getInstance().silosAuto){ + binding.llSilosAuto.removeAllViews(); +// for (lcMode item : DataBus.getInstance().lcModes) { +// jingdutiao1 view = new jingdutiao1(this); +// view.SetValue(item,myClickListener); +// binding.llSilosAuto.addView(view); +// } + }else { + for (lcMode item : DataBus.getInstance().lcModes) { + if (item.num == 1) { + silos1.SetValue(item, myClickListener); + } else if (item.num == 2) { + silos2.SetValue(item, myClickListener); + } else if (item.num == 3) { + silos3.SetValue(item, myClickListener); + }else if (item.num == 4) { + silos4.SetValue(item, myClickListener); + } } } + } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java index 029f3458..1318cde5 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java @@ -9,6 +9,7 @@ import android.os.Environment; import android.view.View; import com.apkfuns.logutils.LogUtils; +import com.bonait.bnframework.MainApplication; import com.bonait.bnframework.R; import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.constant.ConfigName; @@ -42,7 +43,7 @@ public class ImageChooseActivity extends BaseActivity { QMUITopBarLayout mTopBar;//顶部标题 @BindView(R.id.recycler_view) RecyclerView recyclerView;//image列表 - private static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+ ConfigName.dataPath+"/WebImage"; + List data =new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { @@ -65,7 +66,7 @@ public class ImageChooseActivity extends BaseActivity { private void initData() { try{ - File path = new File(CACHE_PATH);// 获得路径 + File path = new File(ConfigName.getFileRoot(MainApplication.getContext()));// 获得路径 File[] files = path.listFiles();// 读取文件 data.clear(); for (int i = 0; i < files.length; i++) { @@ -90,7 +91,7 @@ public class ImageChooseActivity extends BaseActivity { recyclerView.postDelayed(new Runnable() { @Override public void run() { - EventBus.getDefault().post(new ImageSelectEvent(CACHE_PATH+"/"+sp.url)); + EventBus.getDefault().post(new ImageSelectEvent(ConfigName.getFileRoot(MainApplication.getContext())+"/"+sp.url)); } },500); } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java index 111bd6a5..b006edc8 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java @@ -23,6 +23,8 @@ import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; +import com.bonait.bnframework.common.db.mode.BPA_SILOS; +import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; import com.bonait.bnframework.common.model.mode.VersionSelectionEnum; import com.bonait.bnframework.common.thread.ThreadManager; @@ -55,6 +57,11 @@ public class SystemSystemsetFragment extends BaseFragment { @BindView(R.id.cb_autoInit) CheckBox cb_autoInit; + @BindView(R.id.cb_auto_silos) + CheckBox cb_autoSilos; + @BindView(R.id.edittext_silos) + EditText edittextSilos; + @BindView(R.id.edittext100) EditText edittext100; @BindView(R.id.edittext101) @@ -193,6 +200,14 @@ public class SystemSystemsetFragment extends BaseFragment { ConfigName.getInstance().IsAutoInit = Boolean.parseBoolean(item.value); cb_autoInit.setChecked( ConfigName.getInstance().IsAutoInit); break; + case -205: + ConfigName.getInstance().silosAuto = Boolean.parseBoolean(item.value); + cb_autoSilos.setChecked( ConfigName.getInstance().silosAuto); + break; + case -206: + ConfigName.getInstance().silosNum = Integer.parseInt(item.value); + edittextSilos.setText( ConfigName.getInstance().silosNum+""); + break; case -100: ConfigName.getInstance().versionSelectionEnum = item.value; versionselection.setSelection(material_map_vis.get(item.value)==null?0:material_map_vis.get(item.value)); @@ -289,6 +304,40 @@ public class SystemSystemsetFragment extends BaseFragment { ConfigName.getInstance().DeviceHao = Integer.parseInt(edittext102.getText().toString()); ConfigName.getInstance().Key = edittext103.getText().toString(); ConfigName.getInstance().IsAutoInit = cb_autoInit.isChecked(); + + if(cb_autoSilos.isChecked()){ + if(ConfigName.getInstance().silosNum!=Integer.parseInt(edittextSilos.getText().toString())){ + ArrayList silosArrayList = QueryDB.GetSilosALL(); + ArrayList silosandmaterials = QueryDB.GetSilosAndMaterialALL(); + if (!silosArrayList.isEmpty()) { + int size = silosArrayList.size(); + int newSize = Integer.parseInt(edittextSilos.getText().toString()); + + if(size>newSize){ + for(int i=size-1;i>=newSize;i--){ + QueryDB.DeleteSilos(silosArrayList.get(i)); + QueryDB.DeleteSilosAndMaterial(silosandmaterials.get(i)); + } + }else if(size yx_files = new ArrayList<>(); - private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath()+ConfigName.dataPath + "/WebImage"; +// private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath()+ConfigName.dataPath + "/WebImage"; public void FlushedImage() { - File path = new File(CACHE_PATH);// 获得路径 + File path = new File(ConfigName.getFileRoot(MainApplication.getContext()));// 获得路径 File[] files = path.listFiles();// 读取文件 yx_files.clear(); try { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/jingdutiao1.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/jingdutiao1.java index 36e8c41d..a86c5c45 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/jingdutiao1.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/jingdutiao1.java @@ -42,6 +42,11 @@ public class jingdutiao1 extends LinearLayout { public int value=0; private View root; + public jingdutiao1(Context context) { + this(context, null); + + } + public jingdutiao1(Context context, @Nullable AttributeSet attrs) { super(context, attrs); root= LayoutInflater.from(context).inflate(R.layout.item_jingdutiao1, this); @@ -130,13 +135,19 @@ public class jingdutiao1 extends LinearLayout { return "③"; }else if(num==4) { - return ConfigName.getInstance().app.getString(R.string.text_valve); + return "④"; }else if(num==5) { return "⑤"; }else if(num==6) { return "⑥"; + }else if(num==7) + { + return "⑦"; + }else if(num==8) + { + return "⑧"; }else { return "①"; diff --git a/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/WelcomeActivity.java b/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/WelcomeActivity.java index 97f930ad..1377ec83 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/WelcomeActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/WelcomeActivity.java @@ -113,7 +113,8 @@ public class WelcomeActivity extends BaseActivity { */ public void PermissionCheck() { - String[] params = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA}; + String[] params = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA + }; //String[] params = {Manifest.permission.WRITE_EXTERNAL_STORAGE}; //判断是否获取权限 if (EasyPermissions.hasPermissions(this, params)) { diff --git a/app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java b/app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java index a40edcfa..5d2b4534 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java +++ b/app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java @@ -38,6 +38,8 @@ import com.bonait.bnframework.databinding.DialogWithCancelConfirmBinding; import com.bonait.bnframework.modules.home.fragment.from.CookingActivity; import com.bonait.bnframework.modules.home.fragment.from.CookingSimulatedActivity; import com.bonait.bnframework.modules.home.fragment.mode.item_gx; +import com.bonait.bnframework.ui.adapter.classify.ClassifySpinnerAdapter; +import com.bonait.bnframework.ui.adapter.classify.Spinner36Adapter; import com.bonait.bnframework.ui.adapter.step.DiyStepAdapter; import com.bonait.bnframework.ui.dialog.AttributeSelectDialog; import com.bonait.bnframework.ui.dialog.WaiteProgressDialog; @@ -369,9 +371,14 @@ public class DiyProcessActivity extends BaseActivity { } i++; } - ArrayAdapter adapter_kk = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item32, new ArrayList<>(processMap.keySet())); - adapter_kk.setDropDownViewResource(R.layout.spinner_dropdown_item32); - viewBinding.spinnerProcess.setAdapter(adapter_kk); + if(ConfigName.getInstance().isPhoneVersion){ + Spinner36Adapter spinnerAdapter = new Spinner36Adapter(getContext(), new ArrayList<>(processMap.keySet())); + viewBinding.spinnerProcess.setAdapter(spinnerAdapter); + }else { + ArrayAdapter adapter_kk = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item32, new ArrayList<>(processMap.keySet())); + adapter_kk.setDropDownViewResource(R.layout.spinner_dropdown_item32); + viewBinding.spinnerProcess.setAdapter(adapter_kk); + } viewBinding.spinnerProcess.setOnTouchListener(new View.OnTouchListener() { @Override diff --git a/app/src/main/java/com/bonait/bnframework/ui/activity/GoodEditClassifyFragment.java b/app/src/main/java/com/bonait/bnframework/ui/activity/GoodEditClassifyFragment.java index 67c927fb..537bfcb3 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/activity/GoodEditClassifyFragment.java +++ b/app/src/main/java/com/bonait/bnframework/ui/activity/GoodEditClassifyFragment.java @@ -2,6 +2,7 @@ package com.bonait.bnframework.ui.activity; import android.annotation.SuppressLint; import android.content.Context; +import android.graphics.Rect; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -12,6 +13,7 @@ import android.widget.ArrayAdapter; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.RecyclerView; import com.apkfuns.logutils.LogUtils; import com.bonait.bnframework.R; @@ -30,6 +32,7 @@ import com.bonait.bnframework.databinding.DialogAddClassifyBinding; import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; import com.bonait.bnframework.databinding.FragmentGoodEditClassifyBinding; import com.bonait.bnframework.ui.adapter.goods.LocalGoodsAdapter; +import com.bonait.bnframework.ui.util.DimensUtil; import com.bonait.bnframework.ui.util.DisplayManager; import com.bonait.bnframework.ui.widget.NewToastUtil; @@ -230,6 +233,18 @@ public class GoodEditClassifyFragment extends BaseFragment { protected void addGoods() { } }; + viewBinding.recyclerGoods.addItemDecoration(new RecyclerView.ItemDecoration() { + @Override + public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { + super.getItemOffsets(outRect, view, parent, state); + outRect.top = DimensUtil.getDimens(0); + if(ConfigName.getInstance().isPhoneVersion){ + outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-500)); + }else { + outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-60)); + } + } + }); viewBinding.recyclerGoods.setAdapter(goodsAdapter); goodsList.clear(); goodsList.addAll(GoodsDBUtil.getAll()); diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/ClassifySpinnerAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/ClassifySpinnerAdapter.java index eef8a7da..e0d8c653 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/ClassifySpinnerAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/ClassifySpinnerAdapter.java @@ -11,6 +11,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.ui.util.DisplayManager; @@ -52,7 +53,7 @@ public class ClassifySpinnerAdapter extends BaseAdapter { } TextView textView = convertView.findViewById(R.id.textViewCustom); textView.setText(getItem(position)); - if(textView.getTextSize()>34||textView.getTextSize()<30){ + if(textView.getTextSize()>34* ConfigName.getInstance().scale||textView.getTextSize()<30*ConfigName.getInstance().scale){ DisplayManager.scaleViewGroup(convertView.findViewById(R.id.root)); } diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/GoodClassifyAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/GoodClassifyAdapter.java index ee6e3ba9..4d32301d 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/GoodClassifyAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/GoodClassifyAdapter.java @@ -7,6 +7,8 @@ import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; + +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; import com.bonait.bnframework.databinding.ItemClassifyBinding; import com.bonait.bnframework.ui.adapter.BaseAdapter; @@ -28,7 +30,7 @@ public abstract class GoodClassifyAdapter extends BaseAdapter 34 || holder.binding.name.getTextSize()< 30){ + if(holder.binding.name.getTextSize()> 34* ConfigName.getInstance().scale || holder.binding.name.getTextSize()< 30*ConfigName.getInstance().scale){ DisplayManager.scaleViewGroup(holder.binding.getRoot()); } holder.binding.name.setText(mData.get(position).name+""); diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/SelectAttributeListAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/SelectAttributeListAdapter.java index 65a55e7d..60075bf9 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/SelectAttributeListAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/SelectAttributeListAdapter.java @@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.apkfuns.logutils.LogUtils; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; @@ -63,7 +64,7 @@ public class SelectAttributeListAdapter extends ArrayAdapter { //分别获取 image view 和 textview 的实例 TextView name = view.findViewById(R.id.attribute_name); RecyclerView recyclerView = view.findViewById(R.id.recycle_sub_attribute); - if(name.getTextSize()>34||name.getTextSize()<30){ + if(name.getTextSize()>34* ConfigName.getInstance().scale||name.getTextSize()<30*ConfigName.getInstance().scale){ DisplayManager.scaleViewGroup(view.findViewById(R.id.root)); } name.setText(bean.name+":"); diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/SelectSubAttributeAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/SelectSubAttributeAdapter.java index af9ba897..860bd2af 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/SelectSubAttributeAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/SelectSubAttributeAdapter.java @@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.apkfuns.logutils.LogUtils; +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; import com.bonait.bnframework.databinding.ItemSelectSubattributeBinding; @@ -44,7 +45,7 @@ public class SelectSubAttributeAdapter extends BaseAdapter34||holder.binding.name.getTextSize()<30){ + if(holder.binding.name.getTextSize()>34* ConfigName.getInstance().scale||holder.binding.name.getTextSize()<30*ConfigName.getInstance().scale){ DisplayManager.scaleViewGroup(holder.binding.getRoot()); } BPA_SUBATTRIBUTE subattribute = mData.get(position); diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/Spinner36Adapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/Spinner36Adapter.java new file mode 100644 index 00000000..029e5ec2 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/classify/Spinner36Adapter.java @@ -0,0 +1,61 @@ +package com.bonait.bnframework.ui.adapter.classify; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.bonait.bnframework.R; +import com.bonait.bnframework.common.constant.ConfigName; +import com.bonait.bnframework.ui.util.DisplayManager; + +import java.util.List; + +/** + * @author: liup + * @description: + * @date: 2024/5/15 13:45. + */ +public class Spinner36Adapter extends BaseAdapter { + private Context context; + private List data; + public Spinner36Adapter(@NonNull Context context , List data) { + this.context = context; + this.data = data; + } + + @Override + public int getCount() { + return data.size(); + } + + @Override + public String getItem(int i) { + return data.get(i); + } + + @Override + public long getItemId(int i) { + return 0; + } + + @NonNull + @Override + public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { + if(convertView == null){ + convertView = LayoutInflater.from(context).inflate(R.layout.item_spinner_text36, null); + } + TextView textView = convertView.findViewById(R.id.textViewCustom); + textView.setText(getItem(position)); + if(textView.getTextSize()>38* ConfigName.getInstance().scale||textView.getTextSize()<34*ConfigName.getInstance().scale){ + DisplayManager.scaleViewGroup(convertView.findViewById(R.id.root)); + } + + return convertView; + } +} diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/goods/CloudGoodsAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/goods/CloudGoodsAdapter.java index b0b11a65..17f7340c 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/adapter/goods/CloudGoodsAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/goods/CloudGoodsAdapter.java @@ -40,9 +40,10 @@ public abstract class CloudGoodsAdapter extends BaseAdapter 30 || holder.binding.name.getTextSize()< 26){ + LogUtils.d(" holder.binding.name.getTextSize()="+holder.binding.name.getTextSize()); + if(holder.binding.name.getTextSize()> 30*ConfigName.getInstance().scale || holder.binding.name.getTextSize()< 26*ConfigName.getInstance().scale){ DisplayManager.scaleViewGroup(holder.binding.getRoot()); } + LogUtils.d("DisplayManager holder.binding.name.getTextSize()="+holder.binding.name.getTextSize()); + holder.binding.add.setVisibility(View.GONE); if(isEdit){ holder.binding.edit.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/record/LocalLogAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/record/LocalLogAdapter.java index ab0b7867..5959bd2a 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/adapter/record/LocalLogAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/record/LocalLogAdapter.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.mode.BPA_LOG_RECORD; import com.bonait.bnframework.databinding.ItemLogBinding; @@ -31,7 +32,7 @@ public class LocalLogAdapter extends BaseAdapter28||holder.binding.type.getTextSize()<24){ + if(holder.binding.type.getTextSize()>28* ConfigName.getInstance().scale||holder.binding.type.getTextSize()<24*ConfigName.getInstance().scale){ DisplayManager.scaleViewGroup(holder.binding.getRoot()); } holder.binding.type.setText(log.typeName+""); diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/record/OrderAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/record/OrderAdapter.java index 5c0eb16b..45973ad6 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/adapter/record/OrderAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/record/OrderAdapter.java @@ -8,6 +8,7 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.mode.BPA_ORDER_RECORD; import com.bonait.bnframework.databinding.ItemOrderBinding; @@ -30,7 +31,7 @@ public abstract class OrderAdapter extends BaseAdapter28||holder.binding.name.getTextSize()<24){ + if(holder.binding.name.getTextSize()>28* ConfigName.getInstance().scale||holder.binding.name.getTextSize()<24*ConfigName.getInstance().scale){ DisplayManager.scaleViewGroup(holder.binding.getRoot()); } diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/record/SubOrderAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/record/SubOrderAdapter.java index 06f9424b..d8dd11ca 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/adapter/record/SubOrderAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/record/SubOrderAdapter.java @@ -32,7 +32,7 @@ public abstract class SubOrderAdapter extends BaseAdapter28||holder.binding.name.getTextSize()<24){ + if(holder.binding.name.getTextSize()>28*ConfigName.getInstance().scale||holder.binding.name.getTextSize()<24*ConfigName.getInstance().scale){ DisplayManager.scaleViewGroup(holder.binding.getRoot()); } if(order.subNames!=null && !order.subNames.isEmpty()){ diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/step/DiyStepAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/step/DiyStepAdapter.java index 673a1523..6fefeafb 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/adapter/step/DiyStepAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/step/DiyStepAdapter.java @@ -30,7 +30,7 @@ public abstract class DiyStepAdapter extends BaseAdapter 34 || holder.binding.name.getTextSize()< 30){ + if(holder.binding.name.getTextSize()> 34 *ConfigName.getInstance().scale|| holder.binding.name.getTextSize()< 30*ConfigName.getInstance().scale){ DisplayManager.scaleViewGroup(holder.binding.getRoot()); } diff --git a/app/src/main/java/com/bonait/bnframework/ui/adapter/step/StepAdapter.java b/app/src/main/java/com/bonait/bnframework/ui/adapter/step/StepAdapter.java index 9cfb8f2e..b18df668 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/adapter/step/StepAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/ui/adapter/step/StepAdapter.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; import com.bonait.bnframework.databinding.ItemStepDescBinding; @@ -31,7 +32,7 @@ public class StepAdapter extends BaseAdapter 34 || holder.binding.name.getTextSize()< 30){ + if(holder.binding.name.getTextSize()> 34* ConfigName.getInstance().scale || holder.binding.name.getTextSize()< 30*ConfigName.getInstance().scale){ DisplayManager.scaleViewGroup(holder.binding.getRoot()); } diff --git a/app/src/main/java/com/bonait/bnframework/ui/fragment/goods/CloudGoodsFragment.java b/app/src/main/java/com/bonait/bnframework/ui/fragment/goods/CloudGoodsFragment.java index a88b4f1a..8cd053fa 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/fragment/goods/CloudGoodsFragment.java +++ b/app/src/main/java/com/bonait/bnframework/ui/fragment/goods/CloudGoodsFragment.java @@ -173,7 +173,11 @@ public class CloudGoodsFragment extends BaseFragment { public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); outRect.top = DimensUtil.getDimens(0); - outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-60)); + if(ConfigName.getInstance().isPhoneVersion){ + outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-500)); + }else { + outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-60)); + } } }); viewBinding.recyclerGoods.setAdapter(goodsAdapter); diff --git a/app/src/main/java/com/bonait/bnframework/ui/fragment/goods/LocalGoodsFragment.java b/app/src/main/java/com/bonait/bnframework/ui/fragment/goods/LocalGoodsFragment.java index dd335508..23ca2e1c 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/fragment/goods/LocalGoodsFragment.java +++ b/app/src/main/java/com/bonait/bnframework/ui/fragment/goods/LocalGoodsFragment.java @@ -362,7 +362,11 @@ public class LocalGoodsFragment extends BaseFragment { public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { super.getItemOffsets(outRect, view, parent, state); outRect.top = DimensUtil.getDimens(0); - outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-60)); + if(ConfigName.getInstance().isPhoneVersion){ + outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-500)); + }else { + outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-60)); + } } }); viewBinding.recyclerGoods.setAdapter(goodsAdapter); diff --git a/app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateAllDataService.java b/app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateAllDataService.java index fea42312..7a5b24e1 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateAllDataService.java +++ b/app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateAllDataService.java @@ -387,7 +387,7 @@ public class UpdateAllDataService { if(classify!=null){ String imgUrl = ""; if(good.url!=null){ - String path = Environment.getExternalStorageDirectory().getAbsolutePath()+ ConfigName.dataPath+"/WebImage/"; + String path = ConfigName.getFileRoot(MainApplication.getContext())+ ConfigName.dataPath+"/WebImage/"; imgUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//"+good.url.replace(path,""); } upMaterialBean.add(new GoodsDataInfo(good.id,good.name,"",imgUrl,"0",false,good.propClassifyId,classify.name)); diff --git a/app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateDataService.java b/app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateDataService.java index 0dab8411..1dccc50c 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateDataService.java +++ b/app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateDataService.java @@ -427,7 +427,7 @@ public class UpdateDataService { String imgUrl = ""; if(goods.url!=null){ - String path = Environment.getExternalStorageDirectory().getAbsolutePath()+ ConfigName.dataPath+"/WebImage/"; + String path = ConfigName.getFileRoot(MainApplication.getContext())+ ConfigName.dataPath+"/WebImage/"; imgUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//"+goods.url.replace(path,""); } upMaterialBean.add(new GoodsDataInfo(goods.id,goods.name,"",imgUrl,"0",false,goods.propClassifyId, diff --git a/app/src/main/java/com/bonait/bnframework/ui/widget/ProcessValueView.java b/app/src/main/java/com/bonait/bnframework/ui/widget/ProcessValueView.java index 9bef7e3a..f6c7540e 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/widget/ProcessValueView.java +++ b/app/src/main/java/com/bonait/bnframework/ui/widget/ProcessValueView.java @@ -1,5 +1,7 @@ package com.bonait.bnframework.ui.widget; +import static com.bonait.bnframework.MainApplication.getContext; + import android.content.Context; import android.text.InputType; import android.util.AttributeSet; @@ -13,6 +15,7 @@ import com.bonait.bnframework.R; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.databinding.ViewProcessValueBinding; import com.bonait.bnframework.modules.home.fragment.mode.item_gx; +import com.bonait.bnframework.ui.adapter.classify.Spinner36Adapter; import com.bonait.bnframework.ui.util.DisplayManager; import java.util.ArrayList; @@ -99,9 +102,16 @@ public class ProcessValueView extends RelativeLayout { { editsp_map.put(model.data,1); } - ArrayAdapter adapter2 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item32, new ArrayList<>(editsp_map.keySet())); - adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item32); - viewBinding.spinner.setAdapter(adapter2); + + if(ConfigName.getInstance().isPhoneVersion){ + Spinner36Adapter spinnerAdapter = new Spinner36Adapter(getContext(), new ArrayList<>(editsp_map.keySet())); + viewBinding.spinner.setAdapter(spinnerAdapter); + }else { + ArrayAdapter adapter2 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item32, new ArrayList<>(editsp_map.keySet())); + adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item32); + viewBinding.spinner.setAdapter(adapter2); + } + viewBinding.spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView adapterView, View view, int i, long l) { diff --git a/app/src/main/res/layout/activity_bunkersetup.xml b/app/src/main/res/layout/activity_bunkersetup.xml index 06ee6e6d..51256f16 100644 --- a/app/src/main/res/layout/activity_bunkersetup.xml +++ b/app/src/main/res/layout/activity_bunkersetup.xml @@ -80,6 +80,7 @@ android:layout_height="match_parent" android:layout_weight="1"> + android:layout_marginTop="100dp" + > + + + + + @@ -222,6 +237,8 @@ android:visibility="gone"> + + --> - - - - - - - - - - - - - - - - - - - - - @@ -397,12 +319,14 @@ + + + +