diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 00000000..e2ebaa65 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index e9a58ca7..5d822244 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,12 @@ + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 803fea21..72d75343 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -33,6 +33,15 @@ tools:ignore="GoogleAppIndexingWarning" tools:node="merge" tools:replace="android:icon"> + + + - - - - + { + Log.i("TAG", "onClick: 确认参数配置"); + DialogManager.getInstance().hide(mParSetVisual);//关闭参数设置窗口 + }); + + //参数配置界面取消按钮 + ButtonClickBinder(mParSetVisual, R.id.parset_cancel_btn, ()->{ + Log.i("TAG", "onClick: 退出参数配置"); + DialogManager.getInstance().hide(mParSetVisual);//关闭参数设置窗口 + }); + + DialogManager.getInstance().hide(mDialogVisual);//关闭商品选择窗口 + DialogManager.getInstance().show(mParSetVisual,R.id.parset_close_dialog); //打开参数设置窗口 + + ParSetInit(R.id.location_selection,new String[] {"0", "1", "2", "3", "4","5","6"}); + ParSetInit(R.id.accessories_selection_1,new String[] {"0", "1", "2", "3", "4","5","6","7","8"}); + ParSetInit(R.id.accessories_selection_2,new String[] {"0", "1", "2", "3", "4","5","6","7","8"}); + } + }); + DialogManager.getInstance().show(mDialogVisual,R.id.close_dialog); //打开商品选择窗口 + } + }); + } + + private void ParSetInit(int id,String[] args) + { + Spinner sp = mParSetVisual.findViewById(id); + ArrayAdapter starAdapter = new ArrayAdapter(getBaseContext(), R.layout.select_item, args); + sp.setAdapter(starAdapter); + sp.setSelection(0); + sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int i, long l) { + + } + + @Override + public void onNothingSelected(AdapterView adapterView) { + + } + }); + } + + /** + * 弹框按钮事件绑定 + * @param dv 弹框页面 + * @param id 按钮id + * @param action 执行委托 + */ + private void ButtonClickBinder(DialogView dv,int id, IRun action){ + if(dv!=null&& !dv.findViewById(id).hasOnClickListeners()){ + dv.findViewById(id).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if(action!=null) action.Run(); + } + }); + } + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/bonait/bnframework/common/image/MyBitmapUtils.java b/app/src/main/java/com/bonait/bnframework/common/image/MyBitmapUtils.java index 4fc66fe0..280a7506 100644 --- a/app/src/main/java/com/bonait/bnframework/common/image/MyBitmapUtils.java +++ b/app/src/main/java/com/bonait/bnframework/common/image/MyBitmapUtils.java @@ -32,6 +32,7 @@ public class MyBitmapUtils { //内存缓存 String name=""; //https://hbl-1305371387.cos.ap-chengdu.myqcloud.com/Franchisee/jccy@163.com/goods/133381212328681942.jpg + //133381212328681942.jpg if(url.contains("http")) { name=url.substring(url.lastIndexOf('/')+1); diff --git a/app/src/main/java/com/bonait/bnframework/common/utils/AppUtils.java b/app/src/main/java/com/bonait/bnframework/common/utils/AppUtils.java index d8f762c8..3140c052 100644 --- a/app/src/main/java/com/bonait/bnframework/common/utils/AppUtils.java +++ b/app/src/main/java/com/bonait/bnframework/common/utils/AppUtils.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.util.Log; import org.apache.commons.codec.binary.Base64; diff --git a/app/src/main/java/com/bonait/bnframework/dialog/DialogManager.java b/app/src/main/java/com/bonait/bnframework/dialog/DialogManager.java new file mode 100644 index 00000000..8cb6a0a5 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/dialog/DialogManager.java @@ -0,0 +1,70 @@ +package com.bonait.bnframework.dialog; +import android.content.Context; +import android.view.Gravity; +import android.view.View; + +import com.bonait.bnframework.R; + + +public class DialogManager { + private static volatile DialogManager mInstance = null; + + private DialogManager() { + + } + + public static DialogManager getInstance() { + if (mInstance == null) { + synchronized (DialogManager.class) { + if (mInstance == null) { + mInstance = new DialogManager(); + } + } + } + return mInstance; + } + + public DialogView initView(Context context, int layout) { + return new DialogView(context,layout, R.style.CustomDialog, Gravity.CENTER); + } + + public DialogView initView(Context context,int layout,int gravity) { + return new DialogView(context,layout, R.style.mydialog, gravity); + } + + // 显示弹框 + public void show(DialogView view) { + if (view != null) { + if (!view.isShowing()) { + view.show(); + } + } + } + + // 显示弹框 + public void show(DialogView view,int closeId) { + if (view != null) { + if (!view.isShowing()) { + if(!view.findViewById(closeId).hasOnClickListeners()){ + view.findViewById(closeId).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view1) { + hide(view); + } + }); + } + view.show(); + } + } + } + + // 隐藏弹框 + public void hide(DialogView view) { + if (view != null) { + if (view.isShowing()) { + view.dismiss(); + } + } + } +} + diff --git a/app/src/main/java/com/bonait/bnframework/dialog/DialogView.java b/app/src/main/java/com/bonait/bnframework/dialog/DialogView.java new file mode 100644 index 00000000..bdf594ab --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/dialog/DialogView.java @@ -0,0 +1,22 @@ +package com.bonait.bnframework.dialog; + +import android.app.Dialog; +import android.content.Context; +import android.view.Window; + +import androidx.annotation.NonNull; + +public class DialogView extends Dialog { + + public DialogView(@NonNull Context context, int layout, int style, int gravity) { + super(context, style); + setContentView(layout); + Window mWindow = getWindow(); +// WindowManager.LayoutParams params = mWindow.getAttributes(); +// params.width = WindowManager.LayoutParams.MATCH_PARENT; +// params.height = WindowManager.LayoutParams.WRAP_CONTENT; +// params.gravity = gravity; +// mWindow.setAttributes(params); + } +} + diff --git a/app/src/main/java/com/bonait/bnframework/material_view.java b/app/src/main/java/com/bonait/bnframework/material_view.java new file mode 100644 index 00000000..932bcb67 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/material_view.java @@ -0,0 +1,22 @@ +package com.bonait.bnframework; + +import androidx.appcompat.app.AppCompatActivity; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.view.Gravity; +import android.view.View; +import android.widget.Button; + +import com.bonait.bnframework.dialog.DialogManager; +import com.bonait.bnframework.dialog.DialogView; + +public class material_view extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_material_view); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java index 6609e53e..28c93b29 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java @@ -6,6 +6,7 @@ import androidx.viewpager.widget.ViewPager; import android.os.Bundle; import android.util.Log; +import com.bonait.bnframework.MainActivity; import com.bonait.bnframework.R; import com.bonait.bnframework.business.ConfigData; import com.bonait.bnframework.business.OrderServer; @@ -31,6 +32,7 @@ import com.bonait.bnframework.modules.home.adapter.FragmentAdapter; import com.bonait.bnframework.modules.home.fragment.DingDanfragment; import com.bonait.bnframework.modules.home.fragment.GongnengFragment; import com.bonait.bnframework.modules.home.fragment.MakeGoodFragment; +import com.bonait.bnframework.modules.home.fragment.RobotMain; import com.bonait.bnframework.modules.home.fragment.SheZhifragment; import com.bonait.bnframework.modules.mine.fragment.MyFragment; import com.qmuiteam.qmui.widget.QMUIViewPager; @@ -88,7 +90,8 @@ public class BottomNavigationMainActivity extends BaseActivity { fragmentList = new ArrayList<>(); fragmentList.add(new GongnengFragment()); fragmentList.add(new DingDanfragment()); - fragmentList.add(new MakeGoodFragment()); +// fragmentList.add(new MakeGoodFragment());//再来一单 + fragmentList.add(new RobotMain()); fragmentList.add(new SheZhifragment()); fragmentList.add(new MyFragment()); ConfigName.getInstance().fragmentAdapter = new FragmentAdapter(getSupportFragmentManager(), fragmentList); @@ -147,48 +150,6 @@ public class BottomNavigationMainActivity extends BaseActivity { MessageLog.ShowInfo("重新连接Modbus异常," + e.getMessage()); } }).start(); - - - - - -// try { -// -// ThreadManager.Get().StartLong("PLC断线重连线程", true, new IThread() { -// @Override -// public void Run() throws InterruptedException { -// try { -// if (ConfigName.getInstance().PlcIsConnect) { -// //ping 不通 -// boolean status = ModbusClient.ping2(ConfigName.getInstance().Address, 1, 1); -// if (!status) //ping 不通 连接 -// { -// MessageLog.ShowInfo("PLC状态断开,尝试连接..."); -// ConfigName.getInstance().PlcIsConnect = false; -// } -// } else { -// boolean status = ModbusClient.ping2(ConfigName.getInstance().Address, 1, 1); -// if (status) { -// MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!"); -// ModbusClient.ConnectPLC(); -// } else { -// MessageLog.ShowInfo("PLC状态断开,尝试连接..."); -// ConfigName.getInstance().PlcIsConnect = false; -// } -// } -// Thread.sleep(10000); -// } catch (Exception e) { -// Log.i("PLC", "PLC重连接失败!" + e.getMessage()); -// } -// } -// -// @Override -// public void RunComplete() throws InterruptedException { -// } -// }); -// } catch (Exception e) { -// MessageLog.ShowInfo("重新连接Modbus异常," + e.getMessage()); -// } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/RobotMain.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/RobotMain.java new file mode 100644 index 00000000..45f0ac7c --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/RobotMain.java @@ -0,0 +1,143 @@ +package com.bonait.bnframework.modules.home.fragment; + +import android.os.Bundle; +import android.os.Handler; +import android.util.Log; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.Spinner; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.bonait.bnframework.R; +import com.bonait.bnframework.business.ConfigData; +import com.bonait.bnframework.common.base.BaseFragment; +import com.bonait.bnframework.common.constant.ConfigName; +import com.bonait.bnframework.common.helper.I.IRun; +import com.bonait.bnframework.dialog.DialogManager; +import com.bonait.bnframework.dialog.DialogView; +import com.qmuiteam.qmui.widget.QMUITopBarLayout; + +import butterknife.BindView; +import butterknife.ButterKnife; + +public class RobotMain extends BaseFragment { + +// @BindView(R.id.robot_topbar) +// QMUITopBarLayout mTopBar;//顶部标题 + + @BindView(R.id.main_btn1) + Button btn1; + + @BindView(R.id.main_btn2) + Button btn2; + + @BindView(R.id.main_btn3) + Button btn3; + + @BindView(R.id.main_btn4) + Button btn4; + + private DialogView mDialogVisual; + private DialogView mParSetVisual; + + + @Override + protected View onCreateView() { + View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_robot_main, null); + ButterKnife.bind(this, root); + return root; + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + Init(); + OpenGoodSelectDialog(); + mDialogVisual= DialogManager.getInstance().initView(getContext(), R.layout.activity_material_view, Gravity.BOTTOM); + mParSetVisual = DialogManager.getInstance().initView(getContext(),R.layout.activity_par_set,Gravity.BOTTOM); + } + + private void Init(){ + ConfigData.getInstance().GetOrganize(getContext()); + ConfigData.getInstance().GetGevGood(getContext(),null); + } + + private void OpenGoodSelectDialog() + { + btn1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view){ + mDialogVisual.setCanceledOnTouchOutside(false); + Button openSetView = mDialogVisual .findViewById(R.id.open); + openSetView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + //参数配置界面确认按钮 + ButtonClickBinder(mParSetVisual, R.id.parset_ok_btn,()->{ + Log.i("TAG", "onClick: 确认参数配置"); + DialogManager.getInstance().hide(mParSetVisual);//关闭参数设置窗口 + }); + + //参数配置界面取消按钮 + ButtonClickBinder(mParSetVisual, R.id.parset_cancel_btn, ()->{ + Log.i("TAG", "onClick: 退出参数配置"); + DialogManager.getInstance().hide(mParSetVisual);//关闭参数设置窗口 + }); + + DialogManager.getInstance().hide(mDialogVisual);//关闭商品选择窗口 + DialogManager.getInstance().show(mParSetVisual,R.id.parset_close_dialog); //打开参数设置窗口 + + ParSetInit(R.id.location_selection,new String[] {"0", "1", "2", "3", "4","5","6"}); + ParSetInit(R.id.accessories_selection_1,new String[] {"0", "1", "2", "3", "4","5","6","7","8"}); + ParSetInit(R.id.accessories_selection_2,new String[] {"0", "1", "2", "3", "4","5","6","7","8"}); + } + }); + DialogManager.getInstance().show(mDialogVisual,R.id.close_dialog); //打开商品选择窗口 + } + }); + } + + private void ParSetInit(int id,String[] args) + { + Spinner sp = mParSetVisual.findViewById(id); + ArrayAdapter starAdapter = new ArrayAdapter(getContext(), R.layout.select_item, args); + sp.setAdapter(starAdapter); + sp.setSelection(0); + sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int i, long l) { + + } + + @Override + public void onNothingSelected(AdapterView adapterView) { + + } + }); + } + + /** + * 弹框按钮事件绑定 + * @param dv 弹框页面 + * @param id 按钮id + * @param action 执行委托 + */ + private void ButtonClickBinder(DialogView dv,int id, IRun action){ + if(dv!=null&& !dv.findViewById(id).hasOnClickListeners()){ + dv.findViewById(id).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if(action!=null) action.Run(); + } + }); + } + } + +} diff --git a/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java b/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java index 639678d8..fd6878a9 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java @@ -22,29 +22,23 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; +import com.bonait.bnframework.MainActivity; import com.bonait.bnframework.R; import com.bonait.bnframework.business.ConfigData; import com.bonait.bnframework.common.base.BaseActivity; -import com.bonait.bnframework.common.bg.SnowView; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.constant.Constants; import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.mode.BPA_USER; import com.bonait.bnframework.common.db.res.UserLogEnum; -import com.bonait.bnframework.common.helper.ActiveMax; import com.bonait.bnframework.common.helper.MessageLog; -import com.bonait.bnframework.common.utils.AlertDialogUtils; import com.bonait.bnframework.common.utils.AnimationToolUtils; import com.bonait.bnframework.common.utils.AppUtils; -import com.bonait.bnframework.common.utils.Des3Utils; import com.bonait.bnframework.common.utils.KeyboardToolUtils; -import com.bonait.bnframework.common.utils.PreferenceUtils; import com.bonait.bnframework.common.utils.ToastUtils; import com.bonait.bnframework.manager.ActivityLifecycleManager; import com.bonait.bnframework.modules.home.activity.BottomNavigationMainActivity; -import com.bonait.bnframework.modules.welcome.model.AppLoginPo; import com.lzy.okgo.OkGo; -import com.lzy.okgo.model.HttpParams; import com.mobsandgeeks.saripaar.ValidationError; import com.mobsandgeeks.saripaar.Validator; import com.mobsandgeeks.saripaar.annotation.NotEmpty; @@ -52,8 +46,6 @@ import com.mobsandgeeks.saripaar.annotation.Order; import com.mobsandgeeks.saripaar.annotation.Password; import com.qmuiteam.qmui.util.QMUIStatusBarHelper; -import org.litepal.LitePal; - import java.util.List; import butterknife.BindView; @@ -232,6 +224,7 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL // 退出界面之前把状态栏还原为白色字体与图标 QMUIStatusBarHelper.setStatusBarDarkMode(LoginActivity.this); Intent intent = new Intent(LoginActivity.this, BottomNavigationMainActivity.class); +// Intent intent = new Intent(LoginActivity.this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); // 结束所有Activity 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 943e23f3..e8294a04 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 @@ -6,8 +6,6 @@ import android.os.Bundle; import android.os.Handler; import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.recyclerview.widget.GridLayoutManager; import android.view.KeyEvent; @@ -21,7 +19,6 @@ import com.bonait.bnframework.manager.ActivityLifecycleManager; import com.lzy.okgo.OkGo; import okhttp3.OkHttpClient; -import pub.devrel.easypermissions.AfterPermissionGranted; import pub.devrel.easypermissions.EasyPermissions; public class WelcomeActivity extends BaseActivity { diff --git a/app/src/main/java/com/bonait/bnframework/par_set.java b/app/src/main/java/com/bonait/bnframework/par_set.java new file mode 100644 index 00000000..eaf0ad33 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/par_set.java @@ -0,0 +1,14 @@ +package com.bonait.bnframework; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class par_set extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_par_set); + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/border_background.xml b/app/src/main/res/drawable/border_background.xml new file mode 100644 index 00000000..c5e63ef1 --- /dev/null +++ b/app/src/main/res/drawable/border_background.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button4.xml b/app/src/main/res/drawable/button4.xml new file mode 100644 index 00000000..c3fc6059 --- /dev/null +++ b/app/src/main/res/drawable/button4.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/dialog_bg.xml b/app/src/main/res/drawable/dialog_bg.xml new file mode 100644 index 00000000..e2595b45 --- /dev/null +++ b/app/src/main/res/drawable/dialog_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/par_set_bg.xml b/app/src/main/res/drawable/par_set_bg.xml new file mode 100644 index 00000000..d6992250 --- /dev/null +++ b/app/src/main/res/drawable/par_set_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/spinner_br.xml b/app/src/main/res/drawable/spinner_br.xml new file mode 100644 index 00000000..cd2f0cb7 --- /dev/null +++ b/app/src/main/res/drawable/spinner_br.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/spinner_text_br.xml b/app/src/main/res/drawable/spinner_text_br.xml new file mode 100644 index 00000000..0a77226d --- /dev/null +++ b/app/src/main/res/drawable/spinner_text_br.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/datatab/layout/activity_main.xml b/app/src/main/res/layout/datatab/layout/activity_main.xml new file mode 100644 index 00000000..c3e27c48 --- /dev/null +++ b/app/src/main/res/layout/datatab/layout/activity_main.xml @@ -0,0 +1,213 @@ + + + + + + + + + + + +