Commit a45cdb6d by Wyh

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	component-print/src/main/java/com/joe/print/mvp/print/EpsonPrint.java
#	component-print/src/main/java/com/joe/print/mvp/print/service/PrjService.java
#	component-print/src/main/java/com/joe/print/mvp/ui/activity/PrintActivity.java
#	library-common/src/main/java/com/gingersoft/gsa/cloud/common/printer/plugins/PrinterFlowListener.java
#	library-print/src/main/java/com/gingersoft/gsa/cloud/print/PrintSocketHolder.java
parents 33ba7f75 36db1aef
...@@ -8,6 +8,7 @@ import com.epson.epos2.Epos2Exception; ...@@ -8,6 +8,7 @@ import com.epson.epos2.Epos2Exception;
import com.epson.epos2.printer.Printer; import com.epson.epos2.printer.Printer;
import com.epson.epos2.printer.PrinterStatusInfo; import com.epson.epos2.printer.PrinterStatusInfo;
import com.epson.epos2.printer.ReceiveListener; import com.epson.epos2.printer.ReceiveListener;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins; import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins;
import com.gingersoft.gsa.cloud.print.PrintExecutor; import com.gingersoft.gsa.cloud.print.PrintExecutor;
import com.gingersoft.gsa.cloud.print.PrintSocketHolder; import com.gingersoft.gsa.cloud.print.PrintSocketHolder;
...@@ -51,6 +52,7 @@ public class EpsonPrint implements ReceiveListener { ...@@ -51,6 +52,7 @@ public class EpsonPrint implements ReceiveListener {
mPrinter = new Printer(Printer.TM_U220, Printer.MODEL_TAIWAN, context); mPrinter = new Printer(Printer.TM_U220, Printer.MODEL_TAIWAN, context);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
LoganManager.w_printer(TAG, "初始化针式打印机失败:" + e.getMessage());
return false; return false;
} }
mPrinter.setReceiveEventListener(this); mPrinter.setReceiveEventListener(this);
...@@ -66,10 +68,11 @@ public class EpsonPrint implements ReceiveListener { ...@@ -66,10 +68,11 @@ public class EpsonPrint implements ReceiveListener {
} }
while (true) { while (true) {
try { try {
LoganManager.w_printer(TAG, "斷開連接");
mPrinter.disconnect(); mPrinter.disconnect();
break; break;
} catch (final Exception e) { } catch (final Exception e) {
Log.e(TAG, "斷開連接報錯" + e.getMessage() + e.getClass().getName()); LoganManager.w_printer(TAG, "斷開連接報錯:" + e.getMessage());
if (e instanceof Epos2Exception) { if (e instanceof Epos2Exception) {
//Note: If printer is processing such as printing and so on, the disconnect API returns ERR_PROCESSING. //Note: If printer is processing such as printing and so on, the disconnect API returns ERR_PROCESSING.
if (((Epos2Exception) e).getErrorStatus() == Epos2Exception.ERR_PROCESSING) { if (((Epos2Exception) e).getErrorStatus() == Epos2Exception.ERR_PROCESSING) {
...@@ -120,6 +123,7 @@ public class EpsonPrint implements ReceiveListener { ...@@ -120,6 +123,7 @@ public class EpsonPrint implements ReceiveListener {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
mPrinter.clearCommandBuffer(); mPrinter.clearCommandBuffer();
LoganManager.w_printer(TAG, "創建打印數據失败:" + e.getMessage());
return false; return false;
} }
return true; return true;
...@@ -312,7 +316,7 @@ public class EpsonPrint implements ReceiveListener { ...@@ -312,7 +316,7 @@ public class EpsonPrint implements ReceiveListener {
private void connectByIp(String ip, PrinterStatusInfo statusInfo) { private void connectByIp(String ip, PrinterStatusInfo statusInfo) {
if (statusInfo != null) { if (statusInfo != null) {
Log.e(TAG, "連接狀態1111:" + statusInfo.getConnection()); LoganManager.w_printer(TAG, "連接狀態1111:"+statusInfo.getConnection());
if (statusInfo.getConnection() != 1) { if (statusInfo.getConnection() != 1) {
//未連接 //未連接
if (connectPrinter(ip)) { if (connectPrinter(ip)) {
...@@ -321,7 +325,7 @@ public class EpsonPrint implements ReceiveListener { ...@@ -321,7 +325,7 @@ public class EpsonPrint implements ReceiveListener {
} else { } else {
//已連接,判斷這次是否是上次的ip,如果不是,斷開連這個ip //已連接,判斷這次是否是上次的ip,如果不是,斷開連這個ip
if (ipAddress != null && !ipAddress.equals(ip)) { if (ipAddress != null && !ipAddress.equals(ip)) {
Log.e(TAG, "不是上次的ip,斷開重連"); LoganManager.w_printer(TAG, "不是上次的ip,斷開重連:" + ip);
disconnectPrinter(); disconnectPrinter();
if (connectPrinter(ip)) { if (connectPrinter(ip)) {
ipAddress = ip; ipAddress = ip;
...@@ -333,7 +337,7 @@ public class EpsonPrint implements ReceiveListener { ...@@ -333,7 +337,7 @@ public class EpsonPrint implements ReceiveListener {
ipAddress = ip; ipAddress = ip;
} }
} }
Log.e(TAG, "連接狀態222:" + statusInfo.getConnection()); LoganManager.w_printer(TAG, "連接狀態222:"+statusInfo.getConnection());
} }
private void loginfo(PrinterStatusInfo statusInfo) { private void loginfo(PrinterStatusInfo statusInfo) {
...@@ -361,12 +365,14 @@ public class EpsonPrint implements ReceiveListener { ...@@ -361,12 +365,14 @@ public class EpsonPrint implements ReceiveListener {
mPrinter.connect("TCP:" + ip, Printer.PARAM_DEFAULT); mPrinter.connect("TCP:" + ip, Printer.PARAM_DEFAULT);
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "連接打印機報錯" + e.getMessage() + e.getClass().getName()); Log.e(TAG, "連接打印機報錯" + e.getMessage() + e.getClass().getName());
PrinterPlugins.getOnPrinterFlowHandler().connectionError(e);
e.printStackTrace(); e.printStackTrace();
LoganManager.w_printer(TAG, "連接打印機報錯:"+ e.getMessage());
disconnectPrinter(); disconnectPrinter();
finalizeObject(); finalizeObject();
PrinterPlugins.getOnPrinterFlowHandler().connectionError(e);
return false; return false;
} }
PrinterPlugins.getOnPrinterFlowHandler().connectionSuccess();
return true; return true;
} }
...@@ -384,7 +390,6 @@ public class EpsonPrint implements ReceiveListener { ...@@ -384,7 +390,6 @@ public class EpsonPrint implements ReceiveListener {
if (receiveListener != null) { if (receiveListener != null) {
receiveListener.onPtrReceive(printer, i, printerStatusInfo, ids.get(0)); receiveListener.onPtrReceive(printer, i, printerStatusInfo, ids.get(0));
} }
bitmaps.remove(0); bitmaps.remove(0);
ids.remove(0); ids.remove(0);
} }
...@@ -394,7 +399,6 @@ public class EpsonPrint implements ReceiveListener { ...@@ -394,7 +399,6 @@ public class EpsonPrint implements ReceiveListener {
isPrint = false; isPrint = false;
disconnectPrinter(); disconnectPrinter();
finalizeObject(); finalizeObject();
} }
} }
} }
...@@ -459,7 +459,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket ...@@ -459,7 +459,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
LoganManager.w_printer(TAG, "关闭Socket出错"); LoganManager.w_printer(TAG, "关闭Socket出错");
break; break;
} }
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(errorCode); PrinterPlugins.getOnPrinterFlowHandler().onPrintError(null,errorCode);
setPrintState(errorCode); setPrintState(errorCode);
} }
...@@ -644,18 +644,21 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket ...@@ -644,18 +644,21 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintSocket
ll_member_info.setVisibility(View.GONE); ll_member_info.setVisibility(View.GONE);
} }
//生成積分QRCode碼(飯糰APP掃碼獲得積分) //生成積分QRCode碼(飯糰APP掃碼獲得積分)
if (TextUtils.isEmpty(integralQrcode) || if ((boolean) RestaurantExpandInfoUtils.getValue(ExpandConstant.ToPrintQRCode, false) == false) {
(boolean) RestaurantExpandInfoUtils.getValue(ExpandConstant.ToPrintQRCode, false) == false) {
llIntegralQrcode.setVisibility(View.GONE); llIntegralQrcode.setVisibility(View.GONE);
} else { } else {
llIntegralQrcode.setVisibility(View.VISIBLE); if (!TextUtils.isEmpty(integralQrcode)) {
Bitmap QRImage = null; llIntegralQrcode.setVisibility(View.VISIBLE);
try { Bitmap QRImage = null;
QRImage = QRCodeUtil.makeQRImage(integralQrcode, 220, 220); try {
} catch (WriterException e) { QRImage = QRCodeUtil.makeQRImage(integralQrcode, 220, 220);
e.printStackTrace(); } catch (WriterException e) {
e.printStackTrace();
}
ivIntegralQrcode.setImageBitmap(QRImage);
} else {
llIntegralQrcode.setVisibility(View.GONE);
} }
ivIntegralQrcode.setImageBitmap(QRImage);
} }
return view; return view;
} }
......
...@@ -12,9 +12,11 @@ import android.util.Log; ...@@ -12,9 +12,11 @@ import android.util.Log;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.epson.epos2.Epos2Exception;
import com.epson.epos2.printer.Printer; import com.epson.epos2.printer.Printer;
import com.epson.epos2.printer.PrinterStatusInfo; import com.epson.epos2.printer.PrinterStatusInfo;
import com.epson.epos2.printer.ReceiveListener; import com.epson.epos2.printer.ReceiveListener;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans; import com.gingersoft.gsa.cloud.common.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.common.constans.PrintConstans; import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
...@@ -41,7 +43,9 @@ import com.hyweb.n5.lib.constant.PrinterConstant; ...@@ -41,7 +43,9 @@ import com.hyweb.n5.lib.constant.PrinterConstant;
import com.hyweb.n5.lib.util.PrinterUtil; import com.hyweb.n5.lib.util.PrinterUtil;
import com.hyweb.n5.server.aidl.IOnPrintCallback; import com.hyweb.n5.server.aidl.IOnPrintCallback;
import com.joe.print.mvp.print.EpsonPrint; import com.joe.print.mvp.print.EpsonPrint;
import com.joe.print.mvp.print.IpPrintMaker;
import com.joe.print.mvp.print.PrintPrjKitchen; import com.joe.print.mvp.print.PrintPrjKitchen;
import com.joe.print.mvp.print.PrinterRoot;
import com.joe.print.mvp.print.common.PrinterFinderCallback; import com.joe.print.mvp.print.common.PrinterFinderCallback;
import com.joe.print.mvp.print.common.SendResultCode; import com.joe.print.mvp.print.common.SendResultCode;
import com.joe.print.mvp.print.maker.PrjPrintMaker; import com.joe.print.mvp.print.maker.PrjPrintMaker;
...@@ -52,6 +56,7 @@ import com.joe.print.mvp.print.usb.UsbPrinterFinder; ...@@ -52,6 +56,7 @@ import com.joe.print.mvp.print.usb.UsbPrinterFinder;
import com.joe.print.mvp.print.utils.MyPrintUtils; import com.joe.print.mvp.print.utils.MyPrintUtils;
import com.sunmi.peripheral.printer.InnerResultCallbcak; import com.sunmi.peripheral.printer.InnerResultCallbcak;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils; import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxIOTask;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
...@@ -70,6 +75,7 @@ import java.util.concurrent.TimeUnit; ...@@ -70,6 +75,7 @@ import java.util.concurrent.TimeUnit;
import io.reactivex.Observer; import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import jcifs.smb.SmbFile; import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileOutputStream; import jcifs.smb.SmbFileOutputStream;
...@@ -570,7 +576,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -570,7 +576,7 @@ public class PrjService extends Service implements ReceiveListener {
PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess(); PrinterPlugins.getOnPrinterFlowHandler().onPrintSuccess();
updatePrjSuccess(key); updatePrjSuccess(key);
} else if (code == SendResultCode.SEND_FAILED) { } else if (code == SendResultCode.SEND_FAILED) {
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(code); PrinterPlugins.getOnPrinterFlowHandler().onPrintError(null, code);
updatePrjFailure(key); updatePrjFailure(key);
} }
}); });
...@@ -906,7 +912,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -906,7 +912,7 @@ public class PrjService extends Service implements ReceiveListener {
//打印成功 //打印成功
updatePrjSuccess(s); updatePrjSuccess(s);
} else { } else {
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(i); PrinterPlugins.getOnPrinterFlowHandler().onPrintError(null,i);
//打印失敗 //打印失敗
updatePrjFailure(s); updatePrjFailure(s);
} }
......
...@@ -5,6 +5,7 @@ import android.hardware.usb.UsbDeviceConnection; ...@@ -5,6 +5,7 @@ import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbManager; import android.hardware.usb.UsbManager;
import android.util.Log; import android.util.Log;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.joe.print.mvp.print.common.SendCallback; import com.joe.print.mvp.print.common.SendCallback;
import com.joe.print.mvp.print.common.SendResultCode; import com.joe.print.mvp.print.common.SendResultCode;
...@@ -13,7 +14,10 @@ import java.util.concurrent.ExecutorService; ...@@ -13,7 +14,10 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
public class UsbPrint { public class UsbPrint {
// private UsbPrint INSTANCE;
private final String TAG = "UsbPrint";
// private UsbPrint INSTANCE;
private final UsbManager usbManager; private final UsbManager usbManager;
private SendCallback sendCallback; private SendCallback sendCallback;
private final ExecutorService threadPool; private final ExecutorService threadPool;
...@@ -66,13 +70,14 @@ public class UsbPrint { ...@@ -66,13 +70,14 @@ public class UsbPrint {
connection.close(); connection.close();
int sendResultCode = result > 0 ? SendResultCode.SEND_SUCCESS : SendResultCode.SEND_FAILED; int sendResultCode = result > 0 ? SendResultCode.SEND_SUCCESS : SendResultCode.SEND_FAILED;
Log.e("ddd", "發送結果" + sendResultCode);
if (usbPrinter != null && sendCallback != null) { LoganManager.w_printer(TAG, "發送結果" + sendResultCode);
if(usbPrinter != null && sendCallback != null) {
sendCallback.onCallback(sendResultCode, usbPrinter.getPrinterName()); sendCallback.onCallback(sendResultCode, usbPrinter.getPrinterName());
} }
} else { } else {
Log.e("ddd", "連接失敗"); LoganManager.w_printer(TAG, "連接失敗");
} }
} }
} }
......
package com.joe.print.mvp.ui.activity; package com.joe.print.mvp.ui.activity;
import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC; import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult; import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil; import com.billy.cc.core.component.CCUtil;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication; import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.constans.PrintConstans; import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.logan.LoganManager; import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterFlowListener;
import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins; import com.gingersoft.gsa.cloud.common.printer.plugins.PrinterPlugins;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.print.PrintExecutor; import com.gingersoft.gsa.cloud.print.PrintExecutor;
...@@ -28,27 +43,43 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; ...@@ -28,27 +43,43 @@ import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils; import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.database.bean.PrintCurrencyBean; import com.gingersoft.gsa.cloud.database.bean.PrintCurrencyBean;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean; import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.gingersoft.gsa.cloud.ui.utils.DialogUtils;
import com.jess.arms.base.BaseActivity; import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.joe.print.R;
import com.joe.print.di.component.DaggerPrintComponent; import com.joe.print.di.component.DaggerPrintComponent;
import com.joe.print.mvp.contract.PrintContract; import com.joe.print.mvp.contract.PrintContract;
import com.joe.print.mvp.presenter.PrintPresenter; import com.joe.print.mvp.presenter.PrintPresenter;
import com.joe.print.mvp.print.EpsonPrint; import com.joe.print.mvp.print.EpsonPrint;
import com.joe.print.mvp.print.maker.OpenCashBoxMaker; import com.joe.print.mvp.print.OpenCashBoxMaker;
import com.joe.print.mvp.print.PrintInstruction; import com.joe.print.mvp.print.PrintInstruction;
import com.joe.print.mvp.print.PrintListener; import com.joe.print.mvp.print.PrintListener;
import com.joe.print.mvp.print.PrintPrjKitchen; import com.joe.print.mvp.print.PrintPrjKitchen;
import com.joe.print.mvp.print.PrinterRoot; import com.joe.print.mvp.print.PrinterRoot;
import com.joe.print.mvp.print.utils.MyPrintUtils; import com.joe.print.mvp.print.utils.MyPrintUtils;
import com.joe.print.mvp.ui.adapter.DialogPrinterListAdapter;
import com.joe.print.mvp.ui.adapter.PrintProgressAdapter;
import com.joe.print.mvp.ui.view.PrinterLoadingDialog;
import com.joe.print.mvp.ui.view.SelectPrintDevicePopup; import com.joe.print.mvp.ui.view.SelectPrintDevicePopup;
import com.lxj.xpopup.XPopup; import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.CenterPopupView;
import com.lxj.xpopup.enums.PopupAnimation; import com.lxj.xpopup.enums.PopupAnimation;
import com.lxj.xpopup.impl.LoadingPopupView; import com.lxj.xpopup.impl.LoadingPopupView;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxAsyncTask;
import com.xuexiang.rxutil2.rxjava.task.RxUITask;
import com.yanzhenjie.recyclerview.widget.DefaultItemDecoration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_BILL; import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_BILL;
import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_OTHER_CLOSING; import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_OTHER_CLOSING;
import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_OTHER_ORDER; import static com.gingersoft.gsa.cloud.common.constans.PrintConstans.PRINT_OTHER_ORDER;
...@@ -100,7 +131,9 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -100,7 +131,9 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
/** /**
* 打印進度 * 打印進度
*/ */
private LoadingPopupView loadingPopup; // private LoadingPopupView loadingPopup;
private PrinterLoadingDialog printerLoadingDialog;
@Override @Override
public void setupActivityComponent(@NonNull AppComponent appComponent) { public void setupActivityComponent(@NonNull AppComponent appComponent) {
...@@ -121,10 +154,14 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -121,10 +154,14 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
loadingPopup = new XPopup.Builder(mContext) // loadingPopup = new XPopup.Builder(mContext)
.popupAnimation(PopupAnimation.ScaleAlphaFromCenter) // .popupAnimation(PopupAnimation.ScaleAlphaFromCenter)
.asLoading("加载中..."); // .asLoading("加载中...");
loadingPopup.show(); // loadingPopup.show();
printerLoadingDialog = new PrinterLoadingDialog(mContext).build();
printerLoadingDialog.show();
callId = CCUtil.getNavigateCallId(this); callId = CCUtil.getNavigateCallId(this);
//獲取打印類型,根據打印類型生成對應的bitmap //獲取打印類型,根據打印類型生成對應的bitmap
type = CCUtil.getNavigateParam(this, PrintConstans.PRINT_TYPE, PrintConstans.PRINT_TEST); type = CCUtil.getNavigateParam(this, PrintConstans.PRINT_TYPE, PrintConstans.PRINT_TEST);
...@@ -139,6 +176,49 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -139,6 +176,49 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
} }
//初始化打印配置 //初始化打印配置
initPrintConfig(printContent); initPrintConfig(printContent);
PrinterPlugins.setOnPrinterFlowHandler(new PrinterFlowListener() {
@Override
public void connectionBefore(String deviceName, String IP, int port, long ioTimeout, long printTimeout) {
}
@Override
public void connectionSuccess() {
printerLoadingDialog.setStep(2, PrinterLoadingDialog.status_success);
}
@Override
public void connectionError(Exception e) {
printerLoadingDialog.setStep(2, PrinterLoadingDialog.status_error);
}
@Override
public void disconnect() {
printerLoadingDialog.setStep(4, PrinterLoadingDialog.status_success);
}
@Override
public void onPrinterDataBefore(int orderType, int printType, String printerData, String printerDeviceInfo) {
printerLoadingDialog.setStep(1, PrinterLoadingDialog.status_default);
}
@Override
public void onPrinterBitmapBefore(int orderType, int printType, String directoryName, List<Bitmap> bitmaps) {
printerLoadingDialog.setStep(1, PrinterLoadingDialog.status_success);
}
@Override
public void onPrintSuccess() {
printerLoadingDialog.setStep(3, PrinterLoadingDialog.status_success);
}
@Override
public void onPrintError(Exception e, int errorCode) {
printerLoadingDialog.setStep(3, PrinterLoadingDialog.status_error);
}
});
} }
/** /**
...@@ -185,7 +265,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -185,7 +265,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
//如果彈窗已經關閉,打印機還是為空,說明用戶沒有選擇打印機 //如果彈窗已經關閉,打印機還是為空,說明用戶沒有選擇打印機
if (this.defaultPrint == null) { if (this.defaultPrint == null) {
printFailure("沒有找到打印機,無法打印"); printFailure("沒有找到打印機,無法打印");
finish(); killMyself();
} }
}); });
new XPopup.Builder(mContext).asCustom(selectPrintDevicePopup).show(); new XPopup.Builder(mContext).asCustom(selectPrintDevicePopup).show();
...@@ -318,13 +398,13 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -318,13 +398,13 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
} }
private void addPrintProgress(String printState) { private void addPrintProgress(String printState) {
loadingPopup.setTitle(printState); printerLoadingDialog.setTitle(printState);
} }
@Override @Override
public boolean dispatchTouchEvent(MotionEvent ev) { public boolean dispatchTouchEvent(MotionEvent ev) {
//doSomeTing,點擊當前頁面任意地方自動關閉 //doSomeTing,點擊當前頁面任意地方自動關閉
finish(); killMyself();
return true; return true;
} }
...@@ -360,10 +440,10 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -360,10 +440,10 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
break; break;
case PrintSocketHolder.STATE_4: case PrintSocketHolder.STATE_4:
tip = "關閉中"; tip = "關閉中";
finish(); killMyself();
break; break;
case FINISH: case FINISH:
finish(); killMyself();
break; break;
case ADD_PRINT_DEVICE: case ADD_PRINT_DEVICE:
addPrintDevice(); addPrintDevice();
...@@ -387,7 +467,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -387,7 +467,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
public void printSuccess() { public void printSuccess() {
LoganManager.w_printer(TAG, "printFailure 打印成功"); LoganManager.w_printer(TAG, "printFailure 打印成功");
CC.sendCCResult(callId, CCResult.success()); CC.sendCCResult(callId, CCResult.success());
finish(); killMyself();
} }
@Override @Override
...@@ -398,7 +478,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -398,7 +478,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
} else { } else {
CC.sendCCResult(callId, CCResult.error("print error")); CC.sendCCResult(callId, CCResult.error("print error"));
} }
finish(); killMyself();
} }
@Override @Override
...@@ -491,10 +571,13 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -491,10 +571,13 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
loadingPopup.dismiss();
//關閉打印頁面時,關閉所有打印連接 //關閉打印頁面時,關閉所有打印連接
//關閉ip打印連接 //關閉ip打印連接
PrintSocketHolder.getInstance().closeSocket(); PrintSocketHolder.getInstance().closeSocket();
//關閉針式打印連接
EpsonPrint.getInstance().disconnectPrinter();
EpsonPrint.getInstance().finalizeObject();
printerLoadingDialog.dismiss();
} }
@Override @Override
......
package com.joe.print.mvp.ui.view;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.airbnb.lottie.LottieAnimationView;
import com.gingersoft.gsa.cloud.pay.pos.hywebpos.constant.HywebActionStatusCode;
import com.gingersoft.gsa.cloud.ui.widget.dialog.BaseRetryDialog;
import com.joe.print.R;
import com.qmuiteam.qmui.layout.QMUILinearLayout;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import butterknife.BindDrawable;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-03-28
* 修订历史:2020-03-28
* 描述:
*/
public class PrinterLoadingDialog extends BaseRetryDialog {
private static final String TAG = "PrinterLoadingDialog";
private Context mContext;
private TextView tv_generate_print_data, tv_connecting, tv_printing, tv_print_result;
// @BindDrawable(R.drawable.print_grey_point)
// Drawable mGreyDrawable;
// @BindDrawable(R.drawable.print_green_point)
// Drawable mGreedDrawable;
// @BindDrawable(R.drawable.print_red_point)
// Drawable mReaDrawable;
public static final byte status_default = 0;
public static final byte status_success = 1;
public static final byte status_error = 2;
private int mRadius;
private float mShadowAlpha = 0.25f;
private int mShadowElevationDp = 14;
public PrinterLoadingDialog(@NonNull Context context) {
super(context, R.style.MyDialogTheme2);
mContext = context;
mRadius = QMUIDisplayHelper.dp2px(mContext, 8);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setCanceledOnTouchOutside(true);
}
@Override
public void show() {
super.show();
}
@Override
public void dismiss() {
super.dismiss();
}
public PrinterLoadingDialog build() {
View contentView = buildViews();
int screenWidth = (int) (QMUIDisplayHelper.getScreenWidth(mContext) * 0.9);
int screenHeight = (int) (QMUIDisplayHelper.getScreenHeight(mContext) * 0.5);
setContentView(contentView, new LinearLayout.LayoutParams(screenWidth, screenHeight));
return this;
}
private View buildViews() {
View view = View.inflate(mContext, getContentViewLayoutId(), null);
QMUILinearLayout ll_container = view.findViewById(R.id.ll_container);
LottieAnimationView printLottieView = view.findViewById(R.id.lottieAnimationView);
tv_generate_print_data = view.findViewById(R.id.tv_generate_print_data);
tv_connecting = view.findViewById(R.id.tv_connecting);
tv_printing = view.findViewById(R.id.tv_printing);
tv_print_result = view.findViewById(R.id.tv_print_result);
ll_container.setRadiusAndShadow(mRadius, QMUIDisplayHelper.dp2px(mContext, mShadowElevationDp), mShadowAlpha);
printLottieView.setAnimation(R.raw.printer_loading3);
printLottieView.loop(true);
// printLottieView.addAnimatorUpdateListener((animation) -> {
// // Do something.动画状态监听回调
//
// });
printLottieView.playAnimation();//播放动画
// //progress范围0~1f,设置动画进度
// printLottieView.setProgress(0.5f);
// // 自定义动画时长,此处利用ValueAnimator值动画来实时更新AnimationView的进度来达到控制动画时长。
// ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f).setDuration(500);
// animator.start();//启动动画
return view;
}
public void setStep(int step, int status) {
tv_generate_print_data.post(new Runnable() {
@Override
public void run() {
switch (step) {
case 1:
if (status == PrinterLoadingDialog.status_success) {
tv_generate_print_data.setCompoundDrawables(null, getDrawableByResId(R.drawable.print_green_point), null, null);
} else if (status == PrinterLoadingDialog.status_error) {
tv_generate_print_data.setCompoundDrawables(null,getDrawableByResId(R.drawable.print_red_point), null, null);
} else {
tv_generate_print_data.setCompoundDrawables(null, getDrawableByResId(R.drawable.print_grey_point), null, null);
}
break;
case 2:
if (status == PrinterLoadingDialog.status_success) {
tv_connecting.setCompoundDrawables(null,getDrawableByResId(R.drawable.print_green_point), null, null);
} else if (status == PrinterLoadingDialog.status_error) {
tv_connecting.setCompoundDrawables(null, getDrawableByResId(R.drawable.print_red_point), null, null);
} else {
tv_connecting.setCompoundDrawables(null,getDrawableByResId(R.drawable.print_grey_point), null, null);
}
break;
case 3:
if (status == PrinterLoadingDialog.status_success) {
tv_printing.setCompoundDrawables(null, getDrawableByResId(R.drawable.print_green_point), null, null);
} else if (status == PrinterLoadingDialog.status_error) {
tv_printing.setCompoundDrawables(null, getDrawableByResId(R.drawable.print_red_point), null, null);
} else {
tv_printing.setCompoundDrawables(null, getDrawableByResId(R.drawable.print_grey_point), null, null);
}
break;
case 4:
if (status == PrinterLoadingDialog.status_success) {
tv_print_result.setCompoundDrawables(null, getDrawableByResId(R.drawable.print_green_point), null, null);
} else if (status == PrinterLoadingDialog.status_error) {
tv_print_result.setCompoundDrawables(null, getDrawableByResId(R.drawable.print_red_point), null, null);
} else {
tv_print_result.setCompoundDrawables(null, getDrawableByResId(R.drawable.print_grey_point), null, null);
}
break;
default:
break;
}
}
});
}
private Drawable getDrawableByResId(int resId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return mContext.getDrawable(resId);
}
return mContext.getResources().getDrawable(resId);
}
protected int getContentViewLayoutId() {
return R.layout.print_dialog_loading;
}
private OnClickListener onClickListener;
public void setOnClickListener(OnClickListener onClickListener) {
this.onClickListener = onClickListener;
}
public interface OnClickListener {
// void onItemClick(FoodReason item, int position, int deleteNumber);
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/green" />
<size
android:width="@dimen/dp_10"
android:height="@dimen/dp_10" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/theme_grey_color" />
<size
android:width="@dimen/dp_10"
android:height="@dimen/dp_10" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/red" />
<size
android:width="@dimen/dp_10"
android:height="@dimen/dp_10" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.layout.QMUILinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:background="@color/theme_white_color"
android:orientation="vertical">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottieAnimationView"
android:layout_width="@dimen/dp_150"
android:layout_height="@dimen/dp_150"
android:layout_gravity="center_horizontal"
app:lottie_autoPlay="true"
app:lottie_loop="true" />
<!-- 打印前數據信息,圖片->連接成功(失敗)->打印中->打印成功(失敗)->斷開連接-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_generate_print_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/print_grey_point"
android:text="生成打印數據"
android:textColor="@color/black"
android:textSize="@dimen/sp_10" />
<View
android:layout_width="@dimen/dp_50"
android:layout_height="1px"
android:background="@color/black" />
<TextView
android:id="@+id/tv_connecting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/print_grey_point"
android:text="連接中"
android:textColor="@color/black"
android:textSize="@dimen/sp_10" />
<View
android:layout_width="@dimen/dp_50"
android:layout_height="1px"
android:background="@color/black" />
<TextView
android:id="@+id/tv_printing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/print_grey_point"
android:text="打印中"
android:textColor="@color/black"
android:textSize="@dimen/sp_10" />
<View
android:layout_width="@dimen/dp_50"
android:layout_height="1px"
android:background="@color/black" />
<TextView
android:id="@+id/tv_print_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/print_grey_point"
android:text="結果"
android:textColor="@color/black"
android:textSize="@dimen/sp_10" />
</LinearLayout>
</com.qmuiteam.qmui.layout.QMUILinearLayout>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{"v":"5.5.10","fr":30,"ip":0,"op":90,"w":300,"h":300,"nm":"sec2-02","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[150,150,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":20,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-60.812,22.5],[-60.75,52.75],[63.75,53.25],[63.625,21.5]],"c":false}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":25,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-60.812,22.5],[-60.725,60.15],[63.775,60.55],[63.625,21.5]],"c":false}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":35,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-60.812,22.5],[-60.725,60.15],[63.775,60.55],[63.625,21.5]],"c":false}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":51,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-60.812,22.5],[-60.725,60.15],[63.775,60.55],[63.625,21.5]],"c":false}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":55,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-60.812,22.5],[-60.667,77.417],[63.833,77.583],[63.625,21.5]],"c":false}]},{"t":60,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-60.812,22.5],[-60.625,89.75],[63.875,89.75],[63.625,21.5]],"c":false}]}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":12,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":15,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim In Path","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Layer 7 Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[150,122.333,0],"ix":2},"a":{"a":0,"k":[125,110.667,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[192,94.333],[162,94.333]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":12,"ix":5},"lc":2,"lj":1,"ml":10,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[8.187,0],[0,0],[0,-8.187],[0,0],[-8.187,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,8.188],[0,0]],"o":[[0,0],[0,-8.187],[0,0],[-8.187,0],[0,0],[0,8.188],[0,0],[0,0],[0,0],[0,0],[0,0],[8.187,0],[0,0],[0,0]],"v":[[95,-17.5],[95,-45.86],[80.11,-60.5],[-80.11,-60.5],[-95,-45.86],[-95,45.368],[-80.11,60.5],[-61,60.5],[-61,29.5],[64,29.5],[64,60.5],[80.11,60.5],[95,45.368],[95,6.5]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":12,"ix":5},"lc":2,"lj":1,"ml":10,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[125,130.833],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[14.8,0],[0,0],[0,-14.8],[0,0],[0,0],[0,0]],"o":[[0,0],[-14.801,0],[0,0],[0,0],[0,0],[0,-14.8]],"v":[[39.974,-20.241],[-39.972,-20.241],[-66.771,6.557],[-66.771,20.241],[66.772,20.241],[66.772,6.557]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":12,"ix":5},"lc":2,"lj":1,"ml":10,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[125,50.241],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":2,"cix":2,"bm":0,"ix":3,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.5],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":15,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":4,"nm":"Trim In Path","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":90,"st":0,"bm":0}],"markers":[]}
\ No newline at end of file
...@@ -288,6 +288,8 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod ...@@ -288,6 +288,8 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
return; return;
} }
LoganManager.w_tableMode(TAG, LoganManager.EVENT_SELECTED, "食品【" + datasBean.getProductName() + "】");
RvMealClicked = true; RvMealClicked = true;
//设置当前操作的食品 //设置当前操作的食品
mCurrentOrderDetailBean = datasBean; mCurrentOrderDetailBean = datasBean;
...@@ -895,17 +897,16 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod ...@@ -895,17 +897,16 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
* @param initTable 是否是開台 * @param initTable 是否是開台
*/ */
private void printSendOrder(boolean initTable) { private void printSendOrder(boolean initTable) {
if (DoshokuOrder.getInstance().getNewFoodList() == null || DoshokuOrder.getInstance().getNewFoodList().size() <= 0) {
//沒有新的食品時,不打印送單
IActivity.returnBeforeActivity(initTable);
return;
}
if (RestaurantExpandInfoUtils.getValue(ExpandConstant.AutoPrinterPaper, true)) { if (RestaurantExpandInfoUtils.getValue(ExpandConstant.AutoPrinterPaper, true)) {
if (RestaurantExpandInfoUtils.getValue(ExpandConstant.MergeSendFood, true)) { if (RestaurantExpandInfoUtils.getValue(ExpandConstant.MergeSendFood, true)) {
//合并主食品 //合并主食品
mergeMainFoodNumber(mOrderMealList); mergeMainFoodNumber(mOrderMealList);
} }
//餐檯送單
if (DoshokuOrder.getInstance().getNewFoodList() == null || DoshokuOrder.getInstance().getNewFoodList().size() <= 0) {
//沒有新的食品時,不打印送單
IActivity.returnBeforeActivity(initTable);
return;
}
PrintContent printContent = new PrintContentAdapter().adaptationSendOrderPaperContent(DoshokuOrder.getInstance(), mTableInfo); PrintContent printContent = new PrintContentAdapter().adaptationSendOrderPaperContent(DoshokuOrder.getInstance(), mTableInfo);
CC.obtainBuilder(ComponentName.COMPONENT_PRINT) CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
...@@ -1131,15 +1132,15 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod ...@@ -1131,15 +1132,15 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
if (!deleteFood.isNew()) { if (!deleteFood.isNew()) {
//TODO 刪除已下單食品 //TODO 刪除已下單食品
if (!deleteFood.isModify()) { if (!deleteFood.isModify()) {
LoganManager.w_tableMode(TAG, LoganManager.EVENT_CLICK + "刪除已下單食品【" + deleteFood.getRemark() + "】"); LoganManager.w_tableMode(TAG, LoganManager.EVENT_CLICK + "已下單食品【" + deleteFood.getProductName() + "】");
deleteWithOrderedFood(deleteFood); deleteWithOrderedFood(deleteFood);
} }
} else { } else {
if (deleteStyle == 2) { if (deleteStyle == 2) {
LoganManager.w_tableMode(TAG, LoganManager.EVENT_LONG_CLICK + "刪除【" + deleteFood.getRemark() + "】"); LoganManager.w_tableMode(TAG, LoganManager.EVENT_DELETE + "食品【" + deleteFood.getProductName() + "】");
mSelectMealAdapter.removeAllNewFoodItem(); mSelectMealAdapter.removeAllNewFoodItem();
} else { } else {
LoganManager.w_tableMode(TAG, LoganManager.EVENT_CLICK + "刪除【" + deleteFood.getRemark() + "】"); LoganManager.w_tableMode(TAG, LoganManager.EVENT_DELETE + "食品【" + deleteFood.getProductName() + "】");
int deletePosition = mSelectMealAdapter.removeFoodItem(); int deletePosition = mSelectMealAdapter.removeFoodItem();
mRootView.setMealRvScrollToPosition(deletePosition); mRootView.setMealRvScrollToPosition(deletePosition);
//更新最大可選數 //更新最大可選數
......
...@@ -100,6 +100,7 @@ import butterknife.BindView; ...@@ -100,6 +100,7 @@ import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.OnLongClick; import butterknife.OnLongClick;
import static com.gingersoft.gsa.cloud.common.utils.log.LogUtil.v;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -722,12 +723,20 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter> ...@@ -722,12 +723,20 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
} }
@OnClick({R2.id.btn_key1, R2.id.btn_key2, R2.id.btn_key3, R2.id.btn_key4, R2.id.btn_key5, R2.id.btn_keys, @OnClick({R2.id.btn_key1, R2.id.btn_key2, R2.id.btn_key3, R2.id.btn_key4, R2.id.btn_key5, R2.id.btn_keys,
R2.id.btn_numberman, R2.id.btn_fid, R2.id.btn_meal_delete, R2.id.btn_meal_modify_restore, R2.id.btn_send_order, R2.id.tv_no_save_return, R2.id.fl_order_content, R2.id.btn_numberman, R2.id.btn_fid, R2.id.btn_meal_delete, R2.id.btn_meal_modify_restore, R2.id.btn_send_order, R2.id.tv_no_save_return, R2.id.tv_order_content,
R2.id.btn_taste, R2.id.btn_msg, R2.id.btn_delete, R2.id.btn_end, R2.id.iv_fine_back}) R2.id.btn_taste, R2.id.btn_msg, R2.id.btn_delete, R2.id.btn_end, R2.id.iv_fine_back})
public void onClick(View v) { public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
LoganManager.w_tableMode(TAG, LoganManager.EVENT_CLICK, v.getTransitionName()); String text = null;
if (v instanceof Button) {
Button button = (Button) v;
text = button.getText().toString();
} else if (v instanceof TextView) {
TextView textView = (TextView) v;
text = textView.getText().toString();
}
LoganManager.w_tableMode(TAG, LoganManager.EVENT_CLICK, text);
} }
recordOperat(true); recordOperat(true);
...@@ -776,7 +785,7 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter> ...@@ -776,7 +785,7 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
mPresenter.sendOrder(false, null); mPresenter.sendOrder(false, null);
// } // }
// }); // });
} else if (id == R.id.fl_order_content) { } else if (id == R.id.tv_order_content) {
//如果打印成功會回調 //如果打印成功會回調
Intent intent = new Intent(mContext, OrderContentActivity.class); Intent intent = new Intent(mContext, OrderContentActivity.class);
startActivityForResult(intent, ORDER_CONTENT_CODE); startActivityForResult(intent, ORDER_CONTENT_CODE);
......
...@@ -315,9 +315,9 @@ public class SoldoutCtrlActivity extends BaseFragmentActivity<SoldoutCtrlPresent ...@@ -315,9 +315,9 @@ public class SoldoutCtrlActivity extends BaseFragmentActivity<SoldoutCtrlPresent
//循坏加入点点图片组 //循坏加入点点图片组
ivPoints[i] = new ImageView(this); ivPoints[i] = new ImageView(this);
if (i == 0) { if (i == 0) {
ivPoints[i].setImageResource(R.drawable.base_recycle_bottom_point_focuese); ivPoints[i].setImageResource(R.drawable.base_red_point);
} else { } else {
ivPoints[i].setImageResource(R.drawable.base_recycle_bottom_point_unfocused); ivPoints[i].setImageResource(R.drawable.base_grey_point);
} }
ivPoints[i].setPadding(0, 0, 0, 0); ivPoints[i].setPadding(0, 0, 0, 0);
ll_food_group_point.addView(ivPoints[i]); ll_food_group_point.addView(ivPoints[i]);
...@@ -714,9 +714,9 @@ public class SoldoutCtrlActivity extends BaseFragmentActivity<SoldoutCtrlPresent ...@@ -714,9 +714,9 @@ public class SoldoutCtrlActivity extends BaseFragmentActivity<SoldoutCtrlPresent
mPageIndex = pageIndex; mPageIndex = pageIndex;
for (int i = 0; i < totalPage; i++) { for (int i = 0; i < totalPage; i++) {
if (i == pageIndex) { if (i == pageIndex) {
ivPoints[i].setImageResource(R.drawable.base_recycle_bottom_point_focuese); ivPoints[i].setImageResource(R.drawable.base_red_point);
} else { } else {
ivPoints[i].setImageResource(R.drawable.base_recycle_bottom_point_unfocused); ivPoints[i].setImageResource(R.drawable.base_grey_point);
} }
} }
} }
......
...@@ -217,8 +217,8 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen ...@@ -217,8 +217,8 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
@Override @Override
public void onClick(View v) { public void onClick(View v) {
LoganManager.w_tableMode(TAG, "手動刷新餐檯數據"); LoganManager.w_tableMode(TAG, "手動刷新餐檯數據");
launchActivity(new Intent(mContext, CoordinatorlayoutActivity.class)); // launchActivity(new Intent(mContext, CoordinatorlayoutActivity.class));
// getTables(true, null); getTables(true, null);
} }
}); });
rightButton2.setOnClickListener(new View.OnClickListener() { rightButton2.setOnClickListener(new View.OnClickListener() {
......
...@@ -97,16 +97,14 @@ public class BillItemAdapter extends DefaultAdapter<BillItem> { ...@@ -97,16 +97,14 @@ public class BillItemAdapter extends DefaultAdapter<BillItem> {
tv_money.setText(cashStr + datasBean.getMoney()); tv_money.setText(cashStr + datasBean.getMoney());
} }
if (datasBean instanceof ServiceChargeItem) { // 默认没有划线
if (isUseFreeServicePayMethod) { tv_title.getPaint().setFlags(0);
// 中划线 tv_money.getPaint().setFlags(0);
tv_title.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
tv_money.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); if (datasBean instanceof ServiceChargeItem && isUseFreeServicePayMethod) {
} else { // 中划线
// 取消设置的的划线 tv_title.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
tv_title.getPaint().setFlags(0); tv_money.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
tv_money.getPaint().setFlags(0);
}
} }
tv_title.setTextSize(BillTotalFontSize); tv_title.setTextSize(BillTotalFontSize);
...@@ -115,10 +113,13 @@ public class BillItemAdapter extends DefaultAdapter<BillItem> { ...@@ -115,10 +113,13 @@ public class BillItemAdapter extends DefaultAdapter<BillItem> {
tv_title.setTextColor(datasBean.getTextColor()); tv_title.setTextColor(datasBean.getTextColor());
tv_money.setTextColor(datasBean.getTextColor()); tv_money.setTextColor(datasBean.getTextColor());
// if (mContext instanceof OrderContentActivity &&
// (datasBean.getType() == BillOrderMoney.NOMAL_DISCOUNT_TYPE || datasBean.getType() == BillOrderMoney.COUPON_DISCOUNT_TYPE) &&
// datasBean.getType() != BillOrderMoney.MEMBER_DISCOUNT_TYPE &&
// datasBean.getStatus() == 0) {
if (mContext instanceof OrderContentActivity && if (mContext instanceof OrderContentActivity &&
(datasBean.getType() == BillOrderMoney.NOMAL_DISCOUNT_TYPE || datasBean.getType() == BillOrderMoney.COUPON_DISCOUNT_TYPE) && (datasBean.getType() == BillOrderMoney.NOMAL_DISCOUNT_TYPE || datasBean.getType() == BillOrderMoney.COUPON_DISCOUNT_TYPE) &&
datasBean.getType() != BillOrderMoney.MEMBER_DISCOUNT_TYPE && datasBean.getType() != BillOrderMoney.MEMBER_DISCOUNT_TYPE) {
datasBean.getStatus() == 0) {
iv_delete.setVisibility(View.VISIBLE); iv_delete.setVisibility(View.VISIBLE);
iv_delete.setOnClickListener(v -> { iv_delete.setOnClickListener(v -> {
if (mOnItemClickListener != null) { if (mOnItemClickListener != null) {
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--<androidx.coordinatorlayout.widget.CoordinatorLayout-->
<androidx.coordinatorlayout.widget.CoordinatorLayout <!-- xmlns:android="http://schemas.android.com/apk/res/android"-->
xmlns:android="http://schemas.android.com/apk/res/android" <!-- xmlns:app="http://schemas.android.com/apk/res-auto"-->
xmlns:app="http://schemas.android.com/apk/res-auto" <!-- android:id="@+id/coordinator_layout"-->
android:id="@+id/coordinator_layout" <!-- android:layout_width="match_parent"-->
android:layout_width="match_parent" <!-- android:layout_height="match_parent">-->
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout <!-- <com.google.android.material.appbar.AppBarLayout-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="wrap_content"> <!-- android:layout_height="wrap_content">-->
<TextView <!-- <TextView-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="100dp" <!-- android:layout_height="100dp"-->
android:background="#222222" <!-- android:background="#222222"-->
android:gravity="center" <!-- android:gravity="center"-->
android:text="该区域可折叠" <!-- android:text="该区域可折叠"-->
android:textColor="@android:color/white" <!-- android:textColor="@android:color/white"-->
android:textSize="30sp" <!-- android:textSize="30sp"-->
app:layout_scrollFlags="scroll" /> <!-- app:layout_scrollFlags="scroll" />-->
<TextView <!-- <TextView-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="50dp" <!-- android:layout_height="50dp"-->
android:background="#DD012D" <!-- android:background="#DD012D"-->
android:gravity="center" <!-- android:gravity="center"-->
android:text="该区域为上滑至头部固定区域" <!-- android:text="该区域为上滑至头部固定区域"-->
android:textColor="@android:color/white" <!-- android:textColor="@android:color/white"-->
android:textSize="20sp" /> <!-- android:textSize="20sp" />-->
</com.google.android.material.appbar.AppBarLayout> <!-- </com.google.android.material.appbar.AppBarLayout>-->
<!-- <com.google.android.material.bottomappbar.BottomAppBar--> <!-- <com.google.android.material.bottomappbar.BottomAppBar-->
<!-- android:id="@+id/bar"--> <!-- android:id="@+id/bar"-->
...@@ -58,4 +57,45 @@ ...@@ -58,4 +57,45 @@
<!-- android:layout_height="wrap_content" />--> <!-- android:layout_height="wrap_content" />-->
<!-- </FrameLayout>--> <!-- </FrameLayout>-->
</androidx.coordinatorlayout.widget.CoordinatorLayout> <!--</androidx.coordinatorlayout.widget.CoordinatorLayout>-->
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@color/green_400">
<!-- <include layout="@layout/cat_bottomappbar_content"/>-->
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:fitsSystemWindows="true" />
<!-- <com.google.android.material.floatingactionbutton.FloatingActionButton-->
<!-- android:id="@+id/fab"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_anchor="@+id/bar"-->
<!-- app:srcCompat="@drawable/ic_account" />-->
<!-- <FrameLayout-->
<!-- android:id="@+id/bottom_drawer"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:elevation="16dp"-->
<!-- app:behavior_hideable="true"-->
<!-- app:layout_behavior="@string/bottom_sheet_behavior">-->
<!-- <com.google.android.material.navigation.NavigationView-->
<!-- android:id="@+id/navigation_view"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:menu="@menu/table_function_menu" />-->
<!-- </FrameLayout>-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
...@@ -7,8 +7,8 @@ ext { ...@@ -7,8 +7,8 @@ ext {
targetSdkVersion : 29, targetSdkVersion : 29,
//正式版: 1.0.3 3 //正式版: 1.0.3 3
//內部測試版:1.2.0 20 //內部測試版:1.2.0 20
versionCode : 24, versionCode : 25,
versionName : "1.2.4" versionName : "1.2.5"
] ]
version = [ version = [
...@@ -33,39 +33,40 @@ ext { ...@@ -33,39 +33,40 @@ ext {
dependencies = [ dependencies = [
//support //support
"appcompat-v7" : 'androidx.appcompat:appcompat:1.0.2',//不要超過1.0.2,不然android5.1.1用webview會有問題 "appcompat-v7" : 'androidx.appcompat:appcompat:1.0.2',//不要超過1.0.2,不然android5.1.1用webview會有問題
"design" : 'com.google.android.material:material:1.0.0', "design" : 'com.google.android.material:material:1.0.0',
"support-design" : 'com.android.support:design:28.0.0', "support-design" : 'com.android.support:design:28.0.0',
"support-v4" : 'androidx.legacy:legacy-support-v4:1.0.0', "support-v4" : 'androidx.legacy:legacy-support-v4:1.0.0',
"cardview-v7" : 'androidx.cardview:cardview:1.0.0', "cardview-v7" : 'androidx.cardview:cardview:1.0.0',
"annotations" : 'androidx.annotation:annotation:1.0.0', "annotations" : 'androidx.annotation:annotation:1.0.0',
"recyclerview-v7" : 'androidx.recyclerview:recyclerview:1.0.0', "recyclerview-v7" : 'androidx.recyclerview:recyclerview:1.0.0',
"coordinatorlayout" : 'androidx.coordinatorlayout:coordinatorlayout:1.1.0', "coordinatorlayout" : 'androidx.coordinatorlayout:coordinatorlayout:1.1.0',
//network //network
"retrofit" : "com.squareup.retrofit2:retrofit:${version["retrofitSdkVersion"]}", "retrofit" : "com.squareup.retrofit2:retrofit:${version["retrofitSdkVersion"]}",
"retrofit-converter-gson" : "com.squareup.retrofit2:converter-gson:${version["retrofitSdkVersion"]}", "retrofit-converter-gson" : "com.squareup.retrofit2:converter-gson:${version["retrofitSdkVersion"]}",
"retrofit-adapter-rxjava" : "com.squareup.retrofit2:adapter-rxjava:${version["retrofitSdkVersion"]}", "retrofit-adapter-rxjava" : "com.squareup.retrofit2:adapter-rxjava:${version["retrofitSdkVersion"]}",
"retrofit-adapter-rxjava2" : "com.squareup.retrofit2:adapter-rxjava2:${version["retrofitSdkVersion"]}", "retrofit-adapter-rxjava2": "com.squareup.retrofit2:adapter-rxjava2:${version["retrofitSdkVersion"]}",
"okhttp3" : "com.squareup.okhttp3:okhttp:3.8.1", "okhttp3" : "com.squareup.okhttp3:okhttp:3.8.1",
"okhttp-urlconnection" : "com.squareup.okhttp:okhttp-urlconnection:2.0.0", "okhttp-urlconnection" : "com.squareup.okhttp:okhttp-urlconnection:2.0.0",
"glide" : "com.github.bumptech.glide:glide:${version["glideSdkVersion"]}", "glide" : "com.github.bumptech.glide:glide:${version["glideSdkVersion"]}",
"glide-compiler" : "com.github.bumptech.glide:compiler:${version["glideSdkVersion"]}", "glide-compiler" : "com.github.bumptech.glide:compiler:${version["glideSdkVersion"]}",
"glide-loader-okhttp3" : "com.github.bumptech.glide:okhttp3-integration:${version["glideSdkVersion"]}", "glide-loader-okhttp3" : "com.github.bumptech.glide:okhttp3-integration:${version["glideSdkVersion"]}",
"picasso" : "com.squareup.picasso:picasso:2.5.2", "picasso" : "com.squareup.picasso:picasso:2.5.2",
//view //view
"autolayout" : "com.zhy:autolayout:1.4.5", "autolayout" : "com.zhy:autolayout:1.4.5",
"autosize" : 'me.jessyan:autosize:1.1.2', "autosize" : 'me.jessyan:autosize:1.1.2',
"butterknife" : "com.jakewharton:butterknife:${version["butterknifeSdkVersion"]}", "butterknife" : "com.jakewharton:butterknife:${version["butterknifeSdkVersion"]}",
"butterknife-compiler" : "com.jakewharton:butterknife-compiler:${version["butterknifeSdkVersion"]}", "butterknife-compiler" : "com.jakewharton:butterknife-compiler:${version["butterknifeSdkVersion"]}",
"pickerview" : "com.contrarywind:Android-PickerView:4.1.9", "pickerview" : "com.contrarywind:Android-PickerView:4.1.9",
"photoview" : "com.github.chrisbanes.photoview:library:1.2.3", "photoview" : "com.github.chrisbanes.photoview:library:1.2.3",
"numberprogressbar" : "com.daimajia.numberprogressbar:library:1.2@aar", "numberprogressbar" : "com.daimajia.numberprogressbar:library:1.2@aar",
"nineoldandroids" : "com.nineoldandroids:library:2.4.0", "nineoldandroids" : "com.nineoldandroids:library:2.4.0",
"paginate" : "com.github.markomilos:paginate:0.5.1", "paginate" : "com.github.markomilos:paginate:0.5.1",
"vlayout" : "com.alibaba.android:vlayout:1.1.0@aar", "vlayout" : "com.alibaba.android:vlayout:1.1.0@aar",
"loadsir" : "com.kingja.loadsir:loadsir:1.3.8", "loadsir" : "com.kingja.loadsir:loadsir:1.3.8",
"lottie" : "com.airbnb.android:lottie:2.7.0",
//rx1 //rx1
"rxandroid" : "io.reactivex:rxandroid:1.2.1", "rxandroid" : "io.reactivex:rxandroid:1.2.1",
......
...@@ -150,6 +150,8 @@ dependencies { ...@@ -150,6 +150,8 @@ dependencies {
api rootProject.ext.dependencies["pickerview"] api rootProject.ext.dependencies["pickerview"]
//底部功能導航view //底部功能導航view
api 'com.github.ittianyu:BottomNavigationViewEx:2.0.4' api 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
//lottie
api rootProject.ext.dependencies["lottie"]
//滴滴開源 哆啦A夢:辅助开发工具、测试效率工具、视觉辅助工具 //滴滴開源 哆啦A夢:辅助开发工具、测试效率工具、视觉辅助工具
debugImplementation 'com.didichuxing.doraemonkit:dokitx:3.3.3' debugImplementation 'com.didichuxing.doraemonkit:dokitx:3.3.3'
releaseImplementation 'com.didichuxing.doraemonkit:dokitx-no-op:3.3.3' releaseImplementation 'com.didichuxing.doraemonkit:dokitx-no-op:3.3.3'
......
...@@ -143,7 +143,7 @@ public class GsaCloudApplication extends BaseApplication { ...@@ -143,7 +143,7 @@ public class GsaCloudApplication extends BaseApplication {
//初始化QMUI相关 //初始化QMUI相关
initQMUI(); initQMUI();
//初始化哆啦A夢 //初始化哆啦A夢
// initDoraemonKit(); initDoraemonKit();
//初始化上下拉刷新 //初始化上下拉刷新
initRefresh(); initRefresh();
//初始化加载反馈页管理框架 //初始化加载反馈页管理框架
...@@ -166,7 +166,6 @@ public class GsaCloudApplication extends BaseApplication { ...@@ -166,7 +166,6 @@ public class GsaCloudApplication extends BaseApplication {
//上傳餐廳擴展信息 //上傳餐廳擴展信息
ExpandInfoSetting.initUpdateExtendedConfiguration(uiStyleConfiguration, functionConfiguration); ExpandInfoSetting.initUpdateExtendedConfiguration(uiStyleConfiguration, functionConfiguration);
LoganManager.w_action(TAG, TAG + ": onCreate end....."); LoganManager.w_action(TAG, TAG + ": onCreate end.....");
} }
...@@ -202,7 +201,7 @@ public class GsaCloudApplication extends BaseApplication { ...@@ -202,7 +201,7 @@ public class GsaCloudApplication extends BaseApplication {
* 初始化滴滴開發,測試輔助工具哆啦A夢 * 初始化滴滴開發,測試輔助工具哆啦A夢
*/ */
private void initDoraemonKit() { private void initDoraemonKit() {
DoraemonKit.install(getAppContext(), DoraemonKitConfig.PRODUCE_ID); // DoraemonKit.install(getAppContext(), DoraemonKitConfig.PRODUCE_ID);
} }
/** /**
...@@ -363,8 +362,12 @@ public class GsaCloudApplication extends BaseApplication { ...@@ -363,8 +362,12 @@ public class GsaCloudApplication extends BaseApplication {
} }
@Override @Override
public void onPrintError(int errorCode) { public void onPrintError(Exception e, int errorCode) {
LoganManager.w_printer(TAG, "打印失敗:" + errorCode); if (e != null) {
LoganManager.w_printer(TAG, "打印失敗:" + e.getMessage());
} else {
LoganManager.w_printer(TAG, "打印失敗:" + errorCode);
}
} }
@Override @Override
...@@ -380,7 +383,11 @@ public class GsaCloudApplication extends BaseApplication { ...@@ -380,7 +383,11 @@ public class GsaCloudApplication extends BaseApplication {
@Override @Override
public void connectionError(Exception e) { public void connectionError(Exception e) {
LoganManager.w_printer(TAG, "連接打印機失敗" ); if (e != null) {
LoganManager.w_printer(TAG, "連接打印機失敗:" + e.getMessage());
} else {
LoganManager.w_printer(TAG, "連接打印機失敗");
}
} }
@Override @Override
......
...@@ -14,8 +14,8 @@ public class LoganConfig { ...@@ -14,8 +14,8 @@ public class LoganConfig {
public static final String EncryptKey16 = "0123456789012345"; public static final String EncryptKey16 = "0123456789012345";
public static final String EncryptIV16 = "0123456789012345"; public static final String EncryptIV16 = "0123456789012345";
public static final String APP_ID = "gingersoft1008611"; public static final String APP_ID = "gingersoft1008611";
public static final String UPLOAD_LOG_URL = HttpsConstans.HTTP_ADDRESS_URL_HK+ "/logan-web/logan/upload.json"; // public static final String UPLOAD_LOG_URL = HttpsConstans.HTTP_ADDRESS_URL_HK+ "/logan-web/logan/upload.json";
// public static final String UPLOAD_LOG_URL = "http://192.168.1.131:8080/logan-web/logan/upload.json"; public static final String UPLOAD_LOG_URL = "http://192.168.1.131:8080/logan-web/logan/upload.json";
/** /**
* 日誌保留天數 * 日誌保留天數
......
...@@ -25,7 +25,7 @@ public class ExpandConstant { ...@@ -25,7 +25,7 @@ public class ExpandConstant {
public final static String ItemDecimals = "ItemDecimals"; public final static String ItemDecimals = "ItemDecimals";
public final static String MergeSendFood = "MergeSendFood"; public final static String MergeSendFood = "MergeSendFood";
/**送單自動打印上菜紙*/ /**送單自動打印上菜紙*/
public final static String AutoPrinterPaper = "AutoPrinterParper"; public final static String AutoPrinterPaper = "AutoPrinterPaper";
/**結賬是否打印積分二維碼*/ /**結賬是否打印積分二維碼*/
public final static String ToPrintQRCode = "ToPrintQRCode"; public final static String ToPrintQRCode = "ToPrintQRCode";
......
...@@ -155,7 +155,6 @@ public class RestaurantExpandInfoUtils { ...@@ -155,7 +155,6 @@ public class RestaurantExpandInfoUtils {
} }
} }
} }
int i = 100;
} }
......
...@@ -62,6 +62,7 @@ public class PrinterFileUtils { ...@@ -62,6 +62,7 @@ public class PrinterFileUtils {
public static void savePrinterBitmapByType(int orderType, int printType, String directoryName, List<Bitmap> bitmaps) { public static void savePrinterBitmapByType(int orderType, int printType, String directoryName, List<Bitmap> bitmaps) {
RxIOTask rxIOTask = new RxIOTask(0) { RxIOTask rxIOTask = new RxIOTask(0) {
@Override @Override
public Object doInIOThread(Object o) { public Object doInIOThread(Object o) {
String savePath = getPathByPrintType(printType); String savePath = getPathByPrintType(printType);
......
...@@ -11,7 +11,7 @@ import java.util.Map; ...@@ -11,7 +11,7 @@ import java.util.Map;
* @作者: bin * @作者: bin
* @創建時間: 2021-01-25 10:19 * @創建時間: 2021-01-25 10:19
* @更新時間: 2021-01-25 10:19 * @更新時間: 2021-01-25 10:19
* @描述:打印整體打印流程(打印前數據信息,圖片->連接成功(失敗)->打印成功(失敗)->斷開連接) * @描述:打印整體流程(打印前數據信息,圖片->連接成功(失敗)->打印成功(失敗)->斷開連接)
*/ */
public interface PrinterFlowListener extends ExternalPrinterConnection { public interface PrinterFlowListener extends ExternalPrinterConnection {
/** /**
...@@ -44,5 +44,5 @@ public interface PrinterFlowListener extends ExternalPrinterConnection { ...@@ -44,5 +44,5 @@ public interface PrinterFlowListener extends ExternalPrinterConnection {
* *
* @param errorCode 錯誤碼 * @param errorCode 錯誤碼
*/ */
void onPrintError(int errorCode); void onPrintError(Exception e,int errorCode);
} }
...@@ -222,9 +222,17 @@ class GetInfoUpdateService : Service() { ...@@ -222,9 +222,17 @@ class GetInfoUpdateService : Service() {
if (postCallBack != null) { if (postCallBack != null) {
postCallBack!!.callBack(type) postCallBack!!.callBack(type)
} }
//-1斷開連接,\n-2:消息傳輸錯誤,\n0:連接消息,\n1:登錄通知,\n2:登出通知,\n3:外賣送單通知,\n4:自取送單通知,\n5:歷史訂單通知,\n6:修改訂單狀態通知,\n7:支付成功通知" //-1斷開連接,
if (type == 3 || type == 4 || type == 5 // \n-2:消息傳輸錯誤,
|| type == 7) { // \n0:連接消息,
// \n1:登錄通知,
// \n2:登出通知,
// \n3:外賣送單通知,
// \n4:自取送單通知,
// \n5:歷史訂單通知,
// \n6:修改訂單狀態通知,
// \n7:支付成功通知"
if (type == 3 || type == 4 || type == 5 || type == 7) {
//播放提示音 //播放提示音
initSoundPool(R.raw.newordervocal) initSoundPool(R.raw.newordervocal)
} else if (type == 8) { } else if (type == 8) {
......
...@@ -12,10 +12,8 @@ import com.scwang.smartrefresh.layout.listener.OnStateChangedListener; ...@@ -12,10 +12,8 @@ import com.scwang.smartrefresh.layout.listener.OnStateChangedListener;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.net.ConnectException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.List; import java.util.List;
/** /**
...@@ -81,6 +79,14 @@ public class PrintSocketHolder { ...@@ -81,6 +79,14 @@ public class PrintSocketHolder {
e.printStackTrace(); e.printStackTrace();
LoganManager.w_printer(TAG, "連接打印機失敗: " + ip + ":" + port + "." + e.getMessage()); LoganManager.w_printer(TAG, "連接打印機失敗: " + ip + ":" + port + "." + e.getMessage());
return ERROR_7; return ERROR_7;
} catch (SocketException e) {
e.printStackTrace();
PrinterPlugins.getOnPrinterFlowHandler().connectionError(e);
return ERROR_7;
} catch (IOException e) {
e.printStackTrace();
PrinterPlugins.getOnPrinterFlowHandler().connectionError(e);
return ERROR_7;
} catch (Exception e) { } catch (Exception e) {
closeSocket(); closeSocket();
e.printStackTrace(); e.printStackTrace();
...@@ -97,6 +103,7 @@ public class PrintSocketHolder { ...@@ -97,6 +103,7 @@ public class PrintSocketHolder {
} catch (IOException e) { } catch (IOException e) {
LoganManager.w_printer(TAG, "獲取打印機輸入流異常: " + socket.getInetAddress() + e.getMessage()); LoganManager.w_printer(TAG, "獲取打印機輸入流異常: " + socket.getInetAddress() + e.getMessage());
closeSocket(); closeSocket();
PrinterPlugins.getOnPrinterFlowHandler().connectionError(e);
return ERROR_10; return ERROR_10;
} }
return ERROR_0; return ERROR_0;
...@@ -126,6 +133,7 @@ public class PrintSocketHolder { ...@@ -126,6 +133,7 @@ public class PrintSocketHolder {
out.flush(); out.flush();
} catch (IOException | NullPointerException e) { } catch (IOException | NullPointerException e) {
LoganManager.w_printer(TAG, "打印prj寫入數據异常: " + e.getMessage()); LoganManager.w_printer(TAG, "打印prj寫入數據异常: " + e.getMessage());
PrinterPlugins.getOnPrinterFlowHandler().onPrintError(e, ERROR_10);
closeSocket(); closeSocket();
return ERROR_10; return ERROR_10;
} }
......
...@@ -149,7 +149,23 @@ public class OrderPayView extends LinearLayout { ...@@ -149,7 +149,23 @@ public class OrderPayView extends LinearLayout {
return; return;
} }
boolean useFreeServicePayMethod = isUseFreeServicePayMethod(method); if (mBillMoneyList.size() > 0 && PayMethodUtils.withHywebPayMethod(method)) {
int hywebPayMethodIndex = PayMethodUtils.hasHywebPayMethod(mBillMoneyList);
if (hywebPayMethodIndex != -1) {
//只允許存在一個hyweb支付
mBillMoneyList.remove(hywebPayMethodIndex);
}
}
if (mBillMoneyList.size() >= MAX_COUNT_PAY_MEMBER) {
//替换掉第一个
mBillMoneyList.remove(0);
mBillMoneyList.add(method);
} else {
mBillMoneyList.add(method);
}
boolean useFreeServicePayMethod = hasUseFreeServicePayMethod(method);
if (useFreeServicePayMethod) { if (useFreeServicePayMethod) {
//有使用免服務費支付方式 重新獲取一遍尚欠金額 //有使用免服務費支付方式 重新獲取一遍尚欠金額
paymentDifference = getPaymentDifference(); paymentDifference = getPaymentDifference();
...@@ -181,21 +197,6 @@ public class OrderPayView extends LinearLayout { ...@@ -181,21 +197,6 @@ public class OrderPayView extends LinearLayout {
} }
} }
} }
if (mBillMoneyList.size() > 0 && PayMethodUtils.withHywebPayMethod(method)) {
int hywebPayMethodIndex = PayMethodUtils.hasHywebPayMethod(mBillMoneyList);
if (hywebPayMethodIndex != -1) {
//只允許存在一個hyweb支付
mBillMoneyList.remove(hywebPayMethodIndex);
}
}
if (mBillMoneyList.size() >= MAX_COUNT_PAY_MEMBER) {
//替换掉第一个
mBillMoneyList.remove(0);
mBillMoneyList.add(method);
} else {
mBillMoneyList.add(method);
}
int notifyPosition = mBillMoneyList.size() - 1; int notifyPosition = mBillMoneyList.size() - 1;
mBillMoneyAdapter.setSelect_position(notifyPosition); mBillMoneyAdapter.setSelect_position(notifyPosition);
...@@ -235,7 +236,7 @@ public class OrderPayView extends LinearLayout { ...@@ -235,7 +236,7 @@ public class OrderPayView extends LinearLayout {
//設置差額狀態 //設置差額狀態
setDifferenceText(context); setDifferenceText(context);
setWhetherFreeServiceCallback(isUseFreeServicePayMethod(null)); setWhetherFreeServiceCallback(hasUseFreeServicePayMethod(null));
if (onSelectPayClickLisenter != null) { if (onSelectPayClickLisenter != null) {
onSelectPayClickLisenter.delClick(datasBean); onSelectPayClickLisenter.delClick(datasBean);
...@@ -255,7 +256,7 @@ public class OrderPayView extends LinearLayout { ...@@ -255,7 +256,7 @@ public class OrderPayView extends LinearLayout {
ToastUtils.show(context, "請選擇支付方式"); ToastUtils.show(context, "請選擇支付方式");
return; return;
} }
boolean useFreeServicePayMethod = isUseFreeServicePayMethod(selectPayMethod); boolean useFreeServicePayMethod = hasUseFreeServicePayMethod(selectPayMethod);
setWhetherFreeServiceCallback(useFreeServicePayMethod); setWhetherFreeServiceCallback(useFreeServicePayMethod);
pressExact(); pressExact();
...@@ -316,9 +317,9 @@ public class OrderPayView extends LinearLayout { ...@@ -316,9 +317,9 @@ public class OrderPayView extends LinearLayout {
/** /**
* 設置是否免服務費回調 * 設置是否免服務費回調
*/ */
public void setWhetherFreeServiceCallback(boolean isUseFreeServicePayMethod) { public void setWhetherFreeServiceCallback(boolean hasUseFreeServicePayMethod) {
if (onFreeServiceStatusChangeLisenter != null) { if (onFreeServiceStatusChangeLisenter != null) {
onFreeServiceStatusChangeLisenter.onFreeServiceStautsChange(isUseFreeServicePayMethod); onFreeServiceStatusChangeLisenter.onFreeServiceStautsChange(hasUseFreeServicePayMethod);
} }
} }
...@@ -328,7 +329,7 @@ public class OrderPayView extends LinearLayout { ...@@ -328,7 +329,7 @@ public class OrderPayView extends LinearLayout {
* @param method * @param method
* @return * @return
*/ */
private boolean isUseFreeServicePayMethod(PayMethod method) { private boolean hasUseFreeServicePayMethod(PayMethod method) {
boolean freeServiceStatus = false; boolean freeServiceStatus = false;
if (method != null) { if (method != null) {
if (method.getWhetherFreeService() == 1) { if (method.getWhetherFreeService() == 1) {
...@@ -731,7 +732,7 @@ public class OrderPayView extends LinearLayout { ...@@ -731,7 +732,7 @@ public class OrderPayView extends LinearLayout {
} }
public interface OnFreeServiceStatusChangeLisenter { public interface OnFreeServiceStatusChangeLisenter {
void onFreeServiceStautsChange(boolean isUseFreeServicePayMethod); void onFreeServiceStautsChange(boolean hasUseFreeServicePayMethod);
} }
public interface OnSelectPayClickLisenter { public interface OnSelectPayClickLisenter {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment