Commit 92720ce0 by 宁斌

1、新增賬單內容、結賬頁面

parent b9711b76
...@@ -16,13 +16,13 @@ public class FunctionBean { ...@@ -16,13 +16,13 @@ public class FunctionBean {
/** /**
* success : true * success : true
* sysTime : -7.619911602086376E7 * sysTime : 1578629556190
* data : [{"id":-5.450051876040924E7,"status":-6.594638520577614E7,"resName":"non voluptate dolore","resUrl":"sint commodo e","imageURL":"magna sed amet","effectiveTime":8.640891249642807E7},{"id":1112433.804151535,"status":-3.182369490576437E7,"resName":"ipsum magna consequat","resUrl":"in aute","imageURL":"ex non","effectiveTime":-9849064.144339263},{"id":-2.01689121716702E7,"status":-2.10107447801203E7,"resName":"quis","resUrl":"labore consectetur nulla commodo dolor","imageURL":"reprehenderit elit ut","effectiveTime":-3.802933142238536E7},{"id":2.3366445040371537E7,"status":1.2426946110723421E7,"resName":"exercitation qui consectetur est","resUrl":"aute commodo dolor","imageURL":"ea sunt","effectiveTime":3.1788614539086968E7}] * data : [{"id":3815,"status":1,"effectiveTime":1598328927655,"resName":"GSA功能一號","resUrl":"www.baidu.com","imageURL":"https://hktest.ricepon.com:64377/ricepon-web/images/fantuan.png"},{"id":3816,"status":0,"resName":"GSA功能二號","resUrl":"www.baidu.com","imageURL":"https://hktest.ricepon.com:64377/ricepon-web/images/fantuan.png"}]
*/ */
private boolean success; private boolean success;
private String errMsg; private String errMsg;
private double sysTime; private long sysTime;
private List<Function> data; private List<Function> data;
public boolean isSuccess() { public boolean isSuccess() {
...@@ -41,11 +41,11 @@ public class FunctionBean { ...@@ -41,11 +41,11 @@ public class FunctionBean {
this.errMsg = errMsg; this.errMsg = errMsg;
} }
public double getSysTime() { public long getSysTime() {
return sysTime; return sysTime;
} }
public void setSysTime(double sysTime) { public void setSysTime(long sysTime) {
this.sysTime = sysTime; this.sysTime = sysTime;
} }
...@@ -59,12 +59,12 @@ public class FunctionBean { ...@@ -59,12 +59,12 @@ public class FunctionBean {
public static class DataBean { public static class DataBean {
/** /**
* id : 5 * id : 3815
* status : 1 * status : 1
* resName : non voluptate dolore * effectiveTime : 1598328927655
* resUrl : sint commodo e * resName : GSA功能一號
* imageURL : magna sed amet * resUrl : www.baidu.com
* effectiveTime : 640891249642807E7 * imageURL : https://hktest.ricepon.com:64377/ricepon-web/images/fantuan.png
*/ */
private int id; private int id;
...@@ -74,7 +74,6 @@ public class FunctionBean { ...@@ -74,7 +74,6 @@ public class FunctionBean {
private String resUrl; private String resUrl;
private String imageURL; private String imageURL;
public int getId() { public int getId() {
return id; return id;
} }
...@@ -91,6 +90,14 @@ public class FunctionBean { ...@@ -91,6 +90,14 @@ public class FunctionBean {
this.status = status; this.status = status;
} }
public long getEffectiveTime() {
return effectiveTime;
}
public void setEffectiveTime(long effectiveTime) {
this.effectiveTime = effectiveTime;
}
public String getResName() { public String getResName() {
return resName; return resName;
} }
...@@ -114,13 +121,5 @@ public class FunctionBean { ...@@ -114,13 +121,5 @@ public class FunctionBean {
public void setImageURL(String imageURL) { public void setImageURL(String imageURL) {
this.imageURL = imageURL; this.imageURL = imageURL;
} }
public long getEffectiveTime() {
return effectiveTime;
}
public void setEffectiveTime(long effectiveTime) {
this.effectiveTime = effectiveTime;
}
} }
} }
...@@ -4,6 +4,7 @@ import android.app.Application; ...@@ -4,6 +4,7 @@ import android.app.Application;
import android.util.Log; import android.util.Log;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.HomeTurnoverBean;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
...@@ -14,6 +15,7 @@ import com.jess.arms.http.imageloader.ImageLoader; ...@@ -14,6 +15,7 @@ import com.jess.arms.http.imageloader.ImageLoader;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull; import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody; import okhttp3.FormBody;
...@@ -80,6 +82,7 @@ public class HomePresenter extends BasePresenter<HomeContract.Model, HomeContrac ...@@ -80,6 +82,7 @@ public class HomePresenter extends BasePresenter<HomeContract.Model, HomeContrac
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<HomeTurnoverBean>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<HomeTurnoverBean>(mErrorHandler) {
@Override @Override
public void onNext(@NonNull HomeTurnoverBean info) { public void onNext(@NonNull HomeTurnoverBean info) {
if (info != null && info.isSuccess()) { if (info != null && info.isSuccess()) {
...@@ -90,6 +93,18 @@ public class HomePresenter extends BasePresenter<HomeContract.Model, HomeContrac ...@@ -90,6 +93,18 @@ public class HomePresenter extends BasePresenter<HomeContract.Model, HomeContrac
mRootView.showMessage("營業報表獲取失敗"); mRootView.showMessage("營業報表獲取失敗");
} }
} }
@Override
public void onComplete() {
super.onComplete();
RetrofitUrlManager.getInstance().putDomain("common", HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL);
}
@Override
public void onError(Throwable t) {
super.onError(t);
RetrofitUrlManager.getInstance().putDomain("common", HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL);
}
}); });
} }
......
...@@ -22,7 +22,6 @@ import com.qmuiteam.qmui.widget.QMUIViewPager; ...@@ -22,7 +22,6 @@ import com.qmuiteam.qmui.widget.QMUIViewPager;
import com.qmuiteam.qmui.widget.tab.QMUITab; import com.qmuiteam.qmui.widget.tab.QMUITab;
import com.qmuiteam.qmui.widget.tab.QMUITabBuilder; import com.qmuiteam.qmui.widget.tab.QMUITabBuilder;
import com.qmuiteam.qmui.widget.tab.QMUITabSegment; import com.qmuiteam.qmui.widget.tab.QMUITabSegment;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
......
...@@ -65,7 +65,7 @@ public class FunctionAdapter extends BaseAdapter { ...@@ -65,7 +65,7 @@ public class FunctionAdapter extends BaseAdapter {
viewholder = (ViewHolder) convertView.getTag(); viewholder = (ViewHolder) convertView.getTag();
} }
GlideUtils.display(mContext, viewholder.iv_image, dataBean.getImageURL(), R.drawable.main_function_down_data, R.drawable.main_function_down_data, R.drawable.main_function_down_data); GlideUtils.display(mContext, viewholder.iv_image, dataBean.getImageURL(), R.drawable.ic_selected_main, R.drawable.ic_selected_main, R.drawable.ic_selected_main);
viewholder.tv_title.setText(dataBean.getResName()); viewholder.tv_title.setText(dataBean.getResName());
viewholder.ll_container.setOnClickListener(new View.OnClickListener() { viewholder.ll_container.setOnClickListener(new View.OnClickListener() {
......
package com.gingersoft.gsa.cloud.main.mvp.ui.adapter; package com.gingersoft.gsa.cloud.main.mvp.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -11,14 +9,19 @@ import androidx.annotation.Nullable; ...@@ -11,14 +9,19 @@ import androidx.annotation.Nullable;
/** /**
* Created by Wyh on 2020/1/11. * Created by Wyh on 2020/1/11.
*/ */
public class PersonalAdapter extends BaseQuickAdapter<Map<String, Object>, BaseViewHolder> { public class PersonalAdapter {
public PersonalAdapter(int layoutResId, @Nullable List<Map<String, Object>> data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, Map<String, Object> item) {
}
} }
//public class PersonalAdapter extends BaseQuickAdapter<Map<String, Object>, BaseViewHolder> {
//
// public PersonalAdapter(int layoutResId, @Nullable List<Map<String, Object>> data) {
// super(layoutResId, data);
// }
//
// @Override
// protected void convert(BaseViewHolder helper, Map<String, Object> item) {
//
// }
//}
...@@ -79,6 +79,13 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon ...@@ -79,6 +79,13 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon
private RecyclerView.LayoutManager mLayoutManager; private RecyclerView.LayoutManager mLayoutManager;
private HomeFunctionAdapter mAdapter; private HomeFunctionAdapter mAdapter;
private String[] functionTitles = {
"餐檯模式", "外送模式", "外賣模式", "預點餐模式",
"快速收款", "餐牌管理", "選項管理", "餐桌管理",
"時段管理", "支付管理", "折扣管理", "員工管理",
"權限管理", "操作記錄"
};
public static HomeFragment newInstance() { public static HomeFragment newInstance() {
HomeFragment fragment = new HomeFragment(); HomeFragment fragment = new HomeFragment();
return fragment; return fragment;
...@@ -140,10 +147,14 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon ...@@ -140,10 +147,14 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon
@Override @Override
public void onItemClick(QMUIStickySectionAdapter.ViewHolder holder, int position) { public void onItemClick(QMUIStickySectionAdapter.ViewHolder holder, int position) {
switch (position) {
case 1:
CC.obtainBuilder("Component.Table") CC.obtainBuilder("Component.Table")
.setActionName("showTableActivity") .setActionName("showTableActivity")
.build() .build()
.call(); .call();
break;
}
} }
@Override @Override
...@@ -163,8 +174,8 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon ...@@ -163,8 +174,8 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon
private QMUISection<SectionHeader, SectionItem> createSection(String headerText) { private QMUISection<SectionHeader, SectionItem> createSection(String headerText) {
SectionHeader header = new SectionHeader(headerText); SectionHeader header = new SectionHeader(headerText);
ArrayList<SectionItem> contents = new ArrayList<>(); ArrayList<SectionItem> contents = new ArrayList<>();
for (int i = 0; i < 1; i++) { for (int i = 0; i < 5; i++) {
contents.add(new SectionItem(R.drawable.ic_dining_table, "item " + i)); contents.add(new SectionItem(R.drawable.ic_dining_table, functionTitles[i]));
} }
QMUISection<SectionHeader, SectionItem> section = new QMUISection<>(header, contents, false); QMUISection<SectionHeader, SectionItem> section = new QMUISection<>(header, contents, false);
// if test load more, you can open the code // if test load more, you can open the code
......
...@@ -8,6 +8,7 @@ import android.view.View; ...@@ -8,6 +8,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.gingersoft.gsa.cloud.main.R; import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.R2;
import com.gingersoft.gsa.cloud.main.di.component.DaggerMyComponent; import com.gingersoft.gsa.cloud.main.di.component.DaggerMyComponent;
import com.gingersoft.gsa.cloud.main.mvp.contract.MyContract; import com.gingersoft.gsa.cloud.main.mvp.contract.MyContract;
import com.gingersoft.gsa.cloud.main.mvp.presenter.MyPresenter; import com.gingersoft.gsa.cloud.main.mvp.presenter.MyPresenter;
...@@ -36,7 +37,7 @@ import static com.jess.arms.utils.Preconditions.checkNotNull; ...@@ -36,7 +37,7 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* ================================================ * ================================================
*/ */
public class MyFragment extends BaseFragment<MyPresenter> implements MyContract.View { public class MyFragment extends BaseFragment<MyPresenter> implements MyContract.View {
@BindView(R.id.main_personal_center_rv) @BindView(R2.id.main_personal_center_rv)
RecyclerView rvMyList; RecyclerView rvMyList;
......
...@@ -60,43 +60,6 @@ public class ReportFragment extends BaseFragment<ReportPresenter> implements Rep ...@@ -60,43 +60,6 @@ public class ReportFragment extends BaseFragment<ReportPresenter> implements Rep
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
} }
/**
* 通过此方法可以使 Fragment 能够与外界做一些交互和通信, 比如说外部的 Activity 想让自己持有的某个 Fragment 对象执行一些方法,
* 建议在有多个需要与外界交互的方法时, 统一传 {@link Message}, 通过 what 字段来区分不同的方法, 在 {@link #setData(Object)}
* 方法中就可以 {@code switch} 做不同的操作, 这样就可以用统一的入口方法做多个不同的操作, 可以起到分发的作用
* <p>
* 调用此方法时请注意调用时 Fragment 的生命周期, 如果调用 {@link #setData(Object)} 方法时 {@link Fragment#onCreate(Bundle)} 还没执行
* 但在 {@link #setData(Object)} 里却调用了 Presenter 的方法, 是会报空的, 因为 Dagger 注入是在 {@link Fragment#onCreate(Bundle)} 方法中执行的
* 然后才创建的 Presenter, 如果要做一些初始化操作,可以不必让外部调用 {@link #setData(Object)}, 在 {@link #initData(Bundle)} 中初始化就可以了
* <p>
* Example usage:
* <pre>
* public void setData(@Nullable Object data) {
* if (data != null && data instanceof Message) {
* switch (((Message) data).what) {
* case 0:
* loadData(((Message) data).arg1);
* break;
* case 1:
* refreshUI();
* break;
* default:
* //do something
* break;
* }
* }
* }
*
* // call setData(Object):
* Message data = new Message();
* data.what = 0;
* data.arg1 = 1;
* fragment.setData(data);
* </pre>
*
* @param data 当不需要参数时 {@code data} 可以为 {@code null}
*/
@Override @Override
public void setData(@Nullable Object data) { public void setData(@Nullable Object data) {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
android:id="@+id/iv_image" android:id="@+id/iv_image"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/main_function_table_service" /> android:src="@drawable/ic_selected_main" />
<TextView <TextView
android:id="@+id/tv_title" android:id="@+id/tv_title"
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
package="com.gingersoft.gsa.cloud.meal"> package="com.gingersoft.gsa.cloud.meal">
<application> <application>
<activity android:name=".mvp.ui.activity.MealStandActivity"> <activity android:name=".mvp.ui.activity.MealStandActivity"/>
</activity> <activity android:name=".mvp.ui.activity.OrderPayActivity"/>
<activity android:name=".mvp.ui.activity.OrderContentActivity" />
</application> </application>
</manifest> </manifest>
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".mvp.ui.activity.OrderPayActivity"></activity>
<activity android:name=".mvp.ui.activity.OrderContentActivity" />
<activity <activity
android:name="com.gingersoft.gsa.cloud.meal.mvp.ui.activity.MealStandActivity" android:name=".mvp.ui.activity.MealStandActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"> android:windowSoftInputMode="stateHidden|adjustResize">
<intent-filter> <intent-filter>
...@@ -26,7 +27,6 @@ ...@@ -26,7 +27,6 @@
<meta-data <meta-data
android:name="network.config.GlobalConfiguration" android:name="network.config.GlobalConfiguration"
android:value="ConfigModule" /> android:value="ConfigModule" />
<meta-data <meta-data
android:name="design_width_in_dp" android:name="design_width_in_dp"
android:value="360" /> android:value="360" />
...@@ -34,13 +34,12 @@ ...@@ -34,13 +34,12 @@
android:name="design_height_in_dp" android:name="design_height_in_dp"
android:value="540" /> android:value="540" />
</application> </application>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" /> <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest> </manifest>
\ No newline at end of file
...@@ -4,14 +4,13 @@ import com.billy.cc.core.component.CC; ...@@ -4,14 +4,13 @@ import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult; import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil; import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent; import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.database.bean.Food; import com.gingersoft.gsa.cloud.base.mealManage.MyOrderManage;
import com.gingersoft.gsa.cloud.meal.mvp.ui.activity.MealStandActivity; import com.gingersoft.gsa.cloud.meal.mvp.ui.activity.MealStandActivity;
import java.util.List;
public class ComponentMealStand implements IComponent { public class ComponentMealStand implements IComponent {
@Override @Override
public String getName() { public String getName() {
//组件的名称,调用此组件的方式: //组件的名称,调用此组件的方式:
...@@ -35,6 +34,9 @@ public class ComponentMealStand implements IComponent { ...@@ -35,6 +34,9 @@ public class ComponentMealStand implements IComponent {
case "showMealStandActivity": case "showMealStandActivity":
openActivity(cc); openActivity(cc);
break; break;
case "clearOrderList":
clearOrderList(cc);
break;
case "getLifecycleFragment": case "getLifecycleFragment":
//demo for provide fragment object to other component //demo for provide fragment object to other component
getLifecycleFragment(cc); getLifecycleFragment(cc);
...@@ -54,6 +56,10 @@ public class ComponentMealStand implements IComponent { ...@@ -54,6 +56,10 @@ public class ComponentMealStand implements IComponent {
return false; return false;
} }
private void clearOrderList(CC cc) {
MyOrderManage.getInstance().clear();
}
private void lifecycleFragmentDoubleText(CC cc) { private void lifecycleFragmentDoubleText(CC cc) {
// LifecycleFragment lifecycleFragment = cc.getParamItem("fragment"); // LifecycleFragment lifecycleFragment = cc.getParamItem("fragment");
// if (lifecycleFragment != null) { // if (lifecycleFragment != null) {
......
package com.gingersoft.gsa.cloud.meal;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.meal.mvp.ui.activity.MealStandActivity;
public class ComponentOrderContent implements IComponent {
@Override
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return "Component.OrderContent";
}
/**
* 组件被调用时的入口
* 要确保每个逻辑分支都会调用到CC.sendCCResult,
* 包括try-catch,if-else,switch-case-default,startActivity
*
* @param cc 组件调用对象,可从此对象中获取相关信息
* @return true:将异步调用CC.sendCCResult(...),用于异步实现相关功能,例如:文件加载、网络请求等
* false:会同步调用CC.sendCCResult(...),即在onCall方法return之前调用,否则将被视为不合法的实现
*/
@Override
public boolean onCall(CC cc) {
String actionName = cc.getActionName();
switch (actionName) {
case "showOrderContentActivity":
openActivity(cc);
break;
case "getLifecycleFragment":
//demo for provide fragment object to other component
getLifecycleFragment(cc);
break;
case "lifecycleFragment.addText":
lifecycleFragmentDoubleText(cc);
break;
case "getInfo":
getInfo(cc);
break;
default:
//这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例
//并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...)
//在LocalCCInterceptor中将会返回错误码为-10的CCResult
break;
}
return false;
}
private void lifecycleFragmentDoubleText(CC cc) {
// LifecycleFragment lifecycleFragment = cc.getParamItem("fragment");
// if (lifecycleFragment != null) {
// String text = cc.getParamItem("text", "");
// lifecycleFragment.addText(text);
// CC.sendCCResult(cc.getCallId(), CCResult.success());
// } else {
// CC.sendCCResult(cc.getCallId(), CCResult.error("no fragment params"));
// }
}
private void getLifecycleFragment(CC cc) {
// CC.sendCCResult(cc.getCallId(), CCResult.successWithNoKey(new LifecycleFragment()));
}
private void getInfo(CC cc) {
String userName = "billy";
CC.sendCCResult(cc.getCallId(), CCResult.success("userName", userName));
}
private void openActivity(CC cc) {
CCUtil.navigateTo(cc, MealStandActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success());
}
}
package com.gingersoft.gsa.cloud.meal.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.meal.di.module.OrderContentModule;
import com.gingersoft.gsa.cloud.meal.mvp.contract.OrderContentContract;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.gsa.cloud.meal.mvp.ui.activity.OrderContentActivity;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
@Component(modules = OrderContentModule.class, dependencies = AppComponent.class)
public interface OrderContentComponent {
void inject(OrderContentActivity activity);
@Component.Builder
interface Builder {
@BindsInstance
OrderContentComponent.Builder view(OrderContentContract.View view);
OrderContentComponent.Builder appComponent(AppComponent appComponent);
OrderContentComponent build();
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.meal.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.gsa.cloud.meal.di.module.OrderPayModule;
import com.gingersoft.gsa.cloud.meal.mvp.contract.OrderPayContract;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.gsa.cloud.meal.mvp.ui.activity.OrderPayActivity;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:25
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
@Component(modules = OrderPayModule.class, dependencies = AppComponent.class)
public interface OrderPayComponent {
void inject(OrderPayActivity activity);
@Component.Builder
interface Builder {
@BindsInstance
OrderPayComponent.Builder view(OrderPayContract.View view);
OrderPayComponent.Builder appComponent(AppComponent appComponent);
OrderPayComponent build();
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.meal.di.module;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.gsa.cloud.meal.mvp.contract.OrderContentContract;
import com.gingersoft.gsa.cloud.meal.mvp.model.OrderContentModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class OrderContentModule {
@Binds
abstract OrderContentContract.Model bindOrderContentModel(OrderContentModel model);
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.meal.di.module;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.gsa.cloud.meal.mvp.contract.OrderPayContract;
import com.gingersoft.gsa.cloud.meal.mvp.model.OrderPayModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:25
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class OrderPayModule {
@Binds
abstract OrderPayContract.Model bindOrderPayModel(OrderPayModel model);
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.meal.mvp.contract;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:25
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface BaseOrderContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void recordOperat(boolean isPressButtonSound);
void setFoodAdapter(DefaultAdapter adapter);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
...@@ -4,9 +4,8 @@ import android.app.Activity; ...@@ -4,9 +4,8 @@ import android.app.Activity;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import com.gingersoft.gsa.cloud.base.bean.BaseRespose; import com.gingersoft.gsa.cloud.base.bean.BaseRespose;
import com.gingersoft.gsa.cloud.base.bean.FoodBean;
import com.gingersoft.gsa.cloud.database.bean.Food; import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.meal.mvp.model.bean.request.SendOrderRequest; import com.gingersoft.gsa.cloud.meal.mvp.model.bean.request.OrderRequest;
import com.jess.arms.base.DefaultAdapter; import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
...@@ -84,20 +83,26 @@ public interface MealStandContract { ...@@ -84,20 +83,26 @@ public interface MealStandContract {
void showModifyLayoutVisibility(boolean show); void showModifyLayoutVisibility(boolean show);
void setOrderFoodCount(String number);
void setMealRvScrollToPosition(int position) ;
Activity getActivity(); Activity getActivity();
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel { interface Model extends IModel {
Observable<BaseRespose> loadOrder(RequestBody requestBody); Observable<Object> loadOrder(int orderId);
Observable<BaseRespose> sendOrder(List<SendOrderRequest> foods); Observable<BaseRespose> createOrder(OrderRequest request);
Observable<BaseRespose> addFood(RequestBody requestBody); Observable<BaseRespose> addFood(OrderRequest request);
Observable<BaseRespose> deleteFood(RequestBody requestBody); Observable<BaseRespose> deleteFood(RequestBody requestBody);
Observable<BaseRespose> printOrder(RequestBody requestBody);
List<Food> queryDB_FoodGroupList(); List<Food> queryDB_FoodGroupList();
List<Food> queryDB_FoodList(long parentId); List<Food> queryDB_FoodList(long parentId);
......
package com.gingersoft.gsa.cloud.meal.mvp.contract;
import com.gingersoft.gsa.cloud.base.bean.BaseRespose;
import com.gingersoft.gsa.cloud.meal.mvp.model.bean.request.OrderRequest;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface OrderContentContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends BaseOrderContract.View {
void showChoosePeopleNumDialog(boolean isNeedCancel);
void setTopFunctionAdapter(DefaultAdapter adapter);
void setTopFunctionRecycleLayoutManager();
void setFoodRecycleLayoutManager(int orientation);
void setTopFunctionRecycleSpanCount(int size);
void setFoodRecycleSpanCount(int size);
void setTvWhole(double whole);
void setTvTotal(double total);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends BaseOrderContract.Model {
Observable<BaseRespose> createOrder(OrderRequest request);
Observable<BaseRespose> addFood(OrderRequest request);
Observable<BaseRespose> printOrder(RequestBody request);
}
}
package com.gingersoft.gsa.cloud.meal.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:25
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface OrderPayContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends BaseOrderContract.View {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends BaseOrderContract.Model {
}
}
...@@ -3,10 +3,9 @@ package com.gingersoft.gsa.cloud.meal.mvp.model; ...@@ -3,10 +3,9 @@ package com.gingersoft.gsa.cloud.meal.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.base.bean.BaseRespose; import com.gingersoft.gsa.cloud.base.bean.BaseRespose;
import com.gingersoft.gsa.cloud.base.bean.FoodBean;
import com.gingersoft.gsa.cloud.database.bean.Food; import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.utils.FoodDaoUtils; import com.gingersoft.gsa.cloud.database.utils.FoodDaoUtils;
import com.gingersoft.gsa.cloud.meal.mvp.model.bean.request.SendOrderRequest; import com.gingersoft.gsa.cloud.meal.mvp.model.bean.request.OrderRequest;
import com.gingersoft.gsa.cloud.meal.mvp.model.service.MealService; import com.gingersoft.gsa.cloud.meal.mvp.model.service.MealService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
...@@ -56,21 +55,21 @@ public class MealStandModel extends BaseModel implements MealStandContract.Model ...@@ -56,21 +55,21 @@ public class MealStandModel extends BaseModel implements MealStandContract.Model
} }
@Override @Override
public Observable<BaseRespose> loadOrder(RequestBody requestBody) { public Observable<Object> loadOrder(int orderId) {
return mRepositoryManager.obtainRetrofitService(MealService.class) return mRepositoryManager.obtainRetrofitService(MealService.class)
.loadOrder(requestBody); .loadOrder(orderId);
} }
@Override @Override
public Observable<BaseRespose> sendOrder(List<SendOrderRequest> foods) { public Observable<BaseRespose> createOrder( OrderRequest request) {
return mRepositoryManager.obtainRetrofitService(MealService.class) return mRepositoryManager.obtainRetrofitService(MealService.class)
.sendOrder(foods); .createOrder(request);
} }
@Override @Override
public Observable<BaseRespose> addFood(RequestBody requestBody) { public Observable<BaseRespose> addFood(OrderRequest request) {
return mRepositoryManager.obtainRetrofitService(MealService.class) return mRepositoryManager.obtainRetrofitService(MealService.class)
.addFood(requestBody); .addFood(request);
} }
@Override @Override
...@@ -80,6 +79,12 @@ public class MealStandModel extends BaseModel implements MealStandContract.Model ...@@ -80,6 +79,12 @@ public class MealStandModel extends BaseModel implements MealStandContract.Model
} }
@Override @Override
public Observable<BaseRespose> printOrder(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(MealService.class)
.printOrder(requestBody);
}
@Override
public List<Food> queryDB_FoodGroupList() { public List<Food> queryDB_FoodGroupList() {
FoodDaoUtils foodDaoUtils = new FoodDaoUtils(mApplication); FoodDaoUtils foodDaoUtils = new FoodDaoUtils(mApplication);
return foodDaoUtils.queryFoodGroupByQueryBuilder(); return foodDaoUtils.queryFoodGroupByQueryBuilder();
......
package com.gingersoft.gsa.cloud.meal.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.base.bean.BaseRespose;
import com.gingersoft.gsa.cloud.meal.mvp.model.bean.request.OrderRequest;
import com.gingersoft.gsa.cloud.meal.mvp.model.service.MealService;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.ActivityScope;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.meal.mvp.contract.OrderContentContract;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
public class OrderContentModel extends BaseModel implements OrderContentContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public OrderContentModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<BaseRespose> createOrder(OrderRequest request) {
return mRepositoryManager.obtainRetrofitService(MealService.class)
.createOrder(request);
}
@Override
public Observable<BaseRespose> addFood(OrderRequest request) {
return mRepositoryManager.obtainRetrofitService(MealService.class)
.addFood(request);
}
@Override
public Observable<BaseRespose> printOrder(RequestBody request) {
return mRepositoryManager.obtainRetrofitService(MealService.class)
.printOrder(request);
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.meal.mvp.model;
import android.app.Application;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.ActivityScope;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.meal.mvp.contract.OrderPayContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:25
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
public class OrderPayModel extends BaseModel implements OrderPayContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public OrderPayModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.meal.mvp.model.bean.request; package com.gingersoft.gsa.cloud.meal.mvp.model.bean.request;
import java.util.List;
/** /**
* 作者:ELEGANT_BIN * 作者:ELEGANT_BIN
* 版本:1.6.0 * 版本:1.6.0
...@@ -7,15 +9,48 @@ package com.gingersoft.gsa.cloud.meal.mvp.model.bean.request; ...@@ -7,15 +9,48 @@ package com.gingersoft.gsa.cloud.meal.mvp.model.bean.request;
* 修订历史:2020-01-06 * 修订历史:2020-01-06
* 描述: * 描述:
*/ */
public class SendOrderRequest {
public class OrderRequest {
private int person;
private int tableId;
private List<Request> orderDetails;
public int getPerson() {
return person;
}
public void setPerson(int person) {
this.person = person;
}
public int getTableId() {
return tableId;
}
public void setTableId(int tableId) {
this.tableId = tableId;
}
public List<Request> getOrderDetails() {
return orderDetails;
}
public void setOrderDetails(List<Request> orderDetails) {
this.orderDetails = orderDetails;
}
public static class Request {
private long productId; private long productId;
private String productName; private String productName;
private double price; private double price;
private double lunchboxPrice; private double lunchboxPrice;
private int number; private int number;
public SendOrderRequest(long productId, String productName, double price, double lunchboxPrice, int number) { public Request() {
}
public Request(long productId, String productName, double price, double lunchboxPrice, int number) {
this.productId = productId; this.productId = productId;
this.productName = productName; this.productName = productName;
this.price = price; this.price = price;
...@@ -62,4 +97,25 @@ public class SendOrderRequest { ...@@ -62,4 +97,25 @@ public class SendOrderRequest {
public void setNumber(int number) { public void setNumber(int number) {
this.number = number; this.number = number;
} }
@Override
public String toString() {
return "Request{" +
"productId=" + productId +
", productName='" + productName + '\'' +
", price=" + price +
", lunchboxPrice=" + lunchboxPrice +
", number=" + number +
'}';
}
}
@Override
public String toString() {
return "OrderRequest{" +
"person=" + person +
", orderDetails=" + orderDetails +
'}';
}
} }
package com.gingersoft.gsa.cloud.meal.mvp.model.service; package com.gingersoft.gsa.cloud.meal.mvp.model.service;
import com.gingersoft.gsa.cloud.base.bean.BaseRespose; import com.gingersoft.gsa.cloud.base.bean.BaseRespose;
import com.gingersoft.gsa.cloud.database.bean.Food; import com.gingersoft.gsa.cloud.meal.mvp.model.bean.request.OrderRequest;
import com.gingersoft.gsa.cloud.meal.mvp.model.bean.request.SendOrderRequest;
import java.util.List; import java.util.List;
...@@ -10,7 +9,9 @@ import io.reactivex.Observable; ...@@ -10,7 +9,9 @@ import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager; import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.Query;
/** /**
* 作者:ELEGANT_BIN * 作者:ELEGANT_BIN
...@@ -22,14 +23,19 @@ import retrofit2.http.POST; ...@@ -22,14 +23,19 @@ import retrofit2.http.POST;
public interface MealService { public interface MealService {
@POST("order/send" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("order/send" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseRespose> sendOrder(@Body List<SendOrderRequest> foods); Observable<BaseRespose> createOrder(@Body OrderRequest request);
@POST("orderDetails/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("orderDetails/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseRespose> addFood(@Body RequestBody requestBody); Observable<BaseRespose> addFood(@Body OrderRequest request);
@POST("orderDetails/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @GET("orderDetails/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseRespose> loadOrder(@Body RequestBody requestBody); Observable<Object> loadOrder(@Query("orderId") int orderId);
@POST("orderDetails/delete" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("orderDetails/delete" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseRespose> deleteFood(@Body RequestBody requestBody); Observable<BaseRespose> deleteFood(@Body RequestBody requestBody);
@POST("behavior/print" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseRespose> printOrder(@Body RequestBody requestBody);
} }
package com.gingersoft.gsa.cloud.meal.mvp.presenter;
import android.app.Activity;
import android.app.Application;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.meal.mvp.contract.BaseOrderContract;
import com.gingersoft.gsa.cloud.base.mealManage.MyOrderManage;
import com.gingersoft.gsa.cloud.meal.mvp.ui.adapter.meal.SelectMealAdapter;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import java.util.List;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-01-11
* 修订历史:2020-01-11
* 描述:
*/
@ActivityScope
public class BaseOrderPresenter <M extends BaseOrderContract.Model, V extends BaseOrderContract.View> extends BasePresenter<BaseOrderContract.Model, BaseOrderContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
protected M mModel;
protected V mRootView;
private Activity IActivity;
//订单数据管理类
protected MyOrderManage myOrderManage;
protected SelectMealAdapter mSelectMealAdapter;
@Inject
public BaseOrderPresenter(BaseOrderContract.Model model, BaseOrderContract.View rootView) {
super(model, rootView);
this.mModel = (M) model;
this.mRootView = (V) rootView;
this.IActivity = (Activity) mRootView;
this.myOrderManage = MyOrderManage.getInstance();
initFoodAdapter();
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
private void initFoodAdapter() {
if (mSelectMealAdapter == null) {
mSelectMealAdapter = new SelectMealAdapter(IActivity, myOrderManage.getOrderFoodList(), this);
}
// myOrderManage.setSelectMealAdapter(mSelectMealAdapter);
}
public double getTotal() {
double total = 0.0;
for (Food food : myOrderManage.getOrderFoodList()) {
total += food.getNumber() * food.getPrice();
}
return total;
}
public int getFoodCout() {
int cout = 0;
for (Food food : myOrderManage.getOrderFoodList()) {
cout += food.getNumber();
}
return cout;
}
public List<Food> getOrderFoodLists() {
return myOrderManage.getOrderFoodList();
}
}
package com.gingersoft.gsa.cloud.meal.mvp.presenter;
import android.app.Application;
import android.content.Intent;
import android.graphics.Color;
import android.view.View;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.base.mealManage.OpenTableContract;
import com.gingersoft.gsa.cloud.base.bean.BaseRespose;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.meal.mvp.model.bean.request.OrderRequest;
import com.gingersoft.gsa.cloud.meal.mvp.ui.activity.MealStandActivity;
import com.gingersoft.gsa.cloud.meal.mvp.ui.activity.OrderContentActivity;
import com.gingersoft.gsa.cloud.meal.mvp.ui.activity.OrderPayActivity;
import com.gingersoft.gsa.cloud.meal.mvp.ui.adapter.OrderTopFunctionAdapter;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
import okhttp3.RequestBody;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.meal.mvp.contract.OrderContentContract;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContract.Model, OrderContentContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
private OrderContentActivity IActivity;
private OrderTopFunctionAdapter mOrderTopFunctionAdapter;
private List<Function> mFunctionList = new ArrayList<>();
private Function[] functions = {
new Function("送單", Color.parseColor("#FFFFFF"), Color.parseColor("#008131"), 24),
new Function("印單", Color.parseColor("#FFFFFF"), Color.parseColor("#FF8E04"), 24),
new Function("結賬", Color.parseColor("#FFFFFF"), Color.parseColor("#DC0000"), 24),
};
@Inject
public OrderContentPresenter(OrderContentContract.Model model, OrderContentContract.View rootView) {
super(model, rootView);
this.IActivity = (OrderContentActivity) rootView;
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void initAdapter() {
if (mOrderTopFunctionAdapter == null) {
mOrderTopFunctionAdapter = new OrderTopFunctionAdapter(IActivity, mFunctionList);
mRootView.setTopFunctionAdapter(mOrderTopFunctionAdapter);
}
mRootView.setFoodAdapter(mSelectMealAdapter);
}
public void initOrderTopFunctionListener() {
mOrderTopFunctionAdapter.setOnItemClickListener(new DefaultAdapter.OnRecyclerViewItemClickListener() {
@Override
public void onItemClick(View view, int viewType, Object data, int position) {
switch (position) {
case 0:
sendOrder();
break;
case 1:
printOrder(OpenTableContract.getDefault().getTableBean().getId());
break;
case 2:
mRootView.launchActivity(new Intent(IActivity, OrderPayActivity.class));
break;
}
}
});
mOrderTopFunctionAdapter.setOnItemClickListener(new OrderTopFunctionAdapter.OnItemClickListener() {
@Override
public void onItemClick(Function datasBean, int position) {
}
});
}
public void initTopFunctionData() {
mFunctionList.addAll(Arrays.asList(functions));
}
private void createOrder() {
OrderRequest request = getCreateOrderRequest(getOrderFoodLists());
mModel.createOrder(request)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseRespose>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseRespose info) {
if (info != null && info.isSuccess()) {
mRootView.showMessage("送單成功");
mAppManager.killActivity(MealStandActivity.class);
mRootView.killMyself();
} else {
mRootView.showMessage("送單失敗");
}
}
});
}
private void addOrderFood() {
OrderRequest request = getAddOrderFoodRequest(getOrderFoodLists());
mModel.addFood(request)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseRespose>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseRespose info) {
if (info != null && info.isSuccess()) {
mRootView.showMessage("送單成功");
mRootView.launchActivity(new Intent(IActivity, MealStandActivity.class));
} else {
mRootView.showMessage("送單失敗");
}
}
});
}
public void printOrder(int tableId) {
RequestBody requestBody = new FormBody.Builder()
.add("tableId", tableId + "")
.build();
mModel.printOrder(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseRespose>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseRespose info) {
if (info != null && info.isSuccess()) {
// CC.obtainBuilder("Component.Print")
// .setActionName("showPrintActivity")
// .build()
// .call();
} else {
mRootView.showMessage("印單失敗!");
}
}
});
}
public void sendOrder() {
if (OpenTableContract.getDefault().getOrderId() == -1) {
createOrder();
} else {
addOrderFood();
}
}
// private void printOrder() {
// CC.obtainBuilder("Component.Print")
// .setActionName("showPrintActivity")
// .build()
// .call();
// }
private OrderRequest getCreateOrderRequest(List<Food> foodList) {
OrderRequest request = new OrderRequest();
request.setOrderDetails(foodBeanToFoodRequest(foodList));
request.setPerson(OpenTableContract.getDefault().getTableBean().getPeopleNumber());
return request;
}
private OrderRequest getAddOrderFoodRequest(List<Food> foodList) {
OrderRequest request = new OrderRequest();
request.setOrderDetails(foodBeanToFoodRequest(foodList));
return request;
}
private List<OrderRequest.Request> foodBeanToFoodRequest(List<Food> foodList) {
List<OrderRequest.Request> requests = new ArrayList<>();
for (Food food : foodList) {
OrderRequest.Request request = new OrderRequest.Request();
request.setProductName(food.getFoodName());
request.setProductId(food.getId());
request.setNumber(food.getNumber());
request.setPrice(food.getPrice());
request.setLunchboxPrice(0);
requests.add(request);
}
return requests;
}
}
package com.gingersoft.gsa.cloud.meal.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.meal.mvp.ui.adapter.OrderTopFunctionAdapter;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.meal.mvp.contract.OrderPayContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:25
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@ActivityScope
public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model, OrderPayContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public OrderPayPresenter(OrderPayContract.Model model, OrderPayContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void initAdapter() {
mRootView.setFoodAdapter(mSelectMealAdapter);
}
}
package com.gingersoft.gsa.cloud.meal.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.View;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.mealManage.OpenTableContract;
import com.gingersoft.gsa.cloud.base.utils.VibratorUtils;
import com.gingersoft.gsa.cloud.base.utils.ViewUtils;
import com.gingersoft.gsa.cloud.meal.R2;
import com.gingersoft.gsa.cloud.meal.mvp.ui.widget.ChooseNumberDialog;
import com.gingersoft.gsa.cloud.ui.dialog.LoadingDialog;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.gingersoft.gsa.cloud.meal.di.component.DaggerOrderContentComponent;
import com.gingersoft.gsa.cloud.meal.mvp.contract.OrderContentContract;
import com.gingersoft.gsa.cloud.meal.mvp.presenter.OrderContentPresenter;
import com.gingersoft.gsa.cloud.meal.R;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:23
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class OrderContentActivity extends BaseActivity<OrderContentPresenter> implements OrderContentContract.View {
@BindView(R2.id.ctime)
Chronometer chronometer;
@BindView(R2.id.btn_table)
QMUIAlphaButton btn_table;
@BindView(R2.id.tv_server_main)
TextView tv_server_main;
@BindView(R2.id.tv_time)
TextView tv_time;
@BindView(R2.id.btn_people_num)
QMUIAlphaButton btn_people_num;
@BindView(R2.id.rv_top_function)
RecyclerView rv_top_function;
@BindView(R2.id.rv_food)
RecyclerView rv_food;
@BindView(R2.id.btn_order_count)
Button btn_order_count;
@BindView(R2.id.tv_whole)
TextView tv_whole;
@BindView(R2.id.tv_total)
TextView tv_total;
private ChooseNumberDialog chooseNumberDialog;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerOrderContentComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.meal_activity_order_content; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
QMUIDisplayHelper.cancelFullScreen(this);
initOrderDetail();
mPresenter.initTopFunctionData();
mPresenter.initAdapter();
mPresenter.initOrderTopFunctionListener();
}
public void initOrderDetail() {
int foodCount = mPresenter.getFoodCout();
if (foodCount > 0) {
btn_order_count.setText(String.valueOf(foodCount));
btn_order_count.setVisibility(View.VISIBLE);
} else {
btn_order_count.setVisibility(View.INVISIBLE);
}
double total = mPresenter.getTotal();
tv_whole.setText("合計 $" + total);
tv_total.setText("$" + total);
// setTvWhole(total);
// setTvTotal(total);
}
@OnClick({R2.id.btn_table, R2.id.btn_people_num})
public void onClick(View v) {
recordOperat(true);
if (!ViewUtils.isFastClick2()) {
return;
}
int id = v.getId();
if (id == R.id.btn_table) {
killMyself();
} else if (id == R.id.btn_people_num) {
showChoosePeopleNumDialog(true);
}
}
@Override
public void initIntent() {
}
@Override
public void initTopBar() {
}
@Override
public void initLanguage() {
}
@Override
public void initLayoutParams() {
}
@Override
public void initLayoutVisible() {
}
@Override
public void showLoading(String message) {
if (message != null)
LoadingDialog.showDialogForLoading(this, message, true);
else
LoadingDialog.showDialogForLoading(this);
}
@Override
public void hideLoading() {
LoadingDialog.cancelDialogForLoading();
}
@Override
public void showChoosePeopleNumDialog(boolean isNeedCancel) {
if (chooseNumberDialog == null) {
chooseNumberDialog = new ChooseNumberDialog(this);
chooseNumberDialog.builder();
chooseNumberDialog.setValueHint("請輸入人數");
// mInputNumberDialog2.setTitle(LanguageUtils.get_language_system(this, "Meal.Mannumber", "Number"));
// mInputNumberDialog2.setHeadLayoutVisibility(View.VISIBLE);
if (!isNeedCancel)
chooseNumberDialog.setOnBackClickListener(new ChooseNumberDialog.OnBackClickListener() {
@Override
public void OnBackClick() {
recordOperat(true);
}
});
int backPageBtnVisibility;
if (isNeedCancel) {
backPageBtnVisibility = View.GONE;
} else {
backPageBtnVisibility = View.VISIBLE;
}
// mInputNumberDialog2.setBackPageBtnVisibility(backPageBtnVisibility);
chooseNumberDialog.setOnClickListener(new ChooseNumberDialog.OnClickListener() {
@Override
public void onComfirmClick(String number) {
recordOperat(true);
//选择的人数大于0
if (Integer.parseInt(number) > 0) {
OpenTableContract.getDefault().getTableBean().setPeopleNumber(Integer.parseInt(number));
}
btn_people_num.setText(number);
}
@Override
public void onBackPage() {
killMyself();
}
});
chooseNumberDialog.setCancelable(isNeedCancel);
}
}
@Override
public void recordOperat(boolean isPressButtonSound) {
if (isPressButtonSound)
VibratorUtils.pressButtonSound(this);
//关闭倒计时
if (chronometer != null) {
chronometer.stop();
}
//重新开启倒计时
if (chronometer != null) {
chronometer.setBase(SystemClock.elapsedRealtime());
chronometer.start();
}
}
@Override
public void showMessage(@NonNull String message) {
checkNotNull(message);
ArmsUtils.snackbarText(message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
@Override
public void setTopFunctionAdapter(DefaultAdapter adapter) {
rv_top_function.setAdapter(adapter);
}
@Override
public void setFoodAdapter(DefaultAdapter adapter) {
rv_food.setAdapter(adapter);
}
@Override
public void setTopFunctionRecycleLayoutManager() {
}
@Override
public void setFoodRecycleLayoutManager(int orientation) {
}
@Override
public void setTopFunctionRecycleSpanCount(int size) {
}
@Override
public void setFoodRecycleSpanCount(int size) {
}
@Override
public void setTvWhole(double whole) {
tv_whole.setText("合計 $" + whole);
}
@Override
public void setTvTotal(double total) {
tv_total.setText("$" + total);
}
}
package com.gingersoft.gsa.cloud.meal.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.utils.VibratorUtils;
import com.gingersoft.gsa.cloud.base.utils.ViewUtils;
import com.gingersoft.gsa.cloud.meal.R2;
import com.gingersoft.gsa.cloud.ui.dialog.LoadingDialog;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.gingersoft.gsa.cloud.meal.di.component.DaggerOrderPayComponent;
import com.gingersoft.gsa.cloud.meal.mvp.contract.OrderPayContract;
import com.gingersoft.gsa.cloud.meal.mvp.presenter.OrderPayPresenter;
import com.gingersoft.gsa.cloud.meal.R;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.layout.QMUIButton;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/09/2020 19:25
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements OrderPayContract.View {
@BindView(R2.id.btn_table)
QMUIAlphaButton btn_table;
@BindView(R2.id.btn_people_num)
QMUIAlphaButton btn_people_num;
@BindView(R2.id.tv_server_main)
TextView tv_server_main;
@BindView(R2.id.tv_time)
TextView tv_time;
@BindView(R2.id.rv_food)
RecyclerView rv_food;
@BindView(R2.id.tv_whole)
TextView tv_whole;
@BindView(R2.id.tv_total)
TextView tv_total;
@BindView(R2.id.btn_order_count)
Button btn_order_count;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerOrderPayComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_order_pay; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
QMUIDisplayHelper.cancelFullScreen(this);
mPresenter.initAdapter();
initOrderDetail();
}
public void initOrderDetail() {
int foodCount = mPresenter.getFoodCout();
if (foodCount > 0) {
btn_order_count.setText(String.valueOf(foodCount));
btn_order_count.setVisibility(View.VISIBLE);
} else {
btn_order_count.setVisibility(View.INVISIBLE);
}
double total = mPresenter.getTotal();
tv_whole.setText("合計 $" + total);
tv_total.setText("$" + total);
// setTvWhole(total);
// setTvTotal(total);
}
@OnClick({R2.id.btn_pay,R2.id.btn_table})
public void onClick(View v) {
recordOperat(true);
if (!ViewUtils.isFastClick2()) {
return;
}
int id = v.getId();
if (id == R.id.btn_pay) {
} else if(id == R.id.btn_table){
killMyself();
}
}
@Override
public void initIntent() {
}
@Override
public void initTopBar() {
}
@Override
public void initLanguage() {
}
@Override
public void initLayoutParams() {
}
@Override
public void initLayoutVisible() {
}
@Override
public void showLoading(String message) {
if (message != null)
LoadingDialog.showDialogForLoading(this, message, true);
else
LoadingDialog.showDialogForLoading(this);
}
@Override
public void hideLoading() {
LoadingDialog.cancelDialogForLoading();
}
@Override
public void showMessage(@NonNull String message) {
checkNotNull(message);
ArmsUtils.snackbarText(message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
@Override
public void recordOperat(boolean isPressButtonSound) {
if (isPressButtonSound)
VibratorUtils.pressButtonSound(this);
}
@Override
public void setFoodAdapter(DefaultAdapter adapter) {
rv_food.setAdapter(adapter);
}
}
package com.gingersoft.gsa.cloud.meal.mvp.ui.adapter.meal; package com.gingersoft.gsa.cloud.meal.mvp.ui.adapter;
import android.view.View; import android.view.View;
......
package com.gingersoft.gsa.cloud.meal.mvp.ui.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.meal.R;
import com.gingersoft.gsa.cloud.meal.R2;
import com.jess.arms.base.BaseHolder;
import com.jess.arms.base.DefaultAdapter;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import java.util.List;
import butterknife.BindView;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2018/6/27
* 修订历史:2018/6/27
* 描述:
*/
public class OrderTopFunctionAdapter extends DefaultAdapter<Function> {
private Context mContext;
private int detailCol = 3;
public OrderTopFunctionAdapter(Context context, List<Function> infos) {
super(infos);
this.mContext = context;
}
@Override
public int getItemCount() {
return mInfos.size();
}
@Override
public BaseHolder<Function> getHolder(View v, int viewType) {
return new TopFunctionItemHolder(v);
}
@Override
public int getLayoutId(int viewType) {
return R.layout.meal_order_top_function;
}
class TopFunctionItemHolder extends BaseHolder<Function> {
@BindView(R2.id.btn_name)
QMUIAlphaButton btn_name;
public TopFunctionItemHolder(View itemView) {
super(itemView);
}
@Override
public void setData(Function datasBean, int position) {
btn_name.setText(datasBean.getResName());
btn_name.setTextColor(datasBean.getTextColor());
btn_name.setBackgroundColor(datasBean.getBackgroundColor());
btn_name.setTextSize(datasBean.getTextSize());
ViewGroup.LayoutParams layoutParams = btn_name.getLayoutParams();
layoutParams.width = QMUIDisplayHelper.getScreenWidth(mContext) / detailCol;
btn_name.setLayoutParams(layoutParams);
}
}
private OnItemClickListener mOnItemClickListener;
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
mOnItemClickListener = onItemClickListener;
}
public interface OnItemClickListener {
void onItemClick(Function datasBean, int position);
}
}
...@@ -166,12 +166,13 @@ public class FoodAdapter extends DefaultAdapter<Food> { ...@@ -166,12 +166,13 @@ public class FoodAdapter extends DefaultAdapter<Food> {
} }
public void setNumber(Food datasBean) { public void setNumber(Food datasBean) {
ViewGroup.MarginLayoutParams mp = new ViewGroup.MarginLayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); //item的宽高 ViewGroup.MarginLayoutParams mp = new ViewGroup.MarginLayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); //item的宽高
mp.setMargins(0, 0, 0, 0);//分别是margin_top那四个属性 mp.setMargins(0, 0, 0, 0);//分别是margin_top那四个属性
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(mp); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(mp);
lp.width = ArmsUtils.dip2px(mContext, 16); lp.width = ArmsUtils.dip2px(mContext, 16);
lp.height = ArmsUtils.dip2px(mContext, 16); lp.height = ArmsUtils.dip2px(mContext, 16);
tv_number.setLayoutParams(lp); tv_number.setLayoutParams(lp);
tv_number.setTextSize(10); tv_number.setTextSize(10);
......
...@@ -2,36 +2,27 @@ package com.gingersoft.gsa.cloud.meal.mvp.ui.adapter.meal; ...@@ -2,36 +2,27 @@ package com.gingersoft.gsa.cloud.meal.mvp.ui.adapter.meal;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.bean.FoodBean;
import com.gingersoft.gsa.cloud.database.bean.Food; import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.meal.R2; import com.gingersoft.gsa.cloud.meal.R2;
import com.gingersoft.gsa.cloud.meal.mvp.model.manage.MyOrderManage;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil; import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.meal.R; import com.gingersoft.gsa.cloud.meal.R;
import com.gingersoft.gsa.cloud.meal.mvp.model.bean.OrderDetail;
import com.gingersoft.gsa.cloud.meal.mvp.model.constant.MealConstant; import com.gingersoft.gsa.cloud.meal.mvp.model.constant.MealConstant;
import com.gingersoft.gsa.cloud.meal.mvp.presenter.MealStandPresenter; import com.gingersoft.gsa.cloud.meal.mvp.presenter.MealStandPresenter;
import com.gingersoft.gsa.cloud.meal.mvp.presenter.OrderContentPresenter;
import com.gingersoft.gsa.cloud.meal.mvp.ui.activity.MealStandActivity; import com.gingersoft.gsa.cloud.meal.mvp.ui.activity.MealStandActivity;
import com.jess.arms.base.BaseHolder; import com.jess.arms.base.BaseHolder;
import com.jess.arms.base.DefaultAdapter; import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.ThirdViewUtil;
import com.zhy.autolayout.utils.AutoUtils;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView; import butterknife.BindView;
...@@ -45,8 +36,11 @@ import butterknife.BindView; ...@@ -45,8 +36,11 @@ import butterknife.BindView;
public class SelectMealAdapter extends DefaultAdapter<Food> { public class SelectMealAdapter extends DefaultAdapter<Food> {
private MealStandActivity mContext; private Context mContext;
private MealStandPresenter mPresenter;
private MealStandActivity mMealStandActivity;
private MealStandPresenter mMealStandPresenter;
private OrderContentPresenter mOrderContentPresenter;
private int BillListFontSize = 18; private int BillListFontSize = 18;
private String carshStr = "$"; private String carshStr = "$";
...@@ -70,10 +64,15 @@ public class SelectMealAdapter extends DefaultAdapter<Food> { ...@@ -70,10 +64,15 @@ public class SelectMealAdapter extends DefaultAdapter<Food> {
private boolean isRemove = false; private boolean isRemove = false;
public SelectMealAdapter(Context context, List<Food> data, MealStandPresenter presenter) { public SelectMealAdapter(Context context, List<Food> data, BasePresenter presenter) {
super(data); super(data);
this.mContext = (MealStandActivity) context; this.mContext = context;
this.mPresenter = presenter; if (presenter instanceof MealStandPresenter) {
this.mMealStandPresenter = (MealStandPresenter) presenter;
this.mMealStandActivity = (MealStandActivity) context;
} else if (presenter instanceof OrderContentPresenter) {
this.mOrderContentPresenter = (OrderContentPresenter) presenter;
}
// this.mOrderNumberShowSize = GSAApplication.androidSetting.getOrderNumberChildShowSize(); // this.mOrderNumberShowSize = GSAApplication.androidSetting.getOrderNumberChildShowSize();
// this.mOrderNumberFontSize = GSAApplication.androidSetting.getOrderNumberChildFontSize(); // this.mOrderNumberFontSize = GSAApplication.androidSetting.getOrderNumberChildFontSize();
// this.mFoodFontSize = GSAApplication.androidSetting.getFoodFontSize(); // this.mFoodFontSize = GSAApplication.androidSetting.getFoodFontSize();
...@@ -335,7 +334,6 @@ public class SelectMealAdapter extends DefaultAdapter<Food> { ...@@ -335,7 +334,6 @@ public class SelectMealAdapter extends DefaultAdapter<Food> {
rl_select.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.theme_white_color)); rl_select.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
ll_tvname.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.theme_white_color)); ll_tvname.setBackgroundColor(ArmsUtils.getColor(mContext, R.color.theme_white_color));
} }
} }
} }
...@@ -344,7 +342,6 @@ public class SelectMealAdapter extends DefaultAdapter<Food> { ...@@ -344,7 +342,6 @@ public class SelectMealAdapter extends DefaultAdapter<Food> {
tv_name.setTextSize(BillListFontSize); tv_name.setTextSize(BillListFontSize);
tv_number.setTextSize(BillListFontSize); tv_number.setTextSize(BillListFontSize);
} }
} }
private void setSelectPosition(int position) { private void setSelectPosition(int position) {
...@@ -358,7 +355,7 @@ public class SelectMealAdapter extends DefaultAdapter<Food> { ...@@ -358,7 +355,7 @@ public class SelectMealAdapter extends DefaultAdapter<Food> {
select_position += 1; select_position += 1;
mInfos.add(food); mInfos.add(new Food(food));
setSelectPosition(select_position); setSelectPosition(select_position);
...@@ -375,9 +372,9 @@ public class SelectMealAdapter extends DefaultAdapter<Food> { ...@@ -375,9 +372,9 @@ public class SelectMealAdapter extends DefaultAdapter<Food> {
mInfos.remove(i); mInfos.remove(i);
notifyItemChanged(i); notifyItemChanged(i);
if (orderItem != null) { if (orderItem != null) {
Food orderBean = mPresenter.getOrderFoodById(orderItem.getId()); Food orderBean = mMealStandPresenter.getOrderFoodById(orderItem.getId());
if (orderBean != null) { if (orderBean != null) {
mPresenter.setUserMaxQty(orderBean); mMealStandPresenter.setUserMaxQty(orderBean);
} }
} }
} }
...@@ -387,13 +384,13 @@ public class SelectMealAdapter extends DefaultAdapter<Food> { ...@@ -387,13 +384,13 @@ public class SelectMealAdapter extends DefaultAdapter<Food> {
//全部刪除 //全部刪除
return; return;
mContext.showViewModeVisibility(MealConstant.food_group_ViewMode, MealConstant.food_ViewMode); mMealStandActivity.showViewModeVisibility(MealConstant.food_group_ViewMode, MealConstant.food_ViewMode);
} }
/** /**
* 删除食品 * 删除食品
*/ */
public void removeFoodItem() { public int removeFoodItem() {
mInfos.remove(select_position); mInfos.remove(select_position);
notifyItemChanged(select_position); notifyItemChanged(select_position);
...@@ -407,7 +404,12 @@ public class SelectMealAdapter extends DefaultAdapter<Food> { ...@@ -407,7 +404,12 @@ public class SelectMealAdapter extends DefaultAdapter<Food> {
} }
} }
mContext.showViewModeVisibility(MealConstant.food_group_ViewMode, MealConstant.food_ViewMode); mInfos.get(select_position).setIsSelected(true);
notifyItemChanged(select_position);
mMealStandActivity.showViewModeVisibility(MealConstant.food_group_ViewMode, MealConstant.food_ViewMode);
return select_position;
} }
private void removeIntactFoodItem() { private void removeIntactFoodItem() {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/theme_color" /> <solid android:color="@color/red_400" />
<size <size
android:width="15dp" android:width="15dp"
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
<shape> <shape>
<gradient android:endColor="#FFFFFF" android:gradientRadius="50" android:startColor="#ff8c00" android:type="radial" /> <gradient android:endColor="#FFFFFF" android:gradientRadius="50" android:startColor="#ff8c00" android:type="radial" />
<!-- 描边 --> <!-- 描边 -->
<!--<stroke android:width="2dp" android:color="#dcdcdc" android:dashGap="3dp" android:dashWidth="5dp" />--> <stroke android:width="0.8dp" android:color="#dcdcdc" android:dashGap="3dp" android:dashWidth="5dp" />
<!-- 圆角 --> <!-- 圆角 -->
<corners android:radius="18dp" /> <corners android:radius="5dp" />
<padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" /> <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" />
</shape> </shape>
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
<shape> <shape>
<gradient android:angle="270" android:endColor="#ffc2b7" android:startColor="#ffc2b7" /> <gradient android:angle="270" android:endColor="#ffc2b7" android:startColor="#ffc2b7" />
<!--<stroke android:width="2dp" android:color="#dcdcdc" />--> <stroke android:width="0.8dp" android:color="#dcdcdc" />
<corners android:radius="18dp" /> <corners android:radius="5dp" />
<padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" /> <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" />
</shape> </shape>
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
<item> <item>
<shape> <shape>
<solid android:color="#A0AAB4" /> <solid android:color="#BBDFBD" />
<!--<stroke android:width="2dp" android:color="#fad3cf" />--> <stroke android:width="0.8dp" android:color="#AC2E2D" />
<corners android:radius="18dp" /> <corners android:radius="5dp" />
<padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" /> <padding android:bottom="4dp" android:left="4dp" android:right="4dp" android:top="4dp" />
</shape> </shape>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Chronometer
android:id="@+id/ctime"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="131dp"
android:text="Chronometer" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_table"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#096791"
android:drawableLeft="@drawable/qmui_icon_topbar_back"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_5"
android:text="105A-2"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/font_normal3"
android:textStyle="bold" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_pay"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#C50000"
android:text="結賬"
android:textColor="@color/theme_white_color">
</com.qmuiteam.qmui.alpha.QMUIAlphaButton>
</LinearLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#0E655F"
android:gravity="center_vertical"
android:padding="@dimen/dp_5">
<TextView
android:id="@+id/tv_server_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Andy Lam"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/font_normal2"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_server_main"
android:text="時間:14:30"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/font_normal" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_people_num"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="@color/trans"
android:drawableLeft="@mipmap/meal_people_num_white"
android:text="8"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/font_large"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_whole"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_20"
android:gravity="right|center_vertical"
android:paddingRight="@dimen/dp_10"
android:text="合計 $1328.0"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/font_large"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:orientation="horizontal"
android:gravity="center"
android:background="#006666"
android:padding="@dimen/dp_5">
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="match_parent"-->
<!-- android:text="Total:"-->
<!-- android:textSize="@dimen/font_large"-->
<!-- android:textStyle="bold"-->
<!-- android:layout_gravity="left"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:paddingRight="@dimen/dp_10"-->
<!-- android:gravity="right|center_vertical"/>-->
<RelativeLayout
android:id="@+id/fl_order_content"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/tv_total_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Total:"
android:textSize="@dimen/font_large"
android:textStyle="bold"
android:layout_gravity="left"
android:textColor="@color/theme_white_color"
android:paddingRight="@dimen/dp_10"
android:gravity="right|center_vertical"/>
<Button
android:id="@+id/btn_order_count"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ui_shape_red_oval"
android:singleLine="true"
android:gravity="center"
android:text=""
android:layout_margin="@dimen/dp_2"
android:layout_toRightOf="@+id/tv_total_text"
android:visibility="invisible"
android:textColor="@color/theme_white_color" />
</RelativeLayout>
<TextView
android:id="@+id/tv_total"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="$1328.0"
android:textSize="@dimen/font_large"
android:textStyle="bold"
android:layout_gravity="right"
android:textColor="@color/theme_white_color"
android:paddingRight="@dimen/dp_10"
android:gravity="right|center_vertical"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_select_pay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_pay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_1"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_keypad"
android:layout_width="@dimen/dp_100"
android:layout_height="match_parent"
android:background="#2F6666"
android:text="Keypad"
android:textColor="@color/theme_white_color"/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_exact"
android:layout_width="@dimen/dp_100"
android:layout_height="match_parent"
android:background="#315FC5"
android:layout_marginLeft="@dimen/dp_1"
android:text="Exact"
android:textColor="@color/theme_white_color"/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_sure_pay"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginLeft="@dimen/dp_1"
android:layout_height="match_parent"
android:background="@color/Grass_green"
android:text="確認"
android:textColor="@color/theme_white_color"/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="25dp" android:layout_height="25dp"
android:background="#99CC33" android:background="#99CC33"
android:text="Button" android:text="人數:0"
android:textColor="@drawable/ui_selector_white_press" /> android:textColor="@drawable/ui_selector_white_press" />
<ScrollView <ScrollView
...@@ -182,7 +182,7 @@ ...@@ -182,7 +182,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.01" android:layout_weight="0.01"
android:background="@drawable/meal_number_keys" android:background="@drawable/meal_selector_number_keys"
android:tag="0" android:tag="0"
android:text="@string/Key_0" /> android:text="@string/Key_0" />
...@@ -192,7 +192,7 @@ ...@@ -192,7 +192,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.01" android:layout_weight="0.01"
android:background="@drawable/meal_number_keys" android:background="@drawable/meal_selector_number_keys"
android:tag="1" android:tag="1"
android:text="@string/Key_1" /> android:text="@string/Key_1" />
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.01" android:layout_weight="0.01"
android:background="@drawable/meal_number_keys" android:background="@drawable/meal_selector_number_keys"
android:tag="2" android:tag="2"
android:text="@string/Key_2" /> android:text="@string/Key_2" />
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.01" android:layout_weight="0.01"
android:background="@drawable/meal_number_keys" android:background="@drawable/meal_selector_number_keys"
android:tag="3" android:tag="3"
android:text="@string/Key_3" /> android:text="@string/Key_3" />
...@@ -222,19 +222,19 @@ ...@@ -222,19 +222,19 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.01" android:layout_weight="0.01"
android:background="@drawable/meal_number_keys" android:background="@drawable/meal_selector_number_keys"
android:tag="4" android:tag="4"
android:text="@string/Key_4" /> android:text="@string/Key_4" />
<Button <ImageButton
android:id="@+id/btn_keys" android:id="@+id/btn_keys"
style="@style/ButtonBorderless" style="@style/ButtonBorderless"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.00" android:layout_weight="0.00"
android:background="@drawable/meal_number_keys" android:src="@mipmap/meal_number_key"
android:tag="99" android:background="@drawable/meal_selector_number_keys"
android:text="@string/Key_s" /> android:tag="99" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
...@@ -298,10 +298,10 @@ ...@@ -298,10 +298,10 @@
</LinearLayout> </LinearLayout>
<RelativeLayout <LinearLayout
android:id="@+id/rl_stand_oper" android:id="@+id/ll_stand_oper"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="34dp" android:layout_height="@dimen/dp_45"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:orientation="horizontal"> android:orientation="horizontal">
...@@ -342,6 +342,7 @@ ...@@ -342,6 +342,7 @@
android:background="@drawable/ui_shape_red_oval" android:background="@drawable/ui_shape_red_oval"
android:singleLine="true" android:singleLine="true"
android:layout_margin="@dimen/dp_2" android:layout_margin="@dimen/dp_2"
android:visibility="invisible"
android:textColor="@color/theme_white_color" /> android:textColor="@color/theme_white_color" />
</FrameLayout> </FrameLayout>
...@@ -369,7 +370,7 @@ ...@@ -369,7 +370,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:text="send order" android:text="送單"
android:textColor="@drawable/ui_selector_black_press" android:textColor="@drawable/ui_selector_black_press"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:textSize="@dimen/sp_17" /> android:textSize="@dimen/sp_17" />
...@@ -381,6 +382,7 @@ ...@@ -381,6 +382,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:visibility="gone"
android:background="@color/blue_500"> android:background="@color/blue_500">
<Button <Button
...@@ -402,9 +404,10 @@ ...@@ -402,9 +404,10 @@
android:background="@drawable/ui_shape_red_oval" android:background="@drawable/ui_shape_red_oval"
android:gravity="center" android:gravity="center"
android:singleLine="true" android:singleLine="true"
android:visibility="gone"
android:textColor="@color/theme_white_color" /> android:textColor="@color/theme_white_color" />
</FrameLayout> </FrameLayout>
</RelativeLayout> </LinearLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/rl_fine_tabs" android:id="@+id/rl_fine_tabs"
...@@ -496,6 +499,7 @@ ...@@ -496,6 +499,7 @@
android:id="@+id/ll_food_group_point" android:id="@+id/ll_food_group_point"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_5" android:layout_height="@dimen/dp_5"
android:visibility="invisible"
android:background="@color/theme_grey_color" android:background="@color/theme_grey_color"
android:orientation="horizontal" /> android:orientation="horizontal" />
</LinearLayout> </LinearLayout>
...@@ -505,7 +509,7 @@ ...@@ -505,7 +509,7 @@
android:id="@+id/rv_food" android:id="@+id/rv_food"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/rl_stand_oper" android:layout_above="@+id/ll_stand_oper"
android:layout_below="@+id/ll_food_group" android:layout_below="@+id/ll_food_group"
android:divider="@null" android:divider="@null"
android:fadeScrollbars="false" android:fadeScrollbars="false"
...@@ -516,7 +520,7 @@ ...@@ -516,7 +520,7 @@
android:id="@+id/meal_stand_search_keyboard_view" android:id="@+id/meal_stand_search_keyboard_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@id/rl_stand_oper" android:layout_above="@id/ll_stand_oper"
android:layout_below="@+id/ll_meals" android:layout_below="@+id/ll_meals"
android:visibility="gone" /> android:visibility="gone" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Chronometer
android:id="@+id/ctime"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="131dp"
android:text="Chronometer" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="2">
<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" />
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:padding="@dimen/dp_5"
android:background="#0E655F">
<TextView
android:id="@+id/tv_server_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/font_normal3"
android:textStyle="bold"
android:text="Andy Lam"/>
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_server_main"
android:textSize="@dimen/font_normal2"
android:textColor="@color/theme_white_color"
android:text="時間:14:30"/>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_people_num"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="@color/trans"
android:drawableLeft="@mipmap/meal_people_num_white"
android:text="8"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/font_large"
android:textStyle="bold"/>
</RelativeLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_top_function"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_55"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:spanCount="3"
android:orientation="horizontal"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<TextView
android:id="@+id/tv_whole"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="合計 $1328.0"
android:textSize="@dimen/font_large"
android:textStyle="bold"
android:textColor="@color/theme_text_color"
android:layout_marginBottom="@dimen/dp_20"
android:paddingRight="@dimen/dp_10"
android:gravity="right|center_vertical"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:orientation="horizontal"
android:gravity="center"
android:background="#006666"
android:padding="@dimen/dp_5">
<RelativeLayout
android:id="@+id/fl_order_content"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/tv_total_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Total:"
android:textSize="@dimen/font_large"
android:textStyle="bold"
android:layout_gravity="left"
android:textColor="@color/theme_white_color"
android:paddingRight="@dimen/dp_10"
android:gravity="right|center_vertical"/>
<Button
android:id="@+id/btn_order_count"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ui_shape_red_oval"
android:singleLine="true"
android:gravity="center"
android:text=""
android:layout_margin="@dimen/dp_2"
android:layout_toRightOf="@+id/tv_total_text"
android:visibility="invisible"
android:textColor="@color/theme_white_color" />
</RelativeLayout>
<TextView
android:id="@+id/tv_total"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="$1328.0"
android:textSize="@dimen/font_large"
android:textStyle="bold"
android:layout_gravity="right"
android:textColor="@color/theme_white_color"
android:paddingRight="@dimen/dp_10"
android:gravity="right|center_vertical"/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/btn_name"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:background="@color/theme_color"
android:textColor="@color/theme_white_color"
android:text="送單"
android:textSize="@dimen/font_large">
</com.qmuiteam.qmui.alpha.QMUIAlphaButton>
\ No newline at end of file
<resources> <resources>
<string name="meal_app_name">GSA-Mealstand</string> <string name="meal_app_name">GSA-Mealstand</string>
<string name="meal_send_order">送單</string>
<string name="meal_print_order">印單</string>
<string name="meal_pay_order">結賬</string>
</resources> </resources>
...@@ -4,7 +4,14 @@ import android.app.Activity; ...@@ -4,7 +4,14 @@ import android.app.Activity;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.Bundle; import android.os.Bundle;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import com.billy.cc.core.component.CCUtil;
import com.gingersoft.gsa.cloud.base.bean.TableBean;
import com.gingersoft.gsa.cloud.base.mealManage.MyOrderManage;
import com.gingersoft.gsa.cloud.base.mealManage.OpenTableContract;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.ui.dialog.LoadingDialog;
import com.joe.print.adapter.BillAdapter; import com.joe.print.adapter.BillAdapter;
import com.joe.print.adapter.FoodAdapter; import com.joe.print.adapter.FoodAdapter;
import com.joe.print.bean.BillingBean; import com.joe.print.bean.BillingBean;
...@@ -24,46 +31,70 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -24,46 +31,70 @@ import androidx.recyclerview.widget.RecyclerView;
/** /**
* Created by Wyh on 2020/1/7. * Created by Wyh on 2020/1/7.
*/ */
public class PrintActivity extends Activity implements PrintSocketHolder.OnStateChangedListener, PrintExecutor.OnPrintResultListener{ public class PrintActivity extends Activity implements PrintSocketHolder.OnStateChangedListener, PrintExecutor.OnPrintResultListener {
private ImageView view; private ImageView view;
private PrintExecutor executor; private PrintExecutor executor;
private SendPrint maker; private SendPrint maker;
private TextView tv_dining_table_number;
private TextView tv_people;
private TextView tv_order_num;
private TextView tv_date;
private RecyclerView rvFood; private RecyclerView rvFood;
private RecyclerView rvBill; private RecyclerView rvBill;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_print); // setContentView(R.layout.activity_print);
// setContentView(R.layout.print_layout_print); setContentView(R.layout.print_layout_print);
tv_dining_table_number= findViewById(R.id.tv_dining_table_number);
tv_people= findViewById(R.id.tv_people);
tv_order_num= findViewById(R.id.tv_order_num);
tv_date= findViewById(R.id.tv_date);
rvFood = findViewById(R.id.rv_food);
rvBill = findViewById(R.id.rv_bill_amount);
List<Food> foodList = MyOrderManage.getInstance().getOrderFoodList();
TableBean.DataBean tableBean = OpenTableContract.getDefault().getTableBean();
tv_dining_table_number.setText(tableBean.getTableName());
tv_people.setText(tableBean.getPeopleNumber()+"");
// tv_order_num.setText();
tv_date.setText(tableBean.getCreateTime());
// rvFood = findViewById(R.id.rv_food);
// rvBill = findViewById(R.id.rv_bill_amount);
//
// List<FoodBean> data = new ArrayList<>(); // List<FoodBean> data = new ArrayList<>();
// data.add(new FoodBean("包子(主項)",1,13.54)); // data.add(new FoodBean("包子(主項)", 1, 13.54));
// data.add(new FoodBean("番薯爸爸",2,8.0)); // data.add(new FoodBean("番薯爸爸", 2, 8.0));
// data.add(new FoodBean("包子(主項)",3,37.34)); // data.add(new FoodBean("包子(主項)", 3, 37.34));
// data.add(new FoodBean("測卡很快就酸辣粉十大減肥和思考",33,1334.2254)); // data.add(new FoodBean("測卡很快就酸辣粉十大減肥和思考", 33, 1334.2254));
//
// FoodAdapter foodAdapter = new FoodAdapter(data); FoodAdapter foodAdapter = new FoodAdapter(foodList);
// rvFood.setLayoutManager(new LinearLayoutManager(this)); rvFood.setLayoutManager(new LinearLayoutManager(this));
// rvFood.setAdapter(foodAdapter); rvFood.setAdapter(foodAdapter);
//
// List<BillingBean> billingBeans = new ArrayList<>();
// List<BillingBean> billingBeans = new ArrayList<>(); billingBeans.add(new BillingBean("合計", 58.88));
// billingBeans.add(new BillingBean("合計", 58.88)); billingBeans.add(new BillingBean("10%服務費", 5.08));
// billingBeans.add(new BillingBean("10%服務費", 5.08)); billingBeans.add(new BillingBean("賬單小數", -0.06));
// billingBeans.add(new BillingBean("賬單小數", -0.06)); billingBeans.add(new BillingBean("上課交電話費扣水電費可接受的咖啡機", 837248.8829372));
// billingBeans.add(new BillingBean("上課交電話費扣水電費可接受的咖啡機", 837248.8829372));
// BillAdapter billAdapter = new BillAdapter(billingBeans);
// BillAdapter billAdapter = new BillAdapter(billingBeans); rvBill.setLayoutManager(new LinearLayoutManager(this));
// rvBill.setLayoutManager(new LinearLayoutManager(this)); rvBill.setAdapter(billAdapter);
// rvBill.setAdapter(billAdapter);
maker = new SendPrint(this, 255, 560); // view = findViewById(R.id.iv_print);
findViewById(R.id.btn_print).setOnClickListener(v -> {
LoadingDialog.showDialogForLoading(this,"打印中...",false);
// findViewById(R.id.btn_print).setOnClickListener(v -> {
if (executor == null) { if (executor == null) {
executor = new PrintExecutor("192.168.1.217", 9100, PrinterWriter58mm.TYPE_58); executor = new PrintExecutor("192.168.1.217", 9100, PrinterWriter58mm.TYPE_58);
executor.setOnStateChangedListener(PrintActivity.this::onResult); executor.setOnStateChangedListener(PrintActivity.this::onResult);
...@@ -71,11 +102,10 @@ public class PrintActivity extends Activity implements PrintSocketHolder.OnState ...@@ -71,11 +102,10 @@ public class PrintActivity extends Activity implements PrintSocketHolder.OnState
} }
executor.setIp("192.168.1.217", 9100); executor.setIp("192.168.1.217", 9100);
executor.doPrinterRequestAsync(maker); executor.doPrinterRequestAsync(maker);
}); // });
// view = findViewById(R.id.iv_print);
} }
public void loadImage(Bitmap bitmap){ public void loadImage(Bitmap bitmap) {
runOnUiThread(() -> view.setImageBitmap(bitmap)); runOnUiThread(() -> view.setImageBitmap(bitmap));
} }
...@@ -95,6 +125,8 @@ public class PrintActivity extends Activity implements PrintSocketHolder.OnState ...@@ -95,6 +125,8 @@ public class PrintActivity extends Activity implements PrintSocketHolder.OnState
case PrintSocketHolder.ERROR_5: case PrintSocketHolder.ERROR_5:
break; break;
} }
LoadingDialog.cancelDialogForLoading();
finish();
} }
@Override @Override
...@@ -112,4 +144,6 @@ public class PrintActivity extends Activity implements PrintSocketHolder.OnState ...@@ -112,4 +144,6 @@ public class PrintActivity extends Activity implements PrintSocketHolder.OnState
break; break;
} }
} }
} }
...@@ -13,7 +13,7 @@ public class PrintComponent implements IComponent { ...@@ -13,7 +13,7 @@ public class PrintComponent implements IComponent {
public String getName() { public String getName() {
//组件的名称,调用此组件的方式: //组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync() // CC.obtainBuilder("ComponentA")...build().callAsync()
return "Component.Register"; return "Component.Print";
} }
/** /**
...@@ -28,7 +28,7 @@ public class PrintComponent implements IComponent { ...@@ -28,7 +28,7 @@ public class PrintComponent implements IComponent {
public boolean onCall(CC cc) { public boolean onCall(CC cc) {
String actionName = cc.getActionName(); String actionName = cc.getActionName();
switch (actionName) { switch (actionName) {
case "showRegisterActivity": case "showPrintActivity":
openActivity(cc); openActivity(cc);
break; break;
case "getLifecycleFragment": case "getLifecycleFragment":
......
...@@ -2,6 +2,7 @@ package com.joe.print.adapter; ...@@ -2,6 +2,7 @@ package com.joe.print.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.joe.print.R; import com.joe.print.R;
import com.joe.print.bean.FoodBean; import com.joe.print.bean.FoodBean;
...@@ -12,16 +13,16 @@ import androidx.annotation.Nullable; ...@@ -12,16 +13,16 @@ import androidx.annotation.Nullable;
/** /**
* Created by Wyh on 2020/1/9. * Created by Wyh on 2020/1/9.
*/ */
public class FoodAdapter extends BaseQuickAdapter<FoodBean, BaseViewHolder> { public class FoodAdapter extends BaseQuickAdapter<Food, BaseViewHolder> {
public FoodAdapter(@Nullable List<FoodBean> data) { public FoodAdapter(@Nullable List<Food> data) {
super(R.layout.print_item_food, data); super(R.layout.print_item_food, data);
} }
@Override @Override
protected void convert(BaseViewHolder helper, FoodBean item) { protected void convert(BaseViewHolder helper, Food item) {
helper.setText(R.id.tv_food_name, item.getFoodName()); helper.setText(R.id.tv_food_name, item.getFoodName());
helper.setText(R.id.tv_food_quantity, String.valueOf(item.getFoodQuantity())); helper.setText(R.id.tv_food_quantity, String.valueOf(item.getNumber()));
helper.setText(R.id.tv_food_price, "$" + item.getPrice()); helper.setText(R.id.tv_food_price, "$" + item.getPrice());
} }
} }
...@@ -6,6 +6,7 @@ import android.view.View; ...@@ -6,6 +6,7 @@ import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.joe.print.LayoutToBitmapUtils; import com.joe.print.LayoutToBitmapUtils;
import com.joe.print.R; import com.joe.print.R;
import com.joe.print.adapter.BillAdapter; import com.joe.print.adapter.BillAdapter;
...@@ -91,15 +92,15 @@ public class SendPrint implements PrintDataMaker { ...@@ -91,15 +92,15 @@ public class SendPrint implements PrintDataMaker {
RecyclerView rvFood = view.findViewById(R.id.rv_food); RecyclerView rvFood = view.findViewById(R.id.rv_food);
RecyclerView rvBill = view.findViewById(R.id.rv_bill_amount); RecyclerView rvBill = view.findViewById(R.id.rv_bill_amount);
List<FoodBean> foodBeans = new ArrayList<>(); // List<Food> foodBeans = new ArrayList<>();
foodBeans.add(new FoodBean("包子(主項)", 1, 13.54)); // foodBeans.add(new FoodBean("包子(主項)", 1, 13.54));
foodBeans.add(new FoodBean("番薯爸爸", 2, 8.0)); // foodBeans.add(new FoodBean("番薯爸爸", 2, 8.0));
foodBeans.add(new FoodBean("包子(主項)", 3, 37.34)); // foodBeans.add(new FoodBean("包子(主項)", 3, 37.34));
foodBeans.add(new FoodBean("測卡很快就酸辣粉十大減肥和思考", 33, 1334.2254)); // foodBeans.add(new FoodBean("測卡很快就酸辣粉十大減肥和思考", 33, 1334.2254));
FoodAdapter foodAdapter = new FoodAdapter(foodBeans); // FoodAdapter foodAdapter = new FoodAdapter(foodBeans);
rvFood.setLayoutManager(new LinearLayoutManager(context)); // rvFood.setLayoutManager(new LinearLayoutManager(context));
rvFood.setAdapter(foodAdapter); // rvFood.setAdapter(foodAdapter);
List<BillingBean> billingBeans = new ArrayList<>(); List<BillingBean> billingBeans = new ArrayList<>();
...@@ -112,8 +113,8 @@ public class SendPrint implements PrintDataMaker { ...@@ -112,8 +113,8 @@ public class SendPrint implements PrintDataMaker {
rvBill.setLayoutManager(new LinearLayoutManager(context)); rvBill.setLayoutManager(new LinearLayoutManager(context));
rvBill.setAdapter(billAdapter); rvBill.setAdapter(billAdapter);
//加载条形码 //加载条形码
ImageView ivBarCode = view.findViewById(R.id.iv_bar_code); // ImageView ivBarCode = view.findViewById(R.id.iv_bar_code);
ivBarCode.setImageBitmap(BitmapUtil.generateBitmap("12312112131", 2, 450, 150)); // ivBarCode.setImageBitmap(BitmapUtil.generateBitmap("12312112131", 2, 450, 150));
return view; return view;
} }
} }
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
android:textColor="#333" android:textColor="#333"
android:textSize="16sp" /> android:textSize="16sp" />
<TextView <TextView
android:id="@+id/tv_food_quantity" android:id="@+id/tv_food_quantity"
android:layout_width="0dp" android:layout_width="0dp"
......
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
app:layout_constraintTop_toBottomOf="@+id/tv_dining_table_text" /> app:layout_constraintTop_toBottomOf="@+id/tv_dining_table_text" />
<TextView <TextView
android:id="@+id/tv_order" android:id="@+id/tv_order_num"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="000013" android:text="000013"
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
app:layout_constraintTop_toBottomOf="@+id/tv_order_number_text" /> app:layout_constraintTop_toBottomOf="@+id/tv_order_number_text" />
<TextView <TextView
android:id="@+id/tv_data" android:id="@+id/tv_date"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="2020-01-09 上午 11:16:15" android:text="2020-01-09 上午 11:16:15"
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
android:text="——————————————————————————————————————————————————" android:text="——————————————————————————————————————————————————"
android:textColor="#333" android:textColor="#333"
android:textSize="16sp" android:textSize="16sp"
app:layout_constraintTop_toBottomOf="@+id/tv_data" /> app:layout_constraintTop_toBottomOf="@+id/tv_date" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food" android:id="@+id/rv_food"
......
package com.gingersoft.gsa.cloud.table.mvp.model.bean; package com.gingersoft.gsa.cloud.base.bean;
import java.util.List; import java.util.List;
...@@ -95,7 +95,8 @@ public class TableBean { ...@@ -95,7 +95,8 @@ public class TableBean {
//是否刷新數據 //是否刷新數據
private boolean isRefresh = false; private boolean isRefresh = false;
//開台人數
private int peopleNumber;
public boolean isRefresh() { public boolean isRefresh() {
return isRefresh; return isRefresh;
...@@ -113,6 +114,14 @@ public class TableBean { ...@@ -113,6 +114,14 @@ public class TableBean {
this.id = id; this.id = id;
} }
public int getPeopleNumber() {
return peopleNumber;
}
public void setPeopleNumber(int peopleNumber) {
this.peopleNumber = peopleNumber;
}
public String getTableName() { public String getTableName() {
return tableName; return tableName;
} }
......
package com.gingersoft.gsa.cloud.meal.mvp.model.manage; package com.gingersoft.gsa.cloud.base.mealManage;
import android.app.Activity; import android.app.Activity;
import com.gingersoft.gsa.cloud.base.bean.FoodBean;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil; import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.database.bean.Food; import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.meal.mvp.model.bean.OrderDetail;
import com.gingersoft.gsa.cloud.meal.mvp.ui.adapter.meal.SelectMealAdapter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -32,7 +26,6 @@ public class MyOrderManage { ...@@ -32,7 +26,6 @@ public class MyOrderManage {
private Activity context; private Activity context;
// private MealStandPresenter presenter; // private MealStandPresenter presenter;
private SelectMealAdapter selectMealAdapter;
private boolean overMaxQty = false; private boolean overMaxQty = false;
private int Languageindex; private int Languageindex;
...@@ -711,19 +704,19 @@ public class MyOrderManage { ...@@ -711,19 +704,19 @@ public class MyOrderManage {
* @param isFuncmoney * @param isFuncmoney
* @param Money * @param Money
*/ */
public void setCalculatePrice(OrderDetail.DatasBean datasBean, boolean isFuncmoney, double Money) { // public void setCalculatePrice(OrderDetail.DatasBean datasBean, boolean isFuncmoney, double Money) {
double money = 0.00; // double money = 0.00;
if (datasBean.getItemtype() == 1 && isFuncmoney == false && datasBean.getAdvprice() != 2) { // if (datasBean.getItemtype() == 1 && isFuncmoney == false && datasBean.getAdvprice() != 2) {
// money = getMoney(datasBean.getItemno(), datasBean.getQty(), 0, new Date()); //// money = getMoney(datasBean.getItemno(), datasBean.getQty(), 0, new Date());
} else { // } else {
money = Money; // money = Money;
datasBean.manualMoney = money; // datasBean.manualMoney = money;
datasBean.isManualMoney = true; // datasBean.isManualMoney = true;
} // }
datasBean.setUnitprice(MoneyUtil.get_ItemDecimals_money(money)); // datasBean.setUnitprice(MoneyUtil.get_ItemDecimals_money(money));
datasBean.setAmount_price(money * datasBean.getQty() - Math.abs(datasBean.getMixGroupDiscPrice())); // datasBean.setAmount_price(money * datasBean.getQty() - Math.abs(datasBean.getMixGroupDiscPrice()));
datasBean.setFamount_price_sign(money); // datasBean.setFamount_price_sign(money);
} // }
// /** // /**
// * 主食品转换 // * 主食品转换
...@@ -1144,9 +1137,9 @@ public class MyOrderManage { ...@@ -1144,9 +1137,9 @@ public class MyOrderManage {
// this.presenter = presenter; // this.presenter = presenter;
// } // }
// //
public void setSelectMealAdapter(SelectMealAdapter selectMealAdapter) { // public void setSelectMealAdapter(SelectMealAdapter selectMealAdapter) {
this.selectMealAdapter = selectMealAdapter; // this.selectMealAdapter = selectMealAdapter;
} // }
public boolean isAllowAddAutoDiscount() { public boolean isAllowAddAutoDiscount() {
return allowAddAutoDiscount; return allowAddAutoDiscount;
......
package com.gingersoft.gsa.cloud.meal.app; package com.gingersoft.gsa.cloud.base.mealManage;
import com.gingersoft.gsa.cloud.base.bean.TableBean;
/** /**
* 作者:ELEGANT_BIN * 作者:ELEGANT_BIN
* 版本:1.6.0 * 版本:1.6.0
* 创建日期:2020-01-09 * 创建日期:2020-01-09
* 修订历史:2020-01-09 * 修订历史:2020-01-09
* 描述: * 描述:保存開台返回的訂單數據
*/ */
public class OpenTableContract { public class OpenTableContract {
private String TAG = getClass().getSimpleName(); private String TAG = getClass().getSimpleName();
private static OpenTableContract sDefaultOpenTableManage; private static OpenTableContract sDefaultOpenTableManage;
//記錄開台信息
private TableBean.DataBean tableBean;
//記錄訂單信息
//訂單ID
private int orderId ;
public OpenTableContract() { public OpenTableContract() {
orderId = -1;
} }
public static OpenTableContract getDefault() { public static OpenTableContract getDefault() {
...@@ -23,9 +32,19 @@ public class OpenTableContract { ...@@ -23,9 +32,19 @@ public class OpenTableContract {
return sDefaultOpenTableManage; return sDefaultOpenTableManage;
} }
public TableBean.DataBean getTableBean() {
return tableBean;
}
public void setTableBean(TableBean.DataBean tableBean) {
this.tableBean = tableBean;
}
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
} }
...@@ -14,6 +14,9 @@ import android.util.Log; ...@@ -14,6 +14,9 @@ import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil; import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.base.utils.other.AppUtils; import com.gingersoft.gsa.cloud.base.utils.other.AppUtils;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
...@@ -138,30 +141,24 @@ public class AppCrashHandler implements UncaughtExceptionHandler { ...@@ -138,30 +141,24 @@ public class AppCrashHandler implements UncaughtExceptionHandler {
* 退出应用程序 * 退出应用程序
*/ */
public static void appExit(Context context) { public static void appExit(Context context) {
// AppComponent appComponent = ArmsUtils.obtainAppComponentFromContext(context); AppComponent appComponent = ArmsUtils.obtainAppComponentFromContext(context);
// List<Activity> activityList = appComponent.appManager().getActivityList(); List<Activity> activityList = appComponent.appManager().getActivityList();
// try { try {
// for (int i = 0; i < activityList.size(); i++) { for (int i = 0; i < activityList.size(); i++) {
// activityList.get(i).finish(); activityList.get(i).finish();
// activityList.remove(i); activityList.remove(i);
// } }
// if (appComponent.appManager().activityClassIsLive(MainActivity.class)) { // 退出程序
// appComponent.appManager().findActivity(MainActivity.class).finish(); android.os.Process.killProcess(android.os.Process.myPid());
// } /**
// if (appComponent.appManager().activityClassIsLive(TableServiceActivity.class)) { * finish()是Activity的类方法,仅仅针对Activity,当调用finish()时,只是将活动推向后台,并没有立即释放内存,
// appComponent.appManager().findActivity(TableServiceActivity.class).finish(); * 活动的资源并没有被清理;当调用System.exit(0)时,退出当前Activity并释放资源(内存),
// } * 但是该方法不可以结束整个App如有多个Activty或者有其他组件service等不会结束。
// // 退出程序 * 0表示正常退出,1表示非正常 。
// android.os.Process.killProcess(android.os.Process.myPid()); */
// /** System.exit(1);
// * finish()是Activity的类方法,仅仅针对Activity,当调用finish()时,只是将活动推向后台,并没有立即释放内存, } catch (Exception e) {
// * 活动的资源并没有被清理;当调用System.exit(0)时,退出当前Activity并释放资源(内存), }
// * 但是该方法不可以结束整个App如有多个Activty或者有其他组件service等不会结束。
// * 0表示正常退出,1表示非正常 。
// */
// System.exit(1);
// } catch (Exception e) {
// }
} }
/** /**
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<string name="presssound">按鍵音量</string> <string name="presssound">按鍵音量</string>
<string name="Vibration">震動強度</string> <string name="Vibration">震動強度</string>
<string name="refreshtime">刷新時間(秒)</string> <string name="refreshtime">刷新時間(秒)</string>
<string name="nosaveexit">不保存即離開</string> <string name="nosaveexit">返回</string>
<string name="deletemeal">取消商品</string> <string name="deletemeal">取消商品</string>
<string name="Addordelete">加/減</string> <string name="Addordelete">加/減</string>
<string name="msg">特別訊息</string> <string name="msg">特別訊息</string>
......
...@@ -46,7 +46,6 @@ public class Food { ...@@ -46,7 +46,6 @@ public class Food {
private boolean visible = true; private boolean visible = true;
@Generated(hash = 866324199) @Generated(hash = 866324199)
public Food() { public Food() {
} }
...@@ -65,6 +64,17 @@ public class Food { ...@@ -65,6 +64,17 @@ public class Food {
this.plu = plu; this.plu = plu;
} }
public Food(Food addFood) {
this.id = addFood.id;
this.parentId = addFood.parentId;
this.foodName = addFood.foodName;
this.restaurantId = addFood.restaurantId;
this.price = addFood.price;
this.totalSold = addFood.totalSold;
this.isSold = addFood.isSold;
this.plu = addFood.plu;
this.number = 1;
}
public boolean isSelected() { public boolean isSelected() {
return isSelected; return isSelected;
......
...@@ -5,6 +5,7 @@ import org.greenrobot.greendao.annotation.Entity; ...@@ -5,6 +5,7 @@ import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated; import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id; import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull; import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.Transient;
/** /**
* 作者:ELEGANT_BIN * 作者:ELEGANT_BIN
...@@ -29,6 +30,26 @@ public class Function { ...@@ -29,6 +30,26 @@ public class Function {
private String imageURL; private String imageURL;
/**
* 自定義字段
*/
@Transient
private int textColor;
@Transient
private int backgroundColor;
@Transient
private int textSize;
@Transient
private int nameRes;
@Transient
private int textColorRes;
@Transient
private int backgroundColorRes;
@Transient
private int textSizeRes;
@Generated(hash = 291948792) @Generated(hash = 291948792)
public Function(Long id, int status, long effectiveTime, String resName, public Function(Long id, int status, long effectiveTime, String resName,
String resUrl, String imageURL) { String resUrl, String imageURL) {
...@@ -44,6 +65,19 @@ public class Function { ...@@ -44,6 +65,19 @@ public class Function {
public Function() { public Function() {
} }
public Function(String resName, int textColor, int backgroundColor, int textSize) {
this.resName = resName;
this.textColor = textColor;
this.backgroundColor = backgroundColor;
this.textSize = textSize;
}
public Function(int nameRes, int textColorRes, int backgroundColorRes, int textSizeRes) {
this.nameRes = nameRes;
this.textColorRes = textColorRes;
this.backgroundColorRes = backgroundColorRes;
this.textSizeRes = textSizeRes;
}
public Long getId() { public Long getId() {
return id; return id;
...@@ -93,6 +127,62 @@ public class Function { ...@@ -93,6 +127,62 @@ public class Function {
this.imageURL = imageURL; this.imageURL = imageURL;
} }
public int getNameRes() {
return nameRes;
}
public void setNameRes(int nameRes) {
this.nameRes = nameRes;
}
public int getTextColor() {
return textColor;
}
public void setTextColor(int textColor) {
this.textColor = textColor;
}
public int getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(int backgroundColor) {
this.backgroundColor = backgroundColor;
}
public int getTextSize() {
return textSize;
}
public void setTextSize(int textSize) {
this.textSize = textSize;
}
public int getTextColorRes() {
return textColorRes;
}
public void setTextColorRes(int textColorRes) {
this.textColorRes = textColorRes;
}
public int getBackgroundColorRes() {
return backgroundColorRes;
}
public void setBackgroundColorRes(int backgroundColorRes) {
this.backgroundColorRes = backgroundColorRes;
}
public int getTextSizeRes() {
return textSizeRes;
}
public void setTextSizeRes(int textSizeRes) {
this.textSizeRes = textSizeRes;
}
@Override @Override
public String toString() { public String toString() {
return "Function{" + return "Function{" +
...@@ -102,6 +192,12 @@ public class Function { ...@@ -102,6 +192,12 @@ public class Function {
", resName='" + resName + '\'' + ", resName='" + resName + '\'' +
", resUrl='" + resUrl + '\'' + ", resUrl='" + resUrl + '\'' +
", imageURL='" + imageURL + '\'' + ", imageURL='" + imageURL + '\'' +
", textColor=" + textColor +
", backgroundColor=" + backgroundColor +
", textSize=" + textSize +
", textColorRes=" + textColorRes +
", backgroundColorRes=" + backgroundColorRes +
", textSizeRes=" + textSizeRes +
'}'; '}';
} }
} }
...@@ -129,6 +129,7 @@ public class FoodDaoUtils { ...@@ -129,6 +129,7 @@ public class FoodDaoUtils {
return mManager.getDaoSession().load(Food.class, key); return mManager.getDaoSession().load(Food.class, key);
} }
/** /**
* 使用native sql进行查询操作 * 使用native sql进行查询操作
*/ */
...@@ -154,4 +155,13 @@ public class FoodDaoUtils { ...@@ -154,4 +155,13 @@ public class FoodDaoUtils {
return queryBuilder.where(FoodDao.Properties.ParentId.eq(parentId)).list(); return queryBuilder.where(FoodDao.Properties.ParentId.eq(parentId)).list();
} }
/**
* 使用queryBuilder进行查询食品
* @return
*/
public Food queryFoodByQueryBuilder(String plu){
QueryBuilder<Food> queryBuilder = mManager.getDaoSession().queryBuilder(Food.class);
return queryBuilder.where(FoodDao.Properties.Plu.eq(plu)).build().unique();
}
} }
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#BF1C42</color> <color name="colorPrimary">#398BED</color>
<color name="colorPrimaryDark">#BF1C42</color> <color name="colorPrimaryDark">#398BED</color>
<color name="colorAccent">#FF4747</color> <color name="colorAccent">#2abbff</color>
<color name="itemSelected">#b0bec5</color> <color name="itemSelected">#b0bec5</color>
<color name="mainSelected">#90a4ae</color> <color name="mainSelected">#90a4ae</color>
...@@ -404,7 +404,7 @@ ...@@ -404,7 +404,7 @@
<color name="color_f4">#F4F4F4</color> <color name="color_f4">#F4F4F4</color>
<color name="color_ccc">#CCC</color> <color name="color_ccc">#CCC</color>
<color name="line_color">@color/color_ccc</color> <color name="line_color">#CCC</color>
<color name="scroll_bar_color">#CACACA</color> <color name="scroll_bar_color">#CACACA</color>
<color name="main_home_function_head_bg">@color/color_f4</color> <color name="main_home_function_head_bg">#F4F4F4</color>
</resources> </resources>
...@@ -123,9 +123,7 @@ ...@@ -123,9 +123,7 @@
</item> </item>
<item name="qmui_skin_support_tab_normal_color">@color/normal_color</item> <item name="qmui_skin_support_tab_normal_color">@color/normal_color</item>
<item name="qmui_skin_support_tab_selected_color">@color/theme_color</item> <item name="qmui_skin_support_tab_selected_color">@color/theme_color</item>
<item name="qmui_skin_support_tab_sign_count_view_text_color"> <item name="qmui_skin_support_tab_sign_count_view_text_color">@color/qmui_config_color_white</item>
@color/qmui_config_color_white
</item>
<item name="qmui_skin_support_tab_sign_count_view_bg_color">?attr/qmui_config_color_red <item name="qmui_skin_support_tab_sign_count_view_bg_color">?attr/qmui_config_color_red
</item> </item>
</style> </style>
...@@ -142,5 +140,85 @@ ...@@ -142,5 +140,85 @@
<item name="android:gravity">center</item> <item name="android:gravity">center</item>
</style> </style>
<style name="DialogTheme2" parent="QMUI.Dialog">
<!-- <item name="qmui_dialog_wrapper_style">@style/dialog_wrapper_style_63</item>-->
<item name="qmui_dialog_title_style">@style/DialogTheme2TitleStyle</item>
<item name="qmui_dialog_action_container_style">@style/DialogTheme2ActionContainerStyle
</item>
<item name="qmui_dialog_action_style">@style/DialogTheme2ActionStyle</item>
<item name="qmui_dialog_message_content_style">@style/DialogTheme2MessageContentStyle</item>
<item name="qmui_dialog_menu_container_style">@style/DialogTheme2MenuContainerStyle</item>
<item name="qmui_dialog_menu_item_style">@style/DialogTheme2MenuItemStyle</item>
</style>
<style name="ReleaseDialogTheme" parent="DialogTheme2">
<!-- <item name="qmui_dialog_wrapper_style">@style/QMUI.Dialog.Wrapper</item>-->
<item name="qmui_dialog_message_content_style">@style/ReleaseMessageContentStyle</item>
</style>
<style name="dialog_wrapper_style_63">
<item name="android:paddingLeft">63dp</item>
<item name="android:paddingRight">63dp</item>
</style>
<style name="DialogTheme2TitleStyle" parent="QMUI.Dialog.Title">
<item name="android:textColor">?attr/qmui_config_color_gray_1</item>
<item name="android:textSize">17sp</item>
<item name="android:gravity">center</item>
<item name="android:paddingTop">28dp</item>
<item name="android:singleLine">false</item>
<item name="android:lineSpacingExtra">3dp</item>
</style>
<style name="DialogTheme2ActionContainerStyle">
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="qmui_dialog_action_container_justify_content">stretch</item>
<item name="qmui_dialog_action_height">56dp</item>
<item name="qmui_dialog_action_space">8dp</item>
<!-- <item name="qmui_topDividerColor">?attr/qmui_config_color_separator</item>-->
<item name="qmui_topDividerHeight">1px</item>
</style>
<style name="DialogTheme2ActionStyle">
<item name="android:textColor">?attr/qmui_config_color_blue</item>
<item name="android:textSize">15sp</item>
<item name="android:gravity">center</item>
<item name="android:minWidth">64dp</item>
<item name="android:background">@null</item>
<item name="qmui_dialog_action_button_padding_horizontal">12dp</item>
<item name="qmui_dialog_action_icon_space">6dp</item>
<item name="qmui_dialog_positive_action_text_color">?attr/qmui_config_color_blue</item>
<item name="qmui_dialog_negative_action_text_color">?attr/qmui_config_color_red</item>
</style>
<style name="DialogTheme2MessageContentStyle" parent="QMUI.Dialog.MessageContent">
<item name="android:textColor">?attr/qmui_config_color_gray_4</item>
<item name="android:textSize">13sp</item>
<item name="android:gravity">center</item>
<item name="android:paddingTop">13dp</item>
<item name="android:paddingBottom">27dp</item>
<item name="android:lineSpacingExtra">5dp</item>
<item name="qmui_paddingTopWhenNotTitle">27dp</item>
</style>
<style name="ReleaseMessageContentStyle" parent="DialogTheme2MessageContentStyle">
<item name="android:textSize">14sp</item>
<item name="android:gravity">left</item>
</style>
<style name="DialogTheme2MenuItemStyle" parent="@style/QMUI.Dialog_MenuItem">
<item name="android:textSize">16sp</item>
<item name="android:textColor">?attr/qmui_config_color_gray_1</item>
<item name="android:paddingLeft">32dp</item>
<item name="android:paddingRight">32dp</item>
</style>
<style name="DialogTheme2MenuContainerStyle" parent="@style/QMUI.Dialog.MenuContainer">
<item name="qmui_dialog_menu_item_height">52dp</item>
<item name="qmui_dialog_menu_container_padding_top_when_title_exist">23dp</item>
<item name="qmui_dialog_menu_container_padding_bottom_when_action_exist">24dp</item>
</style>
</resources> </resources>
...@@ -73,6 +73,7 @@ public class ComponentTable implements IComponent { ...@@ -73,6 +73,7 @@ public class ComponentTable implements IComponent {
private void openActivity(CC cc) { private void openActivity(CC cc) {
CCUtil.navigateTo(cc, TableActivity.class); CCUtil.navigateTo(cc, TableActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success()); CC.sendCCResult(cc.getCallId(), CCResult.success());
} }
} }
...@@ -16,4 +16,7 @@ public interface GoldConstants { ...@@ -16,4 +16,7 @@ public interface GoldConstants {
boolean isRefreshData = false; boolean isRefreshData = false;
} }
package com.gingersoft.gsa.cloud.table.app;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-01-10
* 修订历史:2020-01-10
* 描述:
*/
public interface TableOperatTypeConstant {
/**
* 1、分台
* 2、上菜纸
* 3、重置
* 4、转台
* 5、sky_order
*/
int splite_table_1 = 1;
int print_parper_2 = 2;
int init_table_3 = 3;
int move_table_4 = 4;
int skyorder_mode_5 = 5;
}
package com.gingersoft.gsa.cloud.table.mvp.contract; package com.gingersoft.gsa.cloud.table.mvp.contract;
import com.gingersoft.gsa.cloud.base.bean.BaseRespose; import com.gingersoft.gsa.cloud.base.bean.BaseRespose;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean; import com.gingersoft.gsa.cloud.base.bean.TableBean;
import com.jess.arms.base.DefaultAdapter; import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
...@@ -30,7 +30,7 @@ public interface TableContract { ...@@ -30,7 +30,7 @@ public interface TableContract {
void returnTableList(List<TableBean.DataBean> dataBeanList); void returnTableList(List<TableBean.DataBean> dataBeanList);
void openTableItem(int id); void clickTableItem(TableBean.DataBean dataBean);
void onStartRefreshTableData(); void onStartRefreshTableData();
...@@ -39,6 +39,12 @@ public interface TableContract { ...@@ -39,6 +39,12 @@ public interface TableContract {
void setBottomFunctionAdapter(DefaultAdapter adapter); void setBottomFunctionAdapter(DefaultAdapter adapter);
void setBottomFunctionRecycleLayoutManager(int orientation); void setBottomFunctionRecycleLayoutManager(int orientation);
void setCurrentOperatType(int type);
void setOperatContentText(String contentText);
void canceOperat();
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
...@@ -48,6 +54,6 @@ public interface TableContract { ...@@ -48,6 +54,6 @@ public interface TableContract {
Observable<BaseRespose> openTable(RequestBody requestBody); Observable<BaseRespose> openTable(RequestBody requestBody);
Observable<Object> initTable(RequestBody requestBody); Observable<BaseRespose> initTable(RequestBody requestBody);
} }
} }
...@@ -3,7 +3,7 @@ package com.gingersoft.gsa.cloud.table.mvp.model; ...@@ -3,7 +3,7 @@ package com.gingersoft.gsa.cloud.table.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.base.bean.BaseRespose; import com.gingersoft.gsa.cloud.base.bean.BaseRespose;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean; import com.gingersoft.gsa.cloud.base.bean.TableBean;
import com.gingersoft.gsa.cloud.table.mvp.model.service.TableService; import com.gingersoft.gsa.cloud.table.mvp.model.service.TableService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
...@@ -63,7 +63,7 @@ public class TableModel extends BaseModel implements TableContract.Model { ...@@ -63,7 +63,7 @@ public class TableModel extends BaseModel implements TableContract.Model {
} }
@Override @Override
public Observable<Object> initTable( RequestBody requestBody) { public Observable<BaseRespose> initTable(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(TableService.class) return mRepositoryManager.obtainRetrofitService(TableService.class)
.initTable(requestBody); .initTable(requestBody);
} }
......
package com.gingersoft.gsa.cloud.table.mvp.model.service; package com.gingersoft.gsa.cloud.table.mvp.model.service;
import com.gingersoft.gsa.cloud.base.bean.BaseRespose; import com.gingersoft.gsa.cloud.base.bean.BaseRespose;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean; import com.gingersoft.gsa.cloud.base.bean.TableBean;
import io.reactivex.Observable; import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager; import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded; import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.POST; import retrofit2.http.POST;
...@@ -22,15 +21,12 @@ import retrofit2.http.Query; ...@@ -22,15 +21,12 @@ import retrofit2.http.Query;
*/ */
public interface TableService { public interface TableService {
@GET("restaurantTable/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @GET("restaurantTable/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<TableBean> getTables(@Query("restaurantId") int restaurantId); Observable<TableBean> getTables(@Query("restaurantId") int restaurantId);
@POST("restaurantTable/kickOff" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("restaurantTable/kickOff" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseRespose> openTable(@Body RequestBody requestBody); Observable<BaseRespose> openTable(@Body RequestBody requestBody);
@FormUrlEncoded
@POST("restaurantTable/set/status" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("restaurantTable/set/status" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<Object> initTable(@Body RequestBody requestBody); Observable<BaseRespose> initTable(@Body RequestBody requestBody);
} }
...@@ -5,7 +5,7 @@ import android.content.Context; ...@@ -5,7 +5,7 @@ import android.content.Context;
import com.gingersoft.gsa.cloud.base.utils.VibratorUtils; import com.gingersoft.gsa.cloud.base.utils.VibratorUtils;
import com.gingersoft.gsa.cloud.base.utils.ViewUtils; import com.gingersoft.gsa.cloud.base.utils.ViewUtils;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean; import com.gingersoft.gsa.cloud.base.bean.TableBean;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity; 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.adapter.TableAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllTableFragment; import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.AllTableFragment;
...@@ -86,12 +86,12 @@ public class AllTablePresenter extends BasePresenter<AllTableContract.Model, All ...@@ -86,12 +86,12 @@ public class AllTablePresenter extends BasePresenter<AllTableContract.Model, All
@Override @Override
public void onItemClick(TableBean.DataBean item, int position) { public void onItemClick(TableBean.DataBean item, int position) {
if (ViewUtils.isFastClick2()) { // if (ViewUtils.isFastClick2()) {
VibratorUtils.pressButtonSound(mApplication); VibratorUtils.pressButtonSound(mApplication);
mActivity.openTableItem(item.getId()); mActivity.clickTableItem(item);
} // }
} }
}); });
} }
......
package com.gingersoft.gsa.cloud.table.mvp.presenter; package com.gingersoft.gsa.cloud.table.mvp.presenter;
import android.app.Application; import android.app.Application;
import android.content.Context;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
...@@ -15,9 +13,6 @@ import javax.inject.Inject; ...@@ -15,9 +13,6 @@ import javax.inject.Inject;
import com.gingersoft.gsa.cloud.table.mvp.contract.InputTableContract; import com.gingersoft.gsa.cloud.table.mvp.contract.InputTableContract;
import java.util.ArrayList;
import java.util.List;
/** /**
* ================================================ * ================================================
......
...@@ -5,7 +5,7 @@ import android.content.Context; ...@@ -5,7 +5,7 @@ import android.content.Context;
import com.gingersoft.gsa.cloud.base.utils.VibratorUtils; import com.gingersoft.gsa.cloud.base.utils.VibratorUtils;
import com.gingersoft.gsa.cloud.base.utils.ViewUtils; import com.gingersoft.gsa.cloud.base.utils.ViewUtils;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean; import com.gingersoft.gsa.cloud.base.bean.TableBean;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity; 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.adapter.TableAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.StateTableFragment; import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.StateTableFragment;
...@@ -251,12 +251,12 @@ public class StateTablePresenter extends BasePresenter<StateTableContract.Model, ...@@ -251,12 +251,12 @@ public class StateTablePresenter extends BasePresenter<StateTableContract.Model,
@Override @Override
public void onItemClick(TableBean.DataBean item, int position) { public void onItemClick(TableBean.DataBean item, int position) {
if (ViewUtils.isFastClick2()) { // if (ViewUtils.isFastClick2()) {
VibratorUtils.pressButtonSound(mApplication); VibratorUtils.pressButtonSound(mApplication);
mActivity.openTableItem(item.getId()); mActivity.clickTableItem(item);
} // }
} }
}); });
} }
......
package com.gingersoft.gsa.cloud.table.mvp.ui.adapter; package com.gingersoft.gsa.cloud.table.mvp.ui.adapter;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.StateListDrawable;
import android.view.Gravity;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.utils.ViewUtils;
import com.gingersoft.gsa.cloud.database.bean.Function; import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2; import com.gingersoft.gsa.cloud.table.R2;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean; import com.gingersoft.gsa.cloud.base.bean.TableBean;
import com.jess.arms.base.BaseHolder; import com.jess.arms.base.BaseHolder;
import com.jess.arms.base.DefaultAdapter; import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.utils.ArmsUtils;
import java.util.List; import java.util.List;
......
package com.gingersoft.gsa.cloud.table.mvp.ui.adapter; package com.gingersoft.gsa.cloud.table.mvp.ui.adapter;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.StateListDrawable; import android.graphics.drawable.StateListDrawable;
import android.text.TextUtils;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
...@@ -15,7 +13,7 @@ import android.widget.TextView; ...@@ -15,7 +13,7 @@ import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.utils.ViewUtils; import com.gingersoft.gsa.cloud.base.utils.ViewUtils;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2; import com.gingersoft.gsa.cloud.table.R2;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean; import com.gingersoft.gsa.cloud.base.bean.TableBean;
import com.jess.arms.base.BaseHolder; import com.jess.arms.base.BaseHolder;
import com.jess.arms.base.DefaultAdapter; import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
......
...@@ -9,9 +9,8 @@ import android.view.View; ...@@ -9,9 +9,8 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.app.GoldConstants;
import com.gingersoft.gsa.cloud.table.di.component.DaggerAllTableComponent; import com.gingersoft.gsa.cloud.table.di.component.DaggerAllTableComponent;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean; import com.gingersoft.gsa.cloud.base.bean.TableBean;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity;
import com.jess.arms.base.BaseFragment; import com.jess.arms.base.BaseFragment;
import com.jess.arms.base.DefaultAdapter; import com.jess.arms.base.DefaultAdapter;
......
...@@ -8,25 +8,28 @@ import android.view.View; ...@@ -8,25 +8,28 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import com.gingersoft.gsa.cloud.base.utils.VibratorUtils; import com.gingersoft.gsa.cloud.base.utils.VibratorUtils;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2; import com.gingersoft.gsa.cloud.table.R2;
import com.gingersoft.gsa.cloud.table.di.component.DaggerInputTableComponent; import com.gingersoft.gsa.cloud.table.di.component.DaggerInputTableComponent;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean; import com.gingersoft.gsa.cloud.base.bean.TableBean;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity;
import com.jess.arms.base.BaseFragment; import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.gingersoft.gsa.cloud.table.mvp.contract.InputTableContract; import com.gingersoft.gsa.cloud.table.mvp.contract.InputTableContract;
import com.gingersoft.gsa.cloud.table.mvp.presenter.InputTablePresenter; import com.gingersoft.gsa.cloud.table.mvp.presenter.InputTablePresenter;
import com.gingersoft.gsa.cloud.table.R2;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.OnLongClick; import butterknife.OnLongClick;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -280,8 +283,9 @@ public class InputTableFragment extends BaseFragment<InputTablePresenter> implem ...@@ -280,8 +283,9 @@ public class InputTableFragment extends BaseFragment<InputTablePresenter> implem
return; return;
} }
int id = getTableIdByName(t_name); TableBean.DataBean table = getTableByName(t_name);
mActivity.openTableItem(id);
mActivity.clickTableItem(table);
} }
private void load_meal_before_splite() { private void load_meal_before_splite() {
...@@ -378,14 +382,14 @@ public class InputTableFragment extends BaseFragment<InputTablePresenter> implem ...@@ -378,14 +382,14 @@ public class InputTableFragment extends BaseFragment<InputTablePresenter> implem
} }
} }
private int getTableIdByName(String name) { private TableBean.DataBean getTableByName(String name) {
for (int i = 0; i < mTableList.size(); i++) { for (int i = 0; i < mTableList.size(); i++) {
TableBean.DataBean dataBean = mTableList.get(i); TableBean.DataBean dataBean = mTableList.get(i);
if (dataBean.getTableName().equals(name)) { if (dataBean.getTableName().equals(name)) {
return dataBean.getId(); return dataBean;
} }
} }
return -1; return null;
} }
@Override @Override
......
...@@ -9,7 +9,7 @@ import android.view.View; ...@@ -9,7 +9,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.gingersoft.gsa.cloud.table.R2; import com.gingersoft.gsa.cloud.table.R2;
import com.gingersoft.gsa.cloud.table.di.component.DaggerStateTableComponent; import com.gingersoft.gsa.cloud.table.di.component.DaggerStateTableComponent;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.TableBean; import com.gingersoft.gsa.cloud.base.bean.TableBean;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity; import com.gingersoft.gsa.cloud.table.mvp.ui.activity.TableActivity;
import com.jess.arms.base.BaseFragment; import com.jess.arms.base.BaseFragment;
import com.jess.arms.base.DefaultAdapter; import com.jess.arms.base.DefaultAdapter;
......
...@@ -4,35 +4,11 @@ ...@@ -4,35 +4,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/ll_operat_choose" android:id="@+id/topbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/head_height" android:layout_height="?attr/qmui_topbar_height"
android:layout_gravity="bottom" app:qmui_topbar_title_color="@color/theme_white_color" />
android:layout_alignParentBottom="true"
android:background="@color/theme_white_color"
android:paddingBottom="2dp"
android:paddingLeft="@dimen/normal_space15"
android:paddingRight="@dimen/normal_space15"
android:paddingTop="2dp"
android:visibility="gone">
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_sure_operat"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/normal_space15"
android:layout_weight="1"
android:text="Button" />
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/btn_cancel_operat"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/theme_hint_color"
android:text="Button" />
</LinearLayout>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -51,6 +27,36 @@ ...@@ -51,6 +27,36 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/qmui_topbar_height" android:layout_height="?attr/qmui_topbar_height"
android:background="@color/theme_white_color" /> android:background="@color/theme_white_color" />
<LinearLayout
android:id="@+id/ll_table_operat_content"
android:layout_width="match_parent"
android:layout_height="?attr/qmui_topbar_height"
android:background="@color/transparent"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/normal_space"
android:visibility="invisible">
<TextView
android:id="@+id/tv_operat_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/orange_300"
android:textSize="@dimen/font_normal3" />
<TextView
android:id="@+id/tv_operat_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/normal_space"
android:layout_weight="1"
android:gravity="center_vertical"
android:text=""
android:textColor="@color/theme_white_color"
android:textSize="@dimen/font_normal3" />
</LinearLayout>
</RelativeLayout> </RelativeLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
...@@ -63,10 +69,14 @@ ...@@ -63,10 +69,14 @@
android:orientation="horizontal" android:orientation="horizontal"
android:padding="1dp" /> android:padding="1dp" />
<com.qmuiteam.qmui.widget.QMUITopBar <com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/topbar" android:id="@+id/btn_cancel_operat"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/qmui_topbar_height" android:layout_height="@dimen/dp_48"
app:qmui_topbar_title_color="@color/theme_white_color" /> android:textColor="@color/theme_white_color"
android:background="@color/theme_grey_color"
android:layout_alignParentBottom="true"
android:visibility="invisible"
android:text="取消" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -69,6 +69,7 @@ dependencies { ...@@ -69,6 +69,7 @@ dependencies {
addComponent 'download-data' addComponent 'download-data'
addComponent 'table-mode' addComponent 'table-mode'
addComponent 'mealstand-mode' addComponent 'mealstand-mode'
addComponent 'print-module'
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"] annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
......
...@@ -69,9 +69,14 @@ public class LoginPresenter extends BasePresenter<LoginContract.Model, LoginCont ...@@ -69,9 +69,14 @@ public class LoginPresenter extends BasePresenter<LoginContract.Model, LoginCont
public void login(String account, String pwd) { public void login(String account, String pwd) {
// RequestBody requestBody = new FormBody.Builder()
// .add("userName", account.trim() + "")
// .add("passWord", pwd.trim() + "")
// .build();
RequestBody requestBody = new FormBody.Builder() RequestBody requestBody = new FormBody.Builder()
.add("userName", account.trim() + "") .add("userName", "admin")
.add("passWord", pwd.trim() + "") .add("passWord", "123456")
.build(); .build();
mModel.login(requestBody) mModel.login(requestBody)
......
...@@ -4,6 +4,7 @@ import android.content.Intent; ...@@ -4,6 +4,7 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import com.billy.cc.core.component.CC; import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult; import com.billy.cc.core.component.CCResult;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
...@@ -21,7 +22,9 @@ import com.gingersoft.gsa.cloud.user.login.mvp.contract.LoginContract; ...@@ -21,7 +22,9 @@ import com.gingersoft.gsa.cloud.user.login.mvp.contract.LoginContract;
import com.gingersoft.gsa.cloud.user.login.mvp.presenter.LoginPresenter; import com.gingersoft.gsa.cloud.user.login.mvp.presenter.LoginPresenter;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils; import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.ui.view.MyEditText; import com.gingersoft.gsa.cloud.ui.view.MyEditText;
import java.io.IOException; import java.io.IOException;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import butterknife.BindView; import butterknife.BindView;
...@@ -76,10 +79,10 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login ...@@ -76,10 +79,10 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login
findViewById(R.id.tv_gsa_user_login).setOnClickListener(this); findViewById(R.id.tv_gsa_user_login).setOnClickListener(this);
edAccount = findViewById(R.id.ed_login_user_account); edAccount = findViewById(R.id.ed_login_user_account);
edPwd = findViewById(R.id.ed_login_user_pwd); edPwd = findViewById(R.id.ed_login_user_pwd);
if(GsaCloudApplication.getLoginToken(mContext).length() > 0){ // if(GsaCloudApplication.getLoginToken(mContext).length() > 0){
jumpActivity(); // jumpActivity();
finish(); // finish();
} // }
} }
@Override @Override
......
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