浏览代码

优化界面

ccc 1 周之前
父节点
当前提交
723108b5a5

+ 1 - 1
BaseLibrary/src/main/java/com/hboxs/base_library/constant/Global.java

@@ -20,7 +20,7 @@ public abstract class Global {
      * 1:
      * 2:国外线上
      */
-    public static final int isVersions = 2;
+    public static final int isVersions = 1;
 
     /**
      * 用来初始化这个Global的类,不然会很卡。

+ 3 - 0
app/src/main/java/com/bgy/autosale/RemoteSupportService.java

@@ -351,6 +351,7 @@ public class RemoteSupportService extends Service implements SendCallback {
             case "eliminate":
                 if (!Constant.reasonKey.equals("")) {
                     Constant.reasonKey = "";
+                    Constant.preKey1=-1;
                     HashMap<String, String> params = new HashMap<>();
                     params.put("clientId", Heartbeat.deviceId);
                     addSubscriptionNew(NoPayOrderStringApi.api.eliminateClean(params), String.class,
@@ -1458,6 +1459,7 @@ public class RemoteSupportService extends Service implements SendCallback {
             RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json);
             //上传到服务器
             if (!Constant.reasonKey.equals(reason)) {
+                LogUtils.logWrite("与上一次报警不同,上传该报警");
                 upError(body, 0, reason);
             }
         }
@@ -1471,6 +1473,7 @@ public class RemoteSupportService extends Service implements SendCallback {
                         Log.d(TAG, "onNext报警测试1: " + o);
                         Constant.reasonKey = reason;
                         if (o != null) {
+                            LogUtils.logWrite("报警了,上传报警成功"+reason);
                             Log.d("AddAlarmRecordApi3", "onNext: " + o);
                         }
                     }

+ 2 - 2
app/src/main/java/com/bgy/autosale/payutil/PayMixDialog.java

@@ -356,7 +356,7 @@ public class PayMixDialog extends BaseDialogNoDatabinding implements View.OnClic
     public void setNameAndPrice(String name, String price) {
         this.price=price;
         tvNum.setText(CustomDecimalFormat.getDecimalFormat().format(Double.valueOf(price)));
-        tvMei.setText(Hawk.get(Name.UNIT_OF_CURRENCY_TIME, ""));
+        tvMei.setText(Hawk.get(Name.UNIT_OF_CURRENCY_TIME, UiUtil.getStringRes(R.string.price_unit)));
 
     }
         /**
@@ -383,7 +383,7 @@ public class PayMixDialog extends BaseDialogNoDatabinding implements View.OnClic
         tvNum.setText(CustomDecimalFormat.getDecimalFormat().format(Double.valueOf(noPay)));
 //        setPicture(goodsBeans.get(position));
 
-        String coinType = Hawk.get(Name.UNIT_OF_CURRENCY_TIME, "");
+        String coinType = Hawk.get(Name.UNIT_OF_CURRENCY_TIME, UiUtil.getStringRes(R.string.price_unit));
         if (!"".equals(coinType)) {
             tvPrice.setText(coinType + CustomDecimalFormat.getDecimalFormat().format(Double.valueOf(totalPrice)));
             tvFuhao.setVisibility(View.GONE);

+ 3 - 0
app/src/main/java/com/bgy/autosale/payutil/ScanDialog.java

@@ -421,6 +421,9 @@ public class ScanDialog extends BaseDialogNoDatabinding implements View.OnClickL
                 LogUtil.d("msn", msn);
                 mHandler.sendMessage(message);
                 time--;
+                if (time<=0){
+                    listener.onClickListener(1000);
+                }
                 LogUtil.d(TAG, "thread: 倒计时:" + time);
             }
         };

+ 2 - 2
app/src/main/java/com/bgy/autosale/ui/MainActivity.java

@@ -152,7 +152,7 @@ public class MainActivity extends BaseScanGunActivity  implements SendCallback,
             App.app.payChannel = SPUtils.getInstance(App.app).getInt(Constant.PAY_CHANNEL, Constant.PAY_FREE);
             App.app.runMode = SPUtils.getInstance(App.app).getInt(Constant.RUN_MODE, Constant.RUN_OFFLINE);
             App.app.specMultipleChoices = SPUtils.getInstance(App.app).getBoolean(ServiceFragment.SHARED_PREFERENCE_FLAVOR_MULTIPLE, true);
-            App.app.currencySymbol = Hawk.get(Name.UNIT_OF_CURRENCY_TIME,"");
+            App.app.currencySymbol = Hawk.get(Name.UNIT_OF_CURRENCY_TIME,getString(R.string.price_unit));
         }
 
         super.onCreate(savedInstanceState);
@@ -479,7 +479,7 @@ public class MainActivity extends BaseScanGunActivity  implements SendCallback,
         UISoundHelper.getInstance();
         findViewById(R.id.main_fragment).setVisibility(View.VISIBLE);
         if (!SPUtils.getInstance(App.app).getBoolean(Constant.LOCK_IN_ERROR, false)) {
-//            App.app.initDeviceStateListener();//是否开机
+            App.app.initDeviceStateListener();//是否开机
             Log.d(TAG, "initMainView: ");
         }
 

+ 27 - 11
app/src/main/java/com/bgy/autosale/ui/consumer/IceCreamFragment.java

@@ -181,7 +181,7 @@ import top.keepempty.sph.library.SphResultCallback;
  * Created by cjx on 2020-08-21
  * 说明:
  */
-public class IceCreamFragment extends BaseAutoExitFragment implements View.OnClickListener, Animation.AnimationListener {
+public class IceCreamFragment extends BaseAutoExitFragment implements View.OnClickListener, Animation.AnimationListener ,View.OnTouchListener{
 
     // 去除末尾的0
 //    private DecimalFormat decimalFormat = new DecimalFormat("###################.###########");
@@ -284,6 +284,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
             public boolean onTouch(View view, MotionEvent motionEvent) {
                 switch (motionEvent.getAction()) {
                     case MotionEvent.ACTION_DOWN:
+                        Log.d(TAG, "onTouch: ACTION_DOWN");
                         resetFinishDelay();
                         View v = getCurrentFocus();
                         if (isShouldHideKeyboard(v, motionEvent)) {
@@ -690,7 +691,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
 //            }
             if (!CommunicationHelper.getInstance().canGenerateOrder()) {
                 ToastUtil.getInstance().showText(CommunicationHelper.getInstance().getWhyCanOrderText());
-//                return;//是否开机
+                return;//是否开机
             }
             if (Hawk.get(Name.SHOPPING_TROLLEY, true)) {
                 addShopCart();
@@ -750,7 +751,6 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
         } else {
             priceList = new ArrayList<>();
             priceList1 = new ArrayList<>();
-
             pri = PriceUtil.getDishPriceOne(currentDish);
         }
         showLoading();
@@ -775,9 +775,11 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
         } else if (App.app.payChannel == Constant.PAY_POS_DEVICE || manualReason != null) {
             Log.d(TAG, "onClick: MDB板信用卡支付");
             payType = 4;
+            ispaySuccess = true;
             pay();//MDB板信用卡支付
         } else if (App.app.payChannel == Constant.PAY_PRICE_MODEL || manualReason != null) {
             payType = 3;
+            ispaySuccess = true;
             showPayMixDialog();
 //                manualMake();
         } else if (App.app.payChannel == Constant.PAY_NAYAX_PAY || manualReason != null) {
@@ -1214,7 +1216,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
         } else if (tvAddCartLength <= 25) {
             tvAddCart.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
         }
-        priceView.setText(Hawk.get(Name.UNIT_OF_CURRENCY_TIME, "") + String.format(Locale.US, "%.2f", num));
+        priceView.setText(Hawk.get(Name.UNIT_OF_CURRENCY_TIME, UiUtil.getStringRes(R.string.price_unit)) + String.format(Locale.US, "%.2f", num));
     }
 
     private void initShopCartView(int position, boolean isAdd) {
@@ -1652,6 +1654,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
                     httpCreditCardDialog.stopTimeDown();
                 }
 
+
                 if (ispaySuccess) {
                     ispaySuccess = false;
                     showDialogPaySuccess(R.string.pay_success, R.drawable.icon_zhifu_pay);
@@ -1757,7 +1760,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
                 if (payMixDialog != null && payMixDialog.isShowing()) {
                     if (Global.hasmoney.doubleValue() + Global.hascoin.doubleValue() >= pri) {
 //                        tvMoney.setText(haveMoney + (Global.hasmoney.doubleValue() + Global.hascoin.doubleValue() - pri) + Hawk.get(Name.UNIT_OF_CURRENCY_TIME, ""));
-                        tvMoney.setText(haveMoney + (Global.hasmoney.add(Global.hascoin).subtract(new BigDecimal(pri + "").setScale(2, RoundingMode.HALF_UP))) + Hawk.get(Name.UNIT_OF_CURRENCY_TIME, ""));
+                        tvMoney.setText(haveMoney + (Global.hasmoney.add(Global.hascoin).subtract(new BigDecimal(pri + "").setScale(2, RoundingMode.HALF_UP))) + Hawk.get(Name.UNIT_OF_CURRENCY_TIME, UiUtil.getStringRes(R.string.price_unit)));
                         remainMoney = Global.hasmoney.doubleValue() + Global.hascoin.doubleValue() - pri;
                         payPaperSuccess(); // 收钞完成
                         EventBus.getDefault().post(new ApiMessageEvent("cashsale",
@@ -1786,7 +1789,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
                 }
                 break;
             case Name.ENDSESSION:
-                if (Hawk.get(Name.END_CREDIT_CARD, false)) {
+//                if (Hawk.get(Name.END_CREDIT_CARD, false)) {
                     new Handler().postDelayed(new Runnable() {
                         @Override
                         public void run() {
@@ -1795,7 +1798,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
                             }
                         }
                     }, 3000);
-                }
+//                }
                 break;
             default:
                 break;
@@ -1861,7 +1864,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
         dismissLoading();
         if (Global.hasmoney.doubleValue() + Global.hascoin.doubleValue() >= pri) {
 //            tvMoney.setText(haveMoney + (Global.hasmoney.doubleValue() + Global.hascoin.doubleValue() - pri) + Hawk.get(Name.UNIT_OF_CURRENCY_TIME, ""));
-            tvMoney.setText(haveMoney + (Global.hasmoney.add(Global.hascoin).subtract(new BigDecimal(pri + "").setScale(2, RoundingMode.HALF_UP))) + Hawk.get(Name.UNIT_OF_CURRENCY_TIME, ""));
+            tvMoney.setText(haveMoney + (Global.hasmoney.add(Global.hascoin).subtract(new BigDecimal(pri + "").setScale(2, RoundingMode.HALF_UP))) + Hawk.get(Name.UNIT_OF_CURRENCY_TIME, UiUtil.getStringRes(R.string.price_unit)));
             payPaperSuccess(); // 收钞完成
             EventBus.getDefault().post(new ApiMessageEvent("cashsale", ByteUtils.decimal2fitHex((long) (coin * 100), 4) + ";" + ByteUtils.decimal2fitHex((long) 1, 4)));
         } else {
@@ -2072,7 +2075,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
                 saveCoinOrder(shoppingCart.getShoppingName(), sum, payType, localOrderSn, orderHelper.getOrderList().get(i).buyCount);
             }
         }
-        LogUtils.logWrite("制作" + orderHelper.generateMakingIceCream().size() + "杯冰淇淋");
+        LogUtils.logWrite("共需制作" + orderHelper.generateMakingIceCream().size() + "杯冰淇淋");
         if (App.app.payChannel != Constant.PAY_FREE) {
             LogUtils.logWrite("非免费开始制作冰淇淋了");
         }
@@ -2206,11 +2209,11 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
     private void getCodeSuccess(String rd_Pic, String sn) {
         LogUtil.d(TAG, "getCodeSuccess: " + rd_Pic);
 //        resetFinishDelay();
+        removeFinish();
         showDialogScan(rd_Pic, sn);
     }
 
     private void showDialogScan(String rd_Pic, String sn) {
-        resetFinishDelay();
 //        Global.makeStatus = Name.IN_PRODUCTION;
         if (scanDialog == null) {
             scanDialog = new ScanDialog(getContext(), getActivity());
@@ -2243,7 +2246,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
 
                     break;
                 case 1000:
-//                    resetFinishDelay();
+                    resetFinishDelay();
                     break;
             }
 
@@ -3094,6 +3097,9 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
         if (loadingDialog != null && loadingDialog.isShowing()) {
             loadingDialog.dismiss();
         }
+        if (scanDialog != null && scanDialog.isShowing()) {
+            scanDialog.dismiss();
+        }
         if (shoppingTrolleyDialogChoosePay != null) {
             shoppingTrolleyDialogChoosePay.dismiss();
         }
@@ -3151,4 +3157,14 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
         }
         return null;
     }
+
+    @Override
+    public boolean onTouch(View view, MotionEvent motionEvent) {
+        switch (motionEvent.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+                resetFinishDelay();
+                return true;
+        }
+        return false;
+    }
 }

+ 16 - 12
app/src/main/java/com/bgy/autosale/ui/consumer/PaySuccessFragment.java

@@ -158,6 +158,9 @@ public class PaySuccessFragment extends BaseAutoExitFragment implements Callback
 //            }
 //        });
         Log.d(TAG, "onViewCreated:iceCreamOrders1 " + iceCreamOrders);
+//        updateFinishInfo();
+//        exitTime = 5;
+//        resetFinishDelay();
     }
 
     private void setMateriel() {
@@ -251,6 +254,7 @@ public class PaySuccessFragment extends BaseAutoExitFragment implements Callback
         AndroidSchedulers.mainThread().scheduleDirect(new Runnable() {
             @Override
             public void run() {
+                Log.d(TAG, "startFinishDelay:111 " + exitTime);
                 switch (result.code) {
                     case BasePlcAgreement.RESULT_CODE_ORDER_ERROR:
                         makeFail();
@@ -357,18 +361,18 @@ public class PaySuccessFragment extends BaseAutoExitFragment implements Callback
     // 订单完成界面数据
     private void updateFinishInfo() {
         UISoundHelper.getInstance().playOrderFinish();
-        if (Global.isVersions == 1) {
-            homeView.setVisibility(View.VISIBLE);
-            homeView.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    resetFinishDelay();
-                    if (getFragmentManager() != null) {
-                        getFragmentManager().popBackStack();
-                    }
-                }
-            });
-        }
+//        if (Global.isVersions == 1) {
+//            homeView.setVisibility(View.VISIBLE);
+//            homeView.setOnClickListener(new View.OnClickListener() {
+//                @Override
+//                public void onClick(View v) {
+//                    resetFinishDelay();
+//                    if (getFragmentManager() != null) {
+//                        getFragmentManager().popBackStack();
+//                    }
+//                }
+//            });
+//        }
 
         if (mix) {
             outTipView.setText("订单完成,欢迎下次光临~\nOrder Completed. Hope to see you again!");

+ 7 - 2
app/src/main/java/com/bgy/autosale/ui/operator/TextSettingActivity.java

@@ -62,7 +62,7 @@ public class TextSettingActivity extends BaseScanGunActivity implements View.OnC
         findViewById(R.id.credit_save).setOnClickListener(this);
 
         etUnitTest=findViewById(R.id.et_unit_test);
-        etUnitTest.setText(Hawk.get(Name.UNIT_OF_CURRENCY_TIME,""));
+        etUnitTest.setText(Hawk.get(Name.UNIT_OF_CURRENCY_TIME,UiUtil.getStringRes(R.string.price_unit)));
         findViewById(R.id.unit_save).setOnClickListener(this);
 
 
@@ -101,7 +101,12 @@ public class TextSettingActivity extends BaseScanGunActivity implements View.OnC
             showToast(getString(R.string.modified_success));
         }else if (id == R.id.unit_save) {
             String contacts = etUnitTest.getText().toString();
-            Hawk.put(Name.UNIT_OF_CURRENCY_TIME, contacts);
+            if (contacts.isEmpty()){
+                Hawk.delete(Name.UNIT_OF_CURRENCY_TIME);
+                Hawk.get(Name.UNIT_OF_CURRENCY_TIME,UiUtil.getStringRes(R.string.price_unit));
+            }else {
+                Hawk.put(Name.UNIT_OF_CURRENCY_TIME, contacts);
+            }
             showToast(getString(R.string.modified_success));
         }else if (id == R.id.ic_save) {
             String contacts = etIcText.getText().toString();

+ 1 - 1
app/src/main/java/com/bgy/autosale/ui/operator/fragments/PriceFragment.java

@@ -470,7 +470,7 @@ public class PriceFragment extends BaseFragment implements View.OnClickListener
             viewHolder1.priceView.setText(price);
             viewHolder1.iconFrameView.setTag(priceBean);
             if (Global.isVersions!=1){
-                viewHolder1.tvItemUnit.setText(Hawk.get(Name.UNIT_OF_CURRENCY_TIME,""));
+                viewHolder1.tvItemUnit.setText(Hawk.get(Name.UNIT_OF_CURRENCY_TIME,UiUtil.getStringRes(R.string.price_unit)));
             }
             String icon = util.getString(priceBean.iconKey, null);
             if (icon == null) {

+ 5 - 5
app/src/main/res/values-ar/strings.xml

@@ -54,16 +54,16 @@
     <string name="guide_text_2">مرحبًا، أعتقد أنك تريد تناول الآيس كريم~</string>
 
     <!--صفحة الطلب -->
-    <string name="price_unit"></string>
+    <string name="price_unit"></string>
     <string name="ice_cream">الآيس كريم</string>
     <string name="buy_too_much">يقتصر على 6 أكواب في المرة الواحدة! </string>
     <string name="no_dishes_info">فشل في الحصول على معلومات المنتج! </string>
     <string name="flavor_original">الآيس كريم الأصلي</string>
     <string name="flavor_original_hw">الآيس كريم الأصلي</string>
     <string name="flavor_multi">آيس كريم متعدد النكهات</string>
-    <string name="flavor_sauce">أضف المربى +</string>
-    <string name="flavor_kernel">+ اختر النواة</string>
-    <string name="shop_cart_add">أضف إلى سلة التسوق</string>
+    <string name="flavor_sauce">أختر الصوص</string>
+    <string name="flavor_kernel"> إختر الإضافات</string>
+    <string name="shop_cart_add"> إضافه إلى السلة</string>
     <string name="make_now">اصنع الآن</string>
     <string name="shop_cart">عربة التسوق</string>
     <string name="shop_cart_pay">انتقل إلى الدفع</string>
@@ -457,7 +457,7 @@
     <string name="price_model">الدفع المختلط من الأوراق النقدية والعملات المعدنية</string>
     <string name="nayax_model1">Nayax No Idle</string>
     <string name="nayax_model2">ناياكس خامل</string>
-    <string name="have_money">المبلغ المستثمر:</string>
+    <string name="have_money"> السعر الإجمالي</string>
     <string name="nayax_model">نموذج NaYax:</string>
     <string name="nayax_pay">دفعة NaYax</string>
     <string name="nayax_pay_mix">NaYax+الدفع المختلط</string>

+ 1 - 1
config.gradle

@@ -5,7 +5,7 @@ ext {
             "minSdkVersion"                : 21,
             "targetSdkVersion"             : 28,
             "versionCode"                  : 110,
-            "versionName"                  : "1.0.94",//版本号修改
+            "versionName"                  : "1.0.97",//版本号修改
 
             "androidSupport"               : "28.0.0",
             "constraint-layout"            : "1.1.3",