Commit d9d4e87b by Wyh

3-21 首頁滑動優化,本地打印優化,報表顯示優化

parent eea0ad67
package com.gingersoft.gsa.cloud.main.mvp.ui.activity; package com.gingersoft.gsa.cloud.main.mvp.ui.activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -138,6 +139,19 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N ...@@ -138,6 +139,19 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
refresh.setEnableLoadMore(false); refresh.setEnableLoadMore(false);
initFuncationData(); initFuncationData();
setTitleInfo(); setTitleInfo();
//側滑顯示或關閉時,修改背景圓角
GradientDrawable drawable = new GradientDrawable();
drawable.setColor(getResources().getColor(R.color.theme_bg_color));
slideMenu.setOnOpenChangedListenter(isOpen -> {
if (isOpen) {
drawable.setCornerRadii(new float[]{0f, 0f, getResources().getDimension(R.dimen.main_page_radius), getResources().getDimension(R.dimen.main_page_radius), 0f, 0f, getResources().getDimension(R.dimen.main_page_radius), getResources().getDimension(R.dimen.main_page_radius)});
} else {
drawable.setCornerRadius(0);
}
refresh.setBackground(drawable);
});
} }
/** /**
...@@ -408,6 +422,9 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N ...@@ -408,6 +422,9 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {
if (slideMenu.isOpen()) {
slideMenu.closeMenu();
} else {
if ((System.currentTimeMillis() - mExitTime) > 2000) { if ((System.currentTimeMillis() - mExitTime) > 2000) {
showMessage("再按一次退出應用"); showMessage("再按一次退出應用");
mExitTime = System.currentTimeMillis(); mExitTime = System.currentTimeMillis();
...@@ -415,6 +432,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N ...@@ -415,6 +432,7 @@ public class NewMainActivity extends BaseActivity<NewMainPresenter> implements N
finish(); finish();
System.exit(0); System.exit(0);
} }
}
return true; return true;
} }
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
......
...@@ -233,7 +233,7 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales ...@@ -233,7 +233,7 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
salesChart.setDragDecelerationFrictionCoef(0.95f); salesChart.setDragDecelerationFrictionCoef(0.95f);
// salesChart.setCenterText(generateCenterSpannableText()); // salesChart.setCenterText(generateCenterSpannableText());
//相當於左右間距 //相當於左右間距
salesChart.setExtraOffsets(0, 0f, 0, 0f); salesChart.setExtraOffsets(0, 15f, 0, 15f);
//是否繪製中心圓 //是否繪製中心圓
salesChart.setDrawHoleEnabled(true); salesChart.setDrawHoleEnabled(true);
salesChart.setHoleColor(Color.WHITE); salesChart.setHoleColor(Color.WHITE);
......
package com.gingersoft.gsa.cloud.main.mvp.ui.view; package com.gingersoft.gsa.cloud.main.mvp.ui.view;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -29,7 +29,11 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -29,7 +29,11 @@ public class SlidingMenu extends HorizontalScrollView {
private ViewGroup mContent; private ViewGroup mContent;
private View touchView; private View touchView;
private Drawable contentBg; private OnOpenChangedListenter onOpenChangedListenter;
public interface OnOpenChangedListenter {
void onChange(boolean isOpen);
}
public SlidingMenu(Context context) { public SlidingMenu(Context context) {
this(context, null); this(context, null);
...@@ -55,8 +59,6 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -55,8 +59,6 @@ public class SlidingMenu extends HorizontalScrollView {
mMenu = (ViewGroup) wrapper.getChildAt(0); mMenu = (ViewGroup) wrapper.getChildAt(0);
mContent = (ViewGroup) wrapper.getChildAt(1); mContent = (ViewGroup) wrapper.getChildAt(1);
touchView = mContent.findViewById(R.id.line_chart_view); touchView = mContent.findViewById(R.id.line_chart_view);
contentBg = mContent.getBackground();
mMenuWidth = mScreenWidth - mMenuRightPadding; mMenuWidth = mScreenWidth - mMenuRightPadding;
mHalfMenuWidth = mMenuWidth / 2; mHalfMenuWidth = mMenuWidth / 2;
mMenu.getLayoutParams().width = mMenuWidth; mMenu.getLayoutParams().width = mMenuWidth;
...@@ -75,19 +77,29 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -75,19 +77,29 @@ public class SlidingMenu extends HorizontalScrollView {
} }
} }
private float downX, downY;
private long downTimeMillis;
@Override @Override
public boolean onInterceptTouchEvent(MotionEvent ev) { public boolean onInterceptTouchEvent(MotionEvent ev) {
if (touchView != null) { if (ev.getAction() == MotionEvent.ACTION_DOWN) {
// switch (ev.getAction()){ downX = ev.getX();
// case MotionEvent.ACTION_DOWN: downY = ev.getY();
downTimeMillis = System.currentTimeMillis();
} else if (ev.getAction() == MotionEvent.ACTION_UP) {
if (isOpen && downX > mContent.getLeft() && ev.getX() > mContent.getLeft()
&& System.currentTimeMillis() < downTimeMillis + 500) {
closeMenu();
return true;
}
return false;
} else if (touchView != null) {
float x = ev.getX(); float x = ev.getX();
float y = ev.getY(); float y = ev.getY();
if (x < touchView.getRight() && x > touchView.getLeft() if (x < touchView.getRight() && x > touchView.getLeft()
&& y > touchView.getTop() && y < touchView.getBottom()) { && y > touchView.getTop() && y < touchView.getBottom()) {
return false; return false;
} }
// break;
// }
} }
return super.onInterceptTouchEvent(ev); return super.onInterceptTouchEvent(ev);
} }
...@@ -101,10 +113,10 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -101,10 +113,10 @@ public class SlidingMenu extends HorizontalScrollView {
int scrollX = getScrollX(); int scrollX = getScrollX();
if (scrollX > mHalfMenuWidth) { if (scrollX > mHalfMenuWidth) {
this.smoothScrollTo(mMenuWidth, 0); this.smoothScrollTo(mMenuWidth, 0);
isOpen = false; setOpen(false);
} else { } else {
this.smoothScrollTo(0, 0); this.smoothScrollTo(0, 0);
isOpen = true; setOpen(true);
} }
return true; return true;
} }
...@@ -119,9 +131,7 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -119,9 +131,7 @@ public class SlidingMenu extends HorizontalScrollView {
if (isOpen) if (isOpen)
return; return;
this.smoothScrollTo(0, 0); this.smoothScrollTo(0, 0);
isOpen = true; setOpen(true);
// ShadowUtil.setShadowDrawable(mContent, Color.parseColor("#FFFFFF"), 50,
// Color.parseColor("#73888888"), 50, 0, 2);
invalidate(); invalidate();
} }
...@@ -131,8 +141,7 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -131,8 +141,7 @@ public class SlidingMenu extends HorizontalScrollView {
public void closeMenu() { public void closeMenu() {
if (isOpen) { if (isOpen) {
this.smoothScrollTo(mMenuWidth, 0); this.smoothScrollTo(mMenuWidth, 0);
isOpen = false; setOpen(false);
mContent.setBackground(contentBg);
} }
} }
...@@ -162,4 +171,23 @@ public class SlidingMenu extends HorizontalScrollView { ...@@ -162,4 +171,23 @@ public class SlidingMenu extends HorizontalScrollView {
ViewHelper.setScaleX(mContent, rightScale); ViewHelper.setScaleX(mContent, rightScale);
ViewHelper.setScaleY(mContent, rightScale); ViewHelper.setScaleY(mContent, rightScale);
} }
public OnOpenChangedListenter getOnOpenChangedListenter() {
return onOpenChangedListenter;
}
public void setOnOpenChangedListenter(OnOpenChangedListenter onOpenChangedListenter) {
this.onOpenChangedListenter = onOpenChangedListenter;
}
public boolean isOpen() {
return isOpen;
}
public void setOpen(boolean open) {
isOpen = open;
if (onOpenChangedListenter != null) {
onOpenChangedListenter.onChange(isOpen);
}
}
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#00C0FA"
android:centerColor="#015EEA"
android:startColor="#00C0FA" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- <corners-->
<!-- android:bottomLeftRadius="@dimen/main_page_radius"-->
<!-- android:bottomRightRadius="@dimen/main_page_radius" />-->
<corners android:radius="@dimen/dp_4" /> <solid android:color="@color/theme_bg_color" />
<solid android:color="@color/white" />
</shape> </shape>
\ No newline at end of file
...@@ -4,4 +4,8 @@ ...@@ -4,4 +4,8 @@
android:angle="270" android:angle="270"
android:endColor="#0097f0" android:endColor="#0097f0"
android:startColor="#00C0FA" /> android:startColor="#00C0FA" />
<corners
android:topLeftRadius="@dimen/main_page_radius"
android:topRightRadius="@dimen/main_page_radius" />
</shape> </shape>
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
android:id="@+id/slideMenu" android:id="@+id/slideMenu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/theme_color"> android:background="@drawable/shape_main_bg">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:background="@color/theme_color"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"> android:orientation="vertical">
...@@ -138,15 +137,16 @@ ...@@ -138,15 +137,16 @@
android:id="@+id/qm_refresh" android:id="@+id/qm_refresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#F0edf1"> android:background="@drawable/shape_main_bottom_corners_bg">
<ScrollView <com.gingersoft.gsa.cloud.ui.view.MyScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fillViewport="true"> android:fillViewport="true">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content">
<fragment <fragment
android:id="@+id/main_top_fragment" android:id="@+id/main_top_fragment"
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
</LinearLayout> </LinearLayout>
</com.lihang.ShadowLayout> </com.lihang.ShadowLayout>
</RelativeLayout> </RelativeLayout>
</ScrollView> </com.gingersoft.gsa.cloud.ui.view.MyScrollView>
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout> </LinearLayout>
......
...@@ -75,7 +75,8 @@ ...@@ -75,7 +75,8 @@
<com.github.mikephil.charting.charts.PieChart <com.github.mikephil.charting.charts.PieChart
android:id="@+id/report_sales_chart" android:id="@+id/report_sales_chart"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_175" android:layout_height="@dimen/dp_215"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:visibility="visible" /> android:visibility="visible" />
</LinearLayout> </LinearLayout>
......
...@@ -4,4 +4,6 @@ ...@@ -4,4 +4,6 @@
<dimen name="main_recyclerview_marginLeft">@dimen/dp_15</dimen> <dimen name="main_recyclerview_marginLeft">@dimen/dp_15</dimen>
<dimen name="main_recyclerview_marginRight">@dimen/dp_15</dimen> <dimen name="main_recyclerview_marginRight">@dimen/dp_15</dimen>
<dimen name="main_page_radius">@dimen/dp_12</dimen>
</resources> </resources>
...@@ -246,7 +246,7 @@ public class PrintUtils { ...@@ -246,7 +246,7 @@ public class PrintUtils {
tableNum.setText(tableBean.getTableName()); tableNum.setText(tableBean.getTableName());
people.setText(OpenTableManage.getDefault().getPeopleNumber() + ""); people.setText(OpenTableManage.getDefault().getPeopleNumber() + "");
orderData.setText(tableBean.getCreateTime()); orderData.setText(TimeUtils.parseTimeRepeat(tableBean.getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT));
checkOutTime.setText(TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT)); checkOutTime.setText(TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT));
FoodAdapter foodAdapter = new FoodAdapter(foodList); FoodAdapter foodAdapter = new FoodAdapter(foodList);
...@@ -301,6 +301,7 @@ public class PrintUtils { ...@@ -301,6 +301,7 @@ public class PrintUtils {
} }
View view = LinearLayout.inflate(context, R.layout.print_kitchen, null); View view = LinearLayout.inflate(context, R.layout.print_kitchen, null);
TextView tvTableNumber = view.findViewById(R.id.tv_kitchen_print_table_number); TextView tvTableNumber = view.findViewById(R.id.tv_kitchen_print_table_number);
TextView tvOrderNumber = view.findViewById(R.id.tv_order_num);
TextView tvOpeningTime = view.findViewById(R.id.tv_opening_time); TextView tvOpeningTime = view.findViewById(R.id.tv_opening_time);
TextView tvOrderTime = view.findViewById(R.id.tv_order_time); TextView tvOrderTime = view.findViewById(R.id.tv_order_time);
TextView tvKitChenLocation = view.findViewById(R.id.tv_kitchen_location); TextView tvKitChenLocation = view.findViewById(R.id.tv_kitchen_location);
...@@ -321,12 +322,13 @@ public class PrintUtils { ...@@ -321,12 +322,13 @@ public class PrintUtils {
tvTableNumber2.setText(OpenTableManage.getDefault().getTableBean().getTableName() + ""); tvTableNumber2.setText(OpenTableManage.getDefault().getTableBean().getTableName() + "");
//人數 //人數
tvPeople.setText(OpenTableManage.getDefault().getPeopleNumber() + ""); tvPeople.setText(OpenTableManage.getDefault().getPeopleNumber() + "");
//訂單號
tvOrderNumber.setText("" + MyOrderManage.getInstance().getOrderId());
//開台時間 //開台時間
// SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm"); tvOpeningTime.setText(TimeUtils.parseTimeRepeat(OpenTableManage.getDefault().getTableBean().getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT));
tvOpeningTime.setText(OpenTableManage.getDefault().getTableBean().getCreateTime());
} }
//落單時間 //落單時間,為當前時間
tvOrderTime.setText(TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_MDHM)); tvOrderTime.setText(TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT));
//操作人員 //操作人員
tvOperator.setText(GsaCloudApplication.userName); tvOperator.setText(GsaCloudApplication.userName);
...@@ -346,6 +348,7 @@ public class PrintUtils { ...@@ -346,6 +348,7 @@ public class PrintUtils {
/** /**
* 獲取清機報表Bitmap * 獲取清機報表Bitmap
*
* @param mContext * @param mContext
* @return * @return
*/ */
......
...@@ -8,6 +8,7 @@ import android.os.Build; ...@@ -8,6 +8,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.os.RemoteException; import android.os.RemoteException;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.WindowManager; import android.view.WindowManager;
...@@ -126,9 +127,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -126,9 +127,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
noDefaultPrintMethod(bitmaps); noDefaultPrintMethod(bitmaps);
} else if (Objects.equals(SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, ""), Constans.LOCAL_PRINT)) { } else if (Objects.equals(SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, ""), Constans.LOCAL_PRINT)) {
// 默認打印方式為本地,進行本地打印 // 默認打印方式為本地,進行本地打印
for (int i = 0; i < bitmaps.size(); i++) { locationPrint(bitmaps);
locationPrint(bitmaps.get(i));
}
} else if (Objects.equals(SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, ""), Constans.IP_PRINT)) { } else if (Objects.equals(SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, ""), Constans.IP_PRINT)) {
// 默認打印方式為ip打印,調用ip打印方法 // 默認打印方式為ip打印,調用ip打印方法
ipPrint(); ipPrint();
...@@ -172,9 +171,9 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -172,9 +171,9 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
public void initLayout(ViewHepler hepler, Dialog dialog) { public void initLayout(ViewHepler hepler, Dialog dialog) {
dialogCount++; dialogCount++;
hepler.setViewClick(R.id.local_print, v -> { hepler.setViewClick(R.id.local_print, v -> {
for (int i = 0; i < bitmaps.size(); i++) { // for (int i = 0; i < bitmaps.size(); i++) {
locationPrint(bitmaps.get(i)); locationPrint(bitmaps);
} // }
//修改默認打印方式為本地 //修改默認打印方式為本地
SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.LOCAL_PRINT); SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.LOCAL_PRINT);
dialog.dismiss(); dialog.dismiss();
...@@ -193,7 +192,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -193,7 +192,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
*/ */
private void ipPrint() { private void ipPrint() {
//獲取默認選中的IP打印機 //獲取默認選中的IP打印機
if(Objects.equals(SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_IP, ""), "")){ if (Objects.equals(SPUtils.get(mContext, PrintConstans.DEFAULT_PRINT_IP, ""), "")) {
//如果沒有獲取到默認打印機IP //如果沒有獲取到默認打印機IP
if (PrinterManager.getPrinterManager().getDeviceBeans() != null if (PrinterManager.getPrinterManager().getDeviceBeans() != null
&& PrinterManager.getPrinterManager().getDeviceBeans().size() > 0) { && PrinterManager.getPrinterManager().getDeviceBeans().size() > 0) {
...@@ -216,9 +215,9 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -216,9 +215,9 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
/** /**
* 本地打印 * 本地打印
*/ */
private void locationPrint(Bitmap bitmap) { private void locationPrint(List<Bitmap> bitmaps) {
//本機打印 //本機打印
if (bitmap == null) { if (bitmaps == null || bitmaps.size() <= 0) {
ToastUtils.show(mContext, "未獲取到打印內容"); ToastUtils.show(mContext, "未獲取到打印內容");
printFile(); printFile();
return; return;
...@@ -226,7 +225,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -226,7 +225,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
String model = Build.MODEL; String model = Build.MODEL;
if (GsaCloudApplication.mV2.contains(model)) { if (GsaCloudApplication.mV2.contains(model)) {
//商米打印 //商米打印
AidlUtil.getInstance().printBitmap(bitmap, new InnerResultCallbcak() { AidlUtil.getInstance().printBitmaps(bitmaps, new InnerResultCallbcak() {
@Override @Override
public void onRunResult(boolean isSuccess) { public void onRunResult(boolean isSuccess) {
//返回接⼝执⾏的情况(并⾮真实打印):成功或失败 //返回接⼝执⾏的情况(并⾮真实打印):成功或失败
...@@ -242,26 +241,30 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -242,26 +241,30 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override @Override
public void onReturnString(String result) { public void onReturnString(String result) {
//部分接⼝会异步返回查询数据 //部分接⼝会异步返回查询数据
ToastUtils.show(mContext, "onReturnString:" + result); Log.e("eee", "onReturnString:" + result);
} }
@Override @Override
public void onRaiseException(int code, String msg) { public void onRaiseException(int code, String msg) {
//接⼝执⾏失败时,返回的异常状态 //接⼝执⾏失败时,返回的异常状态
ToastUtils.show(mContext, "打印異常狀態碼:" + code + "---MSG:" + msg); Log.e("eee", "打印異常狀態碼:" + code + "---MSG:" + msg);
} }
@Override @Override
public void onPrintResult(int code, String msg) { public void onPrintResult(int code, String msg) {
//事务模式下真实的打印结果返回 //事务模式下真实的打印结果返回
ToastUtils.show(mContext, "打印結果:" + code + "---MSG:" + msg); Log.e("eee", "打印結果:" + code + "---MSG:" + msg);
} }
}); });
} else if (GsaCloudApplication.mN5.contains(model)) { } else if (GsaCloudApplication.mN5.contains(model)) {
//N5打印 //N5打印
try { try {
try { try {
PrinterUtil.appendImage(bitmap, PrinterConstant.ALIGN_CENTER); for (int i = 0; i < bitmaps.size(); i++) {
PrinterUtil.appendImage(bitmaps.get(i), PrinterConstant.ALIGN_CENTER);
PrinterUtil.appendPrnStr("\n", 24, PrinterConstant.ALIGN_CENTER, false);
PrinterUtil.appendPrnStr("\n", 24, PrinterConstant.ALIGN_CENTER, false);
}
startN5Print(); startN5Print();
} catch (NullPointerException e) { } catch (NullPointerException e) {
ToastUtils.show(mContext, "打印失敗,請重試"); ToastUtils.show(mContext, "打印失敗,請重試");
......
...@@ -7,6 +7,7 @@ import androidx.annotation.Nullable; ...@@ -7,6 +7,7 @@ import androidx.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.gingersoft.gsa.cloud.base.utils.constans.Constans;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils; import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils; import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean; import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
...@@ -101,6 +102,7 @@ public class PrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean, Base ...@@ -101,6 +102,7 @@ public class PrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean, Base
notifyItemChanged(selectPosition); notifyItemChanged(selectPosition);
} }
selectPosition = helper.getAdapterPosition(); selectPosition = helper.getAdapterPosition();
SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.IP_PRINT);
ToastUtils.show(mContext, "已設置默認打印機"); ToastUtils.show(mContext, "已設置默認打印機");
} }
} }
......
...@@ -6,25 +6,33 @@ import android.os.Message; ...@@ -6,25 +6,33 @@ import android.os.Message;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Switch;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.base.utils.constans.Constans;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.jess.arms.base.BaseFragment; import com.jess.arms.base.BaseFragment;
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.R;
import com.joe.print.R2;
import com.joe.print.di.component.DaggerLocalPrintComponent; import com.joe.print.di.component.DaggerLocalPrintComponent;
import com.joe.print.di.module.LocalPrintModule; import com.joe.print.di.module.LocalPrintModule;
import com.joe.print.mvp.contract.LocalPrintContract; import com.joe.print.mvp.contract.LocalPrintContract;
import com.joe.print.mvp.presenter.LocalPrintPresenter; import com.joe.print.mvp.presenter.LocalPrintPresenter;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
/** /**
* 本機打印配置頁 * 本機打印配置頁
*/ */
public class LocalPrintFragment extends BaseFragment<LocalPrintPresenter> implements LocalPrintContract.View { public class LocalPrintFragment extends BaseFragment<LocalPrintPresenter> implements LocalPrintContract.View {
@BindView(R2.id.iv_location_print_btn)
Switch ivSetLocationPrintBtn;
public static LocalPrintFragment newInstance() { public static LocalPrintFragment newInstance() {
LocalPrintFragment fragment = new LocalPrintFragment(); LocalPrintFragment fragment = new LocalPrintFragment();
...@@ -47,8 +55,33 @@ public class LocalPrintFragment extends BaseFragment<LocalPrintPresenter> implem ...@@ -47,8 +55,33 @@ public class LocalPrintFragment extends BaseFragment<LocalPrintPresenter> implem
} }
@Override @Override
public void onResume() {
super.onResume();
initBtn();
}
@Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
ivSetLocationPrintBtn.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, "").equals(Constans.LOCAL_PRINT)) {
//如果默認打印方式為本地,修改為IP打印
SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.IP_PRINT);
ivSetLocationPrintBtn.setChecked(false);
} else {
//修改默認打印方式為本地
SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.LOCAL_PRINT);
ivSetLocationPrintBtn.setChecked(true);
}
});
}
private void initBtn() {
if (SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, "").equals(Constans.LOCAL_PRINT)) {
//如果默認打印方式為本地
ivSetLocationPrintBtn.setChecked(true);
} else {
ivSetLocationPrintBtn.setChecked(false);
}
} }
/** /**
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:text="設置默認打印為本機打印"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16"
app:layout_constraintBottom_toBottomOf="@id/iv_location_print_btn"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/iv_location_print_btn" />
</LinearLayout> <Switch
\ No newline at end of file android:id="@+id/iv_location_print_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_20"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -12,6 +12,8 @@ import com.sunmi.peripheral.printer.InnerPrinterManager; ...@@ -12,6 +12,8 @@ import com.sunmi.peripheral.printer.InnerPrinterManager;
import com.sunmi.peripheral.printer.InnerResultCallbcak; import com.sunmi.peripheral.printer.InnerResultCallbcak;
import com.sunmi.peripheral.printer.SunmiPrinterService; import com.sunmi.peripheral.printer.SunmiPrinterService;
import java.util.List;
public class AidlUtil { public class AidlUtil {
private static final String SERVICE_PACKAGE = "woyou.aidlservice.jiuiv5"; private static final String SERVICE_PACKAGE = "woyou.aidlservice.jiuiv5";
...@@ -160,7 +162,7 @@ public class AidlUtil { ...@@ -160,7 +162,7 @@ public class AidlUtil {
/* /*
*打印图片 *打印图片
*/ */
public void printBitmap(Bitmap bitmap,InnerResultCallbcak mInnerResultCallbcak) { public void printBitmap(Bitmap bitmap, InnerResultCallbcak mInnerResultCallbcak) {
if (sunmiPrinterService == null) { if (sunmiPrinterService == null) {
Toast.makeText(context, LanguageUtils.get_language_system(context, "server.disconnected", "未連接上打印機!"), Toast.LENGTH_LONG).show(); Toast.makeText(context, LanguageUtils.get_language_system(context, "server.disconnected", "未連接上打印機!"), Toast.LENGTH_LONG).show();
return; return;
...@@ -175,6 +177,26 @@ public class AidlUtil { ...@@ -175,6 +177,26 @@ public class AidlUtil {
} }
} }
/*
*打印图片
*/
public void printBitmaps(List<Bitmap> bitmaps, InnerResultCallbcak mInnerResultCallbcak) {
if (sunmiPrinterService == null) {
Toast.makeText(context, LanguageUtils.get_language_system(context, "server.disconnected", "未連接上打印機!"), Toast.LENGTH_LONG).show();
return;
}
try {
sunmiPrinterService.setAlignment(1, null);
for (int i = 0; i < bitmaps.size(); i++) {
sunmiPrinterService.printBitmap(bitmaps.get(i), mInnerResultCallbcak);
sunmiPrinterService.lineWrap(3, null);
}
} catch (RemoteException e) {
e.printStackTrace();
}
}
/** /**
* 打印图片和文字按照指定排列顺序 * 打印图片和文字按照指定排列顺序
*/ */
......
...@@ -64,7 +64,7 @@ public class TimeUtils { ...@@ -64,7 +64,7 @@ public class TimeUtils {
throw new AssertionError(); throw new AssertionError();
} }
public static String getFormatTime(String time, SimpleDateFormat simpleDateFormat){ public static String getFormatTime(String time, SimpleDateFormat simpleDateFormat) {
return simpleDateFormat.format(new Date(time)); return simpleDateFormat.format(new Date(time));
} }
...@@ -74,9 +74,11 @@ public class TimeUtils { ...@@ -74,9 +74,11 @@ public class TimeUtils {
calendar.add(Calendar.DAY_OF_MONTH, -1);//往上推一天 calendar.add(Calendar.DAY_OF_MONTH, -1);//往上推一天
return simpleDateFormat.format(calendar.getTime()); return simpleDateFormat.format(calendar.getTime());
} }
public static String getTime(Date date) {//可根据需要自行截取数据显示 public static String getTime(Date date) {//可根据需要自行截取数据显示
return DATE_FORMAT_DATE.format(date); return DATE_FORMAT_DATE.format(date);
} }
/** /**
* long time to string * long time to string
* *
...@@ -118,7 +120,6 @@ public class TimeUtils { ...@@ -118,7 +120,6 @@ public class TimeUtils {
/** /**
*
* @param distance 差距: 昨天天傳負一,今天傳零,明天傳一 * @param distance 差距: 昨天天傳負一,今天傳零,明天傳一
* @param type 類型: 1、天 Calendar.DATE 2、年Calendar.YEAR 3、月Calendar.MONTH * @param type 類型: 1、天 Calendar.DATE 2、年Calendar.YEAR 3、月Calendar.MONTH
* @param sf {@link #DEFAULT_DATE_MD} * @param sf {@link #DEFAULT_DATE_MD}
...@@ -137,6 +138,7 @@ public class TimeUtils { ...@@ -137,6 +138,7 @@ public class TimeUtils {
} }
return sf.format(endDate); return sf.format(endDate);
} }
/** /**
* 获取前n天日期、后n天日期 * 获取前n天日期、后n天日期
* *
...@@ -423,14 +425,39 @@ public class TimeUtils { ...@@ -423,14 +425,39 @@ public class TimeUtils {
if (format == null || format.isEmpty()) { if (format == null || format.isEmpty()) {
format = "yyyy-MM-dd HH:mm:ss"; format = "yyyy-MM-dd HH:mm:ss";
} }
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.CHINESE);
sdf.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
Date date = null; Date date = null;
try { try {
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.CHINESE);
sdf.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
date = sdf.parse(serverTime); date = sdf.parse(serverTime);
} catch (Exception e) { } catch (Exception e) {
Timber.e(e, ""); Timber.e(e, "");
} }
return date; return date;
} }
/**
*
* @param time
* @param dateFormat
* @return
*/
public static String parseTimeRepeat(String time, SimpleDateFormat dateFormat) {
Date date = null;
try {
date = new Date(time);
} catch (IllegalArgumentException e) {
try {
date = dateFormat.parse(time);
} catch (ParseException ex) {
ex.printStackTrace();
}
}
if (date != null) {
return dateFormat.format(date);
}
return time;
}
} }
package com.gingersoft.gsa.cloud.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.widget.NestedScrollView;
/**
* 解決嵌套橫向滑動不靈敏,衝突問題
*/
public class MyScrollView extends NestedScrollView {
private float xDistance, yDistance, xLast, yLast;
public MyScrollView(@NonNull Context context) {
super(context);
}
public MyScrollView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public MyScrollView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
xDistance = yDistance = 0f;
xLast = ev.getX();
yLast = ev.getY();
break;
case MotionEvent.ACTION_MOVE:
final float curX = ev.getX();
final float curY = ev.getY();
xDistance += Math.abs(curX - xLast);
yDistance += Math.abs(curY - yLast);
xLast = curX;
yLast = curY;
if(xDistance > yDistance){
return false;
}
}
return super.onInterceptTouchEvent(ev);
}
}
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_on" android:state_checked="true" />
<item android:drawable="@drawable/btn_off" />
</selector>
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<!-- 台號--> <!-- 台號-->
<TextView <TextView
android:id="@+id/tv_kitchen_print_table_number" android:id="@+id/tv_kitchen_print_table_number"
style="@style/Print_large_text_style" style="@style/Print_kitchen_table_number_text_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="19" /> android:text="19" />
...@@ -20,13 +20,30 @@ ...@@ -20,13 +20,30 @@
android:paddingBottom="@dimen/dp_10"> android:paddingBottom="@dimen/dp_10">
<TextView <TextView
android:id="@+id/tv_order_num_text"
style="@style/Print_text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="訂單號:"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_order_num"
style="@style/Print_text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/tv_order_num_text"
app:layout_constraintTop_toTopOf="@id/tv_order_num_text" />
<TextView
android:id="@+id/tv_opening_time_text" android:id="@+id/tv_opening_time_text"
style="@style/Print_text_style" style="@style/Print_text_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="開檯時間:" android:text="開檯時間:"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toBottomOf="@id/tv_order_num_text" />
<TextView <TextView
android:id="@+id/tv_opening_time" android:id="@+id/tv_opening_time"
...@@ -35,7 +52,7 @@ ...@@ -35,7 +52,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="01-04 18:32" android:text="01-04 18:32"
app:layout_constraintLeft_toRightOf="@id/tv_opening_time_text" app:layout_constraintLeft_toRightOf="@id/tv_opening_time_text"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="@id/tv_opening_time_text" />
<TextView <TextView
android:id="@+id/tv_order_time_text" android:id="@+id/tv_order_time_text"
...@@ -111,7 +128,7 @@ ...@@ -111,7 +128,7 @@
<TextView <TextView
android:id="@+id/tv_kitchen_print_table_number2" android:id="@+id/tv_kitchen_print_table_number2"
style="@style/Print_large_text_style" style="@style/Print_kitchen_table_number_text_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="19" android:text="19"
......
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/dp_5" android:layout_marginLeft="@dimen/dp_5"
app:layout_constraintBottom_toBottomOf="@id/tv_dining_table_text" app:layout_constraintBottom_toBottomOf="@id/tv_dining_table_text"
app:layout_constraintLeft_toRightOf="@id/tv_dining_table_text" app:layout_constraintLeft_toRightOf="@id/tv_dining_table_text"
...@@ -77,13 +76,12 @@ ...@@ -77,13 +76,12 @@
style="@style/Print_text_style" style="@style/Print_text_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="right" android:gravity="right"
android:text="人數:" android:text="人數:"
app:layout_constraintBottom_toBottomOf="@id/tv_dining_table_text" app:layout_constraintHorizontal_bias="0.3"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="@id/tv_dining_table_text"
app:layout_constraintLeft_toRightOf="@id/tv_dining_table_number"
app:layout_constraintTop_toTopOf="@id/tv_dining_table_text" /> app:layout_constraintTop_toTopOf="@id/tv_dining_table_text" />
<TextView <TextView
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
<!-- <color name="theme_color">#BF1C42</color>--> <!-- <color name="theme_color">#BF1C42</color>-->
<color name="theme_color">#398BED</color> <color name="theme_color">#398BED</color>
<color name="normal_color">#333333</color> <color name="normal_color">#333333</color>
<!-- 統一頁面背景色-->
<color name="theme_bg_color">#F0edf1</color>
<color name="theme_white_color">#FFFFFFFF</color> <color name="theme_white_color">#FFFFFFFF</color>
<color name="theme_333_color">#333</color> <color name="theme_333_color">#333</color>
......
...@@ -137,7 +137,9 @@ ...@@ -137,7 +137,9 @@
</item> </item>
<item name="qmui_skin_support_tab_normal_color">@color/normal_color</item> <item name="qmui_skin_support_tab_normal_color">@color/normal_color</item>
<item name="qmui_skin_support_tab_selected_color">@color/theme_color</item> <item name="qmui_skin_support_tab_selected_color">@color/theme_color</item>
<item name="qmui_skin_support_tab_sign_count_view_text_color">@color/qmui_config_color_white</item> <item name="qmui_skin_support_tab_sign_count_view_text_color">
@color/qmui_config_color_white
</item>
<item name="qmui_skin_support_tab_sign_count_view_bg_color">?attr/qmui_config_color_red <item name="qmui_skin_support_tab_sign_count_view_bg_color">?attr/qmui_config_color_red
</item> </item>
</style> </style>
...@@ -164,6 +166,7 @@ ...@@ -164,6 +166,7 @@
<item name="qmui_dialog_menu_container_style">@style/DialogTheme2MenuContainerStyle</item> <item name="qmui_dialog_menu_container_style">@style/DialogTheme2MenuContainerStyle</item>
<item name="qmui_dialog_menu_item_style">@style/DialogTheme2MenuItemStyle</item> <item name="qmui_dialog_menu_item_style">@style/DialogTheme2MenuItemStyle</item>
</style> </style>
<style name="ReleaseDialogTheme" parent="MyDialogTheme2"> <style name="ReleaseDialogTheme" parent="MyDialogTheme2">
<!-- <item name="qmui_dialog_wrapper_style">@style/QMUI.Dialog.Wrapper</item>--> <!-- <item name="qmui_dialog_wrapper_style">@style/QMUI.Dialog.Wrapper</item>-->
<item name="qmui_dialog_message_content_style">@style/ReleaseMessageContentStyle</item> <item name="qmui_dialog_message_content_style">@style/ReleaseMessageContentStyle</item>
...@@ -272,9 +275,15 @@ ...@@ -272,9 +275,15 @@
<item name="android:textSize">@dimen/sp_24</item> <item name="android:textSize">@dimen/sp_24</item>
</style> </style>
<!-- 廚房單菜品名字體樣式-->
<style name="Print_large_text_style"> <style name="Print_large_text_style">
<item name="android:textColor">@color/theme_333_color</item> <item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/sp_24</item> <item name="android:textSize">@dimen/sp_34</item>
</style>
<!-- 廚房單台號體樣式-->
<style name="Print_kitchen_table_number_text_style">
<item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/sp_38</item>
</style> </style>
<style name="report_food_ranking"> <style name="report_food_ranking">
......
...@@ -4,7 +4,7 @@ import android.app.Application; ...@@ -4,7 +4,7 @@ import android.app.Application;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.util.Log; import android.util.Log;
import android.view.View;
import com.billy.cc.core.component.CC; import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.base.common.bean.OrderBean; import com.gingersoft.gsa.cloud.base.common.bean.OrderBean;
import com.gingersoft.gsa.cloud.base.common.bean.OrderDetail; import com.gingersoft.gsa.cloud.base.common.bean.OrderDetail;
...@@ -13,6 +13,7 @@ import com.gingersoft.gsa.cloud.base.common.bean.TableBean; ...@@ -13,6 +13,7 @@ import com.gingersoft.gsa.cloud.base.common.bean.TableBean;
import com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage; import com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage;
import com.gingersoft.gsa.cloud.base.common.bean.mealManage.OpenTableManage; import com.gingersoft.gsa.cloud.base.common.bean.mealManage.OpenTableManage;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.mvp.contract.AllOrderContract;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.OrderDetailItem; import com.gingersoft.gsa.cloud.table.mvp.model.bean.OrderDetailItem;
import com.gingersoft.gsa.cloud.table.mvp.model.utils.OrderAssemblyUtil; import com.gingersoft.gsa.cloud.table.mvp.model.utils.OrderAssemblyUtil;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.MealStandActivity;
...@@ -20,21 +21,20 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.activity.orderManager.OrderCenterAc ...@@ -20,21 +21,20 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.activity.orderManager.OrderCenterAc
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.orderManager.OrderDetailActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.orderManager.OrderDetailActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.OrderCenterAdapter; import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.OrderCenterAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllOrderFragment; import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllOrderFragment;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import com.jess.arms.integration.AppManager;
import javax.inject.Inject; import com.jess.arms.mvp.BasePresenter;
import com.gingersoft.gsa.cloud.table.mvp.contract.AllOrderContract;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/** /**
* ================================================ * ================================================
......
...@@ -29,7 +29,6 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FoodAdapter; ...@@ -29,7 +29,6 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FoodAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FoodGroupAdapter; import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FoodGroupAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.ModifierAdapter; import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.ModifierAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.SelectMealAdapter; import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.SelectMealAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.widget.ChooseNumberDialog;
import com.jess.arms.di.scope.ActivityScope; import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
...@@ -40,7 +39,6 @@ import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; ...@@ -40,7 +39,6 @@ import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import org.simple.eventbus.EventBus; import org.simple.eventbus.EventBus;
import org.simple.eventbus.Subscriber; import org.simple.eventbus.Subscriber;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -346,6 +344,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod ...@@ -346,6 +344,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
@Override @Override
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info != null && info.isSuccess()) { if (info != null && info.isSuccess()) {
saveCreateTime(info.getSysTime());
if (info.getData() != null) { if (info.getData() != null) {
setOrderId((Double) info.getData()); setOrderId((Double) info.getData());
} }
......
...@@ -30,7 +30,6 @@ import com.jess.arms.integration.AppManager; ...@@ -30,7 +30,6 @@ import com.jess.arms.integration.AppManager;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -165,6 +164,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra ...@@ -165,6 +164,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
@Override @Override
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info != null && info.isSuccess()) { if (info != null && info.isSuccess()) {
saveCreateTime(info.getSysTime());
if (info.getData() != null) { if (info.getData() != null) {
setOrderId((Double) info.getData()); setOrderId((Double) info.getData());
} }
......
...@@ -225,13 +225,17 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont ...@@ -225,13 +225,17 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
@Override @Override
public void onNext(@NonNull BaseRespose respose) { public void onNext(@NonNull BaseRespose respose) {
if (respose.isSuccess()) { if (respose.isSuccess()) {
//設置當前開台數據1584427984728 1584428017196 1584428086282 //設置當前開台數據
TableBean.DataBean openTableBean = getTableById(tableId); TableBean.DataBean openTableBean = getTableById(tableId);
//先將開台時間設置為當前時間
if(openTableBean != null) {
openTableBean.setCreateTime(TimeUtils.getTime(System.currentTimeMillis(), TimeUtils.DEFAULT_DATE_FORMAT));
}
OpenTableManage.getDefault().setPeopleNumber(0); OpenTableManage.getDefault().setPeopleNumber(0);
OrderBean orderBean = respose.getData(); OrderBean orderBean = respose.getData();
if (orderBean != null && respose.getData().getOrderDetails() != null) { if (orderBean != null && respose.getData().getOrderDetails() != null) {
if (respose.getData().getCreateTime() != null && openTableBean != null) { if (respose.getData().getCreateTime() != null && openTableBean != null) {
//將開台時間設置為訂單創建時間
openTableBean.setCreateTime(TimeUtils.getFormatTime(respose.getData().getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT)); openTableBean.setCreateTime(TimeUtils.getFormatTime(respose.getData().getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT));
} }
OpenTableManage.getDefault().setPeopleNumber(orderBean.getPerson()); OpenTableManage.getDefault().setPeopleNumber(orderBean.getPerson());
......
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