Commit 2dd5c457 by jason

菜品点击事件

parent 298d6949
...@@ -557,7 +557,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -557,7 +557,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
} }
//預計發貨時間 //預計發貨時間
String expect = infoMultiBeans.get(expectIndex).getShowValue(); String expect = infoMultiBeans.get(expectIndex).getShowValue();
LogUtil.e("zjs expect="+expect); // LogUtil.e("zjs expect="+expect);
if (TextUtil.isNotEmptyOrNullOrUndefined(expect)) { if (TextUtil.isNotEmptyOrNullOrUndefined(expect)) {
supplierInfoBean.setDeliveryTime(Double.parseDouble(expect)); supplierInfoBean.setDeliveryTime(Double.parseDouble(expect));
} }
......
...@@ -5,6 +5,7 @@ import android.view.View; ...@@ -5,6 +5,7 @@ import android.view.View;
import com.chad.library.adapter.base.entity.node.BaseNode; import com.chad.library.adapter.base.entity.node.BaseNode;
import com.chad.library.adapter.base.provider.BaseNodeProvider; import com.chad.library.adapter.base.provider.BaseNodeProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
...@@ -24,8 +25,7 @@ public class DishProvider extends BaseNodeProvider { ...@@ -24,8 +25,7 @@ public class DishProvider extends BaseNodeProvider {
public void convert(@NotNull BaseViewHolder helper, @NotNull BaseNode data) { public void convert(@NotNull BaseViewHolder helper, @NotNull BaseNode data) {
DishNode entity = (DishNode) data; DishNode entity = (DishNode) data;
helper.setText(R.id.tv_dish_title, entity.getFoodName()); helper.setText(R.id.tv_dish_title, entity.getFoodName());
LogUtil.e("zjs","isExpanded()="+entity.isExpanded()+" getFoodName"+entity.getFoodName());
// LogUtil.e("zjs"," entity.isExpanded()="+entity.isExpanded());
// if (entity.isExpanded()) { // if (entity.isExpanded()) {
// helper.setImageResource(R.id.iv_dishes_group_icon, R.drawable.ic_dishes_up); // helper.setImageResource(R.id.iv_dishes_group_icon, R.drawable.ic_dishes_up);
// } else { // } else {
...@@ -36,10 +36,13 @@ public class DishProvider extends BaseNodeProvider { ...@@ -36,10 +36,13 @@ public class DishProvider extends BaseNodeProvider {
@Override @Override
public void onClick(@NotNull BaseViewHolder helper, @NotNull View view, BaseNode data, int position) { public void onClick(@NotNull BaseViewHolder helper, @NotNull View view, BaseNode data, int position) {
DishNode entity = (DishNode) data; DishNode entity = (DishNode) data;
LogUtil.e("zjs"," onClick entity.isExpanded()="+entity.toString());
if (entity.isExpanded()) { if (entity.isExpanded()) {
getAdapter().collapse(position); getAdapter().collapse(position);
} else { } else {
getAdapter().expandAndCollapseOther(position); getAdapter().expandAndCollapseOther(position);
} }
} }
} }
\ No newline at end of file
...@@ -19,16 +19,6 @@ public class DishesGroupNode extends BaseExpandNode{ ...@@ -19,16 +19,6 @@ public class DishesGroupNode extends BaseExpandNode{
private List<DishNode> child; private List<DishNode> child;
private List<BaseNode> childNode; private List<BaseNode> childNode;
public DishesGroupNode(int id, int parentId, int restaurantId, boolean isParent, int seqNo, String foodName) {
this.id = id;
this.parentId = parentId;
this.restaurantId = restaurantId;
this.isParent = isParent;
this.seqNo = seqNo;
this.foodName = foodName;
}
public List<DishNode> getDishNodes() { public List<DishNode> getDishNodes() {
return child; return child;
} }
......
...@@ -33,8 +33,11 @@ public class DishesGroupProvider extends BaseNodeProvider { ...@@ -33,8 +33,11 @@ public class DishesGroupProvider extends BaseNodeProvider {
public void convert(@NotNull BaseViewHolder baseViewHolder, BaseNode baseNode) { public void convert(@NotNull BaseViewHolder baseViewHolder, BaseNode baseNode) {
DishesGroupNode entity = (DishesGroupNode) baseNode; DishesGroupNode entity = (DishesGroupNode) baseNode;
baseViewHolder.setText(R.id.tv_dishes_group_title, entity.getFoodName()); baseViewHolder.setText(R.id.tv_dishes_group_title, entity.getFoodName());
if (entity.isExpanded()) {
baseViewHolder.setImageResource(R.id.iv_dishes_group_icon, R.drawable.ic_dishes_up);
} else {
baseViewHolder.setImageResource(R.id.iv_dishes_group_icon, R.drawable.ic_dishes_down); baseViewHolder.setImageResource(R.id.iv_dishes_group_icon, R.drawable.ic_dishes_down);
}
setArrowSpin(baseViewHolder, baseNode, false); setArrowSpin(baseViewHolder, baseNode, false);
} }
......
...@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.ui.adapter.dishes; ...@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.ui.adapter.dishes;
import com.chad.library.adapter.base.BaseNodeAdapter; import com.chad.library.adapter.base.BaseNodeAdapter;
import com.chad.library.adapter.base.entity.node.BaseNode; import com.chad.library.adapter.base.entity.node.BaseNode;
import com.gingersoft.supply_chain.R;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
...@@ -14,7 +15,7 @@ public class DishesTreeAdapter extends BaseNodeAdapter { ...@@ -14,7 +15,7 @@ public class DishesTreeAdapter extends BaseNodeAdapter {
super(); super();
addNodeProvider(new DishesGroupProvider()); addNodeProvider(new DishesGroupProvider());
addNodeProvider(new DishProvider()); addNodeProvider(new DishProvider());
addChildClickViewIds(R.id.tv_dish_title);
} }
@Override @Override
protected int getItemType(@NotNull List<? extends BaseNode> list, int i) { protected int getItemType(@NotNull List<? extends BaseNode> list, int i) {
......
...@@ -11,6 +11,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; ...@@ -11,6 +11,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.entity.node.BaseNode; import com.chad.library.adapter.base.entity.node.BaseNode;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerDishesComponent; import com.gingersoft.supply_chain.di.component.DaggerDishesComponent;
...@@ -21,11 +22,9 @@ import com.gingersoft.supply_chain.mvp.presenter.DishesPresenter; ...@@ -21,11 +22,9 @@ import com.gingersoft.supply_chain.mvp.presenter.DishesPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.dishes.DishNode; import com.gingersoft.supply_chain.mvp.ui.adapter.dishes.DishNode;
import com.gingersoft.supply_chain.mvp.ui.adapter.dishes.DishesGroupNode; import com.gingersoft.supply_chain.mvp.ui.adapter.dishes.DishesGroupNode;
import com.gingersoft.supply_chain.mvp.ui.adapter.dishes.DishesTreeAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.dishes.DishesTreeAdapter;
import com.gingersoft.supply_chain.mvp.ui.widget.CenterLayoutManager;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
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;
...@@ -74,33 +73,25 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp ...@@ -74,33 +73,25 @@ public class DishesFragment extends BaseSupplyChainFragment<DishesPresenter> imp
} }
private void initDishes( List<DishesGroupNode> dishesGroupNodes){ private void initDishes( List<DishesGroupNode> dishesGroupNodes){
DishesTreeAdapter dishesTreeAdapter = new DishesTreeAdapter(); final DishesTreeAdapter dishesTreeAdapter = new DishesTreeAdapter();
dishesTreeAdapter.setOnItemChildClickListener((adapter, view, position) -> {
BaseNode baseNode= dishesTreeAdapter.getItem(position);
if (baseNode instanceof DishesGroupNode) {
DishesGroupNode groupNode= (DishesGroupNode) baseNode;
LogUtil.e("ZJS"," groupNode position="+position +" getFoodName"+ groupNode.getFoodName());
}else {
DishNode dishNode= (DishNode) baseNode;
LogUtil.e("ZJS"," onItemChildClick position="+position +" getFoodName"+ dishNode.getFoodName());
}
LogUtil.e("ZJS"," onItemChildClick position="+position );
});
dishesTreeAdapter.setList(dishesGroupNodes); dishesTreeAdapter.setList(dishesGroupNodes);
rvDishesGroup.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)); rvDishesGroup.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false));
rvDishesGroup.setAdapter(dishesTreeAdapter); rvDishesGroup.setAdapter(dishesTreeAdapter);
} }
private List<BaseNode> getEntity() {
List<BaseNode> list = new ArrayList<>();
for (int i = 0; i < 5; i++) {
List<BaseNode> secondNodeList = new ArrayList<>();
for (int n = 0; n <= 3; n++) {
DishNode seNode = new DishNode(secondNodeList);
secondNodeList.add(seNode);
}
DishesGroupNode entity = new DishesGroupNode(secondNodeList);
// 模拟 默认第0个是展开的
entity.setExpanded(i == 0);
list.add(entity);
}
return list;
}
@Override @Override
public void loadDishGroupInfo( List<DishesGroupNode> dishGroup) { public void loadDishGroupInfo( List<DishesGroupNode> dishGroup) {
initDishes(dishGroup); initDishes(dishGroup);
......
...@@ -171,7 +171,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -171,7 +171,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
@Override @Override
public void initAdapter() { public void initAdapter() {
infoMultiAdapter = new InfoMultiAdapter(mContext, mPresenter.getFragmentInfo(mContext, (v, hasFocus) -> { infoMultiAdapter = new InfoMultiAdapter(mContext, mPresenter.getFragmentInfo(mContext, (v, hasFocus) -> {
LogUtil.e("zjs"," initAdapter currentThread "+v.isPressed()+" hasFocus__"+v.hasFocus()+" hasFocus=="+hasFocus); // LogUtil.e("zjs"," initAdapter currentThread "+v.isPressed()+" hasFocus__"+v.hasFocus()+" hasFocus=="+hasFocus);
if (hasFocus && purchaseFoodBean != null && purchaseFoodBean.getUnitPrice()>0) { if (hasFocus && purchaseFoodBean != null && purchaseFoodBean.getUnitPrice()>0) {
InfoMultiBean infoMultiBean = infoMultiAdapter.getItem(12); InfoMultiBean infoMultiBean = infoMultiAdapter.getItem(12);
infoMultiBean.setShowValue(""); infoMultiBean.setShowValue("");
......
...@@ -100,5 +100,5 @@ ...@@ -100,5 +100,5 @@
<string name="str_order_del_contact_supplier">訂單已刪除,請打電話聯繫供應商訂單刪除!</string> <string name="str_order_del_contact_supplier">訂單已刪除,請打電話聯繫供應商訂單刪除!</string>
<string name="str_order_num">單號:%1$s</string> <string name="str_order_num">單號:%1$s</string>
<string name="str_dishes">菜单</string> <string name="str_dishes">成品管理</string>
</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