Commit e716d712 by Wyh

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

parents 931d78d8 2ea685ea
......@@ -8,6 +8,7 @@ import android.print.PrintManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -37,6 +38,7 @@ import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails;
import com.gingersoft.gsa.cloud.common.function.FunctionManager;
import com.gingersoft.gsa.cloud.common.ui.utils.BtnBuilder;
import com.gingersoft.gsa.cloud.common.utils.ClipboardUtils;
import com.gingersoft.gsa.cloud.common.utils.CollectionUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
......@@ -53,6 +55,7 @@ import com.qmuiteam.qmui.widget.QMUITopBar;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import butterknife.BindView;
......@@ -333,16 +336,17 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
} else {
mRvBtn.setLayoutManager(new GridLayoutManager(mContext, 3));
}
OrderDetailsBtnAdapter orderDetailsBtnAdapter = new OrderDetailsBtnAdapter(btnBeans);
ArrayList<BtnBuilder.BtnBean> realBtnBeans = (ArrayList<BtnBuilder.BtnBean>) CollectionUtils.removeNull(btnBeans);
OrderDetailsBtnAdapter orderDetailsBtnAdapter = new OrderDetailsBtnAdapter(realBtnBeans);
orderDetailsBtnAdapter.setOnItemClickListener((adapter, view, position) -> {
if (btnBeans.get(position).getType() == BtnBuilder.SureBtn) {
if (realBtnBeans.get(position).getType() == BtnBuilder.SureBtn) {
requestPermissions((allGranted, grantedList, deniedList) -> {
//確認訂單
if (allGranted) {
mPresenter.thirdDelivery(bean);
}
});
} else if (btnBeans.get(position).getType() == BtnBuilder.CancelBtn) {
} else if (realBtnBeans.get(position).getType() == BtnBuilder.CancelBtn) {
//取消訂單
new AppDialog().showWaringDialog(this, "確認取消訂單?", (v, dialog) -> {
if (bean.isDelete() == 0) {
......@@ -351,12 +355,12 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
mPresenter.cancelOrder(bean.getID());
}
});
} else if (btnBeans.get(position).getType() == BtnBuilder.LogisticsBtn) {
} else if (realBtnBeans.get(position).getType() == BtnBuilder.LogisticsBtn) {
//取消物流
new AppDialog().showWaringDialog(this, "確認取消物流?", (v, dialog) -> {
mPresenter.cancelLogistics(bean.getID(), false);
});
} else if (btnBeans.get(position).getType() == BtnBuilder.PrintBtn) {
} else if (realBtnBeans.get(position).getType() == BtnBuilder.PrintBtn) {
//打印
requestPermissions((allGranted, grantedList, deniedList) -> {
if (allGranted) {
......
......@@ -5,13 +5,6 @@
android:layout_height="match_parent"
android:background="@mipmap/down_decoration">
<!-- <com.qmuiteam.qmui.widget.QMUITopBar-->
<!-- android:id="@+id/topbar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="?attr/qmui_topbar_height"-->
<!-- android:layout_marginTop="@dimen/dp_20"-->
<!-- android:background="@color/trans" />-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
......
......@@ -35,11 +35,14 @@ import com.jess.arms.integration.AppManager;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.StatusBarUtil;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.OnClick;
......@@ -98,26 +101,20 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
return R.layout.user_login_activity_login; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public int getStatusBarColor() {
return Color.parseColor("#E7F2FF");
}
@Override
public boolean useLightMode() {
return true;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StatusBarUtil.setColor(this, ArmsUtils.getColor(mContext,R.color.trans));
// setStatusBarDarkMode(true,this);
}
public void setStatusBarDarkMode(boolean darkmode, Activity activity) {
Class<? extends Window> clazz = activity.getWindow().getClass();
try {
int darkModeFlag = 0;
Class<?> layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
darkModeFlag = field.getInt(layoutParams);
Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
extraFlagField.invoke(activity.getWindow(), darkmode ? darkModeFlag : 0, darkModeFlag);
} catch (Exception e) {
e.printStackTrace();
}
StatusBarUtil.setColor(this,Color.parseColor("#E7F2FF"));
}
@Override
......
......@@ -15,6 +15,7 @@ import android.view.animation.DecelerateInterpolator;
import android.view.animation.ScaleAnimation;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
......@@ -43,10 +44,13 @@ import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.StatusBarUtil;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import static com.jess.arms.utils.Preconditions.checkNotNull;
......@@ -81,14 +85,24 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_welcome; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
public int getStatusBarColor() {
return ArmsUtils.getColor(this,R.color.theme_white_color);
}
@Override
public boolean useLightMode() {
return true;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StatusBarUtil.setColor(this, ArmsUtils.getColor(mContext,R.color.trans));
StatusBarUtil.setColor(this,ArmsUtils.getColor(mContext,R.color.theme_white_color));
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_welcome; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -136,4 +136,4 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
\ No newline at end of file
</merge>
\ No newline at end of file
......@@ -4,18 +4,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/theme_white_color"
android:orientation="vertical">
android:orientation="vertical"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:background="#E7F2FF"/>
<ImageView
android:id="@+id/iv_top_bg"
android:layout_width="match_parent"
......
......@@ -353,7 +353,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
// }
//將功能列表數據分組
SparseArray<String> parents = new SparseArray<>();
SparseArray<String> parents = new SparseArray<>(3);
SparseArray<List<Function>> funMap = new SparseArray<>();
for (Function function : functions) {
if (function.getParentId() == 0) {
......
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
......@@ -82,20 +82,20 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_10">
<!-- <RadioButton-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="全部計入到10號清機數據"/>-->
<!-- <RadioButton-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="全部計入到12號清機數據"/>-->
<!-- <RadioButton-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="分別按天結算"/>-->
<!-- <RadioButton-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="全部計入到10號清機數據"/>-->
<!-- <RadioButton-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="全部計入到12號清機數據"/>-->
<!-- <RadioButton-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="分別按天結算"/>-->
</RadioGroup>
<RelativeLayout
......@@ -129,4 +129,4 @@
</RelativeLayout>
</LinearLayout>
</ScrollView>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
\ No newline at end of file
</merge>
......@@ -80,3 +80,4 @@
android:paddingTop="@dimen/dp_8" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
......@@ -20,6 +20,7 @@ public interface AddAreaContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void showTTT();
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
package com.gingersoft.gsa.cloud.manager.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.manager.mvp.contract.AddAreaContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
......
package com.gingersoft.gsa.cloud.manager.mvp.ui.activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.view.Gravity;
import android.view.InputQueue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
......@@ -87,14 +101,30 @@ public class TableManageActivity extends BaseFragmentActivity<TableManagePresent
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_table_manage; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
return 0; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
if (findFragment(TableListFragment.class) == null) {
loadRootFragment(R.id.fl_container, TableListFragment.newInstance());
}
loadRootFragment(Window.ID_ANDROID_CONTENT, TableListFragment.newInstance());
}
// generateSystemAlert();
}
private void generateSystemAlert() {
//Activity Context
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
//Application Context
//WindowManager wm = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = 500;
params.gravity = Gravity.CENTER;
final View view = LayoutInflater.from(this).inflate(R.layout.window_system_alert, null);
wm.addView(view, params);
}
public void initGetTableTimer() {
......
......@@ -268,4 +268,8 @@ public class AddAreaFragment extends BaseFragment<AddAreaPresenter> implements A
}
@Override
public void showTTT() {
}
}
<?xml version="1.0" encoding="utf-8"?>
<!--<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical"-->
<!--&gt;-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
......@@ -40,25 +34,3 @@
<!-- android:textColor="@color/theme_color"-->
<!-- android:textSize="@dimen/sp_14" />-->
</LinearLayout>
\ No newline at end of file
<!-- <View-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/dp_1"-->
<!-- android:background="@color/theme_hint_color"/>-->
<!-- <EditText-->
<!-- android:id="@+id/ed_input_name"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/dp_48"-->
<!-- android:paddingLeft="@dimen/dp_10"-->
<!-- android:paddingRight="@dimen/dp_10"-->
<!-- android:background="@null"-->
<!-- android:hint="請輸入打區域名稱"-->
<!-- android:maxLength="20"-->
<!-- android:singleLine="true"-->
<!-- android:textColor="@color/normal_color"-->
<!-- android:textColorHint="@color/hint_color"-->
<!-- android:textSize="@dimen/sp_16"-->
<!-- android:visibility="gone">-->
<!-- </EditText>-->
<!--</LinearLayout>-->
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="这是一个Window"
android:textSize="@dimen/dp_28"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -163,7 +163,7 @@ public class PrintServe extends PrinterRoot<PrintServingPaperContent> {
layout.addView(getDiningFoodList(mContext, foodItemList, printerDeviceBean, 0, false));
//打印紙
layout.addView(getLine(mContext));
layout.addView(getTextView(mContext, "Thank you!", Gravity.CENTER_HORIZONTAL, getDimensionPixelSize(mContext, R.dimen.dp_8)));
layout.addView(getTextView(mContext, mPrintServingPaperContent.getPoliteLanguage(), Gravity.CENTER_HORIZONTAL, getDimensionPixelSize(mContext, R.dimen.dp_8)));
layout.addView(getTextView(mContext, TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT), Gravity.CENTER_HORIZONTAL, getDimensionPixelSize(mContext, R.dimen.dp_8)));
return viewToZoomBitmap(mContext, layout, printerDeviceBean);
}
......
......@@ -216,7 +216,7 @@ public class PrintSlip extends PrinterRoot<PrintSlipContent> {
layout.addView(getHalfLine(mContext));
layout.addView(getAmountText(mContext, "總金額:" + mPrintSlipContent.getTotalAmount()));
layout.addView(getLine(mContext));
layout.addView(getTextView(mContext, "Thank you!", Gravity.CENTER_HORIZONTAL, getDimensionPixelSize(mContext, R.dimen.dp_8)));
layout.addView(getTextView(mContext, mPrintSlipContent.getPoliteLanguage(), Gravity.CENTER_HORIZONTAL, getDimensionPixelSize(mContext, R.dimen.dp_8)));
layout.addView(getTextView(mContext, TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_FORMAT), Gravity.CENTER_HORIZONTAL, getDimensionPixelSize(mContext, R.dimen.dp_8)));
return viewToZoomBitmap(mContext, layout, printerDeviceBean);
}
......
......@@ -572,13 +572,18 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
return View.inflate(mContext, R.layout.print_model_half_line, null);
}
public View getHeader(Context mContext) {
View view = View.inflate(mContext, R.layout.print_model_header, null);
TextView tvBrandName = view.findViewById(R.id.print_brand_name);
TextView tvRestaurantName = view.findViewById(R.id.print_restaurant_name);
TextView tvRestaurantPhone = view.findViewById(R.id.print_restaurant_phone);
tvBrandName.setText(RestaurantInfoManager.newInstance().getBrandName());
tvRestaurantName.setText(RestaurantInfoManager.newInstance().getRestaurantName());
String printHeaderRestaurantPhone = GsaCloudApplication.functionConfiguration.getPrintHeaderRestaurantPhoneVaule();
if (!TextUtils.isEmpty(printHeaderRestaurantPhone)) {
tvRestaurantPhone.setText(printHeaderRestaurantPhone);
tvRestaurantPhone.setVisibility(View.VISIBLE);
}
return view;
}
......
......@@ -181,11 +181,17 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
}
@Override
protected void onResume() {
super.onResume();
protected void onStart() {
super.onStart();
actionPrinter();
}
// @Override
// protected void onResume() {
// super.onResume();
// actionPrinter();
// }
private void actionPrinter() {
showPrintLoadingDialog();
......@@ -211,7 +217,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
printerLoadingDialog = new PrinterLoadingDialog(this).build();
}
printerLoadingDialog.setOnCancelListener(dialog -> {
finish();
killMyself();
if (printerResult) {
CC.sendCCResult(callId, CCResult.success());
} else {
......@@ -416,7 +422,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
//doSomeTing,點擊當前頁面任意地方自動關閉
finish();
killMyself();
return true;
}
......@@ -537,6 +543,15 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
}
@Override
protected void onStop() {
super.onStop();
if (printerLoadingDialog != null) {
printerLoadingDialog.dismiss();
printerLoadingDialog = null;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
//關閉打印頁面時,關閉所有打印連接
......@@ -546,7 +561,6 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
if (printerInIt != null) {
printerInIt.disconnectEpson();
}
printerLoadingDialog.dismiss();
PrinterFlowProxy.newInstance().unregisterPrinterFlowListener(printerFlowListener);
}
......
......@@ -2,6 +2,7 @@ package com.joe.print.mvp.ui.view;
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
......
......@@ -24,4 +24,15 @@
android:gravity="center"
tools:text="餐廳名" />
<TextView
android:id="@+id/print_restaurant_phone"
style="@style/Print_text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
tools:text="电话"
android:visibility="gone"/>
</LinearLayout>
\ No newline at end of file
......@@ -3,13 +3,13 @@ package com.gingersoft.gsa.cloud.table.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.gingersoft.gsa.cloud.table.mvp.contract.RegionFragmentContract;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.table.di.module.AllTableModule;
import com.gingersoft.gsa.cloud.table.mvp.contract.AllTableContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllTableFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.RegionFragment;
/**
......@@ -27,12 +27,12 @@ import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllTableFragment;
@FragmentScope
@Component(modules = AllTableModule.class, dependencies = AppComponent.class)
public interface AllTableComponent {
void inject(AllTableFragment fragment);
void inject(RegionFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
AllTableComponent.Builder view(AllTableContract.View view);
AllTableComponent.Builder view(RegionFragmentContract.View view);
AllTableComponent.Builder appComponent(AppComponent appComponent);
......
......@@ -3,8 +3,8 @@ package com.gingersoft.gsa.cloud.table.di.module;
import dagger.Binds;
import dagger.Module;
import com.gingersoft.gsa.cloud.table.mvp.contract.AllTableContract;
import com.gingersoft.gsa.cloud.table.mvp.model.AllTableModel;
import com.gingersoft.gsa.cloud.table.mvp.contract.RegionFragmentContract;
import com.gingersoft.gsa.cloud.table.mvp.model.RegionFragmentModel;
/**
......@@ -23,5 +23,5 @@ import com.gingersoft.gsa.cloud.table.mvp.model.AllTableModel;
public abstract class AllTableModule {
@Binds
abstract AllTableContract.Model bindAllTableModel(AllTableModel model);
abstract RegionFragmentContract.Model bindAllTableModel(RegionFragmentModel model);
}
\ No newline at end of file
......@@ -71,7 +71,13 @@ public class ModifyOrderAction implements Strategy<OrderManagerResponse> {
doshokuOrder.setOrderId(orderItem.getId());
doshokuOrder.setOrderPlaced(orderBean);
TableBean.DataBean tableBean = new TableBean.DataBean(orderItem.getRestaurantTable());
// TableBean.DataBean tableBean = new TableBean.DataBean(orderItem.getRestaurantTable());
TableBean.DataBean tableBean = null;
try {
tableBean = orderItem.getRestaurantTable().clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
if (!TextUtils.isEmpty(tableBean.getTableNumber())) {
tableBean.setTableName(tableBean.getTableName() + "-" + tableBean.getTableNumber());
} else {
......
......@@ -5,7 +5,7 @@ import android.content.Intent;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.table.TableBean;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.response.BaseOrderResponse;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllTableFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.RegionFragment;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.jess.arms.base.DefaultAdapter;
......@@ -34,7 +34,7 @@ public interface OrderContentContract {
void returnTableList(List<TableBean.DataBean> dataBeanList);
AllTableFragment getCurrentTableFragment();
RegionFragment getCurrentTableFragment();
void clickTableItem(TableBean.DataBean dataBean);
......
......@@ -17,7 +17,7 @@ import com.jess.arms.mvp.IModel;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface AllTableContract {
public interface RegionFragmentContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
......
......@@ -4,7 +4,7 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.table.TableBean;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.response.BaseOrderResponse;
import com.gingersoft.gsa.cloud.table.mvp.action.table.TableAction;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllTableFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.RegionFragment;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.jess.arms.base.DefaultAdapter;
......@@ -37,7 +37,7 @@ public interface TableContract {
void returnTableList(List<TableBean.DataBean> dataBeanList);
AllTableFragment getCurrentTableFragment();
RegionFragment getCurrentTableFragment();
void clickTableItem(TableBean.DataBean dataBean);
......
......@@ -10,7 +10,7 @@ import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.table.mvp.contract.AllTableContract;
import com.gingersoft.gsa.cloud.table.mvp.contract.RegionFragmentContract;
/**
......@@ -26,14 +26,14 @@ import com.gingersoft.gsa.cloud.table.mvp.contract.AllTableContract;
* ================================================
*/
@FragmentScope
public class AllTableModel extends BaseModel implements AllTableContract.Model {
public class RegionFragmentModel extends BaseModel implements RegionFragmentContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public AllTableModel(IRepositoryManager repositoryManager) {
public RegionFragmentModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
......
......@@ -263,7 +263,7 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
* 4、更新服務費項{@link ServiceChargeItem}
* 5、更新賬單折扣項{@link NomalDiscount}
* 6、更新賬單小數項{@link RoundingItem}
* 7、總金額
* 7、更新總金額
*/
public void updateBillInfo(UpdateBillInfoEndListener updateBillInfoEndListener) {
......
......@@ -141,6 +141,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
@Override
public void preformAddDiscount(Discount discount) {
mShoppingCart.addMultyDiscount(mShoppingCart.createNomalDiscount(discount, BillItem.BILL_ITEM_NO_ORDER_STATUS));
DoshokuOrder.getInstance().setBillItemStatus(DoshokuOrder.DISCOUNT_ITEM_TAG);
updateBillInfo();
}
});
......@@ -205,7 +206,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
// if (!canPay()) {
// return;
// }
if (hasNesOrderFoods() || getNewDiscount() != null || hasModifyFoods() || mDoshokuOrder.needUpdateMemberInfo()) {
if (hasNesOrderFoods() || getNewDiscount() != null || hasModifyFoods() || mDoshokuOrder.isBillHasChanged()) {
Class[] parameterTypes = {boolean.class, Class.class};
Object[] parameters = {false, OrderPayActivity.class};
CommonTipDialog.showDoubtDialog(IActivity, "賬單已變化,是否送單后去結賬", BaseOrderPresenter.class, mBaseOrderPresenter,
......@@ -377,7 +378,6 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
if (!hasNesOrderFoods()) {
//未新增食品點擊送單 後台不讓過直接提示即可,不調用打印
mRootView.showMessage("送單成功");
// mRootView.sendSuccess();
} else {
mRootView.showMessage(info.getErrMsg());
}
......@@ -394,6 +394,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
printSendOrder(afterToActivity);
}
}
}
/**
......@@ -843,15 +844,16 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
* @param info
*/
private void updateOrderDetails(BaseOrderResponse info) {
if (mDoshokuOrder != null && info.getData() != null) {
OrderResponse orderResponse = info.getData();
if (mDoshokuOrder != null && orderResponse != null) {
mTableInfo.setPerson(info.getData().getPerson());
mTableInfo.setCreateTime(info.getData().getCreateTime());
mTableInfo.setPerson(orderResponse.getPerson());
mTableInfo.setCreateTime(orderResponse.getCreateTime());
mDoshokuOrder.setOpenTableInfo(mTableInfo);
mDoshokuOrder.setOrderPlaced(info.getData());
mDoshokuOrder.setOrderPlaced(orderResponse);
if (info.getData().getOrderDetails() != null) {
if (orderResponse.getOrderDetails() != null) {
//组装食品信息
List<OrderDetail> orderDetailList = OrderAssemblyUtil.assemblyOrder(OrderDetail.orderTransOrderDetails(info.getData().getOrderDetails()));
......@@ -869,6 +871,16 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
billItem.setTextColor(ArmsUtils.getColor(IActivity, R.color.theme_black));
}
mBillItemAdapter.notifyDataSetChanged();
boolean memberItemStatus = false;
boolean discountItemStatus = false;
if (orderResponse.getMemberInfo() != null) {
memberItemStatus = true;
}
if (orderResponse.getDiscountDetails() != null) {
discountItemStatus = true;
}
mDoshokuOrder.initBillStatus(memberItemStatus, discountItemStatus);
}
}
......@@ -918,6 +930,7 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
if (billItem instanceof DiscountItem) {
//刪除折扣列表對應數據
mShoppingCart.delMultyDiscount(((DiscountItem) billItem).getDiscount());
DoshokuOrder.getInstance().setBillItemStatus(DoshokuOrder.DISCOUNT_ITEM_TAG);
}
updateBillInfo();
}
......
......@@ -5,12 +5,12 @@ import android.app.Application;
import android.content.Context;
import com.gingersoft.gsa.cloud.common.core.table.TableBean;
import com.gingersoft.gsa.cloud.common.utils.VibratorUtils;
import com.gingersoft.gsa.cloud.table.mvp.contract.AllTableContract;
import com.gingersoft.gsa.cloud.table.mvp.contract.RegionFragmentContract;
import com.gingersoft.gsa.cloud.table.mvp.model.constant.TableActionConstant;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderContentActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.TableAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllTableFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.RegionFragment;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
......@@ -38,7 +38,7 @@ import me.jessyan.rxerrorhandler.core.RxErrorHandler;
* ================================================
*/
@FragmentScope
public class AllTablePresenter extends BasePresenter<AllTableContract.Model, AllTableContract.View> {
public class RegionFragmentPresenter extends BasePresenter<RegionFragmentContract.Model, RegionFragmentContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
......@@ -51,16 +51,16 @@ public class AllTablePresenter extends BasePresenter<AllTableContract.Model, All
private TableActivity mTableActivity;
private OrderContentActivity mOrderContentActivity;
private AllTableFragment IView;
private RegionFragment IView;
private TableAdapter mTableAdapter;
private List<TableBean.DataBean> mTableList = new ArrayList<>();
@Inject
public AllTablePresenter(AllTableContract.Model model, AllTableContract.View rootView) {
public RegionFragmentPresenter(RegionFragmentContract.Model model, RegionFragmentContract.View rootView) {
super(model, rootView);
this.IView = (AllTableFragment) rootView;
this.IView = (RegionFragment) rootView;
Activity activity = IView.getCurrentActivity();
if (activity instanceof TableActivity) {
......@@ -154,7 +154,6 @@ public class AllTablePresenter extends BasePresenter<AllTableContract.Model, All
initTableAdapter(context);
mTableAdapter.notifyDataSetChanged();
}
}
/**
......
......@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.table.mvp.presenter;
import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import android.graphics.Region;
import android.text.TextUtils;
import android.view.View;
......@@ -71,11 +72,15 @@ import java.util.List;
import javax.inject.Inject;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;
import io.reactivex.schedulers.Schedulers;
import lombok.Data;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
......@@ -115,15 +120,31 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
*/
private SplitTableDialog mSplitTableDialog;
private List<TableBean.DataBean> mTableList = new ArrayList<>();
/**
* 區域數據
*/
private List<TablePresenter.RegionBean> mRegionList = new ArrayList<>();
/**
* 餐檯數據
*/
private List<TableBean.DataBean> mTableList = new ArrayList<>(10);
private BottomFunctionAdapter mBottomFunctionAdapter;
@XFunctionViews(FunctionTable.TABLE_BOTTOM_GROUP)
private List<Function> mBottomFunctionList = new ArrayList<>();
private List<Function> mBottomFunctionList = new ArrayList<>(5);
private TableAction mTableAction;
private List<TableAction> mTableActions = new ArrayList<>();
private List<TableAction> mTableActions = new ArrayList<>(5);
/**
* 当前区域ID
* 默认 -1 = 不分区
*/
public static final int DEFALUT_REGION_ID = -1;
public static final String DEFALUT_REGION_NAME = "全部";
private RegionBean mCurrRegionBean = new RegionBean(DEFALUT_REGION_ID, DEFALUT_REGION_NAME);
/**
* 选中操作的台名、id、分檯編號
*/
......@@ -142,6 +163,18 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
private Disposable mTablesPollingDisposable;
@Data
public static final class RegionBean {
private int regionId;
private String regionName;
public RegionBean(int regionId, String regionName) {
this.regionId = regionId;
this.regionName = regionName;
}
}
@Inject
public TablePresenter(TableContract.Model model, TableContract.View rootView) {
super(model, rootView);
......@@ -275,6 +308,8 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
sortTableList(tableBeanData);
mTableList.addAll(tableBeanData);
mRootView.returnTableList(tableBeanData);
setAreaListByTableList(tableBeanData);
} else {
mRootView.getCurrentTableFragment().showEmptyView(true, 0, null);
}
......@@ -419,13 +454,17 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
doshokuOrder.setOrderNo(orderBean.getOrderNo());
doshokuOrder.setOrderPlaced(new OrderResponse(orderBean));
doshokuOrder.getShoppingCart().addCommodityList(OrderAssemblyUtil.assemblyOrder(OrderDetail.orderTransOrderDetails(mealCommoditysBeans)));
boolean memberItemStatus = false;
boolean discountItemStatus = false;
if (orderBean.getMemberInfo() != null) {
//设置会员信息
doshokuOrder.setMemberInfo(orderBean.getMemberInfo());
doshokuOrder.setMemberUpdateStatus(true + "-" + true);
} else {
doshokuOrder.setMemberUpdateStatus(false + "-" + false);
memberItemStatus = true;
}
if (respose.getData().getDiscountDetails() != null) {
discountItemStatus = true;
}
doshokuOrder.initBillStatus(memberItemStatus, discountItemStatus);
} else {
doshokuOrder.setOrderPlaced(null);
doshokuOrder.getShoppingCart().setOrderCommodityList(new ArrayList<>());
......@@ -839,28 +878,6 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
});
}
/**
* 根据操作类型过滤一遍餐台
*/
public void filterTableByAction() {
if (mTableList.size() == 0) {
return;
}
List<TableBean.DataBean> filterTableBeanList = new ArrayList<>();
if (mTableAction != null) {
for (int i = 0; i < mTableList.size(); i++) {
TableBean.DataBean dataBean = mTableList.get(i);
if (mTableAction.filterTableCondition(dataBean)) {
filterTableBeanList.add(dataBean);
}
}
} else {
//正常餐檯模式下顯示所有餐檯數據
filterTableBeanList.addAll(mTableList);
}
IActivity.nofilyFragmentUpdateTableData(filterTableBeanList);
}
public void showMoveActionDialog(TableBean.DataBean dataBean) {
QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(IActivity);
dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_doubt);
......@@ -1007,6 +1024,92 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
}
/**
* 根据操作类型过滤一遍餐台
*/
public void filterTableByAction() {
if (mTableList.size() == 0) {
return;
}
List<TableBean.DataBean> filterTableList = new ArrayList<>();
if (mTableAction != null) {
for (int i = 0; i < mTableList.size(); i++) {
TableBean.DataBean dataBean = mTableList.get(i);
if (mTableAction.filterTableCondition(dataBean)) {
filterTableList.add(dataBean);
}
}
} else {
//正常餐檯模式下顯示所有餐檯數據
filterTableList.addAll(mTableList);
}
if (DEFALUT_REGION_ID != mCurrRegionBean.getRegionId()) {
//區域過濾
List<TableBean.DataBean> regionTableList = new ArrayList<>();
for (int i = 0; i < mTableList.size(); i++) {
TableBean.DataBean dataBean = mTableList.get(i);
if (mCurrRegionBean.getRegionId() == dataBean.getRegionId()) {
regionTableList.add(dataBean);
}
}
IActivity.nofilyAllFragmentUpdateTableData(filterTableList, regionTableList, filterTableList);
} else {
IActivity.nofilyAllFragmentUpdateTableData(filterTableList, filterTableList, filterTableList);
}
}
/**
* 切换区域
*
* @param regionBean
*/
public void switchRegion(TablePresenter.RegionBean regionBean) {
mCurrRegionBean = regionBean;
filterTableByAction();
}
/**
* 根据所有餐台数据去重后拿到所有区域
*
* @param tableBeanData
*/
private void setAreaListByTableList(List<TableBean.DataBean> tableBeanData) {
if (mRegionList.size() > 0) {
mRegionList.clear();
}
Observable
.fromIterable(tableBeanData)
.distinct(dataBean -> dataBean.getRegionId())
.subscribeOn(Schedulers.computation())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new Observer<TableBean.DataBean>() {
@Override
public void onSubscribe(Disposable d) {
if (mRegionList.size() > 0) {
mRegionList.clear();
}
mRegionList.add(new TablePresenter.RegionBean(DEFALUT_REGION_ID, DEFALUT_REGION_NAME));
}
@Override
public void onNext(TableBean.DataBean dataBean) {
if (!TextUtils.isEmpty(dataBean.getRegionName())) {
mRegionList.add(new TablePresenter.RegionBean(dataBean.getRegionId(), dataBean.getRegionName()));
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
/**
* 跟進id獲取餐檯對象
*
* @param id
......@@ -1091,4 +1194,8 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
public List<TableBean.DataBean> getTableList() {
return mTableList;
}
public List<TablePresenter.RegionBean> getRegionList() {
return mRegionList;
}
}
/*
* Copyright 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.table.mvp.ui.activity;
import com.google.android.material.bottomappbar.BottomAppBar;
import com.google.android.material.bottomappbar.BottomAppBarTopEdgeTreatment;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.shape.ShapePath;
/**
* A {@link BottomAppBar} top edge that works with a Diamond shaped {@link FloatingActionButton}
*/
public class BottomAppBarCutCornersTopEdge extends BottomAppBarTopEdgeTreatment {
private final float fabMargin;
private final float cradleVerticalOffset;
BottomAppBarCutCornersTopEdge(
float fabMargin, float roundedCornerRadius, float cradleVerticalOffset) {
super(fabMargin, roundedCornerRadius, cradleVerticalOffset);
this.fabMargin = fabMargin;
this.cradleVerticalOffset = cradleVerticalOffset;
}
@Override
@SuppressWarnings("RestrictTo")
public void getEdgePath(float length, float center, float interpolation, ShapePath shapePath) {
float fabDiameter = getFabDiameter();
if (fabDiameter == 0) {
shapePath.lineTo(length, 0);
return;
}
float diamondSize = fabDiameter / 2f;
float middle = center + getHorizontalOffset();
float verticalOffsetRatio = cradleVerticalOffset / diamondSize;
if (verticalOffsetRatio >= 1.0f) {
shapePath.lineTo(length, 0);
return;
}
shapePath.lineTo(middle - (fabMargin + diamondSize - cradleVerticalOffset), 0);
shapePath.lineTo(middle, (diamondSize - cradleVerticalOffset + fabMargin) * interpolation);
shapePath.lineTo(middle + (fabMargin + diamondSize - cradleVerticalOffset), 0);
shapePath.lineTo(length, 0);
}
}
package com.gingersoft.gsa.cloud.table.mvp.ui.activity;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.gingersoft.gsa.cloud.common.utils.threadPool.ThreadPoolManager;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
import com.google.android.material.bottomappbar.BottomAppBar;
import com.google.android.material.bottomappbar.BottomAppBarTopEdgeTreatment;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.navigation.NavigationView;
import com.google.android.material.shape.CutCornerTreatment;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.google.android.material.shape.ShapeAppearanceModel;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.mvp.BasePresenter;
import java.util.Timer;
import java.util.concurrent.DelayQueue;
......@@ -19,6 +33,7 @@ import java.util.concurrent.RecursiveTask;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import butterknife.BindView;
import io.reactivex.internal.schedulers.ScheduledDirectTask;
/**
......@@ -27,7 +42,21 @@ import io.reactivex.internal.schedulers.ScheduledDirectTask;
* @更新時間: 2021-02-02 11:42
* @描述:
*/
public class CoordinatorlayoutActivity extends BaseActivity {
public class CoordinatorlayoutActivity extends BaseActivity{
// @BindView(R2.id.coordinator_layout)
CoordinatorLayout coordinatorLayout;
// @BindView(R2.id.fab)
FloatingActionButton fab;
// @BindView(R2.id.bar)
BottomAppBar bar;
// @BindView(R2.id.bottom_drawer)
// FrameLayout bottomDrawer;
// @BindView(R2.id.navigation_view)
// NavigationView navigationView;
private BottomSheetBehavior<View> bottomDrawerBehavior;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
......@@ -41,7 +70,43 @@ public class CoordinatorlayoutActivity extends BaseActivity {
@Override
public void initData(@Nullable Bundle savedInstanceState) {
coordinatorLayout = findViewById(R.id.coordinator_layout);
fab = findViewById(R.id.fab);
bar = findViewById(R.id.bar);
// bottomDrawer = findViewById(R.id.bottom_drawer);
// navigationView = findViewById(R.id.navigation_view);
setUpBottomDrawer();
setUpBottomAppBarShapeAppearance();
}
private void setUpBottomAppBarShapeAppearance() {
ShapeAppearanceModel fabShapeAppearanceModel = fab.getShapeAppearanceModel();
boolean cutCornersFab =
fabShapeAppearanceModel.getBottomLeftCorner() instanceof CutCornerTreatment
&& fabShapeAppearanceModel.getBottomRightCorner() instanceof CutCornerTreatment;
BottomAppBarTopEdgeTreatment topEdge =
cutCornersFab
? new BottomAppBarCutCornersTopEdge(
bar.getFabCradleMargin(),
bar.getFabCradleRoundedCornerRadius(),
bar.getCradleVerticalOffset())
: new BottomAppBarTopEdgeTreatment(
bar.getFabCradleMargin(),
bar.getFabCradleRoundedCornerRadius(),
bar.getCradleVerticalOffset());
MaterialShapeDrawable babBackground = (MaterialShapeDrawable) bar.getBackground();
babBackground.setShapeAppearanceModel(babBackground.getShapeAppearanceModel().toBuilder().setTopEdge(topEdge).build());
}
protected void setUpBottomDrawer() {
// bottomDrawerBehavior = BottomSheetBehavior.from(bottomDrawer);
// bottomDrawerBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
//
// bar.setNavigationOnClickListener(v -> bottomDrawerBehavior.setState(BottomSheetBehavior.STATE_HALF_EXPANDED));
// bar.setNavigationIcon(R.drawable.ic_add_have_border);
// bar.replaceMenu(R.menu.demo_primary);
}
@Override
......
......@@ -129,7 +129,7 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
*/
public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter> implements MealStandContract.View, PagerGridLayoutManager.PageListener {
private SparseArray<View> map = new SparseArray<>();
private SparseArray<View> map = new SparseArray<>(10);
@BindView(R2.id.ctime)
Chronometer chronometer;
......@@ -643,22 +643,21 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
public void onUseMember(UseMemberDialog dialog) {
if (mMemberInfo != null) {
dialog.dismiss();
if (DoshokuOrder.getInstance().getMemberInfo() == null) {
useMember();
DoshokuOrder.getInstance().setMemberInfo(mMemberInfo);
//添加会员折扣行
ShoppingCart shoppingCart = mPresenter.getShoppingCart();
MultyDiscount multyDiscount = shoppingCart.createMemberDiscount(mMemberInfo, BillItem.BILL_ITEM_NO_ORDER_STATUS);
shoppingCart.addMultyDiscount(multyDiscount);
mPresenter.updateBillInfo();
DoshokuOrder.getInstance().setBillItemStatus(DoshokuOrder.MEMBER_ITEM_TAG);
useMember();
mPresenter.updateBillInfo();
if (DoshokuOrder.getInstance().needUpdateMemberInfo()) {
return;
}
String[] updateMemberStatus = DoshokuOrder.getInstance().getMemberUpdateStatus().split("-");
if (Boolean.parseBoolean(updateMemberStatus[0]) == true) {
DoshokuOrder.getInstance().setMemberUpdateStatus(updateMemberStatus[0] + "-" + true);
}
} else {
showMessage("請輸入正確的會員號碼!");
......@@ -677,13 +676,8 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
//更新賬單信息
mPresenter.updateBillInfo();
}
if (DoshokuOrder.getInstance().needUpdateMemberInfo()) {
return;
}
String[] updateMemberStatus = DoshokuOrder.getInstance().getMemberUpdateStatus().split("-");
if (Boolean.parseBoolean(updateMemberStatus[0]) == true) {
DoshokuOrder.getInstance().setMemberUpdateStatus(updateMemberStatus[0] + "-" + false);
}
DoshokuOrder.getInstance().setBillItemStatus(DoshokuOrder.MEMBER_ITEM_TAG);
}
});
mUseMemberDialog.build();
......@@ -1420,9 +1414,11 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
if (customType == Food.CUSTOM_TYPE_101) {
foodItem.setProductName(name);
}
if(!TextUtils.isEmpty(money)){
foodItem.setUnit_price(Double.parseDouble(money));
foodItem.setPrice(foodItem.getUnit_price());
mPresenter.toAddFoodItem(foodItem);
}
})
.show();
}
......
......@@ -45,7 +45,7 @@ import com.gingersoft.gsa.cloud.table.mvp.model.bean.event.InitTableEvent;
import com.gingersoft.gsa.cloud.table.mvp.model.constant.OrderConentActionConstant;
import com.gingersoft.gsa.cloud.table.mvp.model.constant.TableActionConstant;
import com.gingersoft.gsa.cloud.table.mvp.presenter.OrderContentPresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllTableFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.RegionFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.InputTableFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.widget.ChooseNumberDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
......@@ -145,7 +145,7 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
private ViewPager mContentViewPager;
private InputTableFragment inputTableFragment;
private AllTableFragment allTableFragment, stateTableFragment;
private RegionFragment allTableFragment, stateTableFragment;
private String[] mTabTitles = {"編號", "全部", "狀態:全部"};
/**
* 切換餐檯狀態下拉框
......@@ -188,6 +188,8 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
mDoshokuOrder = DoshokuOrder.getInstance();
mShoppingCart = mDoshokuOrder.getShoppingCart();
super.onCreate(savedInstanceState);
//设置根布局颜色,当layout根布局是FrameLayout时直接使用merge标签,应用DecorView默认就是FrameLayout无需再套一层
getWindow().getDecorView().setBackgroundColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
}
@Override
......@@ -343,7 +345,7 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
}
@Override
public AllTableFragment getCurrentTableFragment() {
public RegionFragment getCurrentTableFragment() {
switch (mCurrentPageIndex) {
case FUNCTION_STATE_TABLE:
return stateTableFragment;
......@@ -681,7 +683,7 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
if (allTableFragment != null) {
return allTableFragment;
}
allTableFragment = AllTableFragment.newInstance();
allTableFragment = RegionFragment.newInstance();
bundle.putInt("currentPageIndex", FUNCTION_ALL_TABLE);
allTableFragment.setArguments(bundle);
return allTableFragment;
......@@ -689,7 +691,7 @@ public class OrderContentActivity extends BaseFragmentActivity<OrderContentPrese
if (stateTableFragment != null) {
return stateTableFragment;
}
stateTableFragment = AllTableFragment.newInstance();
stateTableFragment = RegionFragment.newInstance();
bundle.putInt("currentPageIndex", FUNCTION_STATE_TABLE);
stateTableFragment.setArguments(bundle);
return stateTableFragment;
......
......@@ -77,7 +77,7 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
*/
public class SoldoutCtrlActivity extends BaseFragmentActivity<SoldoutCtrlPresenter> implements SoldoutCtrlContract.View, PagerGridLayoutManager.PageListener {
private SparseArray<View> map = new SparseArray<>();
private SparseArray<View> map = new SparseArray<>(4);
@BindView(R2.id.tv_sold_hmmc)
TextView tv_sold_hmmc;
......@@ -164,8 +164,13 @@ public class SoldoutCtrlActivity extends BaseFragmentActivity<SoldoutCtrlPresent
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
public int getStatusBarColor() {
return ArmsUtils.getColor(mContext,R.color.theme_white_color);
}
@Override
public boolean useLightMode() {
return true;
}
@Override
......
......@@ -37,7 +37,7 @@ import com.gingersoft.gsa.cloud.table.mvp.model.constant.TableActionConstant;
import com.gingersoft.gsa.cloud.table.mvp.action.table.PrintSkyorderAction;
import com.gingersoft.gsa.cloud.table.mvp.action.table.TableAction;
import com.gingersoft.gsa.cloud.table.mvp.presenter.TablePresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllTableFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.RegionFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.InputTableFragment;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.jess.arms.base.BaseFragmentActivity;
......@@ -66,7 +66,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.LogManager;
import butterknife.BindView;
import butterknife.OnClick;
......@@ -128,7 +127,7 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
public static final int FUNCTION_STATE_TABLE = 2;
private InputTableFragment inputTableFragment;
private AllTableFragment allTableFragment, stateTableFragment;
private RegionFragment allTableFragment, stateTableFragment;
private String[] mTabTitles = {"編號", "全部", "狀態:全部"};
/**
......@@ -217,8 +216,8 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
@Override
public void onClick(View v) {
LoganManager.w_tableMode(TAG, "手動刷新餐檯數據");
// launchActivity(new Intent(mContext, CoordinatorlayoutActivity.class));
getTables(true, null);
launchActivity(new Intent(mContext, CoordinatorlayoutActivity.class));
// getTables(true, null);
}
});
rightButton2.setOnClickListener(new View.OnClickListener() {
......@@ -292,7 +291,7 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
}
@Override
public AllTableFragment getCurrentTableFragment() {
public RegionFragment getCurrentTableFragment() {
switch (mCurrentPageIndex) {
case FUNCTION_STATE_TABLE:
return stateTableFragment;
......@@ -320,11 +319,11 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
public void longClickSkyorder() {
boolean state = mPresenter.setSkyorderMode();
if (state) {
LoganManager.w_tableMode(TAG, LoganManager.EVENT_LONG_CLICK,"鎖定Skyorder模式");
LoganManager.w_tableMode(TAG, LoganManager.EVENT_LONG_CLICK, "鎖定Skyorder模式");
mTopBar.setTitle("打印skyorder");
mPresenter.openSkyorderMode();
} else {
LoganManager.w_tableMode(TAG, LoganManager.EVENT_LONG_CLICK,"解鎖Skyorder模式");
LoganManager.w_tableMode(TAG, LoganManager.EVENT_LONG_CLICK, "解鎖Skyorder模式");
canceTableAction();
}
setLockVisibility(state);
......@@ -333,7 +332,7 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
@OnClick(R2.id.rl_skyorder)
public void clickSkyorder() {
LoganManager.w_tableMode(TAG, LoganManager.EVENT_CLICK,"Skyorder");
LoganManager.w_tableMode(TAG, LoganManager.EVENT_CLICK, "Skyorder");
TableAction tableAction = mPresenter.getTableActionByClass(PrintSkyorderAction.class);
if (tableAction != null) {
mPresenter.setTableAction(tableAction);
......@@ -485,7 +484,7 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
if (allTableFragment != null) {
return allTableFragment;
}
allTableFragment = AllTableFragment.newInstance();
allTableFragment = RegionFragment.newInstance();
bundle.putInt("currentPageIndex", FUNCTION_ALL_TABLE);
allTableFragment.setArguments(bundle);
return allTableFragment;
......@@ -493,7 +492,7 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
if (stateTableFragment != null) {
return stateTableFragment;
}
stateTableFragment = AllTableFragment.newInstance();
stateTableFragment = RegionFragment.newInstance();
bundle.putInt("currentPageIndex", FUNCTION_STATE_TABLE);
stateTableFragment.setArguments(bundle);
return stateTableFragment;
......@@ -522,6 +521,9 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
.build(mContext);
QMUITab tab2 = builder
.setText(mTabTitles[1])
.setNormalDrawable(ContextCompat.getDrawable(mContext, R.drawable.arrow_down_black))
.setSelectedDrawable(ContextCompat.getDrawable(mContext, R.drawable.arrow_down_black))
.setIconPosition(QMUITab.ICON_POSITION_RIGHT)
.build(mContext);
QMUITab tab3 = builder
.setNormalDrawable(ContextCompat.getDrawable(mContext, R.drawable.arrow_down_black))
......@@ -547,19 +549,12 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
//彈出選擇狀態彈窗
if (mCurrentPageIndex == 2 && index == 2) {
showTableStatusListPopup(tv_show_popup);
} else if (mCurrentPageIndex == 1 && index == 1) {
showTableAreaListPopup(tabView);
}
mCurrentPageIndex = index;
return false;
}
// @Override
// public void onTabClick(int index) {
// //彈出選擇狀態彈窗
// if (mCurrentPageIndex == 2 && index == 2) {
// showTableStatusListPopup(tv_show_popup);
// }
// mCurrentPageIndex = index;
// }
});
mTabSegment.addOnTabSelectedListener(new QMUITabSegment.OnTabSelectedListener() {
......@@ -600,6 +595,31 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
});
}
private void showTableAreaListPopup(View view) {
List<Map<String, Object>> lists = new ArrayList<>();
List<TablePresenter.RegionBean> regionList = mPresenter.getRegionList();
for (int i = 0; i < regionList.size(); i++) {
Map<String, Object> map = new HashMap<>();
map.put("text", regionList.get(i).getRegionName());
lists.add(map);
}
SimpleAdapter adapter = new SimpleAdapter(this, lists, R.layout.table_item_popup_select_table_area
, new String[]{"text"}
, new int[]{R.id.tv_area});
mTableStatusPopup = QMUIPopups.listPopup(this, QMUIDisplayHelper.getScreenWidth(this) / 3, QMUIDisplayHelper.getScreenHeight(this), adapter, new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mTableStatusPopup.dismiss();
TablePresenter.RegionBean regionBean = regionList.get(position);
if (null != regionBean) {
mTabSegment.updateTabText(1, regionBean.getRegionName());
mPresenter.switchRegion(regionBean);
}
}
}).dimAmount(0.6f).show(view);
}
private void showTableStatusListPopup(View view) {
List<Map<String, Object>> lists = new ArrayList<>();
String[] statusTextList = new String[]{
......@@ -644,7 +664,8 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
*/
public void filterTableByTableStatus(int status) {
this.mCurrentSelectTableStatus = status;
nofilyFragmentUpdateTableData(mPresenter.getTableList());
List<TableBean.DataBean> tableList = mPresenter.getTableList();
nofilyAllFragmentUpdateTableData(tableList, tableList, tableList);
}
/**
......@@ -652,22 +673,39 @@ public class TableActivity extends BaseFragmentActivity<TablePresenter> implemen
*
* @param dataBeanList
*/
public void nofilyFragmentUpdateTableData(List<TableBean.DataBean> dataBeanList) {
public void nofilyAllFragmentUpdateTableData(List<TableBean.DataBean> dataBeanList, List<TableBean.DataBean> dataBeanList2, List<TableBean.DataBean> dataBeanList3) {
Message message = Message.obtain();
message.what = 1;
message.obj = dataBeanList;
message.arg1 = mCurrentSelectTableStatus;
if (inputTableFragment != null) {
message.obj = dataBeanList;
inputTableFragment.setData(message);
}
if (allTableFragment != null) {
message.obj = dataBeanList2;
allTableFragment.setData(message);
}
if (stateTableFragment != null) {
message.obj = dataBeanList3;
stateTableFragment.setData(message);
}
}
/**
* 更新相應頁面餐檯數據
*
* @param dataBeanList
*/
public void nofilyRegionFragmentUpdateTableData(List<TableBean.DataBean> dataBeanList) {
Message message = Message.obtain();
message.what = 1;
message.obj = dataBeanList;
message.arg1 = mCurrentSelectTableStatus;
if (allTableFragment != null) {
allTableFragment.setData(message);
}
}
@Override
protected void onRestart() {
super.onRestart();
......
......@@ -8,9 +8,11 @@ import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.order.contract.OrderStatusContract;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
......@@ -26,14 +28,19 @@ import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.widget.QMUIEmptyView;
import com.qmuiteam.qmui.widget.QMUIWindowInsetLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import org.json.JSONException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.List;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
......@@ -99,13 +106,13 @@ public class AllOrderFragment extends BaseFragment<AllOrderPresenter> implements
public void onRefresh(@NonNull final RefreshLayout refreshLayout) {
//重新獲取第一頁數據
pageIndex = 0;
orderCenterActivity.loadOrderList(getOrderType(),getStatusByFragmentIndex(), refreshLayout, false);
orderCenterActivity.loadOrderList(getOrderType(), getStatusByFragmentIndex(), refreshLayout, false);
}
});
refreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
@Override
public void onLoadMore(@NonNull final RefreshLayout refreshLayout) {
orderCenterActivity.loadOrderList(getOrderType(), getStatusByFragmentIndex(),refreshLayout, true);
orderCenterActivity.loadOrderList(getOrderType(), getStatusByFragmentIndex(), refreshLayout, true);
}
});
}
......@@ -174,7 +181,7 @@ public class AllOrderFragment extends BaseFragment<AllOrderPresenter> implements
public void onClick(View v) {
//重新加載
setPageIndex(0);
orderCenterActivity.loadOrderList(getOrderType(), getStatusByFragmentIndex(),null, false);
orderCenterActivity.loadOrderList(getOrderType(), getStatusByFragmentIndex(), null, false);
}
};
......@@ -236,17 +243,17 @@ public class AllOrderFragment extends BaseFragment<AllOrderPresenter> implements
}
@Override
public String getStatusByFragmentIndex(){
public String getStatusByFragmentIndex() {
switch (mCurrentFragmentIndex) {
case 1:
return OrderStatusContract.STATUS_6+"";
return OrderStatusContract.STATUS_6 + "";
default:
return OrderStatusContract.STATUS_4+","+OrderStatusContract.STATUS_5;
return OrderStatusContract.STATUS_4 + "," + OrderStatusContract.STATUS_5;
}
}
@Nullable
public OrderManagerResponse getCheckedOrderBean(){
public OrderManagerResponse getCheckedOrderBean() {
return mPresenter.getCheckedOrderBean();
}
......
......@@ -26,6 +26,7 @@ import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.widget.QMUIWindowInsetLayout;
import java.util.ArrayList;
import java.util.List;
......
......@@ -15,8 +15,8 @@ import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
import com.gingersoft.gsa.cloud.table.di.component.DaggerAllTableComponent;
import com.gingersoft.gsa.cloud.table.mvp.contract.AllTableContract;
import com.gingersoft.gsa.cloud.table.mvp.presenter.AllTablePresenter;
import com.gingersoft.gsa.cloud.table.mvp.contract.RegionFragmentContract;
import com.gingersoft.gsa.cloud.table.mvp.presenter.RegionFragmentPresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderContentActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity;
import com.google.gson.JsonIOException;
......@@ -42,6 +42,7 @@ import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import static android.widget.AbsListView.OnScrollListener.SCROLL_STATE_IDLE;
......@@ -62,7 +63,7 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class AllTableFragment extends BaseFragment<AllTablePresenter> implements AllTableContract.View {
public class RegionFragment extends BaseFragment<RegionFragmentPresenter> implements RegionFragmentContract.View {
@BindView(R2.id.refreshLayout)
......@@ -84,8 +85,8 @@ public class AllTableFragment extends BaseFragment<AllTablePresenter> implements
private List<TableBean.DataBean> datasBeans;
public static AllTableFragment newInstance() {
AllTableFragment fragment = new AllTableFragment();
public static RegionFragment newInstance() {
RegionFragment fragment = new RegionFragment();
return fragment;
}
......@@ -109,7 +110,7 @@ public class AllTableFragment extends BaseFragment<AllTablePresenter> implements
currentPageIndex = getArguments().getInt("currentPageIndex", TableActivity.FUNCTION_ALL_TABLE);
if (mContext instanceof TableActivity) {
mTableActivity = (TableActivity) mContext;
} else if(mContext instanceof OrderContentActivity){
} else if (mContext instanceof OrderContentActivity) {
mOrderContentActivity = (OrderContentActivity) mContext;
}
initRefreshLayout();
......@@ -218,15 +219,17 @@ public class AllTableFragment extends BaseFragment<AllTablePresenter> implements
datasBeans = (List<TableBean.DataBean>) ((Message) data).obj;
if (mPresenter != null) {
//recycleView正在滑动
if (recycle_all_table.getScrollState() != 0) {
if (recycle_all_table != null && recycle_all_table.getScrollState() != 0) {
} else {
mPresenter.updataTableItem(datasBeans);
}
}
if (mEmptyView != null)
if (mEmptyView != null) {
mEmptyView.hide();
if (recycle_all_table != null)
}
if (recycle_all_table != null) {
recycle_all_table.setVisibility(View.VISIBLE);
}
break;
default:
//do something
......
......@@ -11,6 +11,7 @@ import android.widget.LinearLayout;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.DiscountAdapter;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration;
import com.qmuiteam.qmui.layout.QMUILinearLayout;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.QMUITopBar;
......@@ -20,6 +21,7 @@ import java.util.List;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
......@@ -161,7 +163,9 @@ public class DiscountDialog extends Dialog {
}
closeDialog();
});
recycler_discount.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.HORIZONTAL_LIST));
recycler_discount.setLayoutManager(createLayoutManager());
recycler_discount.setItemAnimator(new DefaultItemAnimator());
recycler_discount.setAdapter(mAdapter);
}
......
......@@ -5,29 +5,29 @@
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->
<!-- <com.google.android.material.appbar.AppBarLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->
<!--&lt;!&ndash; <com.google.android.material.appbar.AppBarLayout&ndash;&gt;-->
<!--&lt;!&ndash; android:layout_width="match_parent"&ndash;&gt;-->
<!--&lt;!&ndash; android:layout_height="wrap_content">&ndash;&gt;-->
<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="100dp"-->
<!-- android:background="#222222"-->
<!-- android:gravity="center"-->
<!-- android:text="该区域可折叠"-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textSize="30sp"-->
<!-- app:layout_scrollFlags="scroll" />-->
<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="50dp"-->
<!-- android:background="#DD012D"-->
<!-- android:gravity="center"-->
<!-- android:text="该区域为上滑至头部固定区域"-->
<!-- android:textColor="@android:color/white"-->
<!-- android:textSize="20sp" />-->
<!-- </com.google.android.material.appbar.AppBarLayout>-->
<!--&lt;!&ndash; <TextView&ndash;&gt;-->
<!--&lt;!&ndash; android:layout_width="match_parent"&ndash;&gt;-->
<!--&lt;!&ndash; android:layout_height="100dp"&ndash;&gt;-->
<!--&lt;!&ndash; android:background="#222222"&ndash;&gt;-->
<!--&lt;!&ndash; android:gravity="center"&ndash;&gt;-->
<!--&lt;!&ndash; android:text="该区域可折叠"&ndash;&gt;-->
<!--&lt;!&ndash; android:textColor="@android:color/white"&ndash;&gt;-->
<!--&lt;!&ndash; android:textSize="30sp"&ndash;&gt;-->
<!--&lt;!&ndash; app:layout_scrollFlags="scroll" />&ndash;&gt;-->
<!--&lt;!&ndash; <TextView&ndash;&gt;-->
<!--&lt;!&ndash; android:layout_width="match_parent"&ndash;&gt;-->
<!--&lt;!&ndash; android:layout_height="50dp"&ndash;&gt;-->
<!--&lt;!&ndash; android:background="#DD012D"&ndash;&gt;-->
<!--&lt;!&ndash; android:gravity="center"&ndash;&gt;-->
<!--&lt;!&ndash; android:text="该区域为上滑至头部固定区域"&ndash;&gt;-->
<!--&lt;!&ndash; android:textColor="@android:color/white"&ndash;&gt;-->
<!--&lt;!&ndash; android:textSize="20sp" />&ndash;&gt;-->
<!--&lt;!&ndash; </com.google.android.material.appbar.AppBarLayout>&ndash;&gt;-->
<!-- <com.google.android.material.bottomappbar.BottomAppBar-->
<!-- android:id="@+id/bar"-->
......@@ -54,48 +54,74 @@
<!-- <com.google.android.material.navigation.NavigationView-->
<!-- android:id="@+id/navigation_view"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content" />-->
<!-- android:layout_height="wrap_content"-->
<!-- app:menu="@menu/table_function_menu"/>-->
<!-- </FrameLayout>-->
<!--</androidx.coordinatorlayout.widget.CoordinatorLayout>-->
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@color/green_400">
android:background="@color/red">
<!-- <include layout="@layout/cat_bottomappbar_content"/>-->
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#222222"
android:gravity="center"
android:text="该区域可折叠"
android:textColor="@android:color/white"
android:textSize="30sp"
app:layout_scrollFlags="scroll" />
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#DD012D"
android:gravity="center"
android:text="该区域为上滑至头部固定区域"
android:textColor="@android:color/white"
android:textSize="20sp" />
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:fitsSystemWindows="true" />
android:fitsSystemWindows="true"
app:navigationContentDescription="contentDescription"
app:navigationIcon="@drawable/ic_red_delete" />
<!-- <com.google.android.material.floatingactionbutton.FloatingActionButton-->
<!-- android:id="@+id/fab"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_anchor="@+id/bar"-->
<!-- app:srcCompat="@drawable/ic_account" />-->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="contentDescription2"
app:layout_anchor="@id/bar"
app:srcCompat="@drawable/ic_add_have_border" />
<!-- <FrameLayout-->
<!-- android:id="@+id/bottom_drawer"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:elevation="16dp"-->
<!-- app:behavior_hideable="true"-->
<!-- app:layout_behavior="@string/bottom_sheet_behavior">-->
<FrameLayout
android:id="@+id/bottom_drawer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="16dp"
app:behavior_hideable="true"
app:layout_behavior="@string/bottom_sheet_behavior">
<!-- <com.google.android.material.navigation.NavigationView-->
<!-- android:id="@+id/navigation_view"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:menu="@menu/table_function_menu" />-->
<!-- </FrameLayout>-->
<com.google.android.material.navigation.NavigationView
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/demo_primary" />
</FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -121,4 +121,4 @@
android:id="@+id/fl_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
\ No newline at end of file
</merge>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -291,4 +291,4 @@
android:text="取消狀態異常,輕觸重試"
android:visibility="gone"/>
</FrameLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>
\ No newline at end of file
</merge>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout
android:id="@+id/windowInsetLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/theme_white_color"
android:orientation="vertical">
<Chronometer
......@@ -20,20 +19,6 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_table"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="1"-->
<!-- android:drawableLeft="@drawable/qmui_icon_topbar_back"-->
<!-- android:text="105A-2"-->
<!-- android:background="#096791"-->
<!-- android:paddingLeft="@dimen/dp_5"-->
<!-- android:gravity="center_vertical"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:textSize="@dimen/font_large"-->
<!-- android:textStyle="bold" />-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
......@@ -227,5 +212,4 @@
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_50"
android:layout="@layout/table_stub_transfer_food" />
</FrameLayout>
\ No newline at end of file
</merge>
\ No newline at end of file
......@@ -17,6 +17,9 @@
android:id="@+id/recycler_discount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="3" />
......
......@@ -7,7 +7,6 @@
android:background="@android:color/transparent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_fine_item_all"
android:layout_width="match_parent"
......@@ -15,7 +14,6 @@
android:fadeScrollbars="false"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_fine_item_kind_item"
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/windowInsetLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -15,31 +16,31 @@
android:id="@+id/ed_value"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_60"
android:layout_centerInParent="true"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:background="@drawable/table_shape_input_table_number_frame"
android:ems="10"
android:enabled="false"
android:gravity="right|center_vertical"
android:hint="@string/please_input_table_number"
android:textSize="@dimen/sp_28"
android:inputType="numberDecimal"
android:paddingLeft="@dimen/dp_8"
android:paddingRight="@dimen/dp_40"
android:layout_centerInParent="true"
android:gravity="right|center_vertical"
android:inputType="numberDecimal"
android:singleLine="true"
android:textColor="@color/table_input_table_keypad"
android:textColorHint="@color/theme_hint_color"
android:textSize="@dimen/sp_28"
android:textStyle="bold" />
<ImageView
android:id="@+id/iv_clear_account"
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"
android:padding="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_25"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_25"
android:padding="@dimen/dp_2"
android:src="@mipmap/ic_clear_text"
android:visibility="gone" />
......@@ -96,8 +97,8 @@
android:layout_marginRight="2dp"
android:layout_weight="1"
android:focusable="true"
android:layerType="software"
android:gravity="center"
android:layerType="software"
android:tag="8"
android:text="@string/Key_8"
android:textColor="@color/table_input_table_keypad"
......@@ -110,8 +111,8 @@
android:layout_height="fill_parent"
android:layout_weight="1"
android:focusable="true"
android:layerType="software"
android:gravity="center"
android:layerType="software"
android:tag="9"
android:text="@string/Key_9"
android:textColor="@color/table_input_table_keypad"
......@@ -129,12 +130,12 @@
android:id="@+id/btn_B"
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:focusable="true"
android:layerType="software"
android:gravity="center"
android:layerType="software"
android:tag="56"
android:text="B"
android:textColor="@color/table_input_table_keypad"
......@@ -145,12 +146,12 @@
android:id="@+id/btn_4"
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:focusable="true"
android:layerType="software"
android:gravity="center"
android:layerType="software"
android:tag="4"
android:text="@string/Key_4"
android:textColor="@color/table_input_table_keypad"
......@@ -161,12 +162,12 @@
android:id="@+id/btn_5"
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:focusable="true"
android:layerType="software"
android:gravity="center"
android:layerType="software"
android:tag="5"
android:text="@string/Key_5"
android:textColor="@color/table_input_table_keypad"
......@@ -180,8 +181,8 @@
android:layout_marginTop="1dp"
android:layout_weight="1"
android:focusable="true"
android:layerType="software"
android:gravity="center"
android:layerType="software"
android:tag="6"
android:text="@string/Key_6"
android:textColor="@color/table_input_table_keypad"
......@@ -199,12 +200,12 @@
android:id="@+id/btn_C"
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:focusable="true"
android:layerType="software"
android:gravity="center"
android:layerType="software"
android:tag="57"
android:text="-"
android:textColor="@color/table_input_table_keypad"
......@@ -215,12 +216,12 @@
android:id="@+id/btn_1"
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:focusable="true"
android:layerType="software"
android:gravity="center"
android:layerType="software"
android:tag="1"
android:text="@string/Key_1"
android:textColor="@color/table_input_table_keypad"
......@@ -231,12 +232,12 @@
android:id="@+id/btn_2"
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:focusable="true"
android:layerType="software"
android:gravity="center"
android:layerType="software"
android:tag="2"
android:text="@string/Key_2"
android:textColor="@color/table_input_table_keypad"
......@@ -250,8 +251,8 @@
android:layout_marginTop="1dp"
android:layout_weight="1"
android:focusable="true"
android:layerType="software"
android:gravity="center"
android:layerType="software"
android:tag="3"
android:text="@string/Key_3"
android:textColor="@color/table_input_table_keypad"
......@@ -270,8 +271,8 @@
android:id="@+id/btn_more"
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:focusable="true"
android:gravity="center"
......@@ -286,8 +287,8 @@
android:id="@+id/btn_clear"
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:focusable="true"
android:gravity="center"
......@@ -303,8 +304,8 @@
android:id="@+id/btn_0"
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:focusable="true"
android:gravity="center"
......
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_area"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_45"
android:background="@drawable/selector_item_background"
android:gravity="center"
android:orientation="horizontal"
android:text="A1"
android:textColor="@color/black"
android:textSize="@dimen/sp_16">
</TextView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
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.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:icon="@drawable/meal_muleiple_selection"
android:title="选择"
app:showAsAction="ifRoom"/>
</menu>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/send_order"
android:title="送單" />
......
......@@ -46,7 +46,7 @@ ext {
"retrofit" : "com.squareup.retrofit2:retrofit:${version["retrofitSdkVersion"]}",
"retrofit-converter-gson" : "com.squareup.retrofit2:converter-gson:${version["retrofitSdkVersion"]}",
"retrofit-adapter-rxjava" : "com.squareup.retrofit2:adapter-rxjava:${version["retrofitSdkVersion"]}",
"retrofit-adapter-rxjava2": "com.squareup.retrofit2:adapter-rxjava2:${version["retrofitSdkVersion"]}",
"retrofit-adapter-rxjava2" : "com.squareup.retrofit2:adapter-rxjava2:${version["retrofitSdkVersion"]}",
"okhttp3" : "com.squareup.okhttp3:okhttp:3.8.1",
"okhttp-urlconnection" : "com.squareup.okhttp:okhttp-urlconnection:2.0.0",
"glide" : "com.github.bumptech.glide:glide:${version["glideSdkVersion"]}",
......@@ -67,6 +67,7 @@ ext {
"vlayout" : "com.alibaba.android:vlayout:1.1.0@aar",
"loadsir" : "com.kingja.loadsir:loadsir:1.3.8",
"lottie" : "com.airbnb.android:lottie:3.6.1",
"loadingIndicatorView" : "com.wang.avi:library:2.1.3",
//rx1
"rxandroid" : "io.reactivex:rxandroid:1.2.1",
......
......@@ -19,6 +19,7 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.View;
......@@ -27,6 +28,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.jess.arms.R;
import com.jess.arms.base.delegate.IActivity;
import com.jess.arms.integration.cache.Cache;
import com.jess.arms.integration.cache.CacheType;
......@@ -36,6 +38,7 @@ import com.jess.arms.utils.AndroidWorkaround;
import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.arch.QMUIActivity;
import com.qmuiteam.qmui.util.QMUIDeviceHelper;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import com.trello.rxlifecycle2.android.ActivityEvent;
import javax.inject.Inject;
......@@ -138,6 +141,17 @@ public abstract class BaseActivity<P extends IPresenter> extends AppCompatActivi
this.mPresenter = null;
}
@Override
public int getStatusBarColor() {
//默认为主题色
return Color.parseColor("#398BED");
}
@Override
public boolean useLightMode() {
//默认状态栏白色字体
return false;
}
/**
* 是否使用eventBus,默认为使用(true),
......
......@@ -18,6 +18,7 @@ package com.jess.arms.base;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.graphics.Color;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.MotionEvent;
......@@ -150,6 +151,18 @@ public abstract class BaseFragmentActivity<P extends IPresenter> extends Fragmen
}
@Override
public int getStatusBarColor() {
//默认为主题色
return Color.parseColor("#398BED");
}
@Override
public boolean useLightMode() {
//默认状态栏白色字体
return false;
}
@Override
public SupportActivityDelegate getSupportDelegate() {
return mDelegate;
}
......
......@@ -16,9 +16,12 @@
package com.jess.arms.base.delegate;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.StatusBarUtil;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
import org.simple.eventbus.EventBus;
......@@ -42,15 +45,22 @@ public class ActivityDelegateImpl implements ActivityDelegate {
this.iActivity = (IActivity) activity;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
//如果要使用 EventBus 请将此方法返回 true
if (iActivity.useEventBus()){
if (iActivity.useEventBus()) {
//注册到事件主线
EventBus.getDefault().register(mActivity);
}
// if (iActivity.useLightMode()) {
// //设置状态栏黑色字体
// QMUIStatusBarHelper.setStatusBarLightMode(mActivity);
// } else {
// //默认状态栏白色字体
// QMUIStatusBarHelper.setStatusBarDarkMode(mActivity);
// }
// //设置沉浸式状态栏颜色
// QMUIStatusBarHelper.translucent(mActivity, iActivity.getStatusBarColor());
//这里提供 AppComponent 对象给 BaseActivity 的子类, 用于 Dagger2 的依赖注入
iActivity.setupActivityComponent(ArmsUtils.obtainAppComponentFromContext(mActivity));
}
......
......@@ -92,6 +92,19 @@ public interface IActivity {
*/
boolean useFragment();
/**
* 获取沉浸式状态栏颜色,默认不设置的情况下为Theme color
* @return
*/
int getStatusBarColor();
/**
* 是否将状态栏字体颜色为黑色,默认为白色
* 持 4.4 以上版本 MIUI 和 Flyme,以及 6.0 以上版本的其他 Android
* @return
*/
boolean useLightMode();
void initIntent();
void initTopBar();
......
......@@ -130,35 +130,23 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.gcssloop.recyclerview:pagerlayoutmanager:2.3.8'
//陰影背景
api 'com.github.lihangleo2:ShadowLayout:2.1.6'
//時間選擇控件
api 'com.contrarywind:Android-PickerView:3.2.4'
//商米打印庫
api 'com.sunmi:printerlibrary:1.0.7'
//上下拉刷新
api 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
//多功能輸入框
api 'com.rengwuxian.materialedittext:library:2.1.4'
//扫码
api 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7'
//加载反馈页管理
api rootProject.ext.dependencies["loadsir"]
//rxjava,rxbinding相關工具類
api 'com.github.xuexiangjys:RxUtil2:1.1.5'
//时间选择器
api rootProject.ext.dependencies["pickerview"]
//底部功能導航view
api 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
//lottie
api rootProject.ext.dependencies["lottie"]
//滴滴開源 哆啦A夢:辅助开发工具、测试效率工具、视觉辅助工具
debugImplementation 'com.didichuxing.doraemonkit:dokitx:3.3.3'
releaseImplementation 'com.didichuxing.doraemonkit:dokitx-no-op:3.3.3'
//美團金剛狼日誌框架
implementation rootProject.ext.dependencies['logan']
//RecyclerView 流式佈局layoutManager
api 'com.google.android:flexbox:1.0.0'
//上下拉刷新
api 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
//时间选择器
api rootProject.ext.dependencies["pickerview"]
// implementation 'com.github.gzu-liyujiang:Android_CN_OAID:版本号'
// 用于生成Java文件的库
......
......@@ -8,7 +8,9 @@ import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.RemoteException;
import androidx.annotation.NonNull;
import com.billy.cc.core.component.CC;
import com.dianping.logan.Logan;
import com.dianping.logan.OnLoganProtocolStatus;
......@@ -52,11 +54,12 @@ import com.kingja.loadsir.core.LoadSir;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxIOTask;
import java.io.File;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import io.reactivex.functions.Consumer;
import io.reactivex.plugins.RxJavaPlugins;
import me.jessyan.autosize.AutoSize;
......@@ -115,12 +118,25 @@ public class GsaCloudApplication extends BaseApplication {
//初始化美團日誌框架
initLogan();
LoganManager.w_action(TAG, TAG + ": onCreate start.....");
RxJavaUtils.doInIOThread(new RxIOTask<Object>(0) {
@Override
public Void doInIOThread(Object o) {
LoganManager.w_action(TAG, "init start.....");
//初始化設備唯一ID
initDeviceId();
//
//初始化Hyweb支付回調
initHywebCommandImpl();
//初始化服務器地址
initDomainUrl();
//初始化數據庫框架
initGreenDao();
//初始化打印相關
initPrint();
//初始化crash記錄
AppCrashHandler.getInstance().init(getAppContext());
//初始化Rxjava相關
initRxjava();
//初始化Http请求响应进度监听器
// initHttpProgressListener();
//初始化QMUI相关
......@@ -133,20 +149,12 @@ public class GsaCloudApplication extends BaseApplication {
initLoadSir();
//初始化今日頭條適配方案
initAutoSize();
//初始化數據庫框架
initGreenDao();
//初始化打印相關
initPrint();
//初始化crash記錄
AppCrashHandler.getInstance().init(this);
//初始化Rxjava相關
initRxjava();
uiStyleConfiguration = new UIStyleExtendedConfiguration();
functionConfiguration = new FunctionExtendedConfiguration();
//上傳餐廳擴展信息
ExpandInfoSetting.initUpdateExtendedConfiguration(uiStyleConfiguration, functionConfiguration);
uploadExpandInfo();
LoganManager.w_action(TAG, "init end.....");
return null;
}
});
LoganManager.w_action(TAG, TAG + ": onCreate end.....");
}
......@@ -187,7 +195,7 @@ public class GsaCloudApplication extends BaseApplication {
* 初始化滴滴開發,測試輔助工具哆啦A夢
*/
private void initDoraemonKit() {
// DoraemonKit.install(getAppContext(), DoraemonKitConfig.PRODUCE_ID);
DoraemonKit.install(getAppContext(), DoraemonKitConfig.PRODUCE_ID);
}
/**
......@@ -336,7 +344,6 @@ public class GsaCloudApplication extends BaseApplication {
});
}
private void initPrint() {
if (PrintConstans.PRINT_MODEL_V2.contains(Build.MODEL)) {
//商米打印
......@@ -420,31 +427,12 @@ public class GsaCloudApplication extends BaseApplication {
RetrofitUrlManager.getInstance().setGlobalDomain(HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL);
}
private void initXLog() {
// LogConfiguration config = new LogConfiguration.Builder()
// .logLevel(BuildConfig.DEBUG ? LogLevel.ALL // 指定日志级别,低于该级别的日志将不会被打印,默认为 LogLevel.ALL
// : LogLevel.NONE)
// .tag("GSA_Cloud_TAG") // 指定 TAG,默认为 "X-LOG"
// .addInterceptor(new BlacklistTagsFilterInterceptor( // 添加黑名单 TAG 过滤器
// "blacklist1", "blacklist2", "blacklist3"))
// .build();
//
// Printer androidPrinter = new AndroidPrinter(); // 通过 android.util.Log 打印日志的打印器
// Printer consolePrinter = new ConsolePrinter(); // 通过 System.out 打印日志到控制台的打印器
// Printer filePrinter = new FilePrinter // 打印日志到文件的打印器
// .Builder(FileUtils.ACTIONLOG_PATH) // 指定保存日志文件的路径
// .fileNameGenerator(new DateFileNameGenerator()) // 指定日志文件名生成器,默认为 ChangelessFileNameGenerator("log")
// .backupStrategy(new MyBackupStrategy(FileUtils.ACTION_MAX_SIZE)) // 指定日志文件备份策略,默认为 FileSizeBackupStrategy(1024 * 1024)
// .cleanStrategy(new FileLastModifiedCleanStrategy(FileUtils.ACTION_MAX_FILE_TIME)) // 指定日志文件清除策略,默认为 NeverCleanStrategy()
// .build();
// XLog.init( // 初始化 XLog
// config, // 指定日志配置,如果不指定,会默认使用 new LogConfiguration.Builder().build()
// androidPrinter, // 添加任意多的打印器。如果没有添加任何打印器,会默认使用 AndroidPrinter(Android)/ConsolePrinter(java)
// consolePrinter,
// filePrinter);
private void uploadExpandInfo() {
uiStyleConfiguration = new UIStyleExtendedConfiguration();
functionConfiguration = new FunctionExtendedConfiguration();
ExpandInfoSetting.initUpdateExtendedConfiguration(uiStyleConfiguration, functionConfiguration);
}
private void initAutoSize() {
//当 App 中出现多进程, 并且您需要适配所有的进程, 就需要在 App 初始化时调用 initCompatMultiProcess()
//在 Demo 中跳转的三方库中的 DefaultErrorActivity 就是在另外一个进程中, 所以要想适配这个 Activity 就需要调用 initCompatMultiProcess()
......
......@@ -119,6 +119,16 @@ public class FunctionExtendedConfiguration {
.remark("PLU左側滑動信息配置")
.build();
private ExpandInfoSetting BottomPoliteLanguage = ExpandInfoSetting.builder()
.valueChar("歡迎光臨!")
.remark("打印單底部禮貌用語")
.build();
private ExpandInfoSetting PrintHeaderRestaurantPhone = ExpandInfoSetting.builder()
.valueChar("電話:888888")
.remark("頂部打印餐廳電話")
.build();
/**
* skyorder相關
*/
......@@ -243,4 +253,11 @@ public class FunctionExtendedConfiguration {
return OpenTableAutoShowKeyboard.getValue();
}
public <T> T getBottomPoliteLanguageVaule() {
return BottomPoliteLanguage.getValue();
}
public <T> T getPrintHeaderRestaurantPhoneVaule() {
return PrintHeaderRestaurantPhone.getValue();
}
}
......@@ -4,6 +4,8 @@ import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
......
......@@ -3,6 +3,10 @@ package com.gingersoft.gsa.cloud.common.core.table;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import java.io.Serializable;
import java.util.List;
......@@ -14,7 +18,6 @@ import lombok.Data;
* 创建日期:2019-12-28
* 修订历史:2019-12-28
* 描述:餐檯實體類
*
*/
public class TableBean {
......@@ -63,7 +66,7 @@ public class TableBean {
}
@Data
public static class DataBean implements Serializable , Parcelable {
public static class DataBean implements Serializable, Parcelable, Cloneable {
/**
* id : 25839
* tableName : ceshitai1*
......@@ -90,6 +93,14 @@ public class TableBean {
private int id;
private String tableName;
/**
* 區域ID
*/
private int regionId;
/**
* 區域名稱
*/
private String regionName;
private int restaurantId;
private Long orderId;
private String qrCode;
......@@ -172,6 +183,8 @@ public class TableBean {
public DataBean(DataBean dataBean) {
this.id = dataBean.id;
this.tableName = dataBean.tableName;
this.regionId = dataBean.regionId;
this.regionName = dataBean.regionName;
this.orderId = dataBean.orderId;
this.restaurantId = dataBean.restaurantId;
this.qrCode = dataBean.qrCode;
......@@ -196,6 +209,16 @@ public class TableBean {
this.scanId = dataBean.scanId;
}
@NonNull
@Override
public TableBean.DataBean clone() throws CloneNotSupportedException {
try {
return (TableBean.DataBean) super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return new TableBean.DataBean(this);
}
@Override
public int describeContents() {
......@@ -206,6 +229,8 @@ public class TableBean {
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.id);
dest.writeString(this.tableName);
dest.writeInt(this.regionId);
dest.writeString(this.regionName);
dest.writeInt(this.restaurantId);
dest.writeValue(this.orderId);
dest.writeString(this.qrCode);
......@@ -233,6 +258,8 @@ public class TableBean {
protected DataBean(Parcel in) {
this.id = in.readInt();
this.tableName = in.readString();
this.regionId = in.readInt();
this.regionName = in.readString();
this.restaurantId = in.readInt();
this.orderId = (Long) in.readValue(Long.class.getClassLoader());
this.qrCode = in.readString();
......@@ -270,7 +297,7 @@ public class TableBean {
};
}
public static TableBean.DataBean splitTableTransformTable(TableBean.DataBean mainTable,TableExtBean.DataBean dataBean) {
public static TableBean.DataBean splitTableTransformTable(TableBean.DataBean mainTable, TableExtBean.DataBean dataBean) {
TableBean.DataBean tableBean = new TableBean.DataBean();
tableBean.setId(dataBean.getId());
tableBean.setTableName(dataBean.getTableName() + "-" + dataBean.getTableNumber());
......
......@@ -105,4 +105,22 @@ public class CollectionUtils {
return new ArrayList<E>();
}
}
/**
* 过滤List中为null的元素
* @param oldList
* @param <T>
* @return
*/
public static <T> List<T> removeNull(List<? extends T> oldList) {
// 临时集合
List<T> listTemp = new ArrayList();
for (int i = 0;i < oldList.size(); i++) {
// 保存不为空的元素
if (oldList.get(i) != null) {
listTemp.add(oldList.get(i));
}
}
return listTemp;
}
}
package com.gingersoft.gsa.cloud.order.order;
import android.text.TextUtils;
import android.util.ArrayMap;
import com.gingersoft.gsa.cloud.common.core.member.MemberInfo;
import com.gingersoft.gsa.cloud.common.core.table.TableBean;
......@@ -11,7 +12,9 @@ import com.gingersoft.gsa.cloud.pay.bean.PayMethod;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import lombok.Getter;
import lombok.Setter;
......@@ -41,6 +44,7 @@ public class DoshokuOrder extends BaseOrder {
private DoshokuOrder() {
super();
initBillStatus(false,false);
}
/**
......@@ -72,9 +76,12 @@ public class DoshokuOrder extends BaseOrder {
*/
private List<PayMethod> billMoney = new ArrayList<>();
/**
* 是否需要更新會員信息(如開台有然後清除: "true:false" 這種情況需要重新送單更新會員信息)
* 賬單項是否需要更新:會員項,整單折扣項
*/
private String memberUpdateStatus = true + "-" + true;
private ArrayMap<Integer, String> billItemStatusMap = new ArrayMap<>(2);
public static final int MEMBER_ITEM_TAG = 10;
public static final int DISCOUNT_ITEM_TAG = 11;
private boolean billHasChanged = false;
/**
* 記錄修改訂單操作
* false#送單
......@@ -147,22 +154,57 @@ public class DoshokuOrder extends BaseOrder {
return deleteDiscountIds;
}
public boolean needUpdateMemberInfo() {
if (TextUtils.isEmpty(memberUpdateStatus)) {
return false;
public void initBillStatus(boolean memberItemStatus, boolean discountItemStatus) {
billItemStatusMap.put(MEMBER_ITEM_TAG, memberItemStatus + "-" + memberItemStatus);
billItemStatusMap.put(DISCOUNT_ITEM_TAG, discountItemStatus + "-" + discountItemStatus);
billHasChanged = false;
}
String[] status = memberUpdateStatus.split("-");
public void setBillItemStatus(int key) {
String value = billItemStatusMap.get(key);
String[] status = value.split("-");
if (status.length == 2) {
billItemStatusMap.put(key, Boolean.parseBoolean(status[0]) + "-" + !Boolean.parseBoolean(status[1]));
changeBillStatus();
}
}
public void changeBillStatus() {
Set<Integer> keySet = billItemStatusMap.keySet();
Iterator<Integer> iterator = keySet.iterator();
while (iterator.hasNext()) {
int key = iterator.next();
String value = billItemStatusMap.get(key);
String[] status = value.split("-");
if (status.length == 2) {
if (Boolean.parseBoolean(status[0]) != Boolean.parseBoolean(status[1])) {
return true;
billHasChanged = true;
return;
} else {
return false;
billHasChanged = false;
}
} else {
return false;
billHasChanged = false;
}
}
}
// public boolean needUpdateMemberInfo() {
// if (TextUtils.isEmpty(memberUpdateStatus)) {
// return false;
// }
// String[] status = memberUpdateStatus.split("-");
// if (status.length == 2) {
// if (Boolean.parseBoolean(status[0]) != Boolean.parseBoolean(status[1])) {
// return true;
// } else {
// return false;
// }
// } else {
// return false;
// }
// }
@Override
public void initialization() {
if (deleteMealOrders != null) {
......@@ -177,6 +219,10 @@ public class DoshokuOrder extends BaseOrder {
if (billMoney != null) {
billMoney.clear();
}
if (billItemStatusMap != null) {
billItemStatusMap.clear();
initBillStatus(false,false);
}
if (orderPlaced != null) {
orderPlaced = null;
}
......@@ -186,7 +232,7 @@ public class DoshokuOrder extends BaseOrder {
if (memberInfo != null) {
memberInfo = null;
}
memberUpdateStatus = null;
billHasChanged = false;
modifyOrder = false;
super.initialization();
......
package com.gingersoft.gsa.cloud.print.bean.adapter;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
......@@ -93,7 +94,7 @@ public class PrintContentAdapter implements AdaptationContent {
slipContent.setBillItemList(billItemCastPrintBillItemList(doshokuOrder.getShoppingCart().getBillItemList()));
slipContent.setWholeAmount(doshokuOrder.getShoppingCart().getWholeAmount());
slipContent.setTotalAmount(doshokuOrder.getShoppingCart().getTotalAmount());
slipContent.setPoliteLanguage("歡迎光臨!");
slipContent.setPoliteLanguage(GsaCloudApplication.functionConfiguration.getBottomPoliteLanguageVaule());
return slipContent;
}
......@@ -114,7 +115,7 @@ public class PrintContentAdapter implements AdaptationContent {
servingPaperContent.setOrderNo(doshokuOrder.getOrderNo());
//送單
servingPaperContent.setFoodItemList(orderDetailItemCastPrintFoodItemList(doshokuOrder.getNewFoodList()));
servingPaperContent.setPoliteLanguage("歡迎光臨!");
servingPaperContent.setPoliteLanguage(GsaCloudApplication.functionConfiguration.getBottomPoliteLanguageVaule());
return servingPaperContent;
}
......@@ -135,7 +136,7 @@ public class PrintContentAdapter implements AdaptationContent {
servingPaperContent.setOrderNo(doshokuOrder.getOrderNo());
// servingPaperContent.setFoodItemList(orderDetailItemCastPrintFoodItemList(doshokuOrder.getNewFoodList()));
servingPaperContent.setFoodItemList(orderDetailItemCastPrintFoodItemList(doshokuOrder.getShoppingCart().getOrderCommodityList()));
servingPaperContent.setPoliteLanguage("歡迎光臨!");
servingPaperContent.setPoliteLanguage(GsaCloudApplication.functionConfiguration.getBottomPoliteLanguageVaule());
return servingPaperContent;
}
......@@ -167,7 +168,7 @@ public class PrintContentAdapter implements AdaptationContent {
billContent.setOldPoints(doshokuOrder.getOldPoints());
billContent.setNowPoints(doshokuOrder.getNowPoints());
billContent.setIntegralQrCode(doshokuOrder.getIntegralQrcode());
billContent.setPoliteLanguage("謝謝光臨!");
billContent.setPoliteLanguage(GsaCloudApplication.functionConfiguration.getBottomPoliteLanguageVaule());
return billContent;
}
......@@ -275,7 +276,7 @@ public class PrintContentAdapter implements AdaptationContent {
takeawayPrintContent.setReceiver("收貨人: " + data.getRECEIVER());
}
takeawayPrintContent.setPhone("手機號: " + data.getPHONE());
takeawayPrintContent.setPoliteLanguage("謝謝光臨!");
takeawayPrintContent.setPoliteLanguage(GsaCloudApplication.functionConfiguration.getBottomPoliteLanguageVaule());
return takeawayPrintContent;
}
......
......@@ -22,18 +22,24 @@ import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import androidx.annotation.ColorInt;
import androidx.annotation.IntDef;
import androidx.core.view.ViewCompat;
import com.qmuiteam.qmui.R;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import static com.qmuiteam.qmui.util.QMUIDisplayHelper.getStatusBarHeight;
/**
* @author cginechen
* @date 2016-03-27
......@@ -49,9 +55,12 @@ public class QMUIStatusBarHelper {
public static float sVirtualDensity = -1;
public static float sVirtualDensityDpi = -1;
private static int sStatusbarHeight = -1;
private static @StatusBarType int mStatuBarType = STATUSBAR_TYPE_DEFAULT;
private static @StatusBarType
int mStatuBarType = STATUSBAR_TYPE_DEFAULT;
private static Integer sTransparentValue;
private static final int FAKE_STATUS_BAR_VIEW_ID = 100;
public static void translucent(Activity activity) {
translucent(activity.getWindow());
}
......@@ -104,7 +113,9 @@ public class QMUIStatusBarHelper {
// ZUK Z1是个另类,自家应用可以实现字体颜色变色,但没开放接口
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
// window.setStatusBarColor(Color.TRANSPARENT);
window.setStatusBarColor(colorOn5x);
} else {
// android 5不能修改状态栏字体颜色,因此直接用FLAG_TRANSLUCENT_STATUS,nexus表现为半透明
// 魅族和小米的表现如何?
......@@ -126,6 +137,85 @@ public class QMUIStatusBarHelper {
// window.getDecorView().setSystemUiVisibility(transparentValue);
// }
}
/************************************************/
// ViewGroup contentView = (ViewGroup) window.findViewById(android.R.id.content);
// // 移除彩色矩形,以免叠加
// View fakeStatusBarView = contentView.findViewById(FAKE_STATUS_BAR_VIEW_ID);
// if (fakeStatusBarView != null) {
// if (fakeStatusBarView.getVisibility() == View.GONE) {
// fakeStatusBarView.setVisibility(View.VISIBLE);
// }
// fakeStatusBarView.setBackgroundColor(colorOn5x);
// } else {
// contentView.addView(createStatusBarView(window.getContext(), colorOn5x));
// }
setRootView(window);
/************************************************/
}
/**
* 设置根布局参数
*/
private static void setRootView(Window window) {
ViewGroup parent = (ViewGroup) window.findViewById(android.R.id.content);
for (int i = 0, count = parent.getChildCount(); i < count; i++) {
View childView = parent.getChildAt(i);
if (childView instanceof ViewGroup) {
childView.setFitsSystemWindows(false);
((ViewGroup) childView).setClipToPadding(true);
}
}
}
/**
* 生成一个和状态栏大小相同的彩色矩形条
*
* @param context 需要设置的 activity
* @param color 状态栏颜色值
* @return 状态栏矩形条
*/
private static View createStatusBarView(Context context, @ColorInt int color) {
return createStatusBarView(context, color, 0);
}
/**
* 生成一个和状态栏大小相同的半透明矩形条
*
* @param context 需要设置的activity
* @param color 状态栏颜色值
* @param alpha 透明值
* @return 状态栏矩形条
*/
private static View createStatusBarView(Context context, @ColorInt int color, int alpha) {
// 绘制一个和状态栏一样高的矩形
View statusBarView = new View(context);
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, QMUIDisplayHelper.getStatusBarHeight(context));
statusBarView.setLayoutParams(params);
statusBarView.setBackgroundColor(calculateStatusColor(color, alpha));
statusBarView.setId(FAKE_STATUS_BAR_VIEW_ID);
return statusBarView;
}
/**
* 计算状态栏颜色
*
* @param color color值
* @param alpha alpha值
* @return 最终的状态栏颜色
*/
private static int calculateStatusColor(@ColorInt int color, int alpha) {
if (alpha == 0) {
return color;
}
float a = 1 - alpha / 255f;
int red = color >> 16 & 0xff;
int green = color >> 8 & 0xff;
int blue = color & 0xff;
red = (int) (red * a + 0.5);
green = (int) (green * a + 0.5);
blue = (int) (blue * a + 0.5);
return 0xff << 24 | red << 16 | green << 8 | blue;
}
@TargetApi(28)
......
......@@ -37,7 +37,7 @@ android {
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
proguardFiles 'proguard-rules.pro'
}
release {
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
......@@ -45,7 +45,7 @@ android {
minifyEnabled true
// shrinkResources true
zipAlignEnabled true
proguardFiles 'proguard.cfg'
proguardFiles 'proguard-rules.pro'
}
}
}
......@@ -74,4 +74,16 @@ dependencies {
kapt rootProject.ext.dependencies["butterknife-compiler"]
api rootProject.ext.dependencies["xpopup"]
api rootProject.ext.dependencies["coordinatorlayout"]
//多功能輸入框
api 'com.rengwuxian.materialedittext:library:2.1.4'
//底部功能導航view
api 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
//RecyclerView 流式佈局layoutManager
api 'com.google.android:flexbox:1.0.0'
//陰影背景
api 'com.github.lihangleo2:ShadowLayout:2.1.6'
//lottie
api rootProject.ext.dependencies["lottie"]
// loadingView
api rootProject.ext.dependencies["loadingIndicatorView"]
}
......@@ -19,3 +19,6 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class com.wang.avi.** { *; }
-keep class com.wang.avi.indicators.** { *; }
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.gingersoft.gsa.cloud.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
......@@ -56,6 +57,11 @@ public class AddKeyBoard extends FrameLayout {
this.onKeyResultListener = onKeyResultListener;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return super.onInterceptTouchEvent(ev);
}
private class KeyBoardAdapter extends RecyclerView.Adapter<KeyBoardAdapter.ViewHolder> {
@NonNull
......
......@@ -12,6 +12,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.ui.R;
import com.wang.avi.AVLoadingIndicatorView;
/**
......@@ -26,6 +27,7 @@ public class LoadingDialog {
private static Dialog mLoadingDialog;
private static AnimationDrawable animationDrawable;
private static TextView loadingText;
private static AVLoadingIndicatorView loadingProgress;
/**
* 显示加载对话框
......@@ -36,6 +38,7 @@ public class LoadingDialog {
*/
public static Dialog showDialogForLoading(Context context, String msg, boolean cancelable) {
View view = LayoutInflater.from(context).inflate(R.layout.ui_dialog_loading, null);
loadingProgress = view.findViewById(R.id.loading_progress);
TextView loadingText = view.findViewById(R.id.tv_loading_dialog_text);
loadingText.setText(msg);
......@@ -53,37 +56,14 @@ public class LoadingDialog {
mLoadingDialog.setCancelable(cancelable);
mLoadingDialog.setCanceledOnTouchOutside(false);
mLoadingDialog.setContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
mLoadingDialog.show();
return mLoadingDialog;
}
/**
* 重新显示一個加载对话框,上面靜態的加載框,其他頁面的加載關閉了,會導致影響到當前頁面的加載框。
*
* @param context 上下文
* @param msg 对话框显示内容
* @param cancelable 对话框是否可以取消
*/
public static Dialog showNewDialogForLoading(Context context, String msg, boolean cancelable) {
View view = LayoutInflater.from(context).inflate(R.layout.ui_dialog_loading, null);
loadingText = view.findViewById(R.id.tv_loading_dialog_text);
loadingText.setText(msg);
Dialog mLoadingDialog = new Dialog(context, R.style.ui_loading_dialog);
mLoadingDialog.setCancelable(cancelable);
mLoadingDialog.setCanceledOnTouchOutside(false);
Window window = mLoadingDialog.getWindow();
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
window.getDecorView().setBackgroundResource(android.R.color.transparent);
mLoadingDialog.setContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
loadingProgress.show();
mLoadingDialog.show();
return mLoadingDialog;
}
public static Dialog showDialogForLoading(Context context) {
View view = LayoutInflater.from(context).inflate(R.layout.ui_dialog_loading, null);
loadingProgress = view.findViewById(R.id.loading_progress);
TextView loadingText = view.findViewById(R.id.tv_loading_dialog_text);
loadingText.setText(context.getString(R.string.base_loading));
......@@ -97,6 +77,7 @@ public class LoadingDialog {
mLoadingDialog.setCanceledOnTouchOutside(false);
mLoadingDialog.setContentView(view, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
try {
loadingProgress.show();
mLoadingDialog.show();
} catch (Exception e) {
e.printStackTrace();
......@@ -119,6 +100,10 @@ public class LoadingDialog {
animationDrawable.stop();
animationDrawable = null;
}
if (loadingProgress != null) {
loadingProgress.hide();
loadingProgress = null;
}
if (mLoadingDialog != null) {
mLoadingDialog.dismiss();
mLoadingDialog = null;
......
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/ui_shape_rect_loading"
android:gravity="center"
android:minWidth="120dp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:minHeight="120dp"
android:minWidth="120dp"
android:orientation="vertical"
android:padding="10dp">
<ProgressBar
style="@style/AppTheme.Base"
<!-- <ProgressBar-->
<!-- style="@style/AppTheme.Base"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_width="wrap_content" />-->
<com.wang.avi.AVLoadingIndicatorView
style="@style/AVLoadingIndicatorView"
app:indicatorColor="@color/theme_white_color"
app:indicatorName="BallSpinFadeLoaderIndicator"
android:id="@+id/loading_progress"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:visibility="visible" />
<TextView
android:id="@+id/tv_loading_dialog_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:text="@string/ui_loading"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/load_dialog_text_size" />
......
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