Commit 0c0053e4 by 王宇航

2020-02-29

parent 2718aa3f
......@@ -24,6 +24,9 @@ buildscript {
classpath 'com.billy.android:cc-register:1.1.2'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
// classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.8'
// classpath fileTree(dir:'plugins', include:['*.jar'])
}
}
......
......@@ -5,7 +5,6 @@ import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.Rect;
import android.util.Log;
import com.daivd.chart.data.LineData;
import com.daivd.chart.data.style.LineStyle;
......@@ -96,9 +95,7 @@ public class LineProvider extends BaseBarLineProvider<LineData> {
ILineModel model = lineData.getLineModel();
model = model == null ? lineModel : model;
for (int i = 0; i < pointY.size(); i++) {
Log.e("bbb", "前值:" + pointY.get(i));
pointY.set(i, pointY.get(i) - style.getWidth() / 2);
Log.e("bbb", "後值:" + pointY.get(i));
}
for (int i = 0; i < pointX.size(); i++) {
pointX.set(i, pointX.get(i) + style.getWidth() / 2);
......
......@@ -61,10 +61,10 @@ public class PaymentMethodReportPresenter extends BasePresenter<PaymentMethodRep
this.mApplication = null;
}
public void getPaymentInfo() {
public void getPaymentInfo(String startTime) {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", "26")
.add("startTime", TimeUtils.getYear(-1))//TimeUtils.getYesterdayTime(TimeUtils.DATE_FORMAT_DATE)
.add("startTime", startTime)//TimeUtils.getYesterdayTime(TimeUtils.DATE_FORMAT_DATE)
.add("endTime", TimeUtils.getYear(0))//TimeUtils.getCurrentTimeInString(TimeUtils.DATE_FORMAT_DATE)
.build();
mModel.getPaymentInfo(requestBody)
......
......@@ -12,6 +12,8 @@ import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.Collections;
import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
......@@ -61,10 +63,10 @@ public class SalesPresenter extends BasePresenter<SalesContract.Model, SalesCont
this.mApplication = null;
}
public void getSalesReportInfo() {
public void getSalesReportInfo(String startTime) {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", "26")
.add("startTime", TimeUtils.getYear(-1))//TimeUtils.getYesterdayTime(TimeUtils.DATE_FORMAT_DATE)
.add("startTime", startTime)//TimeUtils.getYesterdayTime(TimeUtils.DATE_FORMAT_DATE)
.add("endTime", TimeUtils.getYear(0))//TimeUtils.getCurrentTimeInString(TimeUtils.DATE_FORMAT_DATE)
.build();
mModel.getSalesReportInfo(requestBody)
......@@ -80,6 +82,7 @@ public class SalesPresenter extends BasePresenter<SalesContract.Model, SalesCont
public void onNext(@NonNull SalesFoodsBean info) {
if (info != null && info.isSuccess()) {
if (info.getData() != null) {
info.getData().removeAll(Collections.singleton(null));
mRootView.loadInfo(info.getData());
}
} else {
......
......@@ -18,7 +18,7 @@ import androidx.annotation.Nullable;
*/
public class PaymentMethodAdapter extends BaseQuickAdapter<PaymentMethodBean.DataBean, BaseViewHolder> {
private int[] colors = new int[]{R.color.payment_method_color1,
public static int[] colors = new int[]{R.color.payment_method_color1,
R.color.payment_method_color2, R.color.payment_method_color3,
R.color.payment_method_color4, R.color.payment_method_color5,
R.color.payment_method_color6, R.color.payment_method_color7,
......
......@@ -21,6 +21,7 @@ import com.daivd.chart.data.style.LineStyle;
import com.daivd.chart.data.style.PointStyle;
import com.daivd.chart.provider.component.point.Point;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.time.TimePickerUtils;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.main.R;
......@@ -36,6 +37,7 @@ import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
......@@ -79,6 +81,8 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
@BindView(R2.id.tv_end_time)
TextView mTvEndTime;
private BusinessInfoAdapter businessInfoAdapter;
public static BusinessReportFragment newInstance() {
BusinessReportFragment fragment = new BusinessReportFragment();
return fragment;
......@@ -103,8 +107,8 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
public void initData(@Nullable Bundle savedInstanceState) {
//獲取一段時間內的營業信息,默認獲取七天的數據
mPresenter.getRestaurantBusinessInfo("26", TimeUtils.getOldDate(-6), TimeUtils.getOldDate(0));
mRestaurantName.setText(GsaCloudApplication.getRestaurantName(mContext));
mRestaurantName.setText(GsaCloudApplication.getRestaurantName(mContext));
mTvStartTime.setText(TimeUtils.getOldDate(-6));
mTvEndTime.setText(TimeUtils.getOldDate(0));
}
......@@ -202,6 +206,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
tempList1.add(0d);
}
}
final LineData columnData1 = new LineData("今日", "", getResources().getColor(R.color.theme_color), tempList1);
columnData1.setLineStyle(new LineStyle(mContext, 5, getResources().getColor(R.color.theme_color)));
ColumnDatas.add(columnData1);
......@@ -240,10 +245,12 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
mLineChart.setZoom(false);
//开启十字架
mLineChart.getProvider().setOpenCross(true);
//關閉硬件加速
mLineChart.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
//开启MarkView
mLineChart.getProvider().setOpenMark(false);
mLineChart.getProvider().setOpenMark(true);
//设置MarkView
mLineChart.getProvider().setMarkView(new CustomMarkView(mContext));
mLineChart.getProvider().setMarkView(new CustomMarkView(columnData1));
//设置显示点
Point point = new Point();
point.getPointStyle().setShape(PointStyle.CIRCLE);
......@@ -286,21 +293,37 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
@Override
public void loadAdapter(List<BusinessBean> businessBeans) {
if (businessInfoAdapter == null) {
mBusinessDetails.setLayoutManager(new GridLayoutManager(mContext, 3) {
@Override
public boolean canScrollVertically() {
return false;
}
});
mBusinessDetails.setAdapter(new BusinessInfoAdapter(businessBeans));
businessInfoAdapter = new BusinessInfoAdapter(businessBeans);
mBusinessDetails.setAdapter(businessInfoAdapter);
} else {
businessInfoAdapter.setNewData(businessBeans);
}
}
@OnClick({R2.id.tv_start_time})
@Override
public void onClick(View v) {
if (v.getId() == R.id.tv_start_time) {
Calendar cal = Calendar.getInstance();
try {
//設置默認時間為當前的起止時間
cal.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvStartTime.getText().toString()));
} catch (ParseException e) {
e.printStackTrace();
}
//打開時間選擇器
TimePickerUtils.showReportTimePicker(mContext, cal, (date, v1) ->
{
mTvStartTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
mPresenter.getRestaurantBusinessInfo("26", mTvStartTime.getText().toString(), TimeUtils.getOldDate(0));
});
}
}
}
......@@ -34,6 +34,7 @@ import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainOrderInfoChartBean;
import com.gingersoft.gsa.cloud.main.mvp.presenter.MainTopPresenter;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.ReportActivity;
import com.gingersoft.gsa.cloud.main.mvp.ui.view.CustomMarkView;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
......@@ -238,11 +239,8 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
@Override
public void loadChart(List<MainOrderInfoChartBean.DataBean> dataBeans) {
Resources res = getResources();
FontStyle.setDefaultTextSpSize(mContext, 12);
//存儲今天的線條數據
SparseArray<MainOrderInfoChartBean.DataBean.ItemsBean> dataBeanMap = new SparseArray<>();
SparseArray<MainOrderInfoChartBean.DataBean.ItemsBean> yesterdayArrays = new SparseArray<>();
......@@ -270,7 +268,6 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
ArrayList<Double> humidityList = new ArrayList<>();
LineData columnData2 = new LineData("昨日", "", getResources().getColor(R.color.today_line), humidityList);
columnData2.setLineStyle(new LineStyle(mContext, 5, getResources().getColor(R.color.today_line)));
//X軸數據,固定不變
List<String> chartYDataList = new ArrayList<>();
for (int i = 0; i < 24; i++) {
......@@ -330,11 +327,12 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
lineChart.setZoom(false);
//开启十字架
lineChart.getProvider().setOpenCross(true);
//關閉硬件加速
lineChart.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
//开启MarkView
// lineChart.getProvider().setOpenMark(true);
lineChart.getProvider().setOpenMark(true);
//设置MarkView
// lineChart.getProvider().setMarkView(new CustomMarkView(mContext));
lineChart.getProvider().setMarkView(new CustomMarkView(columnData1, columnData2));
//设置显示点
Point point = new Point();
point.getPointStyle().setShape(PointStyle.CIRCLE);
......@@ -350,6 +348,7 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
lineChart.setFirstAnim(true);
lineChart.setChartData(chartData2);
lineChart.setOnClickColumnListener((lineData, pos) -> {
// Paint paint = new Paint();
// paint.setAntiAlias(true);
// paint.setTextSize(DensityUtils.sp2px(mContext, 13));
......
......@@ -9,6 +9,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.utils.time.TimePickerUtils;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.main.R;
......@@ -26,13 +27,14 @@ import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.data.PieEntry;
import com.github.mikephil.charting.formatter.PercentFormatter;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.MPPointF;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import androidx.annotation.NonNull;
......@@ -63,8 +65,10 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
@BindView(R2.id.rv_payment_color)
RecyclerView rvPaymentColor;
private PaymentMethodColorAdapter methodColorAdapter;
@BindView(R2.id.rv_payment_proportion)
RecyclerView rvPaymentProportion;
private PaymentMethodAdapter methodAdapter;
@BindView(R2.id.report_payment_method_chart)
PieChart chart;
@BindView(R2.id.tv_start_time)
......@@ -94,7 +98,7 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
@Override
public void initData(@Nullable Bundle savedInstanceState) {
mPresenter.getPaymentInfo();
mPresenter.getPaymentInfo(TimeUtils.getYear(-1));
mTvStartTime.setText(TimeUtils.getOldDate(-6));
mTvEndTime.setText(TimeUtils.getOldDate(0));
......@@ -171,22 +175,30 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
@Override
public void loadPaymentInfo(List<PaymentMethodBean.DataBean> data) {
if (methodColorAdapter == null) {
rvPaymentColor.setLayoutManager(new GridLayoutManager(mContext, 4) {
@Override
public boolean canScrollVertically() {
return false;
}
});
rvPaymentColor.setAdapter(new PaymentMethodColorAdapter(mContext, data));
methodColorAdapter = new PaymentMethodColorAdapter(mContext, data);
rvPaymentColor.setAdapter(methodColorAdapter);
} else {
methodColorAdapter.setNewData(data);
}
if (methodAdapter == null) {
rvPaymentProportion.setLayoutManager(new GridLayoutManager(mContext, 4) {
@Override
public boolean canScrollVertically() {
return false;
}
});
rvPaymentProportion.setAdapter(new PaymentMethodAdapter(mContext, data));
methodAdapter = new PaymentMethodAdapter(mContext, data);
rvPaymentProportion.setAdapter(methodAdapter);
} else {
methodAdapter.setNewData(data);
}
initChart();
setData(data);
}
......@@ -230,7 +242,7 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
l.setDrawInside(false);
l.setEnabled(false);
// entry label styling
chart.setEntryLabelColor(mContext.getResources().getColor(R.color.theme_color));
chart.setEntryLabelColor(mContext.getResources().getColor(R.color.white));
chart.setEntryLabelTextSize(12f);
}
......@@ -239,50 +251,32 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
// NOTE: The order of the entries when being added to the entries array determines their position around the center of
// the chart.
ArrayList<Integer> colors = new ArrayList<>();
for (int i = 0; i < dataBeans.size(); i++) {
float percentage = Float.parseFloat(dataBeans.get(i).getPercentage().replace("%", ""));
if (percentage > 0) {//比例大於0才添加
entries.add(new PieEntry(percentage,
dataBeans.get(i).getPayName()));
entries.add(new PieEntry(percentage, dataBeans.get(i).getPayName()));
if (i < PaymentMethodAdapter.colors.length) {
colors.add(mContext.getResources().getColor(PaymentMethodAdapter.colors[i]));
} else {
colors.add(mContext.getResources().getColor(PaymentMethodAdapter.colors[i % PaymentMethodAdapter.colors.length]));
}
}
}
PieDataSet dataSet = new PieDataSet(entries, "Election Results");
dataSet.setColors(colors);
dataSet.setDrawIcons(false);
dataSet.setSliceSpace(3f);
dataSet.setSliceSpace(1f);
dataSet.setIconsOffset(new MPPointF(0, 40));
dataSet.setSelectionShift(5f);
// add a lot of colors
ArrayList<Integer> colors = new ArrayList<>();
for (int c : ColorTemplate.VORDIPLOM_COLORS)
colors.add(c);
for (int c : ColorTemplate.JOYFUL_COLORS)
colors.add(c);
for (int c : ColorTemplate.COLORFUL_COLORS)
colors.add(c);
for (int c : ColorTemplate.LIBERTY_COLORS)
colors.add(c);
for (int c : ColorTemplate.PASTEL_COLORS)
colors.add(c);
colors.add(ColorTemplate.getHoloBlue());
dataSet.setColors(colors);
//dataSet.setSelectionShift(0f);
PieData data = new PieData(dataSet);
data.setValueFormatter(new PercentFormatter(chart));
data.setValueTextSize(12f);
data.setValueTextColor(mContext.getResources().getColor(R.color.theme_color));
data.setValueTextColor(mContext.getResources().getColor(R.color.white));
chart.setData(data);
// undo all highlights
......@@ -295,8 +289,18 @@ public class PaymentMethodReportFragment extends BaseFragment<PaymentMethodRepor
@Override
public void onClick(View v) {
if (v.getId() == R.id.tv_start_time) {
Calendar cal = Calendar.getInstance();
try {
//設置默認時間為當前的起止時間
cal.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvStartTime.getText().toString()));
} catch (ParseException e) {
e.printStackTrace();
}
//打開時間選擇器
TimePickerUtils.showReportTimePicker(mContext, cal, (date, v1) -> {
mTvStartTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
mPresenter.getPaymentInfo(mTvStartTime.getText().toString());
});
}
}
}
......@@ -9,6 +9,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.utils.time.TimePickerUtils;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.main.R;
......@@ -33,7 +34,9 @@ import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import androidx.annotation.NonNull;
......@@ -65,12 +68,15 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
PieChart salesChart;
@BindView(R2.id.rv_sort_numbering)
RecyclerView rvSortNumbering;
private SortNumberingAdapter mSortNumberingAdapter;
@BindView(R2.id.rv_restaurant)
RecyclerView rvFoodRanking;
private FoodRankingAdapter foodRankingAdapter;
@BindView(R2.id.tv_start_time)
TextView mTvStartTime;
@BindView(R2.id.tv_end_time)
TextView mTvEndTime;
public static SalesFragment newInstance() {
SalesFragment fragment = new SalesFragment();
return fragment;
......@@ -93,9 +99,9 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
@Override
public void initData(@Nullable Bundle savedInstanceState) {
mPresenter.getSalesReportInfo();
mPresenter.getSalesReportInfo(TimeUtils.getYear(-1));
mTvStartTime.setText(TimeUtils.getOldDate(-6));
mTvStartTime.setText(TimeUtils.getYear(-1));
mTvEndTime.setText(TimeUtils.getOldDate(0));
}
......@@ -172,6 +178,7 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
public void loadInfo(List<SalesFoodsBean.DataBean> info) {
List<SalesFoodsBean.DataBean> rankings = new ArrayList<>(info);
rankings.add(0, new SalesFoodsBean.DataBean());
if (mSortNumberingAdapter == null) {
//序號adapter
rvSortNumbering.setLayoutManager(new LinearLayoutManager(mContext) {
@Override
......@@ -179,8 +186,13 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
return false;
}
});
rvSortNumbering.setAdapter(new SortNumberingAdapter(mContext, rankings));
mSortNumberingAdapter = new SortNumberingAdapter(mContext, rankings);
rvSortNumbering.setAdapter(mSortNumberingAdapter);
} else {
mSortNumberingAdapter.setNewData(rankings);
}
if (foodRankingAdapter == null) {
LinearLayoutManager lm = new LinearLayoutManager(mContext) {
@Override
public boolean canScrollVertically() {
......@@ -189,8 +201,11 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
};
lm.setOrientation(RecyclerView.VERTICAL);
rvFoodRanking.setLayoutManager(lm);
rvFoodRanking.setAdapter(new FoodRankingAdapter(mContext, rankings));
foodRankingAdapter = new FoodRankingAdapter(mContext, rankings);
rvFoodRanking.setAdapter(foodRankingAdapter);
} else {
foodRankingAdapter.setNewData(rankings);
}
loadChart(info);
}
......@@ -257,8 +272,11 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
ArrayList<PieEntry> entries = new ArrayList<>();
// NOTE: The order of the entries when being added to the entries array determines their position around the center of
// the chart.
if (info != null) {
for (int i = 0; i < info.size(); i++) {
entries.add(new PieEntry(Float.parseFloat(info.get(i).getPercentageTotal().replace("%","")), info.get(i).getFoodName()));
if (info.get(i) != null)
entries.add(new PieEntry(Float.parseFloat(info.get(i).getPercentageTotal().replace("%", "")), info.get(i).getFoodName()));
}
}
PieDataSet dataSet = new PieDataSet(entries, "Election Results");
dataSet.setSliceSpace(3f);//設置餅狀圖空隙
......@@ -313,7 +331,17 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
public void onClick(View v) {
if (v.getId() == R.id.tv_start_time) {
//打開時間選擇器
Calendar cal = Calendar.getInstance();
try {
//設置默認時間為當前的起止時間
cal.setTime(TimeUtils.DATE_FORMAT_DATE.parse(mTvStartTime.getText().toString()));
} catch (ParseException e) {
e.printStackTrace();
}
TimePickerUtils.showReportTimePicker(mContext, cal, (date, v1) -> {
mTvStartTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
mPresenter.getSalesReportInfo(mTvStartTime.getText().toString());
});
}
}
}
package com.gingersoft.gsa.cloud.main.mvp.ui.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.LayoutInflater;
import android.view.View;
import android.graphics.RectF;
import com.daivd.chart.data.BarData;
import com.daivd.chart.data.LineData;
import com.daivd.chart.provider.component.mark.IMark;
import com.daivd.chart.provider.component.tip.MultiLineBubbleTip;
import com.daivd.chart.provider.component.tip.SingleLineBubbleTip;
import com.daivd.chart.utils.DensityUtils;
import com.gingersoft.gsa.cloud.main.R;
/**
* Created by huang on 2017/9/28.
*/
public class CustomMarkView<C extends BarData> implements IMark<C> {
private SingleLineBubbleTip<String> bubbleTip;
private Paint paint;
private View contentView;
private int mTodayColor = Color.parseColor("#018EF2");
private int mYesterDayColor = Color.parseColor("#FFCC8F");
private LineData columnData;
private LineData columnData2;
public CustomMarkView(LineData columnData) {
this.columnData = columnData;
initPaint();
}
private MultiLineBubbleTip<View> multiLineBubbleTip;
// private DialogUtils dialog;
public CustomMarkView(Context context) {
contentView = LayoutInflater.from(context).inflate(R.layout.layout_markview, null);
public CustomMarkView(LineData columnData, LineData columnData2) {
this.columnData = columnData;
this.columnData2 = columnData2;
initPaint();
}
private void initPaint() {
paint = new Paint();
paint.setAntiAlias(true);
paint.setTextSize(DensityUtils.sp2px(context, 13));
paint.setTextSize(34);
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.WHITE);
multiLineBubbleTip = new MultiLineBubbleTip<View>(context, R.drawable.bg,0, paint) {
@Override
public boolean isShowTip(View view, int position) {
return true;
paint.setColor(Color.parseColor("#333333"));
}
@Override
public String[] format(View view, int position) {
return new String[0];
public CustomMarkView setTodayColor() {
return this;
}
};
bubbleTip = new SingleLineBubbleTip<String>(context, R.drawable.bg, 0, paint) {
@Override
public boolean isShowTip(String s, int position) {
return false;
public Paint getPaint() {
return paint;
}
@Override
public String format(String s, int position) {
return s;
}
};
bubbleTip.setColorFilter(Color.parseColor("#F4A460"));
bubbleTip.setAlpha(0.8f);
public int getTextHeight() {
Paint.FontMetrics fontMetrics = getPaint().getFontMetrics();
return (int) (fontMetrics.bottom - fontMetrics.top);
}
public Paint getPaint() {
return paint;
public int getTextWidth(String content) {
return (int) getPaint().measureText(content);
}
private int verticalPadding = 15;
private int horizontalPadding = 15;
private int contentInterval = 7;//內容空隙
private int ovalWidth = 23;//圓點的寬度
@Override
public void drawMark(Canvas canvas, float x, float y, Rect rect, String content, BarData data, int position) {
String text = content + "---" + data.getChartYDataList().get(position) + "---" + data.getUnit();
//
//
multiLineBubbleTip.drawTip(canvas, x, y, rect, contentView, position);
// dialog.show();
public void drawMark(Canvas canvas, float x, float y, Rect rect, String content, BarData d, int position) {
float rectWidth = 0;//矩形寬度
float rectHeight = 0;//矩形高度
int row = 0;
float textHeight = getTextHeight();
String content1 = null, content2 = null;
if (columnData != null && columnData.getName() != null && position <= columnData.getChartYDataList().size()) {
content1 = columnData.getName() + columnData.getChartYDataList().get(position);
}
if (columnData2 != null && columnData2.getChartYDataList() != null && position <= columnData2.getChartYDataList().size()) {
content2 = columnData2.getName() + columnData2.getChartYDataList().get(position);
}
if (content != null) {
row++;
rectWidth = Math.max(rectWidth, getTextWidth(content));
}
if (content1 != null) {
row++;
rectWidth = Math.max(rectWidth, getTextWidth(content1));
}
if (content2 != null) {
row++;
rectWidth = Math.max(rectWidth, getTextWidth(content2));
}
//矩形寬度=圓點寬度+圓點與內容的間距+左右間距
rectWidth += ovalWidth + contentInterval + horizontalPadding * 2;
//矩形高度=三行文字的高度+三行文字中間是兩行間距+上下間距
rectHeight = getTextHeight() * row + contentInterval * 2 + verticalPadding * 2;
float selfWidth = rectWidth / 2;
float selfHeight = rectHeight / 2;
RectF rectf = new RectF(x - selfWidth, y - selfHeight, x + selfWidth, y + selfHeight);
//判斷在有效範圍內
if (x > rect.left && x < rect.right) {
if (rectf.left < rect.left) {
rectf.left = rect.left;
rectf.right = rect.left + rectWidth;
}
if (rectf.right > rect.right) {
rectf.right = rect.right;
rectf.left = rect.right - rectWidth;
}
}
//設置陰影
paint.setShadowLayer(10, 0, 0, Color.parseColor("#33000000")); //第一个参数是阴影扩散半径,紧接着的2个参数是阴影在X和Y方向的偏移量,最后一个参数是颜色
paint.setColor(Color.parseColor("#FFFFFF"));
canvas.drawRoundRect(rectf, 8, 8, paint);
//清除陰影
paint.clearShadowLayer();
//繪製時間
paint.setColor(Color.parseColor("#333333"));
if (content != null) {
canvas.drawText(content, rectf.left + horizontalPadding + ovalWidth + contentInterval, rectf.top + verticalPadding + textHeight, paint);
}
float ovalHeight = (textHeight - ovalWidth) / 2;//圓和文字上下空隙,為了居中顯示
if (content2 != null) {
canvas.drawText(content2, rectf.left + horizontalPadding + ovalWidth + contentInterval, rectf.top + verticalPadding + contentInterval + textHeight * 2, paint);
paint.setColor(columnData2.getLineStyle().getColor());
RectF yesterDayOvalRect = new RectF(rectf.left + horizontalPadding, rectf.top + verticalPadding + contentInterval + textHeight + ovalWidth - ovalHeight, rectf.left + horizontalPadding + ovalWidth, rectf.top + verticalPadding + contentInterval + textHeight + ovalWidth * 2 - ovalHeight);
canvas.drawOval(yesterDayOvalRect, paint);
}
if (content1 != null) {
paint.setColor(Color.parseColor("#333333"));
canvas.drawText(content1, rectf.left + horizontalPadding + ovalWidth + contentInterval, rectf.top + verticalPadding + contentInterval * 2 + textHeight * row, paint);
paint.setColor(columnData.getLineStyle().getColor());
RectF yesterDayOvalRect = new RectF(rectf.left + horizontalPadding, rectf.top + verticalPadding + contentInterval * 2 + (textHeight * (row - 1)) + ovalWidth - ovalHeight, rectf.left + horizontalPadding + ovalWidth, rectf.top + verticalPadding + contentInterval * 2 + (textHeight * (row - 1)) + ovalWidth * 2 - ovalHeight);
canvas.drawOval(yesterDayOvalRect, paint);
}
}
}
......@@ -4,6 +4,7 @@ import android.app.Application;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
......@@ -68,7 +69,12 @@ public class PrinterAddPresenter extends BasePresenter<PrinterAddContract.Model,
* @param type 類型1 :55mm, 2:88mm
*/
public void addPrinter(int restaurantId, String ip, String port, int type) {
PrinterDeviceBean printerDeviceBean = new PrinterDeviceBean(restaurantId, ip, Integer.parseInt(port), type);
PrinterDeviceBean printerDeviceBean;
if (TextUtil.isEmptyOrNullOrUndefined(port)) {
printerDeviceBean = new PrinterDeviceBean(restaurantId, ip, null, type);
} else {
printerDeviceBean = new PrinterDeviceBean(restaurantId, ip, Integer.parseInt(port), type);
}
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), JsonUtils.toJson(printerDeviceBean));
mModel.addPrinter(requestBody)
......@@ -100,7 +106,12 @@ public class PrinterAddPresenter extends BasePresenter<PrinterAddContract.Model,
* @param type 打印機類型 1 :55mm, 2:88mm
*/
public void updatePrinterInfo(int id, int restaurantId, String ip, String port, int type) {
PrinterDeviceBean printerDeviceBean = new PrinterDeviceBean(id, null, ip, Integer.parseInt(port), type);
PrinterDeviceBean printerDeviceBean;
if (TextUtil.isEmptyOrNullOrUndefined(port)) {
printerDeviceBean = new PrinterDeviceBean(id, null, ip, null, type);
} else {
printerDeviceBean = new PrinterDeviceBean(id, null, ip, Integer.parseInt(port), type);
}
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), JsonUtils.toJson(printerDeviceBean));
mModel.updatePrinter(requestBody)
.subscribeOn(Schedulers.io())
......
......@@ -6,11 +6,11 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.joe.print.mvp.print.SendPrint;
......@@ -66,8 +66,8 @@ public class OldPrintActivity extends Activity implements PrintSocketHolder.OnSt
if (ip == null || ip.equals("")) {
ip = "192.168.1.217";
}
if (port == null || port.equals("")) {
port = "9100";
if (TextUtil.isEmptyOrNullOrUndefined(port) || port.equals("")) {
port = "0";
}
if (paperType == 1) {
paperType = PrinterWriter58mm.TYPE_58;
......@@ -157,6 +157,7 @@ public class OldPrintActivity extends Activity implements PrintSocketHolder.OnSt
ToastUtils.show(this, msg);
//延遲一秒
dialog.dismiss();
LoadingDialog.cancelDialogForLoading();
//判断是否为CC调用打开本页面
if (callId != null) {
CCResult result;
......
......@@ -9,7 +9,6 @@ import android.os.Bundle;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.util.Log;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
......@@ -17,6 +16,8 @@ import com.billy.cc.core.component.CCUtil;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.PrinterManger.PrinterManager;
import com.gingersoft.gsa.cloud.base.utils.PrintUtils;
import com.gingersoft.gsa.cloud.base.utils.constans.Constans;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.base.utils.view.ImageUtils;
import com.gingersoft.gsa.cloud.base.widget.DialogUtils;
......@@ -37,6 +38,7 @@ import com.joe.print.mvp.ui.adapter.DialogPrinterListAdapter;
import com.yanzhenjie.recyclerview.widget.DefaultItemDecoration;
import java.util.List;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
......@@ -101,13 +103,27 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
public void initData(@Nullable Bundle savedInstanceState) {
type = CCUtil.getNavigateParam(this, "type", 1001);
Log.e("bbb", "打印類型:" + type);
List<Bitmap> bitmaps = PrintUtils.getPrintBitmap(mContext, type, 500);
if (bitmaps.size() <= 0) {
printFile();
finish();
return;
}
if (Objects.equals(SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, ""), "")) {
//如果沒有默認打印位置
noDefaultPrintMethod(bitmaps);
} else if (Objects.equals(SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, ""), Constans.LOCAL_PRINT)) {
//默認打印方式為本地,進行本地打印
for (int i = 0; i < bitmaps.size(); i++) {
locationPrint(bitmaps.get(i));
}
} else if (Objects.equals(SPUtils.get(mContext, Constans.DEFAULT_PRINT_METHOD, ""), Constans.IP_PRINT)) {
//默認打印方式為ip打印,調用ip打印方法
ipPrint();
}
}
private void noDefaultPrintMethod(List<Bitmap> bitmaps) {
selectDialog = new DialogUtils(mContext, R.layout.print_dialog_select_device) {
@Override
public void initLayout(ViewHepler hepler, Dialog dialog) {
......@@ -116,10 +132,23 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
for (int i = 0; i < bitmaps.size(); i++) {
locationPrint(bitmaps.get(i));
}
//修改默認打印方式為本地
SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.LOCAL_PRINT);
dialog.dismiss();
});
hepler.setViewClick(R.id.internet_print, v -> {
//IP打印
//修改默認打印方式為IP打印
SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.LOCAL_PRINT);
ipPrint();
});
}
}.createDialogView().show().setOnDismissListener(this);
}
/**
* IP打印
*/
private void ipPrint() {
if (PrinterManager.getPrinterManager().getDeviceBeans() != null
&& PrinterManager.getPrinterManager().getDeviceBeans().size() > 0) {
//如果本地保存有打印設備
......@@ -128,9 +157,6 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
//網絡獲取打印設備
mPresenter.getPrinterList(GsaCloudApplication.getRestaurantId(mContext));
}
});
}
}.createDialogView().show().setOnDismissListener(this);
}
/**
......
......@@ -168,10 +168,10 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
ipAddress.append(editText.getText());
ipAddress.append(".");
}
if (etPort.getText() == null || etPort.getText().toString().equals("")) {
showMessage("請輸入端口號");
return;
}
// if (etPort.getText() == null || etPort.getText().toString().equals("")) {
// showMessage("請輸入端口號");
// return;
// }
hideKeyBoard();
int paperType = 1;//打印紙類型
......
......@@ -181,34 +181,27 @@ public class PrinterListActivity extends BaseActivity<PrintListPresenter> implem
finish();
}
private List<PrinterDeviceBean> devicess;
@Override
public void loadPrinterList(List<PrinterDeviceBean> deviceBeans) {
PrinterManager.getPrinterManager().setDeviceBeans(deviceBeans);
devicess = deviceBeans;
if (printListAdapter == null) {
printListAdapter = new PrinterListAdapter(deviceBeans, mContext);
mRvPrintList.setLayoutManager(new LinearLayoutManager(this));
//分割线
mRvPrintList.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(this, R.color.line_color)));
mRvPrintList.setOnItemClickListener((view, adapterPosition) -> {
//打開打印機詳情
Intent intent = new Intent(mContext, PrinterAddActivity.class);
intent.putExtra("printerInfo", deviceBeans.get(adapterPosition));
intent.putExtra("printerInfo", devicess.get(adapterPosition));
startActivity(intent);
});
//menu 右侧菜單點擊事件
mRvPrintList.setOnItemMenuClickListener((menuBridge, position) -> {
menuBridge.closeMenu();
mPresenter.deletePrinter(deviceBeans.get(position).getId() + "");
deviceBeans.remove(position);
mPresenter.deletePrinter(devicess.get(position).getId() + "");
devicess.remove(position);
printListAdapter.notifyItemRemoved(position);
}); // Item的Menu点击。
mRvPrintList.setSwipeMenuCreator(mSwipeMenuCreator); // 菜单创建器。
mRvPrintList.setOnItemStateChangedListener(mOnItemStateChangedListener); // 监听Item的手指状态,拖拽、侧滑、松开。
mRvPrintList.setLongPressDragEnabled(true); // 长按拖拽,默认关闭。
mRvPrintList.setOnItemMoveListener(new OnItemMoveListener() {
@Override
public boolean onItemMove(RecyclerView.ViewHolder srcHolder, RecyclerView.ViewHolder targetHolder) {
......@@ -220,11 +213,11 @@ public class PrinterListActivity extends BaseActivity<PrintListPresenter> implem
if (fromPosition < toPosition) {
for (int i = fromPosition; i < toPosition; i++) {
Collections.swap(deviceBeans, i, i + 1);
Collections.swap(devicess, i, i + 1);
}
} else {
for (int i = fromPosition; i > toPosition; i--) {
Collections.swap(deviceBeans, i, i - 1);
Collections.swap(devicess, i, i - 1);
}
}
printListAdapter.notifyItemMoved(fromPosition, toPosition);
......@@ -237,9 +230,16 @@ public class PrinterListActivity extends BaseActivity<PrintListPresenter> implem
// int position = adapterPosition - mRvPrintList.getHeaderCount();
}
});// 监听拖拽和侧滑删除,更新UI和数据源。
printListAdapter = new PrinterListAdapter(devicess, mContext);
mRvPrintList.setLayoutManager(new LinearLayoutManager(this));
//分割线
mRvPrintList.addItemDecoration(new DefaultItemDecoration(ContextCompat.getColor(this, R.color.line_color)));
mRvPrintList.setSwipeMenuCreator(mSwipeMenuCreator); // 菜单创建器。
mRvPrintList.setAdapter(printListAdapter);
} else {
printListAdapter.notifyData(deviceBeans);
printListAdapter.notifyData(devicess);
}
}
}
......@@ -2,6 +2,7 @@ ext.alwaysLib = true //虽然apply了cc-settings-2.gradle,但一直作为libra
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'org.greenrobot.greendao'
//apply plugin: 'android-aspectjx'
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......@@ -84,4 +85,6 @@ dependencies {
//陰影背景
// implementation 'com.github.Liberuman:ShadowDrawable:0.1'
api 'com.github.lihangleo2:ShadowLayout:2.1.6'
// implementation 'org.aspectj:aspectjrt:1.8.9'
api 'com.contrarywind:Android-PickerView:3.2.4'//時間選擇控件
}
//package com.gingersoft.gsa.cloud.aspectj;
//
//import java.lang.annotation.ElementType;
//import java.lang.annotation.Retention;
//import java.lang.annotation.RetentionPolicy;
//import java.lang.annotation.Target;
//
///**
// * Created by Wyh on 2020/2/29.
// */
//@Retention(RetentionPolicy.RUNTIME)
//@Target(ElementType.METHOD)
//public @interface SingleClick {
// /* 点击间隔时间 */
// long value() default 1000;
//}
//package com.gingersoft.gsa.cloud.aspectj;
//
//import android.view.View;
//
//import java.lang.reflect.Method;
//
///**
// * Created by Wyh on 2020/2/29.
// */
//@Aspect
//public class SingleClickAspect {
// private static final long DEFAULT_TIME_INTERVAL = 5000;
//
// /**
// * 定义切点,标记切点为所有被@SingleClick注解的方法
// * 注意:这里me.baron.test.annotation.SingleClick需要替换成
// * 你自己项目中SingleClick这个类的全路径哦
// */
// @Pointcut("execution(@com.gingersoft.gsa.cloud.aspectj.SingleClick * *(..))")
// public void methodAnnotated() {
// }
//
// /**
// * 定义一个切面方法,包裹切点方法
// */
// @Around("methodAnnotated()")
// public void aroundJoinPoint(ProceedingJoinPoint joinPoint) throws Throwable {
// // 取出方法的参数
// View view = null;
// for (Object arg : joinPoint.getArgs()) {
// if (arg instanceof View) {
// view = (View) arg;
// break;
// }
// }
// if (view == null) {
// return;
// }
// // 取出方法的注解
// MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
// Method method = methodSignature.getMethod();
// if (!method.isAnnotationPresent(SingleClick.class)) {
// return;
// }
// SingleClick singleClick = method.getAnnotation(SingleClick.class);
// // 判断是否快速点击
// if (!XClickUtil.isFastDoubleClick(view, singleClick.value())) {
// // 不是快速点击,执行原方法
// joinPoint.proceed();
// }
// }
//}
//package com.gingersoft.gsa.cloud.aspectj;
//
//import android.view.View;
//
///**
// * Created by Wyh on 2020/2/29.
// */
//public class XClickUtil {
// /**
// * 最近一次点击的时间
// */
// private static long mLastClickTime;
// /**
// * 最近一次点击的控件ID
// */
// private static int mLastClickViewId;
//
// /**
// * 是否是快速点击
// *
// * @param v 点击的控件
// * @param intervalMillis 时间间期(毫秒)
// * @return true:是,false:不是
// */
// public static boolean isFastDoubleClick(View v, long intervalMillis) {
// int viewId = v.getId();
// long time = System.currentTimeMillis();
// long timeInterval = Math.abs(time - mLastClickTime);
// if (timeInterval < intervalMillis && viewId == mLastClickViewId) {
// return true;
// } else {
// mLastClickTime = time;
// mLastClickViewId = viewId;
// return false;
// }
// }
//}
......@@ -140,6 +140,9 @@ public class PrintUtils {
* @return
*/
private static Bitmap getPrintBitmap(Context context, List<OrderDetail> foodList) {
if (foodList == null || foodList.size() <= 0) {
return null;
}
View view = LinearLayout.inflate(context, R.layout.print_layout_print, null);
TextView brandName = view.findViewById(R.id.tv_brand_name);
TextView restaurantName = view.findViewById(R.id.tv_restaurant_name);
......@@ -176,24 +179,18 @@ public class PrintUtils {
rvBillAmount.setLayoutManager(new LinearLayoutManager(context));
rvBillAmount.setAdapter(billAdapter);
}
if (OpenTableManage.getDefault().
getTableBean() != null) {
if (OpenTableManage.getDefault().getTableBean() != null) {
tableNum.setText(OpenTableManage.getDefault().getTableBean().getTableName());
people.setText(OpenTableManage.getDefault().getPeopleNumber() + "");
}
if (MyOrderManage.getInstance().
getOrderId() != -1) {
if (MyOrderManage.getInstance().getOrderId() != -1) {
orderNum.setText(MyOrderManage.getInstance().getOrderId() + "");
}
BigDecimal totalAmount = new BigDecimal(0);
for (
OrderDetail OrderDetail : MyOrderManage.getInstance().
getOrderFoodList()) {
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(OrderDetail.getUnit_price(), OrderDetail.getNumber()));
for (OrderDetail OrderDetail : foodList) {
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(OrderDetail.getPrice(), OrderDetail.getNumber()));
}
//總金額
mTvTotalAmount.setText(totalAmount + "");
......@@ -213,6 +210,11 @@ public class PrintUtils {
* @return
*/
private static Bitmap getPrintBillBitmap(Context context) {
List<OrderDetail> foodList = MyOrderManage.getInstance().getOrderFoodList();
TableBean.DataBean tableBean = OpenTableManage.getDefault().getTableBean();
if (foodList == null || foodList.size() <= 0 || tableBean == null) {
return null;
}
View view = LinearLayout.inflate(context, R.layout.print_layout_print_bill, null);
TextView brandName = view.findViewById(R.id.tv_brand_name);
TextView restaurantName = view.findViewById(R.id.tv_restaurant_name);
......@@ -228,8 +230,6 @@ public class PrintUtils {
TextView line_food_info = view.findViewById(R.id.line_food_info);
RecyclerView rvPayType = view.findViewById(R.id.rv_print_pay_type);//顯示支付方式
List<OrderDetail> foodList = MyOrderManage.getInstance().getOrderFoodList();
TableBean.DataBean tableBean = OpenTableManage.getDefault().getTableBean();
tableNum.setText(tableBean.getTableName());
people.setText(OpenTableManage.getDefault().getPeopleNumber() + "");
......@@ -263,7 +263,7 @@ public class PrintUtils {
BigDecimal totalAmount = new BigDecimal(0);
for (OrderDetail OrderDetail : MyOrderManage.getInstance().getOrderFoodList()) {
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(OrderDetail.getUnit_price(), OrderDetail.getNumber()));
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(OrderDetail.getPrice(), OrderDetail.getNumber()));
}
//總金額
mTvTotalAmount.setText(totalAmount + "");
......@@ -286,6 +286,9 @@ public class PrintUtils {
* @return
*/
private static Bitmap getKitChenPrintBitmap(Context context, List<OrderDetail> foodList) {
if (foodList == null || foodList.size() <= 0) {
return null;
}
View view = LinearLayout.inflate(context, R.layout.print_kitchen, null);
TextView tvTableNumber = view.findViewById(R.id.tv_kitchen_print_table_number);
TextView tvOpeningTime = view.findViewById(R.id.tv_opening_time);
......
package com.gingersoft.gsa.cloud.base.utils.constans;
/**
* Created by Wyh on 2019/12/21.
*/
public class Constans {
//默認打印方式
public final static String DEFAULT_PRINT_METHOD = "default_print";
public final static String LOCAL_PRINT = "local_print";
public final static String IP_PRINT = "ip_print";
}
......@@ -5,8 +5,8 @@ package com.gingersoft.gsa.cloud.base.utils.constans;
*/
public class HttpsConstans {
// public static String ROOT_SERVER_ADDRESS_FORMAL = "http://gingersoft.tpddns.cn:58201/ricepon-cloud-gsa/api/";// 深圳服务器
public static String ROOT_SERVER_ADDRESS_FORMAL = "http://a.ricepon.com:58201/ricepon-cloud-gsa/api/";// 香港服务器
public static String ROOT_SERVER_ADDRESS_FORMAL = "http://gingersoft.tpddns.cn:58201/ricepon-cloud-gsa/api/";// 深圳服务器
// public static String ROOT_SERVER_ADDRESS_FORMAL = "http://a.ricepon.com:58201/ricepon-cloud-gsa/api/";// 香港服务器
public static String ROOT_SERVER_ADDRESS_FORMAL2 = "http://gingersoft.tpddns.cn:53000/mock/49/ricepon-cloud-gsa/api/";//測試服務器
......
......@@ -4,6 +4,9 @@ package com.gingersoft.gsa.cloud.base.utils.constans;
* Created by Wyh on 2019/12/21.
*/
public class UserConstans {
public final static String LOGIN_USERNAME = "login_account";
public final static String LOGIN_PASSWORD = "login_password";
public static String memberId = "member_id";
public static String memberName = "member_name";
......
package com.gingersoft.gsa.cloud.base.utils.time;
import android.content.Context;
import android.graphics.Color;
import com.bigkoo.pickerview.TimePickerView;
import java.util.Calendar;
/**
* Created by Wyh on 2020/2/28.
* 時間選擇工具類
*/
public class TimePickerUtils {
/**
* 顯示報表頁面時間選擇樣式
* @param mContext
* @param defaultTime 默認選中時間
* @param onTimeSelectListener 選中時間回調
*/
public static void showReportTimePicker(Context mContext, Calendar defaultTime, TimePickerView.OnTimeSelectListener onTimeSelectListener) {
//獲取今年第一天的日期
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_YEAR, cal.getActualMinimum(Calendar.DAY_OF_YEAR));
//打開時間選擇器
TimePickerView pvTime = new TimePickerView.Builder(mContext, onTimeSelectListener)
.setType(TimePickerView.Type.YEAR_MONTH_DAY)//默认全部显示
.setCancelText("取消")//取消按钮文字
.setSubmitText("確認")//确认按钮文字
.setContentSize(20)//滚轮文字大小
.setTitleSize(20)//标题文字大小
// .setTitleText("请选择时间")//标题文字
.setOutSideCancelable(true)//点击屏幕,点在控件外部范围时,是否取消显示
.isCyclic(false)//是否循环滚动
.setTextColorCenter(Color.BLACK)//设置选中项的颜色
.setTitleColor(Color.BLACK)//标题文字颜色
.setSubmitColor(Color.BLUE)//确定按钮文字颜色
.setCancelColor(Color.BLUE)//取消按钮文字颜色
// .setTitleBgColor(0xFF666666)//标题背景颜色 Night mode
// .setBgColor(0xFF333333)//滚轮背景颜色 Night mode
.setRange(Calendar.getInstance().get(Calendar.YEAR), Calendar.getInstance().get(Calendar.YEAR))
// .setDate(selectedDate)// 如果不设置的话,默认是系统时间*/
.setRangDate(cal, Calendar.getInstance())//時間是今年第一天到今天
.setLabel("", "", "", "", "", "")
.isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。
// .isDialog(true)//是否显示为对话框样式
.build();
//設置默認選中時間
pvTime.setDate(defaultTime);//注:根据需求来决定是否使用该方法(一般是精确到秒的情况),此项可以在弹出选择器的时候重新设置当前时间,避免在初始化之后由于时间已经设定,导致选中时间与当前时间不匹配的问题。
pvTime.show();
}
}
......@@ -18,6 +18,16 @@ public class TimeUtils {
public static final SimpleDateFormat DEFAULT_DATE_MDHM = new SimpleDateFormat("MM-dd HH:mm");//, Locale.CHINESE
public static final SimpleDateFormat DEFAULT_DATE_MD = new SimpleDateFormat("MM-dd");
public static final SimpleDateFormat DEFAULT_DATE_Y = new SimpleDateFormat("yyyy-");
public static final SimpleDateFormat DATE_Y = new SimpleDateFormat("yyyy");
/**
* 獲得今年第一天的日期
* cal.set(Calendar.DAY_OF_YEAR, cal.getActualMinimum(Calendar.DAY_OF_YEAR));
* 獲得今年最後一天的日期
* cal.set(Calendar.DAY_OF_YEAR, cal.getActualMaximum(Calendar.DAY_OF_YEAR));
*
*/
/**
* 时间日期格式化到年月日.
......@@ -52,7 +62,9 @@ public class TimeUtils {
calendar.add(Calendar.DAY_OF_MONTH, -1);//往上推一天
return simpleDateFormat.format(calendar.getTime());
}
public static String getTime(Date date) {//可根据需要自行截取数据显示
return DATE_FORMAT_DATE.format(date);
}
/**
* long time to string
*
......@@ -113,7 +125,6 @@ public class TimeUtils {
}
return sf.format(endDate);
}
/**
* 获取前n天日期、后n天日期
*
......
......@@ -23,14 +23,14 @@ public class PrinterDeviceBean implements Serializable {
private Integer restaurantId;
private String ip;
private int port;
private Integer port;
private int type;
@Generated(hash = 626885316)
public PrinterDeviceBean() {
}
public PrinterDeviceBean(int id, Integer restaurantId, String ip, int port, int type) {
public PrinterDeviceBean(int id, Integer restaurantId, String ip, Integer port, int type) {
this.id = id;
this.restaurantId = restaurantId;
this.ip = ip;
......@@ -39,15 +39,15 @@ public class PrinterDeviceBean implements Serializable {
}
public PrinterDeviceBean(Integer restaurantId, String ip, int port, int type) {
public PrinterDeviceBean(Integer restaurantId, String ip, Integer port, int type) {
this.restaurantId = restaurantId;
this.ip = ip;
this.port = port;
this.type = type;
}
@Generated(hash = 2111154422)
public PrinterDeviceBean(int id, Long dbid, Integer restaurantId, String ip, int port,
@Generated(hash = 1970016969)
public PrinterDeviceBean(int id, Long dbid, Integer restaurantId, String ip, Integer port,
int type) {
this.id = id;
this.dbid = dbid;
......@@ -85,11 +85,11 @@ public class PrinterDeviceBean implements Serializable {
this.ip = ip;
}
public int getPort() {
public Integer getPort() {
return this.port;
}
public void setPort(int port) {
public void setPort(Integer port) {
this.port = port;
}
......
......@@ -28,7 +28,7 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
public final static Property Dbid = new Property(1, Long.class, "dbid", true, "_id");
public final static Property RestaurantId = new Property(2, Integer.class, "restaurantId", false, "RESTAURANT_ID");
public final static Property Ip = new Property(3, String.class, "ip", false, "IP");
public final static Property Port = new Property(4, int.class, "port", false, "PORT");
public final static Property Port = new Property(4, Integer.class, "port", false, "PORT");
public final static Property Type = new Property(5, int.class, "type", false, "TYPE");
}
......@@ -49,7 +49,7 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 1: dbid
"\"RESTAURANT_ID\" INTEGER," + // 2: restaurantId
"\"IP\" TEXT," + // 3: ip
"\"PORT\" INTEGER NOT NULL ," + // 4: port
"\"PORT\" INTEGER," + // 4: port
"\"TYPE\" INTEGER NOT NULL );"); // 5: type
}
......@@ -78,7 +78,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
if (ip != null) {
stmt.bindString(4, ip);
}
stmt.bindLong(5, entity.getPort());
Integer port = entity.getPort();
if (port != null) {
stmt.bindLong(5, port);
}
stmt.bindLong(6, entity.getType());
}
......@@ -101,7 +105,11 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
if (ip != null) {
stmt.bindString(4, ip);
}
stmt.bindLong(5, entity.getPort());
Integer port = entity.getPort();
if (port != null) {
stmt.bindLong(5, port);
}
stmt.bindLong(6, entity.getType());
}
......@@ -117,7 +125,7 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // dbid
cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2), // restaurantId
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // ip
cursor.getInt(offset + 4), // port
cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4), // port
cursor.getInt(offset + 5) // type
);
return entity;
......@@ -129,7 +137,7 @@ public class PrinterDeviceBeanDao extends AbstractDao<PrinterDeviceBean, Long> {
entity.setDbid(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1));
entity.setRestaurantId(cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2));
entity.setIp(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setPort(cursor.getInt(offset + 4));
entity.setPort(cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4));
entity.setType(cursor.getInt(offset + 5));
}
......
......@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.ui.adapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.base.R2;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader;
......@@ -11,6 +12,7 @@ import com.gingersoft.gsa.cloud.ui.view.BaseTextSection;
import com.qmuiteam.qmui.widget.section.QMUIDefaultStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUISection;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import androidx.annotation.NonNull;
import butterknife.BindView;
import butterknife.ButterKnife;
......
......@@ -14,6 +14,7 @@ import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import com.gingersoft.gsa.cloud.base.R;
......@@ -246,6 +247,12 @@ public class ChooseRestaurantDialog extends Dialog {
mSectionLayout = view.findViewById(R.id.section_layout);
mTopBar = view.findViewById(R.id.topbar);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) mSectionLayout.getRecyclerView().getLayoutParams();
// layoutParams.height = (int) DeviceUtils.getScreenHeight(mContext);
layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin, layoutParams.rightMargin, mContext.getResources().getDimensionPixelOffset(R.dimen.head_height) / 2);
mSectionLayout.getRecyclerView().setLayoutParams(layoutParams);
initTopbar();
initStickyLayout();
return view;
......@@ -281,7 +288,7 @@ public class ChooseRestaurantDialog extends Dialog {
if (viewHolder.getTvName().getText() != null) {
SectionTextItem item = viewHolder.getSectionTextItem(position);
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClick(mDialog,item, position);
mOnItemClickListener.onItemClick(mDialog, item, position);
}
}
} else {
......@@ -342,7 +349,7 @@ public class ChooseRestaurantDialog extends Dialog {
public interface OnItemClickListener {
void onItemClick(ChooseRestaurantDialog dialog,SectionTextItem item, int position);
void onItemClick(ChooseRestaurantDialog dialog, SectionTextItem item, int position);
}
}
......
......@@ -219,7 +219,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/dp_5"
android:text="0"
app:layout_constraintBottom_toBottomOf="@id/tv_amount"
app:layout_constraintRight_toRightOf="parent"
......
......@@ -13,9 +13,10 @@
android:fitsSystemWindows="true"
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_height="match_parent"
android:descendantFocusability="blocksDescendants" />
</LinearLayout>
\ No newline at end of file
package com.gingersoft.gsa.cloud.ui.adapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.ui.R;
import com.gingersoft.gsa.cloud.ui.R2;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionItem;
import com.gingersoft.gsa.cloud.ui.view.BaseTextSection;
import com.qmuiteam.qmui.widget.section.QMUIDefaultStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUISection;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import androidx.annotation.NonNull;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-02-09
* 修订历史:2020-02-09
* 描述:
*/
public class ChooseRestaurantAdapter extends QMUIDefaultStickySectionAdapter<SectionHeader, SectionItem> {
@NonNull
@Override
protected QMUIStickySectionAdapter.ViewHolder onCreateSectionHeaderViewHolder(@NonNull ViewGroup viewGroup) {
return new QMUIStickySectionAdapter.ViewHolder(new BaseTextSection(viewGroup.getContext()));
}
@NonNull
@Override
protected ViewHolder onCreateSectionItemViewHolder(@NonNull ViewGroup viewGroup) {
return new ViewHolder(View.inflate(viewGroup.getContext(), R.layout.ui_item_base_text_section, null));
}
@Override
protected void onBindSectionHeader(QMUIStickySectionAdapter.ViewHolder holder, int position, QMUISection<SectionHeader, SectionItem> section) {
super.onBindSectionHeader(holder, position, section);
BaseTextSection itemView = (BaseTextSection) holder.itemView;
itemView.render(section.getHeader(), section.isFold());
}
@Override
protected void onBindSectionItem(QMUIStickySectionAdapter.ViewHolder holder, int position, QMUISection<SectionHeader, SectionItem> section, int itemIndex) {
super.onBindSectionItem(holder, position, section, itemIndex);
ViewHolder viewHolder = (ViewHolder) holder;
viewHolder.tvFun.setText(section.getItemAt(itemIndex).getText());
}
public class ViewHolder extends QMUIStickySectionAdapter.ViewHolder {
@BindView(R2.id.tv_name)
TextView tvFun;//功能名
public ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
public TextView getTvFun() {
return tvFun;
}
}
}
package com.gingersoft.gsa.cloud.ui.adapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.ui.R;
import com.gingersoft.gsa.cloud.ui.R2;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionImageItem;
import com.gingersoft.gsa.cloud.ui.view.BaseTextSection;
import com.qmuiteam.qmui.widget.section.QMUIDefaultStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUISection;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import androidx.annotation.NonNull;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-02-09
* 修订历史:2020-02-09
* 描述:
*/
public class BasTextSectiontAdapter extends QMUIDefaultStickySectionAdapter<SectionHeader, SectionImageItem> {
@NonNull
@Override
protected QMUIStickySectionAdapter.ViewHolder onCreateSectionHeaderViewHolder(@NonNull ViewGroup viewGroup) {
return new QMUIStickySectionAdapter.ViewHolder(new BaseTextSection(viewGroup.getContext()));
}
@NonNull
@Override
protected ViewHolder onCreateSectionItemViewHolder(@NonNull ViewGroup viewGroup) {
return new ViewHolder(View.inflate(viewGroup.getContext(), R.layout.ui_item_base_text_section, null));
}
@Override
protected void onBindSectionHeader(QMUIStickySectionAdapter.ViewHolder holder, int position, QMUISection<SectionHeader, SectionImageItem> section) {
super.onBindSectionHeader(holder, position, section);
BaseTextSection itemView = (BaseTextSection) holder.itemView;
itemView.render(section.getHeader(), section.isFold());
}
@Override
protected void onBindSectionItem(QMUIStickySectionAdapter.ViewHolder holder, int position, QMUISection<SectionHeader, SectionImageItem> section, int itemIndex) {
super.onBindSectionItem(holder, position, section, itemIndex);
ViewHolder viewHolder = (ViewHolder) holder;
viewHolder.tv_name.setText(section.getItemAt(itemIndex).getText());
}
public class ViewHolder extends QMUIStickySectionAdapter.ViewHolder {
@BindView(R2.id.tv_name)
TextView tv_name;//功能名
public ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
public TextView getTvName() {
return tv_name;
}
}
}
package com.gingersoft.gsa.cloud.user.login.mvp.bean;
import java.util.List;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2019-12-28
* 修订历史:2019-12-28
* 描述:
*/
public class LoginBean {
/**
* success : true
* sysTime : 1578563902000
* data : {"user":{"userId":1,"userName":"admin","brands":[{"brandId":242,"brandName":"莫拉塔","restaurants":[]},{"brandId":243,"brandName":"蕭蕭","restaurants":[{"restaurantId":337,"restaurantName":"小張"}]}]},"token":"24ce30df203b41619a21967dbd9988b9"}
*/
private boolean success;
private String errMsg;
private long sysTime;
private DataBean data;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public long getSysTime() {
return sysTime;
}
public void setSysTime(long sysTime) {
this.sysTime = sysTime;
}
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean {
/**
* user : {"userId":1,"userName":"admin","brands":[{"brandId":242,"brandName":"莫拉塔","restaurants":[]},{"brandId":243,"brandName":"蕭蕭","restaurants":[{"restaurantId":337,"restaurantName":"小張"}]}]}
* token : 24ce30df203b41619a21967dbd9988b9
*/
private UserBean user;
private String token;
public UserBean getUser() {
return user;
}
public void setUser(UserBean user) {
this.user = user;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public static class UserBean {
/**
* userId : 1
* userName : admin
* brands : [{"brandId":242,"brandName":"莫拉塔","restaurants":[]},{"brandId":243,"brandName":"蕭蕭","restaurants":[{"restaurantId":337,"restaurantName":"小張"}]}]
*/
private int userId;
private String userName;
private List<BrandsBean> brands;
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public List<BrandsBean> getBrands() {
return brands;
}
public void setBrands(List<BrandsBean> brands) {
this.brands = brands;
}
public static class BrandsBean {
/**
* brandId : 242
* brandName : 莫拉塔
* restaurants : []
*/
private int brandId;
private String brandName;
private List<RestaurantsBean> restaurants;
public int getBrandId() {
return brandId;
}
public void setBrandId(int brandId) {
this.brandId = brandId;
}
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public List<RestaurantsBean> getRestaurants() {
return restaurants;
}
public void setRestaurants(List<RestaurantsBean> restaurants) {
this.restaurants = restaurants;
}
public static class RestaurantsBean {
private int restaurantId;
private String restaurantName;
public int getRestaurantId() {
return restaurantId;
}
public void setRestaurantId(int restaurantId) {
this.restaurantId = restaurantId;
}
public String getRestaurantName() {
return restaurantName;
}
public void setRestaurantName(String restaurantName) {
this.restaurantName = restaurantName;
}
}
}
}
}
}
/*
* 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.bean;
import com.qmuiteam.qmui.widget.section.QMUISection.Model;
import java.util.Objects;
public class SectionHeader implements Model<SectionHeader> {
private final String text;
public SectionHeader(String text){
this.text = text;
}
public String getText() {
return text;
}
@Override
public SectionHeader cloneForDiff() {
return new SectionHeader(getText());
}
@Override
public boolean isSameItem(SectionHeader other) {
return Objects.equals(text, other.text);
}
@Override
public boolean isSameContent(SectionHeader other) {
return true;
}
}
package com.gingersoft.gsa.cloud.ui.bean.view;
import com.qmuiteam.qmui.widget.section.QMUISection.Model;
import java.util.Objects;
public class SectionItem implements Model<SectionItem> {
private int image;
private String text;
public SectionItem(int image, String text) {
this.image = image;
this.text = text;
}
public String getText() {
return text;
}
public int getImage() {
return image;
}
@Override
public SectionItem cloneForDiff() {
return new SectionItem(getImage(), getText());
}
@Override
public boolean isSameItem(SectionItem other) {
return Objects.equals(text, other.text);
}
@Override
public boolean isSameContent(SectionItem other) {
return true;
}
}
package com.gingersoft.gsa.cloud.ui.bean.view;
import com.qmuiteam.qmui.widget.section.QMUISection.Model;
import java.util.Objects;
public class SectionImageItem implements Model<SectionImageItem> {
private int image;
private String text;
public SectionImageItem(int image, String text) {
this.image = image;
this.text = text;
}
public String getText() {
return text;
}
public int getImage() {
return image;
}
@Override
public SectionImageItem cloneForDiff() {
return new SectionImageItem(getImage(), getText());
}
@Override
public boolean isSameItem(SectionImageItem other) {
return Objects.equals(text, other.text);
}
@Override
public boolean isSameContent(SectionImageItem other) {
return true;
}
}
package com.gingersoft.gsa.cloud.ui.bean.view;
import com.qmuiteam.qmui.widget.section.QMUISection.Model;
import java.util.Objects;
public class SectionImageItem implements Model<SectionImageItem> {
private int image;
private String text;
public SectionImageItem(int image, String text) {
this.image = image;
this.text = text;
}
public String getText() {
return text;
}
public int getImage() {
return image;
}
@Override
public SectionImageItem cloneForDiff() {
return new SectionImageItem(getImage(), getText());
}
@Override
public boolean isSameItem(SectionImageItem other) {
return Objects.equals(text, other.text);
}
@Override
public boolean isSameContent(SectionImageItem other) {
return true;
}
}
package com.gingersoft.gsa.cloud.ui.bean;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2018/11/27
* 修订历史:2018/11/27
* 描述:
*/
public class TagViewBean {
private boolean checked = false;
private String tagName;
private int id;
public TagViewBean(boolean checked, String tagName, int id) {
this.checked = checked;
this.tagName = tagName;
this.id = id;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public String getTagName() {
return tagName;
}
public void setTagName(String tagName) {
this.tagName = tagName;
}
}
package com.gingersoft.gsa.cloud.ui.view;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.ui.R;
import com.gingersoft.gsa.cloud.ui.bean.SectionHeader;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import androidx.annotation.Nullable;
/**
* Created by Wyh on 2020/1/10.
*/
public class BaseTextSectionAdapter extends LinearLayout {
private TextView mTitleTv;
public BaseTextSectionAdapter(Context context) {
this(context, null);
}
public BaseTextSectionAdapter(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
setOrientation(LinearLayout.HORIZONTAL);
setGravity(Gravity.CENTER_VERTICAL);
setBackgroundColor(Color.WHITE);
int paddingHor = QMUIDisplayHelper.dp2px(context, 5);
int paddingVer = QMUIDisplayHelper.dp2px(context, 5);
mTitleTv = new TextView(getContext());
mTitleTv.setTextSize(14);
mTitleTv.setTypeface(Typeface.DEFAULT_BOLD);
mTitleTv.setTextColor(getColor(context, R.color.theme_color));
mTitleTv.setPadding(paddingHor, paddingVer, paddingHor, paddingVer);
addView(mTitleTv, new LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
setBackgroundColor(getColor(context, R.color.main_home_function_head_bg));
}
private int getColor(Context context, int colorId) {
return context.getResources().getColor(colorId);
}
// public ImageView getArrowView() {
// return mArrowView;
// }
public void render(SectionHeader header, boolean isFold) {
mTitleTv.setText(header.getText());
}
//
// @Override
// protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(headerHeight, MeasureSpec.EXACTLY));
// }
}
\ No newline at end of file
package com.elegant.bin.gsa.mvp.base.ui.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import com.elegant.bin.gsa.R;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-02-02
* 修订历史:2020-02-02
* 描述:
*/
public class MaxHeightRecyclerView extends RecyclerView {
private int mMaxHeight;
public MaxHeightRecyclerView(Context context) {
super(context);
}
public MaxHeightRecyclerView(Context context, AttributeSet attrs) {
super(context, attrs);
initialize(context, attrs);
}
public MaxHeightRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initialize(context, attrs);
}
private void initialize(Context context, AttributeSet attrs) {
TypedArray arr = context.obtainStyledAttributes(attrs, R.styleable.MaxHeightRecyclerView);
mMaxHeight = arr.getLayoutDimension(R.styleable.MaxHeightRecyclerView_maxHeight, mMaxHeight);
arr.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mMaxHeight > 0) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(mMaxHeight, MeasureSpec.AT_MOST);
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
package com.gingersoft.gsa.cloud.table.mvp.ui.widget.customstatus;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import com.gingersoft.gsa.cloud.table.R;
import androidx.core.content.ContextCompat;
/**
*
*/
public class CustomStatusView extends View {
private int progressColor; //进度颜色
private int loadSuccessColor; //成功的颜色
private int loadFailureColor; //失败的颜色
private float progressWidth; //进度宽度
private float progressRadius; //圆环半径
private Paint mPaint;
private StatusEnum mStatus; //状态
private int startAngle = -90;
private int minAngle = -90;
private int sweepAngle = 120;
private int curAngle = 0;
//追踪Path的坐标
private PathMeasure mPathMeasure;
//画圆的Path
private Path mPathCircle;
//截取PathMeasure中的path
private Path mPathCircleDst;
private Path successPath;
private Path failurePathLeft;
private Path failurePathRight;
private ValueAnimator circleAnimator;
private float circleValue;
private float successValue;
private float failValueRight;
private float failValueLeft;
public CustomStatusView(Context context) {
this(context, null);
}
public CustomStatusView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CustomStatusView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray array = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CustomStatusView, defStyleAttr, 0);
progressColor = array.getColor(R.styleable.CustomStatusView_progress_color, ContextCompat.getColor(context, R.color.colorPrimary));
loadSuccessColor = array.getColor(R.styleable.CustomStatusView_load_success_color, ContextCompat.getColor(context, R.color.pay_load_success));
loadFailureColor = array.getColor(R.styleable.CustomStatusView_load_failure_color, ContextCompat.getColor(context, R.color.pay_load_failure));
progressWidth = array.getDimension(R.styleable.CustomStatusView_progress_width, 6);
progressRadius = array.getDimension(R.styleable.CustomStatusView_progress_radius, 100);
array.recycle();
initPaint();
initPath();
initAnim();
}
private void initPaint() {
mPaint = new Paint();
mPaint.setColor(progressColor);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setDither(true);
mPaint.setAntiAlias(true);
mPaint.setStrokeWidth(progressWidth);
mPaint.setStrokeCap(Paint.Cap.ROUND); //设置画笔为圆角笔触
}
private void initPath() {
mPathCircle = new Path();
mPathMeasure = new PathMeasure();
mPathCircleDst = new Path();
successPath = new Path();
failurePathLeft = new Path();
failurePathRight = new Path();
}
private void initAnim() {
circleAnimator = ValueAnimator.ofFloat(0, 1);
circleAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
circleValue = (float) animation.getAnimatedValue();
invalidate();
}
});
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.translate(getPaddingLeft(), getPaddingTop()); //将当前画布的点移到getPaddingLeft,getPaddingTop,后面的操作都以该点作为参照点
if (mStatus == StatusEnum.Loading) { //正在加载
mPaint.setColor(progressColor);
if (startAngle == minAngle) {
sweepAngle += 6;
}
if (sweepAngle >= 300 || startAngle > minAngle) {
startAngle += 6;
if (sweepAngle > 20) {
sweepAngle -= 6;
}
}
if (startAngle > minAngle + 300) {
startAngle %= 360;
minAngle = startAngle;
sweepAngle = 20;
}
canvas.rotate(curAngle += 4, progressRadius, progressRadius); //旋转的弧长为4
canvas.drawArc(new RectF(0, 0, progressRadius * 2, progressRadius * 2), startAngle, sweepAngle, false, mPaint);
invalidate();
} else if (mStatus == StatusEnum.LoadSuccess) { //加载成功
mPaint.setColor(loadSuccessColor);
mPathCircle.addCircle(getWidth() / 2, getWidth() / 2, progressRadius, Path.Direction.CW);
mPathMeasure.setPath(mPathCircle, false);
mPathMeasure.getSegment(0, circleValue * mPathMeasure.getLength(), mPathCircleDst, true); //截取path并保存到mPathCircleDst中
canvas.drawPath(mPathCircleDst, mPaint);
if (circleValue == 1) { //表示圆画完了,可以钩了
successPath.moveTo(getWidth() / 8 * 3, getWidth() / 2);
successPath.lineTo(getWidth() / 2, getWidth() / 5 * 3);
successPath.lineTo(getWidth() / 3 * 2, getWidth() / 5 * 2);
mPathMeasure.nextContour();
mPathMeasure.setPath(successPath, false);
mPathMeasure.getSegment(0, successValue * mPathMeasure.getLength(), mPathCircleDst, true);
canvas.drawPath(mPathCircleDst, mPaint);
}
} else { //加载失败
mPaint.setColor(loadFailureColor);
mPathCircle.addCircle(getWidth() / 2, getWidth() / 2, progressRadius, Path.Direction.CW);
mPathMeasure.setPath(mPathCircle, false);
mPathMeasure.getSegment(0, circleValue * mPathMeasure.getLength(), mPathCircleDst, true);
canvas.drawPath(mPathCircleDst, mPaint);
if (circleValue == 1) { //表示圆画完了,可以画叉叉的右边部分
failurePathRight.moveTo(getWidth() / 3 * 2, getWidth() / 3);
failurePathRight.lineTo(getWidth() / 3, getWidth() / 3 * 2);
mPathMeasure.nextContour();
mPathMeasure.setPath(failurePathRight, false);
mPathMeasure.getSegment(0, failValueRight * mPathMeasure.getLength(), mPathCircleDst, true);
canvas.drawPath(mPathCircleDst, mPaint);
}
if (failValueRight == 1) { //表示叉叉的右边部分画完了,可以画叉叉的左边部分
failurePathLeft.moveTo(getWidth() / 3, getWidth() / 3);
failurePathLeft.lineTo(getWidth() / 3 * 2, getWidth() / 3 * 2);
mPathMeasure.nextContour();
mPathMeasure.setPath(failurePathLeft, false);
mPathMeasure.getSegment(0, failValueLeft * mPathMeasure.getLength(), mPathCircleDst, true);
canvas.drawPath(mPathCircleDst, mPaint);
}
}
}
//重制路径
private void resetPath() {
successValue = 0;
circleValue = 0;
failValueLeft = 0;
failValueRight = 0;
mPathCircle.reset();
mPathCircleDst.reset();
failurePathLeft.reset();
failurePathRight.reset();
successPath.reset();
}
private void setStatus(StatusEnum status) {
mStatus = status;
}
public void loadLoading() {
resetPath();
setStatus(StatusEnum.Loading);
invalidate();
}
public void loadSuccess() {
resetPath();
setStatus(StatusEnum.LoadSuccess);
startSuccessAnim();
}
public void loadFailure() {
resetPath();
setStatus(StatusEnum.LoadFailure);
startFailAnim();
}
private void startSuccessAnim() {
ValueAnimator success = ValueAnimator.ofFloat(0f, 1.0f);
success.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
successValue = (float) animation.getAnimatedValue();
invalidate();
}
});
//组合动画,一先一后执行
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(success).after(circleAnimator);
animatorSet.setDuration(500);
animatorSet.start();
}
private void startFailAnim() {
ValueAnimator failLeft = ValueAnimator.ofFloat(0f, 1.0f);
failLeft.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
failValueRight = (float) animation.getAnimatedValue();
invalidate();
}
});
ValueAnimator failRight = ValueAnimator.ofFloat(0f, 1.0f);
failRight.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
failValueLeft = (float) animation.getAnimatedValue();
invalidate();
}
});
//组合动画,一先一后执行
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(failLeft).after(circleAnimator).before(failRight);
animatorSet.setDuration(500);
animatorSet.start();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width;
int height;
int mode = MeasureSpec.getMode(widthMeasureSpec);
int size = MeasureSpec.getSize(widthMeasureSpec);
if (mode == MeasureSpec.EXACTLY) {
width = size;
} else {
width = (int) (2 * progressRadius + progressWidth + getPaddingLeft() + getPaddingRight());
}
mode = MeasureSpec.getMode(heightMeasureSpec);
size = MeasureSpec.getSize(heightMeasureSpec);
if (mode == MeasureSpec.EXACTLY) {
height = size;
} else {
height = (int) (2 * progressRadius + progressWidth + getPaddingTop() + getPaddingBottom());
}
setMeasuredDimension(width, height);
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.table.mvp.ui.widget.customstatus;
/**
*
*/
public enum StatusEnum {
Loading,
LoadSuccess,
LoadFailure
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.table.mvp.ui.widget;
import android.app.Activity;
import android.app.Dialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.elegant.bin.gsa.R;
import com.elegant.bin.gsa.app.payment.PayConstant;
import com.elegant.bin.gsa.app.utils.LanguageUtils;
import com.elegant.bin.gsa.mvp.main.ui.widget.customstatus.CustomStatusView;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.ThirdViewUtil;
import butterknife.BindView;
public class StatusLoadingDialog {
private Activity mContext;
private Dialog dialog;
@BindView(R.id.ll_container)
LinearLayout ll_container;
@BindView(R.id.as_status)
CustomStatusView as_status;
@BindView(R.id.tv_status)
TextView tv_status;
//操作类型:1、支付 2、退款
public static final int SALE_LOADING = 1;
public static final int REFUND_LOADING = 2;
public static final int VOID_LOADING = 3;
private int opeatType = SALE_LOADING;
private String loadingText;
public StatusLoadingDialog(Activity context) {
this.mContext = context;
this.loadingText = LanguageUtils.get_language_system(mContext, "pay", "支付");
initView();
}
private void initView() {
View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_pay_loading, null);
ThirdViewUtil.bindTarget(this, view);
// 定义Dialog布局和参数
dialog = new Dialog(mContext, R.style.loading_dialog);
dialog.setContentView(view);
dialog.setCancelable(false);
ll_container.setLayoutParams(new FrameLayout.LayoutParams((int) (ArmsUtils.getScreenWidth(mContext) * 0.4), (int) (ArmsUtils.getScreenWidth(mContext) * 0.4)));
}
public StatusLoadingDialog builder() {
return this;
}
public void loadLoading() {
as_status.loadLoading();
}
public void loadSuccess() {
setStatusText(loadingText + LanguageUtils.get_language_system(mContext, "success", "成功"));
as_status.loadSuccess();
as_status.postDelayed(new Runnable() {
@Override
public void run() {
if (mOnClickListener != null) {
mOnClickListener.loadSuccessEnd();
}
cancel();
}
}, 1000);
}
public void loadFailure(String stauts) {
switch (stauts) {
case "100"://生成訂單失敗
setStatusText(LanguageUtils.get_language_system(mContext, "generate.order.failed", "生成訂單失敗"));
break;
//N5支付返回狀態
case PayConstant.PAY_STATUS_03:
setStatusText(LanguageUtils.get_language_system(mContext, "confirm.or.handle", "确认/处理"));
break;
case PayConstant.PAY_STATUS_09:
setStatusText(LanguageUtils.get_language_system(mContext, "cancelled", "已取消"));
break;
case PayConstant.PAY_STATUS_10:
setStatusText(LanguageUtils.get_language_system(mContext, "moderator.rejected", "主持人拒絕"));
break;
case PayConstant.PAY_STATUS_11:
setStatusText(LanguageUtils.get_language_system(mContext, "revoked", "已撤銷"));
break;
case PayConstant.PAY_STATUS_12:
setStatusText(LanguageUtils.get_language_system(mContext, "transaction.has.been.cancelled.or.completed", "交易有已经作废/已完成"));
break;
case PayConstant.PAY_STATUS_13:
setStatusText(LanguageUtils.get_language_system(mContext,"no.related.orders.found","找不到相關訂單"));
break;
case PayConstant.PAY_STATUS_90: //交易通訊格式有誤
case PayConstant.PAY_STATUS_91: //功能或 付款方式没有 支持的
case PayConstant.PAY_STATUS_99://未知错误
setStatusText(loadingText + LanguageUtils.get_language_system(mContext,"failed","失敗"));
break;
case PayConstant.PAY_STATUS_98:
switch (opeatType) {
case SALE_LOADING:
setStatusText(LanguageUtils.get_language_system(mContext, "prompt.payment request.timed.out", "支付請求超時"));
break;
case REFUND_LOADING:
setStatusText(loadingText + LanguageUtils.get_language_system(mContext,"timeout","超時"));
break;
case VOID_LOADING:
setStatusText(LanguageUtils.get_language_system(mContext, "rompt.void request.timed.out", "取消請求超時"));
break;
}
break;
case PayConstant.PAY_STATUS_200:
setStatusText(loadingText);
break;
default:
setStatusText(loadingText + LanguageUtils.get_language_system(mContext,"success","成功"));
break;
}
as_status.loadFailure();
as_status.postDelayed(new Runnable() {
@Override
public void run() {
if (mOnClickListener != null) {
mOnClickListener.loadFailureEnd();
}
cancel();
}
}, 1000);
}
public void setLoadingText(String loadingText) {
this.loadingText = loadingText;
}
public void setOpeatType(int opeatType) {
this.opeatType = opeatType;
}
public void setStatusText(String text) {
tv_status.setText(text);
}
public void clearLoadingAnim() {
if (as_status != null && as_status.getAnimation() != null) {
as_status.clearAnimation();
}
}
public void show() {
if (dialog != null)
dialog.show();
loadLoading();
}
public void cancel() {
clearLoadingAnim();
if (dialog != null && dialog.isShowing())
dialog.cancel();
}
private OnLoadStautsListener mOnClickListener;
public void setOnLoadStautsListener(OnLoadStautsListener onClickListener) {
mOnClickListener = onClickListener;
}
public interface OnLoadStautsListener {
void loadSuccessEnd();
void loadFailureEnd();
}
}
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="餐檯模式"
android:textColor="@color/normal_color"
android:textSize="@dimen/sp_14">
</TextView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
<ImageView
android:id="@+id/iv_main_home_item_function_icon"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:src="@drawable/ic_dining_table" />
<TextView
android:id="@+id/tv_main_home_item_function_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="餐檯模式"
android:textColor="@color/normal_color"
android:textSize="@dimen/sp_14" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#398BED</color>
<color name="colorPrimaryDark">#398BED</color>
<color name="colorAccent">#2abbff</color>
<color name="itemSelected">#b0bec5</color>
<color name="mainSelected">#90a4ae</color>
<!--App主色调-->
<!-- <color name="theme_color">#BF1C42</color>-->
<color name="theme_color">#0099CC</color>
<color name="normal_color">#333333</color>
<!-- 首页报表“昨日”线条颜色-->
<color name="today_line">#FFCC8F</color>
<!-- 報表虛線顏色-->
<color name="report_dotted_line_color">#8CA0B3</color>
<!-- 報表左側刻度文字顏色-->
<color name="report_left_scale">#777</color>
<color name="theme_white_color">#FFFFFFFF</color>
<color name="theme_333_color">#333</color>
<color name="theme_grey_color">#747879</color> <!--灰色tag、字体 -->
<color name="theme_red_color">#ff2500</color> <!--红色强调 -->
<color name="theme_background_color">#EEEDEB</color> <!--页面背景色 -->
<color name="theme_click_blue_color">#2abbff</color> <!--按钮点击时颜色 -->
<color name="theme_transparent_white_color">#CCFFFFFF</color><!--透明白色背景 -->
<color name="theme_webview_progressbar_color">#e57c59</color>
<!-- 字体和hint颜色 -->
<color name="theme_text_color">#222222</color> <!--字体颜色 -->
<color name="theme_hint_color">#BBBBBB</color> <!--字体hint颜色 -->
<color name="theme_text_color_black">#444242</color><!-- 黑色-->
<color name="theme_text_pice_color">#ff531e</color>
<color name="theme_black">#000000</color> <!--顶部标题栏文字、图片颜色 -->
<color name="black">#000000</color> <!--顶部标题栏文字、图片颜色 -->
<color name="transparent">#aa000000</color>
<color name="trans">#00000000</color>
<color name="keyboard_normal">#006CB7</color>
<color name="keyboard_press">#005096</color>
<color name="keyboard_paybill_normal">#069683</color>
<color name="keyboard_paybill_press">#067878</color>
<color name="pay_load_success">#03a44e</color>
<color name="pay_load_failure">#de0e26</color>
<color name="Dark_grayish">#545454</color>
<color name="Dark_green">#238E23</color>
<color name="sky_blue">#3299CC</color>
<color name="Medium_slate_blue">#7F00FF</color>
<color name="Dark_Slate_Blue">#6B238E</color>
<color name="blue">#0000FF</color>
<color name="red">#FFFF0000</color>
<color name="green">#FF00FF00</color>
<color name="white">#FFFFFF</color>
<color name="gray">#ADAFC3</color>
<color name="Dark_Jade">#7093DB</color>
<color name="Neon_blue">#4D4DFF</color>
<color name="New_blue_night">#00009C</color>
<color name="dimgray">#696969</color>
<color name="Grass_green">#238E23</color>
<color name="yellow">#FFFF00</color>
<color name="Violet">#871F78</color>
<color name="chocolate">#d2691e</color>
<color name="Magenta">#FF00FF</color>
<color name="viewfinder_frame">#ff000000</color>
<color name="viewfinder_laser">#ffff0000</color>
<color name="viewfinder_mask">#60000000</color>
<color name="result_view">#b0000000</color>
<color name="possible_result_points">#c0ffff00</color>
<!-- ***********************QMUI********************** -->
<!-- common -->
<color name="app_color_blue">#00A8E1</color>
<color name="app_color_blue_disabled">#8000A8E1</color>
<color name="app_color_blue_pressed">#c000A8E1</color>
<color name="app_color_blue_2">#31BDF3</color>
<color name="app_color_blue_2_disabled">#7F31BDF3</color>
<color name="app_color_blue_2_pressed">#7F31BDF3</color>
<color name="app_color_blue_3">#EBF9FF</color>
<color name="app_color_blue_3_disabled">#7FEBF9FF</color>
<color name="app_color_blue_3_pressed">#7FEBF9FF</color>
<color name="app_color_theme_1">#EF5362</color> <!-- Grapefruit -->
<color name="app_color_theme_2">#FE6D4B</color> <!-- Bittersweet -->
<color name="app_color_theme_3">#FFCF47</color> <!-- Sunflower -->
<color name="app_color_theme_4">#9FD661</color> <!-- Grass -->
<color name="app_color_theme_5">#3FD0AD</color> <!-- Mint -->
<color name="app_color_theme_6">#2BBDF3</color> <!-- Aqua -->
<color name="app_color_theme_7">#5A9AEF</color> <!-- Blue Jeans -->
<color name="app_color_theme_8">#AC8FEF</color> <!-- Lavender -->
<color name="app_color_theme_9">#EE85C1</color> <!-- Pink Rose -->
<color name="app_color_description">@color/qmui_config_color_gray_5</color>
<color name="bar_divider">#D4D6D8</color>
<color name="tab_panel_bg">#ffffff</color>
<color name="tab_panel_divider">@color/bar_divider</color>
<!-- Components 组件 -->
<color name="radiusImageView_border_color">@color/app_color_theme_2</color>
<color name="radiusImageView_selected_border_color">@color/app_color_theme_1</color>
<color name="radiusImageView_selected_mask_color">#7FEF5362</color>
<!-- Helper 系列界面 -->
<!-- ColorHelper 颜色工具 -->
<color name="colorHelper_square_alpha_background">@color/app_color_theme_4</color>
<color name="colorHelper_square_from_ratio_background">@color/app_color_blue</color>
<color name="colorHelper_square_to_ratio_background">@color/app_color_theme_3</color>
<color name="pc_black_t_pic">#22000000</color>
<color name="alpha_05_white">#0DFFFFFF</color>
<color name="alpha_10_white">#1AFFFFFF</color>
<color name="alpha_15_white">#26FFFFFF</color>
<color name="alpha_20_white">#33FFFFFF</color>
<color name="alpha_25_white">#40FFFFFF</color>
<color name="alpha_30_white">#4DFFFFFF</color>
<color name="alpha_35_white">#59FFFFFF</color>
<color name="alpha_40_white">#66FFFFFF</color>
<color name="alpha_45_white">#73FFFFFF</color>
<color name="alpha_50_white">#80FFFFFF</color>
<color name="alpha_55_white">#8CFFFFFF</color>
<color name="alpha_60_white">#99FFFFFF</color>
<color name="alpha_65_white">#A6FFFFFF</color>
<color name="alpha_70_white">#B3FFFFFF</color>
<color name="alpha_75_white">#BFFFFFFF</color>
<color name="alpha_80_white">#CCFFFFFF</color>
<color name="alpha_85_white">#D9FFFFFF</color>
<color name="alpha_90_white">#E6FFFFFF</color>
<color name="alpha_95_white">#F2FFFFFF</color>
<color name="red_50">#fde0dc</color>
<color name="red_100">#f9bdbb</color>
<color name="red_200">#f69988</color>
<color name="red_300">#f36c60</color>
<color name="red_400">#e84e40</color>
<color name="red_500">#e51c23</color>
<color name="red_600">#dd191d</color>
<color name="red_700">#d01716</color>
<color name="red_800">#c41411</color>
<color name="red_900">#b0120a</color>
<color name="red_a100">#ff7997</color>
<color name="red_a200">#ff5177</color>
<color name="red_a400">#ff2d6f</color>
<color name="red_a700">#e00032</color>
<color name="pink_50">#fce4ec</color>
<color name="pink_100">#f8bbd0</color>
<color name="pink_200">#f48fb1</color>
<color name="pink_300">#f06292</color>
<color name="pink_400">#ec407a</color>
<color name="pink_500">#e91e63</color>
<color name="pink_600">#d81b60</color>
<color name="pink_700">#c2185b</color>
<color name="pink_800">#ad1457</color>
<color name="pink_900">#880e4f</color>
<color name="pink_a100">#ff80ab</color>
<color name="pink_a200">#ff4081</color>
<color name="pink_a400">#f50057</color>
<color name="pink_a700">#c51162</color>
<color name="purple_50">#f3e5f5</color>
<color name="purple_100">#e1bee7</color>
<color name="purple_200">#ce93d8</color>
<color name="purple_300">#ba68c8</color>
<color name="purple_400">#ab47bc</color>
<color name="purple_500">#9c27b0</color>
<color name="purple_600">#8e24aa</color>
<color name="purple_700">#7b1fa2</color>
<color name="purple_800">#6a1b9a</color>
<color name="purple_900">#4a148c</color>
<color name="purple_a100">#ea80fc</color>
<color name="purple_a200">#e040fb</color>
<color name="purple_a400">#d500f9</color>
<color name="purple_a700">#aa00ff</color>
<color name="deep_purple_50">#ede7f6</color>
<color name="deep_purple_100">#d1c4e9</color>
<color name="deep_purple_200">#b39ddb</color>
<color name="deep_purple_300">#9575cd</color>
<color name="deep_purple_400">#7e57c2</color>
<color name="deep_purple_500">#673ab7</color>
<color name="deep_purple_600">#5e35b1</color>
<color name="deep_purple_700">#512da8</color>
<color name="deep_purple_800">#4527a0</color>
<color name="deep_purple_900">#311b92</color>
<color name="deep_purple_a100">#b388ff</color>
<color name="deep_purple_a200">#7c4dff</color>
<color name="deep_purple_a400">#651fff</color>
<color name="deep_purple_a700">#6200ea</color>
<color name="indigo_50">#e8eaf6</color>
<color name="indigo_100">#c5cae9</color>
<color name="indigo_200">#9fa8da</color>
<color name="indigo_300">#7986cb</color>
<color name="indigo_400">#5c6bc0</color>
<color name="indigo_500">#3f51b5</color>
<color name="indigo_600">#3949ab</color>
<color name="indigo_700">#303f9f</color>
<color name="indigo_800">#283593</color>
<color name="indigo_900">#1a237e</color>
<color name="indigo_a100">#8c9eff</color>
<color name="indigo_a200">#536dfe</color>
<color name="indigo_a400">#3d5afe</color>
<color name="indigo_a700">#304ffe</color>
<color name="blue_50">#e7e9fd</color>
<color name="blue_100">#d0d9ff</color>
<color name="blue_200">#afbfff</color>
<color name="blue_300">#91a7ff</color>
<color name="blue_400">#738ffe</color>
<color name="blue_500">#5677fc</color>
<color name="blue_600">#4e6cef</color>
<color name="blue_700">#455ede</color>
<color name="blue_800">#3b50ce</color>
<color name="blue_900">#2a36b1</color>
<color name="blue_a100">#a6baff</color>
<color name="blue_a200">#6889ff</color>
<color name="blue_a400">#4d73ff</color>
<color name="blue_a700">#4d69ff</color>
<color name="light_blue_50">#e1f5fe</color>
<color name="light_blue_100">#b3e5fc</color>
<color name="light_blue_200">#81d4fa</color>
<color name="light_blue_300">#4fc3f7</color>
<color name="light_blue_400">#29b6f6</color>
<color name="light_blue_500">#03a9f4</color>
<color name="light_blue_600">#039be5</color>
<color name="light_blue_700">#0288d1</color>
<color name="light_blue_800">#0277bd</color>
<color name="light_blue_900">#01579b</color>
<color name="light_blue_a100">#80d8ff</color>
<color name="light_blue_a200">#40c4ff</color>
<color name="light_blue_a400">#00b0ff</color>
<color name="light_blue_a700">#0091ea</color>
<color name="cyan_50">#e0f7fa</color>
<color name="cyan_100">#b2ebf2</color>
<color name="cyan_200">#80deea</color>
<color name="cyan_300">#4dd0e1</color>
<color name="cyan_400">#26c6da</color>
<color name="cyan_500">#00bcd4</color>
<color name="cyan_600">#00acc1</color>
<color name="cyan_700">#0097a7</color>
<color name="cyan_800">#00838f</color>
<color name="cyan_900">#006064</color>
<color name="cyan_a100">#84ffff</color>
<color name="cyan_a200">#18ffff</color>
<color name="cyan_a400">#00e5ff</color>
<color name="cyan_a700">#00b8d4</color>
<color name="teal_50">#e0f2f1</color>
<color name="teal_100">#b2dfdb</color>
<color name="teal_200">#80cbc4</color>
<color name="teal_300">#4db6ac</color>
<color name="teal_400">#26a69a</color>
<color name="teal_500">#009688</color>
<color name="teal_600">#00897b</color>
<color name="teal_700">#00796b</color>
<color name="teal_800">#00695c</color>
<color name="teal_900">#004d40</color>
<color name="teal_a100">#a7ffeb</color>
<color name="teal_a200">#64ffda</color>
<color name="teal_a400">#1de9b6</color>
<color name="teal_a700">#00bfa5</color>
<color name="green_50">#d0f8ce</color>
<color name="green_100">#a3e9a4</color>
<color name="green_200">#72d572</color>
<color name="green_300">#42bd41</color>
<color name="green_400">#2baf2b</color>
<color name="green_500">#259b24</color>
<color name="green_600">#0a8f08</color>
<color name="green_700">#0a7e07</color>
<color name="green_800">#056f00</color>
<color name="green_900">#0d5302</color>
<color name="green_a100">#a2f78d</color>
<color name="green_a200">#5af158</color>
<color name="green_a400">#14e715</color>
<color name="green_a700">#12c700</color>
<color name="light_green_50">#f1f8e9</color>
<color name="light_green_100">#dcedc8</color>
<color name="light_green_200">#c5e1a5</color>
<color name="light_green_300">#aed581</color>
<color name="light_green_400">#9ccc65</color>
<color name="light_green_500">#8bc34a</color>
<color name="light_green_600">#7cb342</color>
<color name="light_green_700">#689f38</color>
<color name="light_green_800">#558b2f</color>
<color name="light_green_900">#33691e</color>
<color name="light_green_a100">#ccff90</color>
<color name="light_green_a200">#b2ff59</color>
<color name="light_green_a400">#76ff03</color>
<color name="light_green_a700">#64dd17</color>
<color name="lime_50">#f9fbe7</color>
<color name="lime_100">#f0f4c3</color>
<color name="lime_200">#e6ee9c</color>
<color name="lime_300">#dce775</color>
<color name="lime_400">#d4e157</color>
<color name="lime_500">#cddc39</color>
<color name="lime_600">#c0ca33</color>
<color name="lime_700">#afb42b</color>
<color name="lime_800">#9e9d24</color>
<color name="lime_900">#827717</color>
<color name="lime_a100">#f4ff81</color>
<color name="lime_a200">#eeff41</color>
<color name="lime_a400">#c6ff00</color>
<color name="lime_a700">#aeea00</color>
<color name="yellow_50">#fffde7</color>
<color name="yellow_100">#fff9c4</color>
<color name="yellow_200">#fff59d</color>
<color name="yellow_300">#fff176</color>
<color name="yellow_400">#ffee58</color>
<color name="yellow_500">#ffeb3b</color>
<color name="yellow_600">#fdd835</color>
<color name="yellow_700">#fbc02d</color>
<color name="yellow_800">#f9a825</color>
<color name="yellow_900">#f57f17</color>
<color name="yellow_a100">#ffff8d</color>
<color name="yellow_a200">#ffff00</color>
<color name="yellow_a400">#ffea00</color>
<color name="yellow_a700">#ffd600</color>
<color name="amber_50">#fff8e1</color>
<color name="amber_100">#ffecb3</color>
<color name="amber_200">#ffe082</color>
<color name="amber_300">#ffd54f</color>
<color name="amber_400">#ffca28</color>
<color name="amber_500">#ffc107</color>
<color name="amber_600">#ffb300</color>
<color name="amber_700">#ffa000</color>
<color name="amber_800">#ff8f00</color>
<color name="amber_900">#ff6f00</color>
<color name="amber_a100">#ffe57f</color>
<color name="amber_a200">#ffd740</color>
<color name="amber_a400">#ffc400</color>
<color name="amber_a700">#ffab00</color>
<color name="orange_50">#fff3e0</color>
<color name="orange_100">#ffe0b2</color>
<color name="orange_200">#ffcc80</color>
<color name="orange_300">#ffb74d</color>
<color name="orange_400">#ffa726</color>
<color name="orange_500">#ff9800</color>
<color name="orange_600">#fb8c00</color>
<color name="orange_700">#f57c00</color>
<color name="orange_800">#ef6c00</color>
<color name="orange_900">#e65100</color>
<color name="orange_a100">#ffd180</color>
<color name="orange_a200">#ffab40</color>
<color name="orange_a400">#ff9100</color>
<color name="orange_a700">#ff6d00</color>
<color name="deep_orange_50">#fbe9e7</color>
<color name="deep_orange_100">#ffccbc</color>
<color name="deep_orange_200">#ffab91</color>
<color name="deep_orange_300">#ff8a65</color>
<color name="deep_orange_400">#ff7043</color>
<color name="deep_orange_500">#ff5722</color>
<color name="deep_orange_600">#f4511e</color>
<color name="deep_orange_700">#e64a19</color>
<color name="deep_orange_800">#d84315</color>
<color name="deep_orange_900">#bf360c</color>
<color name="deep_orange_a100">#ff9e80</color>
<color name="deep_orange_a200">#ff6e40</color>
<color name="deep_orange_a400">#ff3d00</color>
<color name="deep_orange_a700">#dd2c00</color>
<color name="brown_50">#efebe9</color>
<color name="brown_100">#d7ccc8</color>
<color name="brown_200">#bcaaa4</color>
<color name="brown_300">#a1887f</color>
<color name="brown_400">#8d6e63</color>
<color name="brown_500">#795548</color>
<color name="brown_600">#6d4c41</color>
<color name="brown_700">#5d4037</color>
<color name="brown_800">#4e342e</color>
<color name="brown_900">#3e2723</color>
<color name="grey_50">#fafafa</color>
<color name="grey_100">#f5f5f5</color>
<color name="grey_200">#eeeeee</color>
<color name="grey_300">#e0e0e0</color>
<color name="grey_400">#bdbdbd</color>
<color name="grey_500">#9e9e9e</color>
<color name="grey_600">#757575</color>
<color name="grey_700">#616161</color>
<color name="grey_800">#424242</color>
<color name="grey_900">#212121</color>
<color name="blue_grey_50">#eceff1</color>
<color name="blue_grey_100">#cfd8dc</color>
<color name="blue_grey_200">#b0bec5</color>
<color name="blue_grey_300">#90a4ae</color>
<color name="blue_grey_400">#78909c</color>
<color name="blue_grey_500">#607d8b</color>
<color name="blue_grey_600">#546e7a</color>
<color name="blue_grey_700">#455a64</color>
<color name="blue_grey_800">#37474f</color>
<color name="blue_grey_900">#263238</color>
<color name="color_f4">#F4F4F4</color>
<color name="color_ccc">#CCC</color>
<color name="line_color">#CCC</color>
<color name="scroll_bar_color">#CACACA</color>
<color name="hint_color">#676767</color>
<color name="main_home_function_head_bg">#F4F4F4</color>
</resources>
package com.gingersoft.gsa.cloud.table.mvp.ui.activity;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
......@@ -25,8 +26,10 @@ import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.TableBean;
import com.gingersoft.gsa.cloud.base.common.bean.mealManage.OpenTableManage;
import com.gingersoft.gsa.cloud.base.utils.VibratorUtils;
import com.gingersoft.gsa.cloud.base.utils.view.ViewUtils;
import com.gingersoft.gsa.cloud.base.utils.constans.Constans;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.utils.view.ViewUtils;
import com.gingersoft.gsa.cloud.base.widget.DialogUtils;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.utils.ComboItemDaoUtils;
import com.gingersoft.gsa.cloud.database.utils.FoodComboDaoUtils;
......@@ -39,9 +42,7 @@ import com.gingersoft.gsa.cloud.table.mvp.contract.MealStandContract;
import com.gingersoft.gsa.cloud.table.mvp.model.constant.MealConstant;
import com.gingersoft.gsa.cloud.table.mvp.presenter.MealStandPresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.BaseFragmentAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.MyViewPagerAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FoodGroupAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.HorizontalGridViewAdpter;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.FineItemAllFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.FineItemKindFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.widget.ChooseNumberDialog;
......@@ -49,15 +50,14 @@ import com.gingersoft.gsa.cloud.ui.recylcler.Indicator.PagerConfig;
import com.gingersoft.gsa.cloud.ui.recylcler.Indicator.PagerGridLayoutManager;
import com.gingersoft.gsa.cloud.ui.recylcler.Indicator.PagerGridSnapHelper;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.GridDividerItemDecoration;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.gingersoft.gsa.cloud.ui.view.PagerSlidingTabStrip;
import com.gingersoft.gsa.cloud.ui.view.RecyclerViewNoBugLinearLayoutManager;
import com.gingersoft.gsa.cloud.ui.view.SearchKeyBoardView;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.DeviceUtils;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
......@@ -395,9 +395,9 @@ public class MealStandActivity extends BaseActivity<MealStandPresenter> implemen
layoutParams.width = ArmsUtils.getScreenWidth(this) / totalPage;
ivPoints[i].setLayoutParams(layoutParams);
}
if(foodGroupList.size() >10){
if (foodGroupList.size() > 10) {
ll_food_group_point.setVisibility(View.VISIBLE);
}else {
} else {
ll_food_group_point.setVisibility(View.GONE);
}
// //设置ViewPager的滑动监听,主要是设置点点的背景颜色的改变
......@@ -964,6 +964,23 @@ public class MealStandActivity extends BaseActivity<MealStandPresenter> implemen
map.put(MealConstant.fine_ViewMode, pager_fine);
map.put(MealConstant.fine_tabs_ViewMode, rl_fine_tabs);
map.put(MealConstant.ViewMode_keys, keyView);
btn_send_order.setOnLongClickListener(v -> {
new DialogUtils(mContext, R.layout.print_select_print_method) {
@Override
public void initLayout(ViewHepler hepler, Dialog dialog) {
hepler.setViewClick(R.id.local_print, v -> {
SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.LOCAL_PRINT);
dialog.dismiss();
});
hepler.setViewClick(R.id.internet_print, v -> {
SPUtils.put(mContext, Constans.DEFAULT_PRINT_METHOD, Constans.LOCAL_PRINT);
dialog.dismiss();
});
}
}.createDialogView().show();
return false;
});
}
public FoodGroupAdapter getFoodGroupGridViewAdapter() {
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_white_eight_corners_bg"
android:gravity="center"
android:orientation="vertical"
android:padding="@dimen/dp_20">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_10"
android:text="修改默認打印方式"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/sp_22" />
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<TextView
android:id="@+id/local_print"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:text="本機打印"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/sp_18" />
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<TextView
android:id="@+id/internet_print"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:text="網絡打印"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/sp_18" />
</LinearLayout>
\ No newline at end of file
ext.mainApp = true //设置为true,表示此module为主app module,一直以application方式编译
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife'
//apply plugin: 'android-aspectjx'
android {
signingConfigs {
GSAndroidNew {
......
......@@ -3,17 +3,18 @@ package com.gingersoft.gsa.cloud.user.login.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.base.utils.constans.UserConstans;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionTextItem;
......@@ -31,6 +32,7 @@ import com.jess.arms.utils.ArmsUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
......@@ -68,6 +70,8 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login
ImageView icClear;
@BindView(R2.id.iv_clear_account)
ImageView icClearAccount;
@BindView(R2.id.rb_remember_password)
CheckBox mRbRememberPwd;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
......@@ -96,6 +100,13 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login
@Override
public void initData(@Nullable Bundle savedInstanceState) {
findViewById(R.id.tv_gsa_user_login).setOnClickListener(this);
if (!Objects.equals(SPUtils.get(mContext, UserConstans.LOGIN_USERNAME, ""), "")) {
edAccount.setText("" + SPUtils.get(mContext, UserConstans.LOGIN_USERNAME, ""));
mRbRememberPwd.setChecked(true);
}
if (!Objects.equals(SPUtils.get(mContext, UserConstans.LOGIN_PASSWORD, ""), "")) {
edPwd.setText("" + SPUtils.get(mContext, UserConstans.LOGIN_PASSWORD, ""));
}
// if(GsaCloudApplication.getLoginToken(mContext).length() > 0){
// jumpActivity();
// finish();
......@@ -200,9 +211,10 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login
@Override
public void loginSuccess(LoginBean loginBean) {
//記住密碼
RememberPwd();
GsaCloudApplication.setBrandRestaurantInfos(this, "");
if (loginBean.getData() != null) {
GsaCloudApplication.setLoginToken(LoginActivity.this, loginBean.getData().getToken());
......@@ -254,15 +266,20 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login
}
}
}
}
// if (loginBean.getData().getUser() != null) {
// GsaCloudApplication.setMemberId(LoginActivity.this, loginBean.getData().getUser().getUserId());
//// GsaCloudApplication.setRestaurantId(LoginActivity.this, loginBean.getData().getUser().getRestaurants().get(0).getRestaurantId());
// }
// ToastUtils.show(LoginActivity.this, "登錄成功");
// jumpActivity();
/**
* 記住密碼
*/
private void RememberPwd() {
if (mRbRememberPwd.isChecked()) {
//登陸成功後,如果選中了記住密碼,則保存密碼
SPUtils.put(mContext, UserConstans.LOGIN_USERNAME, edAccount.getText().toString());
SPUtils.put(mContext, UserConstans.LOGIN_PASSWORD, edPwd.getText().toString());
} else {
SPUtils.put(mContext, UserConstans.LOGIN_USERNAME, "");
SPUtils.put(mContext, UserConstans.LOGIN_PASSWORD, "");
}
}
private void saveBrandAndRestaurantInfo(int brandId, String brandName, int restaurantId, String restaurantName) {
......
......@@ -37,7 +37,7 @@
android:layout_height="0dp"
android:background="@null"
android:hint="請輸入賬戶"
android:maxLength="11"
android:maxLength="16"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:singleLine="true"
......@@ -93,6 +93,25 @@
app:layout_constraintRight_toLeftOf="@id/iv_clear_pwd"
app:layout_constraintTop_toTopOf="@id/iv_login_pwd_icon" />
<CheckBox
android:id="@+id/rb_remember_password"
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_15"
app:layout_constraintLeft_toLeftOf="@id/iv_login_pwd_icon"
app:layout_constraintTop_toBottomOf="@id/ed_login_user_pwd" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:text="記住密碼"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/sp_14"
app:layout_constraintBottom_toBottomOf="@id/rb_remember_password"
app:layout_constraintLeft_toRightOf="@id/rb_remember_password"
app:layout_constraintTop_toTopOf="@id/rb_remember_password" />
<ImageView
android:id="@+id/iv_clear_pwd"
android:layout_width="@dimen/dp_30"
......@@ -115,7 +134,7 @@
android:visibility="invisible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ed_login_user_pwd" />
app:layout_constraintTop_toBottomOf="@id/rb_remember_password" />
<TextView
android:id="@+id/tv_gsa_user_login"
......
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