|
@@ -27,7 +27,6 @@ import android.view.animation.Animation;
|
|
|
import android.view.animation.AnimationUtils;
|
|
|
import android.view.animation.OvershootInterpolator;
|
|
|
import android.widget.ImageView;
|
|
|
-import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.bgy.autosale.App;
|
|
@@ -43,7 +42,6 @@ import com.bgy.autosale.helpers.CommunicationHelper;
|
|
|
import com.bgy.autosale.helpers.OrderHelper;
|
|
|
import com.bgy.autosale.helpers.StockHelper;
|
|
|
import com.bgy.autosale.helpers.UISoundHelper;
|
|
|
-import com.bgy.autosale.interfaces.OnPayCloseListener;
|
|
|
import com.bgy.autosale.payutil.CoinPaySuccessDialog;
|
|
|
import com.bgy.autosale.payutil.CreditCardDialog;
|
|
|
import com.bgy.autosale.payutil.ImgOrderBean;
|
|
@@ -52,6 +50,7 @@ import com.bgy.autosale.payutil.PayMixDialog;
|
|
|
import com.bgy.autosale.payutil.PaySuccessConstant;
|
|
|
import com.bgy.autosale.payutil.ScanDialog;
|
|
|
import com.bgy.autosale.payutil.ShoppingCartBean;
|
|
|
+import com.bgy.autosale.payutil.dialog.ShoppingTrolleyDialogChoosePay;
|
|
|
import com.bgy.autosale.ui.MainActivity;
|
|
|
import com.bgy.autosale.ui.adapters.ShopCartAdapter;
|
|
|
import com.bgy.autosale.ui.base.BaseAutoExitFragment;
|
|
@@ -67,7 +66,6 @@ import com.bgy.autosale.utils.PriceUtil;
|
|
|
import com.bgy.autosale.utils.SPUtils;
|
|
|
import com.bgy.autosale.utils.ToastUtil;
|
|
|
import com.bumptech.glide.Glide;
|
|
|
-import com.example.FaPiaoUtils;
|
|
|
import com.example.offpay.event.OfflineMessageEvent;
|
|
|
import com.example.offpay.event.WmdbIctMessageEvent;
|
|
|
import com.example.offpay.ictrs232.ByteUtils;
|
|
@@ -115,7 +113,6 @@ import io.reactivex.observers.DisposableObserver;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
import okhttp3.MediaType;
|
|
|
import okhttp3.RequestBody;
|
|
|
-import top.keepempty.sph.library.SerialPortHelper;
|
|
|
import top.keepempty.sph.library.SphCmdEntity;
|
|
|
import top.keepempty.sph.library.SphResultCallback;
|
|
|
|
|
@@ -302,13 +299,9 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
});
|
|
|
orderHelper = OrderHelper.getInstance();
|
|
|
orderHelper.init(currentDish);
|
|
|
- Log.d(TAG, "onViewCreated: 6");
|
|
|
updateStockNotification();
|
|
|
- Log.d(TAG, "onViewCreated: 7");
|
|
|
initSpecView();
|
|
|
- Log.d(TAG, "onViewCreated: 8");
|
|
|
initPrice();
|
|
|
- Log.d(TAG, "onViewCreated: 9");
|
|
|
|
|
|
shopCartStubView = findViewById(R.id.dishes_frame_shop_cart_stub);
|
|
|
|
|
@@ -330,9 +323,8 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
});
|
|
|
}
|
|
|
}, 1, TimeUnit.SECONDS);
|
|
|
- if (Hawk.get("MDB_COIN", false)) {
|
|
|
+ if (App.app.payChannel == Constant.PAY_PRICE_MODEL||App.app.payChannel==Constant.PAY_NAYAX_PAY_MIX) {
|
|
|
findViewById(R.id.rl_money_show).setVisibility(View.VISIBLE);
|
|
|
- Log.d(TAG, "onViewCreated: 5");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -347,29 +339,33 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
Log.d(TAG, "MDB_COIN: 2");
|
|
|
mHandler.postDelayed(mRunnable, 500);
|
|
|
}
|
|
|
-// if (Hawk.get(Name.ALWAYS_IDLE, false)){
|
|
|
-// Log.d(TAG, "onCreate: ALWAYS_IDLE1");
|
|
|
-// if (mCreditCardPresenter==null){
|
|
|
-// initCreditCardDriver();
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if (Hawk.get("nayax", false)){
|
|
|
+ Log.d(TAG, "onCreate: ALWAYS_IDLE1");
|
|
|
+ if (mCreditCardPresenter==null){
|
|
|
+ initCreditCardDriver();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private void nayaxCreditCard() {
|
|
|
+ private void showNayaxCreditCard() {
|
|
|
//用于做数据统计的。
|
|
|
//是否通信成功,如果通信不成功,那麽就试着再通信一次。
|
|
|
- if (!mCreditCardPresenter.is_ready()) {
|
|
|
- Log.d(TAG, "nayaxonClickListener: 连接通信不成功");
|
|
|
- mCreditCardPresenter.StartCommunication(4);
|
|
|
- }
|
|
|
- if (mCreditCardPresenter.is_ready()) {
|
|
|
- mCreditCardPresenter.startThreadTimer();
|
|
|
- //弹出信用卡对话框
|
|
|
- showDialogCreditCard();
|
|
|
- return;
|
|
|
+ if (mCreditCardPresenter != null) {
|
|
|
+ if (!mCreditCardPresenter.is_ready()) {
|
|
|
+ Log.d(TAG, "nayaxonClickListener: 连接通信不成功");
|
|
|
+ mCreditCardPresenter.StartCommunication(4);
|
|
|
+ }
|
|
|
+ if (mCreditCardPresenter.is_ready()) {
|
|
|
+ mCreditCardPresenter.startThreadTimer();
|
|
|
+ //弹出信用卡对话框
|
|
|
+ showDialogCreditCard();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ showToast(UiUtil.getStringRes(R.string.nany_noconnect));
|
|
|
}
|
|
|
- showToast(UiUtil.getStringRes(R.string.nany_noconnect));
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
private CreditCardPresenter mCreditCardPresenter;
|
|
|
|
|
|
public void initCreditCardDriver() {
|
|
@@ -391,6 +387,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
}, 5000);
|
|
|
//1.开始通信
|
|
|
}
|
|
|
+
|
|
|
private String str1 = "01030001000295CB";//
|
|
|
private double readCoin = 0;
|
|
|
private Handler mHandler = new Handler();
|
|
@@ -489,9 +486,10 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
pay();//MDB板信用卡支付
|
|
|
} else if (App.app.payChannel == Constant.PAY_PRICE_MODEL || manualReason != null) {
|
|
|
showPayMixDialog();
|
|
|
- } else if (App.app.payChannel == Constant.PAY_NAYAX_MODEL || manualReason != null) {
|
|
|
- nayaxCreditCard();
|
|
|
-// showDialogCreditCard();
|
|
|
+ } else if (App.app.payChannel == Constant.PAY_NAYAX_MODEL ||App.app.payChannel == Constant.PAY_NAYAX_MODEL_IDLE || manualReason != null) {
|
|
|
+ showNayaxCreditCard();
|
|
|
+ }else if (App.app.payChannel == Constant.PAY_NAYAX_PAY_MIX || manualReason != null){
|
|
|
+ showDialogChoosePay();
|
|
|
}
|
|
|
} else if (id == R.id.dishes_ice_cream) {
|
|
|
notifyAddShopCart();
|
|
@@ -515,16 +513,37 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private ShoppingTrolleyDialogChoosePay shoppingTrolleyDialogChoosePay;
|
|
|
+ private void showDialogChoosePay(){
|
|
|
+ if (shoppingTrolleyDialogChoosePay == null) {
|
|
|
+ shoppingTrolleyDialogChoosePay = new ShoppingTrolleyDialogChoosePay(getContext());
|
|
|
+ shoppingTrolleyDialogChoosePay.setCanTouchOutsideDismiss(false);
|
|
|
+ }
|
|
|
+ shoppingTrolleyDialogChoosePay.setListener(new DialogClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClickListener(int type) {
|
|
|
+ switch (type){
|
|
|
+ case 125:
|
|
|
+ shoppingTrolleyDialogChoosePay.dismiss();
|
|
|
+ break;
|
|
|
+ case R.id.iv_qianbi:
|
|
|
+ showPayMixDialog();
|
|
|
+ break;
|
|
|
+ case R.id.iv_nayax:
|
|
|
+ showNayaxCreditCard();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ shoppingTrolleyDialogChoosePay.show((ViewGroup) iceCreamView.getParent());
|
|
|
+ }
|
|
|
+
|
|
|
private CreditCardDialog mCreditCardDialog;
|
|
|
private boolean isCreditCards = false;
|
|
|
private void showDialogCreditCard() {
|
|
|
Log.d(TAG, "showDialogCreditCard: ");
|
|
|
LogUtils.logWrite("弹出刷卡对话框");
|
|
|
mCreditCardDialog = new CreditCardDialog(getContext(), getActivity());
|
|
|
-// final int coin = goodsBeans.get(currentPosition).getCoin();
|
|
|
-// final double coin = /*goodsBeans.get(currentPosition).getCoin()*/localPrice;
|
|
|
-// localPrice = coin;
|
|
|
-// ToastUtil.showToast(coin + "");
|
|
|
Log.d(TAG, "showDialogCreditCard: " + coin);
|
|
|
mCreditCardDialog.setListener(new DialogClickListener() {
|
|
|
@Override
|
|
@@ -548,7 +567,6 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
//显示投币成功弹窗
|
|
|
showDialogPaySuccess(R.string.credit_card_success, R.drawable.icon_xinyongka_pay);
|
|
|
isCreditCards = true;
|
|
|
- // mPresenter.saveCoinOrder(chineseName, (int) coin, 3);
|
|
|
break;
|
|
|
case 131://支付失败
|
|
|
break;
|
|
@@ -558,7 +576,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
}
|
|
|
});
|
|
|
//設置價格
|
|
|
- mCreditCardPresenter.setNameAndPrice(pri*100 , 0);
|
|
|
+ mCreditCardPresenter.setNameAndPrice(pri * 100, 0);
|
|
|
//如果是always_idle模式,那么就直接发送金额
|
|
|
if (Hawk.get(Name.ALWAYS_IDLE, false)) {
|
|
|
mCreditCardPresenter.vendRequest();
|
|
@@ -1097,10 +1115,10 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
};
|
|
|
|
|
|
private void pay() {
|
|
|
- if (!CommunicationHelper.getInstance().canGenerateOrder()) {
|
|
|
- showToast(getString(R.string.no_ready));
|
|
|
- return;
|
|
|
- }
|
|
|
+// if (!CommunicationHelper.getInstance().canGenerateOrder()) {
|
|
|
+// showToast(getString(R.string.no_ready));
|
|
|
+// return;
|
|
|
+// }
|
|
|
UISoundHelper.getInstance().playSelectFlavor(false);
|
|
|
removeFinish();
|
|
|
|
|
@@ -1287,6 +1305,16 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
case Name.VENDAPPROVED://支付成功
|
|
|
break;
|
|
|
case Name.ENDSESSION:
|
|
|
+ if (Hawk.get(Name.END_CREDIT_CARD, false)) {
|
|
|
+ new Handler().postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ if (mMdbCreditCardDialog != null) {
|
|
|
+ mMdbCreditCardDialog.dismiss();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 3000);
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -1491,9 +1519,9 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
Gson gson = new Gson();
|
|
|
LogUtil.d("SettingPresenter", "测试2");
|
|
|
ImgOrderBean imgOrderBean = gson.fromJson(type, ImgOrderBean.class);
|
|
|
- LogUtil.d("SettingPresenter", "测试3"+imgOrderBean);
|
|
|
+ LogUtil.d("SettingPresenter", "测试3" + imgOrderBean);
|
|
|
PaySuccessConstant.sn = imgOrderBean.getSn();
|
|
|
- LogUtil.d("SettingPresenter", imgOrderBean.getSn()+"测试3.1:"+PaySuccessConstant.sn);
|
|
|
+ LogUtil.d("SettingPresenter", imgOrderBean.getSn() + "测试3.1:" + PaySuccessConstant.sn);
|
|
|
if (type != null && !TextUtils.isEmpty(imgOrderBean.getRd_Pic()) && !TextUtils.isEmpty(imgOrderBean.getSn())) {
|
|
|
LogUtil.d("SettingPresenter", "测试4");
|
|
|
getCodeSuccess(imgOrderBean.getRd_Pic(), imgOrderBean.getSn());
|
|
@@ -1542,6 +1570,8 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
case 125:
|
|
|
Global.makeStatus = Name.Idle;
|
|
|
BaseConstant.CANCEL_POLL = false;
|
|
|
+ Log.d(TAG, "showDialogScan: 关闭了重新计时");
|
|
|
+ startFinishDelay();
|
|
|
break;
|
|
|
case 130:
|
|
|
// closeLoading();
|