Commit d9d4e87b by Wyh

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

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