Commit 268b6d27 by Wyh

1、替換了彈窗實現 2、報表的時間問題 3、外送訂單報表數據不顯示的BUG

parent 3586c6d6
......@@ -489,9 +489,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
mPresenter.updateRestOpenStatus(state, restaurantId);
} else {
//提示補單
new AppDialog().showWaringDialog(this, "是否暫停接單?", (view, dialog) -> {
mPresenter.updateRestOpenStatus(state, restaurantId);
});
AppDialog.getInstance().showWaringDialog(this, "是否暫停接單?", () -> mPresenter.updateRestOpenStatus(state, restaurantId));
}
restaurantPopup.dismiss();
}
......@@ -501,9 +499,7 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
mPresenter.pickUp(restaurantId);
} else {
//提示補單
new AppDialog().showWaringDialog(this, "不滿足送貨條件,是否需要補單?", (view, dialog) -> {
jumpSupplementOrder(bean);
});
AppDialog.getInstance().showTipDialog(this, "不滿足送貨條件,是否需要補單?", () -> jumpSupplementOrder(bean));
}
}
......
......@@ -345,7 +345,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
});
} else if (realBtnBeans.get(position).getType() == BtnBuilder.CancelBtn) {
//取消訂單
new AppDialog().showWaringDialog(this, "確認取消訂單?", (v, dialog) -> {
AppDialog.getInstance().showWaringDialog(this, "確認取消訂單?", () -> {
if (bean.isDelete() == 0) {
mPresenter.cancelOrderAndLogistics(orderId);
} else {
......@@ -354,9 +354,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
});
} else if (realBtnBeans.get(position).getType() == BtnBuilder.LogisticsBtn) {
//取消物流
new AppDialog().showWaringDialog(this, "確認取消物流?", (v, dialog) -> {
mPresenter.cancelLogistics(bean.getID(), false);
});
AppDialog.getInstance().showWaringDialog(this, "確認取消物流?", () -> mPresenter.cancelLogistics(bean.getID(), false));
} else if (realBtnBeans.get(position).getType() == BtnBuilder.PrintBtn) {
//打印
requestPermissions((allGranted, grantedList, deniedList) -> {
......
......@@ -213,9 +213,7 @@ public class PrjQueryActivity extends BaseActivity<PrjQueryPresenter> implements
List<PrjBean> prjData = prjQueryBean.getData();
if (prjData.get(position).getPrinterType() == 3) {
//已打印的,提示是否重新打印
new AppDialog().showWaringDialog(mContext, "食品已打印,確認重印?", (view1, dialog) -> {
organizeData(position, prjData);
});
AppDialog.getInstance().showTipDialog(mContext, "食品已打印,確認重印?", () -> organizeData(position, prjData));
} else {
organizeData(position, prjData);
}
......
......@@ -371,18 +371,9 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
pageViewModel.updateRestOpenStatus(state)
} else {
//暫停接單,彈窗向用戶確認是否關閉
object : DialogUtils(this, R.layout.other_order_pause_orders) {
override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
it.isClickable = false
pageViewModel.updateRestOpenStatus(state)
dialog.dismiss()
}
hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
dialog.dismiss()
}
}
}.show()
AppDialog.getInstance().showWaringDialog(this, "是否暫停接單?") {
pageViewModel.updateRestOpenStatus(state)
}
}
restaurantPopup?.dismiss()
}
......@@ -396,7 +387,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
val notification: NotificationManagerCompat = NotificationManagerCompat.from(this)
if (!notification.areNotificationsEnabled()) {
//未開啟通知權限
AppDialog().showTipDialog(this, "檢測到通知權限未打開,建議打開,否則會影響正常使用!") { ->
AppDialog().showTipDialog(this, "檢測到通知權限未打開,建議打開,否則會影響正常使用!") {
val intent = Intent()
when {
SDK_INT >= Build.VERSION_CODES.O -> {
......@@ -464,7 +455,7 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
//查詢預約單和即時單數量
pageViewModel.getOrderStatistics(fragmentStatus[view_pager.currentItem])
}
} else if(type == 1){
} else if (type == 1) {
//長連接登陸成功,也刷新一下列表
getCurrentPageOrderList()
}
......
......@@ -51,13 +51,10 @@ import com.gingersoft.gsa.delivery_pick_mode.ui.base.BaseActivity
import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil
import com.gingersoft.gsa.delivery_pick_mode.util.getCustomColor
import com.gingersoft.gsa.delivery_pick_mode.util.showSelectDialog
import com.gingersoft.gsa.delivery_pick_mode.util.showWaringDialog
import com.jess.arms.mvp.IPresenter
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.interfaces.OnSelectListener
import com.qmuiteam.qmui.widget.QMUITopBar
import kotlinx.android.synthetic.main.activity_order_details.*
import kotlinx.android.synthetic.main.activity_other_order.*
import java.util.*
class OrderDetailsActivity : BaseActivity<IPresenter>() {
......@@ -667,11 +664,10 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
}
private fun PageViewModel.showIsUpdateTransportation(it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean, isPrint: Boolean) {
showWaringDialog("金額範圍和對應的運輸工具不符,是否修改運輸工具", { dialog ->
AppDialog.getInstance().showTipDialog(mContext,"金額範圍和對應的運輸工具不符,是否修改運輸工具", { ->
//要修改運輸工具,彈出彈窗讓用戶選擇
showSelectTransportation(it, orderDetails, isPrint)
dialog.dismiss()
}, { dialog ->
}, { ->
//不修改運輸工具,使用默認的
for (value in it) {
if (value.status == 1) {
......@@ -679,7 +675,6 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
break
}
}
dialog.dismiss()
})
}
......@@ -800,8 +795,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
* 是否確認取消訂單
*/
private fun PageViewModel.isSureCancelOrder(orderDetails: OrderDetails.DataBean, reasonId: String, reasonDesc: String) {
showWaringDialog("是否確認取消訂單?", { dialog ->
dialog.dismiss()
AppDialog.getInstance().showWaringDialog(mContext,"是否確認取消訂單?") { ->
showLoading()
if (orderDetails.isDelete == 0) {
//是第三方物流單,先取消物流,再取消訂單
......@@ -828,9 +822,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
}
}
}
}, {
it.dismiss()
})
}
}
/**
......@@ -858,7 +850,7 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
* 是否確認取消物流
*/
private fun PageViewModel.confirmCancelLogistics(orderId: String, reasonId: String, reasonDesc: String) {
AppDialog().showWaringDialog(this@OrderDetailsActivity, "是否確認取消第三方派送?") { _, _ ->
AppDialog.getInstance().showWaringDialog(this@OrderDetailsActivity, "是否確認取消第三方派送?") { ->
showLoading()
cancelLogistics(restaurantId, orderId, reasonId, reasonDesc) {
cancelDialogForLoading()
......
package com.gingersoft.gsa.delivery_pick_mode.ui.activity
import android.app.Dialog
import android.os.Bundle
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
......@@ -14,7 +12,7 @@ import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.pay.bean.PayMethod
import com.gingersoft.gsa.cloud.ui.utils.DialogUtils
import com.gingersoft.gsa.cloud.ui.utils.AppDialog
import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.BillBean
import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel
......@@ -67,7 +65,7 @@ class PayActivity : BaseActivity<IPresenter>() {
}
other_pay_view.loadInfo(this, ArrayList<PayMethod>(), totalAmount, foodCount)
pageViewModel.getPayMethod(RestaurantInfoManager.newInstance().getBrandId(), RestaurantInfoManager.newInstance().getRestaurantId())
pageViewModel.getPayMethod(RestaurantInfoManager.newInstance().brandId, RestaurantInfoManager.newInstance().restaurantId)
pageViewModel.payTypeBean.observe(this, Observer {
//獲取支付方式
// other_pay_view.loadInfo(this, PayTypeInfo.getPayMethodByPayType(it), MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount), foodCount)
......@@ -80,33 +78,19 @@ class PayActivity : BaseActivity<IPresenter>() {
other_pay_view.setmOnSureClickLisenter { payMethods ->
//確認結賬,調用結賬接口
object : DialogUtils(this, R.layout.other_order_pause_orders) {
override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
hepler.setText(R.id.tv_warning_title, "是否確認結賬?")
hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
dialog.dismiss()
showLoading()
if (OrderDetails.verificationAmount(orderDetails)) {
ToastUtils.show(this@PayActivity, verifiAmountTip)
return@setOnClickListener
}
pageViewModel.closingBill(orderDetails, payMethods) { _, _ ->
cancelDialogForLoading()
setResult(RESULT_OK)
finish()
AppDialog.getInstance().showTipDialog(this, "是否確認結賬?") {
showLoading()
if (OrderDetails.verificationAmount(orderDetails)) {
ToastUtils.show(this@PayActivity, verifiAmountTip)
return@showTipDialog
}
pageViewModel.closingBill(orderDetails, payMethods) { _, _ ->
cancelDialogForLoading()
setResult(RESULT_OK)
finish()
}
// pageViewModel.gsUpdateOrderStatus(orderDetails, payMethods[0].id, payMethods[0].name) { _, _ ->
// cancelDialogForLoading()
// setResult(RESULT_OK)
// finish()
// }
}
hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
dialog.dismiss()
}
}
}.show()
}
}
......
......@@ -57,11 +57,10 @@ class DeliveryFragment : BaseFragment() {
deliveryListAdapter!!.setOnItemChildClickListener { _, view, position ->
when (view.id) {
R.id.iv_delete -> {
AppDialog().showWaringDialog(context, "是否確認刪除") { _, dialog ->
AppDialog.getInstance().showWaringDialog(context, "是否確認刪除") { ->
showLoading()
it.data.list[position].apply {
viewModel.updateDeliveryConfig(distributionFeeMin.toString(), distributionFeeMax.toString(), distributionFee.toString(), deliveryCost.toString(), distributionType, type, desc, id, RestaurantInfoManager.newInstance().getRestaurantId(), UserContext.newInstance().getMemberId(), lackPrice.toString(), 1) {
dialog.dismiss()
viewModel.updateDeliveryConfig(distributionFeeMin.toString(), distributionFeeMax.toString(), distributionFee.toString(), deliveryCost.toString(), distributionType, type, desc, id, RestaurantInfoManager.newInstance().restaurantId, UserContext.newInstance().memberId, lackPrice.toString(), 1) {
cancelDialogForLoading()
}
}
......
......@@ -18,20 +18,6 @@ fun View.setState(state: Boolean) {
}
}
fun Activity.showWaringDialog(title: String, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit) {
AppDialog().showWaringDialog(this, title) { view, dialog ->
when (view.id) {
R.id.tv_dialog_confirm -> {
confirm.invoke(dialog)
}
R.id.tv_dialog_cancel -> {
cancel.invoke(dialog)
}
}
}
}
fun Activity.showSelectDialog(title: String, spanCount: Int, adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit) {
AppDialog().showSelectDialog(this, title, spanCount, adapter) { view, dialog ->
when (view.id) {
......
......@@ -164,10 +164,7 @@ public class EditFoodFragment extends BaseFoodMenuFragment<EditFoodPresenter> im
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();
});
AppDialog.getInstance().showWaringDialog(mContext, "是否確認刪除?", () -> mPresenter.deleteInfoById(fragmentType, id, position));
} else if (viewId == R.id.iv_food_group_edit) {
startForResult(toFragment, fragmentType);
}
......
......@@ -260,7 +260,7 @@ public class IpPrintListActivityFragment extends BaseFragment<IpPrintListActivit
printListAdapter = new PrinterListAdapter(devicess, mContext);
printListAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.layout_delete) {
new AppDialog().showWaringDialog(mContext, "是否刪除打印機", (view1, dialog) -> {
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除打印機", () -> {
//調用刪除接口
mPresenter.deletePrinter(devicess.get(position).getId() + "");
devicess.remove(position);
......
......@@ -179,7 +179,7 @@ public class LocalPrintFragment extends BaseFragment<LocalPrintPresenter> implem
int finalI1 = i;
view.findViewById(R.id.iv_currency_print_delete).setOnClickListener(v -> {
//刪除
new AppDialog().showWaringDialog(mContext, "是否確認刪除", (view1, dialog) -> {
AppDialog.getInstance().showWaringDialog(mContext, "是否確認刪除", () -> {
//調用刪除接口
if (finalI1 < printCurrencyBeans.size()) {
printCurrencyBeans.get(finalI1).setDeletes(1);
......
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.WarehousingOrderDetailsModule;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderDetailsContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderDetailsFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/29/2021 15:05
* <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 = WarehousingOrderDetailsModule.class, dependencies = AppComponent.class)
public interface WarehousingOrderDetailsComponent {
void inject(WarehousingOrderDetailsFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
WarehousingOrderDetailsComponent.Builder view(WarehousingOrderDetailsContract.View view);
WarehousingOrderDetailsComponent.Builder appComponent(AppComponent appComponent);
WarehousingOrderDetailsComponent 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.WarehousingOrderDetailsContract;
import com.gingersoft.supply_chain.mvp.model.WarehousingOrderDetailsModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/29/2021 15:05
* <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 WarehousingOrderDetailsModule {
@Binds
abstract WarehousingOrderDetailsContract.Model bindWarehousingOrderDetailsModel(WarehousingOrderDetailsModel model);
}
\ No newline at end of file
......@@ -227,4 +227,6 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas
public int hashCode() {
return Objects.hash(supplierName, images, foodNo, name, unitPrice, foodCategoryName, remarks, quantityStarts, quantityEnd, packingDescription, basicUnitName, foodCategoryId, supplierId, inventoryAlarm, inventoryWarningId, reviews, minimumInventory, shelfLife, warningDays, foodMarkSn, foodUnits);
}
}
......@@ -15,4 +15,15 @@ public class WarehouseOrderBean {
public int warehousingSpecies;
public String warehousingReason;
public WarehouseOrderBean() {
}
public WarehouseOrderBean(String orderNo, String warehousingMember, String warehousingTime, String warehousingFoodName, int warehousingSpecies, String warehousingReason) {
this.orderNo = orderNo;
this.warehousingMember = warehousingMember;
this.warehousingTime = warehousingTime;
this.warehousingFoodName = warehousingFoodName;
this.warehousingSpecies = warehousingSpecies;
this.warehousingReason = warehousingReason;
}
}
package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.supply_chain.mvp.ui.adapter.ConsumptionReasonAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingOrderFoodAdapter;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/29/2021 15:05
* <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 WarehousingOrderDetailsContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void initReason(ConsumptionReasonAdapter consumptionReasonAdapter);
void initFoodView(WareHousingOrderFoodAdapter wareHousingOrderFoodAdapter);
}
//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.WarehousingOrderDetailsContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/29/2021 15:05
* <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 WarehousingOrderDetailsModel extends BaseModel implements WarehousingOrderDetailsContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public WarehousingOrderDetailsModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
......@@ -493,10 +493,14 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) {
//需要在供應商和分類的緩存中這個食品移除
// categoryFoods
// supplierFoods
//列表中刪除掉這個食品
showFoods.get(groupPosition).purchaseFoodList.remove(position);
//移除在購物車中的緩存
SupplyShoppingCart.getInstance().removeFoodsByFoodId(foodId);
mRootView.loadFood(showFoods, true, true);
//刷新頁面
mRootView.loadFood(new ArrayList<>(showFoods), true, true);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
......
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.ui.adapter.ConsumptionReasonAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingOrderFoodAdapter;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderDetailsContract;
import java.util.ArrayList;
import java.util.List;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 04/29/2021 15:05
* <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 WarehousingOrderDetailsPresenter extends BasePresenter<WarehousingOrderDetailsContract.Model, WarehousingOrderDetailsContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
private ConsumptionReasonAdapter consumptionReasonAdapter;
private WareHousingOrderFoodAdapter wareHousingOrderFoodAdapter;
@Inject
public WarehousingOrderDetailsPresenter(WarehousingOrderDetailsContract.Model model, WarehousingOrderDetailsContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void getWarehousingReason() {
List<ConsumeReasonBean> consumeReasonBeans = new ArrayList<>();
consumptionReasonAdapter = new ConsumptionReasonAdapter(consumeReasonBeans);
mRootView.initReason(consumptionReasonAdapter);
}
public void getWarehousingFood() {
if (wareHousingOrderFoodAdapter == null) {
wareHousingOrderFoodAdapter = new WareHousingOrderFoodAdapter(SupplyShoppingCart.getInstance().getCartFoods());
mRootView.initFoodView(wareHousingOrderFoodAdapter);
} else {
wareHousingOrderFoodAdapter.setNewInstance(SupplyShoppingCart.getInstance().getCartFoods());
}
}
}
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.SparseArray;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.recyclerview.widget.RecyclerView;
import org.jetbrains.annotations.NotNull;
/**
* 通用的RecyclerView.ViewHolder。提供了根据viewId获取View的方法。
* 提供了对View、TextView、ImageView的常用设置方法。
*/
public class BaseViewHolder extends RecyclerView.ViewHolder {
private SparseArray<View> mViews;
public class BaseViewHolder extends com.chad.library.adapter.base.viewholder.BaseViewHolder {
public BaseViewHolder(View itemView) {
super(itemView);
mViews = new SparseArray<>();
public BaseViewHolder(@NotNull View view) {
super(view);
}
/**
......@@ -34,137 +28,121 @@ public class BaseViewHolder extends RecyclerView.ViewHolder {
return DataBindingUtil.getBinding(this.itemView);
}
/**
* 根据View Id 获取对应的View
*
* @param viewId
* @param <T>
* @return
*/
public <T extends View> T get(int viewId) {
View view = mViews.get(viewId);
if (view == null) {
view = this.itemView.findViewById(viewId);
mViews.put(viewId, view);
}
return (T) view;
}
//******** 提供对View、TextView、ImageView的常用设置方法 ******//
public BaseViewHolder setText(int viewId, CharSequence text) {
TextView tv = get(viewId);
tv.setText(text);
return this;
}
public BaseViewHolder setText(int viewId, CharSequence text, TextView.BufferType type) {
TextView tv = get(viewId);
tv.setText(text, type);
return this;
}
public BaseViewHolder setText(int viewId, int textRes) {
TextView tv = get(viewId);
tv.setText(textRes);
return this;
}
public BaseViewHolder setTextColor(int viewId, int textColor) {
TextView view = get(viewId);
view.setTextColor(textColor);
return this;
}
public BaseViewHolder setTextSize(int viewId, float size) {
TextView view = get(viewId);
view.setTextSize(size);
return this;
}
public BaseViewHolder setImageResource(int viewId, int resId) {
ImageView view = get(viewId);
view.setImageResource(resId);
return this;
}
public BaseViewHolder setImageBitmap(int viewId, Bitmap bitmap) {
ImageView view = get(viewId);
view.setImageBitmap(bitmap);
return this;
}
public BaseViewHolder setImageDrawable(int viewId, Drawable drawable) {
ImageView view = get(viewId);
view.setImageDrawable(drawable);
return this;
}
public BaseViewHolder setBackgroundColor(int viewId, int color) {
View view = get(viewId);
view.setBackgroundColor(color);
return this;
}
public BaseViewHolder setBackgroundRes(int viewId, int backgroundRes) {
View view = get(viewId);
view.setBackgroundResource(backgroundRes);
return this;
}
public BaseViewHolder setVisible(int viewId, boolean visible) {
View view = get(viewId);
view.setVisibility(visible ? View.VISIBLE : View.GONE);
return this;
}
public BaseViewHolder setVisible(int viewId, int visible) {
View view = get(viewId);
view.setVisibility(visible);
return this;
}
public BaseViewHolder setInvisible(int viewId, boolean invisible) {
View view = get(viewId);
view.setVisibility(invisible ? View.INVISIBLE : View.VISIBLE);
return this;
}
public BaseViewHolder setInvisible(int viewId, int invisible) {
View view = get(viewId);
view.setVisibility(invisible);
return this;
}
// public BaseViewHolder setText(int viewId, CharSequence text) {
// TextView tv = get(viewId);
// tv.setText(text);
// return this;
// }
//
// public BaseViewHolder setText(int viewId, CharSequence text, TextView.BufferType type) {
// TextView tv = get(viewId);
// tv.setText(text, type);
// return this;
// }
//
//
// public BaseViewHolder setText(int viewId, int textRes) {
// TextView tv = get(viewId);
// tv.setText(textRes);
// return this;
// }
//
// public BaseViewHolder setTextColor(int viewId, int textColor) {
// TextView view = get(viewId);
// view.setTextColor(textColor);
// return this;
// }
//
// public BaseViewHolder setTextSize(int viewId, float size) {
// TextView view = get(viewId);
// view.setTextSize(size);
// return this;
// }
//
// public BaseViewHolder setImageResource(int viewId, int resId) {
// ImageView view = get(viewId);
// view.setImageResource(resId);
// return this;
// }
//
// public BaseViewHolder setImageBitmap(int viewId, Bitmap bitmap) {
// ImageView view = get(viewId);
// view.setImageBitmap(bitmap);
// return this;
// }
//
//
// public BaseViewHolder setImageDrawable(int viewId, Drawable drawable) {
// ImageView view = get(viewId);
// view.setImageDrawable(drawable);
// return this;
// }
//
//
// public BaseViewHolder setBackgroundColor(int viewId, int color) {
// View view = get(viewId);
// view.setBackgroundColor(color);
// return this;
// }
//
// public BaseViewHolder setBackgroundRes(int viewId, int backgroundRes) {
// View view = get(viewId);
// view.setBackgroundResource(backgroundRes);
// return this;
// }
//
// public BaseViewHolder setVisible(int viewId, boolean visible) {
// View view = get(viewId);
// view.setVisibility(visible ? View.VISIBLE : View.GONE);
// return this;
// }
//
// public BaseViewHolder setVisible(int viewId, int visible) {
// View view = get(viewId);
// view.setVisibility(visible);
// return this;
// }
//
// public BaseViewHolder setInvisible(int viewId, boolean invisible) {
// View view = get(viewId);
// view.setVisibility(invisible ? View.INVISIBLE : View.VISIBLE);
// return this;
// }
//
// public BaseViewHolder setInvisible(int viewId, int invisible) {
// View view = get(viewId);
// view.setVisibility(invisible);
// return this;
// }
public BaseViewHolder setOnClickListener(int viewId, View.OnClickListener onClickListener) {
View view = get(viewId);
View view = getView(viewId);
view.setOnClickListener(onClickListener);
return this;
}
public BaseViewHolder setOnLongClickListener(int viewId, View.OnLongClickListener l) {
View view = get(viewId);
View view = getView(viewId);
view.setOnLongClickListener(l);
return this;
}
public BaseViewHolder setOnTouchListener(int viewId, View.OnTouchListener l) {
View view = get(viewId);
View view = getView(viewId);
view.setOnTouchListener(l);
return this;
}
public BaseViewHolder setOnFocusChangeListener(int viewId, View.OnFocusChangeListener onFocusChangeListener) {
View view = get(viewId);
View view = getView(viewId);
view.setOnFocusChangeListener(onFocusChangeListener);
return this;
}
public <T extends TextView> CharSequence getText(int viewId) {
T view = get(viewId);
T view = getView(viewId);
return view.getText();
}
}
......@@ -101,7 +101,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
itemViewHolder.setText(R.id.tv_food_item_supplier_name, purchaseFoodBean.getSupplierName());
itemViewHolder.setImageResource(R.id.iv_food_ingredient_img, R.drawable.img_small_default);
if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseFoodBean.getImages())) {
GlideUtils.display(mContext, itemViewHolder.get(R.id.iv_food_ingredient_img), purchaseFoodBean.getImages());
GlideUtils.display(mContext, itemViewHolder.getView(R.id.iv_food_ingredient_img), purchaseFoodBean.getImages());
}
itemViewHolder.setText(R.id.tv_food_item_no, purchaseFoodBean.getFoodNo());
itemViewHolder.setText(R.id.tv_food_item_name, purchaseFoodBean.getName());
......@@ -112,7 +112,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
itemViewHolder.setText(R.id.tv_food_item_unit, purchaseFoodBean.getBasicUnitName());
}
itemViewHolder.setText(R.id.tv_food_item_price, String.format(mContext.getString(R.string.amount_string_s), MoneyUtil.formatDouble(purchaseFoodBean.getUnitPrice())));
EditText edNumberInput = itemViewHolder.get(R.id.ed_food_ingredient_number);
EditText edNumberInput = itemViewHolder.getView(R.id.ed_food_ingredient_number);
edNumberInput.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()), TextView.BufferType.EDITABLE);
//如果數量小於等於0,就不顯示減號和數量
setSubAndNumShow(itemViewHolder, purchaseFoodBean.getFoodQuantity() <= 0);
......@@ -205,7 +205,7 @@ public class BuyIngredientsAdapter extends GroupedRecyclerViewAdapter<BuyIngredi
*/
public void setLongClick(BaseViewHolder itemViewHolder, int groupPosition, int childPosition, PurchaseFoodBean purchaseFoodBean, boolean addOrSub) {
//開啟線程
EditText edNumberInput = itemViewHolder.get(R.id.ed_food_ingredient_number);
EditText edNumberInput = itemViewHolder.getView(R.id.ed_food_ingredient_number);
ThreadPoolManager.getInstence().putExecutableTasks(() -> {
int number = 0;
if (TextUtil.isNotEmptyOrNullOrUndefined(edNumberInput)) {
......
......@@ -187,7 +187,7 @@ public abstract class GroupedRecyclerViewAdapter<T>
protected void bindViewClickListener(BaseViewHolder viewHolder, int viewType) {
if (mOnItemChildClickListener != null && viewType == TYPE_CHILD) {
for (Integer childClickViewId : childClickViewIds) {
View childView = viewHolder.get(childClickViewId);
View childView = viewHolder.getView(childClickViewId);
if (!childView.isClickable()) {
childView.setClickable(true);
}
......
......@@ -139,20 +139,19 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Shop
if (number <= 0) {
//如果數量小於等於0,需要詢問是否刪除
//彈窗顯示 是否刪除
new AppDialog().showWaringDialog(context, "是否刪除食品?", true, (view, dialog) -> {
AppDialog.getInstance().showWaringDialog(context, "是否刪除食品?", true, () -> {
boolean isDeleteSupplier = deleteFood(viewHolder.getAdapterPosition(), viewHolder, viewHolder.getView(R.id.tv_order_item_food_type_total), foodListAdapter, beforeNumber, position, purchaseFoodBean);
//如果這個供應商被刪除了,就不用判斷採購金額了
if (!isDeleteSupplier) {
//判斷當前總價是否滿足最低採購金額
setTvMinimumAmount(viewHolder);
}
}, (view, dialog) -> {
}, () -> {
//不刪除這個食品
if (purchaseFoodBean.getFoodQuantity() <= 0) {
purchaseFoodBean.setFoodQuantity(1);
}
foodListAdapter.notifyItemChanged(position);
dialog.dismiss();
});
} else {
//當數量發生改變時,重新計算價格。
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import androidx.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* @author 宇航. 1239658231@qq.com
* User: admin
* Date: 2021/4/30
* Time: 9:20
* Use:
*/
public class WareHousingOrderFoodAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseViewHolder> {
public WareHousingOrderFoodAdapter(@Nullable List<PurchaseFoodBean> data) {
super(R.layout.item_warehousing_order_details, data);
addChildClickViewIds(R.id.tv_edit);
}
@Override
protected void convert(@NotNull BaseViewHolder holder, PurchaseFoodBean item) {
holder.setText(R.id.tv_goods_name, item.getName());
holder.setText(R.id.tv_goods_unit, item.getBasicUnitName());
holder.setText(R.id.tv_goods_quantity, String.valueOf(item.getFoodQuantity()));
holder.setText(R.id.tv_edit, getContext().getString(R.string.str_look_over));
if (item.getFoodUnits() != null && item.getFoodUnits().size() > 1) {
holder.setVisible(R.id.iv_switch_unit, true);
} else {
holder.setGone(R.id.iv_switch_unit, true);
}
}
}
......@@ -17,7 +17,7 @@ class WarehousingOrderListAdapter(data: MutableList<WarehouseOrderBean>?) : Base
override fun convert(holder: BaseViewHolder, item: WarehouseOrderBean) {
holder.setText(R.id.tv_warehousing_order_no, item.orderNo)
holder.setText(R.id.tv_warehousing_order_createTime, item.warehousingTime)
holder.setText(R.id.tv_warehousing_order_species, item.warehousingSpecies)
holder.setText(R.id.tv_warehousing_order_species, item.warehousingSpecies.toString())
holder.setText(R.id.tv_warehousing_order_createMember, item.warehousingMember)
holder.setText(R.id.tv_warehousing_order_foods, item.warehousingFoodName)
holder.setText(R.id.tv_warehousing_order_createReason, item.warehousingReason)
......
......@@ -27,6 +27,7 @@ import com.gingersoft.supply_chain.mvp.ui.fragment.inventory.StorageListFragment
import com.gingersoft.supply_chain.mvp.ui.fragment.order.PurchaseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHouseListFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingOrderListFragment;
import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.widget.QMUITopBar;
......@@ -92,9 +93,11 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
List<Function> orderManger = new ArrayList<>();
orderManger.add(new Function("採購訂單", R.drawable.ic_purchase_order));
purchaseFunctionBeans.add(new PurchaseFunctionBean("訂單管理", orderManger));
List<Function> storage = new ArrayList<>();
storage.add(new Function("庫存查詢", R.drawable.ic_purchase_order));
storage.add(new Function("庫存查詢", R.drawable.ic_inventory_inquiry));
storage.add(new Function("入庫", R.drawable.ic_warehousing));
storage.add(new Function("出庫", R.drawable.ic_out_of_stock));
storage.add(new Function("盤點", R.drawable.ic_inventory));
if (BuildConfig.DEBUG) {
storage.add(new Function("切換環境", R.drawable.ic_seekbar_btn));
}
......@@ -121,12 +124,15 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
case "採購訂單":
start(PurchaseListFragment.newInstance());
break;
case "入庫":
start(StorageListFragment.newInstance());
break;
// case "入庫":
// start(StorageListFragment.newInstance());
// break;
case "庫存查詢":
start(WareHouseListFragment.newInstance());
break;
case "入庫":
start(WarehousingOrderListFragment.newInstance());
break;
case "切換環境":
int format = (int) SPUtils.get("isFormal", 3);
if (format == 3) {
......
......@@ -202,7 +202,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
NewAddCategoryPopup categoryPopup = new NewAddCategoryPopup(mContext, getString(R.string.str_modify), getString(R.string.str_category_name), getString(R.string.str_please_modify_current_category_name), foodCategoryTrees.getName(), true);
categoryPopup.setOnDeleteListener(v -> {
//刪除分類
AppDialog.getInstance().showWaringDialog(mContext, String.format(getString(R.string.str_delete_category_tip), foodCategoryTrees.getName()), (view, dialog) -> {
AppDialog.getInstance().showWaringDialog(mContext, String.format(getString(R.string.str_delete_category_tip), foodCategoryTrees.getName()), () -> {
categoryPopup.dismiss();
mPresenter.deleteFoodCategory(foodCategoryTrees, currentLevel, position);
});
......
......@@ -93,6 +93,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
* ADD_ORDER 為添加訂單頁面
* ORDER_TYPE 為購物車頁面
* GET_FOOD_BY_SUPPLIER 根据供應商顯示食品列表
* GET_FOOD_BY_WAREHOUSING_ORDER 入庫訂單選購食材
*/
private int pageType = 1;
public final static int FOOD_INGREDIENTS = 1;
......@@ -100,6 +101,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
public final static int ORDER_TYPE = 3;
public final static int GET_FOOD_BY_SUPPLIER = 4;
private final static String pageTypeKey = "pageType";
private final static String supplierIdKey = "supplierId";
private final static String supplierNameKey = "supplierName";
......@@ -411,7 +413,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
} else if (view.getId() == R.id.iv_supplier_delete) {
//刪除食材
PurchaseFoodBean purchaseFoodBean = foodListAdapter.getData().get(position);
new AppDialog().showWaringDialog(mContext, "是否確認刪除" + purchaseFoodBean.getName(), (view1, dialog) -> {
AppDialog.getInstance().showWaringDialog(mContext, "是否確認刪除" + purchaseFoodBean.getName(), () -> {
if (!isSupplier) {
purchaseFoodBean.setFoodCategoryName(getCurrentCategory());
}
......
......@@ -176,9 +176,7 @@ public class MeasurementUnitFragment extends BaseSupplyChainFragment<Measurement
measurementUnitAdapter.setOnItemChildClickListener((adapter, view, position) -> {
List<MeasurementUnitBean.DataBean.Unit> data = measurementUnitAdapter.getData();
MeasurementUnitBean.DataBean.Unit unit = data.get(position);
new AppDialog().showWaringDialog(mContext, "是否確認刪除?", (view1, dialog) -> {
mPresenter.deleteMeasurementUnit(unit, position);
});
AppDialog.getInstance().showWaringDialog(mContext, "是否確認刪除?", () -> mPresenter.deleteMeasurementUnit(unit, position));
});
measurementUnitAdapter.setOnItemClickListener((adapter, view, position) -> {
List<MeasurementUnitBean.DataBean.Unit> data = measurementUnitAdapter.getData();
......
......@@ -253,6 +253,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
if (data != null) {
Uri uri = data.getData();
if (uri != null) {
//有報錯
File file = SelectPicture.getInstance().uriToFileApiQ(requireContext(), uri);
SelectPicture.getInstance().crop(Uri.fromFile(file), this);
}
......
......@@ -255,7 +255,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
showMessage("有已收貨食材,訂單不可刪除");
return;
}
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", (view1, dialog) -> mPresenter.deleteOrder());
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", () -> mPresenter.deleteOrder());
} else if (position == 2) {
//部分收貨
addWarehouse(PurchaseOrderDetailsBean.PART_RECEIVED);
......@@ -579,16 +579,9 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
ScanSnPopup scanSnPopup = new ScanSnPopup(this, infoVosBean.getName(), CollectionUtils.deepCopy(foodEncodeSns), infoVosBean.getStatus() != PurchaseOrderDetailsBean.COMPLETE_RECEIVED)
.setOnDeleteListener((snCode, snPosition) -> {
if (foodEncodeSns != null) {
for (PurchaseFoodEncodeSn foodEncodeSn : foodEncodeSns) {
if (foodEncodeSn.getEncodeSnNo().equals(snCode)) {
if (!foodEncodeSn.newAdd) {
mPresenter.deleteSn(infoVosBean.getOrderNo(), infoVosBean.getFoodNo(), foodEncodeSn.getEncodeSnNo());
foodEncodeSns.remove(foodEncodeSn);
}
return;
}
}
if (!snCode.newAdd) {
mPresenter.deleteSn(infoVosBean.getOrderNo(), infoVosBean.getFoodNo(), snCode.getEncodeSnNo());
foodEncodeSns.remove(snCode);
}
});
scanSnPopup.setOnScanResultListener((popup, scanResult) -> {
......
......@@ -208,7 +208,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
//刪除
if (purchaseOrderAdapter.getItem(position).getStatus() == PurchaseOrderDetailsBean.WAIT_RECEIVED) {
//只有待收貨可以刪除
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", (view1, dialog) -> mPresenter.deleteOrder(position, purchaseOrderAdapter.getData().get(position).getId()));
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", () -> mPresenter.deleteOrder(position, purchaseOrderAdapter.getData().get(position).getId()));
} else {
showMessage("該訂單已有入庫食品,不可刪除!");
}
......
......@@ -103,9 +103,7 @@ public class NewSupplierFragment extends BaseSupplyChainFragment<NewSupplierPres
int viewId = v.getId();
if (viewId == R.id.topbar_right_delete_button) {
//刪除供應商
new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> {
mPresenter.deleteSupplier(supplierBean.getId());
});
AppDialog.getInstance().showWaringDialog(mContext, "刪除供應商", () -> mPresenter.deleteSupplier(supplierBean.getId()));
} else if (viewId == R.id.btn_save_supplier) {
//保存
if (isUpdate) {
......
......@@ -237,7 +237,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
});
supplierAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_supplier_delete) {
new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> {
AppDialog.getInstance().showWaringDialog(mContext, "刪除供應商", () -> {
List<SupplierInfoBean> data = supplierAdapter.getData();
mPresenter.deleteSupplier(data.get(position).getId(), position);
});
......
package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerWarehousingOrderDetailsComponent;
import com.gingersoft.supply_chain.mvp.bean.ConsumeReasonBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderDetailsContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehousingOrderDetailsPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.ConsumptionReasonAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingOrderFoodAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.GoodsDetailsPopup;
import com.jess.arms.di.component.AppComponent;
import com.lxj.xpopup.XPopup;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.widget.QMUITopBar;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* Description: 入庫單詳情
*
* @author admin
*/
public class WarehousingOrderDetailsFragment extends BaseSupplyChainFragment<WarehousingOrderDetailsPresenter> implements WarehousingOrderDetailsContract.View {
@BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar;
@BindView(R2.id.rv_warehousing_type)
RecyclerView rvWarehousingType;
@BindView(R2.id.rv_warehousing_food)
RecyclerView rvWarehousingFood;
@BindView(R2.id.switch_warehousing_is_print)
SwitchCompat switchWarehousingIsPrint;
@BindView(R2.id.tv_food_species)
TextView tvFoodSpecies;
@BindView(R2.id.tv_order_total_amount)
TextView tvOrderTotalAmount;
@BindView(R2.id.ed_remark)
EditText edRemark;
@BindView(R2.id.tv_order_confirm)
QMUIAlphaTextView tvOrderConfirm;
@BindView(R2.id.tv_order_cancel)
QMUIAlphaTextView tvOrderCancel;
public static WarehousingOrderDetailsFragment newInstance() {
WarehousingOrderDetailsFragment fragment = new WarehousingOrderDetailsFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerWarehousingOrderDetailsComponent //如找不到该类,请编译一下项目
.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_warehousing_order_details, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
//入庫類型
rvWarehousingType.setLayoutManager(new GridLayoutManager(requireContext(), 3));
mPresenter.getWarehousingReason();
mPresenter.getWarehousingFood();
}
private View getHeader() {
View view = getLayoutInflater().inflate(R.layout.item_warehousing_order_details, rvWarehousingFood, false);
TextView goodsName = view.findViewById(R.id.tv_goods_name);
TextView goodsUnit = view.findViewById(R.id.tv_goods_unit);
TextView goodsNumber = view.findViewById(R.id.tv_goods_quantity);
TextView tvEdit = view.findViewById(R.id.tv_edit);
goodsName.setTypeface(null, Typeface.BOLD);
goodsUnit.setTypeface(null, Typeface.BOLD);
goodsNumber.setTypeface(null, Typeface.BOLD);
tvEdit.setTypeface(null, Typeface.BOLD);
return view;
}
private View getFooter(View.OnClickListener onClickListener) {
View view = getLayoutInflater().inflate(R.layout.footer_add, rvWarehousingFood, false);
view.setOnClickListener(onClickListener);
return view;
}
@Override
public void initReason(ConsumptionReasonAdapter consumptionReasonAdapter) {
rvWarehousingType.setAdapter(consumptionReasonAdapter);
}
@Override
public void initFoodView(WareHousingOrderFoodAdapter wareHousingOrderFoodAdapter) {
wareHousingOrderFoodAdapter.addHeaderView(getHeader());
wareHousingOrderFoodAdapter.addFooterView(getFooter(v -> start(BuyIngredientsFragment.newInstance(BuyIngredientsFragment.GET_FOOD_BY_WAREHOUSING_ORDER))));
rvWarehousingFood.setAdapter(wareHousingOrderFoodAdapter);
wareHousingOrderFoodAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
@Override
public void onItemChildClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
int viewId = view.getId();
if (viewId == R.id.tv_edit) {
//查看
PurchaseFoodBean item = wareHousingOrderFoodAdapter.getItem(position);
if (wareHousingOrderFoodAdapter.getItem(position).getFoodMarkSn() == PurchaseFoodBean.HAS_SN) {
//SN食材,輸入SN碼
} else {
//顯示詳情
new XPopup.Builder(requireContext())
.autoOpenSoftInput(false)
.autoFocusEditText(false)
.asCustom(new GoodsDetailsPopup(requireContext(), item).setEditNumber(false))
.show();
}
}
}
});
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.os.UserManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.di.component.AppComponent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.core.user.UserConstans;
import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.core.user.info.UserInfo;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.ui.animator.CustomAnimation1;
import com.gingersoft.gsa.cloud.ui.animator.CustomAnimation3;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerWarehousingOrderListComponent;
import com.gingersoft.supply_chain.mvp.bean.WarehouseOrderBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.WarehousingOrderListContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehousingOrderListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WarehousingOrderListAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.food.BuyIngredientsFragment;
import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.gingersoft.supply_chain.R;
import java.util.ArrayList;
import java.util.List;
import static com.jess.arms.utils.Preconditions.checkNotNull;
import butterknife.BindView;
import static com.gingersoft.supply_chain.mvp.ui.fragment.food.FoodIngredientsFragment.FOOD_INGREDIENTS;
/**
......@@ -33,7 +49,12 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class WarehousingOrderListFragment extends BaseSupplyChainFragment<WarehousingOrderListPresenter> implements WarehousingOrderListContract.View {
public class WarehousingOrderListFragment extends BaseSupplyChainFragment<WarehousingOrderListPresenter> implements WarehousingOrderListContract.View, View.OnClickListener {
@BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar;
@BindView(R2.id.rv_second_category)
RecyclerView rvSecondCategory;
public static WarehousingOrderListFragment newInstance() {
WarehousingOrderListFragment fragment = new WarehousingOrderListFragment();
......@@ -57,6 +78,25 @@ public class WarehousingOrderListFragment extends BaseSupplyChainFragment<Wareho
@Override
public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(supplyTopBar, "入庫單");
supplyTopBar.addRightImageButton(R.drawable.ic_circle_new_food_ingredient, R.id.topbar_right_add_button).setOnClickListener(this);
List<WarehouseOrderBean> warehouseOrderBeanList = new ArrayList<>();
for (int i = 0; i < 15; i++) {
warehouseOrderBeanList.add(new WarehouseOrderBean("RKO1101" + i, UserContext.newInstance().getMemberName(), TimeUtils.getCurrentDate(TimeUtils.DEFAULT_DATE_FORMAT_YMDHM), "巴西肥牛", 1, "調撥入庫"));
}
WarehousingOrderListAdapter adapter = new WarehousingOrderListAdapter(warehouseOrderBeanList);
adapter.setAdapterAnimation(new CustomAnimation3());
rvSecondCategory.setAdapter(adapter);
}
@Override
public void onClick(View v) {
int viewId = v.getId();
if (viewId == R.id.topbar_right_add_button) {
//先清空購物車
SupplyShoppingCart.getInstance().clear();
//新增入庫單
start(BuyIngredientsFragment.newInstance(BuyIngredientsFragment.GET_FOOD_BY_WAREHOUSING_ORDER));
}
}
}
......@@ -107,6 +107,7 @@ public class GoodsDetailsPopup extends CenterPopupView {
if (!isEditNumber) {
layoutOperationFoodNum.setVisibility(GONE);
tvGoodsStock.setVisibility(GONE);
return;
}
edFoodIngredientNumber.setText(purchaseFoodBean.getFoodQuantity() + "");
......
......@@ -139,7 +139,6 @@ public class ScanSnView extends FrameLayout {
this.fragment = fragment;
}
public ScanSnView init() {
View rootView = LayoutInflater.from(getContext()).inflate(R.layout.layout_scan_sn, this, false);
ButterKnife.bind(this, rootView);
......@@ -198,7 +197,7 @@ public class ScanSnView extends FrameLayout {
});
adapter.setOnItemChildClickListener((adapter1, view, position) -> {
if (view.getId() == R.id.iv_sn_code_delete) {
if (adapter.getItem(position).newAdd) {
// if (adapter.getItem(position).newAdd) {
onSingerResultListener.onScanValue(false, adapter.getItem(position), adapter.getItemCount());
if (onDeleteSnCodeListener != null) {
onDeleteSnCodeListener.onDelete(adapter.getItem(position), position);
......@@ -208,9 +207,9 @@ public class ScanSnView extends FrameLayout {
}
adapter1.removeAt(position);
setConfirmBtnState();
} else {
ToastUtils.show(getContext(), "已入庫的SN碼不可刪除");
}
// } else {
// ToastUtils.show(getContext(), "已入庫的SN碼不可刪除");
// }
}
});
addView(rootView);
......
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_add_food"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_5"
android:text="+添加食材"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<?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:animateLayoutChanges="true"
android:background="@color/supply_chain_bg_color"
android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar
......@@ -120,8 +121,8 @@
android:id="@+id/layout_category"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:visibility="gone"
android:background="@color/white">
android:background="@color/white"
android:visibility="gone">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_ingredients_second_category"
......@@ -140,8 +141,8 @@
<ImageView
android:id="@+id/iv_unfold_arrow"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_inverted_triangle_66" />
</androidx.cardview.widget.CardView>
</com.google.android.material.appbar.CollapsingToolbarLayout>
......@@ -208,6 +209,7 @@
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
......@@ -221,6 +223,43 @@
android:textSize="@dimen/dp_16"
android:visibility="gone" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_20"
android:layout_weight="1"
android:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_chosen"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/left_parenthesis"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<TextView
android:id="@+id/tv_select_food_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/right_parenthesis"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
</LinearLayout>
<FrameLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
......@@ -264,9 +303,8 @@
android:layout_marginBottom="@dimen/dp_5"
android:layout_weight="1"
android:text="取消"
android:visibility="visible" />
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</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:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="入庫類型:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_warehousing_type"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_warehousing_food"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_10"
android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switch_warehousing_is_print"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:shadowColor="@color/trans"
android:text="是否打印:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16"
android:thumb="@drawable/shape_thumb_on"
android:track="@drawable/selector_switch_track" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_15"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="種類:"
android:textColor="@color/color_222"
android:textSize="@dimen/supply_chain_textSize_16" />
<TextView
android:id="@+id/tv_food_species"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/required_color"
android:textSize="@dimen/supply_chain_textSize_16"
android:textStyle="bold"
tools:text="3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:gravity="right"
android:text="總計:"
android:textColor="@color/color_222"
android:textSize="@dimen/supply_chain_textSize_16" />
<TextView
android:id="@+id/tv_order_total_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/required_color"
android:textSize="@dimen/supply_chain_textSize_16"
android:textStyle="bold"
tools:text="$330" />
</LinearLayout>
<EditText
android:id="@+id/ed_remark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_15"
android:textCursorDrawable="@drawable/cursor_theme"
android:text="勝多負少"
android:hint="@string/str_remark"
android:textColorHint="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_10"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_order_confirm"
style="@style/app_btn_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/shape_app_btn_small_radius"
android:gravity="center"
android:paddingLeft="@dimen/dp_35"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_35"
android:paddingBottom="@dimen/dp_10"
android:text="確定" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_order_cancel"
style="@style/Cancel_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_weight="1"
android:gravity="center"
android:paddingLeft="@dimen/dp_35"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_35"
android:paddingBottom="@dimen/dp_10"
android:text="取消" />
</LinearLayout>
</LinearLayout>
\ 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="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_goods_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="食材名"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_goods_unit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="單位"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<ImageView
android:id="@+id/iv_switch_unit"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_6"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/dp_11"
android:src="@drawable/ic_inverted_triangle_66"
android:visibility="gone" />
</LinearLayout>
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<TextView
android:id="@+id/tv_goods_quantity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="數量"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
<TextView
android:id="@+id/tv_edit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:text="編輯"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/supply_chain_textSize_16" />
</LinearLayout>
\ No newline at end of file
......@@ -112,7 +112,8 @@
android:layout_weight="1"
android:text="庫存:15/60"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" />
android:textSize="@dimen/dp_15"
android:visibility="invisible" />
<LinearLayout
android:id="@+id/layout_operation_food_num"
......
......@@ -65,7 +65,6 @@
app:layout_constraintTop_toTopOf="parent"
app:switchPadding="@dimen/dp_5" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
......
......@@ -6,4 +6,14 @@
<dimen name="new_supplier_info_item_marginBottom">@dimen/dp_10</dimen>
<dimen name="new_category_dialog_marginLeft">@dimen/dp_15</dimen>
<dimen name="purchase_order_confirm_item_marginTop">@dimen/dp_10</dimen>
<!-- 供應鏈通用,便於統一管理,到時候要是修改,直接用名稱一鍵替換 -->
<dimen name="supply_chain_textSize_12">@dimen/textSize_12</dimen>
<dimen name="supply_chain_textSize_14">@dimen/textSize_14</dimen>
<dimen name="supply_chain_textSize_16">@dimen/textSize_16</dimen>
<dimen name="supply_chain_textSize_18">@dimen/textSize_18</dimen>
<dimen name="supply_chain_textSize_20">@dimen/textSize_20</dimen>
</resources>
\ No newline at end of file
......@@ -57,5 +57,7 @@
<string name="str_select_least_one_product">至少選擇一個商品</string>
<string name="str_confirm_receipt">是否確認收貨?</string>
<string name="str_new_add_ingredients">新增食材</string>
<string name="str_chosen">已選擇</string>
</resources>
\ No newline at end of file
......@@ -489,5 +489,11 @@
<dimen name="multi_marginLeft">@dimen/dp_18</dimen>
<!-- 多類型adapter 高度:輸入item,選擇item -->
<dimen name="multi_height">@dimen/dp_55</dimen>
<!-- 統一使用字體大小,其他模塊字體大小繼承,便於統一管理-->
<dimen name="textSize_12">@dimen/dp_12</dimen>
<dimen name="textSize_14">@dimen/dp_14</dimen>
<dimen name="textSize_16">@dimen/dp_16</dimen>
<dimen name="textSize_18">@dimen/dp_18</dimen>
<dimen name="textSize_20">@dimen/dp_20</dimen>
</resources>
\ No newline at end of file
......@@ -285,5 +285,5 @@
<string name="str_modify">修改</string>
<string name="str_please_modify_current_category_name">请修改當前類別名稱</string>
<string name="str_data_info">出錯啦,請重新進入後再試</string>
<string name="str_look_over">查看</string>
</resources>
......@@ -18,7 +18,7 @@ public class CustomAnimation3 implements BaseAnimation {
alpha.setDuration(450);
Animator translationY =
ObjectAnimator.ofFloat(view, "translationY", view.getRootView().getHeight(), 0f);
ObjectAnimator.ofFloat(view, "translationY", view.getRootView().getHeight(), 0.5f);
translationY.setDuration(450);
translationY.setInterpolator(new DecelerateInterpolator(1.2f));
......
......@@ -34,47 +34,19 @@ public class AppDialog {
}
public void showWaringDialog(Context context, String title, DialogOnClickListener sureOnclickListener) {
showWaringDialog(context, title, null, null, sureOnclickListener, null, true);
public void showWaringDialog(Context context, String title, OnConfirmListener confirmListener) {
showWaringDialog(context, title, null, null, confirmListener, null, true);
}
public void showWaringDialog(Context context, String title, boolean isDismiss, DialogOnClickListener sureOnclickListener) {
showWaringDialog(context, title, null, null, sureOnclickListener, null, isDismiss);
public void showWaringDialog(Context context, String title, OnConfirmListener confirmListener, OnCancelListener cancelListener) {
showWaringDialog(context, title, null, null, confirmListener, cancelListener, true);
}
public void showWaringDialog(Context context, String title, boolean isDismiss, DialogOnClickListener sureOnclickListener, DialogOnClickListener cancelOnclickListener) {
showWaringDialog(context, title, null, null, sureOnclickListener, cancelOnclickListener, isDismiss);
public void showWaringDialog(Context context, String title, boolean isDismiss, OnConfirmListener confirmListener, OnCancelListener cancelListener) {
showWaringDialog(context, title, null, null, confirmListener, cancelListener, isDismiss);
}
private void showWaringDialog(Context context, String title, String confimText, String cancelText, DialogOnClickListener sureOnclickListener, DialogOnClickListener cancelOnclickListener, boolean isDismiss) {
//DialogUtils內存洩漏,換Xpopup
new DialogUtils(context, R.layout.other_order_pause_orders) {
@Override
public void initLayout(ViewHepler hepler, Dialog dialog) {
if (title != null) {
hepler.setText(R.id.tv_warning_title, title);
}
if (confimText != null) {
hepler.setText(R.id.tv_dialog_confirm, confimText);
}
if (sureOnclickListener != null) {
hepler.getView(R.id.tv_dialog_confirm).setOnClickListener(v -> {
sureOnclickListener.onclick(v, dialog);
if (isDismiss) {
dialog.dismiss();
}
});
}
if (cancelText != null) {
hepler.setText(R.id.tv_dialog_cancel, cancelText);
}
if (cancelOnclickListener != null) {
hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> cancelOnclickListener.onclick(v, dialog));
} else {
hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> dialog.dismiss());
}
}
}.show();
private void showWaringDialog(Context context, String title, String sureBtnText, String cancelBtnText, OnConfirmListener confirmListener, OnCancelListener cancelListener, boolean isDismiss) {
new XPopup.Builder(context).asConfirm(title, "", cancelBtnText, sureBtnText, confirmListener, cancelListener, false, R.layout.other_order_pause_orders).show();
}
public void showSelectDialog(Context context, String title, int spanCount, RecyclerView.Adapter adapter, DialogOnClickListener sureOnclickListenter) {
......@@ -119,29 +91,6 @@ public class AppDialog {
public void showTipDialog(Context context, String title, String sureBtnText, String cancelBtnText, OnConfirmListener sureOnclickListener, OnCancelListener onCancelListener) {
new XPopup.Builder(context).asConfirm(title, "", cancelBtnText, sureBtnText, sureOnclickListener, onCancelListener, false, R.layout.dialog_tip).show();
// new DialogUtils(context, R.layout.dialog_tip) {
// @Override
// public void initLayout(ViewHepler hepler, Dialog dialog) {
// if (title != null) {
// hepler.setText(R.id.tv_warning_title, title);
// }
// hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> dialog.dismiss());
// ((TextView) hepler.getView(R.id.tv_dialog_confirm)).setText(sureBtnText);
// ((TextView) hepler.getView(R.id.tv_dialog_cancel)).setText(cancelBtnText);
// hepler.getView(R.id.tv_dialog_confirm).setOnClickListener(v -> {
// if (sureOnclickListener != null) {
// sureOnclickListener.onclick(v, dialog);
// }
// dialog.dismiss();
// });
// hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> {
// dismiss();
// if (onCancelListener != null) {
// onCancelListener.onclick(v, dialog);
// }
// });
// }
// }.show();
}
public void showListDialog(Context context, String[] data, onDialogSelectListener onSelectListener) {
......
......@@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/shape_white_eight_corners_bg"
android:gravity="center_horizontal"
android:orientation="vertical"
......@@ -16,14 +17,20 @@
android:src="@drawable/ic_warning" />
<TextView
android:id="@+id/tv_warning_title"
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_22"
android:text="是否暫停接單?"
tools:text="是否暫停接單?"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_20" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -31,7 +38,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/tv_dialog_confirm"
android:id="@+id/tv_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_red_seven_radius_bg"
......@@ -44,7 +51,7 @@
android:textSize="@dimen/dp_15" />
<TextView
android:id="@+id/tv_dialog_cancel"
android:id="@+id/tv_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_28"
......
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