Commit f01b18c5 by 宁斌

1、餐檯管理調整

parent 39e33787
...@@ -81,6 +81,10 @@ public class TableBean { ...@@ -81,6 +81,10 @@ public class TableBean {
private Long orderId; private Long orderId;
private String qrCode; private String qrCode;
private int seatCount; private int seatCount;
/**最大就餐人數*/
private Integer maxSeatCount;
/**最小就餐人數*/
private Integer minSeatCount;
private String createTime; private String createTime;
private String createBy; private String createBy;
private String qrCodeImg; private String qrCodeImg;
...@@ -108,6 +112,12 @@ public class TableBean { ...@@ -108,6 +112,12 @@ public class TableBean {
* 排序 * 排序
*/ */
private int sort; private int sort;
/**
0#堂食
1#外賣
2#自取
*/
private int type;
public DataBean() { public DataBean() {
...@@ -120,6 +130,8 @@ public class TableBean { ...@@ -120,6 +130,8 @@ public class TableBean {
this.restaurantId = dataBean.restaurantId; this.restaurantId = dataBean.restaurantId;
this.qrCode = dataBean.qrCode; this.qrCode = dataBean.qrCode;
this.seatCount = dataBean.seatCount; this.seatCount = dataBean.seatCount;
this.maxSeatCount = dataBean.maxSeatCount;
this.minSeatCount = dataBean.minSeatCount;
this.createTime = dataBean.createTime; this.createTime = dataBean.createTime;
this.createBy = dataBean.createBy; this.createBy = dataBean.createBy;
this.qrCodeImg = dataBean.qrCodeImg; this.qrCodeImg = dataBean.qrCodeImg;
...@@ -130,6 +142,7 @@ public class TableBean { ...@@ -130,6 +142,7 @@ public class TableBean {
this.person = dataBean.person; this.person = dataBean.person;
this.useStatus = dataBean.useStatus; this.useStatus = dataBean.useStatus;
this.sort = dataBean.sort; this.sort = dataBean.sort;
this.type = dataBean.type;
} }
public int getPerson() { public int getPerson() {
...@@ -196,6 +209,22 @@ public class TableBean { ...@@ -196,6 +209,22 @@ public class TableBean {
this.seatCount = seatCount; this.seatCount = seatCount;
} }
public Integer getMaxSeatCount() {
return maxSeatCount;
}
public void setMaxSeatCount(Integer maxSeatCount) {
this.maxSeatCount = maxSeatCount;
}
public Integer getMinSeatCount() {
return minSeatCount;
}
public void setMinSeatCount(Integer minSeatCount) {
this.minSeatCount = minSeatCount;
}
public String getCreateTime() { public String getCreateTime() {
return createTime; return createTime;
} }
...@@ -259,5 +288,13 @@ public class TableBean { ...@@ -259,5 +288,13 @@ public class TableBean {
public void setSort(int sort) { public void setSort(int sort) {
this.sort = sort; this.sort = sort;
} }
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
} }
} }
...@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.ui.recylcler.event; ...@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.ui.recylcler.event;
import android.graphics.Color; import android.graphics.Color;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
import com.jess.arms.base.DefaultAdapter; import com.jess.arms.base.DefaultAdapter;
import com.qmuiteam.qmui.widget.section.QMUIDefaultStickySectionAdapter; import com.qmuiteam.qmui.widget.section.QMUIDefaultStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUISection; import com.qmuiteam.qmui.widget.section.QMUISection;
...@@ -23,6 +24,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -23,6 +24,7 @@ import androidx.recyclerview.widget.RecyclerView;
*/ */
public class RecyItemTouchHelperCallback<H extends QMUISection.Model<H>, T extends QMUISection.Model<T>> extends ItemTouchHelper.Callback { public class RecyItemTouchHelperCallback<H extends QMUISection.Model<H>, T extends QMUISection.Model<T>> extends ItemTouchHelper.Callback {
private final String TAG = getClass().getSimpleName();
RecyclerView.Adapter mAdapter; RecyclerView.Adapter mAdapter;
boolean isSwipeEnable; boolean isSwipeEnable;
boolean isFirstDragUnable; boolean isFirstDragUnable;
...@@ -64,10 +66,11 @@ public class RecyItemTouchHelperCallback<H extends QMUISection.Model<H>, T exten ...@@ -64,10 +66,11 @@ public class RecyItemTouchHelperCallback<H extends QMUISection.Model<H>, T exten
if (mAdapter instanceof QMUIStickySectionAdapter) { if (mAdapter instanceof QMUIStickySectionAdapter) {
QMUIStickySectionAdapter.ViewHolder holder = (QMUIStickySectionAdapter.ViewHolder) viewHolder; QMUIStickySectionAdapter.ViewHolder holder = (QMUIStickySectionAdapter.ViewHolder) viewHolder;
int pos = holder.isForStickyHeader ? i : holder.getAdapterPosition(); int pos = holder.isForStickyHeader ? i : holder.getAdapterPosition();
int ItemIndex = ((QMUIStickySectionAdapter) mAdapter).getItemIndex(pos); int itemIndex = ((QMUIStickySectionAdapter) mAdapter).getItemIndex(pos);
QMUISection<H, T> qmuiSections = ((QMUIStickySectionAdapter) mAdapter).getSection(ItemIndex); LogUtil.d(TAG, "fromPosition:" + fromPosition + " toPosition:" + toPosition + " itemIndex: " + itemIndex + " pos: " + pos);
QMUISection<H, T> qmuiSections = ((QMUIStickySectionAdapter) mAdapter).getSection(pos);
List<?> list = qmuiSections.getItemList(); List<?> list = qmuiSections.getItemList();
Collections.swap(list, ItemIndex, ItemIndex + 1); Collections.swap(list, itemIndex, itemIndex + 1);
} else { } else {
Collections.swap(((DefaultAdapter) mAdapter).getInfos(), i, i + 1); Collections.swap(((DefaultAdapter) mAdapter).getInfos(), i, i + 1);
} }
...@@ -77,18 +80,17 @@ public class RecyItemTouchHelperCallback<H extends QMUISection.Model<H>, T exten ...@@ -77,18 +80,17 @@ public class RecyItemTouchHelperCallback<H extends QMUISection.Model<H>, T exten
if (mAdapter instanceof QMUIStickySectionAdapter) { if (mAdapter instanceof QMUIStickySectionAdapter) {
QMUIStickySectionAdapter.ViewHolder holder = (QMUIStickySectionAdapter.ViewHolder) viewHolder; QMUIStickySectionAdapter.ViewHolder holder = (QMUIStickySectionAdapter.ViewHolder) viewHolder;
int pos = holder.isForStickyHeader ? i : holder.getAdapterPosition(); int pos = holder.isForStickyHeader ? i : holder.getAdapterPosition();
int ItemIndex = ((QMUIStickySectionAdapter) mAdapter).getItemIndex(pos); int itemIndex = ((QMUIStickySectionAdapter) mAdapter).getItemIndex(pos);
QMUISection<H, T> qmuiSections = ((QMUIStickySectionAdapter) mAdapter).getSection(ItemIndex); LogUtil.d(TAG, "fromPosition:" + fromPosition + " toPosition:" + toPosition + " itemIndex: " + itemIndex + " pos: " + pos);
QMUISection<H, T> qmuiSections = ((QMUIStickySectionAdapter) mAdapter).getSection(pos);
List<?> list = qmuiSections.getItemList(); List<?> list = qmuiSections.getItemList();
Collections.swap(list, ItemIndex, ItemIndex - 1); Collections.swap(list, itemIndex, itemIndex - 1);
} else { } else {
Collections.swap(((DefaultAdapter) mAdapter).getInfos(), i, i - 1); Collections.swap(((DefaultAdapter) mAdapter).getInfos(), fromPosition, toPosition - 1);
} }
} }
} }
mAdapter.notifyItemMoved(fromPosition, toPosition); mAdapter.notifyItemMoved(fromPosition, toPosition);
mAdapter.notifyItemChanged(toPosition);
mAdapter.notifyItemChanged(fromPosition);
return true; return true;
} }
...@@ -114,7 +116,10 @@ public class RecyItemTouchHelperCallback<H extends QMUISection.Model<H>, T exten ...@@ -114,7 +116,10 @@ public class RecyItemTouchHelperCallback<H extends QMUISection.Model<H>, T exten
@Override @Override
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
super.clearView(recyclerView, viewHolder); super.clearView(recyclerView, viewHolder);
viewHolder.itemView.setBackgroundColor(Color.WHITE); // viewHolder.itemView.setBackgroundColor(Color.WHITE);
if (onMoveListener != null) {
onMoveListener.onMoveFinish();
}
} }
@Override @Override
...@@ -126,4 +131,14 @@ public class RecyItemTouchHelperCallback<H extends QMUISection.Model<H>, T exten ...@@ -126,4 +131,14 @@ public class RecyItemTouchHelperCallback<H extends QMUISection.Model<H>, T exten
public boolean isItemViewSwipeEnabled() { public boolean isItemViewSwipeEnabled() {
return isSwipeEnable; return isSwipeEnable;
} }
private onMoveListener onMoveListener;
public void setOnMoveListener(RecyItemTouchHelperCallback.onMoveListener onMoveListener) {
this.onMoveListener = onMoveListener;
}
public interface onMoveListener {
void onMoveFinish();
}
} }
\ No newline at end of file
package com.gingersoft.gsa.cloud.ui.view;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import com.gingersoft.gsa.cloud.base.R;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.StringRes;
import androidx.core.content.ContextCompat;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-06-13
* 修订历史:2020-06-13
* 描述:
*/
public class TriangleLabelView extends View {
private static final String TAG = TriangleLabelView.class.getSimpleName();
private static class PaintHolder {
String text = "";
Paint paint;
int color;
float size;
float height;
float width;
int style;
void initPaint() {
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(color);
paint.setTextAlign(Paint.Align.CENTER);
paint.setTextSize(size);
if (style == 1) {
paint.setTypeface(Typeface.SANS_SERIF);
} else if (style == 2) {
paint.setTypeface(Typeface.DEFAULT_BOLD);
}
}
void resetStatus() {
Rect rectText = new Rect();
paint.getTextBounds(text, 0, text.length(), rectText);
width = rectText.width();
height = rectText.height();
}
}
private PaintHolder primary = new PaintHolder();
private PaintHolder secondary = new PaintHolder();
private float topPadding;
private float bottomPadding;
private float centerPadding;
private Paint trianglePaint;
private int backGroundColor;
private int width;
private int height;
private static final int DEGREES_LEFT = -45;
private static final int DEGREES_RIGHT = 45;
private Corner corner;
public enum Corner {
TOP_LEFT(1),
TOP_RIGHT(2),
BOTTOM_LEFT(3),
BOTTOM_RIGHT(4),;
private final int type;
Corner(int type) {
this.type = type;
}
private boolean top() {
return this == TOP_LEFT || this == TOP_RIGHT;
}
private boolean left() {
return this == TOP_LEFT || this == BOTTOM_LEFT;
}
private static Corner from(int type) {
for (Corner c : values()) {
if (c.type == type) return c;
}
return Corner.TOP_LEFT;
}
}
public TriangleLabelView(Context context) {
this(context, null);
}
public TriangleLabelView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public TriangleLabelView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public TriangleLabelView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.TriangleLabelView);
this.topPadding = ta.getDimension(R.styleable.TriangleLabelView_labelTopPadding, dp2px(7));
this.centerPadding = ta.getDimension(R.styleable.TriangleLabelView_labelCenterPadding, dp2px(3));
this.bottomPadding = ta.getDimension(R.styleable.TriangleLabelView_labelBottomPadding, dp2px(3));
this.backGroundColor = ta.getColor(R.styleable.TriangleLabelView_backgroundColor, Color.parseColor("#66000000"));
this.primary.color = ta.getColor(R.styleable.TriangleLabelView_primaryTextColor, Color.WHITE);
this.secondary.color = ta.getColor(R.styleable.TriangleLabelView_secondaryTextColor, Color.WHITE);
this.primary.size = ta.getDimension(R.styleable.TriangleLabelView_primaryTextSize, sp2px(11));
this.secondary.size = ta.getDimension(R.styleable.TriangleLabelView_secondaryTextSize, sp2px(8));
final String primary = ta.getString(R.styleable.TriangleLabelView_primaryText);
if (primary != null) {
this.primary.text = primary;
}
final String secondary = ta.getString(R.styleable.TriangleLabelView_secondaryText);
if (secondary != null) {
this.secondary.text = secondary;
}
this.primary.style = ta.getInt(R.styleable.TriangleLabelView_primaryTextStyle, 2);
this.secondary.style = ta.getInt(R.styleable.TriangleLabelView_secondaryTextStyle, 0);
this.corner = Corner.from(ta.getInt(R.styleable.TriangleLabelView_corner, 1));
ta.recycle();
this.primary.initPaint();
this.secondary.initPaint();
trianglePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
trianglePaint.setColor(backGroundColor);
this.primary.resetStatus();
this.secondary.resetStatus();
}
public void setLabelTopPadding(float dp) {
topPadding = dp2px(dp);
}
public float getLabelTopPadding() {
return topPadding;
}
public void setLabelCenterPadding(float dp) {
centerPadding = dp2px(dp);
relayout();
}
public float getLabelCenterPadding() {
return centerPadding;
}
public void setLabelBottomPadding(float dp) {
bottomPadding = dp2px(dp);
relayout();
}
public float getLabelBottomPadding() {
return bottomPadding;
}
public void setPrimaryText(String text) {
primary.text = text;
primary.resetStatus();
relayout();
}
public void setPrimaryText(@StringRes int textRes) {
primary.text = getContext().getString(textRes);
primary.resetStatus();
relayout();
}
public String getPrimaryText() {
return primary.text;
}
public void setSecondaryText(String smallText) {
secondary.text = smallText;
secondary.resetStatus();
relayout();
}
public void setSecondaryText(@StringRes int textRes) {
secondary.text = getContext().getString(textRes);
secondary.resetStatus();
relayout();
}
public String getSecondaryText() {
return secondary.text;
}
public void setPrimaryTextColor(@ColorInt int color) {
primary.color = color;
primary.initPaint();
primary.resetStatus();
relayout();
}
public void setPrimaryTextColorResource(@ColorRes int colorResource) {
primary.color = ContextCompat.getColor(getContext(), colorResource);
primary.initPaint();
primary.resetStatus();
relayout();
}
public void setSecondaryTextColor(@ColorInt int color) {
secondary.color = color;
secondary.initPaint();
secondary.resetStatus();
relayout();
}
public void setSecondaryTextColorResource(@ColorRes int colorResource) {
secondary.color = ContextCompat.getColor(getContext(), colorResource);
secondary.initPaint();
secondary.resetStatus();
relayout();
}
public void setPrimaryTextSize(float sp) {
primary.size = sp2px(sp);
relayout();
}
public void setSecondaryTextSize(float sp) {
secondary.size = sp2px(sp);
relayout();
}
public float getPrimaryTextSize() {
return primary.size;
}
public float getSecondaryTextSize() {
return secondary.size;
}
public void setTriangleBackgroundColor(@ColorInt int color) {
backGroundColor = color;
trianglePaint.setColor(backGroundColor);
relayout();
}
public void setTriangleBackgroundColorResource(@ColorRes int colorResource) {
backGroundColor = ContextCompat.getColor(getContext(), colorResource);
trianglePaint.setColor(backGroundColor);
relayout();
}
public int getTriangleBackGroundColor() {
return backGroundColor;
}
public void setCorner(Corner corner) {
this.corner = corner;
relayout();
}
public Corner getCorner() {
return corner;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.save();
// translate
if (corner.top()) {
canvas.translate(0, (float) ((height * Math.sqrt(2)) - height));
}
// rotate
if (corner.top()) {
if (corner.left()) {
canvas.rotate(DEGREES_LEFT, 0, height);
} else {
canvas.rotate(DEGREES_RIGHT, width, height);
}
} else {
if (corner.left()) {
canvas.rotate(DEGREES_RIGHT, 0, 0);
} else {
canvas.rotate(DEGREES_LEFT, width, 0);
}
}
// draw triangle
@SuppressLint("DrawAllocation")
Path path = new Path();
if (corner.top()) {
path.moveTo(0, height);
path.lineTo(width / 2, 0);
path.lineTo(width, height);
} else {
path.moveTo(0, 0);
path.lineTo(width / 2, height);
path.lineTo(width, 0);
}
path.close();
canvas.drawPath(path, trianglePaint);
// draw secondaryText
if (corner.top()) {
canvas.drawText(secondary.text, (width) / 2, topPadding + secondary.height, secondary.paint);
canvas.drawText(primary.text, (width) / 2, (topPadding + secondary.height + centerPadding + primary.height), primary.paint);
} else {
canvas.drawText(secondary.text, (width) / 2, bottomPadding + secondary.height + centerPadding + primary.height, secondary.paint);
canvas.drawText(primary.text, (width) / 2, (bottomPadding + primary.height), primary.paint);
}
canvas.restore();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
height = (int) (topPadding + centerPadding + bottomPadding + secondary.height + primary.height);
width = 2 * height;
int realHeight = (int) (height * Math.sqrt(2));
setMeasuredDimension(width, realHeight);
}
public int dp2px(float dpValue) {
final float scale = getContext().getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
public float sp2px(float spValue) {
final float scale = getContext().getResources().getDisplayMetrics().scaledDensity;
return spValue * scale;
}
/**
* Should be called whenever what we're displaying could have changed.
*/
private void relayout() {
invalidate();
requestLayout();
}
}
/*
* Tencent is pleased to support the open source community by making QMUI_Android available.
*
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the MIT License (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gingersoft.gsa.cloud.ui.view.qm;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import com.gingersoft.gsa.cloud.base.R;
import com.qmuiteam.qmui.layout.QMUIFrameLayout;
import androidx.customview.widget.ViewDragHelper;
/**
* Created by cgspine on 2018/3/22.
*/
public class QDShadowAdjustLayout extends QMUIFrameLayout {
ViewDragHelper viewDragHelper;
public QDShadowAdjustLayout(Context context) {
this(context, null);
}
public QDShadowAdjustLayout(Context context, AttributeSet attrs) {
super(context, attrs);
viewDragHelper = ViewDragHelper.create(this, new ViewDragHelper.Callback() {
@Override
public boolean tryCaptureView(View child, int pointerId) {
return child.getId() == R.id.layout_for_test;
}
@Override
public int clampViewPositionHorizontal(View child, int left, int dx) {
return left;
}
@Override
public int clampViewPositionVertical(View child, int top, int dy) {
return top;
}
});
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return viewDragHelper.shouldInterceptTouchEvent(event);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
viewDragHelper.processTouchEvent(event);
return true;
}
}
...@@ -54,12 +54,10 @@ public class QDSectionHeaderView extends LinearLayout { ...@@ -54,12 +54,10 @@ public class QDSectionHeaderView extends LinearLayout {
mTitleTv.setTextSize(16); mTitleTv.setTextSize(16);
mTitleTv.setTextColor(Color.BLACK); mTitleTv.setTextColor(Color.BLACK);
mTitleTv.setPadding(paddingHor, 0, paddingHor, 0); mTitleTv.setPadding(paddingHor, 0, paddingHor, 0);
addView(mTitleTv, new LinearLayout.LayoutParams( addView(mTitleTv, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
mArrowView = new AppCompatImageView(context); mArrowView = new AppCompatImageView(context);
mArrowView.setImageDrawable(QMUIResHelper.getAttrDrawable(getContext(), mArrowView.setImageDrawable(QMUIResHelper.getAttrDrawable(getContext(), R.attr.qmui_common_list_item_chevron));
R.attr.qmui_common_list_item_chevron));
mArrowView.setScaleType(ImageView.ScaleType.CENTER); mArrowView.setScaleType(ImageView.ScaleType.CENTER);
addView(mArrowView, new LinearLayout.LayoutParams(headerHeight, headerHeight)); addView(mArrowView, new LinearLayout.LayoutParams(headerHeight, headerHeight));
} }
......
package com.gingersoft.gsa.cloud.ui.widget.dialog; package com.gingersoft.gsa.cloud.ui.widget.dialog;
import android.app.Activity; import android.app.Activity;
import android.text.InputType;
import android.text.TextUtils; import android.text.TextUtils;
import com.gingersoft.gsa.cloud.base.R; import com.gingersoft.gsa.cloud.base.R;
...@@ -22,6 +23,7 @@ public class CommonTipDialog { ...@@ -22,6 +23,7 @@ public class CommonTipDialog {
/** /**
* 提示dialog 確認后執行對應方法 * 提示dialog 確認后執行對應方法
*
* @param context * @param context
* @param msg * @param msg
* @param c * @param c
...@@ -30,16 +32,16 @@ public class CommonTipDialog { ...@@ -30,16 +32,16 @@ public class CommonTipDialog {
* @param parameterTypes * @param parameterTypes
* @param parameters * @param parameters
*/ */
public static void showDoubtDialog(Activity context,String msg, Class c, Object object, String methodName, Class[] parameterTypes, Object[] parameters) { public static void showDoubtDialog(Activity context, String msg, Class c, Object object, String methodName, Class[] parameterTypes, Object[] parameters) {
QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(context); QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(context);
dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_doubt); dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_doubt);
dialogBuilder.setMessage(msg); dialogBuilder.setMessage(msg);
if(!TextUtils.isEmpty(methodName)) { if (!TextUtils.isEmpty(methodName)) {
dialogBuilder.addAction(R.drawable.shape_3c_cancel_btn_bg,"取消", (dialog, index) -> dialog.dismiss()); dialogBuilder.addAction(R.drawable.shape_3c_cancel_btn_bg, "取消", (dialog, index) -> dialog.dismiss());
} }
dialogBuilder.addAction(R.drawable.shape_red_five_radius_bg, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> { dialogBuilder.addAction(R.drawable.shape_red_five_radius_bg, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> {
dialog.dismiss(); dialog.dismiss();
if(TextUtils.isEmpty(methodName)){ if (TextUtils.isEmpty(methodName)) {
return; return;
} }
try { try {
...@@ -59,6 +61,7 @@ public class CommonTipDialog { ...@@ -59,6 +61,7 @@ public class CommonTipDialog {
/** /**
* 危險警示dialog 確認后執行對應方法 * 危險警示dialog 確認后執行對應方法
*
* @param context * @param context
* @param msg * @param msg
* @param c * @param c
...@@ -67,16 +70,16 @@ public class CommonTipDialog { ...@@ -67,16 +70,16 @@ public class CommonTipDialog {
* @param parameterTypes * @param parameterTypes
* @param parameters * @param parameters
*/ */
public static void showSurpisedDialog(Activity context,String msg, Class c, Object object, String methodName, Class[] parameterTypes, Object[] parameters) { public static void showSurpisedDialog(Activity context, String msg, Class c, Object object, String methodName, Class[] parameterTypes, Object[] parameters) {
QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(context); QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(context);
dialogBuilder.setMessage(msg); dialogBuilder.setMessage(msg);
dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_surprised); dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_surprised);
if(!TextUtils.isEmpty(methodName)) { if (!TextUtils.isEmpty(methodName)) {
dialogBuilder.addAction("取消", (dialog, index) -> dialog.dismiss()); dialogBuilder.addAction("取消", (dialog, index) -> dialog.dismiss());
} }
dialogBuilder.addAction(0, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> { dialogBuilder.addAction(0, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> {
dialog.dismiss(); dialog.dismiss();
if(TextUtils.isEmpty(methodName)){ if (TextUtils.isEmpty(methodName)) {
return; return;
} }
try { try {
...@@ -96,6 +99,7 @@ public class CommonTipDialog { ...@@ -96,6 +99,7 @@ public class CommonTipDialog {
/** /**
* 警示dialog 確認后執行對應方法 * 警示dialog 確認后執行對應方法
*
* @param context * @param context
* @param msg * @param msg
* @param c * @param c
...@@ -104,16 +108,16 @@ public class CommonTipDialog { ...@@ -104,16 +108,16 @@ public class CommonTipDialog {
* @param parameterTypes * @param parameterTypes
* @param parameters * @param parameters
*/ */
public static void showWarnDialog(Activity context,String msg, Class c, Object object, String methodName, Class[] parameterTypes, Object[] parameters) { public static void showWarnDialog(Activity context, String msg, Class c, Object object, String methodName, Class[] parameterTypes, Object[] parameters) {
QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(context); QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(context);
dialogBuilder.setMessage(msg); dialogBuilder.setMessage(msg);
dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_warn); dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_warn);
if(!TextUtils.isEmpty(methodName)) { if (!TextUtils.isEmpty(methodName)) {
dialogBuilder.addAction("取消", (dialog, index) -> dialog.dismiss()); dialogBuilder.addAction("取消", (dialog, index) -> dialog.dismiss());
} }
dialogBuilder.addAction(0, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> { dialogBuilder.addAction(0, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> {
dialog.dismiss(); dialog.dismiss();
if(TextUtils.isEmpty(methodName)){ if (TextUtils.isEmpty(methodName)) {
return; return;
} }
try { try {
...@@ -133,6 +137,7 @@ public class CommonTipDialog { ...@@ -133,6 +137,7 @@ public class CommonTipDialog {
/** /**
* 取消 dialog 確認后執行對應方法 * 取消 dialog 確認后執行對應方法
*
* @param context * @param context
* @param msg * @param msg
* @param c * @param c
...@@ -141,16 +146,16 @@ public class CommonTipDialog { ...@@ -141,16 +146,16 @@ public class CommonTipDialog {
* @param parameterTypes * @param parameterTypes
* @param parameters * @param parameters
*/ */
public static void showCancelDialog(Activity context,String msg, Class c, Object object, String methodName, Class[] parameterTypes, Object[] parameters) { public static void showCancelDialog(Activity context, String msg, Class c, Object object, String methodName, Class[] parameterTypes, Object[] parameters) {
QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(context); QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(context);
dialogBuilder.setMessage(msg); dialogBuilder.setMessage(msg);
dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_cancel); dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_cancel);
if(!TextUtils.isEmpty(methodName)) { if (!TextUtils.isEmpty(methodName)) {
dialogBuilder.addAction("取消", (dialog, index) -> dialog.dismiss()); dialogBuilder.addAction("取消", (dialog, index) -> dialog.dismiss());
} }
dialogBuilder.addAction(0, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> { dialogBuilder.addAction(0, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> {
dialog.dismiss(); dialog.dismiss();
if(TextUtils.isEmpty(methodName)){ if (TextUtils.isEmpty(methodName)) {
return; return;
} }
try { try {
...@@ -177,4 +182,46 @@ public class CommonTipDialog { ...@@ -177,4 +182,46 @@ public class CommonTipDialog {
dialogBuilder.create(R.style.MyDialogTheme2).show(); dialogBuilder.create(R.style.MyDialogTheme2).show();
} }
/**
* 輸入型 dialog 確認后執行對應方法
*
* @param context
* @param title
* @param placeholder
* @param c
* @param object
* @param methodName
* @param parameterTypes
* @param parameters
*/
public static void showEditTextDialog(Activity context, String title, String placeholder, Class c, Object object, String methodName, Class[] parameterTypes, Object[] parameters) {
final QMUIDialog.EditTextDialogBuilder dialogBuilder = new QMUIDialog.EditTextDialogBuilder(context);
dialogBuilder.setTitle(title);
dialogBuilder.setPlaceholder(placeholder);
dialogBuilder.setInputType(InputType.TYPE_CLASS_TEXT);
if (!TextUtils.isEmpty(methodName)) {
dialogBuilder.addAction("取消", (dialog, index) -> dialog.dismiss());
}
dialogBuilder.addAction(0, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> {
dialog.dismiss();
if (TextUtils.isEmpty(methodName)) {
return;
}
try {
Method method = c.getDeclaredMethod(methodName, parameterTypes);
method.setAccessible(true);
method.invoke(object, parameters);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
});
dialogBuilder.create(R.style.MyDialogTheme2).show();
}
} }
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/shape_id">
<!-- 正三角 -->
<rotate
android:fromDegrees="45"
android:toDegrees="45"
android:pivotX="100%"
android:pivotY="100%">
<shape android:shape="rectangle">
<solid android:color="@color/theme_white_color"/>
</shape>
</rotate>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<declare-styleable name="AvatarView">
<attr name="showLabel" format="boolean" />
<attr name="avatarSize" format="dimension" />
<attr name="avatarSrc" format="reference" />
<attr name="labelSrc" format="reference" />
</declare-styleable>
<declare-styleable name="TriangleLabelView">
<attr name="backgroundColor" format="color" />
<attr name="primaryTextColor" format="color" />
<attr name="secondaryTextColor" format="color" />
<attr name="primaryText" format="string" />
<attr name="secondaryText" format="string" />
<attr name="primaryTextSize" format="dimension" />
<attr name="secondaryTextSize" format="dimension" />
<attr name="labelTopPadding" format="dimension" />
<attr name="labelCenterPadding" format="dimension" />
<attr name="labelBottomPadding" format="dimension" />
<attr name="primaryTextStyle">
<enum name="normal" value="0" />
<enum name="italic" value="1" />
<enum name="bold" value="2" />
</attr>
<attr name="secondaryTextStyle">
<enum name="normal" value="0" />
<enum name="italic" value="1" />
<enum name="bold" value="2" />
</attr>
<attr name="corner">
<enum name="leftTop" value="1" />
<enum name="rightTop" value="2" />
<enum name="leftBottom" value="3" />
<enum name="rightBottom" value="4" />
</attr>
</declare-styleable>
<declare-styleable name="SwipeBackLayout"> <declare-styleable name="SwipeBackLayout">
<attr name="edge_flag"> <attr name="edge_flag">
<enum name="left" value="0" /> <enum name="left" value="0" />
......
...@@ -22,5 +22,5 @@ ...@@ -22,5 +22,5 @@
<item name="topbar_right_change_button" type="id"/> <item name="topbar_right_change_button" type="id"/>
<item name="layout_for_test" type="id"/>
</resources> </resources>
\ No newline at end of file
...@@ -235,34 +235,31 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -235,34 +235,31 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
// } // }
List<Function> functions = new ArrayList<>(); List<Function> functions = new ArrayList<>();
if (!BuildConfig.DEBUG) { // if (!BuildConfig.DEBUG) {
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.order, "order"));
functions.add(new Function((long) 150, 0, 5, "點餐", 0, 0)); functions.add(new Function((long) 150, 0, 5, "點餐", 0, 0));
functions.add(new Function((long) 138, 150, 5, "餐檯模式", R.drawable.ic_dining_table_mode, 0)); functions.add(new Function((long) 138, 150, 5, "餐檯模式", R.drawable.ic_dining_table_mode, 0));
functions.add(new Function((long) 139, 150, 5, "外送模式", R.drawable.ic_delivery_mode_close, 0)); functions.add(new Function((long) 139, 150, 5, "外送模式", R.drawable.ic_delivery_mode_close, 0));
functions.add(new Function((long) 140, 150, 5, "外賣模式", R.drawable.ic_outsourcing_model_close, 0)); functions.add(new Function((long) 140, 150, 5, "外賣模式", R.drawable.ic_outsourcing_model_close, 0));
functions.add(new Function((long) 141, 150, 5, "預點餐模式", R.drawable.ic_pre_order_mode_close, 1)); functions.add(new Function((long) 141, 150, 5, "預點餐模式", R.drawable.ic_pre_order_mode_close, 1));
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager"));
functions.add(new Function((long) 151, 0, 5, "管理", 0, 0)); functions.add(new Function((long) 151, 0, 5, "管理", 0, 0));
//// functions.add(new Function((long) 142, 151, 5, "賬單管理", R.drawable.ic_meals_menu_management, 0)); functions.add(new Function((long) 142, 151, 5, "賬單管理", R.drawable.ic_meals_menu_management, 0));
functions.add(new Function((long) 142, 151, 5, "外賣接單", R.drawable.ic_takeaway_orders, 0)); functions.add(new Function((long) 142, 151, 5, "外賣接單", R.drawable.ic_takeaway_orders, 0));
// functions.add(new Function((long) 143, 151, 5, "餐臺管理", R.drawable.ic_dining_table_management, 0)); functions.add(new Function((long) 143, 151, 5, "餐檯管理", R.drawable.ic_dining_table_management, 0));
functions.add(new Function((long) 144, 151, 5, "打印管理", R.drawable.ic_print_management, 0)); functions.add(new Function((long) 144, 151, 5, "打印管理", R.drawable.ic_print_management, 0));
//// functions.add(new Function((long) 145, 151, 5, "支付管理", R.drawable.ic_pay_management_close, 1)); //// functions.add(new Function((long) 145, 151, 5, "支付管理", R.drawable.ic_pay_management_close, 1));
//// functions.add(new Function((long) 146, 151, 5, "折扣管理", R.drawable.ic_discount_management_close, 1)); //// functions.add(new Function((long) 146, 151, 5, "折扣管理", R.drawable.ic_discount_management_close, 1));
//// functions.add(new Function((long) 147, 151, 5, "沽清管理", R.drawable.ic_sell_off_manger, 0)); functions.add(new Function((long) 147, 151, 5, "沽清管理", R.drawable.ic_sell_off_manger, 0));
// functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.employee, "employee"));
functions.add(new Function((long) 152, 0, 5, "員工", 0, 0)); functions.add(new Function((long) 152, 0, 5, "員工", 0, 0));
functions.add(new Function((long) 147, 152, 5, "員工管理", R.drawable.ic_staff_management_close, 1)); functions.add(new Function((long) 147, 152, 5, "員工管理", R.drawable.ic_staff_management_close, 1));
functions.add(new Function((long) 148, 152, 5, "權限管理", R.drawable.ic_authority_management_close, 1)); functions.add(new Function((long) 148, 152, 5, "權限管理", R.drawable.ic_authority_management_close, 1));
functions.add(new Function((long) 149, 152, 5, "操作記錄", R.drawable.ic_operation_record_close, 1)); functions.add(new Function((long) 149, 152, 5, "操作記錄", R.drawable.ic_operation_record_close, 1));
} else { // } else {
functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.order, "order")); // functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.order, "order"));
functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager")); // functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager"));
functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.employee, "employee")); // functions.addAll(FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.employee, "employee"));
} // }
//將功能列表數據分組 //將功能列表數據分組
SparseArray<String> parents = new SparseArray<>(); SparseArray<String> parents = new SparseArray<>();
...@@ -303,14 +300,14 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -303,14 +300,14 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
} }
private void functionClick(String name, int status) { private void functionClick(String name, int status) {
switch (status){ // switch (status){
case STATUS_NONACTIVATED: // case STATUS_NONACTIVATED:
ToastUtils.show(mContext, "服務暫未開通,請前往開通"); // ToastUtils.show(mContext, "服務暫未開通,請前往開通");
return; // return;
case STATUS_TIME_LIMIT: // case STATUS_TIME_LIMIT:
ToastUtils.show(mContext, "服務已到期,請前往續費"); // ToastUtils.show(mContext, "服務已到期,請前往續費");
return; // return;
} // }
if (name.equals("餐檯模式")) { if (name.equals("餐檯模式")) {
CC.obtainBuilder("Component.Table") CC.obtainBuilder("Component.Table")
.setActionName("showTableActivity") .setActionName("showTableActivity")
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_8" android:layout_marginTop="@dimen/dp_8"
android:singleLine="true"
android:text="餐檯模式" android:text="餐檯模式"
android:textColor="@color/normal_color" android:textColor="@color/normal_color"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
......
package com.gingersoft.gsa.cloud.manager.mvp.contract; package com.gingersoft.gsa.cloud.manager.mvp.contract;
import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableItem;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import java.util.List;
/** /**
* ================================================ * ================================================
...@@ -20,6 +23,8 @@ public interface TableListContract { ...@@ -20,6 +23,8 @@ public interface TableListContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void showEmptyView(boolean isSuccess, int size, Throwable t); void showEmptyView(boolean isSuccess, int size, Throwable t);
List<TableItem> getTableList();
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
...@@ -34,6 +34,10 @@ public interface TableManageContract { ...@@ -34,6 +34,10 @@ public interface TableManageContract {
void queryTablesSuccess(List<TableItem> tables, int type); void queryTablesSuccess(List<TableItem> tables, int type);
void showEmptyView(boolean isSuccess, int size, Throwable t); void showEmptyView(boolean isSuccess, int size, Throwable t);
void onStartRefreshTableData();
void onPauseRefreshTableData();
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
...@@ -55,5 +59,10 @@ public interface TableManageContract { ...@@ -55,5 +59,10 @@ public interface TableManageContract {
Observable<BaseResult> queryTables(); Observable<BaseResult> queryTables();
Observable<BaseResult> changeAreaSort(RequestBody requestBody);
Observable<BaseResult> changeTableSort(RequestBody requestBody);
Observable<BaseResult> updateTableServiceCharge(RequestBody requestBody);
} }
} }
...@@ -158,4 +158,40 @@ public class TableManageModel extends BaseModel implements TableManageContract.M ...@@ -158,4 +158,40 @@ public class TableManageModel extends BaseModel implements TableManageContract.M
.queryTable(restaurantId); .queryTable(restaurantId);
} }
@Override
public Observable<BaseResult> changeAreaSort(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(TableManageService.class)
.changeAreaSort(requestBody);
}
@Override
public Observable<BaseResult> changeTableSort(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(TableManageService.class)
.changeTableSort(requestBody)
.flatMap(new Function<BaseResult, Observable<BaseResult>>() {
@Override
public Observable<BaseResult> apply(BaseResult info) throws Exception {
if (info != null && info.isSuccess()) {
return queryTables();
}
return null;
}
});
}
@Override
public Observable<BaseResult> updateTableServiceCharge(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(TableManageService.class)
.updateTableServiceCharge(requestBody)
.flatMap(new Function<BaseResult, Observable<BaseResult>>() {
@Override
public Observable<BaseResult> apply(BaseResult info) throws Exception {
if (info != null && info.isSuccess()) {
return queryTables();
}
return null;
}
});
}
} }
\ No newline at end of file
...@@ -34,7 +34,7 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{ ...@@ -34,7 +34,7 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{
* regionId : 1 * regionId : 1
*/ */
private int id; private long id;
/**區域ID*/ /**區域ID*/
private int regionId; private int regionId;
/**區域名稱*/ /**區域名稱*/
...@@ -43,7 +43,12 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{ ...@@ -43,7 +43,12 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{
private int restaurantId; private int restaurantId;
private Long orderId; private Long orderId;
private String qrCode; private String qrCode;
/**默認就餐人數*/
private int seatCount; private int seatCount;
/**最大就餐人數*/
private int maxSeatCount;
/**最小就餐人數*/
private int minSeatCount;
private String createTime; private String createTime;
private String createBy; private String createBy;
private String qrCodeImg; private String qrCodeImg;
...@@ -71,10 +76,29 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{ ...@@ -71,10 +76,29 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{
* 排序 * 排序
*/ */
private int sort; private int sort;
/**
0:堂食
1:外賣
2:自取
*/
private int type = -1;
public static final int TABLE_TYPE_CANTEEN = 0;
public static final int TABLE_TYPE_TAKEAWAY = 1;
public static final int TABLE_TYPE_SELF_FETCHING = 2;
/**
* 自定義字段
*/
/**是否選中*/ /**是否選中*/
private boolean isChecked = false; private boolean isChecked = false;
/**
* UI类型:
* 餐台 0
* 新增(+) 1
*/
private int layoutType = 0;
public TableItem() { public TableItem() {
} }
...@@ -88,6 +112,8 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{ ...@@ -88,6 +112,8 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{
this.restaurantId = dataBean.restaurantId; this.restaurantId = dataBean.restaurantId;
this.qrCode = dataBean.qrCode; this.qrCode = dataBean.qrCode;
this.seatCount = dataBean.seatCount; this.seatCount = dataBean.seatCount;
this.maxSeatCount = dataBean.maxSeatCount;
this.minSeatCount = dataBean.minSeatCount;
this.createTime = dataBean.createTime; this.createTime = dataBean.createTime;
this.createBy = dataBean.createBy; this.createBy = dataBean.createBy;
this.qrCodeImg = dataBean.qrCodeImg; this.qrCodeImg = dataBean.qrCodeImg;
...@@ -98,6 +124,7 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{ ...@@ -98,6 +124,7 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{
this.person = dataBean.person; this.person = dataBean.person;
this.useStatus = dataBean.useStatus; this.useStatus = dataBean.useStatus;
this.sort = dataBean.sort; this.sort = dataBean.sort;
this.type = dataBean.type;
this.isChecked = dataBean.isChecked; this.isChecked = dataBean.isChecked;
} }
...@@ -117,11 +144,11 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{ ...@@ -117,11 +144,11 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{
this.useStatus = useStatus; this.useStatus = useStatus;
} }
public int getId() { public long getId() {
return id; return id;
} }
public void setId(int id) { public void setId(long id) {
this.id = id; this.id = id;
} }
...@@ -181,6 +208,30 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{ ...@@ -181,6 +208,30 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{
this.seatCount = seatCount; this.seatCount = seatCount;
} }
public int getMaxSeatCount() {
return maxSeatCount;
}
public void setMaxSeatCount(int maxSeatCount) {
this.maxSeatCount = maxSeatCount;
}
public int getMinSeatCount() {
return minSeatCount;
}
public void setMinSeatCount(int minSeatCount) {
this.minSeatCount = minSeatCount;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getCreateTime() { public String getCreateTime() {
return createTime; return createTime;
} }
...@@ -253,6 +304,14 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{ ...@@ -253,6 +304,14 @@ public class TableItem implements Serializable, QMUISection.Model<TableItem>{
isChecked = checked; isChecked = checked;
} }
public int getLayoutType() {
return layoutType;
}
public void setLayoutType(int layoutType) {
this.layoutType = layoutType;
}
@Override @Override
public TableItem cloneForDiff() { public TableItem cloneForDiff() {
return null; return null;
......
...@@ -16,13 +16,22 @@ public class TableRequest { ...@@ -16,13 +16,22 @@ public class TableRequest {
private int regionId; private int regionId;
/**餐檯名*/ /**餐檯名*/
private String tableName; private String tableName;
/**座位数*/ /**默認就餐人數*/
private int seatCount; private Integer seatCount;
/**最大就餐人數*/
private Integer maxSeatCount;
/**最小就餐人數*/
private Integer minSeatCount;
/**服務費*/ /**服務費*/
private Double serviceCharge; private Double serviceCharge;
/**排序*/ /**排序*/
private int sort; private int sort;
/**
0#堂食
1#外賣
2#自取
*/
private int type;
public int getRestaurantId() { public int getRestaurantId() {
return restaurantId; return restaurantId;
...@@ -56,6 +65,34 @@ public class TableRequest { ...@@ -56,6 +65,34 @@ public class TableRequest {
this.seatCount = seatCount; this.seatCount = seatCount;
} }
public void setSeatCount(Integer seatCount) {
this.seatCount = seatCount;
}
public Integer getMaxSeatCount() {
return maxSeatCount;
}
public void setMaxSeatCount(Integer maxSeatCount) {
this.maxSeatCount = maxSeatCount;
}
public Integer getMinSeatCount() {
return minSeatCount;
}
public void setMinSeatCount(Integer minSeatCount) {
this.minSeatCount = minSeatCount;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public Double getServiceCharge() { public Double getServiceCharge() {
return serviceCharge; return serviceCharge;
} }
...@@ -75,26 +112,36 @@ public class TableRequest { ...@@ -75,26 +112,36 @@ public class TableRequest {
public static class Update { public static class Update {
private int id; private long id;
private int restaurantId; private int restaurantId;
/**區域ID*/ /**區域ID*/
private int regionId; private int regionId;
/**餐檯名*/ /**餐檯名*/
private String tableName; private String tableName;
/**座位数*/ /**默認就餐人數*/
private int seatCount; private Integer seatCount;
/**最大就餐人數*/
private Integer maxSeatCount;
/**最小就餐人數*/
private Integer minSeatCount;
/**服務費*/ /**服務費*/
private Double serviceCharge; private Double serviceCharge;
/**排序*/ /**排序*/
private int sort; private int sort;
/**
0:堂食
1:外賣
2:自取
*/
private int type = -1;
public int getId() { public long getId() {
return id; return id;
} }
public void setId(int id) { public void setId(long id) {
this.id = id; this.id = id;
} }
...@@ -130,6 +177,34 @@ public class TableRequest { ...@@ -130,6 +177,34 @@ public class TableRequest {
this.seatCount = seatCount; this.seatCount = seatCount;
} }
public void setSeatCount(Integer seatCount) {
this.seatCount = seatCount;
}
public Integer getMaxSeatCount() {
return maxSeatCount;
}
public void setMaxSeatCount(Integer maxSeatCount) {
this.maxSeatCount = maxSeatCount;
}
public Integer getMinSeatCount() {
return minSeatCount;
}
public void setMinSeatCount(Integer minSeatCount) {
this.minSeatCount = minSeatCount;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public Double getServiceCharge() { public Double getServiceCharge() {
return serviceCharge; return serviceCharge;
} }
...@@ -147,4 +222,28 @@ public class TableRequest { ...@@ -147,4 +222,28 @@ public class TableRequest {
} }
} }
public static class UpdateServiceCharge {
private long id;
/**服務費*/
private Double serviceCharge;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Double getServiceCharge() {
return serviceCharge;
}
public void setServiceCharge(Double serviceCharge) {
this.serviceCharge = serviceCharge;
}
}
} }
...@@ -51,4 +51,13 @@ public interface TableManageService { ...@@ -51,4 +51,13 @@ public interface TableManageService {
@POST("restaurant/exchangeSort" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> changeAreaSort(@Body RequestBody requestBody);
@POST("restaurantTable/exchangeSort" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> changeTableSort(@Body RequestBody requestBody);
@POST("restaurantTable/updateRestaurantTableBatch" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> updateTableServiceCharge(@Body RequestBody requestBody);
} }
...@@ -90,9 +90,22 @@ public class TableListPresenter extends BasePresenter<TableListContract.Model, T ...@@ -90,9 +90,22 @@ public class TableListPresenter extends BasePresenter<TableListContract.Model, T
/** /**
* 組合區域集合 * 組合區域集合
*/ */
public List<TableArea> assembleAreaList(List<TableItem> tableList) { public List<TableArea> assembleAreaList(List<TableArea> areaList, List<TableItem> tableList) {
removeOtherAreaItem(areaList);
if (areaList.size() > 0) {
for (TableItem table : tableList) {
if (table.getRegionId() == -1) {
//將沒有區域的檯 放到其他下面
TableArea newArea = new TableArea();
newArea.setId(-1);
newArea.setRegionName("其他");
areaList.add(newArea);
break;
}
}
return areaList;
}
boolean addOther = false; boolean addOther = false;
List<TableArea> areaList = new ArrayList<>();
for (TableItem table : tableList) { for (TableItem table : tableList) {
if (table.getRegionId() != -1) { if (table.getRegionId() != -1) {
if (!equalsAreaId(areaList, table.getRegionId())) { if (!equalsAreaId(areaList, table.getRegionId())) {
...@@ -124,6 +137,14 @@ public class TableListPresenter extends BasePresenter<TableListContract.Model, T ...@@ -124,6 +137,14 @@ public class TableListPresenter extends BasePresenter<TableListContract.Model, T
return false; return false;
} }
private void removeOtherAreaItem(List<TableArea> areaList) {
for (int i = areaList.size() - 1; i >= 0; i--) {
if (areaList.get(i).getRegionName().equals("其他")) {
areaList.remove(i);
}
}
}
public List<QMUISection<SectionHeader, TableItem>> tableAreaTransformToSection(List<TableArea> mItems) { public List<QMUISection<SectionHeader, TableItem>> tableAreaTransformToSection(List<TableArea> mItems) {
List<QMUISection<SectionHeader, TableItem>> qmuiSections = new ArrayList<>(); List<QMUISection<SectionHeader, TableItem>> qmuiSections = new ArrayList<>();
for (int i = 0; i < mItems.size(); i++) { for (int i = 0; i < mItems.size(); i++) {
...@@ -139,6 +160,23 @@ public class TableListPresenter extends BasePresenter<TableListContract.Model, T ...@@ -139,6 +160,23 @@ public class TableListPresenter extends BasePresenter<TableListContract.Model, T
if (Objects.requireNonNull(tableArea.getTableItemList().size()) > 0) { if (Objects.requireNonNull(tableArea.getTableItemList().size()) > 0) {
contents.addAll(tableArea.getTableItemList()); contents.addAll(tableArea.getTableItemList());
} }
contents.add(createAddTableItem(tableArea));
return new QMUISection(header, contents, false); return new QMUISection(header, contents, false);
} }
/**
* 创建+按钮
*
* @return
*/
private TableItem createAddTableItem(TableArea tableArea) {
TableItem item = new TableItem();
item.setLayoutType(1);
item.setStatus(0);
item.setRegionId(tableArea.getId());
item.setRegionName(tableArea.getRegionName());
return item;
}
} }
package com.gingersoft.gsa.cloud.manager.mvp.presenter; package com.gingersoft.gsa.cloud.manager.mvp.presenter;
import android.app.Application; import android.app.Application;
import android.os.CountDownTimer;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult; import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.common.bean.FoodBean; import com.gingersoft.gsa.cloud.base.common.bean.FoodBean;
import com.gingersoft.gsa.cloud.base.common.bean.OrderDetail;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils; import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.constans.GoldConstants;
import com.gingersoft.gsa.cloud.database.utils.FoodDaoUtils; import com.gingersoft.gsa.cloud.database.utils.FoodDaoUtils;
import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableArea; import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableArea;
import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableItem; import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableItem;
...@@ -35,8 +39,11 @@ import com.gingersoft.gsa.cloud.manager.mvp.contract.TableManageContract; ...@@ -35,8 +39,11 @@ import com.gingersoft.gsa.cloud.manager.mvp.contract.TableManageContract;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.gingersoft.gsa.cloud.base.common.bean.OrderDetail.DISCOUNT_TYPE;
/** /**
* ================================================ * ================================================
...@@ -61,10 +68,16 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode ...@@ -61,10 +68,16 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
@Inject @Inject
AppManager mAppManager; AppManager mAppManager;
//定时获取餐台 定时器
private GetTableTimer tableTimer;
private Disposable mGetTablesDataDisposable;
private TableManageActivity IActivity;
@Inject @Inject
public TableManagePresenter(TableManageContract.Model model, TableManageContract.View rootView) { public TableManagePresenter(TableManageContract.Model model, TableManageContract.View rootView) {
super(model, rootView); super(model, rootView);
this.IActivity = (TableManageActivity) rootView;
} }
@Override @Override
...@@ -155,11 +168,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode ...@@ -155,11 +168,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
}); });
} }
public void queryAreas(RefreshLayout refreshLayout) { public void queryAreas(RefreshLayout refreshLayout, boolean showLoading) {
mModel.queryAreas() mModel.queryAreas()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> { .doOnSubscribe(disposable -> {
if (refreshLayout == null) { if (refreshLayout == null && showLoading) {
mRootView.showLoading(null); mRootView.showLoading(null);
} }
}) })
...@@ -291,20 +304,14 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode ...@@ -291,20 +304,14 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
mRootView.showMessage("更新失敗"); mRootView.showMessage("更新失敗");
} }
} }
@Override
public void onError(Throwable t) {
super.onError(t);
}
}); });
} }
public void queryTables(RefreshLayout refreshLayout) { public void queryTables(RefreshLayout refreshLayout, boolean showLoading) {
mModel.queryTables() mModel.queryTables()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> { .doOnSubscribe(disposable -> {
if (refreshLayout == null) { if (refreshLayout == null && showLoading) {
mRootView.showLoading(null); mRootView.showLoading(null);
} }
}) })
...@@ -315,6 +322,12 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode ...@@ -315,6 +322,12 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override @Override
public void onSubscribe(Disposable d) {
super.onSubscribe(d);
mGetTablesDataDisposable = d;
}
@Override
public void onNext(@NonNull BaseResult info) { public void onNext(@NonNull BaseResult info) {
if (info != null && info.isSuccess()) { if (info != null && info.isSuccess()) {
if (info.getData() != null) { if (info.getData() != null) {
...@@ -355,5 +368,168 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode ...@@ -355,5 +368,168 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
}); });
} }
public void changeAreaSort(long id, long sort, long targetId, long targetSort) {
RequestBody requestBody = new FormBody.Builder()
.add("id", String.valueOf(id))
.add("sort", String.valueOf(sort))
.add("targetId", String.valueOf(targetId))
.add("targetSort", String.valueOf(targetSort))
.build();
LogUtil.d(TAG, "changeAreaSort " + " id:" + id + " sort:" + sort + " targetId:" + targetId + " targetSort:" + targetSort);
mModel.changeAreaSort(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info != null && info.isSuccess()) {
if (info.getData() != null) {
List<TableItem> tableItems = JsonUtils.parseArray(info.getData(), TableItem.class);
if (tableItems.size() > 0) {
mRootView.queryTablesSuccess(tableItems, TableManageActivity.CHANGE_AREA_SORT);
} else {
mRootView.showEmptyView(true, 0, null);
}
} else {
mRootView.showEmptyView(true, 0, null);
}
} else {
mRootView.showMessage("更新失敗");
}
}
});
}
public void changeTableSort() {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", String.valueOf(GsaCloudApplication.getRestaurantId(mApplication)))
.add("ids", getTableIds())
.build();
mModel.changeTableSort(requestBody)
.subscribeOn(Schedulers.io())
// .doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
// .doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info != null && info.isSuccess()) {
if (info.getData() != null) {
List<TableItem> tableItems = JsonUtils.parseArray(info.getData(), TableItem.class);
if (tableItems.size() > 0) {
mRootView.queryTablesSuccess(tableItems, TableManageActivity.CHANGE_TABLE_SORT);
} else {
mRootView.showEmptyView(true, 0, null);
}
} else {
mRootView.showEmptyView(true, 0, null);
}
} else {
mRootView.showMessage("更新失敗");
}
}
});
}
private String getTableIds() {
StringBuilder builder = new StringBuilder();
for (TableItem tableItem : IActivity.getTableList()) {
builder.append(tableItem.getId());
builder.append(",");
}
String str = builder.toString();
if (str.endsWith(",")) {
str = str.substring(0, str.length() - 1);
}
return str;
}
public void updateTableServiceCharge(List<TableRequest.UpdateServiceCharge> request) {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(request));
String json = GsonUtils.GsonString(request);
mModel.updateTableServiceCharge(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info != null && info.isSuccess()) {
if (info.getData() != null) {
List<TableItem> tableItems = JsonUtils.parseArray(info.getData(), TableItem.class);
if (tableItems.size() > 0) {
mRootView.queryTablesSuccess(tableItems, TableManageActivity.UPDATE_TABLE_SERVICE_CHARGE);
} else {
mRootView.showEmptyView(true, 0, null);
}
} else {
mRootView.showEmptyView(true, 0, null);
}
} else {
mRootView.showMessage("更新失敗");
}
}
});
}
public void initGetTableTimer() {
if (tableTimer == null) {
tableTimer = new GetTableTimer(GoldConstants.refreshTime * 1000, GoldConstants.refreshTime * 1000);
}
TableManageActivity.isRefreshData = true;
tableTimer.start();
}
public void startTableTimer() {
if (tableTimer != null) {
tableTimer.start();
}
}
public void cancelTableTimer() {
if (tableTimer != null) {
tableTimer.cancel();
}
}
/**
* 计时器类 定時更新餐台数据
*/
private class GetTableTimer extends CountDownTimer {
public GetTableTimer(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);// 参数依次为总时长,和计时的时间间隔
}
@Override
public void onFinish() {// 计时完毕时触发
if (TableManageActivity.isRefreshData) {
queryAreas(null, false);
queryTables(null, false);
}
this.start();
}
@Override
public void onTick(long millisUntilFinished) {// 计时过程显示
}
}
public Disposable getGetTablesDataDisposable() {
return mGetTablesDataDisposable;
}
} }
...@@ -79,6 +79,11 @@ import static com.jess.arms.utils.Preconditions.checkNotNull; ...@@ -79,6 +79,11 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
*/ */
public class TableManageActivity extends BaseFragmentActivity<TableManagePresenter> implements TableManageContract.View { public class TableManageActivity extends BaseFragmentActivity<TableManagePresenter> implements TableManageContract.View {
/**
* 輪訓刷新餐檯數據
*/
public static boolean isRefreshData = true;
public static final int ADD_TABLE_RESULT_SUCCESS = 100; public static final int ADD_TABLE_RESULT_SUCCESS = 100;
public static final int ADD_AREA_RESULT_SUCCESS = 200; public static final int ADD_AREA_RESULT_SUCCESS = 200;
...@@ -92,7 +97,14 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent ...@@ -92,7 +97,14 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent
public static final byte UPDATE_TABLE_SUCCESS = 22; public static final byte UPDATE_TABLE_SUCCESS = 22;
public static final byte QUERY_TABLE_SUCCESS = 23; public static final byte QUERY_TABLE_SUCCESS = 23;
public static final byte CHANGE_AREA_SORT = 30;
public static final byte CHANGE_TABLE_SORT = 31;
public static final byte UPDATE_TABLE_SERVICE_CHARGE = 32;
private List<TableArea> mTableAreaList = new ArrayList<>(); private List<TableArea> mTableAreaList = new ArrayList<>();
private List<TableItem> mTableList = new ArrayList<>();
@Override @Override
public void setupActivityComponent(@NonNull AppComponent appComponent) { public void setupActivityComponent(@NonNull AppComponent appComponent) {
...@@ -115,6 +127,11 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent ...@@ -115,6 +127,11 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent
if (findFragment(TableListFragment.class) == null) { if (findFragment(TableListFragment.class) == null) {
loadRootFragment(R.id.fl_container, TableListFragment.newInstance()); loadRootFragment(R.id.fl_container, TableListFragment.newInstance());
} }
}
public void initGetTableTimer() {
mPresenter.initGetTableTimer();
} }
@Override @Override
...@@ -142,7 +159,7 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent ...@@ -142,7 +159,7 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent
} }
public void queryAreas(RefreshLayout refreshLayout) { public void queryAreas(RefreshLayout refreshLayout) {
mPresenter.queryAreas(refreshLayout); mPresenter.queryAreas(refreshLayout, true);
} }
public void addTable(TableRequest.Add request) { public void addTable(TableRequest.Add request) {
...@@ -158,7 +175,19 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent ...@@ -158,7 +175,19 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent
} }
public void queryTables(RefreshLayout refreshLayout) { public void queryTables(RefreshLayout refreshLayout) {
mPresenter.queryTables(refreshLayout); mPresenter.queryTables(refreshLayout, true);
}
public void changeAreaSort(long id, long sort, long targetId, long targetSort) {
mPresenter.changeAreaSort(id, sort, targetId, targetSort);
}
public void changeTableSort() {
mPresenter.changeTableSort();
}
public void updateTableServiceCharge(List<TableRequest.UpdateServiceCharge> request) {
mPresenter.updateTableServiceCharge(request);
} }
@Override @Override
...@@ -233,11 +262,15 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent ...@@ -233,11 +262,15 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent
switch (type) { switch (type) {
case ADD_AREA_SUCCESS: case ADD_AREA_SUCCESS:
case UPDATE_AREA_SUCCESS: case UPDATE_AREA_SUCCESS:
AddAreaFragment addAreaFragment = (AddAreaFragment) fragment; AreaListFragment areaListFragment = (AreaListFragment) fragment;
addAreaFragment.pop();
AreaListFragment areaListFragment = findFragment(AreaListFragment.class);
if (areaListFragment != null) { if (areaListFragment != null) {
areaListFragment.updateAreaData(areas); if (type == ADD_AREA_SUCCESS) {
areaListFragment.addSuccess();
}
}
TableListFragment tableListFragment = findFragment(TableListFragment.class);
if(tableListFragment != null){
tableListFragment.updateTableData(mTableAreaList, mTableList);
} }
break; break;
case DELETE_AREA_SUCCESS: case DELETE_AREA_SUCCESS:
...@@ -246,29 +279,43 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent ...@@ -246,29 +279,43 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent
case QUERY_AREA_SUCCESS: case QUERY_AREA_SUCCESS:
break; break;
case CHANGE_AREA_SORT:
break;
} }
} }
} }
@Override @Override
public void queryTablesSuccess(List<TableItem> tables, int type) { public void queryTablesSuccess(List<TableItem> tables, int type) {
if (mTableList.size() > 0) {
mTableList.clear();
}
this.mTableList.addAll(tables);
ISupportFragment fragment = getTopFragment(); ISupportFragment fragment = getTopFragment();
if (fragment != null) { if (fragment != null) {
if (fragment instanceof TableListFragment) { if (fragment instanceof TableListFragment) {
TableListFragment tableListFragment = (TableListFragment) fragment; TableListFragment tableListFragment = (TableListFragment) fragment;
tableListFragment.updateTableData(tables); tableListFragment.updateTableData(mTableAreaList, tables);
} }
TableListFragment tableListFragment = findFragment(TableListFragment.class);
switch (type) { switch (type) {
case ADD_TABLE_SUCCESS: case ADD_TABLE_SUCCESS:
case UPDATE_TABLE_SUCCESS: case UPDATE_TABLE_SUCCESS:
AddTableFragment addTableFragment = (AddTableFragment) fragment; AddTableFragment addTableFragment = (AddTableFragment) fragment;
addTableFragment.pop(); addTableFragment.pop();
TableListFragment tableListFragment = findFragment(TableListFragment.class);
if (tableListFragment != null) { if (tableListFragment != null) {
tableListFragment.updateTableData(tables); tableListFragment.updateTableData(mTableAreaList, tables);
} }
break; break;
case DELETE_TABLE_SUCCESS: case DELETE_TABLE_SUCCESS:
case UPDATE_TABLE_SERVICE_CHARGE:
if (fragment instanceof TableListFragment) {
tableListFragment.backEdit();
}
break;
case CHANGE_TABLE_SORT:
break; break;
case QUERY_TABLE_SUCCESS: case QUERY_TABLE_SUCCESS:
...@@ -290,8 +337,29 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent ...@@ -290,8 +337,29 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent
} }
} }
@Override
public void onStartRefreshTableData() {
isRefreshData = true;
mPresenter.startTableTimer();
mPresenter.queryTables(null, false);
}
@Override
public void onPauseRefreshTableData() {
isRefreshData = false;
mPresenter.cancelTableTimer();
//立刻停止獲取餐檯接口
if (mPresenter.getGetTablesDataDisposable() != null && !mPresenter.getGetTablesDataDisposable().isDisposed()) {
mPresenter.getGetTablesDataDisposable().dispose();
}
}
public List<TableArea> getTableAreaList() { public List<TableArea> getTableAreaList() {
return mTableAreaList; return mTableAreaList;
} }
public List<TableItem> getTableList() {
return mTableList;
}
} }
package com.gingersoft.gsa.cloud.manager.mvp.ui.adapter; package com.gingersoft.gsa.cloud.manager.mvp.ui.adapter;
import android.content.Context; import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View; import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView; import android.widget.TextView;
...@@ -50,12 +53,12 @@ public class AreaManageAdapter extends DefaultAdapter<TableArea> { ...@@ -50,12 +53,12 @@ public class AreaManageAdapter extends DefaultAdapter<TableArea> {
return R.layout.manager_item_manage_area; return R.layout.manager_item_manage_area;
} }
class TopTableAreaItemHolder extends BaseHolder<TableArea> { public class TopTableAreaItemHolder extends BaseHolder<TableArea> {
@BindView(R2.id.tv_name) @BindView(R2.id.ed_name)
TextView tv_name; EditText ed_name;
// @BindView(R2.id.tv_edit) // @BindView(R2.id.ed_input_name)
// TextView tv_edit; // TextView ed_input_name;
@BindView(R2.id.cb_checked) @BindView(R2.id.cb_checked)
CheckBox cb_checked; CheckBox cb_checked;
...@@ -65,7 +68,18 @@ public class AreaManageAdapter extends DefaultAdapter<TableArea> { ...@@ -65,7 +68,18 @@ public class AreaManageAdapter extends DefaultAdapter<TableArea> {
@Override @Override
public void setData(TableArea datasBean, int position) { public void setData(TableArea datasBean, int position) {
tv_name.setText(datasBean.getRegionName()); ed_name.setText(datasBean.getRegionName());
ed_name.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
String name = ed_name.getText().toString();
if (onTextChangedListener != null && !name.equals(datasBean.getRegionName())) {
onTextChangedListener.afterTextChanged(datasBean, name);
}
}
}
});
// tv_edit.setOnClickListener(new View.OnClickListener() { // tv_edit.setOnClickListener(new View.OnClickListener() {
// @Override // @Override
// public void onClick(View v) { // public void onClick(View v) {
...@@ -92,15 +106,15 @@ public class AreaManageAdapter extends DefaultAdapter<TableArea> { ...@@ -92,15 +106,15 @@ public class AreaManageAdapter extends DefaultAdapter<TableArea> {
isRadioEdit = radioEdit; isRadioEdit = radioEdit;
} }
private OnClickListener onClickListener; private OnTextChangedListener onTextChangedListener;
public void setOnClickListener(OnClickListener onClickListener) { public void addTextChangedListener(OnTextChangedListener onTextChangedListener) {
this.onClickListener = onClickListener; this.onTextChangedListener = onTextChangedListener;
} }
public interface OnClickListener { public interface OnTextChangedListener {
void onItemClick(View v, TableArea function); void afterTextChanged(TableArea datasBean, String s);
} }
} }
package com.gingersoft.gsa.cloud.manager.mvp.ui.adapter; package com.gingersoft.gsa.cloud.manager.mvp.ui.adapter;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.gingersoft.gsa.cloud.aspectj.XClickUtil;
import com.gingersoft.gsa.cloud.base.common.bean.TableBean;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtil;
import com.gingersoft.gsa.cloud.manager.R; import com.gingersoft.gsa.cloud.manager.R;
import com.gingersoft.gsa.cloud.manager.R2; import com.gingersoft.gsa.cloud.manager.R2;
import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableItem; import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableItem;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader; import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader;
import com.gingersoft.gsa.cloud.ui.view.TriangleLabelView;
import com.gingersoft.gsa.cloud.ui.view.qm.QDLoadingItemView; import com.gingersoft.gsa.cloud.ui.view.qm.QDLoadingItemView;
import com.gingersoft.gsa.cloud.ui.view.section.QDSectionHeaderView; import com.gingersoft.gsa.cloud.ui.view.section.QDSectionHeaderView;
import com.jess.arms.utils.DeviceUtils;
import com.qmuiteam.qmui.alpha.QMUIAlphaRelativeLayout;
import com.qmuiteam.qmui.layout.QMUIFrameLayout;
import com.qmuiteam.qmui.layout.QMUILinearLayout;
import com.qmuiteam.qmui.layout.QMUIRelativeLayout;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.section.QMUIDefaultStickySectionAdapter; import com.qmuiteam.qmui.widget.section.QMUIDefaultStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUISection; import com.qmuiteam.qmui.widget.section.QMUISection;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter; import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import java.util.Date;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
...@@ -34,10 +53,28 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter< ...@@ -34,10 +53,28 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter<
private Context context; private Context context;
private boolean isRadioEdit = false; private boolean isRadioEdit = false;
//Item行数(行数根据数据自动计算)
private int ItemRowCount = 6;
//Item高度
private int ItemColHeight;
private int mRadius;
private float mShadowAlpha = 0.25f;
private int mShadowElevationDp = 14;
public void initItemDispalyHeight() {
float screenHeight = DeviceUtils.getScreenHeight(context) - 75 - 75;
ItemColHeight = (int) Math.ceil((double) screenHeight / (double) (ItemRowCount));
ItemColHeight = ItemColHeight - 3;
}
@NonNull @NonNull
@Override @Override
protected QMUIStickySectionAdapter.ViewHolder onCreateSectionHeaderViewHolder(@NonNull ViewGroup viewGroup) { protected QMUIStickySectionAdapter.ViewHolder onCreateSectionHeaderViewHolder(@NonNull ViewGroup viewGroup) {
this.context = viewGroup.getContext(); this.context = viewGroup.getContext();
this.mRadius = QMUIDisplayHelper.dp2px(context, 5);
initItemDispalyHeight();
return new QMUIStickySectionAdapter.ViewHolder(new QDSectionHeaderView(viewGroup.getContext())); return new QMUIStickySectionAdapter.ViewHolder(new QDSectionHeaderView(viewGroup.getContext()));
} }
...@@ -76,25 +113,151 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter< ...@@ -76,25 +113,151 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter<
TableItem tableItem = section.getItemAt(itemIndex); TableItem tableItem = section.getItemAt(itemIndex);
viewHolder.tv_name.setText(tableItem.getTableName()); if (tableItem.getLayoutType() == 1) {
if (tableItem.getServiceCharge() > 0) {
viewHolder.tv_service_fee.setText(tableItem.getServiceCharge() + "%"); viewHolder.fl_add_table.setVisibility(View.VISIBLE);
viewHolder.tv_service_fee.setVisibility(View.VISIBLE); viewHolder.rl_table.setVisibility(View.GONE);
initAddItemDispalyMetrics(viewHolder);
viewHolder.ll_container.setBackgroundColor(Color.parseColor("#FFFFFFFF"));
setBackGroundWork(viewHolder, Color.parseColor("#FFFFFFFF"), R.color.black);
} else {
viewHolder.rl_table.setVisibility(View.VISIBLE);
viewHolder.fl_add_table.setVisibility(View.GONE);
initTableItemData(viewHolder, tableItem);
initTableItemDispalyMetrics(viewHolder);
initTableBackground(viewHolder, tableItem);
if (tableItem.getServiceCharge() > 0) {
viewHolder.tv_service_fee.setText(tableItem.getServiceCharge() + "%");
viewHolder.tv_service_fee.setVisibility(View.VISIBLE);
} else {
viewHolder.tv_service_fee.setVisibility(View.INVISIBLE);
}
if (isRadioEdit && tableItem.getUseStatus() == 0) {
viewHolder.cb_checked.setChecked(tableItem.isChecked());
viewHolder.cb_checked.setVisibility(View.VISIBLE);
viewHolder.cb_checked.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
tableItem.setChecked(isChecked);
}
});
} else {
viewHolder.cb_checked.setVisibility(View.GONE);
}
}
viewHolder.ll_container.setRadiusAndShadow(mRadius, QMUIDisplayHelper.dp2px(context, mShadowElevationDp), mShadowAlpha);
}
private void initTableItemData(ViewHolder viewHolder, TableItem item) {
viewHolder.tv_table.setText(item.getTableName());
if (item.getStatus() != 0) {
viewHolder.tv_people.setVisibility(View.VISIBLE);
if (item.getMinSeatCount() != 0 || item.getMaxSeatCount() != 0) {
viewHolder.tv_people.setText(item.getMinSeatCount() + "-" + item.getMaxSeatCount() + "人");
} else {
viewHolder.tv_people.setText("");
}
viewHolder.tv_table.setMaxLines(1);
} else {
//未開檯空間足夠可換行顯示
viewHolder.tv_table.setMaxLines(2);
viewHolder.tv_people.setVisibility(View.GONE);
}
if (item.getStatus() != 0) {
switch (item.getType()) {
case TableItem.TABLE_TYPE_CANTEEN:
viewHolder.tlv_table_type.setPrimaryText("堂");
viewHolder.tlv_table_type.setPrimaryTextColor(Color.parseColor("#249B65"));
break;
case TableItem.TABLE_TYPE_TAKEAWAY:
viewHolder.tlv_table_type.setPrimaryText("外");
viewHolder.tlv_table_type.setPrimaryTextColor(Color.parseColor("#FF720A"));
break;
case TableItem.TABLE_TYPE_SELF_FETCHING:
viewHolder.tlv_table_type.setPrimaryText("自");
viewHolder.tlv_table_type.setPrimaryTextColor(Color.parseColor("#00479D"));
break;
}
viewHolder.tlv_table_type.setVisibility(View.VISIBLE);
} else { } else {
viewHolder.tv_service_fee.setVisibility(View.INVISIBLE); viewHolder.tlv_table_type.setVisibility(View.GONE);
} }
if (isRadioEdit) { }
viewHolder.cb_checked.setChecked(tableItem.isChecked());
viewHolder.cb_checked.setVisibility(View.VISIBLE); private void initTableBackground(ViewHolder viewHolder, TableItem item) {
viewHolder.cb_checked.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { // if (item.getSplitStatus() != 0) {
@Override // setBackGroundWork(item, "888", R.drawable.tablebutton_splite, R.drawable.tablebutton_splite_new, R.color.black);
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // } else {
tableItem.setChecked(isChecked);
} viewHolder.ll_container.setBackgroundColor(Color.parseColor("#FFFFFFFF"));
});
if (item.getUseStatus() == 1) {
setBackGroundWork(viewHolder, Color.parseColor("#FFD14141"), R.color.theme_white_color);
} else { } else {
viewHolder.cb_checked.setVisibility(View.GONE); switch (item.getStatus()) {
case 0:
setBackGroundWork(viewHolder, Color.parseColor("#FFFFFFFF"), R.color.black);
break;
case 1:
// setBackGroundWork(item, "2", R.drawable.table_shape_table_send, R.drawable.tablebutton_glassgreen_new, R.color.theme_white_color); break;
case 2:
setBackGroundWork(viewHolder, Color.parseColor("#FF249B65"), R.color.theme_white_color);
break;
case 3:
setBackGroundWork(viewHolder, Color.parseColor("#FFE5AC00"), R.color.theme_white_color);
break;
case 4:
setBackGroundWork(viewHolder, ContextCompat.getColor(context, R.color.Violet), R.color.theme_white_color);
break;
case 5:
setBackGroundWork(viewHolder, ContextCompat.getColor(context, R.color.Violet), R.color.theme_white_color);
break;
case 6:
setBackGroundWork(viewHolder, ContextCompat.getColor(context, R.color.Violet), R.color.theme_white_color);
break;
}
}
}
private void initTableItemDispalyMetrics(ViewHolder viewHolder) {
if (viewHolder.tv_table.getGravity() != Gravity.CENTER) {
viewHolder.rl_table.setGravity(Gravity.CENTER);
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) viewHolder.rl_table.getLayoutParams();
lp.height = ItemColHeight;
viewHolder.rl_table.setLayoutParams(lp);
} }
viewHolder.rl_table.setMinimumHeight(ItemColHeight);
RelativeLayout.LayoutParams relativeLayout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
relativeLayout.height = ItemColHeight;
viewHolder.rl_table.setLayoutParams(relativeLayout);
}
private void setBackGroundWork(ViewHolder viewHolder, int defaultMainback, int defaultFontColor) {
if (defaultMainback != -1) {
viewHolder.ll_container.setBackgroundColor(defaultMainback);
}
viewHolder.tv_table.setTextColor(context.getResources().getColor(defaultFontColor));
}
private void initAddItemDispalyMetrics(ViewHolder viewHolder) {
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) viewHolder.fl_add_table.getLayoutParams();
viewHolder.fl_add_table.setLayoutParams(lp);
viewHolder.fl_add_table.setMinimumHeight(ItemColHeight);
RelativeLayout.LayoutParams relativeLayout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
relativeLayout.height = ItemColHeight;
viewHolder.fl_add_table.setLayoutParams(relativeLayout);
} }
public void setRadioEdit(boolean radioEdit) { public void setRadioEdit(boolean radioEdit) {
...@@ -102,20 +265,39 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter< ...@@ -102,20 +265,39 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter<
} }
public class ViewHolder extends QMUIStickySectionAdapter.ViewHolder { public class ViewHolder extends QMUIStickySectionAdapter.ViewHolder {
@BindView(R2.id.tv_name)
TextView tv_name; @BindView(R2.id.ll_container)
QMUIRelativeLayout ll_container;
@BindView(R2.id.rl_table)
RelativeLayout rl_table;
@BindView(R2.id.tv_table)
TextView tv_table;
@BindView(R2.id.tv_people)
TextView tv_people;
// @BindView(R2.id.btn_showMain)
// Button btn_showMain;
// @BindView(R2.id.iv_vip)
// ImageView iv_vip;
// @BindView(R2.id.tv_scan_flag)
// TextView tv_scan_flag;
@BindView(R2.id.tv_service_fee) @BindView(R2.id.tv_service_fee)
TextView tv_service_fee; TextView tv_service_fee;
@BindView(R2.id.cb_checked) @BindView(R2.id.cb_checked)
CheckBox cb_checked; CheckBox cb_checked;
@BindView(R2.id.fl_add_table)
FrameLayout fl_add_table;
@BindView(R2.id.tlv_table_type)
TriangleLabelView tlv_table_type;
public ViewHolder(View itemView) { public ViewHolder(View itemView) {
super(itemView); super(itemView);
ButterKnife.bind(this, itemView); ButterKnife.bind(this, itemView);
} }
public TextView getTvName() { public TextView getTvName() {
return tv_name; return tv_table;
} }
public TextView getTvServiceFee() { public TextView getTvServiceFee() {
...@@ -126,6 +308,7 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter< ...@@ -126,6 +308,7 @@ public class TableManageSectiontAdapter extends QMUIDefaultStickySectionAdapter<
TableItem item = getSectionItem(position); TableItem item = getSectionItem(position);
return item; return item;
} }
} }
} }
...@@ -3,13 +3,18 @@ package com.gingersoft.gsa.cloud.manager.mvp.ui.fragment; ...@@ -3,13 +3,18 @@ package com.gingersoft.gsa.cloud.manager.mvp.ui.fragment;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Gravity;
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.view.ViewGroup.MarginLayoutParams;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
...@@ -39,6 +44,7 @@ import java.util.List; ...@@ -39,6 +44,7 @@ import java.util.List;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import butterknife.BindView; import butterknife.BindView;
...@@ -66,15 +72,21 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements ...@@ -66,15 +72,21 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements
private TableManageActivity mActivity; private TableManageActivity mActivity;
private QMUIPopup mNormalPopup; private QMUICommonListItemView tableTypeItemView;
private QMUICommonListItemView areaItemView; private EditText tableNameEditText, peopleMixNumberEditText, peopleMaxNumberEditText, defalutPeopleNumberEditText, serverchargeEditText;
private EditText tableNameEditText, peopleNumberEditText, serverchargeEditText, tableSortEditText;
private static final String TABLE_AREA = "table"; private static final String TABLE_AREA = "table";
private TableItem mTableItem; private TableItem mTableItem;
private int currentAreaId; private int currentAreaId;
/**
* 餐檯類型
*/
private String[] tableTypes = {"堂食", "外賣", "自取"};
private int tableType = -1;
public static AddTableFragment newInstance(TableItem item) { public static AddTableFragment newInstance(TableItem item) {
AddTableFragment fragment = new AddTableFragment(); AddTableFragment fragment = new AddTableFragment();
if (item != null) { if (item != null) {
...@@ -119,7 +131,7 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements ...@@ -119,7 +131,7 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements
Button rightButton = mTopBar.addRightTextButton("保存", R.id.qmui_dialog_edit_right_icon); Button rightButton = mTopBar.addRightTextButton("保存", R.id.qmui_dialog_edit_right_icon);
rightButton.setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color)); rightButton.setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color));
rightButton.setOnClickListener(v -> { rightButton.setOnClickListener(v -> {
if (mTableItem != null) { if (mTableItem.getLayoutType() == 0) {
//修改 //修改
mActivity.updateTable(createUpdateTableRequest(mTableItem.getId())); mActivity.updateTable(createUpdateTableRequest(mTableItem.getId()));
} else { } else {
...@@ -129,7 +141,7 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements ...@@ -129,7 +141,7 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements
} }
}); });
mTopBar.setBackgroundResource(R.color.theme_color); mTopBar.setBackgroundResource(R.color.theme_color);
if (mTableItem != null) { if (mTableItem.getLayoutType() == 0) {
mTopBar.setTitle("修改餐檯").setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color)); mTopBar.setTitle("修改餐檯").setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color));
} else { } else {
mTopBar.setTitle("添加餐檯").setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color)); mTopBar.setTitle("添加餐檯").setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color));
...@@ -140,103 +152,181 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements ...@@ -140,103 +152,181 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements
int height = QMUIResHelper.getAttrDimen(mContext, com.qmuiteam.qmui.R.attr.qmui_list_item_height); int height = QMUIResHelper.getAttrDimen(mContext, com.qmuiteam.qmui.R.attr.qmui_list_item_height);
areaItemView = mGroupListView.createItemView(null, /**
"區域", * 區域,餐檯名稱
getAreaName(), */
QMUICommonListItemView.HORIZONTAL, QMUICommonListItemView tableAreaItemView = mGroupListView.createItemView("區域");
QMUICommonListItemView.ACCESSORY_TYPE_CHEVRON, tableAreaItemView.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CUSTOM);
height); TextView textView = new TextView(mContext);
areaItemView.setTipPosition(QMUICommonListItemView.TIP_POSITION_RIGHT); textView.setText(getAreaName());
textView.setTextSize(16);
textView.setTextColor(ContextCompat.getColor(mContext, R.color.theme_grey_color));
tableAreaItemView.addAccessoryCustomView(textView);
QMUICommonListItemView tableNameItemView = mGroupListView.createItemView("餐檯名稱"); QMUICommonListItemView tableNameItemView = mGroupListView.createItemView("餐檯名稱");
tableNameItemView.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CUSTOM); tableNameItemView.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CUSTOM);
tableNameEditText = new EditText(mContext); tableNameEditText = new EditText(mContext);
tableNameEditText.setHint("必填"); tableNameEditText.setHint("必填");
if (mTableItem != null) { if (mTableItem.getLayoutType() == 0) {
tableNameEditText.setText(mTableItem.getTableName()); tableNameEditText.setText(mTableItem.getTableName());
} }
tableNameEditText.setWidth(QMUIDisplayHelper.dp2px(mActivity, 75)); // tableNameEditText.setWidth(QMUIDisplayHelper.dp2px(mActivity, 75));
tableNameEditText.setTextSize(16); tableNameEditText.setTextSize(16);
tableNameEditText.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans)); tableNameEditText.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans));
tableNameItemView.addAccessoryCustomView(tableNameEditText); tableNameItemView.addAccessoryCustomView(tableNameEditText);
int size = QMUIDisplayHelper.dp2px(mContext, 20);
QMUIGroupListView.newSection(mContext)
.setLeftIconSize(size, ViewGroup.LayoutParams.WRAP_CONTENT)
.addItemView(tableAreaItemView, null)
.addItemView(tableNameItemView, null)
.setMiddleSeparatorInset(QMUIDisplayHelper.dp2px(mContext, 16), 0)
.addTo(mGroupListView);
/**
* 就餐人數範圍,默認人數
*/
QMUICommonListItemView peopleNumberItemView = mGroupListView.createItemView("就餐人數"); QMUICommonListItemView peopleNumberItemView = mGroupListView.createItemView("就餐人數");
peopleNumberItemView.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CUSTOM); peopleNumberItemView.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CUSTOM);
peopleNumberEditText = new EditText(mContext);
peopleNumberEditText.setHint("必填"); peopleMixNumberEditText = new EditText(mContext);
if (mTableItem != null) { peopleMixNumberEditText.setHint("最少人數");
peopleNumberEditText.setText(mTableItem.getSeatCount() + ""); if (mTableItem.getLayoutType() == 0) {
peopleMixNumberEditText.setText(mTableItem.getMinSeatCount() + "");
}
peopleMixNumberEditText.setGravity(Gravity.CENTER);
peopleMixNumberEditText.setTextSize(13);
peopleMixNumberEditText.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans));
peopleMixNumberEditText.setInputType(EditorInfo.TYPE_CLASS_NUMBER);
peopleMixNumberEditText.setBackground(ArmsUtils.getDrawablebyResource(mContext, R.drawable.shape_delivery_item_btn_normal));
TextView tv_line = new TextView(mContext);
tv_line.setGravity(Gravity.CENTER);
tv_line.setText("一");
tv_line.setTextSize(14);
tv_line.setTextColor(ContextCompat.getColor(mContext, R.color.theme_black));
peopleMaxNumberEditText = new EditText(mContext);
peopleMaxNumberEditText.setHint("最多人數");
if (mTableItem.getLayoutType() == 0) {
peopleMaxNumberEditText.setText(mTableItem.getMaxSeatCount() + "");
} }
peopleNumberEditText.setWidth(QMUIDisplayHelper.dp2px(mActivity, 75)); peopleMaxNumberEditText.setGravity(Gravity.CENTER);
peopleNumberEditText.setTextSize(16); peopleMaxNumberEditText.setTextSize(13);
peopleNumberEditText.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans)); peopleMaxNumberEditText.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans));
peopleNumberEditText.setInputType(EditorInfo.TYPE_CLASS_NUMBER); peopleMaxNumberEditText.setInputType(EditorInfo.TYPE_CLASS_NUMBER);
peopleNumberItemView.addAccessoryCustomView(peopleNumberEditText); peopleMaxNumberEditText.setBackground(ArmsUtils.getDrawablebyResource(mContext, R.drawable.shape_delivery_item_btn_normal));
peopleNumberItemView.addAccessoryCustomView(peopleMixNumberEditText);
peopleNumberItemView.addAccessoryCustomView(tv_line);
peopleNumberItemView.addAccessoryCustomView(peopleMaxNumberEditText);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.MATCH_PARENT);
params.gravity = Gravity.CENTER | Gravity.RIGHT;
params.width = 130;
peopleMixNumberEditText.setLayoutParams(params);
FrameLayout.LayoutParams params2 = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.MATCH_PARENT);
params2.gravity = Gravity.CENTER | Gravity.RIGHT;
params2.width = 30;
params2.rightMargin = 150;
tv_line.setLayoutParams(params2);
FrameLayout.LayoutParams params3 = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.MATCH_PARENT);
params3.gravity = Gravity.CENTER | Gravity.RIGHT;
params3.width = 130;
params3.rightMargin = 200;
peopleMaxNumberEditText.setLayoutParams(params3);
QMUICommonListItemView defalutPeopleNumberItemView = mGroupListView.createItemView("默認人數");
defalutPeopleNumberItemView.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CUSTOM);
defalutPeopleNumberEditText = new EditText(mContext);
defalutPeopleNumberEditText.setHint("0");
if (mTableItem.getLayoutType() == 0) {
defalutPeopleNumberEditText.setText(mTableItem.getSeatCount() + "");
}
defalutPeopleNumberEditText.setTextSize(16);
defalutPeopleNumberEditText.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans));
defalutPeopleNumberEditText.setInputType(EditorInfo.TYPE_CLASS_NUMBER);
defalutPeopleNumberItemView.addAccessoryCustomView(defalutPeopleNumberEditText);
TextView tv_people = new TextView(mContext);
tv_people.setGravity(Gravity.CENTER);
tv_people.setText("人");
tv_people.setTextSize(14);
tv_people.setTextColor(ContextCompat.getColor(mContext, R.color.theme_black));
defalutPeopleNumberItemView.addAccessoryCustomView(tv_people);
FrameLayout.LayoutParams params5 = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.MATCH_PARENT);
params5.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
tv_people.setLayoutParams(params5);
FrameLayout.LayoutParams params6 = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.MATCH_PARENT);
params6.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
params6.rightMargin = 60;
defalutPeopleNumberEditText.setLayoutParams(params6);
QMUIGroupListView.newSection(getContext())
.setLeftIconSize(size, ViewGroup.LayoutParams.WRAP_CONTENT)
.addItemView(peopleNumberItemView, null)
.addItemView(defalutPeopleNumberItemView, null)
.setMiddleSeparatorInset(QMUIDisplayHelper.dp2px(getContext(), 16), 0)
.addTo(mGroupListView);
/**
* 餐桌類型
*/
tableTypeItemView = mGroupListView.createItemView(null,
"餐桌類型",
getTableType(),
QMUICommonListItemView.HORIZONTAL,
QMUICommonListItemView.ACCESSORY_TYPE_CHEVRON,
height);
tableTypeItemView.setTipPosition(QMUICommonListItemView.TIP_POSITION_RIGHT);
QMUIGroupListView.newSection(getContext())
.setLeftIconSize(size, ViewGroup.LayoutParams.WRAP_CONTENT)
.addItemView(tableTypeItemView, new View.OnClickListener() {
@Override
public void onClick(View v) {
showTableTypeBottomSheetList(true, true, false, "餐檯類型",
tableTypes, true, false);
}
})
.setMiddleSeparatorInset(QMUIDisplayHelper.dp2px(getContext(), 16), 0)
.addTo(mGroupListView);
/**
* 服務費
*/
QMUICommonListItemView serverchargeItemView = mGroupListView.createItemView("服務費%"); QMUICommonListItemView serverchargeItemView = mGroupListView.createItemView("服務費%");
serverchargeItemView.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CUSTOM); serverchargeItemView.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CUSTOM);
serverchargeEditText = new EditText(mContext); serverchargeEditText = new EditText(mContext);
serverchargeEditText.setHint("0"); serverchargeEditText.setHint("请输入服务费");
if (mTableItem != null) { if (mTableItem.getLayoutType() == 0 && mTableItem.getServiceCharge() != 0) {
serverchargeEditText.setText(mTableItem.getServiceCharge() + ""); serverchargeEditText.setText(mTableItem.getServiceCharge() + "");
} }
serverchargeEditText.setWidth(QMUIDisplayHelper.dp2px(mActivity, 75));
serverchargeEditText.setTextSize(16); serverchargeEditText.setTextSize(16);
serverchargeEditText.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans)); serverchargeEditText.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans));
serverchargeEditText.setInputType(EditorInfo.TYPE_CLASS_NUMBER); serverchargeEditText.setInputType(EditorInfo.TYPE_CLASS_NUMBER);
serverchargeItemView.addAccessoryCustomView(serverchargeEditText); serverchargeItemView.addAccessoryCustomView(serverchargeEditText);
QMUIGroupListView.newSection(getContext())
QMUICommonListItemView tableSortItemView = mGroupListView.createItemView("餐桌排序");
tableSortItemView.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CUSTOM);
tableSortEditText = new EditText(mContext);
// tableSortEditText.setHint("100");
if (mTableItem != null) {
tableSortEditText.setText(mTableItem.getSort() + "");
}else {
tableSortEditText.setText("100");
}
tableSortEditText.setWidth(QMUIDisplayHelper.dp2px(mActivity, 75));
tableSortEditText.setTextSize(16);
tableSortEditText.setBackgroundColor(ContextCompat.getColor(mContext, R.color.trans));
tableSortEditText.setInputType(EditorInfo.TYPE_CLASS_NUMBER);
tableSortItemView.addAccessoryCustomView(tableSortEditText);
tableSortItemView.showNewTip(true);
tableSortItemView.setNewTipImage(R.drawable.question_prompt);
tableSortItemView.setNewTipClick(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSortTip(v);
}
});
int size = QMUIDisplayHelper.dp2px(mContext, 20);
QMUIGroupListView.newSection(mContext)
.setLeftIconSize(size, ViewGroup.LayoutParams.WRAP_CONTENT) .setLeftIconSize(size, ViewGroup.LayoutParams.WRAP_CONTENT)
.addItemView(areaItemView, new View.OnClickListener() {
@Override
public void onClick(View v) {
showAreaBottomSheetList(true, true, false, "所在區域",
mActivity.getTableAreaList(), true, false);
}
})
.addItemView(tableNameItemView, null)
.addItemView(peopleNumberItemView, null)
.addItemView(serverchargeItemView, null) .addItemView(serverchargeItemView, null)
.addItemView(tableSortItemView, null) .setMiddleSeparatorInset(QMUIDisplayHelper.dp2px(getContext(), 16), 0)
.setMiddleSeparatorInset(QMUIDisplayHelper.dp2px(mContext, 16), 0)
.addTo(mGroupListView); .addTo(mGroupListView);
} }
private void showAreaBottomSheetList(boolean gravityCenter, private void showTableTypeBottomSheetList(boolean gravityCenter,
boolean addCancelBtn, boolean addCancelBtn,
boolean withIcon, boolean withIcon,
CharSequence title, CharSequence title,
List<TableArea> areaList, String[] tableTypeList,
boolean allowDragDismiss, boolean allowDragDismiss,
boolean withMark) { boolean withMark) {
QMUIBottomSheet.BottomListSheetBuilder builder = new QMUIBottomSheet.BottomListSheetBuilder(getActivity()); QMUIBottomSheet.BottomListSheetBuilder builder = new QMUIBottomSheet.BottomListSheetBuilder(getActivity());
builder.setGravityCenter(gravityCenter) builder.setGravityCenter(gravityCenter)
.setTitle(title) .setTitle(title)
...@@ -246,63 +336,33 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements ...@@ -246,63 +336,33 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements
.setOnSheetItemClickListener(new QMUIBottomSheet.BottomListSheetBuilder.OnSheetItemClickListener() { .setOnSheetItemClickListener(new QMUIBottomSheet.BottomListSheetBuilder.OnSheetItemClickListener() {
@Override @Override
public void onClick(QMUIBottomSheet dialog, View itemView, int position, String tag) { public void onClick(QMUIBottomSheet dialog, View itemView, int position, String tag) {
currentAreaId = areaList.get(position).getId(); tableType = position;
areaItemView.setDetailText(tag); tableTypeItemView.setDetailText(tableTypeList[position]);
dialog.dismiss(); dialog.dismiss();
} }
}); });
if (withMark) { if (withMark) {
builder.setCheckedIndex(40); builder.setCheckedIndex(40);
} }
for (TableArea item : areaList) { for (String item : tableTypeList) {
builder.addItem(item.getRegionName()); builder.addItem(item);
} }
builder.build().show(); builder.build().show();
} }
private void showSortTip(View v) { private String getAreaName() {
TextView textView = new TextView(mContext); String areaName = mTableItem.getRegionName();
textView.setLineSpacing(QMUIDisplayHelper.dp2px(mContext, 4), 1.0f); currentAreaId = mTableItem.getRegionId();
int padding = QMUIDisplayHelper.dp2px(mContext, 20); return areaName;
textView.setPadding(padding, padding, padding, padding);
textView.setText("默認值為100,數字越小排序\n" + "越靠前!");
int color = QMUIResHelper.getAttrColor(mContext, R.attr.app_skin_common_title_text_color);
textView.setTextColor(ArmsUtils.getColor(mContext, R.color.theme_black));
// QMUISkinValueBuilder builder = QMUISkinValueBuilder.acquire();
// builder.textColor(R.attr.app_skin_common_title_text_color);
// QMUISkinHelper.setSkinValue(textView, builder);
// builder.release();
mNormalPopup = QMUIPopups.popup(mContext, QMUIDisplayHelper.dp2px(mContext, 250))
.preferredDirection(QMUIPopup.DIRECTION_BOTTOM)
.view(textView)
.edgeProtection(QMUIDisplayHelper.dp2px(mContext, 20))
.dimAmount(0.6f)
.animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER)
.onDismiss(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
}
})
.show(v);
} }
private String getAreaName() { private String getTableType() {
String areaName = ""; String tableType = "";
if (mTableItem != null) { if (mTableItem != null && mTableItem.getType() != -1) {
//修改操作 //修改操作
areaName = mTableItem.getRegionName(); tableType = tableTypes[mTableItem.getType()];
currentAreaId = mTableItem.getRegionId();
} else {
//添加操作
if (mActivity.getTableAreaList().size() > 0) {
areaName = mActivity.getTableAreaList().get(0).getRegionName();
currentAreaId = mActivity.getTableAreaList().get(0).getId();
} else {
areaName = "其他";
}
} }
return areaName; return tableType;
} }
@Override @Override
...@@ -348,16 +408,20 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements ...@@ -348,16 +408,20 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements
if (!TextUtils.isEmpty(serverchargeEditText.getText().toString())) { if (!TextUtils.isEmpty(serverchargeEditText.getText().toString())) {
addTableRequest.setServiceCharge(Double.parseDouble(serverchargeEditText.getText().toString())); addTableRequest.setServiceCharge(Double.parseDouble(serverchargeEditText.getText().toString()));
} }
if (!TextUtils.isEmpty(peopleNumberEditText.getText().toString())) { if (!TextUtils.isEmpty(defalutPeopleNumberEditText.getText().toString())) {
addTableRequest.setSeatCount(Integer.parseInt(peopleNumberEditText.getText().toString())); addTableRequest.setSeatCount(Integer.parseInt(defalutPeopleNumberEditText.getText().toString()));
} }
if (!TextUtils.isEmpty(tableSortEditText.getText().toString())) { if (!TextUtils.isEmpty(peopleMaxNumberEditText.getText().toString())) {
addTableRequest.setSort(Integer.parseInt(tableSortEditText.getText().toString())); addTableRequest.setMaxSeatCount(Integer.parseInt(peopleMaxNumberEditText.getText().toString()));
} }
if (!TextUtils.isEmpty(peopleMixNumberEditText.getText().toString())) {
addTableRequest.setMinSeatCount(Integer.parseInt(peopleMixNumberEditText.getText().toString()));
}
addTableRequest.setType(tableType);
return addTableRequest; return addTableRequest;
} }
public TableRequest.Update createUpdateTableRequest(int id) { public TableRequest.Update createUpdateTableRequest(long id) {
TableRequest.Update update = new TableRequest.Update(); TableRequest.Update update = new TableRequest.Update();
update.setId(id); update.setId(id);
update.setRegionId(currentAreaId); update.setRegionId(currentAreaId);
...@@ -366,11 +430,8 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements ...@@ -366,11 +430,8 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements
if (!TextUtils.isEmpty(serverchargeEditText.getText().toString())) { if (!TextUtils.isEmpty(serverchargeEditText.getText().toString())) {
update.setServiceCharge(Double.parseDouble(serverchargeEditText.getText().toString())); update.setServiceCharge(Double.parseDouble(serverchargeEditText.getText().toString()));
} }
if (!TextUtils.isEmpty(peopleNumberEditText.getText().toString())) { if (!TextUtils.isEmpty(defalutPeopleNumberEditText.getText().toString())) {
update.setSeatCount(Integer.parseInt(peopleNumberEditText.getText().toString())); update.setSeatCount(Integer.parseInt(defalutPeopleNumberEditText.getText().toString()));
}
if (!TextUtils.isEmpty(tableSortEditText.getText().toString())) {
update.setSort(Integer.parseInt(tableSortEditText.getText().toString()));
} }
return update; return update;
} }
...@@ -380,10 +441,15 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements ...@@ -380,10 +441,15 @@ public class AddTableFragment extends BaseFragment<AddTablePresenter> implements
showMessage("請輸入餐檯名稱"); showMessage("請輸入餐檯名稱");
return false; return false;
} }
if (TextUtils.isEmpty(peopleNumberEditText.getText().toString())) { // if (TextUtils.isEmpty(defalutPeopleNumberEditText.getText().toString())) {
showMessage("請輸入就餐人數"); // showMessage("請輸入就餐人數");
// return false;
// }
if (tableType == -1) {
showMessage("請選擇餐桌類型");
return false; return false;
} }
return true; return true;
} }
} }
...@@ -5,14 +5,22 @@ import android.graphics.Color; ...@@ -5,14 +5,22 @@ import android.graphics.Color;
import android.net.ParseException; import android.net.ParseException;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
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.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils; import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.constans.PrintConstans; import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.manager.R2; import com.gingersoft.gsa.cloud.manager.R2;
...@@ -22,6 +30,8 @@ import com.gingersoft.gsa.cloud.manager.mvp.model.bean.request.AreaRequest; ...@@ -22,6 +30,8 @@ import com.gingersoft.gsa.cloud.manager.mvp.model.bean.request.AreaRequest;
import com.gingersoft.gsa.cloud.manager.mvp.ui.activity.TableManageActivity; import com.gingersoft.gsa.cloud.manager.mvp.ui.activity.TableManageActivity;
import com.gingersoft.gsa.cloud.manager.mvp.ui.adapter.AreaManageAdapter; import com.gingersoft.gsa.cloud.manager.mvp.ui.adapter.AreaManageAdapter;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration; import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration;
import com.gingersoft.gsa.cloud.ui.recylcler.event.OnRecyclerItemClickListener;
import com.gingersoft.gsa.cloud.ui.recylcler.event.RecyItemTouchHelperCallback;
import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.google.gson.JsonIOException; import com.google.gson.JsonIOException;
...@@ -40,6 +50,7 @@ import com.qmuiteam.qmui.alpha.QMUIAlphaFrameLayout; ...@@ -40,6 +50,7 @@ import com.qmuiteam.qmui.alpha.QMUIAlphaFrameLayout;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView; import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.widget.QMUIEmptyView; import com.qmuiteam.qmui.widget.QMUIEmptyView;
import com.qmuiteam.qmui.widget.QMUITopBarLayout; import com.qmuiteam.qmui.widget.QMUITopBarLayout;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener; import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener; import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
...@@ -63,6 +74,7 @@ import androidx.annotation.NonNull; ...@@ -63,6 +74,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView; import butterknife.BindView;
...@@ -97,14 +109,22 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements ...@@ -97,14 +109,22 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements
@BindView(R2.id.fl_add_area) @BindView(R2.id.fl_add_area)
QMUIAlphaFrameLayout fl_add_area; QMUIAlphaFrameLayout fl_add_area;
@BindView(R2.id.ll_add_area_layout)
LinearLayout ll_add_area_layout;
@BindView(R2.id.ll_bottom_operat) @BindView(R2.id.ll_bottom_operat)
LinearLayout ll_bottom_operat; LinearLayout ll_bottom_operat;
@BindView(R2.id.ed_area_name)
EditText ed_area_name;
@BindView(R2.id.cb_all_select)
CheckBox cb_all_select;
private TableManageActivity mActivity; private TableManageActivity mActivity;
private AreaManageAdapter mAreaManageAdapter; private AreaManageAdapter mAreaManageAdapter;
private List<TableArea> mTableAreaList = new ArrayList<>(); private List<TableArea> mTableAreaList = new ArrayList<>();
private boolean isSave = false;
private boolean isRadioEdit; private boolean isRadioEdit;
public static AreaListFragment newInstance() { public static AreaListFragment newInstance() {
...@@ -135,6 +155,16 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements ...@@ -135,6 +155,16 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements
initAdapter(); initAdapter();
initRefreshLayout(); initRefreshLayout();
mActivity.queryAreas(null); mActivity.queryAreas(null);
cb_all_select.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
for (int i = 0; i < mTableAreaList.size(); i++) {
mTableAreaList.get(i).setChecked(isChecked);
}
mAreaManageAdapter.notifyDataSetChanged();
}
});
} }
@Override @Override
...@@ -176,6 +206,26 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements ...@@ -176,6 +206,26 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements
} }
}); });
RecyItemTouchHelperCallback itemTouchHelperCallback = new RecyItemTouchHelperCallback(mAreaManageAdapter);
final ItemTouchHelper itemTouchHelper = new ItemTouchHelper(itemTouchHelperCallback);
itemTouchHelper.attachToRecyclerView(recycler_area);
recycler_area.addOnItemTouchListener(new OnRecyclerItemClickListener(recycler_area) {
@Override
public void onItemClick(RecyclerView.ViewHolder viewHolder) {
}
@Override
public void onLongClick(RecyclerView.ViewHolder viewHolder) {
AreaManageAdapter.TopTableAreaItemHolder viewHolder1 = (AreaManageAdapter.TopTableAreaItemHolder) viewHolder;
Toast.makeText(mActivity, "長按:" + viewHolder1.getAdapterPosition(), Toast.LENGTH_SHORT).show();
if (viewHolder.getLayoutPosition() != 0) {
itemTouchHelper.startDrag(viewHolder);
}
}
});
} }
private void initAdapter() { private void initAdapter() {
...@@ -185,13 +235,20 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements ...@@ -185,13 +235,20 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements
mAreaManageAdapter.setOnItemClickListener(new DefaultAdapter.OnRecyclerViewItemClickListener() { mAreaManageAdapter.setOnItemClickListener(new DefaultAdapter.OnRecyclerViewItemClickListener() {
@Override @Override
public void onItemClick(View view, int viewType, Object data, int position) { public void onItemClick(View view, int viewType, Object data, int position) {
if (isRadioEdit) { // if (isRadioEdit) {
TableArea tableArea = (TableArea) data; // TableArea tableArea = (TableArea) data;
tableArea.setChecked(!tableArea.isChecked()); // tableArea.setChecked(!tableArea.isChecked());
mAreaManageAdapter.notifyDataSetChanged(); // mAreaManageAdapter.notifyDataSetChanged();
} else { // } else {
start(AddAreaFragment.newInstance((TableArea) data)); // start(AddAreaFragment.newInstance((TableArea) data));
} // }
}
});
mAreaManageAdapter.addTextChangedListener(new AreaManageAdapter.OnTextChangedListener() {
@Override
public void afterTextChanged(TableArea datasBean, String name) {
mActivity.updateArea(createUpateAreaRequest(datasBean.getId(), name));
} }
}); });
} }
...@@ -207,11 +264,15 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements ...@@ -207,11 +264,15 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements
recycler_area.setVisibility(View.VISIBLE); recycler_area.setVisibility(View.VISIBLE);
} }
public void addSuccess(){
ed_area_name.setText("");
}
@Override @Override
public void setData(@Nullable Object data) { public void setData(@Nullable Object data) {
} }
private void initCheckedStatus(){ private void initCheckedStatus() {
for (int i = 0; i < mTableAreaList.size(); i++) { for (int i = 0; i < mTableAreaList.size(); i++) {
mTableAreaList.get(i).setChecked(false); mTableAreaList.get(i).setChecked(false);
} }
...@@ -220,26 +281,37 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements ...@@ -220,26 +281,37 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements
@OnClick(R2.id.fl_add_area) @OnClick(R2.id.fl_add_area)
void onClickAddArea() { void onClickAddArea() {
startForResult(AddAreaFragment.newInstance(null), ADD_AREA_RESULT_SUCCESS); if(ll_add_area_layout.getVisibility() == View.GONE){
} ll_add_area_layout.setVisibility(View.VISIBLE);
}else {
@OnClick(R2.id.btn_all_select) ll_add_area_layout.setVisibility(View.GONE);
void onClickAddSelect() {
for (int i = 0; i < mTableAreaList.size(); i++) {
mTableAreaList.get(i).setChecked(true);
} }
mAreaManageAdapter.notifyDataSetChanged();
} }
@OnClick(R2.id.btn_anti_select) @OnClick(R2.id.btn_save_area)
void onClickAntiSelect() { void onClickSaveArea() {
for (int i = 0; i < mTableAreaList.size(); i++) { if (addCondition()) {
TableArea tableArea = mTableAreaList.get(i); mActivity.addArea(createAddAreaRequest());
tableArea.setChecked(!tableArea.isChecked());
} }
mAreaManageAdapter.notifyDataSetChanged();
} }
// @OnClick(R2.id.cb_all_select)
// void onClickAddSelect() {
// for (int i = 0; i < mTableAreaList.size(); i++) {
// mTableAreaList.get(i).setChecked(true);
// }
// mAreaManageAdapter.notifyDataSetChanged();
// }
// @OnClick(R2.id.btn_anti_select)
// void onClickAntiSelect() {
// for (int i = 0; i < mTableAreaList.size(); i++) {
// TableArea tableArea = mTableAreaList.get(i);
// tableArea.setChecked(!tableArea.isChecked());
// }
// mAreaManageAdapter.notifyDataSetChanged();
// }
@OnClick(R2.id.btn_sure) @OnClick(R2.id.btn_sure)
void onClickSure() { void onClickSure() {
String ids = getDeleteIds(); String ids = getDeleteIds();
...@@ -344,6 +416,30 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements ...@@ -344,6 +416,30 @@ public class AreaListFragment extends BaseFragment<AreaListPresenter> implements
recycler_area.setAdapter(adapter); recycler_area.setAdapter(adapter);
} }
public boolean addCondition() {
if (TextUtils.isEmpty(ed_area_name.getText().toString())) {
showMessage("請輸入區域名稱");
return false;
}
return true;
}
public AreaRequest.Add createAddAreaRequest() {
int restaurantId = GsaCloudApplication.getRestaurantId(mContext);
AreaRequest.Add areaRequest = new AreaRequest.Add();
areaRequest.setRestaurantId(restaurantId);
areaRequest.setRegionName(ed_area_name.getText().toString());
// areaRequest.setSort(Integer.parseInt(ed_area_sort.getText().toString()));
return areaRequest;
}
public AreaRequest.Update createUpateAreaRequest(int id, String name) {
AreaRequest.Update areaRequest = new AreaRequest.Update();
areaRequest.setId(id);
areaRequest.setRegionName(name);
// areaRequest.setSort(Integer.parseInt(ed_area_sort.getText().toString()));
return areaRequest;
}
private void showRadioEdit() { private void showRadioEdit() {
if (isRadioEdit) { if (isRadioEdit) {
......
package com.gingersoft.gsa.cloud.manager.mvp.ui.fragment; package com.gingersoft.gsa.cloud.manager.mvp.ui.fragment;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.Rect; import android.graphics.Rect;
import android.net.ParseException; import android.net.ParseException;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.text.InputType;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.gingersoft.gsa.cloud.base.common.bean.OrderDetail;
import com.gingersoft.gsa.cloud.base.common.bean.TableBean;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.manager.R2; import com.gingersoft.gsa.cloud.manager.R2;
import com.gingersoft.gsa.cloud.manager.di.component.DaggerTableListComponent; import com.gingersoft.gsa.cloud.manager.di.component.DaggerTableListComponent;
import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableArea; import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableArea;
import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableItem; import com.gingersoft.gsa.cloud.manager.mvp.model.bean.TableItem;
import com.gingersoft.gsa.cloud.manager.mvp.model.bean.request.TableRequest;
import com.gingersoft.gsa.cloud.manager.mvp.ui.activity.TableManageActivity; import com.gingersoft.gsa.cloud.manager.mvp.ui.activity.TableManageActivity;
import com.gingersoft.gsa.cloud.manager.mvp.ui.adapter.AreaManageAdapter;
import com.gingersoft.gsa.cloud.manager.mvp.ui.adapter.TableManageSectiontAdapter; import com.gingersoft.gsa.cloud.manager.mvp.ui.adapter.TableManageSectiontAdapter;
import com.gingersoft.gsa.cloud.ui.adapter.BasTextSectiontAdapter;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader; import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader;
import com.gingersoft.gsa.cloud.ui.recylcler.event.OnRecyclerItemClickListener; import com.gingersoft.gsa.cloud.ui.recylcler.event.OnRecyclerItemClickListener;
import com.gingersoft.gsa.cloud.ui.recylcler.event.RecyItemTouchHelperCallback; import com.gingersoft.gsa.cloud.ui.recylcler.event.RecyItemTouchHelperCallback;
import com.gingersoft.gsa.cloud.ui.utils.AnimateUtils;
import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.google.gson.JsonIOException; import com.google.gson.JsonIOException;
...@@ -43,10 +39,11 @@ import com.gingersoft.gsa.cloud.manager.mvp.presenter.TableListPresenter; ...@@ -43,10 +39,11 @@ import com.gingersoft.gsa.cloud.manager.mvp.presenter.TableListPresenter;
import com.gingersoft.gsa.cloud.manager.R; import com.gingersoft.gsa.cloud.manager.R;
import com.qmuiteam.qmui.alpha.QMUIAlphaFrameLayout; import com.qmuiteam.qmui.alpha.QMUIAlphaFrameLayout;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.QMUIEmptyView; import com.qmuiteam.qmui.widget.QMUIEmptyView;
import com.qmuiteam.qmui.widget.QMUITopBarLayout; import com.qmuiteam.qmui.widget.QMUITopBarLayout;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import com.qmuiteam.qmui.widget.section.QMUISection; import com.qmuiteam.qmui.widget.section.QMUISection;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter; import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout; import com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout;
...@@ -60,7 +57,6 @@ import java.net.SocketTimeoutException; ...@@ -60,7 +57,6 @@ import java.net.SocketTimeoutException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
...@@ -72,9 +68,10 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -72,9 +68,10 @@ import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import static com.gingersoft.gsa.cloud.base.common.bean.OrderDetail.DISCOUNT_TYPE; import static android.widget.AbsListView.OnScrollListener.SCROLL_STATE_IDLE;
import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_DRAGGING;
import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_SETTLING;
import static com.gingersoft.gsa.cloud.manager.mvp.ui.activity.TableManageActivity.ADD_AREA_RESULT_SUCCESS; import static com.gingersoft.gsa.cloud.manager.mvp.ui.activity.TableManageActivity.ADD_AREA_RESULT_SUCCESS;
import static com.gingersoft.gsa.cloud.manager.mvp.ui.activity.TableManageActivity.ADD_TABLE_RESULT_SUCCESS;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -103,11 +100,13 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -103,11 +100,13 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
@BindView(R2.id.fl_add_table) @BindView(R2.id.fl_add_table)
QMUIAlphaFrameLayout fl_add_table; QMUIAlphaFrameLayout fl_add_table;
@BindView(R2.id.tv_area)
QMUIAlphaTextView tv_area;
@BindView(R2.id.ll_bottom_operat) @BindView(R2.id.ll_bottom_operat)
LinearLayout ll_bottom_operat; LinearLayout ll_bottom_operat;
@BindView(R2.id.cb_all_select)
CheckBox cb_all_select;
private Button rightButton;
private TableManageActivity mActivity; private TableManageActivity mActivity;
...@@ -117,6 +116,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -117,6 +116,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
private TableManageSectiontAdapter mAdapter; private TableManageSectiontAdapter mAdapter;
private List<QMUISection<SectionHeader, TableItem>> mTableAreaSectionList = new ArrayList<>(); private List<QMUISection<SectionHeader, TableItem>> mTableAreaSectionList = new ArrayList<>();
private boolean initLoad = false;
/** /**
* 是否編輯 * 是否編輯
*/ */
...@@ -161,14 +161,42 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -161,14 +161,42 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
initTopbar(); initTopbar();
initRefreshLayout(); initRefreshLayout();
initStickyLayout(); initStickyLayout();
// initRecycleScrollListener();
mActivity.queryAreas(null); mActivity.queryAreas(null);
mActivity.queryTables(null); mActivity.queryTables(null);
// mActivity.initGetTableTimer();
cb_all_select.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
for (int i = 0; i < mTableList.size(); i++) {
TableItem tableItem = mTableList.get(i);
if (tableItem.getStatus() == 0) {
mTableList.get(i).setChecked(isChecked);
}
}
mAdapter.notifyDataSetChanged();
}
});
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
hideSoftInput(); hideSoftInput();
//開始刷新餐檯數據
// mActivity.onStartRefreshTableData();
}
@Override
public void onPause() {
super.onPause();
//停止刷新餐檯數據
// mActivity.onPauseRefreshTableData();
}
@Override
public void setData(@Nullable Object data) {
} }
private void initTopbar() { private void initTopbar() {
...@@ -176,20 +204,28 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -176,20 +204,28 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
mTopBar.addLeftBackImageButton().setOnClickListener(v -> killMyself()); mTopBar.addLeftBackImageButton().setOnClickListener(v -> killMyself());
mTopBar.setTitle("餐檯管理").setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color)); mTopBar.setTitle("餐檯管理").setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color));
Button rightButton = mTopBar.addRightTextButton("編輯", R.id.qmui_dialog_edit_right_icon); rightButton = mTopBar.addRightTextButton("編輯", R.id.qmui_dialog_edit_right_icon);
rightButton.setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color)); rightButton.setTextColor(ContextCompat.getColor(mContext, R.color.theme_white_color));
rightButton.setOnClickListener(v -> { rightButton.setOnClickListener(v -> {
isRadioEdit = !isRadioEdit; clickEdit(rightButton);
if (isRadioEdit) { });
initCheckedStatus(); }
private void clickEdit(Button rightButton) {
isRadioEdit = !isRadioEdit;
if (isRadioEdit) {
initCheckedStatus();
if (rightButton != null) {
rightButton.setText("取消"); rightButton.setText("取消");
} else { }
} else {
if (rightButton != null) {
rightButton.setText("編輯"); rightButton.setText("編輯");
} }
showRadioEdit(); }
mAdapter.setRadioEdit(isRadioEdit); showRadioEdit();
mAdapter.notifyDataSetChanged(); mAdapter.setRadioEdit(isRadioEdit);
}); mAdapter.notifyDataSetChanged();
} }
private void initRefreshLayout() { private void initRefreshLayout() {
...@@ -223,11 +259,15 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -223,11 +259,15 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
TableManageSectiontAdapter.ViewHolder viewHolder = (TableManageSectiontAdapter.ViewHolder) holder; TableManageSectiontAdapter.ViewHolder viewHolder = (TableManageSectiontAdapter.ViewHolder) holder;
if (viewHolder.getTvName().getText() != null) { if (viewHolder.getTvName().getText() != null) {
TableItem item = viewHolder.getTableItem(position); TableItem item = viewHolder.getTableItem(position);
if(isRadioEdit){ if (item.getLayoutType() == 1) {
item.setChecked(!item.isChecked());
mAdapter.notifyDataSetChanged();
}else {
start(AddTableFragment.newInstance(item)); start(AddTableFragment.newInstance(item));
} else {
if (isRadioEdit) {
item.setChecked(!item.isChecked());
mAdapter.notifyDataSetChanged();
} else {
start(AddTableFragment.newInstance(item));
}
} }
} }
} else { } else {
...@@ -247,7 +287,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -247,7 +287,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
int margin = QMUIDisplayHelper.dp2px(getContext(), 10); int margin = QMUIDisplayHelper.dp2px(getContext(), 10);
outRect.set(margin, margin, margin, margin); outRect.set(margin, margin, margin, margin);
} else { } else {
outRect.set(0, 0, 0, 0); outRect.set(5, 5, 5, 5);
} }
} }
}); });
...@@ -260,25 +300,31 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -260,25 +300,31 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
@Override @Override
public void onItemClick(RecyclerView.ViewHolder viewHolder) { public void onItemClick(RecyclerView.ViewHolder viewHolder) {
QMUIStickySectionAdapter.ViewHolder viewHolder1 = (QMUIStickySectionAdapter.ViewHolder) viewHolder;
Toast.makeText(mActivity, "點擊了:" + viewHolder1.getAdapterPosition(), Toast.LENGTH_SHORT).show();
} }
@Override @Override
public void onLongClick(RecyclerView.ViewHolder viewHolder) { public void onLongClick(RecyclerView.ViewHolder viewHolder) {
QMUIStickySectionAdapter.ViewHolder viewHolder1 = (QMUIStickySectionAdapter.ViewHolder) viewHolder; // QMUIStickySectionAdapter.ViewHolder viewHolder1 = (QMUIStickySectionAdapter.ViewHolder) viewHolder;
Toast.makeText(mActivity, "長按:" + viewHolder1.getAdapterPosition(), Toast.LENGTH_SHORT).show(); // Toast.makeText(mActivity, "長按:" + viewHolder1.getAdapterPosition(), Toast.LENGTH_SHORT).show();
if (viewHolder.getLayoutPosition() != 0) { if (viewHolder.getLayoutPosition() != 0) {
itemTouchHelper.startDrag(viewHolder); itemTouchHelper.startDrag(viewHolder);
} }
} }
}); });
itemTouchHelperCallback.setOnMoveListener(new RecyItemTouchHelperCallback.onMoveListener() {
@Override
public void onMoveFinish() {
mAdapter.notifyDataSetChanged();
mActivity.changeTableSort();
}
});
mSectionLayout.setAdapter(mAdapter, true); mSectionLayout.setAdapter(mAdapter, true);
} }
private RecyclerView.LayoutManager createLayoutManager() { private RecyclerView.LayoutManager createLayoutManager() {
final GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 3); final GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 4, LinearLayoutManager.VERTICAL, false);
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override @Override
public int getSpanSize(int i) { public int getSpanSize(int i) {
...@@ -295,7 +341,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -295,7 +341,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
mAreaList.addAll(tableAreaList); mAreaList.addAll(tableAreaList);
} }
public void updateTableData(List<TableItem> tableItemList) { public void updateTableData(List<TableArea> tableAreaList, List<TableItem> tableItemList) {
initParms(); initParms();
...@@ -306,13 +352,22 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -306,13 +352,22 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
item.setRegionId(-1); item.setRegionId(-1);
} }
} }
mTableAreaSectionList.addAll(mPresenter.tableAreaTransformToSection(mPresenter.assembleTableArea(mPresenter.assembleAreaList(mTableList), mTableList)));
mTableAreaSectionList.addAll(mPresenter.tableAreaTransformToSection(mPresenter.assembleTableArea(mPresenter.assembleAreaList(tableAreaList, mTableList), mTableList)));
// if (!initLoad) {
mAdapter.setData(mTableAreaSectionList); mAdapter.setData(mTableAreaSectionList);
// } else {
// mAdapter.notifyDataSetChanged();
// }
mEmptyView.hide(); mEmptyView.hide();
mSectionLayout.setVisibility(View.VISIBLE); mSectionLayout.setVisibility(View.VISIBLE);
initLoad = true;
} }
private void initParms() { private void initParms() {
if (mTableList.size() > 0) { if (mTableList.size() > 0) {
mTableList.clear(); mTableList.clear();
...@@ -325,12 +380,11 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -325,12 +380,11 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
} }
} }
@Override public void backEdit() {
public void setData(@Nullable Object data) { clickEdit(rightButton);
} }
private void initCheckedStatus(){ private void initCheckedStatus() {
for (int i = 0; i < mTableAreaSectionList.size(); i++) { for (int i = 0; i < mTableAreaSectionList.size(); i++) {
for (int j = 0; j < mTableAreaSectionList.get(i).getItemCount(); j++) { for (int j = 0; j < mTableAreaSectionList.get(i).getItemCount(); j++) {
mTableAreaSectionList.get(i).getItemAt(j).setChecked(false); mTableAreaSectionList.get(i).getItemAt(j).setChecked(false);
...@@ -339,40 +393,25 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -339,40 +393,25 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
mAdapter.setData(mTableAreaSectionList); mAdapter.setData(mTableAreaSectionList);
} }
@OnClick(R2.id.tv_area)
void onClickToArea() {
startForResult(AreaListFragment.newInstance(), ADD_AREA_RESULT_SUCCESS);
}
@OnClick(R2.id.fl_add_table) @OnClick(R2.id.fl_add_table)
void onClickAddTable() { void onClickAddTable() {
startForResult(AddTableFragment.newInstance(null), ADD_TABLE_RESULT_SUCCESS); startForResult(AreaListFragment.newInstance(), ADD_AREA_RESULT_SUCCESS);
}
@OnClick(R2.id.btn_all_select)
void onClickAddSelect() {
for (int i = 0; i < mTableAreaSectionList.size(); i++) {
for (int j = 0; j < mTableAreaSectionList.get(i).getItemCount(); j++) {
mTableAreaSectionList.get(i).getItemAt(j).setChecked(true);
}
}
mAdapter.setData(mTableAreaSectionList);
} }
@OnClick(R2.id.btn_anti_select) @OnClick(R2.id.btn_modify_serviceCharge)
void onClickAntiSelect() { void onClickModifyServiceCharge() {
for (int i = 0; i < mTableAreaSectionList.size(); i++) { String ids = getSelectedIds();
for (int j = 0; j < mTableAreaSectionList.get(i).getItemCount(); j++) { if (TextUtils.isEmpty(ids)) {
TableItem tableItem = mTableAreaSectionList.get(i).getItemAt(j); showMessage("請選擇餐檯");
tableItem.setChecked(!tableItem.isChecked()); return;
}
} }
mAdapter.setData(mTableAreaSectionList); showEditTextDialog(mActivity, "批量修改服務費", "請輸入服務費");
} }
@OnClick(R2.id.btn_sure) @OnClick(R2.id.btn_delete)
void onClickSure() { void onClickSure() {
String ids = getDeleteIds(); String ids = getSelectedIds();
if (TextUtils.isEmpty(ids)) { if (TextUtils.isEmpty(ids)) {
showMessage("請選擇餐檯"); showMessage("請選擇餐檯");
return; return;
...@@ -382,8 +421,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -382,8 +421,7 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
CommonTipDialog.showSurpisedDialog(mActivity, "是否刪除所選餐檯", TableManageActivity.class, mActivity, "deleteTable", parameterTypes, parameters); CommonTipDialog.showSurpisedDialog(mActivity, "是否刪除所選餐檯", TableManageActivity.class, mActivity, "deleteTable", parameterTypes, parameters);
} }
private String getSelectedIds() {
private String getDeleteIds() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
for (int i = 0; i < mTableAreaSectionList.size(); i++) { for (int i = 0; i < mTableAreaSectionList.size(); i++) {
for (int j = 0; j < mTableAreaSectionList.get(i).getItemCount(); j++) { for (int j = 0; j < mTableAreaSectionList.get(i).getItemCount(); j++) {
...@@ -401,6 +439,37 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -401,6 +439,37 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
return str; return str;
} }
private List<TableRequest.UpdateServiceCharge> getModifyServiceChargeList(double modifyServiceCharge) {
List<TableRequest.UpdateServiceCharge> updateServiceCharges = new ArrayList<>();
for (int i = 0; i < mTableList.size(); i++) {
TableItem tableItem = mTableList.get(i);
if (tableItem.isChecked()) {
TableRequest.UpdateServiceCharge updateServiceCharge = new TableRequest.UpdateServiceCharge();
updateServiceCharge.setId(tableItem.getId());
updateServiceCharge.setServiceCharge(modifyServiceCharge);
updateServiceCharges.add(updateServiceCharge);
}
}
return updateServiceCharges;
}
public void showEditTextDialog(Activity context, String title, String placeholder) {
final QMUIDialog.EditTextDialogBuilder dialogBuilder = new QMUIDialog.EditTextDialogBuilder(context);
dialogBuilder.setTitle(title);
dialogBuilder.setPlaceholder(placeholder);
dialogBuilder.setInputType(InputType.TYPE_CLASS_NUMBER);
dialogBuilder.addAction("取消", (dialog, index) -> dialog.dismiss());
dialogBuilder.addAction(0, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> {
dialog.dismiss();
CharSequence text = dialogBuilder.getEditText().getText();
if (text != null && text.length() > 0) {
mActivity.updateTableServiceCharge(getModifyServiceChargeList(Double.parseDouble(text.toString())));
} else {
showMessage("請輸入服務費比例");
}
});
dialogBuilder.create(R.style.MyDialogTheme2).show();
}
@Override @Override
public void showLoading(String message) { public void showLoading(String message) {
...@@ -474,15 +543,64 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen ...@@ -474,15 +543,64 @@ public class TableListFragment extends BaseFragment<TableListPresenter> implemen
mSectionLayout.setVisibility(View.VISIBLE); mSectionLayout.setVisibility(View.VISIBLE);
} }
private void initRecycleScrollListener() {
mSectionLayout.getRecyclerView().addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
switch (newState) {
case SCROLL_STATE_IDLE://停止滚动
if (mActivity != null) {
mActivity.onStartRefreshTableData();
}
break;
case SCROLL_STATE_DRAGGING://正在被外部拖拽,一般为用户正在用手指滚动
case SCROLL_STATE_SETTLING://自动滚动开始
if (mActivity != null) {
mActivity.onPauseRefreshTableData();
}
break;
}
}
});
mSectionLayout.getRecyclerView().setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE: //用户滑动 先停止刷新餐台数据
if (mActivity != null) {
mActivity.onPauseRefreshTableData();
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mActivity != null) {
mActivity.onStartRefreshTableData();
}
//用户手抬起是 继续刷新餐台数据
break;
}
return false;
}
});
}
private void showRadioEdit() { private void showRadioEdit() {
if (isRadioEdit) { if (isRadioEdit) {
fl_add_table.setVisibility(View.GONE); fl_add_table.setVisibility(View.GONE);
tv_area.setVisibility(View.GONE);
ll_bottom_operat.setVisibility(View.VISIBLE); ll_bottom_operat.setVisibility(View.VISIBLE);
} else { } else {
fl_add_table.setVisibility(View.VISIBLE); fl_add_table.setVisibility(View.VISIBLE);
tv_area.setVisibility(View.VISIBLE);
ll_bottom_operat.setVisibility(View.GONE); ll_bottom_operat.setVisibility(View.GONE);
} }
} }
@Override
public List<TableItem> getTableList() {
return mTableList;
}
} }
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
android:thicknessRatio="20" android:thicknessRatio="20"
android:useLevel="false"> android:useLevel="false">
<solid android:color="#FF3333" /> <solid android:color="#1196DB" />
</shape> </shape>
\ No newline at end of file
...@@ -5,57 +5,3 @@ ...@@ -5,57 +5,3 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
<!--<?xml version="1.0" encoding="utf-8"?>-->
<!--<RelativeLayout 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:orientation="vertical">-->
<!-- <com.qmuiteam.qmui.widget.QMUITopBar-->
<!-- android:id="@+id/topbar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="?attr/qmui_topbar_height"-->
<!-- app:qmui_topbar_title_color="@color/theme_white_color" />-->
<!-- <com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout-->
<!-- android:id="@+id/section_layout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginTop="?attr/qmui_topbar_height"/>-->
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaTextView-->
<!-- android:id="@+id/tv_area_list"-->
<!-- android:layout_width="@dimen/dp_65"-->
<!-- android:layout_height="@dimen/dp_65"-->
<!-- android:layout_toLeftOf="@+id/tv_add_table"-->
<!-- android:layout_marginRight="@dimen/dp_15"-->
<!-- android:layout_marginBottom="@dimen/dp_20"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:text="@string/manager_area"-->
<!-- android:textSize="@dimen/sp_14"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:gravity="center"-->
<!-- android:background="@drawable/ui_shape_theme_oval"/>-->
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaTextView-->
<!-- android:id="@+id/tv_add_table"-->
<!-- android:layout_width="@dimen/dp_65"-->
<!-- android:layout_height="@dimen/dp_65"-->
<!-- android:layout_marginBottom="@dimen/dp_20"-->
<!-- android:layout_marginRight="@dimen/dp_20"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:text="@string/manager_add"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/sp_14"-->
<!-- android:gravity="center"-->
<!-- android:background="@drawable/manage_shape_add_btn_oval"/>-->
<!-- <FrameLayout-->
<!-- android:id="@+id/frameLayout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginTop="?attr/qmui_topbar_height" />-->
<!--</RelativeLayout>-->
...@@ -10,90 +10,127 @@ ...@@ -10,90 +10,127 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="?attr/qmui_topbar_height"> android:layout_marginTop="?attr/qmui_topbar_height">
<com.qmuiteam.qmui.widget.QMUIEmptyView
android:id="@+id/emptyView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" />
<com.scwang.smartrefresh.layout.SmartRefreshLayout <com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/refreshLayout" android:id="@+id/refreshLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:srlEnableLoadMore="false"> app:srlEnableLoadMore="false">
<androidx.recyclerview.widget.RecyclerView <LinearLayout
android:id="@+id/recycler_area"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" android:orientation="vertical"
app:spanCount="1" /> android:background="@color/theme_white_color">
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
<com.qmuiteam.qmui.widget.QMUIEmptyView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/emptyView" android:id="@+id/recycler_area"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:fitsSystemWindows="true" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:spanCount="1" />
<LinearLayout
android:id="@+id/ll_add_area_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone">
<EditText
android:id="@+id/ed_area_name"
android:layout_width="0dp"
android:layout_height="@dimen/dp_48"
android:layout_weight="1"
android:background="@null"
android:hint="請輸入打區域名稱"
android:maxLength="20"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:singleLine="true"
android:textColor="@color/normal_color"
android:textColorHint="@color/hint_color"
android:textSize="@dimen/sp_16"
android:visibility="visible"/>
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/btn_save_area"
android:layout_width="@dimen/dp_60"
android:layout_height="@dimen/dp_38"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_10"
android:layout_gravity="right|center_vertical"
android:background="@color/theme_red_color"
android:text="保存"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14"
app:qmui_backgroundColor="@color/theme_color"
app:qmui_radius="@dimen/dp_5" />
</LinearLayout>
</LinearLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_bottom_operat" android:id="@+id/ll_bottom_operat"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_40" android:layout_height="@dimen/dp_45"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@color/theme_white_color"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="gone" android:paddingLeft="@dimen/dp_15"
android:weightSum="3"> android:paddingRight="@dimen/dp_15"
android:visibility="gone">
<com.qmuiteam.qmui.alpha.QMUIAlphaButton <CheckBox
android:id="@+id/btn_all_select" android:id="@+id/cb_all_select"
android:layout_width="@dimen/dp_0" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:background="@color/theme_color"
android:text="全選" android:text="全選"
android:textColor="@color/theme_white_color" android:textColor="@color/theme_black"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/btn_anti_select"
android:layout_width="@dimen/dp_0"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_1"
android:layout_weight="1"
android:background="@color/theme_color"
android:text="反選"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_sure" android:id="@+id/btn_sure"
android:layout_width="@dimen/dp_0" android:layout_width="@dimen/dp_60"
android:layout_height="match_parent" android:layout_height="@dimen/dp_38"
android:layout_marginLeft="@dimen/dp_1" android:layout_gravity="right|center_vertical"
android:layout_weight="1"
android:background="@color/theme_red_color" android:background="@color/theme_red_color"
android:text="刪除" android:text="刪除"
android:textColor="@color/theme_white_color" android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14"
app:qmui_backgroundColor="@color/theme_color"
app:qmui_radius="@dimen/dp_5" />
</LinearLayout> </LinearLayout>
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaTextView--> <!-- <com.qmuiteam.qmui.alpha.QMUIAlphaTextView-->
<!-- android:id="@+id/tv_add_area"--> <!-- android:id="@+id/tv_add_area"-->
<!-- android:layout_width="@dimen/dp_65"--> <!-- android:layout_width="@dimen/dp_65"-->
<!-- android:layout_height="@dimen/dp_65"--> <!-- android:layout_height="@dimen/dp_65"-->
<!-- android:layout_gravity="bottom|right"--> <!-- android:layout_gravity="bottom|right"-->
<!-- android:layout_marginBottom="@dimen/dp_20"--> <!-- android:layout_marginBottom="@dimen/dp_20"-->
<!-- android:layout_marginRight="@dimen/dp_20"--> <!-- android:layout_marginRight="@dimen/dp_20"-->
<!-- android:background="@drawable/manage_shape_add_btn_oval"--> <!-- android:background="@drawable/manage_shape_add_btn_oval"-->
<!-- android:gravity="center"--> <!-- android:gravity="center"-->
<!-- android:text="+"--> <!-- android:text="+"-->
<!-- android:textColor="@color/theme_white_color"--> <!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/sp_14" />--> <!-- android:textSize="@dimen/sp_14" />-->
<com.qmuiteam.qmui.alpha.QMUIAlphaFrameLayout <com.qmuiteam.qmui.alpha.QMUIAlphaFrameLayout
android:id="@+id/fl_add_area" android:id="@+id/fl_add_area"
android:layout_width="@dimen/dp_65" android:layout_width="@dimen/dp_65"
android:layout_height="@dimen/dp_65" android:layout_height="@dimen/dp_65"
android:layout_gravity="bottom|right" android:layout_gravity="bottom|right"
android:layout_marginBottom="@dimen/dp_20" android:layout_marginBottom="@dimen/dp_45"
android:layout_marginRight="@dimen/dp_20" android:layout_marginRight="@dimen/dp_20"
android:background="@drawable/manage_shape_add_btn_oval"> android:background="@drawable/manage_shape_add_btn_oval">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
<com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout <com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout
android:id="@+id/section_table" android:id="@+id/section_table"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content" />
android:layout_marginBottom="@dimen/dp_10"/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
</FrameLayout> </FrameLayout>
...@@ -48,6 +47,7 @@ ...@@ -48,6 +47,7 @@
android:layout_marginBottom="@dimen/dp_15" android:layout_marginBottom="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_20" android:layout_marginRight="@dimen/dp_20"
android:background="@drawable/manage_shape_add_btn_oval"> android:background="@drawable/manage_shape_add_btn_oval">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -55,60 +55,53 @@ ...@@ -55,60 +55,53 @@
android:src="@drawable/add_white" /> android:src="@drawable/add_white" />
</com.qmuiteam.qmui.alpha.QMUIAlphaFrameLayout> </com.qmuiteam.qmui.alpha.QMUIAlphaFrameLayout>
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_area"
android:layout_width="@dimen/dp_65"
android:layout_height="@dimen/dp_65"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:layout_toLeftOf="@+id/fl_add_table"
android:background="@drawable/ui_shape_theme_oval"
android:gravity="center"
android:text="@string/manager_area"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
<LinearLayout <LinearLayout
android:id="@+id/ll_bottom_operat" android:id="@+id/ll_bottom_operat"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_40" android:layout_height="@dimen/dp_45"
android:weightSum="3"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:visibility="gone"> android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_15"
android:paddingRight="@dimen/dp_15"
android:visibility="gone"
android:background="@color/theme_white_color">
<com.qmuiteam.qmui.alpha.QMUIAlphaButton <CheckBox
android:id="@+id/btn_all_select" android:id="@+id/cb_all_select"
android:layout_width="@dimen/dp_0" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14"
android:text="全選" android:text="全選"
android:background="@color/theme_color"/> android:textColor="@color/theme_black"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/btn_anti_select" android:id="@+id/btn_modify_serviceCharge"
android:layout_width="@dimen/dp_0" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="@dimen/dp_38"
android:layout_weight="1" android:layout_gravity="right|center_vertical"
android:layout_marginLeft="@dimen/dp_1" android:background="@color/theme_red_color"
android:text="批量修改服務費"
android:textColor="@color/theme_white_color" android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14"
android:background="@color/theme_color" android:layout_marginRight="@dimen/dp_10"
android:text="反選"/> android:paddingRight="@dimen/dp_8"
android:paddingLeft="@dimen/dp_8"
app:qmui_backgroundColor="@color/theme_color"
app:qmui_radius="@dimen/dp_5" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/btn_sure" android:id="@+id/btn_delete"
android:layout_width="@dimen/dp_0" android:layout_width="@dimen/dp_60"
android:layout_height="match_parent" android:layout_height="@dimen/dp_38"
android:layout_weight="1" android:layout_gravity="right|center_vertical"
android:layout_marginLeft="@dimen/dp_1" android:background="@color/theme_red_color"
android:text="刪除"
android:textColor="@color/theme_white_color" android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14"
android:background="@color/theme_red_color" app:qmui_backgroundColor="@color/theme_color"
android:text="刪除"/> app:qmui_radius="@dimen/dp_5" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <!--<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
android:orientation="horizontal" <!-- android:layout_width="match_parent"-->
android:layout_width="match_parent" <!-- android:layout_height="wrap_content"-->
android:layout_height="@dimen/dp_48" <!-- android:orientation="vertical"-->
android:gravity="center_vertical" <!--&gt;-->
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">
<TextView <LinearLayout
android:id="@+id/tv_name" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_weight="1" android:layout_height="@dimen/dp_48"
android:layout_height="wrap_content" android:gravity="center_vertical"
android:textColor="@color/theme_black" android:orientation="horizontal"
android:textSize="@dimen/sp_14" android:paddingLeft="@dimen/dp_10"
android:text="大廳"/> android:paddingRight="@dimen/dp_10">
<EditText
android:id="@+id/ed_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:maxLength="20"
android:singleLine="true"
android:text="大廳"
android:textColor="@color/theme_black"
android:textSize="@dimen/sp_16" />
<CheckBox <CheckBox
android:id="@+id/cb_checked" android:id="@+id/cb_checked"
...@@ -22,13 +32,33 @@ ...@@ -22,13 +32,33 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_20" android:layout_marginRight="@dimen/dp_20"
android:visibility="gone" /> android:visibility="gone" />
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaTextView-->
<!-- android:id="@+id/tv_edit"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="編輯"-->
<!-- android:textColor="@color/theme_color"-->
<!-- android:textSize="@dimen/sp_14" />-->
</LinearLayout>
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaTextView--> <!-- <View-->
<!-- android:id="@+id/tv_edit"--> <!-- android:layout_width="match_parent"-->
<!-- android:layout_width="wrap_content"--> <!-- android:layout_height="@dimen/dp_1"-->
<!-- android:layout_height="wrap_content"--> <!-- android:background="@color/theme_hint_color"/>-->
<!-- android:textColor="@color/theme_color"-->
<!-- android:textSize="@dimen/sp_14"-->
<!-- android:text="編輯"/>-->
</LinearLayout> <!-- <EditText-->
\ No newline at end of file <!-- android:id="@+id/ed_input_name"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/dp_48"-->
<!-- android:paddingLeft="@dimen/dp_10"-->
<!-- android:paddingRight="@dimen/dp_10"-->
<!-- android:background="@null"-->
<!-- android:hint="請輸入打區域名稱"-->
<!-- android:maxLength="20"-->
<!-- android:singleLine="true"-->
<!-- android:textColor="@color/normal_color"-->
<!-- android:textColorHint="@color/hint_color"-->
<!-- android:textSize="@dimen/sp_16"-->
<!-- android:visibility="gone">-->
<!-- </EditText>-->
<!--</LinearLayout>-->
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <com.qmuiteam.qmui.layout.QMUIRelativeLayout 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_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:background="@color/theme_background_color"> android:orientation="vertical"
android:background="@color/theme_white_color">
<LinearLayout <com.qmuiteam.qmui.alpha.QMUIAlphaRelativeLayout
android:layout_width="@dimen/dp_100" android:id="@+id/rl_table"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:background="@drawable/ui_selector_item_background" android:layout_height="wrap_content">
android:gravity="center"
android:orientation="vertical" <TextView
android:padding="@dimen/dp_10" android:id="@+id/tv_table"
android:layout_margin="@dimen/dp_10"> android:layout_width="wrap_content"
android:layout_height="wrap_content"
<TextView android:layout_centerHorizontal="true"
android:id="@+id/tv_name" android:ellipsize="end"
android:layout_width="wrap_content" android:maxLines="1"
android:layout_height="wrap_content" android:text="Button"
android:ellipsize="end" android:textColor="#FF000000"
android:maxLines="1" android:textSize="@dimen/dp_22" />
android:text=""
android:textColor="@color/theme_black" <TextView
android:textSize="@dimen/sp_16" /> android:id="@+id/tv_people"
android:layout_width="wrap_content"
<TextView android:layout_height="wrap_content"
android:id="@+id/tv_service_fee" android:layout_below="@+id/tv_table"
android:layout_width="wrap_content" android:layout_centerHorizontal="true"
android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_2" android:text=""
android:text="" android:textColor="@color/theme_white_color"
android:textColor="@color/theme_text_pice_color" android:textSize="@dimen/sp_13"
android:textSize="@dimen/sp_16" /> android:visibility="visible" />
<TextView
android:id="@+id/tv_service_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_2"
android:layout_below="@+id/tv_people"
android:text=""
android:textColor="@color/theme_text_pice_color"
android:textSize="@dimen/sp_16" />
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_showMain"-->
<!-- style="@style/ButtonBorderless"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="96dp"-->
<!-- android:layout_alignParentLeft="true"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_marginLeft="0dp"-->
<!-- android:layout_marginTop="0dp"-->
<!-- android:text="Button"-->
<!-- android:textSize="@dimen/dp_16"-->
<!-- android:visibility="gone" />-->
<!-- <ImageView-->
<!-- android:id="@+id/iv_vip"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_alignParentLeft="true"-->
<!-- android:layout_alignParentTop="true"-->
<!-- android:scaleType="fitXY"-->
<!-- android:src="@drawable/qmui_icon_tip_new"-->
<!-- android:visibility="gone" />-->
<!-- <TextView-->
<!-- android:id="@+id/tv_scan_flag"-->
<!-- android:layout_width="25dp"-->
<!-- android:layout_height="25dp"-->
<!-- android:layout_alignParentTop="true"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:text="S"-->
<!-- android:background="@color/orange_700"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:gravity="center"-->
<!-- android:visibility="gone"-->
<!-- android:textSize="@dimen/font_normal2" />-->
<CheckBox <CheckBox
android:id="@+id/cb_checked" android:id="@+id/cb_checked"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2" android:layout_centerHorizontal="true"
android:visibility="gone" /> android:layout_below="@+id/tv_service_fee"
</LinearLayout> android:visibility="invisible" />
</FrameLayout> </com.qmuiteam.qmui.alpha.QMUIAlphaRelativeLayout>
<com.gingersoft.gsa.cloud.ui.view.TriangleLabelView
android:id="@+id/tlv_table_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
app:backgroundColor="@color/theme_white_color"
app:corner="rightBottom"
app:primaryText="堂"
app:primaryTextColor="#249B65"
app:primaryTextSize="10sp"
android:visibility="gone"/>
<FrameLayout
android:id="@+id/fl_add_table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="+"
android:textColor="#ff3c3c3c"
android:textSize="31sp"/>
</FrameLayout>
</com.qmuiteam.qmui.layout.QMUIRelativeLayout>
...@@ -93,7 +93,6 @@ public class StateTableFragment extends BaseFragment<StateTablePresenter> implem ...@@ -93,7 +93,6 @@ public class StateTableFragment extends BaseFragment<StateTablePresenter> implem
} else if(mContext instanceof OrderContentActivity){ } else if(mContext instanceof OrderContentActivity){
mOrderContentActivity = (OrderContentActivity) mContext; mOrderContentActivity = (OrderContentActivity) mContext;
} }
initRecycleScrollListener(); initRecycleScrollListener();
} }
......
...@@ -12,11 +12,9 @@ ...@@ -12,11 +12,9 @@
android:id="@+id/recycle_all_table" android:id="@+id/recycle_all_table"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/theme_background_color" android:background="@color/theme_background_color" />
android:overScrollMode="never" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
<com.qmuiteam.qmui.widget.QMUIEmptyView <com.qmuiteam.qmui.widget.QMUIEmptyView
android:id="@+id/emptyView" android:id="@+id/emptyView"
android:layout_width="match_parent" android:layout_width="match_parent"
......
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