|
@@ -15,6 +15,7 @@ import android.os.Looper;
|
|
import android.support.annotation.NonNull;
|
|
import android.support.annotation.NonNull;
|
|
import android.support.annotation.Nullable;
|
|
import android.support.annotation.Nullable;
|
|
import android.support.annotation.RequiresApi;
|
|
import android.support.annotation.RequiresApi;
|
|
|
|
+import android.support.v4.app.DialogFragment;
|
|
import android.support.v4.app.Fragment;
|
|
import android.support.v4.app.Fragment;
|
|
import android.support.v4.app.FragmentManager;
|
|
import android.support.v4.app.FragmentManager;
|
|
import android.support.v4.app.FragmentTransaction;
|
|
import android.support.v4.app.FragmentTransaction;
|
|
@@ -259,7 +260,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
}
|
|
}
|
|
|
|
|
|
protected int getExitTime() {
|
|
protected int getExitTime() {
|
|
- return isManualMode() ? ADVERTISING_TIME2 * 1000 : ADVERTISING_TIME1 * 1000;
|
|
|
|
|
|
+ return isManualMode() ? ADVERTISING_TIME2 : ADVERTISING_TIME1;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -279,10 +280,13 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
flbuy.setOnTouchListener(new View.OnTouchListener() {
|
|
flbuy.setOnTouchListener(new View.OnTouchListener() {
|
|
@Override
|
|
@Override
|
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
|
- if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
|
|
|
|
- resetFinishDelay();
|
|
|
|
|
|
+ switch (motionEvent.getAction()) {
|
|
|
|
+ case MotionEvent.ACTION_DOWN:
|
|
|
|
+ resetFinishDelay();
|
|
|
|
+ return true;
|
|
|
|
+ default:
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
- return false;
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -488,6 +492,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
@Override
|
|
@Override
|
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
|
|
+ LogUtils.logWrite("进入了选购页面");
|
|
Heartbeat.deviceId = FileUtil.getDeviceId().trim();
|
|
Heartbeat.deviceId = FileUtil.getDeviceId().trim();
|
|
EventBus.getDefault().register(this);
|
|
EventBus.getDefault().register(this);
|
|
Log.d(TAG, "MDB_COIN: 0");
|
|
Log.d(TAG, "MDB_COIN: 0");
|
|
@@ -568,16 +573,22 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
serialPortHelper.setSphResultCallback(new SphResultCallback() {
|
|
serialPortHelper.setSphResultCallback(new SphResultCallback() {
|
|
@Override
|
|
@Override
|
|
public void onSendData(SphCmdEntity sendCom) {
|
|
public void onSendData(SphCmdEntity sendCom) {
|
|
|
|
+ if (sendCom.commandsHex!=null){
|
|
|
|
+ LogUtils.logWrite("MDB_COIN1:"+sendCom.commandsHex);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onReceiveData(SphCmdEntity data) {
|
|
public void onReceiveData(SphCmdEntity data) {
|
|
- if (data.commandsHex.startsWith("010304") && data.commandsHex.length() >= 10) {
|
|
|
|
- String result = data.commandsHex.substring(6, 10);
|
|
|
|
- double coin = Integer.parseInt(result, 16) / 100.00;
|
|
|
|
- if (!result.equals("0000")) {
|
|
|
|
- Global.hascoin = Global.hascoin.add(new BigDecimal((coin * Global.coinMultiplier) / Global.coinMultiplierDivide)).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
- getDefault().post(new OfflineMessageEvent(Name.CURRENCYCHANGES, null));
|
|
|
|
|
|
+ if (data.commandsHex!=null) {
|
|
|
|
+ LogUtils.logWrite("MDB_COIN2:" + data.commandsHex);
|
|
|
|
+ if (data.commandsHex.startsWith("010304") && data.commandsHex.length() >= 10) {
|
|
|
|
+ String result = data.commandsHex.substring(6, 10);
|
|
|
|
+ double coin = Integer.parseInt(result, 16) / 100.00;
|
|
|
|
+ if (!result.equals("0000")) {
|
|
|
|
+ Global.hascoin = Global.hascoin.add(new BigDecimal((coin * Global.coinMultiplier) / Global.coinMultiplierDivide)).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
+ getDefault().post(new OfflineMessageEvent(Name.CURRENCYCHANGES, null));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -615,9 +626,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
public void onDestroyView() {
|
|
public void onDestroyView() {
|
|
super.onDestroyView();
|
|
super.onDestroyView();
|
|
LogUtils.logWrite("退出了选购页面");
|
|
LogUtils.logWrite("退出了选购页面");
|
|
- if (loadingDialog != null && loadingDialog.isShowing()) {
|
|
|
|
- loadingDialog.dismiss();
|
|
|
|
- }
|
|
|
|
|
|
+ closeAllDialog();
|
|
removeFinish();
|
|
removeFinish();
|
|
mHandler.removeCallbacks(mRunnable);
|
|
mHandler.removeCallbacks(mRunnable);
|
|
UISoundHelper.getInstance().playSelectFlavor(false);
|
|
UISoundHelper.getInstance().playSelectFlavor(false);
|
|
@@ -626,6 +635,12 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
if (getView() != null) {
|
|
if (getView() != null) {
|
|
imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);
|
|
imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);
|
|
}
|
|
}
|
|
|
|
+ FragmentManager fragmentManager = getChildFragmentManager();
|
|
|
|
+ for (Fragment fragment : fragmentManager.getFragments()) {
|
|
|
|
+ if (fragment instanceof DialogFragment) {
|
|
|
|
+ ((DialogFragment) fragment).dismiss(); // 关闭 DialogFragment
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -687,6 +702,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
} else if (id == R.id.dishes_kernel_2) {
|
|
} else if (id == R.id.dishes_kernel_2) {
|
|
selectKernel(1);
|
|
selectKernel(1);
|
|
}
|
|
}
|
|
|
|
+ resetFinishDelay();
|
|
}
|
|
}
|
|
|
|
|
|
private void showChoosePay() {
|
|
private void showChoosePay() {
|
|
@@ -702,7 +718,9 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
double totalSum = 0.0; // 用于存储总和
|
|
double totalSum = 0.0; // 用于存储总和
|
|
if (orderHelper.getOrderList().get(i).selectSpecBeans.size() > 0) {
|
|
if (orderHelper.getOrderList().get(i).selectSpecBeans.size() > 0) {
|
|
for (int j = 0; j < orderHelper.getOrderList().get(i).selectSpecBeans.size(); j++) {
|
|
for (int j = 0; j < orderHelper.getOrderList().get(i).selectSpecBeans.size(); j++) {
|
|
- totalSum += Double.parseDouble(orderHelper.getOrderList().get(i).selectSpecBeans.get(j).price);
|
|
|
|
|
|
+ String priceString = orderHelper.getOrderList().get(i).selectSpecBeans.get(j).price;
|
|
|
|
+ priceString = priceString.replace(',', '.');
|
|
|
|
+ totalSum += Double.parseDouble(priceString);
|
|
}
|
|
}
|
|
totalSum += shoppingCart.getPrice();
|
|
totalSum += shoppingCart.getPrice();
|
|
} else {
|
|
} else {
|
|
@@ -761,6 +779,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
dismissLoading();
|
|
dismissLoading();
|
|
showDialogChoosePay();
|
|
showDialogChoosePay();
|
|
}
|
|
}
|
|
|
|
+ resetFinishDelay();
|
|
}
|
|
}
|
|
|
|
|
|
private ShoppingTrolleyDialogChoosePay shoppingTrolleyDialogChoosePay;
|
|
private ShoppingTrolleyDialogChoosePay shoppingTrolleyDialogChoosePay;
|
|
@@ -781,7 +800,6 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
public void onClickListener(int type) {
|
|
public void onClickListener(int type) {
|
|
switch (type) {
|
|
switch (type) {
|
|
case 125:
|
|
case 125:
|
|
- resetFinishDelay();
|
|
|
|
shoppingTrolleyDialogChoosePay.dismiss();
|
|
shoppingTrolleyDialogChoosePay.dismiss();
|
|
break;
|
|
break;
|
|
case R.id.iv_qianbi:
|
|
case R.id.iv_qianbi:
|
|
@@ -822,6 +840,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
}
|
|
}
|
|
|
|
|
|
private void handlePaymentSelection(int payType, int id, Runnable fallbackAction) {
|
|
private void handlePaymentSelection(int payType, int id, Runnable fallbackAction) {
|
|
|
|
+ resetFinishDelay();
|
|
this.payType = payType;
|
|
this.payType = payType;
|
|
shoppingNumber = 0;
|
|
shoppingNumber = 0;
|
|
specialPrice = 0;
|
|
specialPrice = 0;
|
|
@@ -861,7 +880,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
private void showDialogCreditCard() {
|
|
private void showDialogCreditCard() {
|
|
Log.d(TAG, "showDialogCreditCard: ");
|
|
Log.d(TAG, "showDialogCreditCard: ");
|
|
LogUtils.logWrite("弹出刷卡对话框");
|
|
LogUtils.logWrite("弹出刷卡对话框");
|
|
- removeFinish();
|
|
|
|
|
|
+// removeFinish();
|
|
mCreditCardDialog = new CreditCardDialog(getContext(), getActivity());
|
|
mCreditCardDialog = new CreditCardDialog(getContext(), getActivity());
|
|
Log.d(TAG, "showDialogCreditCard: " + coin);
|
|
Log.d(TAG, "showDialogCreditCard: " + coin);
|
|
mCreditCardDialog.setListener(new DialogClickListener() {
|
|
mCreditCardDialog.setListener(new DialogClickListener() {
|
|
@@ -875,7 +894,6 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
if (mCreditCardPresenter.is_ready()) {
|
|
if (mCreditCardPresenter.is_ready()) {
|
|
mCreditCardPresenter.CanselSession();
|
|
mCreditCardPresenter.CanselSession();
|
|
}
|
|
}
|
|
- resetFinishDelay();
|
|
|
|
//关闭 重新支付弹窗倒计
|
|
//关闭 重新支付弹窗倒计
|
|
LogUtil.d(TAG, "倒计时showTimeOutDialog:111 ");
|
|
LogUtil.d(TAG, "倒计时showTimeOutDialog:111 ");
|
|
break;
|
|
break;
|
|
@@ -1509,7 +1527,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
// return;
|
|
// return;
|
|
// }
|
|
// }
|
|
UISoundHelper.getInstance().playSelectFlavor(false);
|
|
UISoundHelper.getInstance().playSelectFlavor(false);
|
|
- removeFinish();
|
|
|
|
|
|
+// removeFinish();
|
|
|
|
|
|
if (getFragmentManager() != null) {
|
|
if (getFragmentManager() != null) {
|
|
Fragment f = null;
|
|
Fragment f = null;
|
|
@@ -1781,7 +1799,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
|
|
|
|
|
|
|
private void showPayMixDialog() {
|
|
private void showPayMixDialog() {
|
|
- removeFinish();
|
|
|
|
|
|
+// removeFinish();
|
|
if (payMixDialog == null) {
|
|
if (payMixDialog == null) {
|
|
payMixDialog = new PayMixDialog(getContext(), getActivity());
|
|
payMixDialog = new PayMixDialog(getContext(), getActivity());
|
|
}
|
|
}
|
|
@@ -1872,7 +1890,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
showDialogPaySuccess(R.string.pay_success, R.drawable.img_toubi_pay);
|
|
showDialogPaySuccess(R.string.pay_success, R.drawable.img_toubi_pay);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- removeFinish();
|
|
|
|
|
|
+// removeFinish();
|
|
if (mMdbCreditCardDialog == null) {
|
|
if (mMdbCreditCardDialog == null) {
|
|
mMdbCreditCardDialog = new MdbCreditCardDialog(getContext());
|
|
mMdbCreditCardDialog = new MdbCreditCardDialog(getContext());
|
|
mMdbCreditCardDialog.setCanTouchOutsideDismiss(false);
|
|
mMdbCreditCardDialog.setCanTouchOutsideDismiss(false);
|
|
@@ -1890,7 +1908,6 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
public void onClickListener(int type) {
|
|
public void onClickListener(int type) {
|
|
switch (type) {
|
|
switch (type) {
|
|
case 125:
|
|
case 125:
|
|
- resetFinishDelay();
|
|
|
|
break;
|
|
break;
|
|
case 130:
|
|
case 130:
|
|
//通用
|
|
//通用
|
|
@@ -1992,7 +2009,9 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
shoppingCart.setCount(orderHelper.getOrderList().get(i).buyCount);
|
|
shoppingCart.setCount(orderHelper.getOrderList().get(i).buyCount);
|
|
shoppingCart.setPrice(Double.parseDouble(orderHelper.getOrderList().get(i).price));
|
|
shoppingCart.setPrice(Double.parseDouble(orderHelper.getOrderList().get(i).price));
|
|
for (int j = 0; j < orderHelper.getOrderList().get(i).selectSpecBeans.size(); j++) {
|
|
for (int j = 0; j < orderHelper.getOrderList().get(i).selectSpecBeans.size(); j++) {
|
|
- totalSum += Double.parseDouble(orderHelper.getOrderList().get(i).selectSpecBeans.get(j).price);
|
|
|
|
|
|
+ String priceString = orderHelper.getOrderList().get(i).selectSpecBeans.get(j).price;
|
|
|
|
+ priceString = priceString.replace(',', '.');
|
|
|
|
+ totalSum += Double.parseDouble(priceString);
|
|
}
|
|
}
|
|
totalSum += shoppingCart.getPrice();
|
|
totalSum += shoppingCart.getPrice();
|
|
Log.d(TAG, "manualMake:42 " + totalSum + "*" + orderHelper.getOrderList().get(i).buyCount);
|
|
Log.d(TAG, "manualMake:42 " + totalSum + "*" + orderHelper.getOrderList().get(i).buyCount);
|
|
@@ -2007,7 +2026,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
if (!priceList1.isEmpty()) {
|
|
if (!priceList1.isEmpty()) {
|
|
double newPri = getPriceList.get(j) - priceList1.get(0);
|
|
double newPri = getPriceList.get(j) - priceList1.get(0);
|
|
String roundedResult = df.format(newPri);
|
|
String roundedResult = df.format(newPri);
|
|
- getPriceList.set(j, Double.valueOf(roundedResult));
|
|
|
|
|
|
+ getPriceList.set(j, Double.valueOf(roundedResult.replace(',', '.')));
|
|
priceList1.remove(0);
|
|
priceList1.remove(0);
|
|
Log.d(TAG, "DecimalFormat: 2");
|
|
Log.d(TAG, "DecimalFormat: 2");
|
|
}
|
|
}
|
|
@@ -2778,6 +2797,8 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
}
|
|
}
|
|
|
|
|
|
public void getConfirmCodeSuccess(double format, int id) {
|
|
public void getConfirmCodeSuccess(double format, int id) {
|
|
|
|
+ resetFinishDelay();
|
|
|
|
+
|
|
pri = PriceUtil.getAllDishPriceDouble(orderHelper.getOrderList()) - format;
|
|
pri = PriceUtil.getAllDishPriceDouble(orderHelper.getOrderList()) - format;
|
|
if (id == R.id.iv_qianbi) {
|
|
if (id == R.id.iv_qianbi) {
|
|
showPayMixDialog();
|
|
showPayMixDialog();
|
|
@@ -3039,4 +3060,31 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
com.hboxs.base_library.util.ToastUtil.showToast(message);
|
|
com.hboxs.base_library.util.ToastUtil.showToast(message);
|
|
closeGkashCardDialog();
|
|
closeGkashCardDialog();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private void closeAllDialog(){
|
|
|
|
+ if (loadingDialog!=null&& loadingDialog.isShowing()){
|
|
|
|
+ loadingDialog.dismiss();
|
|
|
|
+ }
|
|
|
|
+ if (shoppingTrolleyDialogChoosePay!=null) {
|
|
|
|
+ shoppingTrolleyDialogChoosePay.dismiss();
|
|
|
|
+ }
|
|
|
|
+ if (gkashPayDialog!=null) {
|
|
|
|
+ gkashPayDialog.dismiss();
|
|
|
|
+ }
|
|
|
|
+ if (httpCreditCardDialog!=null) {
|
|
|
|
+ httpCreditCardDialog.dismiss();
|
|
|
|
+ }
|
|
|
|
+ if (paySuccessDialog != null) {
|
|
|
|
+ paySuccessDialog.dismiss();
|
|
|
|
+ }
|
|
|
|
+ if (mMdbCreditCardDialog!=null) {
|
|
|
|
+ mMdbCreditCardDialog.dismiss();
|
|
|
|
+ }
|
|
|
|
+ if (payMixDialog!=null) {
|
|
|
|
+ payMixDialog.dismiss();
|
|
|
|
+ }
|
|
|
|
+ if (mCreditCardDialog!=null) {
|
|
|
|
+ mCreditCardDialog.dismiss();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|