Browse Source

修改基础数据滚动刷新

调味吧台
liup 7 months ago
parent
commit
a1e3f23a29
11 changed files with 479 additions and 144 deletions
  1. +1
    -1
      .idea/deploymentTargetSelector.xml
  2. +39
    -13
      app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java
  3. +166
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/AttributeSetAdapter.java
  4. +93
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/MaterialSetAdapter.java
  5. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/zsx_adapter.java
  6. +53
    -17
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_sxgl_fragment.java
  7. +23
    -12
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_wl_fragment.java
  8. +90
    -94
      app/src/main/res/layout/datatab/layout/sx_item.xml
  9. +9
    -4
      app/src/main/res/layout/datatab/layout/wl_item.xml
  10. +2
    -1
      app/src/main/res/layout/fragment_jcsjgl_sxgl.xml
  11. +2
    -1
      app/src/main/res/layout/fragment_jcsjgl_wl.xml

+ 1
- 1
.idea/deploymentTargetSelector.xml View File

@@ -4,7 +4,7 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-05-21T07:39:43.054726300Z">
<DropdownSelection timestamp="2024-05-21T09:01:34.719952400Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=74bb378d" />


+ 39
- 13
app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java View File

@@ -130,14 +130,26 @@ public class APIService {
QueryDB.AddGoodsProperty(bpa_goodproperty);

//子属性添加
goodProperty.goodsAttributeValueList.forEach(attributeValue->{
BPA_GOODPROPERTY bpa_goodpropertySub = new BPA_GOODPROPERTY();
bpa_goodpropertySub.name = attributeValue.attributeValue;
bpa_goodpropertySub.parentid = goodProperty.goodsAttributeId;
bpa_goodpropertySub.id = attributeValue.goodsAttributeValueId;
bpa_goodproperty.userID="超级管理员";
QueryDB.AddGoodsProperty(bpa_goodpropertySub);
});
if(goodProperty.goodsAttributeValueList!=null){
for(int i=0;i<goodProperty.goodsAttributeValueList.size();i++){
BPA_GOODPROPERTY bpa_goodpropertySub = new BPA_GOODPROPERTY();
bpa_goodpropertySub.name = goodProperty.goodsAttributeValueList.get(i).attributeValue;
bpa_goodpropertySub.parentid = goodProperty.goodsAttributeId;
bpa_goodpropertySub.id = goodProperty.goodsAttributeValueList.get(i).goodsAttributeValueId;
bpa_goodpropertySub.sort = i+1;
bpa_goodproperty.userID="超级管理员";
QueryDB.AddGoodsProperty(bpa_goodpropertySub);
}
}

// goodProperty.goodsAttributeValueList.forEach(attributeValue->{
// BPA_GOODPROPERTY bpa_goodpropertySub = new BPA_GOODPROPERTY();
// bpa_goodpropertySub.name = attributeValue.attributeValue;
// bpa_goodpropertySub.parentid = goodProperty.goodsAttributeId;
// bpa_goodpropertySub.id = attributeValue.goodsAttributeValueId;
// bpa_goodproperty.userID="超级管理员";
// QueryDB.AddGoodsProperty(bpa_goodpropertySub);
// });
}) ;
}

@@ -148,19 +160,33 @@ public class APIService {
*/
private static void GoodInfoSynchronous(DeviceGoodInfo item,List<BPA_GOODS> goods){
if(item.goodsInfoList!=null){
item.goodsInfoList.forEach(goodinfo->{
for(int i=0;i<item.goodsInfoList.size();i++){
BPA_GOODS bpa_goods =new BPA_GOODS();
bpa_goods.id = goodinfo.goodsId;
bpa_goods.name = goodinfo.goodsName;
bpa_goods.materialids = getMaterialids(goodinfo);
bpa_goods.id = item.goodsInfoList.get(i).goodsId;
bpa_goods.name = item.goodsInfoList.get(i).goodsName;
bpa_goods.materialids = getMaterialids(item.goodsInfoList.get(i));
bpa_goods.goodtype=item.goodsTypeId;
bpa_goods.status=1;
bpa_goods.issc=1;
bpa_goods.maketime=180;
bpa_goods.url="";
bpa_goods.sort= i+1;
bpa_goods.foreignKeyRe="";
QueryDB.AddGoods(bpa_goods);
});
}
// item.goodsInfoList.forEach(goodinfo->{
// BPA_GOODS bpa_goods =new BPA_GOODS();
// bpa_goods.id = goodinfo.goodsId;
// bpa_goods.name = goodinfo.goodsName;
// bpa_goods.materialids = getMaterialids(goodinfo);
// bpa_goods.goodtype=item.goodsTypeId;
// bpa_goods.status=1;
// bpa_goods.issc=1;
// bpa_goods.maketime=180;
// bpa_goods.url="";
// bpa_goods.foreignKeyRe="";
// QueryDB.AddGoods(bpa_goods);
// });
}
}



+ 166
- 0
app/src/main/java/com/bonait/bnframework/modules/home/adapter/AttributeSetAdapter.java View File

@@ -0,0 +1,166 @@
package com.bonait.bnframework.modules.home.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODPROPERTY;
import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.KeyboardUtil;
import com.bonait.bnframework.common.view.MyLayoutManager;

import java.util.ArrayList;
import java.util.List;

/**
* @author: liup
* @description: 基础数据管理 - 属性管理
* @date: 2024/5/21 16:28.
*/
public class AttributeSetAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
/**
* 内部点击事件
*/
private MyClickListener mListener;
private List<BPA_GOODPROPERTY> datas;

private ArrayList<BPA_GOODSTYPE> goodstypes;
private final LayoutInflater mLayoutInflater;
private Context context;
public AttributeSetAdapter(@NonNull Context context, @NonNull List<BPA_GOODPROPERTY> objects, ArrayList<BPA_GOODSTYPE> bpa_goodstypes, MyClickListener listener) {
mListener = listener;
datas=objects;
this.context=context;
goodstypes=bpa_goodstypes;
mLayoutInflater = LayoutInflater.from(context);
}

@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = mLayoutInflater.inflate(R.layout.sx_item, parent, false);
return new MyLCViewHolder1(inflate);

}

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
MyLCViewHolder1 myLCViewHolder1 = (MyLCViewHolder1) holder;
BPA_GOODPROPERTY bpa_goodproperty = (BPA_GOODPROPERTY) datas.get(position);//得到当前项选中item实例
myLCViewHolder1.root.setOnClickListener(KeyboardUtil::hideKeyboard);

ArrayList<BPA_GOODPROPERTY> zsx= QueryDB.GetGoodsPropertyALL(bpa_goodproperty.id);
MyLayoutManager layout = new MyLayoutManager();
layout.setAutoMeasureEnabled(true);
myLCViewHolder1.recyclerView.setLayoutManager(layout);
zsx_adapter zsxadapter = new zsx_adapter(position,context,zsx,mListener);
myLCViewHolder1.recyclerView.setAdapter(zsxadapter);



// 设置要显示的图片和文字
myLCViewHolder1.name.setText(bpa_goodproperty.name);
myLCViewHolder1.sort.setText(bpa_goodproperty.sort+"");

myLCViewHolder1.typeS.setText(GetName(bpa_goodproperty.GoodsTypeId));
myLCViewHolder1.name.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
}
});

myLCViewHolder1.sort.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
}
});

myLCViewHolder1.typeS.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
}
});

myLCViewHolder1.button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
}
});

myLCViewHolder1.button_add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
}
});
}

public String GetName(String ids)
{
String name="";
if(ids==null || ids.isEmpty())
{
return "";
}
for (BPA_GOODSTYPE item:goodstypes)
{
if(ids.contains(item.id))
{
name+=item.name+",";
}
}

if(!name.isEmpty())
{
name=name.substring(0, name.length() - 1);
}

return name;
}

@Override
public int getItemCount() {
return datas.size();
}

public static class MyLCViewHolder1 extends RecyclerView.ViewHolder{
LinearLayout root ;
TextView name ;//属性名称
TextView sort ;//排序
TextView typeS ;//排序

ImageView button ;//删除
ImageView button_add ;//增加 子属性

RecyclerView recyclerView;
public MyLCViewHolder1(@NonNull View view) {
super(view);
root = view.findViewById(R.id.root);
name = view.findViewById(R.id.name);//属性名称
sort = view.findViewById(R.id.sort);//排序
typeS = view.findViewById(R.id.typeS);//排序

button = view.findViewById(R.id.button_item);//删除
button_add = view.findViewById(R.id.button_add);//增加 子属性

recyclerView=view.findViewById(R.id.recycler_view);
}
}
}

+ 93
- 0
app/src/main/java/com/bonait/bnframework/modules/home/adapter/MaterialSetAdapter.java View File

@@ -0,0 +1,93 @@
package com.bonait.bnframework.modules.home.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.helper.I.MyClickListener;

import java.util.List;

/**
* @author: liup
* @description: 基础数据管理 - 物料管理
* @date: 2024/5/21 16:19.
*/
public class MaterialSetAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
/**
* 内部点击事件
*/
private MyClickListener mListener;
private List<BPA_MATERIAL> datas;
private final LayoutInflater mLayoutInflater;
public MaterialSetAdapter(@NonNull Context context, @NonNull List<BPA_MATERIAL> objects, MyClickListener listener) {
mListener = listener;
datas=objects;
mLayoutInflater = LayoutInflater.from(context);
}

@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = mLayoutInflater.inflate(R.layout.wl_item, parent, false);
return new MyLCViewHolder1(inflate);

}

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
BPA_MATERIAL bpa_material = (BPA_MATERIAL) datas.get(position);//得到当前项选中item实例
//为每一个子项加载设定的布局
MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder;

// 设置要显示的图片和文字
myViewHolder.name.setText(bpa_material.name);
myViewHolder.name.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_material);
}
});

myViewHolder.button_update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_material);
}
});

myViewHolder.button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_material);
}
});
}

@Override
public int getItemCount() {
return datas.size();
}

public static class MyLCViewHolder1 extends RecyclerView.ViewHolder{
TextView name ;
RelativeLayout button ;
RelativeLayout button_update ;

public MyLCViewHolder1(@NonNull View view) {
super(view);
name = view.findViewById(R.id.name);
button = view.findViewById(R.id.button_item);
button_update = view.findViewById(R.id.button_update);
}
}
}

+ 1
- 1
app/src/main/java/com/bonait/bnframework/modules/home/adapter/zsx_adapter.java View File

@@ -68,7 +68,7 @@ public class zsx_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder;
myViewHolder.root.setOnClickListener(KeyboardUtil::hideKeyboard);
myViewHolder.edittext.setText(goodproperty.name+"");
myViewHolder.edittext_wj.setText(goodproperty.foreignKeyRe+"");
myViewHolder.edittext_wj.setText(goodproperty.foreignKeyRe==null?"":goodproperty.foreignKeyRe);
myViewHolder.edittext_px.setText(goodproperty.sort+"");
myViewHolder.save_text.setOnClickListener(new View.OnClickListener() {
@Override


+ 53
- 17
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_sxgl_fragment.java View File

@@ -2,6 +2,7 @@ package com.bonait.bnframework.modules.home.fragment.from.fragment;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Context;
import android.content.DialogInterface;
@@ -25,6 +26,7 @@ import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.KeyboardUtil;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.AttributeSetAdapter;
import com.bonait.bnframework.modules.home.adapter.sx_adapter;
import com.orhanobut.logger.Logger;
import com.qmuiteam.qmui.widget.QMUIWindowInsetLayout;
@@ -42,7 +44,7 @@ import butterknife.OnClick;
public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickListener

@BindView(R.id.datatab_sx)
ListView datatab_sx;
RecyclerView datatab_sx;
@BindView(R.id.root)
QMUIWindowInsetLayout root;
/**
@@ -120,7 +122,15 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
bpa_goodproperty.userID = ConfigName.getInstance().user.userID;
QueryDB.AddGoodsProperty(bpa_goodproperty);
ToastUtils.info("新增成功");
Initdata_sx(bpa_goodproperties.size());
// Initdata_sx(bpa_goodproperties.size());
bpa_goodproperties.add(bpa_goodproperty);
datatab_sx.getAdapter().notifyItemChanged(bpa_goodproperties.size()-1);
datatab_sx.postDelayed(new Runnable() {
@Override
public void run() {
datatab_sx.scrollToPosition(bpa_goodproperties.size()-1);
}
},100);
KeyboardUtil.hideKeyboard(builder_add.getEditText());
dialog.dismiss();
} else {
@@ -166,7 +176,11 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
return;
}
QueryDB.UpdateGoodsPropertyName(((BPA_GOODPROPERTY) data).id, text.toString());
Initdata_sx(k);
// Initdata_sx(k);
BPA_GOODPROPERTY bean = (BPA_GOODPROPERTY) data;
bean.name = text.toString();
bpa_goodproperties.set(k,bean);
datatab_sx.getAdapter().notifyItemChanged(k);
KeyboardUtil.hideKeyboard(builder.getEditText());
dialog.dismiss();
} else {
@@ -196,7 +210,11 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
CharSequence text = builder1.getEditText().getText();
if (text != null && text.length() > 0) {
QueryDB.UpdateGoodsPropertySort(((BPA_GOODPROPERTY) data).id, Integer.parseInt(text.toString()));
Initdata_sx(k);
BPA_GOODPROPERTY bean = (BPA_GOODPROPERTY) data;
bean.sort = Integer.parseInt(text.toString());
// Initdata_sx(k);
bpa_goodproperties.set(k,bean);
datatab_sx.getAdapter().notifyItemChanged(k);
KeyboardUtil.hideKeyboard(v);
dialog.dismiss();
} else {
@@ -262,7 +280,11 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
result=result.substring(0, result.length() - 1);
}
QueryDB.UpdateGoodsPropertyType(((BPA_GOODPROPERTY) data).id, result);
Initdata_sx(k);
BPA_GOODPROPERTY bean = (BPA_GOODPROPERTY) data;
bean.GoodsTypeId = result;
bpa_goodproperties.set(k,bean);
datatab_sx.getAdapter().notifyItemChanged(k);
// Initdata_sx(k);
KeyboardUtil.hideKeyboard(v);
dialog.dismiss();
}
@@ -287,7 +309,10 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
QueryDB.DeleteGoodsProperty(item);
}
QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data);
Initdata_sx(k);
// Initdata_sx(k);
bpa_goodproperties.remove(k);
datatab_sx.getAdapter().notifyDataSetChanged();
datatab_sx.scrollToPosition(k-1);
ToastUtils.info("删除成功");
KeyboardUtil.hideKeyboard(v);
dialog.dismiss();
@@ -306,14 +331,17 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
bpa_goodproperty.userID = ConfigName.getInstance().user.userID;
QueryDB.AddGoodsProperty(bpa_goodproperty);
ToastUtils.info("新增成功");
Initdata_sx(k);
// Initdata_sx(k);

datatab_sx.getAdapter().notifyItemChanged(k);
KeyboardUtil.hideKeyboard(v);
break;

case R.id.save_text://保存属性
QueryDB.UpdateGoodsProperty((BPA_GOODPROPERTY) data);
ToastUtils.info("保存成功");
Initdata_sx(k);
// Initdata_sx(k);
datatab_sx.getAdapter().notifyItemChanged(k);
KeyboardUtil.hideKeyboard(v);
break;
case R.id.delete_text://删除
@@ -329,7 +357,8 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
}
}
QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data);
Initdata_sx(k);
// Initdata_sx(k);
datatab_sx.getAdapter().notifyItemChanged(k);
ToastUtils.info("删除成功");
KeyboardUtil.hideKeyboard(v);
dialog.dismiss();
@@ -363,15 +392,22 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
try {

bpa_goodproperties = QueryDB.GetGoodsPropertyALL("0");
sx_adapter adapter = new sx_adapter(context, R.layout.sx_item, bpa_goodproperties, bpa_goodstypes,listener);
AttributeSetAdapter adapter = new AttributeSetAdapter(context, bpa_goodproperties, bpa_goodstypes,listener);
datatab_sx.setAdapter(adapter);
if(position>0){
if(position>=bpa_goodproperties.size()-1){
datatab_sx.smoothScrollToPosition(bpa_goodproperties.size()-1);
}else {
datatab_sx.smoothScrollToPosition(position);
}
}
adapter.notifyDataSetChanged();
// datatab_sx.postDelayed(new Runnable() {
// @Override
// public void run() {
// if(position>0){
// if(position>=bpa_goodproperties.size()-1){
// datatab_sx.smoothScrollToPosition(bpa_goodproperties.size()-1);
// }else {
// datatab_sx.smoothScrollToPosition(position);
// }
// }
// }
// },500);

} catch (Exception e) {

}


+ 23
- 12
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_wl_fragment.java View File

@@ -3,6 +3,7 @@ package com.bonait.bnframework.modules.home.fragment.from.fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import android.annotation.SuppressLint;
import android.content.Context;
@@ -35,6 +36,7 @@ import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.KeyboardUtil;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.MaterialSetAdapter;
import com.bonait.bnframework.modules.home.adapter.wl_adapter;
import com.orhanobut.logger.Logger;
import com.qmuiteam.qmui.widget.QMUIWindowInsetLayout;
@@ -54,7 +56,7 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
@BindView(R.id.add_wl)
Button add_wl;
@BindView(R.id.datatab_wl)
ListView datatab_wl;
RecyclerView datatab_wl;
@BindView(R.id.root)
QMUIWindowInsetLayout root;
/**
@@ -127,7 +129,15 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
bpa_material.userID = ConfigName.getInstance().user.userID;
QueryDB.AddMaterial(bpa_material);
ToastUtils.info("新增成功");
Initdata_wl(bpa_materials.size());
// Initdata_wl(bpa_materials.size());
bpa_materials.add(bpa_material);
datatab_wl.getAdapter().notifyItemChanged(bpa_materials.size()-1);
datatab_wl.postDelayed(new Runnable() {
@Override
public void run() {
datatab_wl.scrollToPosition(bpa_materials.size()-1);
}
},100);
KeyboardUtil.hideKeyboard(builder_add.getEditText());
dialog.dismiss();
} else {
@@ -183,15 +193,9 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
public void Initdata_wl(int position) {
try {
bpa_materials = QueryDB.GetMaterialALL();
wl_adapter adapter = new wl_adapter(context, R.layout.wl_item, bpa_materials, listener);
MaterialSetAdapter adapter = new MaterialSetAdapter(context, bpa_materials, listener);
datatab_wl.setAdapter(adapter);
if(position>0){
if(position>=bpa_materials.size()-1){
datatab_wl.smoothScrollToPosition(bpa_materials.size()-1);
}else {
datatab_wl.smoothScrollToPosition(position);
}
}
adapter.notifyDataSetChanged();
} catch (Exception e) {

}
@@ -255,7 +259,11 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
return;
}
QueryDB.UpdateMaterialName(((BPA_MATERIAL) data).id, text.toString());
Initdata_wl(k);
// Initdata_wl(k);
BPA_MATERIAL bean = (BPA_MATERIAL) data;
bean.name = text.toString();
bpa_materials.set(k,bean);
datatab_wl.getAdapter().notifyItemChanged(k);
ToastUtils.info("修改成功");
dialog.dismiss();
} else {
@@ -273,7 +281,10 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
@Override
public void onClick(QMUIDialog dialog, int index) {
QueryDB.DeleteMaterial((BPA_MATERIAL) data);
Initdata_wl(k-1);
// Initdata_wl(k-1);
bpa_materials.remove(k);
datatab_wl.getAdapter().notifyDataSetChanged();
datatab_wl.scrollToPosition(k-1);
ToastUtils.info("删除成功");
dialog.dismiss();
}


+ 90
- 94
app/src/main/res/layout/datatab/layout/sx_item.xml View File

@@ -1,121 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/root"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.android.com/apk/res/android ">

<LinearLayout
<TableLayout
android:background="@color/main_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableLayout
android:background="@color/main_background"
android:layout_width="match_parent"
android:gravity="center"
android:layout_gravity="center"
android:stretchColumns="0">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:stretchColumns="0">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
android:gravity="center_horizontal">

<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_alignParentLeft="true"
android:text="回锅肉"
android:textAlignment="center"
android:textSize="13dp"/>
</RelativeLayout>
<TextView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_alignParentLeft="true"
android:text="回锅肉"
android:textAlignment="center"
android:textSize="13dp"/>
</RelativeLayout>
<RelativeLayout
android:background="@drawable/border"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/typeS"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="小类"
android:textAlignment="center"
android:textSize="13dp" />
</RelativeLayout>
<RelativeLayout
android:background="@drawable/border"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/sort"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="排序"
android:textAlignment="center"
android:textSize="13dp" />
</RelativeLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/border">
<RelativeLayout
android:background="@drawable/border"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/typeS"
<ImageView
android:id="@+id/button_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="小类"
android:textAlignment="center"
android:textSize="13dp" />
android:layout_centerInParent="true"
android:src="@mipmap/new_delete" />
</RelativeLayout>
<RelativeLayout
android:background="@drawable/border"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:id="@+id/sort"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/border">
<ImageView
android:layout_centerInParent="true"
android:id="@+id/button_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="排序"
android:textAlignment="center"
android:textSize="13dp" />
android:src="@mipmap/new_add"/>
</RelativeLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/border">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<ImageView
android:id="@+id/button_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/new_delete" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/border">
<ImageView
android:layout_centerInParent="true"
android:id="@+id/button_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@mipmap/new_add"/>
</RelativeLayout>
</LinearLayout>

</LinearLayout>
</TableRow>
</TableLayout>

</TableRow>
</TableLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>

</RelativeLayout>
</LinearLayout>

+ 9
- 4
app/src/main/res/layout/datatab/layout/wl_item.xml View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.android.com/apk/res/android ">

@@ -85,4 +85,9 @@

</TableRow>
</TableLayout>
</RelativeLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/black_50p"
/>
</LinearLayout>

+ 2
- 1
app/src/main/res/layout/fragment_jcsjgl_sxgl.xml View File

@@ -148,9 +148,10 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/datatab_sx"
android:layout_width="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_height="match_parent" />
</RelativeLayout>
</LinearLayout>


+ 2
- 1
app/src/main/res/layout/fragment_jcsjgl_wl.xml View File

@@ -159,10 +159,11 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/datatab_wl"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
/>

<!-- android:layout_marginTop="3dp"-->


Loading…
Cancel
Save