Commit 9dde516f by Wyh

1、餐牌時段的增刪改查 2、餐牌餐種的增刪改查 3、打印新增打印路徑,prj打印模式 4、供應鏈模塊

Signed-off-by: Wyh <1239658231>
parent ceec008e
...@@ -40,11 +40,12 @@ public class MyGlobalHttpHandler implements GlobalHttpHandler { ...@@ -40,11 +40,12 @@ public class MyGlobalHttpHandler implements GlobalHttpHandler {
builder.set("apptype", AppConstans.APP_TYPE); builder.set("apptype", AppConstans.APP_TYPE);
builder.set("appinfo", DeviceUtils.getVersionName(GsaCloudApplication.getAppContext())); builder.set("appinfo", DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()));
builder.set("mobileId", "1"); builder.set("mobileId", "1");
builder.set("uid", GsaCloudApplication.getMemberId() + "");
Headers headers = request.headers(); Headers headers = request.headers();
for (int i = 0; i < headers.size(); i++) { for (int i = 0; i < headers.size(); i++) {
builder.set(headers.name(i), headers.value(i)); builder.set(headers.name(i), headers.value(i));
} }
if(GsaCloudApplication.isLogin){ if (GsaCloudApplication.isLogin) {
builder.set("token", token); builder.set("token", token);
} }
// builder.set("Domain-Name", "common"); // builder.set("Domain-Name", "common");
...@@ -54,6 +55,4 @@ public class MyGlobalHttpHandler implements GlobalHttpHandler { ...@@ -54,6 +55,4 @@ public class MyGlobalHttpHandler implements GlobalHttpHandler {
} }
} }
...@@ -4,6 +4,15 @@ package com.gingersoft.gsa.cloud.constans; ...@@ -4,6 +4,15 @@ package com.gingersoft.gsa.cloud.constans;
* Created by Wyh on 2019/12/21. * Created by Wyh on 2019/12/21.
*/ */
public class AppConstans { public class AppConstans {
/**
* 供應鏈首頁action
*/
public static final String SUPPLY_CHAIN_MAIN_ACTION = "supply_chain_main_action";
/**
* 供應鏈模塊名
*/
public static final String SUPPLY_CHAIN_COMPONENT_NAME = "Component.SupplyChain";
public static final String RP_HEART_ERROR = "RP_HD001";//心跳斷開錯誤碼 public static final String RP_HEART_ERROR = "RP_HD001";//心跳斷開錯誤碼
public static final String RP_ORDER_LIST_ERROR = "RP_OL002";//訂單列表錯誤碼 public static final String RP_ORDER_LIST_ERROR = "RP_OL002";//訂單列表錯誤碼
...@@ -23,10 +32,10 @@ public class AppConstans { ...@@ -23,10 +32,10 @@ public class AppConstans {
public static final String CARSH_STR = "$"; public static final String CARSH_STR = "$";
public static final String CLEAR_ORDER_RECEIVING_HEART ="CLEAR_ORDER_RECEIVING_HEART"; public static final String CLEAR_ORDER_RECEIVING_HEART = "CLEAR_ORDER_RECEIVING_HEART";
/**語言下標*/ /**
* 語言下標
*/
public static final String LANGUAGE_INDEX = "language_index"; public static final String LANGUAGE_INDEX = "language_index";
//4個四通,四條腿
} }
...@@ -15,7 +15,6 @@ public class LoginBean { ...@@ -15,7 +15,6 @@ public class LoginBean {
/** /**
* success : true * success : true
* sysTime : 1578563902000 * sysTime : 1578563902000
* data : {"user":{"userId":1,"userName":"admin","brands":[{"brandId":242,"brandName":"莫拉塔","restaurants":[]},{"brandId":243,"brandName":"蕭蕭","restaurants":[{"restaurantId":337,"restaurantName":"小張"}]}]},"token":"24ce30df203b41619a21967dbd9988b9"}
*/ */
private boolean success; private boolean success;
......
...@@ -514,4 +514,8 @@ ...@@ -514,4 +514,8 @@
<color name="skeleton_color">@color/color_f4</color> <color name="skeleton_color">@color/color_f4</color>
<color name="required_color">#BE1C42</color> <color name="required_color">#BE1C42</color>
<!-- 供應鏈功能的文字顏色-->
<color name="supply_function_color">#94918F</color>
<!-- 供應鏈頁面背景色-->
<color name="supply_chain_bg_color">#EEF2F5</color>
</resources> </resources>
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<item name="topbar_right_change_button" type="id"/> <item name="topbar_right_change_button" type="id"/>
<item name="topbar_right_add_button" type="id"/> <item name="topbar_right_add_button" type="id"/>
<item name="topbar_right_edit_button" type="id"/> <item name="topbar_right_edit_button" type="id"/>
<item name="topbar_right_screen_button" type="id"/>
<item name="layout_for_test" type="id"/> <item name="layout_for_test" type="id"/>
<item name="topbar_heart_disconnect" type="id"/> <item name="topbar_heart_disconnect" type="id"/>
......
...@@ -123,9 +123,9 @@ public class Function { ...@@ -123,9 +123,9 @@ public class Function {
this.textSizeRes = textSizeRes; this.textSizeRes = textSizeRes;
} }
public Function(String resUrl, int iconRes) { public Function(String resName, int icRes) {
this.resUrl = resUrl; this.resName = resName;
this.iconRes = iconRes; this.icRes = icRes;
} }
@Generated(hash = 607723885) @Generated(hash = 607723885)
......
...@@ -7,11 +7,18 @@ import org.greenrobot.greendao.annotation.Property; ...@@ -7,11 +7,18 @@ import org.greenrobot.greendao.annotation.Property;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data;
/** /**
* Created by Wyh on 2020/1/17. * Created by Wyh on 2020/1/17.
*/ */
@Entity @Entity
@Data
public class PrinterDeviceBean implements Serializable { public class PrinterDeviceBean implements Serializable {
public static final int PRINT_IP = 1;
public static final int PRINT_LOCAL = 2;
public static final int PRINT_USB = 3;
public static final int PRINT_PRJ_PC = 4;
private static final long serialVersionUID = 4583366043598445115L; private static final long serialVersionUID = 4583366043598445115L;
...@@ -39,6 +46,10 @@ public class PrinterDeviceBean implements Serializable { ...@@ -39,6 +46,10 @@ public class PrinterDeviceBean implements Serializable {
private int printerDeviceType;//打印機類型 1:網絡打印 2:本地打印(N5,Sunmi手持打印) 3:USB打印 4:藍牙打印 private int printerDeviceType;//打印機類型 1:網絡打印 2:本地打印(N5,Sunmi手持打印) 3:USB打印 4:藍牙打印
/** /**
* PRJ模式時填寫的打印路徑,PC端共享文件夾的路徑
*/
private String printPath;
/**
* 飛單1打印機id * 飛單1打印機id
*/ */
private Long flyPrinterDeviceId; private Long flyPrinterDeviceId;
...@@ -77,9 +88,9 @@ public class PrinterDeviceBean implements Serializable { ...@@ -77,9 +88,9 @@ public class PrinterDeviceBean implements Serializable {
this.paperSpecification = paperSpecification; this.paperSpecification = paperSpecification;
} }
@Generated(hash = 243659502) @Generated(hash = 1843654148)
public PrinterDeviceBean(Long id, Long dbid, String name, Integer restaurantId, String ip, Long uid, Integer port, Integer type, Long printerModelId, String paperSpecification, int lineFontStop, String printerName, String model, String noteContent, Long printerDeviceDefaultId, int printerDeviceType, Long flyPrinterDeviceId, Long flyPrinterDeviceId2, int foodComplexion, int modifierComplexion, int foodIsBold, String foodFont, int foodIsItalic, int modifierIsBold, String modifierFont, public PrinterDeviceBean(Long id, Long dbid, String name, Integer restaurantId, String ip, Long uid, Integer port, Integer type, Long printerModelId, String paperSpecification, int lineFontStop, String printerName, String model, String noteContent, Long printerDeviceDefaultId, int printerDeviceType, String printPath, Long flyPrinterDeviceId, Long flyPrinterDeviceId2, int foodComplexion, int modifierComplexion, int foodIsBold, String foodFont, int foodIsItalic, int modifierIsBold,
int modifierIsItalic, int numberIsFlip, String languageType) { String modifierFont, int modifierIsItalic, int numberIsFlip, String languageType) {
this.id = id; this.id = id;
this.dbid = dbid; this.dbid = dbid;
this.name = name; this.name = name;
...@@ -96,6 +107,7 @@ public class PrinterDeviceBean implements Serializable { ...@@ -96,6 +107,7 @@ public class PrinterDeviceBean implements Serializable {
this.noteContent = noteContent; this.noteContent = noteContent;
this.printerDeviceDefaultId = printerDeviceDefaultId; this.printerDeviceDefaultId = printerDeviceDefaultId;
this.printerDeviceType = printerDeviceType; this.printerDeviceType = printerDeviceType;
this.printPath = printPath;
this.flyPrinterDeviceId = flyPrinterDeviceId; this.flyPrinterDeviceId = flyPrinterDeviceId;
this.flyPrinterDeviceId2 = flyPrinterDeviceId2; this.flyPrinterDeviceId2 = flyPrinterDeviceId2;
this.foodComplexion = foodComplexion; this.foodComplexion = foodComplexion;
...@@ -340,4 +352,12 @@ public class PrinterDeviceBean implements Serializable { ...@@ -340,4 +352,12 @@ public class PrinterDeviceBean implements Serializable {
public void setLanguageType(String languageType) { public void setLanguageType(String languageType) {
this.languageType = languageType; this.languageType = languageType;
} }
public String getPrintPath() {
return this.printPath;
}
public void setPrintPath(String printPath) {
this.printPath = printPath;
}
} }
...@@ -124,6 +124,7 @@ dependencies { ...@@ -124,6 +124,7 @@ dependencies {
addComponent 'delivery_pick_module' addComponent 'delivery_pick_module'
addComponent 'manager-module' addComponent 'manager-module'
addComponent 'coldchain-module' addComponent 'coldchain-module'
addComponent 'supply-chain-module'
implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03' implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03'
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"] annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
......
package com.gingersoft.gsa.cloud.main.mvp.contract; package com.gingersoft.gsa.cloud.main.mvp.contract;
import com.jess.arms.mvp.IView; import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.FoodGroupBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SummaryBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.TimePeriodBean;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import java.util.List;
import io.reactivex.Observable;
/** /**
...@@ -19,11 +27,38 @@ import com.jess.arms.mvp.IModel; ...@@ -19,11 +27,38 @@ import com.jess.arms.mvp.IModel;
public interface EditFoodContract { public interface EditFoodContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void loadInfoList(List<FoodGroupBean> foodGroupBeans);
void setTimePeriodClick(List<TimePeriodBean> timePeriodBeans);
void setSummaryClick(List<SummaryBean> summaryBeans);
void deleteByPosition(int position);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel { interface Model extends IModel {
Observable<BaseResult> getPeriodList(int brandId);
/**
* 刪除時段
* @param id 時段id
* @return
*/
Observable<BaseResult> deletePeriod(int id);
/**
* 獲取餐種列表
* @param restaurantId 餐廳id
* @return
*/
Observable<BaseResult> getSummaryList(int restaurantId);
/**
* 刪除餐種
* @param id 餐種id
* @return
*/
Observable<BaseResult> deleteSummary(int id);
} }
} }
package com.gingersoft.gsa.cloud.main.mvp.contract; package com.gingersoft.gsa.cloud.main.mvp.contract;
import com.jess.arms.mvp.IView; import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/** /**
...@@ -24,6 +28,39 @@ public interface NewlyAddedContract { ...@@ -24,6 +28,39 @@ public interface NewlyAddedContract {
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel { interface Model extends IModel {
/**
* 添加時段
* @param requestBody
* @return
*/
Observable<BaseResult> addPeriod(RequestBody requestBody);
/**
* 修改時段
* @param requestBody
* @return
*/
Observable<BaseResult> updatePeriod(RequestBody requestBody);
/**
* 刪除時段
* @param id 時段id
* @return
*/
Observable<BaseResult> deletePeriod(int id);
/**
* 新增餐種
* @param requestBody
* @return
*/
Observable<BaseResult> addSummary(RequestBody requestBody);
/**
* 修改餐種
* @param requestBody
* @return
*/
Observable<BaseResult> updateSummary(RequestBody requestBody);
} }
} }
...@@ -2,15 +2,17 @@ package com.gingersoft.gsa.cloud.main.mvp.model; ...@@ -2,15 +2,17 @@ package com.gingersoft.gsa.cloud.main.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.main.mvp.contract.EditFoodContract;
import com.gingersoft.gsa.cloud.main.mvp.model.service.FoodMenuService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel; import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.gsa.cloud.main.mvp.contract.EditFoodContract; import io.reactivex.Observable;
/** /**
...@@ -43,4 +45,24 @@ public class EditFoodModel extends BaseModel implements EditFoodContract.Model { ...@@ -43,4 +45,24 @@ public class EditFoodModel extends BaseModel implements EditFoodContract.Model {
this.mGson = null; this.mGson = null;
this.mApplication = null; this.mApplication = null;
} }
@Override
public Observable<BaseResult> getPeriodList(int brandId) {
return mRepositoryManager.obtainRetrofitService(FoodMenuService.class).getPeriodList(brandId);
}
@Override
public Observable<BaseResult> deletePeriod(int id) {
return mRepositoryManager.obtainRetrofitService(FoodMenuService.class).deletePeriod(id);
}
@Override
public Observable<BaseResult> getSummaryList(int restaurantId) {
return mRepositoryManager.obtainRetrofitService(FoodMenuService.class).getSummaryList(restaurantId);
}
@Override
public Observable<BaseResult> deleteSummary(int id) {
return mRepositoryManager.obtainRetrofitService(FoodMenuService.class).deleteSummary(id);
}
} }
\ No newline at end of file
...@@ -2,15 +2,18 @@ package com.gingersoft.gsa.cloud.main.mvp.model; ...@@ -2,15 +2,18 @@ package com.gingersoft.gsa.cloud.main.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.main.mvp.contract.NewlyAddedContract;
import com.gingersoft.gsa.cloud.main.mvp.model.service.FoodMenuService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel; import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.gsa.cloud.main.mvp.contract.NewlyAddedContract; import io.reactivex.Observable;
import okhttp3.RequestBody;
/** /**
...@@ -43,4 +46,30 @@ public class NewlyAddedModel extends BaseModel implements NewlyAddedContract.Mod ...@@ -43,4 +46,30 @@ public class NewlyAddedModel extends BaseModel implements NewlyAddedContract.Mod
this.mGson = null; this.mGson = null;
this.mApplication = null; this.mApplication = null;
} }
@Override
public Observable<BaseResult> addPeriod(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(FoodMenuService.class).addPeriod(requestBody);
}
@Override
public Observable<BaseResult> updatePeriod(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(FoodMenuService.class).updatePeriod(requestBody);
}
@Override
public Observable<BaseResult> deletePeriod(int id) {
return mRepositoryManager.obtainRetrofitService(FoodMenuService.class).deletePeriod(id);
}
@Override
public Observable<BaseResult> addSummary(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(FoodMenuService.class).addSummary(requestBody);
}
@Override
public Observable<BaseResult> updateSummary(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(FoodMenuService.class).updateSummary(requestBody);
}
} }
\ No newline at end of file
...@@ -12,9 +12,11 @@ import lombok.Data; ...@@ -12,9 +12,11 @@ import lombok.Data;
@Data @Data
public class FoodGroupBean { public class FoodGroupBean {
private int id;
private String foodGroupName; private String foodGroupName;
public FoodGroupBean(String foodGroupName) { public FoodGroupBean(int id, String foodGroupName) {
this.id = id;
this.foodGroupName = foodGroupName; this.foodGroupName = foodGroupName;
} }
} }
...@@ -44,6 +44,7 @@ public class FoodMenuEditBean { ...@@ -44,6 +44,7 @@ public class FoodMenuEditBean {
public int itemType; public int itemType;
private int id;
/** /**
* 用於顯示的標題 * 用於顯示的標題
*/ */
...@@ -63,17 +64,6 @@ public class FoodMenuEditBean { ...@@ -63,17 +64,6 @@ public class FoodMenuEditBean {
*/ */
private List<ShowClient> checkBoxList; private List<ShowClient> checkBoxList;
private String foodName1;
private String foodName2;
private String foodName3;
/**
* 時段
*/
private String timePeriod;
/**
* 餐種
*/
private String foodType;
/** /**
* 顯示狀態,多個端顯示 * 顯示狀態,多個端顯示
*/ */
...@@ -132,6 +122,12 @@ public class FoodMenuEditBean { ...@@ -132,6 +122,12 @@ public class FoodMenuEditBean {
this.isChecked = isChecked; this.isChecked = isChecked;
} }
} }
/**
* 新增或編輯,list下標為0的item裝有對應的對象。
*/
private SummaryBean summaryBean;
private TimePeriodBean timePeriodBean;
public FoodMenuEditBean() { public FoodMenuEditBean() {
} }
......
package com.gingersoft.gsa.cloud.main.mvp.model.bean;
import java.io.Serializable;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2020/11/18
* Time: 18:43
* Use:
*/
@Data
public class SummaryBean implements Serializable {
private static final long serialVersionUID = 1374006138456209796L;
private int id;
private String name;
private int restaurantId;
/**
* 是否有效:0 無效,1 有效
*/
private int valid;
private String createDate;
private String updateDate;
private String updateBy;
private int businessType;
private String createBy;
private int isDefault;
private int seqNo;
}
package com.gingersoft.gsa.cloud.main.mvp.model.bean;
import java.io.Serializable;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2020/11/18
* Time: 14:20
* Use:
*/
@Data
public class TimePeriodBean implements Serializable {
private static final long serialVersionUID = -555404634011042193L;
private int id;
private String periodName1;
private String periodName2;
private String periodName3;
/**
* 0 未選擇,1已選擇
*/
private int day1;
private int day2;
private int day3;
private int day4;
private int day5;
private int day6;
private int day7;
/**
* 1=使用假日表中的記錄, 0=找假日表中的記錄排除
*/
private int dayH;
private String beginTime;
private String endTime;
private String beginDate;
private String endDate;
private int restaurantId;
private int brandId;
}
package com.gingersoft.gsa.cloud.main.mvp.model.service;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
/**
* @author 宇航.
* User: admin
* Date: 2020/11/18
* Time: 10:35
* Use:
*/
public interface FoodMenuService {
@Headers({"Domain-Name: ricepon_restaurant"})
@GET("period/getPeriodList" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getPeriodList(@Query("brandId") int brandId);
@Headers({"Domain-Name: ricepon_restaurant"})
@POST("period/addPeriod" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> addPeriod(@Body RequestBody requestBody);
@Headers({"Domain-Name: ricepon_restaurant"})
@POST("period/updatePeriod" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> updatePeriod(@Body RequestBody requestBody);
@Headers({"Domain-Name: ricepon_restaurant"})
@FormUrlEncoded
@POST("period/deletePeriod" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> deletePeriod(@Field("id") int id);
@Headers({"Domain-Name: ricepon_restaurant"})
@GET("summary/getSummaryList" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getSummaryList(@Query("restaurantId") int restaurantId);
@Headers({"Domain-Name: ricepon_restaurant"})
@POST("summary/addSummary" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> addSummary(@Body RequestBody requestBody);
@Headers({"Domain-Name: ricepon_restaurant"})
@POST("summary/updateSummary" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> updateSummary(@Body RequestBody requestBody);
@Headers({"Domain-Name: ricepon_restaurant"})
@FormUrlEncoded
@POST("summary/deleteSummary" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> deleteSummary(@Field("id") int id);
}
...@@ -2,15 +2,32 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter; ...@@ -2,15 +2,32 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.main.mvp.contract.EditFoodContract; import com.gingersoft.gsa.cloud.main.mvp.contract.EditFoodContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.FoodGroupBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SummaryBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.TimePeriodBean;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import static com.gingersoft.gsa.cloud.main.mvp.ui.fragment.menu.BaseFoodMenuFragment.SELECT_FOOD_TYPE;
import static com.gingersoft.gsa.cloud.main.mvp.ui.fragment.menu.BaseFoodMenuFragment.SELECT_TIME_PERIOD;
/** /**
...@@ -49,4 +66,119 @@ public class EditFoodPresenter extends BasePresenter<EditFoodContract.Model, Edi ...@@ -49,4 +66,119 @@ public class EditFoodPresenter extends BasePresenter<EditFoodContract.Model, Edi
this.mImageLoader = null; this.mImageLoader = null;
this.mApplication = null; this.mApplication = null;
} }
public void loadInfo(int fragmentType) {
if (fragmentType == SELECT_TIME_PERIOD) {
getPeriodList();
} else if (fragmentType == SELECT_FOOD_TYPE) {
getSummaryList();
}
}
public void deleteInfoById(int fragmentType, int id, int position) {
Observable<BaseResult> baseResultObservable = null;
if (fragmentType == SELECT_TIME_PERIOD) {
baseResultObservable = mModel.deletePeriod(id);
} else if (fragmentType == SELECT_FOOD_TYPE) {
baseResultObservable = mModel.deleteSummary(id);
}
if (baseResultObservable != null) {
deletePeriod(baseResultObservable, position);
}
}
/**
* 刪除時段
* @param position
*/
private void deletePeriod(Observable<BaseResult> observable, int position) {
observable.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("刪除中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult result) {
if (result.isSuccess()) {
mRootView.deleteByPosition(position);
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
}
});
}
/**
* 獲取時段列表
*/
private void getPeriodList() {
mModel.getPeriodList(GsaCloudApplication.getBrandId())
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取時段信息中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult result) {
if (result.isSuccess()) {
List<TimePeriodBean> timePeriodBeans = JsonUtils.parseArray(result.getData(), TimePeriodBean.class);
if (timePeriodBeans != null) {
List<FoodGroupBean> foodGroupBeans = new ArrayList<>();
for (TimePeriodBean timePeriodBean : timePeriodBeans) {
foodGroupBeans.add(new FoodGroupBean(timePeriodBean.getId(), timePeriodBean.getPeriodName1()));
}
mRootView.loadInfoList(foodGroupBeans);
mRootView.setTimePeriodClick(timePeriodBeans);
}
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
}
});
}
/**
* 獲取餐種
*/
private void getSummaryList() {
mModel.getSummaryList(GsaCloudApplication.getRestaurantId())
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取餐種信息中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult result) {
if (result.isSuccess()) {
List<SummaryBean> summaryBeans = JsonUtils.parseArray(result.getData(), SummaryBean.class);
if (summaryBeans != null) {
List<FoodGroupBean> foodGroupBeans = new ArrayList<>();
for (SummaryBean summaryBean : summaryBeans) {
foodGroupBeans.add(new FoodGroupBean(summaryBean.getId(), summaryBean.getName()));
}
mRootView.loadInfoList(foodGroupBeans);
mRootView.setSummaryClick(summaryBeans);
}
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
}
});
}
} }
...@@ -2,15 +2,32 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter; ...@@ -2,15 +2,32 @@ package com.gingersoft.gsa.cloud.main.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.main.mvp.contract.NewlyAddedContract; import com.gingersoft.gsa.cloud.main.mvp.contract.NewlyAddedContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SummaryBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.TimePeriodBean;
import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.foodmenu.FoodMenuAdapter;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import javax.inject.Inject; import javax.inject.Inject;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import static com.gingersoft.gsa.cloud.main.mvp.ui.fragment.menu.BaseFoodMenuFragment.NEW_FOOD_TYPE;
import static com.gingersoft.gsa.cloud.main.mvp.ui.fragment.menu.BaseFoodMenuFragment.NEW_TIME_PERIOD;
/** /**
...@@ -49,4 +66,85 @@ public class NewlyAddedPresenter extends BasePresenter<NewlyAddedContract.Model, ...@@ -49,4 +66,85 @@ public class NewlyAddedPresenter extends BasePresenter<NewlyAddedContract.Model,
this.mImageLoader = null; this.mImageLoader = null;
this.mApplication = null; this.mApplication = null;
} }
public void saveInfoByType(int fragmentType, FoodMenuAdapter foodMenuAdapter, boolean isUpdate) {
if (fragmentType == NEW_TIME_PERIOD) {
//新增時段
addTimePeriod(foodMenuAdapter.getTimePeriodInfo(), isUpdate);
} else if(fragmentType == NEW_FOOD_TYPE){
addSummary(foodMenuAdapter.getSummaryInfo(), isUpdate);
}
}
/**
* 餐種
*
* @param summaryBean 餐種數據
*/
private void addSummary(SummaryBean summaryBean, boolean isUpdate) {
if (TextUtil.isEmptyOrNullOrUndefined(summaryBean.getName())) {
mRootView.showMessage("請輸入餐種名稱");
return;
}
Observable<BaseResult> baseResultObservable;
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(summaryBean));
if (isUpdate) {
baseResultObservable = mModel.updateSummary(requestBody);
} else {
baseResultObservable = mModel.addSummary(requestBody);
}
baseResultObservable.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult result) {
if (result.isSuccess()) {
mRootView.showMessage("保存成功");
mRootView.killMyself();
}
}
});
}
/**
* 時段
*
* @param timePeriodBean 時段數據
*/
private void addTimePeriod(TimePeriodBean timePeriodBean, boolean isUpdate) {
if (TextUtil.isEmptyOrNullOrUndefined(timePeriodBean.getPeriodName1())) {
mRootView.showMessage("請輸入時段名稱");
return;
}
Observable<BaseResult> baseResultObservable;
timePeriodBean.setBrandId(GsaCloudApplication.getBrandId());
timePeriodBean.setRestaurantId(GsaCloudApplication.getRestaurantId());
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(timePeriodBean));
if (isUpdate) {
baseResultObservable = mModel.updatePeriod(requestBody);
} else {
baseResultObservable = mModel.addPeriod(requestBody);
}
baseResultObservable.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult result) {
if (result.isSuccess()) {
mRootView.showMessage("保存成功");
mRootView.killMyself();
}
}
});
}
} }
...@@ -29,6 +29,7 @@ import com.gingersoft.gsa.cloud.base.utils.RestaurantInfoUtils; ...@@ -29,6 +29,7 @@ import com.gingersoft.gsa.cloud.base.utils.RestaurantInfoUtils;
import com.gingersoft.gsa.cloud.base.utils.encryption.Aes; import com.gingersoft.gsa.cloud.base.utils.encryption.Aes;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils; import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils; import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.constans.AppConstans;
import com.gingersoft.gsa.cloud.constans.ResultConstans; import com.gingersoft.gsa.cloud.constans.ResultConstans;
import com.gingersoft.gsa.cloud.database.bean.Function; import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.function.FunctionManager; import com.gingersoft.gsa.cloud.function.FunctionManager;
...@@ -269,10 +270,11 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -269,10 +270,11 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
List<Function> managerFuncations = FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager"); List<Function> managerFuncations = FunctionManager.getDefault().getFunctionByResModule(this, ComponentMain.main.class, ComponentMain.main.manager, "manager");
managerFuncations.add(new Function(171, 163, 5, "二維碼", R.drawable.ic_authority_management, 0)); managerFuncations.add(new Function(171, 163, 5, "二維碼", R.drawable.ic_qr_code, 0));
managerFuncations.add(new Function(171, 163, 5, "配置列表", R.drawable.ic_authority_management, 0)); managerFuncations.add(new Function(171, 163, 5, "配置列表", R.drawable.ic_expand_list, 0));
managerFuncations.add(new Function(171, 163, 5, "廚房打印查詢", R.drawable.ic_authority_management, 0)); managerFuncations.add(new Function(171, 163, 5, "廚房打印查詢", R.drawable.ic_kitchen_print_query, 0));
managerFuncations.add(new Function(171, 163, 5, "餐牌管理", R.drawable.ic_authority_management, 0)); managerFuncations.add(new Function(171, 163, 5, "餐牌管理", R.drawable.ic_food_menu_manger, 0));
managerFuncations.add(new Function(171, 163, 5, "採購", R.drawable.ic_purchase, 0));
if (managerFuncations.size() > 0) { if (managerFuncations.size() > 0) {
functions.addAll(managerFuncations); functions.addAll(managerFuncations);
...@@ -395,6 +397,12 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -395,6 +397,12 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
case "餐牌管理": case "餐牌管理":
launchActivity(new Intent(mContext, FoodMenuManageActivity.class)); launchActivity(new Intent(mContext, FoodMenuManageActivity.class));
break; break;
case "採購":
CC.obtainBuilder(AppConstans.SUPPLY_CHAIN_COMPONENT_NAME)
.setActionName(AppConstans.SUPPLY_CHAIN_MAIN_ACTION)
.build()
.call();
break;
default: default:
break; break;
} }
......
package com.gingersoft.gsa.cloud.main.mvp.ui.adapter; package com.gingersoft.gsa.cloud.main.mvp.ui.adapter;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.database.bean.Function; import com.gingersoft.gsa.cloud.database.bean.Function;
...@@ -7,8 +11,6 @@ import com.gingersoft.gsa.cloud.main.R; ...@@ -7,8 +11,6 @@ import com.gingersoft.gsa.cloud.main.R;
import java.util.List; import java.util.List;
import androidx.annotation.Nullable;
/** /**
* Created by Wyh on 2020/2/19. * Created by Wyh on 2020/2/19.
* 首頁點餐 * 首頁點餐
...@@ -27,5 +29,7 @@ public class MainOrderingAdapter extends BaseQuickAdapter<Function, BaseViewHold ...@@ -27,5 +29,7 @@ public class MainOrderingAdapter extends BaseQuickAdapter<Function, BaseViewHold
protected void convert(BaseViewHolder helper, Function item) { protected void convert(BaseViewHolder helper, Function item) {
helper.setImageResource(R.id.iv_main_home_item_function_icon, item.getIcRes()); helper.setImageResource(R.id.iv_main_home_item_function_icon, item.getIcRes());
helper.setText(R.id.tv_main_home_item_function_name, item.getResName()); helper.setText(R.id.tv_main_home_item_function_name, item.getResName());
TextView textView = helper.getView(R.id.tv_main_home_item_function_name);
textView.setSelected(true);
} }
} }
...@@ -23,7 +23,7 @@ public class FoodGroupEditAdapter extends BaseQuickAdapter<FoodGroupBean, BaseVi ...@@ -23,7 +23,7 @@ public class FoodGroupEditAdapter extends BaseQuickAdapter<FoodGroupBean, BaseVi
public FoodGroupEditAdapter(@Nullable List<FoodGroupBean> data) { public FoodGroupEditAdapter(@Nullable List<FoodGroupBean> data) {
super(R.layout.item_food_group_edit, data); super(R.layout.item_food_group_edit, data);
addChildClickViewIds(R.id.iv_food_group_delete); addChildClickViewIds(R.id.iv_food_group_delete, R.id.iv_food_group_edit);
} }
@Override @Override
...@@ -37,4 +37,8 @@ public class FoodGroupEditAdapter extends BaseQuickAdapter<FoodGroupBean, BaseVi ...@@ -37,4 +37,8 @@ public class FoodGroupEditAdapter extends BaseQuickAdapter<FoodGroupBean, BaseVi
isShowEdit = !isShowEdit; isShowEdit = !isShowEdit;
super.notifyDataSetChanged(); super.notifyDataSetChanged();
} }
public boolean isShowEdit() {
return isShowEdit;
}
} }
...@@ -3,7 +3,10 @@ package com.gingersoft.gsa.cloud.main.mvp.ui.adapter.foodmenu; ...@@ -3,7 +3,10 @@ package com.gingersoft.gsa.cloud.main.mvp.ui.adapter.foodmenu;
import android.content.Context; import android.content.Context;
import com.chad.library.adapter.base.BaseProviderMultiAdapter; import com.chad.library.adapter.base.BaseProviderMultiAdapter;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.FoodMenuEditBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.FoodMenuEditBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SummaryBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.TimePeriodBean;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
...@@ -38,7 +41,7 @@ import static com.gingersoft.gsa.cloud.main.mvp.ui.fragment.menu.FoodMenuFragmen ...@@ -38,7 +41,7 @@ import static com.gingersoft.gsa.cloud.main.mvp.ui.fragment.menu.FoodMenuFragmen
public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean> { public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean> {
private static FoodMenuEditBean showClient; private static FoodMenuEditBean showClient;
public static FoodMenuAdapter getFoodMenuAdapter(Context context, int listType) { public static List<FoodMenuEditBean> getFoodMenuEditBean(int listType) {
List<FoodMenuEditBean> foodMenuEditBeans; List<FoodMenuEditBean> foodMenuEditBeans;
switch (listType) { switch (listType) {
case NEW_FOOD_GROUP: case NEW_FOOD_GROUP:
...@@ -75,6 +78,10 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean> ...@@ -75,6 +78,10 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean>
foodMenuEditBeans = null; foodMenuEditBeans = null;
break; break;
} }
return foodMenuEditBeans;
}
public static FoodMenuAdapter getFoodMenuAdapter(Context context, List<FoodMenuEditBean> foodMenuEditBeans) {
return new FoodMenuAdapter(context, foodMenuEditBeans); return new FoodMenuAdapter(context, foodMenuEditBeans);
} }
...@@ -169,6 +176,18 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean> ...@@ -169,6 +176,18 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean>
return foodMenuEditBeans; return foodMenuEditBeans;
} }
public SummaryBean getSummaryInfo() {
List<FoodMenuEditBean> data = getData();
SummaryBean summaryBean = data.get(0).getSummaryBean();
if(summaryBean == null){
summaryBean = new SummaryBean();
}
summaryBean.setRestaurantId(GsaCloudApplication.getRestaurantId());
summaryBean.setName(data.get(0).getShowValue());
summaryBean.setValid(data.get(1).isShowState() ? 1 : 0);
return summaryBean;
}
/** /**
* 新增時段 * 新增時段
* *
...@@ -204,6 +223,36 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean> ...@@ -204,6 +223,36 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean>
} }
/** /**
* @return 新增時段數據
*/
public TimePeriodBean getTimePeriodInfo() {
List<FoodMenuEditBean> data = getData();
TimePeriodBean timePeriodBean = data.get(0).getTimePeriodBean();
if (timePeriodBean == null) {
timePeriodBean = new TimePeriodBean();
}
timePeriodBean.setId(data.get(0).getId());
timePeriodBean.setPeriodName1(data.get(0).getShowValue());
timePeriodBean.setPeriodName2(data.get(1).getShowValue());
timePeriodBean.setPeriodName3(data.get(2).getShowValue());
timePeriodBean.setBeginDate(data.get(3).getShowValue());
timePeriodBean.setEndDate(data.get(4).getShowValue());
timePeriodBean.setBeginTime(data.get(5).getShowValue());
timePeriodBean.setEndTime(data.get(6).getShowValue());
List<FoodMenuEditBean.ShowClient> checkBoxList = data.get(9).getCheckBoxList();
timePeriodBean.setDay1(checkBoxList.get(1).isChecked() ? 1 : 0);
timePeriodBean.setDay2(checkBoxList.get(2).isChecked() ? 1 : 0);
timePeriodBean.setDay3(checkBoxList.get(3).isChecked() ? 1 : 0);
timePeriodBean.setDay4(checkBoxList.get(4).isChecked() ? 1 : 0);
timePeriodBean.setDay5(checkBoxList.get(5).isChecked() ? 1 : 0);
timePeriodBean.setDay6(checkBoxList.get(6).isChecked() ? 1 : 0);
timePeriodBean.setDay7(checkBoxList.get(7).isChecked() ? 1 : 0);
timePeriodBean.setDayH(checkBoxList.get(0).isChecked() ? 1 : 0);
return timePeriodBean;
}
/**
* 加配細項 * 加配細項
* *
* @return * @return
...@@ -232,6 +281,7 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean> ...@@ -232,6 +281,7 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean>
foodMenuEditBeans.add(new FoodMenuEditBean(FoodMenuEditBean.EDIT_FOOD_ITEM_SELECT, "排除選項", false, "請選擇", SELECT_EXCLUDE_LIST)); foodMenuEditBeans.add(new FoodMenuEditBean(FoodMenuEditBean.EDIT_FOOD_ITEM_SELECT, "排除選項", false, "請選擇", SELECT_EXCLUDE_LIST));
return foodMenuEditBeans; return foodMenuEditBeans;
} }
/** /**
* 加配套餐 * 加配套餐
* *
...@@ -260,6 +310,7 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean> ...@@ -260,6 +310,7 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean>
foodMenuEditBeans.add(new FoodMenuEditBean(FoodMenuEditBean.EDIT_FOOD_ITEM_SELECT, "排除選項", false, "請選擇", SELECT_EXCLUDE_LIST)); foodMenuEditBeans.add(new FoodMenuEditBean(FoodMenuEditBean.EDIT_FOOD_ITEM_SELECT, "排除選項", false, "請選擇", SELECT_EXCLUDE_LIST));
return foodMenuEditBeans; return foodMenuEditBeans;
} }
/** /**
* 加配細項 * 加配細項
* *
...@@ -346,4 +397,6 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean> ...@@ -346,4 +397,6 @@ public class FoodMenuAdapter extends BaseProviderMultiAdapter<FoodMenuEditBean>
foodMenuEditBeans.add(new FoodMenuEditBean(FoodMenuEditBean.EDIT_FOOD_ITEM_CHECKBOX, "顯示狀態", false, selectCount)); foodMenuEditBeans.add(new FoodMenuEditBean(FoodMenuEditBean.EDIT_FOOD_ITEM_CHECKBOX, "顯示狀態", false, selectCount));
return foodMenuEditBeans; return foodMenuEditBeans;
} }
} }
package com.gingersoft.gsa.cloud.main.mvp.ui.adapter.foodmenu; package com.gingersoft.gsa.cloud.main.mvp.ui.adapter.foodmenu;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText; import android.widget.EditText;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
...@@ -33,5 +35,22 @@ public class InputItemProvider extends FoodMenuItemProvider { ...@@ -33,5 +35,22 @@ public class InputItemProvider extends FoodMenuItemProvider {
} else if (TextUtil.isNotEmptyOrNullOrUndefined(foodMenuEditBean.getHintText())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(foodMenuEditBean.getHintText())) {
editText.setHint(foodMenuEditBean.getHintText()); editText.setHint(foodMenuEditBean.getHintText());
} }
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
FoodMenuEditBean foodMenuEditBean1 = getAdapter().getData().get(baseViewHolder.getAdapterPosition());
foodMenuEditBean1.setShowValue(s + "");
}
});
} }
} }
...@@ -195,7 +195,7 @@ public abstract class BaseFoodMenuFragment<P extends IPresenter> extends BaseFra ...@@ -195,7 +195,7 @@ public abstract class BaseFoodMenuFragment<P extends IPresenter> extends BaseFra
protected void toFragmentByFragmentType(int fragmentType) { protected void toFragmentByFragmentType(int fragmentType) {
ISupportFragment fragment = getFragmentByType(fragmentType); ISupportFragment fragment = getFragmentByType(fragmentType);
if (fragment != null) { if (fragment != null) {
start(fragment); startForResult(fragment, fragmentType);
} }
} }
} }
...@@ -19,7 +19,8 @@ import com.gingersoft.gsa.cloud.main.R2; ...@@ -19,7 +19,8 @@ import com.gingersoft.gsa.cloud.main.R2;
import com.gingersoft.gsa.cloud.main.di.component.DaggerEditFoodComponent; import com.gingersoft.gsa.cloud.main.di.component.DaggerEditFoodComponent;
import com.gingersoft.gsa.cloud.main.mvp.contract.EditFoodContract; import com.gingersoft.gsa.cloud.main.mvp.contract.EditFoodContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.FoodGroupBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.FoodGroupBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.FoodMenuEditBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.SummaryBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.TimePeriodBean;
import com.gingersoft.gsa.cloud.main.mvp.presenter.EditFoodPresenter; import com.gingersoft.gsa.cloud.main.mvp.presenter.EditFoodPresenter;
import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.foodmenu.FoodGroupEditAdapter; import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.foodmenu.FoodGroupEditAdapter;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration; import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration;
...@@ -28,11 +29,13 @@ import com.jess.arms.di.component.AppComponent; ...@@ -28,11 +29,13 @@ import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import me.yokeyword.fragmentation.ISupportFragment;
import static com.gingersoft.gsa.cloud.main.mvp.ui.fragment.menu.NewlyAddedFragment.SUMMARY_INFO;
import static com.gingersoft.gsa.cloud.main.mvp.ui.fragment.menu.NewlyAddedFragment.TIME_PERIOD_INFO;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -93,45 +96,93 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im ...@@ -93,45 +96,93 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im
toShellActivity = arguments.getBoolean(TO_SHELL_ACTIVITY); toShellActivity = arguments.getBoolean(TO_SHELL_ACTIVITY);
} }
initTopBar(title); initTopBar(title);
getInfo();
}
List<FoodGroupBean> data = new ArrayList<>(); private void getInfo() {
for (int i = 0; i < 10; i++) { mPresenter.loadInfo(fragmentType);
data.add(new FoodGroupBean("時段名稱" + i));
} }
@Override
public void loadInfoList(List<FoodGroupBean> foodGroupBeans) {
rvContent.addItemDecoration(new DividerItemDecoration(mContext, LinearLayoutManager.VERTICAL)); rvContent.addItemDecoration(new DividerItemDecoration(mContext, LinearLayoutManager.VERTICAL));
rvContent.setLayoutManager(new LinearLayoutManager(mContext)); rvContent.setLayoutManager(new LinearLayoutManager(mContext));
foodGroupEditAdapter = new FoodGroupEditAdapter(data); foodGroupEditAdapter = new FoodGroupEditAdapter(foodGroupBeans);
rvContent.setAdapter(foodGroupEditAdapter); rvContent.setAdapter(foodGroupEditAdapter);
foodGroupEditAdapter.setOnItemClickListener((adapter, view, position) -> {
if (adapter.getItemViewType(position) == FoodMenuEditBean.EDIT_FOOD_ITEM_SELECT) {
if (toShellActivity) {
// Intent intent = new Intent(mContext, ShellActivity.class);
// intent.putExtra(FRAGMENT_TYPE, foodGroupEditAdapter.getData().get(position).getFragmentType());
// startActivity(intent);
} else {
// toFragmentByFragmentType(foodGroupEditAdapter.getData().get(position).getFragmentType());
} }
} else {
@Override
public void setTimePeriodClick(List<TimePeriodBean> timePeriodBeans) {
foodGroupEditAdapter.setOnItemClickListener((adapter, view, position) -> {
Bundle bundle = new Bundle();
bundle.putSerializable(TIME_PERIOD_INFO, timePeriodBeans.get(position));
itemClick(bundle);
});
foodGroupEditAdapter.setOnItemChildClickListener((adapter, view, position) -> {
// if (view.getId() == R.id.iv_food_group_delete) {
// new AppDialog().showWaringDialog(mContext, "是否確認刪除?", (view1, dialog) -> {
// mPresenter.deleteInfoById(fragmentType, timePeriodBeans.get(position).getId(), position);
// dialog.dismiss();
// });
// } else if (view.getId() == R.id.iv_food_group_edit) {
// NewlyAddedFragment newlyAddedFragment = NewlyAddedFragment.newInstance(NEW_TIME_PERIOD, "編輯時段");
// Bundle arguments = newlyAddedFragment.getArguments();
// arguments.putSerializable(TIME_PERIOD_INFO, timePeriodBeans.get(position));
// newlyAddedFragment.putNewBundle(arguments);
// startForResult(newlyAddedFragment, fragmentType);
// }
NewlyAddedFragment newlyAddedFragment = NewlyAddedFragment.newInstance(NEW_TIME_PERIOD, "編輯時段");
Bundle arguments = newlyAddedFragment.getArguments();
arguments.putSerializable(TIME_PERIOD_INFO, timePeriodBeans.get(position));
newlyAddedFragment.putNewBundle(arguments);
itemChildChick(view.getId(), timePeriodBeans.get(position).getId(), position, newlyAddedFragment);
});
} }
@Override
public void setSummaryClick(List<SummaryBean> summaryBeans) {
foodGroupEditAdapter.setOnItemClickListener((adapter, view, position) -> {
Bundle bundle = new Bundle();
bundle.putSerializable(SUMMARY_INFO, summaryBeans.get(position));
itemClick(bundle);
}); });
foodGroupEditAdapter.setOnItemChildClickListener((adapter, view, position) -> { foodGroupEditAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_food_group_delete) { NewlyAddedFragment newlyAddedFragment = NewlyAddedFragment.newInstance(NEW_FOOD_TYPE, "編輯餐種");
new AppDialog().showWaringDialog(mContext, "是否確認刪除" + data.get(position).getFoodGroupName(), (view1, dialog) -> { Bundle arguments = newlyAddedFragment.getArguments();
foodGroupEditAdapter.removeAt(position); arguments.putSerializable(SUMMARY_INFO, summaryBeans.get(position));
dialog.dismiss(); newlyAddedFragment.putNewBundle(arguments);
itemChildChick(view.getId(), summaryBeans.get(position).getId(), position, newlyAddedFragment);
}); });
} }
private void itemClick(Bundle bundle) {
setFragmentResult(fragmentType, bundle);
killMyself();
}
private void itemChildChick(int viewId, int id, int position, ISupportFragment toFragment) {
if (viewId == R.id.iv_food_group_delete) {
new AppDialog().showWaringDialog(mContext, "是否確認刪除?", (view1, dialog) -> {
mPresenter.deleteInfoById(fragmentType, id, position);
dialog.dismiss();
}); });
} else if (viewId == R.id.iv_food_group_edit) {
startForResult(toFragment, fragmentType);
}
}
@Override
public void deleteByPosition(int position) {
foodGroupEditAdapter.removeAt(position);
} }
public void initTopBar(String title) { public void initTopBar(String title) {
topbarList.setTitle(title); topbarList.setTitle(title);
topbarList.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener(v -> { topbarList.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener(v -> {
FragmentActivity activity = getActivity(); killMyself();
if (activity != null) {
activity.onBackPressed();
}
}); });
topbarList.addRightImageButton(R.drawable.ic_white_add, R.id.topbar_right_add_button).setOnClickListener(this); topbarList.addRightImageButton(R.drawable.ic_white_add, R.id.topbar_right_add_button).setOnClickListener(this);
topbarList.addRightImageButton(R.drawable.ic_white_edit, R.id.topbar_right_edit_button).setOnClickListener(this); topbarList.addRightImageButton(R.drawable.ic_white_edit, R.id.topbar_right_edit_button).setOnClickListener(this);
...@@ -139,6 +190,10 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im ...@@ -139,6 +190,10 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im
@Override @Override
public boolean onBackPressedSupport() { public boolean onBackPressedSupport() {
if (foodGroupEditAdapter.isShowEdit()) {
foodGroupEditAdapter.setShowEdit();
return true;
}
return super.onBackPressedSupport(); return super.onBackPressedSupport();
} }
...@@ -207,7 +262,10 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im ...@@ -207,7 +262,10 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im
@Override @Override
public void killMyself() { public void killMyself() {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.onBackPressed();
}
} }
@Override @Override
...@@ -231,11 +289,17 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im ...@@ -231,11 +289,17 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im
default: default:
break; break;
} }
start(getFragmentByType(toFragmentType)); startForResult(getFragmentByType(toFragmentType), fragmentType);
} else if (viewId == R.id.topbar_right_edit_button) { } else if (viewId == R.id.topbar_right_edit_button) {
if (foodGroupEditAdapter != null) { if (foodGroupEditAdapter != null) {
foodGroupEditAdapter.setShowEdit(); foodGroupEditAdapter.setShowEdit();
} }
} }
} }
@Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data);
getInfo();
}
} }
...@@ -22,6 +22,8 @@ import com.gingersoft.gsa.cloud.main.R2; ...@@ -22,6 +22,8 @@ import com.gingersoft.gsa.cloud.main.R2;
import com.gingersoft.gsa.cloud.main.di.component.DaggerNewlyAddedComponent; import com.gingersoft.gsa.cloud.main.di.component.DaggerNewlyAddedComponent;
import com.gingersoft.gsa.cloud.main.mvp.contract.NewlyAddedContract; import com.gingersoft.gsa.cloud.main.mvp.contract.NewlyAddedContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.FoodMenuEditBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.FoodMenuEditBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SummaryBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.TimePeriodBean;
import com.gingersoft.gsa.cloud.main.mvp.presenter.NewlyAddedPresenter; import com.gingersoft.gsa.cloud.main.mvp.presenter.NewlyAddedPresenter;
import com.gingersoft.gsa.cloud.main.mvp.ui.activity.menu.ShellActivity; import com.gingersoft.gsa.cloud.main.mvp.ui.activity.menu.ShellActivity;
import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.foodmenu.FoodMenuAdapter; import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.foodmenu.FoodMenuAdapter;
...@@ -34,6 +36,7 @@ import com.qmuiteam.qmui.widget.QMUITopBar; ...@@ -34,6 +36,7 @@ import com.qmuiteam.qmui.widget.QMUITopBar;
import java.util.List; import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick;
import static com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration.VERTICAL_LIST; import static com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration.VERTICAL_LIST;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -51,7 +54,9 @@ import static com.jess.arms.utils.Preconditions.checkNotNull; ...@@ -51,7 +54,9 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================ * ================================================
*/ */
public class NewlyAddedFragment extends BaseFoodMenuFragment<NewlyAddedPresenter> implements NewlyAddedContract.View { public class NewlyAddedFragment extends BaseFoodMenuFragment<NewlyAddedPresenter> implements NewlyAddedContract.View, View.OnClickListener {
public final static String TIME_PERIOD_INFO = "timePeriodInfo";
public final static String SUMMARY_INFO = "summaryInfo";
public static NewlyAddedFragment newInstance(int fragmentType, String title) { public static NewlyAddedFragment newInstance(int fragmentType, String title) {
return newInstance(fragmentType, title, false); return newInstance(fragmentType, title, false);
...@@ -85,6 +90,12 @@ public class NewlyAddedFragment extends BaseFoodMenuFragment<NewlyAddedPresenter ...@@ -85,6 +90,12 @@ public class NewlyAddedFragment extends BaseFoodMenuFragment<NewlyAddedPresenter
RecyclerView rvContent; RecyclerView rvContent;
@BindView(R2.id.btn_save) @BindView(R2.id.btn_save)
QMUIAlphaButton btnSave; QMUIAlphaButton btnSave;
/**
* 是新增還是修改,調用接口不同
*/
private boolean isUpdate = false;
private FoodMenuAdapter foodMenuAdapter;
@Override @Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) { public void setupFragmentComponent(@NonNull AppComponent appComponent) {
...@@ -106,15 +117,24 @@ public class NewlyAddedFragment extends BaseFoodMenuFragment<NewlyAddedPresenter ...@@ -106,15 +117,24 @@ public class NewlyAddedFragment extends BaseFoodMenuFragment<NewlyAddedPresenter
Bundle arguments = getArguments(); Bundle arguments = getArguments();
if (arguments != null) { if (arguments != null) {
fragmentType = arguments.getInt(FRAGMENT_TYPE); fragmentType = arguments.getInt(FRAGMENT_TYPE);
setFragmentResult(fragmentType, null);
title = arguments.getString(TITLE_KEY); title = arguments.getString(TITLE_KEY);
toShellActivity = arguments.getBoolean(TO_SHELL_ACTIVITY); toShellActivity = arguments.getBoolean(TO_SHELL_ACTIVITY);
List<FoodMenuEditBean> foodMenuEditBeans = FoodMenuAdapter.getFoodMenuEditBean(fragmentType);
if (fragmentType == NEW_TIME_PERIOD) {
//新增時段,如果有傳數據,則是編輯時段
TimePeriodBean timePeriodBean = (TimePeriodBean) arguments.getSerializable(TIME_PERIOD_INFO);
loadTimePeriodInfo(foodMenuEditBeans, timePeriodBean);
} else if (fragmentType == NEW_FOOD_TYPE) {
SummaryBean summaryBean = (SummaryBean) arguments.getSerializable(SUMMARY_INFO);
loadSummaryInfo(foodMenuEditBeans, summaryBean);
} }
initTopBar(title); initTopBar(title);
//添加自定义分割线 //添加自定义分割线
rvContent.addItemDecoration(new DividerItemDecoration(mContext, VERTICAL_LIST)); rvContent.addItemDecoration(new DividerItemDecoration(mContext, VERTICAL_LIST));
rvContent.setLayoutManager(new LinearLayoutManager(mContext)); rvContent.setLayoutManager(new LinearLayoutManager(mContext));
FoodMenuAdapter foodMenuAdapter = FoodMenuAdapter.getFoodMenuAdapter(mContext, fragmentType); foodMenuAdapter = FoodMenuAdapter.getFoodMenuAdapter(mContext, foodMenuEditBeans);
foodMenuAdapter.setOnItemClickListener((adapter, view, position) -> { foodMenuAdapter.setOnItemClickListener((adapter, view, position) -> {
if (adapter.getItemViewType(position) == FoodMenuEditBean.EDIT_FOOD_ITEM_SELECT) { if (adapter.getItemViewType(position) == FoodMenuEditBean.EDIT_FOOD_ITEM_SELECT) {
...@@ -149,16 +169,50 @@ public class NewlyAddedFragment extends BaseFoodMenuFragment<NewlyAddedPresenter ...@@ -149,16 +169,50 @@ public class NewlyAddedFragment extends BaseFoodMenuFragment<NewlyAddedPresenter
} }
}); });
rvContent.setAdapter(foodMenuAdapter); rvContent.setAdapter(foodMenuAdapter);
} else {
showMessage("類型錯誤");
killMyself();
}
}
private void loadTimePeriodInfo(List<FoodMenuEditBean> foodMenuEditBeans, TimePeriodBean timePeriodBean) {
if (timePeriodBean != null) {
isUpdate = true;
foodMenuEditBeans.get(0).setTimePeriodBean(timePeriodBean);
foodMenuEditBeans.get(0).setId(timePeriodBean.getId());
foodMenuEditBeans.get(0).setShowValue(timePeriodBean.getPeriodName1());
foodMenuEditBeans.get(1).setShowValue(timePeriodBean.getPeriodName2());
foodMenuEditBeans.get(2).setShowValue(timePeriodBean.getPeriodName3());
foodMenuEditBeans.get(3).setShowValue(timePeriodBean.getBeginDate());
foodMenuEditBeans.get(4).setShowValue(timePeriodBean.getEndDate());
foodMenuEditBeans.get(5).setShowValue(timePeriodBean.getBeginTime());
foodMenuEditBeans.get(6).setShowValue(timePeriodBean.getEndTime());
List<FoodMenuEditBean.ShowClient> checkBoxList = foodMenuEditBeans.get(9).getCheckBoxList();
checkBoxList.get(0).setChecked(timePeriodBean.getDayH() == 1);
checkBoxList.get(1).setChecked(timePeriodBean.getDay1() == 1);
checkBoxList.get(2).setChecked(timePeriodBean.getDay2() == 1);
checkBoxList.get(3).setChecked(timePeriodBean.getDay3() == 1);
checkBoxList.get(4).setChecked(timePeriodBean.getDay4() == 1);
checkBoxList.get(5).setChecked(timePeriodBean.getDay5() == 1);
checkBoxList.get(6).setChecked(timePeriodBean.getDay6() == 1);
checkBoxList.get(7).setChecked(timePeriodBean.getDay7() == 1);
}
}
private void loadSummaryInfo(List<FoodMenuEditBean> foodMenuEditBeans, SummaryBean summaryBean) {
if (summaryBean != null) {
isUpdate = true;
foodMenuEditBeans.get(0).setSummaryBean(summaryBean);
foodMenuEditBeans.get(0).setShowValue(summaryBean.getName());
foodMenuEditBeans.get(1).setShowState(summaryBean.getValid() == 1);
}
} }
public void initTopBar(String title) { public void initTopBar(String title) {
if (TextUtil.isNotEmptyOrNullOrUndefined(title)) { if (TextUtil.isNotEmptyOrNullOrUndefined(title)) {
topbarList.setTitle(title); topbarList.setTitle(title);
topbarList.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener(v -> { topbarList.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener(v -> {
FragmentActivity activity = getActivity(); killMyself();
if (activity != null) {
activity.onBackPressed();
}
}); });
} else { } else {
topbarList.setVisibility(View.GONE); topbarList.setVisibility(View.GONE);
...@@ -235,6 +289,36 @@ public class NewlyAddedFragment extends BaseFoodMenuFragment<NewlyAddedPresenter ...@@ -235,6 +289,36 @@ public class NewlyAddedFragment extends BaseFoodMenuFragment<NewlyAddedPresenter
@Override @Override
public void killMyself() { public void killMyself() {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.onBackPressed();
}
}
@OnClick({R2.id.btn_save})
@Override
public void onClick(View v) {
int viewId = v.getId();
if (viewId == R.id.btn_save) {
mPresenter.saveInfoByType(fragmentType, foodMenuAdapter, isUpdate);
}
}
@Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data);
if(data != null){
List<FoodMenuEditBean> data1 = foodMenuAdapter.getData();
if (requestCode == SELECT_TIME_PERIOD) {
TimePeriodBean timePeriodBean = (TimePeriodBean) data.getSerializable(TIME_PERIOD_INFO);
data1.get(3).setShowValue(timePeriodBean.getPeriodName1());
foodMenuAdapter.notifyItemChanged(3);
} else if(requestCode == SELECT_FOOD_TYPE){
SummaryBean summaryBean = (SummaryBean) data.getSerializable(SUMMARY_INFO);
data1.get(4).setShowValue(summaryBean.getName());
foodMenuAdapter.notifyItemChanged(4);
}
}
} }
} }
...@@ -88,6 +88,11 @@ public class SelectFragment extends BaseFoodMenuFragment<SelectPresenter> implem ...@@ -88,6 +88,11 @@ public class SelectFragment extends BaseFoodMenuFragment<SelectPresenter> implem
} else if (fragmentType == SELECT_EXCLUDE_LIST) { } else if (fragmentType == SELECT_EXCLUDE_LIST) {
itemName = "排除"; itemName = "排除";
} }
rvContent.setLayoutManager(new LinearLayoutManager(mContext)); rvContent.setLayoutManager(new LinearLayoutManager(mContext));
List<String> contents = new ArrayList<>(); List<String> contents = new ArrayList<>();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
......
...@@ -18,8 +18,10 @@ ...@@ -18,8 +18,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="餐檯模式" android:text="餐檯模式"
android:ellipsize="marquee"
android:layout_marginTop="@dimen/dp_8" android:layout_marginTop="@dimen/dp_8"
android:textColor="@color/normal_color" android:textColor="@color/normal_color"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12"
android:singleLine="true" />
</com.qmuiteam.qmui.alpha.QMUIAlphaLinearLayout> </com.qmuiteam.qmui.alpha.QMUIAlphaLinearLayout>
\ No newline at end of file
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_8" android:layout_marginTop="@dimen/dp_8"
android:text="餐檯模式" android:text="餐檯模式"
android:singleLine="true"
android:ellipsize="marquee"
android:textColor="@color/normal_color" android:textColor="@color/normal_color"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
......
...@@ -379,6 +379,10 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis ...@@ -379,6 +379,10 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
printerFinder.startFinder(); printerFinder.startFinder();
} }
public void transmitPrjToPc(PrinterDeviceBean defaultPrint){
}
/** /**
* view轉bitmap * view轉bitmap
* *
......
...@@ -53,6 +53,7 @@ import org.json.JSONException; ...@@ -53,6 +53,7 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
...@@ -66,9 +67,17 @@ import io.reactivex.Observer; ...@@ -66,9 +67,17 @@ import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileOutputStream;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import static com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean.PRINT_IP;
import static com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean.PRINT_LOCAL;
import static com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean.PRINT_PRJ_PC;
import static com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean.PRINT_USB;
/** /**
* 在用戶登錄成功後,打開打印service,每隔3~5秒請求一次。請求到了數據就進行打印邏輯 * 在用戶登錄成功後,打開打印service,每隔3~5秒請求一次。請求到了數據就進行打印邏輯
*/ */
...@@ -480,7 +489,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -480,7 +489,7 @@ public class PrjService extends Service implements ReceiveListener {
* 生成用於打印的prj的Bitmap * 生成用於打印的prj的Bitmap
*/ */
private void generatePrintData(String key, List<PrjBean.DataBean.Bean> beans, PrinterDeviceBean printerDeviceBean) { private void generatePrintData(String key, List<PrjBean.DataBean.Bean> beans, PrinterDeviceBean printerDeviceBean) {
if (isPinPrinter(printerDeviceBean) && printerDeviceBean.getPrinterDeviceType() == 1) { if (isPinPrinter(printerDeviceBean) && printerDeviceBean.getPrinterDeviceType() == PRINT_IP) {
//針式打印機並且打印機類型為IP打印,生成獨特的格式 //針式打印機並且打印機類型為IP打印,生成獨特的格式
List<Map<String, Bitmap>> bitmapMaps = generatePrintMaps(key, beans, printerDeviceBean); List<Map<String, Bitmap>> bitmapMaps = generatePrintMaps(key, beans, printerDeviceBean);
EpsIds = getPrintIds(bitmapMaps); EpsIds = getPrintIds(bitmapMaps);
...@@ -543,27 +552,123 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -543,27 +552,123 @@ public class PrjService extends Service implements ReceiveListener {
} else { } else {
updatePrjFailure(EpsIds); updatePrjFailure(EpsIds);
} }
} else if (printerDeviceBean.getPrinterDeviceType() == PRINT_PRJ_PC) {
} else { } else {
List<Map<String, Bitmap>> bitmapMaps = null; List<Map<String, Bitmap>> bitmapMaps = null;
if (printerDeviceBean.getPrinterDeviceType() == 2 && PrintConstans.PRINT_MODEL_WISEPOS.contains(Build.MODEL)) { if (printerDeviceBean.getPrinterDeviceType() == PRINT_LOCAL && PrintConstans.PRINT_MODEL_WISEPOS.contains(Build.MODEL)) {
//本機打印並且是BBPOS //本機打印並且是BBPOS
} else if (printerDeviceBean.getPrinterDeviceType() == PRINT_PRJ_PC) {
//PRJ模式,生成PRJ文件到共享的電腦上
ThreadPoolManager.getInstence().putExecutableTasks(() -> {
List<PrjBean.DataBean.Bean> noCutList = new ArrayList<>();
List<PrjBean.DataBean.Bean> cutList = new ArrayList<>();
for (PrjBean.DataBean.Bean bean : beans) {
if (bean.getStatus() == 2) {
//需要切紙
cutList.add(bean);
} else { } else {
bitmapMaps = generatePrintMaps(key, beans, printerDeviceBean); //不需要切紙
noCutList.add(bean);
}
}
String rootPath = "smb://" + printerDeviceBean.getPrintPath() + "/";
try {
SmbFile smbFile = new SmbFile(rootPath);
smbFile.connect();
if (smbFile.isDirectory()) {
for (int i = 0; i < cutList.size(); i++) {
String newFilePath = rootPath + System.currentTimeMillis() + ".prj";
SmbFile createFile = new SmbFile(newFilePath);
createFile.createNewFile();
if (createFile.exists()) {
PrintStream ps = new PrintStream(new SmbFileOutputStream(createFile));
// 往文件里写入字符串
String prjInfo = "[printType]ptKitchen\n" +
"[table]4\n" +
"[date]落單時間:11-13 17:48\n" +
"[waiter]n5 收銀員\n" +
"[KP]K2烤爐\n" +
"[PAX]人數:2\n" +
"[line]\n" +
"[food_1]1 包子(主項)\n" +
"[food_1]1 包子(主項)\n" +
"[table2]4\n";
ps.println(prjInfo);
}
}
if (noCutList.size() > 0) {
String newFilePath = rootPath + System.currentTimeMillis() + ".prj";
SmbFile createFile = new SmbFile(newFilePath);
createFile.createNewFile();
if (createFile.exists()) {
PrintStream ps = new PrintStream(new SmbFileOutputStream(createFile));
PrjBean.DataBean.Bean bean = noCutList.get(0);
String tableName = "";
if (TextUtil.isEmptyOrNullOrUndefined(bean.getTableName())) {
if (bean.getOrderType() == 7) {
tableName = "自取";
} else {
tableName = "外賣";
}
} else {
tableName = bean.getTableName();
}
// 往文件里写入字符串
// String prjInfo = "[printType]ptKitchen\n" +
// "[table]4\n" +
// "[date]落單時間:11-13 17:48\n" +
// "[waiter]n5 收銀員\n" +
// "[KP]K2烤爐\n" +
// "[PAX]人數:2\n" +
// "[line]\n" +
// "[food_1]1 包子(主項)\n" +
// "[food_1]1 包子(主項)\n" +
// "[table2]4\n";
String prjInfo = "[printType]ptKitchen\n" +
"[table]" + tableName + "\n" +
"[date]落單時間:11-13 17:48\n" +
"[waiter]n5 收銀員\n" +
"[KP]K2烤爐\n" +
"[PAX]人數:2\n" +
"[line]\n" +
"[food_1]1 包子(主項)\n" +
"[food_1]1 包子(主項)\n" +
"[table2]" + tableName + "\n";
ps.println(prjInfo);
} }
}
} else {
ToastUtils.show(this, "PRJ輸出路徑必須為文件夾");
}
} catch (IOException e) {
e.printStackTrace();
}
});
} else {
bitmapMaps = generatePrintMaps(key, beans, printerDeviceBean);
switch (printerDeviceBean.getPrinterDeviceType()) { switch (printerDeviceBean.getPrinterDeviceType()) {
case 1: case PRINT_IP:
//IP打印 //IP打印
ipPrint(printerDeviceBean, bitmapMaps); ipPrint(printerDeviceBean, bitmapMaps);
break; break;
case 2: case PRINT_LOCAL:
//本地N5或Sunmi打印 //本地N5或Sunmi打印
locationPrint(bitmapMaps); locationPrint(bitmapMaps);
break; break;
case 3: case PRINT_USB:
//USB打印 //USB打印
usbPrint(bitmapMaps); usbPrint(bitmapMaps);
break; break;
default:
break;
}
} }
} }
} }
......
...@@ -256,7 +256,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -256,7 +256,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
List<Bitmap> zoomBitmaps = null; List<Bitmap> zoomBitmaps = null;
String printData = null; String printData = null;
if (defaultPrint.getPrinterDeviceType() == 2 && PrintConstans.PRINT_MODEL_WISEPOS.contains(Build.MODEL)) { if (defaultPrint.getPrinterDeviceType() == PrinterDeviceBean.PRINT_LOCAL && PrintConstans.PRINT_MODEL_WISEPOS.contains(Build.MODEL)) {
//本機打印並且是BBPOS //本機打印並且是BBPOS
printData = printerInIt.getPrintData(mContext, defaultPrint); printData = printerInIt.getPrintData(mContext, defaultPrint);
if (printData == null) { if (printData == null) {
...@@ -279,16 +279,20 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print ...@@ -279,16 +279,20 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
} }
} }
//獲得對應的圖片 //獲得對應的圖片
if (defaultPrint.getPrinterDeviceType() == 1) { if (defaultPrint.getPrinterDeviceType() == PrinterDeviceBean.PRINT_IP) {
//IP打印 //IP打印
printerInIt.ipDevicePrint(defaultPrint, zoomBitmaps); printerInIt.ipDevicePrint(defaultPrint, zoomBitmaps);
} else if (defaultPrint.getPrinterDeviceType() == 2) { } else if (defaultPrint.getPrinterDeviceType() == PrinterDeviceBean.PRINT_LOCAL) {
//本地N5或Sunmi打印 //本地N5或Sunmi打印
printerInIt.locationPrint(zoomBitmaps, printData, this); printerInIt.locationPrint(zoomBitmaps, printData, this);
} else if (defaultPrint.getPrinterDeviceType() == 3) { } else if (defaultPrint.getPrinterDeviceType() == PrinterDeviceBean.PRINT_USB) {
//USB打印打印 //USB打印打印
printerInIt.usbPrint(mContext, zoomBitmaps); printerInIt.usbPrint(mContext, zoomBitmaps);
} else { }
// else if (defaultPrint.getPrinterDeviceType() == 4) {
// printerInIt.transmitPrjToPc(defaultPrint);
// }
else {
printFile("未找到對應的打印類型"); printFile("未找到對應的打印類型");
} }
......
...@@ -3,6 +3,7 @@ package com.joe.print.mvp.ui.activity; ...@@ -3,6 +3,7 @@ package com.joe.print.mvp.ui.activity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
...@@ -20,18 +21,14 @@ import com.joe.print.mvp.print.common.SendCallback; ...@@ -20,18 +21,14 @@ import com.joe.print.mvp.print.common.SendCallback;
import com.joe.print.mvp.print.common.SendResultCode; import com.joe.print.mvp.print.common.SendResultCode;
import com.joe.print.mvp.print.usb.UsbPrinter; import com.joe.print.mvp.print.usb.UsbPrinter;
import java.io.BufferedOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import jcifs.UniAddress;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile; import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileInputStream;
import jcifs.smb.SmbFileOutputStream; import jcifs.smb.SmbFileOutputStream;
import jcifs.smb.SmbSession;
public class PrintTestActivity extends AppCompatActivity implements PrintSocketHolder.OnStateChangedListener, PrintExecutor.OnPrintResultListener, ReceiveListener { public class PrintTestActivity extends AppCompatActivity implements PrintSocketHolder.OnStateChangedListener, PrintExecutor.OnPrintResultListener, ReceiveListener {
...@@ -41,32 +38,21 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH ...@@ -41,32 +38,21 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH
private static int foodAmountSpace = 10; private static int foodAmountSpace = 10;
private static void run() { private static void run() {
//smb://192.168.1.144/KuGou/
String ip = "192.168.1.144"; String ip = "192.168.1.144";
String rootPath = "smb://" + ip + "/KuGou/"; String rootPath = "smb://" + ip + "/KuGou/";
try { try {
UniAddress domain = UniAddress.getByName(ip); SmbFile smbFile = new SmbFile(rootPath);
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(rootPath,
"", "");
SmbSession.logon(domain, auth);
SmbFile smbFile = new SmbFile(rootPath, auth);
smbFile.connect(); smbFile.connect();
if (smbFile.isDirectory()) { if(smbFile.isDirectory()){
String newFilePath = rootPath + System.currentTimeMillis() + ".prj"; String newFilePath = rootPath + System.currentTimeMillis() + ".prj";
SmbFile createFile = new SmbFile(newFilePath, auth); SmbFile createFile = new SmbFile(newFilePath);
createFile.connect();
createFile.createNewFile(); createFile.createNewFile();
if (createFile.exists()) { if(createFile.exists()){
SmbFileInputStream in = new SmbFileInputStream(createFile); PrintStream ps = new PrintStream(new SmbFileOutputStream(createFile));
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new SmbFileOutputStream(createFile, true)); // 往文件里写入字符串
bufferedOutputStream.write("oiasfia按時間肯定很快就愛上檔卡戶時段接口和6556a6d5as65das5das奧術大師大所奧術大師大所".getBytes()); ps.println("阿斯加德垃圾勝利大街阿里");
bufferedOutputStream.close(); }
}
smbFile.delete();
createFile.delete();
} else {
Log.e("eee", "请选择文件夾");
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -77,12 +63,16 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH ...@@ -77,12 +63,16 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_print_test); setContentView(R.layout.activity_print_test);
// System.setProperty("jcifs.smb.client.dfs.disabled", "true"); System.setProperty("jcifs.smb.client.dfs.disabled", "true");
// System.setProperty("jcifs.smb.client.soTimeout", "1000000"); System.setProperty("jcifs.smb.client.soTimeout", "1000000");
// System.setProperty("jcifs.smb.client.responseTimeout", "30000"); System.setProperty("jcifs.smb.client.responseTimeout", "30000");
// 获取跟目录然后获取下面各个盘符 // 获取跟目录然后获取下面各个盘符
new Thread(//smb://192.168.1.144/KuGou/ findViewById(R.id.btn_test).setOnClickListener(new View.OnClickListener() {
PrintTestActivity::run).start(); @Override
public void onClick(View v) {
new Thread(PrintTestActivity::run).start();
}
});
} }
/** /**
......
...@@ -61,6 +61,8 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem ...@@ -61,6 +61,8 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
EditText mEdPrintName; EditText mEdPrintName;
@BindView(R2.id.tv_print_type) @BindView(R2.id.tv_print_type)
TextView tvPrintType; TextView tvPrintType;
@BindView(R2.id.layout_print_path)
LinearLayout prjOutPath;
@BindViews({R2.id.ip_edit_1, R2.id.ip_edit_2, R2.id.ip_edit_3, R2.id.ip_edit_4}) @BindViews({R2.id.ip_edit_1, R2.id.ip_edit_2, R2.id.ip_edit_3, R2.id.ip_edit_4})
EditText[] ipEdits = new EditText[4]; EditText[] ipEdits = new EditText[4];
@BindView(R2.id.add_printer_topbar) @BindView(R2.id.add_printer_topbar)
...@@ -121,7 +123,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem ...@@ -121,7 +123,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
private int modelPosition = -1; private int modelPosition = -1;
private int foodFondSize = 0;//食品字體大小 0為預設 private int foodFondSize = 0;//食品字體大小 0為預設
private int modifierFontSize = 0; //細項字體大小 0為預設 private int modifierFontSize = 0; //細項字體大小 0為預設
private int printType = 1;//打印類型:1:網絡打印,2:本機打印 3:USB打印 4:藍牙打印 private int printType = 1;//打印類型:1:網絡打印,2:本機打印 3:USB打印 4:PRJ模式 5:藍牙打印
private int foodIsBoldPosition = 0;//食品是否加粗 private int foodIsBoldPosition = 0;//食品是否加粗
private int modifierIsBoldPosition = 0;//細項是否加粗 private int modifierIsBoldPosition = 0;//細項是否加粗
private int foodIsItalic = 0;//食品是否斜體 private int foodIsItalic = 0;//食品是否斜體
...@@ -129,7 +131,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem ...@@ -129,7 +131,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
private int flipPosition = 0;//數量大於1是否翻轉 private int flipPosition = 0;//數量大於1是否翻轉
private String[] languageType = new String[]{"1"}; private String[] languageType = new String[]{"1"};
public static List<String> printTypes = Arrays.asList("網路打印", "本機打印", "USB打印"); public static List<String> printTypes = Arrays.asList("網路打印", "本機打印", "USB打印", "PRJ模式");
private List<String> fontSize = Arrays.asList("預設", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"); private List<String> fontSize = Arrays.asList("預設", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30");
private List<String> booleanSelect = Arrays.asList("預設", "是", "否"); private List<String> booleanSelect = Arrays.asList("預設", "是", "否");
private List<String> languageSelect = Arrays.asList("語言一", "語言二", "語言三"); private List<String> languageSelect = Arrays.asList("語言一", "語言二", "語言三");
...@@ -220,6 +222,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem ...@@ -220,6 +222,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
//打印類型,USB,網路 //打印類型,USB,網路
if (printType - 1 >= 0 && printType - 1 < printTypes.size()) { if (printType - 1 >= 0 && printType - 1 < printTypes.size()) {
tvPrintType.setText(printTypes.get(printType - 1)); tvPrintType.setText(printTypes.get(printType - 1));
prjOutPath.setVisibility(printType == 4 ? View.VISIBLE : View.GONE);
} }
//食品和細項字體大小 //食品和細項字體大小
if (foodFondSize > fontSize.size()) { if (foodFondSize > fontSize.size()) {
...@@ -369,6 +372,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem ...@@ -369,6 +372,7 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
printType = i + 1; printType = i + 1;
hideIpPrint(); hideIpPrint();
tvPrintType.setText(printTypes.get(i)); tvPrintType.setText(printTypes.get(i));
prjOutPath.setVisibility(printType == 4 ? View.VISIBLE : View.GONE);
}); });
} }
......
...@@ -26,7 +26,7 @@ public class DialogPrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean ...@@ -26,7 +26,7 @@ public class DialogPrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean
@Override @Override
protected void convert(BaseViewHolder helper, PrinterDeviceBean item) { protected void convert(BaseViewHolder helper, PrinterDeviceBean item) {
helper.setText(R.id.tv_printer_name, item.getName() + ""); helper.setText(R.id.tv_printer_name, item.getName() + "");
if (item.getPrinterDeviceType() == 1) { if (item.getPrinterDeviceType() == PrinterDeviceBean.PRINT_IP) {
helper.setText(R.id.tv_printer_ip, String.format(mContext.getString(R.string.print_ip), item.getIp())); helper.setText(R.id.tv_printer_ip, String.format(mContext.getString(R.string.print_ip), item.getIp()));
} else { } else {
helper.setText(R.id.tv_printer_ip, PrinterAddActivity.printTypes.get(item.getPrinterDeviceType() - 1)); helper.setText(R.id.tv_printer_ip, PrinterAddActivity.printTypes.get(item.getPrinterDeviceType() - 1));
......
...@@ -46,14 +46,13 @@ ...@@ -46,14 +46,13 @@
android:layout_weight="0.7" android:layout_weight="0.7"
android:background="@null" android:background="@null"
android:digits="@string/edit_digits_number_words" android:digits="@string/edit_digits_number_words"
android:gravity="right"
android:hint="請輸入打印機名稱" android:hint="請輸入打印機名稱"
android:maxLength="20" android:maxLength="20"
android:singleLine="true" android:singleLine="true"
android:textColor="@color/normal_color" android:textColor="@color/normal_color"
android:textColorHint="@color/hint_color" android:textColorHint="@color/hint_color"
android:textSize="@dimen/dp_14"> android:textSize="@dimen/dp_14" />
</EditText>
</LinearLayout> </LinearLayout>
<include layout="@layout/include_horizontal_color_ccc_dividing_line" /> <include layout="@layout/include_horizontal_color_ccc_dividing_line" />
...@@ -98,6 +97,38 @@ ...@@ -98,6 +97,38 @@
<include layout="@layout/include_horizontal_color_ccc_dividing_line" /> <include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<LinearLayout <LinearLayout
android:id="@+id/layout_print_path"
style="@style/print_add_printer_input_style"
android:layout_width="match_parent"
android:orientation="horizontal"
android:visibility="gone">
<TextView
style="@style/print_add_title_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="輸出路徑" />
<EditText
android:id="@+id/add_print_path"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_weight="0.7"
android:background="@null"
android:gravity="right"
android:hint="請輸入PRJ文件輸出路徑"
android:inputType="number"
android:maxLength="6"
android:textColor="@color/normal_color"
android:textColorHint="@color/hint_color"
android:textSize="@dimen/dp_14" />
</LinearLayout>
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<LinearLayout
android:id="@+id/layout_ip" android:id="@+id/layout_ip"
style="@style/print_add_printer_input_style" style="@style/print_add_printer_input_style"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -242,6 +273,7 @@ ...@@ -242,6 +273,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_weight="0.7" android:layout_weight="0.7"
android:background="@null" android:background="@null"
android:gravity="right"
android:hint="請輸入端口號,默認9100" android:hint="請輸入端口號,默認9100"
android:inputType="number" android:inputType="number"
android:maxLength="6" android:maxLength="6"
......
...@@ -26,6 +26,6 @@ include 'cc-register', ...@@ -26,6 +26,6 @@ include 'cc-register',
'delivery_pick_module', 'delivery_pick_module',
'tracker', 'tracker',
'coldchain-module', 'coldchain-module',
'order-advance-module' 'order-advance-module',
'supply-chain-module'
/build
\ No newline at end of file
apply from: rootProject.file('cc-settings.gradle')
apply plugin: 'com.jakewharton.butterknife'
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
// 避免 lint 检测出错时停止构建
lintOptions {
abortOnError false
}
defaultConfig {
if (project.ext.runAsApp) {
applicationId "com.gingersoft.supply_chain"
}
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
multiDexEnabled true
//配置注解处理器
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
resourcePrefix "supply_chain"
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
minifyEnabled false
shrinkResources false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
testImplementation rootProject.ext.dependencies["junit"]
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
implementation rootProject.ext.dependencies["BaseRecyclerViewAdapter"]
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.supply_chain">
<application android:networkSecurityConfig="@xml/network_android">
<activity
android:name=".mvp.ui.activity.SupplyChainMainActivity"
android:screenOrientation="portrait" />
<meta-data
android:name="com.gingersoft.gsa.cloud.config.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
<meta-data
android:name="design_width_in_dp"
android:value="360" />
<meta-data
android:name="design_height_in_dp"
android:value="640" />
</application>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.supply_chain">
<uses-permission android:name="android.permission.INTERNET" />
<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" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name="com.gingersoft.gsa.cloud.app.GsaCloudApplication"
android:networkSecurityConfig="@xml/network_android">
<activity android:name="com.gingersoft.supply_chain.mvp.ui.activity.SupplyChainMainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.gingersoft.gsa.cloud.config.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
<meta-data
android:name="design_width_in_dp"
android:value="360" />
<meta-data
android:name="design_height_in_dp"
android:value="640" />
</application>
</manifest>
\ No newline at end of file
package debug;
import com.billy.cc.core.component.CC;
import com.jess.arms.base.BaseApplication;
public class MyApp extends BaseApplication {
@Override
public void onCreate() {
super.onCreate();
CC.enableVerboseLog(true);
CC.enableDebug(true);
CC.enableRemoteCC(true);
}
}
package com.gingersoft.supply_chain;
import android.util.Log;
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.constans.AppConstans;
import com.gingersoft.supply_chain.mvp.ui.activity.SupplyChainMainActivity;
public class ComponentSupplyChain implements IComponent {
@Override
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return AppConstans.SUPPLY_CHAIN_COMPONENT_NAME;
}
/**
* 组件被调用时的入口
* 要确保每个逻辑分支都会调用到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();
Log.e("eee", "調用供應鏈" + actionName);
switch (actionName) {
case AppConstans.SUPPLY_CHAIN_MAIN_ACTION:
CCUtil.navigateTo(cc, SupplyChainMainActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success());
break;
default:
//这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例
//并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...)
//在LocalCCInterceptor中将会返回错误码为-10的CCResult
break;
}
return false;
}
}
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.FunctionListModule;
import com.gingersoft.supply_chain.mvp.contract.FunctionListContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.FunctionListFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 16:15
* <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>
* ================================================
*/
@FragmentScope
@Component(modules = FunctionListModule.class, dependencies = AppComponent.class)
public interface FunctionListComponent {
void inject(FunctionListFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
FunctionListComponent.Builder view(FunctionListContract.View view);
FunctionListComponent.Builder appComponent(AppComponent appComponent);
FunctionListComponent build();
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.NewSupplierModule;
import com.gingersoft.supply_chain.mvp.contract.NewSupplierContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.NewSupplierFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 18:33
* <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>
* ================================================
*/
@FragmentScope
@Component(modules = NewSupplierModule.class, dependencies = AppComponent.class)
public interface NewSupplierComponent {
void inject(NewSupplierFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
NewSupplierComponent.Builder view(NewSupplierContract.View view);
NewSupplierComponent.Builder appComponent(AppComponent appComponent);
NewSupplierComponent build();
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.SupplierListModule;
import com.gingersoft.supply_chain.mvp.contract.SupplierListContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.SupplierListFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 17:41
* <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>
* ================================================
*/
@FragmentScope
@Component(modules = SupplierListModule.class, dependencies = AppComponent.class)
public interface SupplierListComponent {
void inject(SupplierListFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
SupplierListComponent.Builder view(SupplierListContract.View view);
SupplierListComponent.Builder appComponent(AppComponent appComponent);
SupplierListComponent build();
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.SupplyChainMainModule;
import com.gingersoft.supply_chain.mvp.contract.SupplyChainMainContract;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.supply_chain.mvp.ui.activity.SupplyChainMainActivity;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 14:45
* <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 = SupplyChainMainModule.class, dependencies = AppComponent.class)
public interface SupplyChainMainComponent {
void inject(SupplyChainMainActivity activity);
@Component.Builder
interface Builder {
@BindsInstance
SupplyChainMainComponent.Builder view(SupplyChainMainContract.View view);
SupplyChainMainComponent.Builder appComponent(AppComponent appComponent);
SupplyChainMainComponent build();
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.FunctionListContract;
import com.gingersoft.supply_chain.mvp.model.FunctionListModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 16:15
* <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 FunctionListModule {
@Binds
abstract FunctionListContract.Model bindFunctionListModel(FunctionListModel model);
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.NewSupplierContract;
import com.gingersoft.supply_chain.mvp.model.NewSupplierModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 18:33
* <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 NewSupplierModule {
@Binds
abstract NewSupplierContract.Model bindNewSupplierModel(NewSupplierModel model);
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.SupplierListContract;
import com.gingersoft.supply_chain.mvp.model.SupplierListModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 17:41
* <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 SupplierListModule {
@Binds
abstract SupplierListContract.Model bindSupplierListModel(SupplierListModel model);
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.SupplyChainMainContract;
import com.gingersoft.supply_chain.mvp.model.SupplyChainMainModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 14:45
* <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 SupplyChainMainModule {
@Binds
abstract SupplyChainMainContract.Model bindSupplyChainMainModel(SupplyChainMainModel model);
}
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.bean;
import com.gingersoft.gsa.cloud.database.bean.Function;
import java.util.List;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2020/11/19
* Time: 16:32
* Use:
*/
@Data
public class PurchaseFunctionBean {
private String functionName;
private List<Function> childFunction;
public PurchaseFunctionBean(String functionName, List<Function> childFunction) {
this.functionName = functionName;
this.childFunction = childFunction;
}
}
package com.gingersoft.supply_chain.mvp.bean;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2020/11/19
* Time: 18:01
* Use: 供應商信息
*/
@Data
public class SupplierInfoBean {
private String name;
private String address;
private String phone;
private String contacts;
private String createDate;
public SupplierInfoBean(String name, String address, String phone, String contacts, String createDate) {
this.name = name;
this.address = address;
this.phone = phone;
this.contacts = contacts;
this.createDate = createDate;
}
}
package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 16:16
* <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 BaseSupplyChainContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 16:15
* <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 FunctionListContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 18:33
* <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 NewSupplierContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 17:41
* <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 SupplierListContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 14:45
* <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 SupplyChainMainContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.supply_chain.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.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.BaseSupplyChainContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 16:16
* <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>
* ================================================
*/
@FragmentScope
public class BaseSupplyChainModel extends BaseModel implements BaseSupplyChainContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public BaseSupplyChainModel(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.supply_chain.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.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.FunctionListContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 16:15
* <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>
* ================================================
*/
@FragmentScope
public class FunctionListModel extends BaseModel implements FunctionListContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public FunctionListModel(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.supply_chain.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.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.NewSupplierContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 18:33
* <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>
* ================================================
*/
@FragmentScope
public class NewSupplierModel extends BaseModel implements NewSupplierContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public NewSupplierModel(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.supply_chain.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.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.SupplierListContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 17:41
* <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>
* ================================================
*/
@FragmentScope
public class SupplierListModel extends BaseModel implements SupplierListContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public SupplierListModel(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.supply_chain.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.supply_chain.mvp.contract.SupplyChainMainContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 14:45
* <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 SupplyChainMainModel extends BaseModel implements SupplyChainMainContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public SupplyChainMainModel(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.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.contract.BaseSupplyChainContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 16:16
* <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>
* ================================================
*/
@FragmentScope
public class BaseSupplyChainPresenter extends BasePresenter<BaseSupplyChainContract.Model, BaseSupplyChainContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public BaseSupplyChainPresenter(BaseSupplyChainContract.Model model, BaseSupplyChainContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.contract.FunctionListContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 16:15
* <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>
* ================================================
*/
@FragmentScope
public class FunctionListPresenter extends BasePresenter<FunctionListContract.Model, FunctionListContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public FunctionListPresenter(FunctionListContract.Model model, FunctionListContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.contract.NewSupplierContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 18:33
* <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>
* ================================================
*/
@FragmentScope
public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Model, NewSupplierContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public NewSupplierPresenter(NewSupplierContract.Model model, NewSupplierContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.contract.SupplierListContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 17:41
* <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>
* ================================================
*/
@FragmentScope
public class SupplierListPresenter extends BasePresenter<SupplierListContract.Model, SupplierListContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public SupplierListPresenter(SupplierListContract.Model model, SupplierListContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.contract.SupplyChainMainContract;
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 javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 14:45
* <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 SupplyChainMainPresenter extends BasePresenter<SupplyChainMainContract.Model, SupplyChainMainContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public SupplyChainMainPresenter(SupplyChainMainContract.Model model, SupplyChainMainContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
package com.gingersoft.supply_chain.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.di.component.DaggerSupplyChainMainComponent;
import com.gingersoft.supply_chain.mvp.contract.SupplyChainMainContract;
import com.gingersoft.supply_chain.mvp.presenter.SupplyChainMainPresenter;
import com.gingersoft.supply_chain.mvp.ui.fragment.FunctionListFragment;
import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 14:45
* <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 SupplyChainMainActivity extends BaseFragmentActivity<SupplyChainMainPresenter> implements SupplyChainMainContract.View {
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerSupplyChainMainComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_supply_chain_main;
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
loadRootFragment(R.id.layout_supply_chain_content, FunctionListFragment.newInstance());
}
@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) {
ArmsUtils.makeText(this, message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
}
package com.gingersoft.supply_chain.mvp.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.supply_chain.R;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2020/11/19
* Time: 16:42
* Use:
*/
public class FunctionChildAdapter extends BaseQuickAdapter<Function, BaseViewHolder> {
public FunctionChildAdapter(@Nullable List<Function> data) {
super(R.layout.main_function_child_list_item, data);
}
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, Function function) {
baseViewHolder.setImageResource(R.id.iv_function_child, function.getIcRes());
baseViewHolder.setText(R.id.tv_function_child, function.getResName());
}
}
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFunctionBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2020/11/19
* Time: 16:28
* Use:
*/
public class PurchaseFunctionAdapter extends BaseQuickAdapter<PurchaseFunctionBean, BaseViewHolder> {
private Context mContext;
private OnItemClickListener onItemClickListener;
public PurchaseFunctionAdapter(Context context, @Nullable List<PurchaseFunctionBean> data) {
super(R.layout.main_function_item, data);
this.mContext = context;
}
public void setFunctionClickListener(OnItemClickListener onItemClickListener){
this.onItemClickListener = onItemClickListener;
}
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, PurchaseFunctionBean purchaseFunctionBean) {
baseViewHolder.setText(R.id.tv_purchase_function_name, purchaseFunctionBean.getFunctionName());
RecyclerView mRvFunctionList = baseViewHolder.getView(R.id.rv_purchase_function_list_child_list);
mRvFunctionList.setLayoutManager(new GridLayoutManager(mContext, 4));
FunctionChildAdapter functionChildAdapter = new FunctionChildAdapter(purchaseFunctionBean.getChildFunction());
functionChildAdapter.setOnItemClickListener((adapter, view, position) -> {
if(onItemClickListener != null){
onItemClickListener.onItemClick(adapter, view, position);
}
});
mRvFunctionList.setAdapter(functionChildAdapter);
}
}
package com.gingersoft.supply_chain.mvp.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2020/11/19
* Time: 18:01
* Use:
*/
public class SupplierAdapter extends BaseQuickAdapter<SupplierInfoBean, BaseViewHolder> {
public SupplierAdapter(@Nullable List<SupplierInfoBean> data) {
super(R.layout.item_supplier, data);
addChildClickViewIds(R.id.iv_supplier_delete);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, SupplierInfoBean supplierInfoBean) {
viewHolder.setText(R.id.tv_supplier_name, supplierInfoBean.getName());
viewHolder.setText(R.id.tv_supplier_address, supplierInfoBean.getAddress());
viewHolder.setText(R.id.tv_supplier_phone, supplierInfoBean.getPhone());
viewHolder.setText(R.id.tv_supplier_contact, supplierInfoBean.getContacts());
viewHolder.setText(R.id.tv_supplier_create_date, supplierInfoBean.getCreateDate());
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.gingersoft.supply_chain.mvp.contract.BaseSupplyChainContract;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.mvp.IPresenter;
import com.jess.arms.utils.ArmsUtils;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 16:16
* <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 abstract class BaseSupplyChainFragment<P extends IPresenter> extends BaseFragment<P> implements BaseSupplyChainContract.View {
/**
* 通过此方法可以使 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
public void setData(@Nullable Object data) {
}
@Override
public void showLoading(String message) {
}
@Override
public void hideLoading() {
}
@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() {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.onBackPressed();
}
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.di.component.DaggerFunctionListComponent;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFunctionBean;
import com.gingersoft.supply_chain.mvp.contract.FunctionListContract;
import com.gingersoft.supply_chain.mvp.presenter.FunctionListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.FunctionChildAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseFunctionAdapter;
import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.widget.QMUITopBar;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 16:15
* <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 FunctionListFragment extends BaseSupplyChainFragment<FunctionListPresenter> implements FunctionListContract.View {
@BindView(R.id.topbar_supply_chain)
QMUITopBar mTopBar;
@BindView(R.id.rv_supply_chain_function_list)
RecyclerView rvSupplyChainFunctionList;
public static FunctionListFragment newInstance() {
FunctionListFragment fragment = new FunctionListFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerFunctionListComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_function_list, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
initTopBar();
List<PurchaseFunctionBean> purchaseFunctionBeans = new ArrayList<>();
List<Function> basicManagementFunction = new ArrayList<>();
basicManagementFunction.add(new Function("供應商", R.drawable.ic_supplier));
basicManagementFunction.add(new Function("食材", R.drawable.ic_food_ingredients));
basicManagementFunction.add(new Function("種類", R.drawable.ic_type));
basicManagementFunction.add(new Function("包裝", R.drawable.ic_packing));
purchaseFunctionBeans.add(new PurchaseFunctionBean("基礎管理", basicManagementFunction));
List<Function> orderManger = new ArrayList<>();
orderManger.add(new Function("採購訂單", R.drawable.ic_purchase_order));
purchaseFunctionBeans.add(new PurchaseFunctionBean("訂單管理", orderManger));
PurchaseFunctionAdapter purchaseFunctionAdapter = new PurchaseFunctionAdapter(mContext, purchaseFunctionBeans);
purchaseFunctionAdapter.setFunctionClickListener(new OnItemClickListener() {
@Override
public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
FunctionChildAdapter functionChildAdapter = (FunctionChildAdapter) adapter;
List<Function> data = functionChildAdapter.getData();
if(data.get(position).getResName().equals("供應商")){
start(SupplierListFragment.newInstance());
}
}
});
rvSupplyChainFunctionList.setAdapter(purchaseFunctionAdapter);
}
private void initTopBar() {
mTopBar.setTitle("採購");
mTopBar.addLeftBackImageButton().setOnClickListener(v -> killMyself());
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.di.component.DaggerNewSupplierComponent;
import com.gingersoft.supply_chain.mvp.contract.NewSupplierContract;
import com.gingersoft.supply_chain.mvp.presenter.NewSupplierPresenter;
import com.jess.arms.di.component.AppComponent;
/**
* ================================================
* Description:新增或編輯供應商
* <p>
* Created by MVPArmsTemplate on 11/19/2020 18:33
* <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 NewSupplierFragment extends BaseSupplyChainFragment<NewSupplierPresenter> implements NewSupplierContract.View {
public static NewSupplierFragment newInstance() {
NewSupplierFragment fragment = new NewSupplierFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerNewSupplierComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_new_supplier, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.di.component.DaggerSupplierListComponent;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.contract.SupplierListContract;
import com.gingersoft.supply_chain.mvp.presenter.SupplierListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SupplierAdapter;
import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.widget.QMUITopBar;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 11/19/2020 17:41
* <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 SupplierListFragment extends BaseSupplyChainFragment<SupplierListPresenter> implements SupplierListContract.View, View.OnClickListener {
@BindView(R.id.topbar_supplier_list)
QMUITopBar mTopBarSupplierList;
@BindView(R.id.rv_supplier_list)
RecyclerView rvSupplierList;
@BindView(R.id.btn_new_supplier)
QMUIAlphaButton btnNewSupplier;
public final static int SUPPLIER_LIST = 101;
public static SupplierListFragment newInstance() {
SupplierListFragment fragment = new SupplierListFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerSupplierListComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_supplier_list, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
initTopBar();
List<SupplierInfoBean> supplierInfoBeans = new ArrayList<>();
supplierInfoBeans.add(new SupplierInfoBean("海鮮天地", "香港長沙灣青山道479A麗昌大廈", "23719831", "李先生", "2020-11-19"));
supplierInfoBeans.add(new SupplierInfoBean("海鮮天地", "香港長沙灣青山道479A麗昌大廈", "23719831", "李先生", "2020-11-19"));
supplierInfoBeans.add(new SupplierInfoBean("海鮮天地", "香港長沙灣青山道479A麗昌大廈", "23719831", "李先生", "2020-11-19"));
SupplierAdapter supplierAdapter = new SupplierAdapter(supplierInfoBeans);
rvSupplierList.setAdapter(supplierAdapter);
supplierAdapter.setOnItemClickListener((adapter, view, position) -> startForResult(NewSupplierFragment.newInstance(), SUPPLIER_LIST));
supplierAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_supplier_delete) {
new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> {
dialog.dismiss();
supplierAdapter.removeAt(position);
});
}
});
}
private void initTopBar() {
mTopBarSupplierList.setTitle("供應商");
mTopBarSupplierList.addLeftBackImageButton().setOnClickListener(v -> killMyself());
mTopBarSupplierList.addRightImageButton(R.drawable.ic_screen, R.id.topbar_right_screen_button).setOnClickListener(this);
}
@OnClick({R.id.btn_new_supplier})
@Override
public void onClick(View v) {
int viewId = v.getId();
if (viewId == R.id.topbar_right_screen_button) {
//篩選
} else if (viewId == R.id.btn_new_supplier) {
//新增供應商
startForResult(NewSupplierFragment.newInstance(), SUPPLIER_LIST);
}
}
@Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data);
if (requestCode == SUPPLIER_LIST) {
//新增或編輯了供應商,重新獲取所有供應商數據
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_supply_chain_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
\ No newline at end of file
<?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:background="@color/supply_chain_bg_color"
android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/topbar_supply_chain"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:background="@color/theme_color"
android:fitsSystemWindows="true"
app:qmui_topbar_title_color="@color/theme_white_color" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_supply_chain_function_list"
android:layout_width="match_parent"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>
\ No newline at end of file
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/supply_chain_bg_color"
android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/topbar_supplier_info"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:background="@color/theme_color"
android:fitsSystemWindows="true"
app:qmui_topbar_title_color="@color/theme_white_color" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/new_supplier_info_item_marginLeft"
android:layout_marginTop="@dimen/new_supplier_info_item_marginTop"
android:layout_marginBottom="@dimen/new_supplier_info_item_marginBottom"
android:text="基本信息"
android:textColor="@color/black"
android:textSize="@dimen/dp_14" />
</LinearLayout>
\ No newline at end of file
<?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:background="@color/supply_chain_bg_color"
android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/topbar_supplier_list"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:background="@color/theme_color"
android:fitsSystemWindows="true"
app:qmui_topbar_title_color="@color/theme_white_color" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/dp_10">
<LinearLayout
android:id="@+id/layout_supplier_search"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dp_10"
android:src="@drawable/ic_search" />
<EditText
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:layout_weight="1"
android:background="@null"
android:hint="搜索供應商"
android:textColor="@color/theme_333_color"
android:textColorHint="@color/hint_color"
android:textSize="@dimen/dp_16" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_1"
android:layout_marginBottom="@dimen/dp_1"
android:background="@drawable/shape_app_btn"
android:text="搜索"
android:textColor="@color/white"
android:textSize="@dimen/dp_14" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_supplier_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/btn_new_supplier"
android:layout_below="@id/layout_supplier_search"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_new_supplier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/shape_app_btn"
android:gravity="center"
android:text="+新增供應商"
android:textColor="@color/white"
android:textSize="@dimen/dp_16" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_marginLeft="@dimen/dp_8"
android:layout_marginRight="@dimen/dp_8"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="供應商:"
android:textColor="@color/black"
android:textSize="@dimen/dp_14"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_supplier_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="海鮮天地"
android:textColor="@color/black"
android:textSize="@dimen/dp_14"
android:textStyle="bold" />
<ImageView
android:id="@+id/iv_supplier_edit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/dp_10"
android:src="@drawable/ic_blue_edit" />
<ImageView
android:id="@+id/iv_supplier_delete"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/dp_10"
android:src="@drawable/ic_red_delete" />
</LinearLayout>
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:orientation="horizontal">
<TextView
style="@style/Supplier_Info_text_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="地 址:" />
<TextView
android:id="@+id/tv_supplier_address"
style="@style/Supplier_Info_text_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="香港長沙灣青山道479A麗昌大廈" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:orientation="horizontal">
<TextView
style="@style/Supplier_Info_text_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="聯繫方式:" />
<TextView
android:id="@+id/tv_supplier_phone"
style="@style/Supplier_Info_text_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
tools:text="12893798276" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:orientation="horizontal">
<TextView
style="@style/Supplier_Info_text_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="聯繫人:" />
<TextView
android:id="@+id/tv_supplier_contact"
style="@style/Supplier_Info_text_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
tools:text="雷鋒" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:orientation="horizontal">
<TextView
style="@style/Supplier_Info_text_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="添加日期:" />
<TextView
android:id="@+id/tv_supplier_create_date"
style="@style/Supplier_Info_text_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
tools:text="2020-11-19" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:id="@+id/iv_function_child"
android:layout_width="@dimen/dp_25"
android:layout_height="@dimen/dp_25"
android:src="@drawable/ic_supplier" />
<TextView
android:id="@+id/tv_function_child"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:text="供應商"
android:textColor="@color/supply_function_color"
android:textSize="@dimen/dp_12" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="vertical">
<TextView
android:id="@+id/tv_purchase_function_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:text="基礎管理"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_16"
android:textStyle="bold" />
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_purchase_function_list_child_list"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
android:layout_height="wrap_content" />
</LinearLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
\ No newline at end of file
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