@@ -47,9 +47,17 @@ | |||
android:launchMode="singleTask" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".ui.activity.EditClassifyActivity" | |||
android:name=".ui.activity.GoodEditClassifyFragment" | |||
tools:ignore="Instantiatable" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".ui.activity.EditClassifyTabActivity" | |||
android:launchMode="singleTask" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".ui.activity.PropEditClassifyFragment" | |||
tools:ignore="Instantiatable" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".modules.home.fragment.from.fragment.AutoTestMoreFragment" | |||
android:exported="false" | |||
@@ -32,8 +32,8 @@ import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; | |||
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.DBListDataUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.helper.ConfigUtil; | |||
@@ -417,7 +417,7 @@ public class ConfigData { | |||
DBListDataUtil.addGOODSList(rd.goods); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_CLASSIFY.class,null); | |||
GoodsClassifyDBUtil.addList(rd.classifies); | |||
PropClassifyDBUtil.addList(rd.classifies); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ATTRIBUTE.class,null); | |||
AttributeDBUtil.addList(rd.attributes); | |||
@@ -90,7 +90,7 @@ public class RecordManager { | |||
order.groupName = group.name; | |||
order.groupId = group.id; | |||
order.goodsName = goods.name; | |||
order.classifyId = goods.classifyId; | |||
order.classifyId = goods.propClassifyId; | |||
order.goodsId = goods.id; | |||
switch (type){ | |||
case "完成": | |||
@@ -4,7 +4,6 @@ import android.content.ContentValues; | |||
import android.database.Cursor; | |||
import android.database.sqlite.SQLiteDatabase; | |||
import android.util.Log; | |||
import android.widget.TableRow; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
@@ -16,14 +15,12 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.mode.BPA_LOG_RECORD; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG; | |||
import com.bonait.bnframework.common.db.mode.BPA_CRAFT; | |||
import com.bonait.bnframework.common.db.mode.BPA_CRAFTPROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_LOG; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_MENU; | |||
import com.bonait.bnframework.common.db.mode.BPA_MENUANDUSER; | |||
import com.bonait.bnframework.common.db.mode.BPA_ORDER; | |||
@@ -34,6 +31,7 @@ import com.bonait.bnframework.common.db.mode.BPA_ORDER_RECORD; | |||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE; | |||
@@ -50,7 +48,6 @@ import com.bonait.bnframework.common.db.res.ResLog; | |||
import com.bonait.bnframework.common.db.res.ResSilosMode; | |||
import com.bonait.bnframework.common.db.res.ResSubOrder; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import com.bonait.bnframework.common.utils.PreferenceUtils; | |||
import java.lang.reflect.Field; | |||
import java.text.SimpleDateFormat; | |||
@@ -2736,7 +2733,7 @@ public class QueryDB { | |||
((BPA_GOODS) data).sort = cursor.getInt((int) cursor.getColumnIndex("sort")); | |||
((BPA_GOODS) data).status = cursor.getInt((int) cursor.getColumnIndex("status")); | |||
((BPA_GOODS) data).url = cursor.getString((int) cursor.getColumnIndex("url")); | |||
((BPA_GOODS) data).classifyId = cursor.getString((int) cursor.getColumnIndex("classifyId")); | |||
((BPA_GOODS) data).propClassifyId = cursor.getString((int) cursor.getColumnIndex("classifyId")); | |||
((BPA_GOODS) data).isCollect = cursor.getInt((int) cursor.getColumnIndex("isCollect")); | |||
break; | |||
@@ -2952,6 +2949,12 @@ public class QueryDB { | |||
((BPA_GOODS_CLASSIFY) data).name = cursor.getString((int) cursor.getColumnIndex("name")); | |||
((BPA_GOODS_CLASSIFY) data).state = cursor.getInt((int) cursor.getColumnIndex("state")); | |||
break; | |||
case "BPA_PROPERTY_CLASSIFY": | |||
data = new BPA_PROPERTY_CLASSIFY(); | |||
//私有 | |||
((BPA_PROPERTY_CLASSIFY) data).name = cursor.getString((int) cursor.getColumnIndex("name")); | |||
((BPA_PROPERTY_CLASSIFY) data).state = cursor.getInt((int) cursor.getColumnIndex("state")); | |||
break; | |||
case "BPA_GOODS_SUBATTRIBUTE_GROUP": | |||
data = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
//私有 | |||
@@ -30,6 +30,7 @@ import com.bonait.bnframework.common.db.mode.BPA_ORDER_RECORD; | |||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE; | |||
@@ -147,6 +148,7 @@ public class DBHelper extends SQLiteOpenHelper { | |||
CreateTablesAll(BPA_ORDER_RECORD.class,null);//子属性 | |||
CreateTablesAll(BPA_LOG_RECORD.class,null);//子属性 | |||
CreateTablesAll(BPA_ORDER_LIST.class,null);//子属性 | |||
CreateTablesAll(BPA_PROPERTY_CLASSIFY.class,null);//属性分类表 | |||
ForeignKeys(); | |||
} | |||
/** | |||
@@ -11,7 +11,7 @@ public class BPA_ATTRIBUTE extends ModeBase { | |||
*/ | |||
public int sort; | |||
/** | |||
* 分类id | |||
* 属性分类id | |||
*/ | |||
public String classifyId; | |||
/** | |||
@@ -26,10 +26,15 @@ public class BPA_GOODS extends ModeBase { | |||
* 是否收藏 0 未收藏 1 收藏 | |||
*/ | |||
public int isCollect; | |||
/** | |||
* 属性分类id | |||
*/ | |||
public String propClassifyId; | |||
/** | |||
* 商品分类id | |||
*/ | |||
public String classifyId; | |||
public String goodClassifyid; | |||
@Override | |||
public String toString() { | |||
@@ -40,7 +45,7 @@ public class BPA_GOODS extends ModeBase { | |||
", sort=" + sort + | |||
", status=" + status + | |||
", isCollect=" + isCollect + | |||
", classifyId='" + classifyId + '\'' + | |||
", classifyId='" + propClassifyId + '\'' + | |||
'}'; | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.bonait.bnframework.common.db.mode; | |||
/** | |||
* 属性分类表 | |||
*/ | |||
public class BPA_PROPERTY_CLASSIFY extends ModeBase { | |||
/** | |||
* 属性分类名称 | |||
*/ | |||
public String name; | |||
/** | |||
* 状态 | |||
*/ | |||
public int state; | |||
@Override | |||
public String toString() { | |||
return "BPA_GOODS_CLASSIFY{" + | |||
"name='" + name + '\'' + | |||
", state=" + state + | |||
", id=" + id + | |||
'}'; | |||
} | |||
} |
@@ -0,0 +1,238 @@ | |||
package com.bonait.bnframework.common.db.util; | |||
import android.content.ContentValues; | |||
import android.database.sqlite.SQLiteDatabase; | |||
import android.util.Log; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author: liup | |||
* @description: 属性分类数据库操作 | |||
* @date: 2024/5/8 9:07. | |||
*/ | |||
public class PropClassifyDBUtil { | |||
/** | |||
* 新增属性分类数据 | |||
* | |||
* @param data 属性分类数据 | |||
* @return 是否成功 | |||
*/ | |||
public static boolean add(BPA_PROPERTY_CLASSIFY data) { | |||
return QueryDB.Add(BPA_PROPERTY_CLASSIFY.class, data); | |||
} | |||
/** | |||
* 批量新增 | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addList( List<BPA_PROPERTY_CLASSIFY> list) { | |||
if(list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
try { | |||
long insert=-1; | |||
db.beginTransaction(); | |||
for(int i = 0; i < list.size(); i++){ | |||
ContentValues cv = new ContentValues(); | |||
Map<String, Object> map = Tools.getObjValue(list.get(i)); | |||
if (map.get("id").toString().isEmpty()) | |||
return false; | |||
for (String key : map.keySet()) { | |||
Object value = map.get(key); | |||
if (value instanceof String) { | |||
cv.put(key, (String) value); | |||
} else if (value instanceof Integer) { | |||
cv.put(key, ((Integer) value).intValue()); | |||
} else if (value instanceof Double) { | |||
cv.put(key, ((Double) value).doubleValue()); | |||
} else if (value instanceof Float) { | |||
cv.put(key, ((Float) value).floatValue()); | |||
} else if (value instanceof Long) { | |||
cv.put(key, ((Long) value).longValue()); | |||
} else if (value instanceof Boolean) { | |||
cv.put(key, ((Boolean) value).booleanValue()); | |||
} | |||
} | |||
insert = db.insertOrThrow(BPA_PROPERTY_CLASSIFY.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 修改属性分类数据 | |||
* | |||
* @param data | |||
*/ | |||
public static void update(BPA_PROPERTY_CLASSIFY data) { | |||
QueryDB.Update(BPA_PROPERTY_CLASSIFY.class, data); | |||
} | |||
/** | |||
* 删除属性分类数据 | |||
* | |||
* @param data 属性分类数据 | |||
* @return 是否成功 | |||
*/ | |||
public static boolean delete(BPA_PROPERTY_CLASSIFY data) { | |||
return QueryDB.Delete(BPA_PROPERTY_CLASSIFY.class, data.id); | |||
} | |||
/** | |||
* 删除 | |||
* | |||
* @return | |||
*/ | |||
public static boolean DeleteList(List<BPA_PROPERTY_CLASSIFY> list) { | |||
if(list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
boolean isSucess = true; | |||
try { | |||
db.beginTransaction(); | |||
for(int i = 0; i < list.size(); i++){ | |||
if(!list.get(i).id.isEmpty()){ | |||
long delete = db.delete(BPA_PROPERTY_CLASSIFY.class.getSimpleName(), "id = ?", | |||
new String[]{list.get(i).id}); | |||
if(delete<=0){ | |||
isSucess = false; | |||
} | |||
} | |||
} | |||
db.setTransactionSuccessful(); | |||
return isSucess; | |||
} catch (Exception e) { | |||
Log.d("删除异常", "删除异常: " + e.getMessage()); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 删除属性分类数据 | |||
* | |||
* @param id 属性分类id | |||
* @return 是否成功 | |||
*/ | |||
public static boolean deleteById(String id) { | |||
BPA_PROPERTY_CLASSIFY bean = getById(id); | |||
if(bean!=null){ | |||
return QueryDB.Delete(BPA_PROPERTY_CLASSIFY.class, bean.id); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 根据属性分类id获取属性分类 | |||
* | |||
* @param id | |||
* @return BPA_PROPERTY_CLASSIFY | |||
*/ | |||
public static BPA_PROPERTY_CLASSIFY getById(String id) { | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and id=?"; | |||
String[] args = new String[]{"0", id}; | |||
ArrayList<Object> obj = QueryDB.Get(BPA_PROPERTY_CLASSIFY.class, where, args, orderby); | |||
return obj.size() > 0 ? (BPA_PROPERTY_CLASSIFY) obj.get(0) : null; | |||
} | |||
/** | |||
* 根据属性分类name获取属性分类 | |||
* | |||
* @param name | |||
* @return BPA_PROPERTY_CLASSIFY | |||
*/ | |||
public static BPA_PROPERTY_CLASSIFY getByName(String name) { | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and name=?"; | |||
String[] args = new String[]{"0", name}; | |||
ArrayList<Object> obj = QueryDB.Get(BPA_PROPERTY_CLASSIFY.class, where, args, orderby); | |||
return obj.size() > 0 ? (BPA_PROPERTY_CLASSIFY) obj.get(0) : null; | |||
} | |||
/** | |||
* 根据属性分类name获取属性分类 | |||
* | |||
* @param name | |||
* @return BPA_PROPERTY_CLASSIFY | |||
*/ | |||
public static ArrayList<BPA_PROPERTY_CLASSIFY> getListByName(String name) { | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and name=?"; | |||
String[] args = new String[]{"0", name}; | |||
ArrayList<BPA_PROPERTY_CLASSIFY> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_PROPERTY_CLASSIFY.class, where, args, orderby); | |||
for(Object bean : obj){ | |||
data.add((BPA_PROPERTY_CLASSIFY) bean); | |||
} | |||
return data; | |||
} | |||
/** | |||
* 根据分类classifyId获取属性分类列表 | |||
* | |||
* @return ArrayList<BPA_PROPERTY_CLASSIFY> | |||
*/ | |||
public static ArrayList<BPA_PROPERTY_CLASSIFY> getAll() { | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? "; | |||
String[] args = new String[]{"0"}; | |||
ArrayList<BPA_PROPERTY_CLASSIFY> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_PROPERTY_CLASSIFY.class, where, args, orderby); | |||
for (Object k : obj) { | |||
data.add((BPA_PROPERTY_CLASSIFY) k); | |||
} | |||
LogUtils.d("getAll 根据分类classifyId获取属性分类列表 data=" + data.toString()); | |||
return data; | |||
} | |||
/** | |||
* 删除所有属性相关的数据 | |||
*/ | |||
public static void deleteAllGoodsData(){ | |||
List<BPA_PROPERTY_CLASSIFY> classifyList = getAll(); | |||
for(BPA_PROPERTY_CLASSIFY classify :classifyList){ | |||
AttributeDBUtil.deleteByClassifyId(classify.id); | |||
GoodsDBUtil.deleteByClassifyId(classify.id); | |||
SubAttributeGroupDBUtil.deleteByClassifyId(classify.id); | |||
SubAttributeDBUtil.deleteByClassifyId(classify.id); | |||
} | |||
} | |||
} |
@@ -12,6 +12,7 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
@@ -21,7 +22,7 @@ import java.util.ArrayList; | |||
public class ReceiveData { | |||
public ArrayList<BPA_GOODS> goods;//商品表 | |||
public ArrayList<BPA_MATERIAL> material;//物料表 | |||
public ArrayList<BPA_GOODS_CLASSIFY> classifies;//商品配方明细表 | |||
public ArrayList<BPA_PROPERTY_CLASSIFY> classifies;//商品配方明细表 | |||
public ArrayList<BPA_ATTRIBUTE> attributes;//商品配方明细表 | |||
public ArrayList<BPA_SUBATTRIBUTE> subattributes;//商品配方明细表 | |||
public ArrayList<BPA_GOODS_SUBATTRIBUTE_GROUP> groups;//商品配方明细表 | |||
@@ -0,0 +1,116 @@ | |||
package com.bonait.bnframework.ui.activity; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import android.view.MenuItem; | |||
import androidx.annotation.Nullable; | |||
import androidx.viewpager.widget.ViewPager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.databinding.ActivityEditClassifyTabBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter; | |||
import com.bonait.bnframework.ui.util.DisplayManager; | |||
import org.greenrobot.eventbus.EventBus; | |||
import butterknife.ButterKnife; | |||
/** | |||
* @author: liup | |||
* @description: 编辑分类 | |||
* @date: 2024/5/6 16:04. | |||
*/ | |||
public class EditClassifyTabActivity extends BaseActivity { | |||
private final static String TAG = "EditClassifyTabActivity 编辑分类 ==> "; | |||
private Context context; | |||
private ActivityEditClassifyTabBinding viewBinding; | |||
private MenuItem menuItem; | |||
private FragmentAdapter fragmentAdapter = null; | |||
@Override | |||
protected void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
viewBinding = ActivityEditClassifyTabBinding.inflate(getLayoutInflater()); | |||
setContentView(viewBinding.getRoot()); | |||
ButterKnife.bind(this); | |||
context = this; | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
Init(); | |||
initTopBar(); | |||
} | |||
private void initTopBar(){ | |||
// viewBinding.topbar.setTitle("编辑分类"); | |||
viewBinding.back.setOnClickListener(v->{ | |||
finishActivity(); | |||
}); | |||
} | |||
private void Init(){ | |||
fragmentAdapter = new FragmentAdapter(getSupportFragmentManager()); | |||
fragmentAdapter.addFragment(new PropEditClassifyFragment()); | |||
fragmentAdapter.addFragment(new GoodEditClassifyFragment()); | |||
viewBinding.viewpager.setAdapter(fragmentAdapter); | |||
viewBinding.viewpager.addOnPageChangeListener(pageChangeListener); | |||
viewBinding.viewpager.setOffscreenPageLimit(2); // 设置viewPager缓存多少个fragment | |||
viewBinding.navigation.setOnNavigationItemSelectedListener((item)->{ | |||
switch (item.getItemId()) { | |||
case R.id.bottom_device_1: | |||
viewBinding.viewpager.setCurrentItem(0); | |||
return true; | |||
case R.id.bottom_device_2: | |||
viewBinding.viewpager.setCurrentItem(1); | |||
return true; | |||
} | |||
return false; | |||
}); | |||
} | |||
/** | |||
* 配置ViewPager监听器,手指滑动监听 | |||
*/ | |||
private ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() { | |||
@Override | |||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |||
MenuItem menuItem = viewBinding.navigation.getMenu().getItem(position); | |||
} | |||
@Override | |||
public void onPageSelected(int position) { | |||
menuItem = viewBinding.navigation.getMenu().getItem(position); | |||
menuItem.setChecked(true); | |||
} | |||
@Override | |||
public void onPageScrollStateChanged(int state) { | |||
} | |||
}; | |||
@Override | |||
protected void doOnBackPressed() { | |||
super.doOnBackPressed(); | |||
finishActivity(); | |||
} | |||
private void finishActivity(){ | |||
setResult(RESULT_OK, null); | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
finish(); | |||
} | |||
@Override | |||
protected String getClassName() { | |||
return "编辑分类页"; | |||
} | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; | |||
} | |||
} |
@@ -0,0 +1,337 @@ | |||
package com.bonait.bnframework.ui.activity; | |||
import android.annotation.SuppressLint; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.widget.AdapterView; | |||
import android.widget.ArrayAdapter; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.RecordManager; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.databinding.DialogAddClassifyBinding; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.databinding.FragmentGoodEditClassifyBinding; | |||
import com.bonait.bnframework.ui.adapter.classify.AttributeAdapter; | |||
import com.bonait.bnframework.ui.adapter.classify.SubattributeAdapter; | |||
import com.bonait.bnframework.ui.util.DisplayManager; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import java.util.ArrayList; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
/** | |||
* @author: liup | |||
* @description: 编辑分类 | |||
* @date: 2024/5/6 16:04. | |||
*/ | |||
public class GoodEditClassifyFragment extends BaseFragment { | |||
private final static String TAG = "EditClassifyActivity 编辑分类 ==> "; | |||
private Context context; | |||
private FragmentGoodEditClassifyBinding viewBinding; | |||
/** | |||
* 下拉列表 | |||
*/ | |||
private ArrayAdapter<String> spinnerAdapter;// | |||
private final Map<String, String> classifyList = new LinkedHashMap<>(); | |||
private final List<String> classifyNameList = new ArrayList<>(); | |||
private boolean isUserClicked = false; | |||
private int classifyPosition = 0;//选中位置 | |||
@Override | |||
protected View onCreateView() { | |||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_good_edit_classify, null); | |||
viewBinding = FragmentGoodEditClassifyBinding.bind(root); | |||
ButterKnife.bind(this, root); | |||
return root; | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
context=getContext(); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
initData(); | |||
initView(); | |||
// EventBus.getDefault().register(this); | |||
} | |||
private void initData(){ | |||
classifyPosition=0; | |||
classifyList.clear(); | |||
classifyList.put(getString(R.string.text_noselect),""); | |||
for(BPA_GOODS_CLASSIFY goodsClassify:GoodsClassifyDBUtil.getAll()){ | |||
classifyList.put(goodsClassify.name,goodsClassify.id); | |||
} | |||
} | |||
/** | |||
* 选中分类名称 | |||
*/ | |||
private void selectClassify(int position){ | |||
classifyPosition = position; | |||
viewBinding.spinnerClassify.setSelection(position); | |||
LogUtils.d(TAG+" viewBinding.spinnerClassify.getSelectedItem().toString()="+viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
if(position>0){ | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
} | |||
} | |||
/** | |||
* 初始化 | |||
* 修改子属性 | |||
* 删除子属性 | |||
*/ | |||
private void initView(){ | |||
//下拉选择 | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter = new ArrayAdapter<>(context, R.layout.spinner_text_item32, classifyNameList); | |||
LogUtils.d(" initView classifyNameList="+classifyNameList); | |||
spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item32); | |||
viewBinding.spinnerClassify.setAdapter(spinnerAdapter); | |||
viewBinding.spinnerClassify.setOnTouchListener(new View.OnTouchListener() { | |||
@Override | |||
public boolean onTouch(View view, MotionEvent motionEvent) { | |||
isUserClicked = true; | |||
view.performClick(); | |||
return false; | |||
} | |||
}); | |||
viewBinding.spinnerClassify.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
if (isUserClicked)//不是用户点击返回 | |||
{ | |||
selectClassify(i); | |||
isUserClicked = false; | |||
} | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
} | |||
@SuppressLint("NonConstantResourceId") | |||
@OnClick({R.id.btn_add_classify,R.id.btn_update_classify,R.id.btn_delete_classify}) | |||
public void onViewClicked(View view) { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast!"); | |||
return; | |||
} | |||
switch (view.getId()){ | |||
case R.id.btn_add_classify://添加分类 | |||
addClassify(); | |||
break; | |||
case R.id.btn_update_classify://修改分类 | |||
updateClassify(); | |||
break; | |||
case R.id.btn_delete_classify://删除分类 | |||
removeClassify(); | |||
break; | |||
} | |||
} | |||
/** | |||
* 添加分类 | |||
*/ | |||
private void addClassify(){ | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText(getString(R.string.top_addclass)); | |||
binding.edit.setHint(getString(R.string.info_addclass)); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast"); | |||
return; | |||
} | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for (Map.Entry<String, String> entry : classifyList.entrySet()) { | |||
if(entry.getKey().equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该分类,请换一个名称!","This class already exists, please change its name!"); | |||
return; | |||
} | |||
} | |||
BPA_GOODS_CLASSIFY goodsClassify = new BPA_GOODS_CLASSIFY(); | |||
goodsClassify.name = input; | |||
if(GoodsClassifyDBUtil.add(goodsClassify)){ | |||
classifyList.put(input,goodsClassify.id); | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyList.size()-1);//更新数据 | |||
NewToastUtil.getInstance().showToast("添加["+input+"]分类成功!","Add ["+input+"] Success!"); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "添加["+input+"]分类成功!"); | |||
}else { | |||
NewToastUtil.getInstance().showToast("添加["+input+"]分类失败!","Add ["+input+"] Fail!"); | |||
} | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!","The name cannot be empty!"); | |||
} | |||
}); | |||
}); | |||
} | |||
/** | |||
* 修改分类 | |||
*/ | |||
private void updateClassify(){ | |||
if(classifyPosition == 0){ | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String classifyName = viewBinding.spinnerClassify.getSelectedItem().toString(); | |||
binding.title.setText(getString(R.string.top_reviseclass)); | |||
binding.edit.setText(classifyName); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast"); | |||
return; | |||
} | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for (Map.Entry<String, String> entry : classifyList.entrySet()) { | |||
if(entry.getKey().equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该分类,请换一个名称!","This class already exists, please change its name!"); | |||
return; | |||
} | |||
} | |||
BPA_GOODS_CLASSIFY goodsClassify = GoodsClassifyDBUtil.getById(classifyId); | |||
goodsClassify.name = input; | |||
GoodsClassifyDBUtil.update(goodsClassify); | |||
classifyList.remove(classifyName); | |||
classifyList.put(input,classifyId); | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyList.size()-1);//更新数据 | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "修改["+input+"]分类成功!"); | |||
NewToastUtil.getInstance().showToast("修改["+input+"]分类成功!","Revise ["+input+"] Success!"); | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!","The name cannot be empty!"); | |||
} | |||
}); | |||
}); | |||
} | |||
/** | |||
* 删除分类 | |||
*/ | |||
private void removeClassify(){ | |||
if(classifyPosition>0){ | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_delete_classify, (layoutView, xCom) -> { | |||
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView); | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String classifyName = viewBinding.spinnerClassify.getSelectedItem().toString(); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText(getString(R.string.top_deleteclass)); | |||
switch (getString(R.string.language)){ | |||
case "en": | |||
binding.edit.setText("Delete all products&attributes of ["+classifyName+"] ?"); | |||
break; | |||
case "zh": | |||
binding.edit.setText("是否删除["+classifyName+"]分类下所有商品及属性?"); | |||
break; | |||
} | |||
binding.cancel.setOnClickListener(view1 ->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast"); | |||
return; | |||
} | |||
if(GoodsClassifyDBUtil.deleteById(classifyId)){ | |||
GoodsClassifyDBUtil.DeleteList(GoodsClassifyDBUtil.getListByName(classifyName)); | |||
AttributeDBUtil.deleteByClassifyId(classifyId); | |||
GoodsDBUtil.deleteByClassifyId(classifyId); | |||
SubAttributeGroupDBUtil.deleteByClassifyId(classifyId); | |||
SubAttributeDBUtil.deleteByClassifyId(classifyId); | |||
classifyList.remove(classifyName); | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyPosition-1);//更新数据 | |||
NewToastUtil.getInstance().showToast("删除["+classifyName+"]分类成功!","Delete ["+classifyName+"] Success!"); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "删除["+classifyName+"]分类成功!"); | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("删除["+classifyName+"]分类失败!","Delete ["+classifyName+"] Fail!"); | |||
} | |||
}); | |||
}); | |||
} | |||
} | |||
private void initTopBar(){ | |||
// viewBinding.topbar.setTitle("编辑分类"); | |||
// viewBinding.back.setOnClickListener(v->{ | |||
//// finishActivity(); | |||
// }); | |||
} | |||
// @Override | |||
// protected void doOnBackPressed() { | |||
// super.doOnBackPressed(); | |||
// finishActivity(); | |||
// } | |||
// private void finishActivity(){ | |||
// setResult(RESULT_OK, null); | |||
// EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
// finish(); | |||
// } | |||
// @Override | |||
// protected String getClassName() { | |||
// return "编辑分类页"; | |||
// } | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; | |||
} | |||
} |
@@ -3,34 +3,36 @@ package com.bonait.bnframework.ui.activity; | |||
import android.annotation.SuppressLint; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.widget.AdapterView; | |||
import android.widget.ArrayAdapter; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.RecordManager; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.databinding.ActivityEditClassifyBinding; | |||
import com.bonait.bnframework.databinding.DialogAddClassifyBinding; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.databinding.FragmentPropEditClassifyBinding; | |||
import com.bonait.bnframework.ui.adapter.classify.AttributeAdapter; | |||
import com.bonait.bnframework.ui.adapter.classify.SubattributeAdapter; | |||
import com.bonait.bnframework.ui.util.DisplayManager; | |||
@@ -51,10 +53,10 @@ import butterknife.OnClick; | |||
* @description: 编辑分类 | |||
* @date: 2024/5/6 16:04. | |||
*/ | |||
public class EditClassifyActivity extends BaseActivity { | |||
public class PropEditClassifyFragment extends BaseFragment { | |||
private final static String TAG = "EditClassifyActivity 编辑分类 ==> "; | |||
private Context context; | |||
private ActivityEditClassifyBinding viewBinding; | |||
private FragmentPropEditClassifyBinding viewBinding; | |||
/** | |||
* 父属性列表 | |||
*/ | |||
@@ -79,18 +81,35 @@ public class EditClassifyActivity extends BaseActivity { | |||
@Override | |||
protected void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
viewBinding = ActivityEditClassifyBinding.inflate(getLayoutInflater()); | |||
setContentView(viewBinding.getRoot()); | |||
ButterKnife.bind(this); | |||
context = this; | |||
protected View onCreateView() { | |||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_prop_edit_classify, null); | |||
viewBinding = FragmentPropEditClassifyBinding.bind(root); | |||
ButterKnife.bind(this, root); | |||
return root; | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
context=getContext(); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
initData(); | |||
initView(); | |||
initTopBar(); | |||
// EventBus.getDefault().register(this); | |||
} | |||
// @Override | |||
// protected void onCreate(@Nullable Bundle savedInstanceState) { | |||
// super.onCreate(savedInstanceState); | |||
// viewBinding = FragmentPropEditClassifyBinding.inflate(getLayoutInflater()); | |||
// setContentView(viewBinding.getRoot()); | |||
// DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
// initData(); | |||
// initView(); | |||
// initTopBar(); | |||
// } | |||
private void initData(){ | |||
attributePosition = 0; | |||
classifyPosition=0; | |||
@@ -98,7 +117,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
subattributeList.clear(); | |||
classifyList.clear(); | |||
classifyList.put(getString(R.string.text_noselect),""); | |||
for(BPA_GOODS_CLASSIFY goodsClassify:GoodsClassifyDBUtil.getAll()){ | |||
for(BPA_PROPERTY_CLASSIFY goodsClassify:PropClassifyDBUtil.getAll()){ | |||
classifyList.put(goodsClassify.name,goodsClassify.id); | |||
} | |||
} | |||
@@ -167,7 +186,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
return; | |||
} | |||
//修改子属性 | |||
AlertDialogUtils.showCancelAndConfirmDialog(EditClassifyActivity.this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText(getString(R.string.top_revisechildattribute)); | |||
@@ -293,7 +312,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
* 添加分类 | |||
*/ | |||
private void addClassify(){ | |||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText(getString(R.string.top_addclass)); | |||
@@ -312,9 +331,9 @@ public class EditClassifyActivity extends BaseActivity { | |||
} | |||
} | |||
BPA_GOODS_CLASSIFY goodsClassify = new BPA_GOODS_CLASSIFY(); | |||
BPA_PROPERTY_CLASSIFY goodsClassify = new BPA_PROPERTY_CLASSIFY(); | |||
goodsClassify.name = input; | |||
if(GoodsClassifyDBUtil.add(goodsClassify)){ | |||
if(PropClassifyDBUtil.add(goodsClassify)){ | |||
classifyList.put(input,goodsClassify.id); | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
@@ -341,7 +360,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
if(classifyPosition == 0){ | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
@@ -362,9 +381,9 @@ public class EditClassifyActivity extends BaseActivity { | |||
} | |||
} | |||
BPA_GOODS_CLASSIFY goodsClassify = GoodsClassifyDBUtil.getById(classifyId); | |||
BPA_PROPERTY_CLASSIFY goodsClassify = PropClassifyDBUtil.getById(classifyId); | |||
goodsClassify.name = input; | |||
GoodsClassifyDBUtil.update(goodsClassify); | |||
PropClassifyDBUtil.update(goodsClassify); | |||
classifyList.remove(classifyName); | |||
classifyList.put(input,classifyId); | |||
@@ -387,7 +406,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
*/ | |||
private void removeClassify(){ | |||
if(classifyPosition>0){ | |||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_delete_classify, (layoutView, xCom) -> { | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_delete_classify, (layoutView, xCom) -> { | |||
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView); | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String classifyName = viewBinding.spinnerClassify.getSelectedItem().toString(); | |||
@@ -410,8 +429,8 @@ public class EditClassifyActivity extends BaseActivity { | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast"); | |||
return; | |||
} | |||
if(GoodsClassifyDBUtil.deleteById(classifyId)){ | |||
GoodsClassifyDBUtil.DeleteList(GoodsClassifyDBUtil.getListByName(classifyName)); | |||
if(PropClassifyDBUtil.deleteById(classifyId)){ | |||
PropClassifyDBUtil.DeleteList(PropClassifyDBUtil.getListByName(classifyName)); | |||
AttributeDBUtil.deleteByClassifyId(classifyId); | |||
GoodsDBUtil.deleteByClassifyId(classifyId); | |||
SubAttributeGroupDBUtil.deleteByClassifyId(classifyId); | |||
@@ -447,7 +466,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
} | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
if(GoodsDBUtil.getClassifyId(classifyId)!=null){ | |||
AlertDialogUtils.showTipDialog(this, "注意", "添加属性将会影响当前分类下所有菜品,请确保该分类下没有商品再操作","Look!","Adding attributes will affect all dishes in the current category. Please ensure that there are no products in this category!", | |||
AlertDialogUtils.showTipDialog((AppCompatActivity)getActivity(), "注意", "添加属性将会影响当前分类下所有菜品,请确保该分类下没有商品再操作","Look!","Adding attributes will affect all dishes in the current category. Please ensure that there are no products in this category!", | |||
new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
@@ -459,7 +478,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
}); | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText(getString(R.string.top_addattribute)); | |||
@@ -506,7 +525,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
} | |||
String classifyId1 = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
if(GoodsDBUtil.getClassifyId(classifyId1)!=null){ | |||
AlertDialogUtils.showTipDialog(this, "警告", "删除属性将会影响当前分类下所有菜品,请确保该分类下没有商品再操作","Warning","Deleting the attributes will affect all dishes in the current category. Please ensure that no products are operated in this category!", | |||
AlertDialogUtils.showTipDialog((AppCompatActivity)getActivity(), "警告", "删除属性将会影响当前分类下所有菜品,请确保该分类下没有商品再操作","Warning","Deleting the attributes will affect all dishes in the current category. Please ensure that no products are operated in this category!", | |||
new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
@@ -555,7 +574,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
return; | |||
} | |||
if(attributePosition>=0&&attributePosition<attributeList.size()){ | |||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText(getString(R.string.top_reviseattribute)); | |||
@@ -599,7 +618,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
NewToastUtil.getInstance().showToast("请先添加属性","Add attributes first"); | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText(getString(R.string.top_addchildattribute)); | |||
@@ -658,27 +677,27 @@ public class EditClassifyActivity extends BaseActivity { | |||
private void initTopBar(){ | |||
// viewBinding.topbar.setTitle("编辑分类"); | |||
viewBinding.back.setOnClickListener(v->{ | |||
finishActivity(); | |||
}); | |||
} | |||
@Override | |||
protected void doOnBackPressed() { | |||
super.doOnBackPressed(); | |||
finishActivity(); | |||
} | |||
private void finishActivity(){ | |||
setResult(RESULT_OK, null); | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
finish(); | |||
// viewBinding.back.setOnClickListener(v->{ | |||
// finishActivity(); | |||
// }); | |||
} | |||
@Override | |||
protected String getClassName() { | |||
return "编辑分类页"; | |||
} | |||
// @Override | |||
// protected void doOnBackPressed() { | |||
// super.doOnBackPressed(); | |||
// finishActivity(); | |||
// } | |||
// private void finishActivity(){ | |||
// setResult(RESULT_OK, null); | |||
// EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
// finish(); | |||
// } | |||
// @Override | |||
// protected String getClassName() { | |||
// return "编辑分类页"; | |||
// } | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; |
@@ -17,7 +17,7 @@ import com.bonait.bnframework.ui.util.DisplayManager; | |||
* @description: | |||
* @date: 2024/5/9 9:02. | |||
*/ | |||
public abstract class ClassifyAdapter extends BaseAdapter<BPA_GOODS_CLASSIFY,ClassifyAdapter.ViewHolder> { | |||
public abstract class GoodClassifyAdapter extends BaseAdapter<BPA_GOODS_CLASSIFY, GoodClassifyAdapter.ViewHolder> { | |||
@NonNull | |||
@Override |
@@ -57,7 +57,7 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods | |||
holder.binding.image.setImageResource(R.mipmap.loading123); | |||
} | |||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goods.classifyId)!=null){ | |||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goods.propClassifyId)!=null){ | |||
holder.binding.downLoad.setVisibility(View.GONE); | |||
}else { | |||
holder.binding.downLoad.setVisibility(View.VISIBLE); | |||
@@ -22,9 +22,9 @@ import androidx.fragment.app.DialogFragment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.PropClassifyDBUtil; | |||
import com.bonait.bnframework.databinding.DialogAddGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodPicEvent; | |||
import com.bonait.bnframework.event.ImageSelectEvent; | |||
@@ -55,8 +55,9 @@ public class AddGoodsDialog extends DialogFragment { | |||
private String TAG = " AddGoodsDialog =>"; | |||
private DialogAddGoodsBinding viewBinding; | |||
private ClassifySpinnerAdapter spinnerAdapter; | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
private int classifyPosition = -1; | |||
private ArrayList<BPA_PROPERTY_CLASSIFY> classifyList = new ArrayList<>(); | |||
private int classifyPosition = 0; | |||
private String goodClassifyId; | |||
private String picUrl = ""; | |||
public boolean isDismiss = false; | |||
@@ -66,7 +67,7 @@ public class AddGoodsDialog extends DialogFragment { | |||
super.onCreate(savedInstanceState); | |||
setStyle(STYLE_NORMAL, R.style.DialogScale); | |||
if(getArguments()!=null){ | |||
classifyPosition = getArguments().getInt("classifyPosition"); | |||
goodClassifyId = getArguments().getString("goodClassifyId"); | |||
} | |||
} | |||
@@ -217,10 +218,11 @@ public class AddGoodsDialog extends DialogFragment { | |||
} | |||
return; | |||
} | |||
BPA_GOODS_CLASSIFY classify = classifyList.get(classifyPosition); | |||
BPA_PROPERTY_CLASSIFY classify = classifyList.get(classifyPosition); | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
goods.name = name; | |||
goods.classifyId = classify.id; | |||
goods.propClassifyId = classify.id; | |||
goods.goodClassifyid=goodClassifyId; | |||
goods.url = picUrl; | |||
GoodsDBUtil.add(goods); | |||
dismiss(); | |||
@@ -235,9 +237,9 @@ public class AddGoodsDialog extends DialogFragment { | |||
public void updateClassifyData(int position){ | |||
classifyPosition = position; | |||
classifyList.clear(); | |||
classifyList.addAll(GoodsClassifyDBUtil.getAll()); | |||
classifyList.addAll(PropClassifyDBUtil.getAll()); | |||
List<String> classifyNameList = new ArrayList<>(); | |||
for(BPA_GOODS_CLASSIFY bean: classifyList){ | |||
for(BPA_PROPERTY_CLASSIFY bean: classifyList){ | |||
classifyNameList.add(bean.name); | |||
} | |||
LogUtils.d(" updateClassifyData getContext()="+getContext()); | |||
@@ -70,7 +70,7 @@ public class AttributeSelectDialog extends DialogFragment { | |||
} | |||
goods = GoodsDBUtil.getById(goodId); | |||
if (goods != null) { | |||
attributeList = AttributeDBUtil.getByClassify(goods.classifyId); | |||
attributeList = AttributeDBUtil.getByClassify(goods.propClassifyId); | |||
} | |||
} | |||
private void fullScreen(Window window){ | |||
@@ -45,7 +45,6 @@ import com.bonait.bnframework.event.ImageSelectEvent; | |||
import com.bonait.bnframework.glide.GlideUtil; | |||
import com.bonait.bnframework.modules.home.activity.BottomNavigation2Activity; | |||
import com.bonait.bnframework.modules.home.activity.BottomNavigationNewActivity; | |||
import com.bonait.bnframework.modules.home.fragment.from.CookingActivity; | |||
import com.bonait.bnframework.modules.home.fragment.from.ImageChooseActivity; | |||
import com.bonait.bnframework.ui.activity.DiyProcessActivity; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifySpinnerAdapter; | |||
@@ -134,7 +133,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
} | |||
goods = GoodsDBUtil.getById(goodId); | |||
if(goods!=null){ | |||
attributeList = AttributeDBUtil.getByClassify(goods.classifyId); | |||
attributeList = AttributeDBUtil.getByClassify(goods.propClassifyId); | |||
} | |||
AdbCommandUtil.hideStatusBar(true); | |||
initView(); | |||
@@ -21,13 +21,12 @@ import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.model.GoodsClassifyBean; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.databinding.FragmentCloudGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.classify.GoodClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.goods.CloudGoodsAdapter; | |||
import com.bonait.bnframework.ui.dialog.WaiteProgressDialog; | |||
import com.bonait.bnframework.ui.util.DimensUtil; | |||
@@ -50,7 +49,7 @@ import java.util.Objects; | |||
public class CloudGoodsFragment extends BaseFragment { | |||
private FragmentCloudGoodsBinding viewBinding; | |||
private CloudGoodsAdapter goodsAdapter; | |||
private ClassifyAdapter classifyAdapter; | |||
private GoodClassifyAdapter goodClassifyAdapter; | |||
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
private static final int MSG_FRESH_GOODS= 1; | |||
@@ -71,7 +70,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
super.handleMessage(msg); | |||
switch (msg.what){ | |||
case MSG_FRESH_GOODS: | |||
dealGoodsData(classifyAdapter.getCurrentPosition()); | |||
dealGoodsData(goodClassifyAdapter.getCurrentPosition()); | |||
break; | |||
} | |||
} | |||
@@ -172,7 +171,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
}); | |||
viewBinding.recyclerGoods.setAdapter(goodsAdapter); | |||
classifyAdapter =new ClassifyAdapter() { | |||
goodClassifyAdapter =new GoodClassifyAdapter() { | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
LogUtils.d("分类列表点击 position="+position+" name = "+mData.get(position).name); | |||
@@ -180,7 +179,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_GOODS,200L);//避免快速点击 | |||
} | |||
}; | |||
viewBinding.recyclerClassify.setAdapter(classifyAdapter); | |||
viewBinding.recyclerClassify.setAdapter(goodClassifyAdapter); | |||
} | |||
/** | |||
@@ -202,8 +201,8 @@ public class CloudGoodsFragment extends BaseFragment { | |||
classifyList.add(goodsClassify); | |||
} | |||
} | |||
classifyAdapter.setCurrentPosition(0); | |||
classifyAdapter.setNewData(classifyList); | |||
goodClassifyAdapter.setCurrentPosition(0); | |||
goodClassifyAdapter.setNewData(classifyList); | |||
} | |||
private void dealGoodsData(int position){ | |||
@@ -218,7 +217,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
goods.name = goodsInfoListBean.getGoodsName(); | |||
goods.id = goodsInfoListBean.getGoodsId(); | |||
goods.classifyId = bean.getGoodsTypeId(); | |||
goods.propClassifyId = bean.getGoodsTypeId(); | |||
goods.url = goodsInfoListBean.getImgUrl(); | |||
goodsList.add(goods); | |||
} | |||
@@ -246,7 +245,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
} | |||
if(goodsAdapter!=null){ | |||
goodsAdapter = null; | |||
classifyAdapter = null; | |||
goodClassifyAdapter = null; | |||
} | |||
if(handler!=null){ | |||
handler.removeCallbacksAndMessages(null); | |||
@@ -262,13 +261,13 @@ public class CloudGoodsFragment extends BaseFragment { | |||
*/ | |||
private boolean downLoadCloudGoods(int pos){ | |||
BPA_GOODS goods = goodsAdapter.getData().get(pos); | |||
BPA_GOODS_CLASSIFY goodsClassify = classifyAdapter.getData().get(classifyAdapter.getCurrentPosition()); | |||
if(GoodsDBUtil.getByIdAndClassifyId(goods.id,goodsClassify.id)!=null){ | |||
NewToastUtil.getInstance().showToastError("请勿重复下载,本地商品已存在!!!"); | |||
return false; | |||
}else { | |||
viewModel.downLoadCloudGoods(goods,goodsClassify); | |||
} | |||
// BPA_PROPERTY_CLASSIFY goodsClassify = goodClassifyAdapter.getData().get(goodClassifyAdapter.getCurrentPosition()); | |||
// if(GoodsDBUtil.getByIdAndClassifyId(goods.id,goodsClassify.id)!=null){ | |||
// NewToastUtil.getInstance().showToastError("请勿重复下载,本地商品已存在!!!"); | |||
// return false; | |||
// }else { | |||
// viewModel.downLoadCloudGoods(goods,goodsClassify); | |||
// } | |||
return true; | |||
} | |||
@@ -7,7 +7,6 @@ import android.os.Bundle; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
import android.os.Message; | |||
import android.util.Log; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
@@ -19,17 +18,18 @@ import androidx.recyclerview.widget.RecyclerView; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.MainInit; | |||
import com.bonait.bnframework.business.RecordManager; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
@@ -38,9 +38,8 @@ import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.databinding.FragmentLocalGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodPicEvent; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.ui.activity.EditClassifyActivity; | |||
import com.bonait.bnframework.ui.activity.EditGoodsActivity; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.activity.EditClassifyTabActivity; | |||
import com.bonait.bnframework.ui.adapter.classify.GoodClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.goods.LocalGoodsAdapter; | |||
import com.bonait.bnframework.ui.dialog.AddGoodsDialog; | |||
import com.bonait.bnframework.ui.dialog.EditGoodsDialog; | |||
@@ -55,7 +54,6 @@ import org.greenrobot.eventbus.Subscribe; | |||
import org.greenrobot.eventbus.ThreadMode; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
@@ -67,9 +65,18 @@ import java.util.stream.Collectors; | |||
public class LocalGoodsFragment extends BaseFragment { | |||
private FragmentLocalGoodsBinding viewBinding; | |||
private LocalGoodsAdapter goodsAdapter; | |||
private ClassifyAdapter classifyAdapter; | |||
private GoodClassifyAdapter goodClassifyAdapter; | |||
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
/** | |||
* 商品分类列表 | |||
*/ | |||
private ArrayList<BPA_GOODS_CLASSIFY> goodClassifyList = new ArrayList<>(); | |||
/** | |||
* 属性分类列表 | |||
*/ | |||
private ArrayList<BPA_PROPERTY_CLASSIFY> propClassifyList = new ArrayList<>(); | |||
private static final int MSG_FRESH_GOODS= 1; | |||
private Long FRESH_DELAY_TIME = 200L; | |||
private AddGoodsDialog addGoodsDialog; | |||
@@ -94,7 +101,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
switch (msg.what){ | |||
case MSG_FRESH_GOODS: | |||
goodsList.clear(); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyList.get(classifyAdapter.getCurrentPosition()).id)); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(goodClassifyList.get(goodClassifyAdapter.getCurrentPosition()).id)); | |||
goodsAdapter.notifyDataSetChanged(); | |||
break; | |||
} | |||
@@ -323,9 +330,13 @@ public class LocalGoodsFragment extends BaseFragment { | |||
@Override | |||
protected void addGoods() { | |||
if(!classifyList.isEmpty() && getActivity()!=null){ | |||
if(classifyList.size()>classifyAdapter.getCurrentPosition()){ | |||
BPA_GOODS_CLASSIFY classify = classifyList.get(classifyAdapter.getCurrentPosition()); | |||
//添加商品的时候选择一个商品分类 | |||
//添加商品的时候选择一个属性分类 | |||
addGoodsDialog(); | |||
if(!propClassifyList.isEmpty() && getActivity()!=null){ | |||
String selectPropName=""; | |||
BPA_PROPERTY_CLASSIFY classify= PropClassifyDBUtil.getByName(selectPropName); | |||
if (classify!=null){ | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(classify.id); | |||
if(attributes.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("当前分类没有属性,请先创建分类父属性","The current class does not have attributes. Create the parent attributes of the class first"); | |||
@@ -339,8 +350,8 @@ public class LocalGoodsFragment extends BaseFragment { | |||
} | |||
} | |||
} | |||
addGoodsDialog(); | |||
} | |||
addGoodsDialog(); | |||
} | |||
}; | |||
goodsAdapter.setEdit(isEdit); | |||
@@ -358,7 +369,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
}); | |||
viewBinding.recyclerGoods.setAdapter(goodsAdapter); | |||
classifyAdapter =new ClassifyAdapter() { | |||
goodClassifyAdapter =new GoodClassifyAdapter() { | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
viewBinding.selectCB.setChecked(true);//切换分类后隐藏多选内容 | |||
@@ -368,8 +379,8 @@ public class LocalGoodsFragment extends BaseFragment { | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_GOODS,FRESH_DELAY_TIME);//避免快速点击 | |||
} | |||
}; | |||
classifyAdapter.setCurrentPosition(0); | |||
viewBinding.recyclerClassify.setAdapter(classifyAdapter); | |||
goodClassifyAdapter.setCurrentPosition(0); | |||
viewBinding.recyclerClassify.setAdapter(goodClassifyAdapter); | |||
} | |||
/** | |||
@@ -404,7 +415,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
NewToastUtil.getInstance().showToast("请勿快速点击!","Click too fast!"); | |||
return; | |||
} | |||
if(!classifyList.isEmpty() && getActivity()!=null){ | |||
if(!propClassifyList.isEmpty() && getActivity()!=null){ | |||
LogUtils.d(" addGoodsDialog addGoodsDialog="+addGoodsDialog); | |||
if(addGoodsDialog == null){ | |||
addGoodsDialog = new AddGoodsDialog(); | |||
@@ -412,7 +423,8 @@ public class LocalGoodsFragment extends BaseFragment { | |||
addGoodsDialog.dismiss(); | |||
} | |||
Bundle bundle = new Bundle(); | |||
bundle.putInt("classifyPosition",classifyAdapter.getCurrentPosition()); | |||
// bundle.putInt("goodClassifyPosition", goodClassifyAdapter.getCurrentPosition()); | |||
bundle.putString("goodClassifyId", goodClassifyList.get(goodClassifyAdapter.getCurrentPosition()).id); | |||
addGoodsDialog.setArguments(bundle); | |||
addGoodsDialog.show(getActivity().getSupportFragmentManager(), "addGoods"); | |||
}else { | |||
@@ -422,7 +434,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
} | |||
private void jumpClassify(){ | |||
Intent intent = new Intent(getContext(), EditClassifyActivity.class); | |||
Intent intent = new Intent(getContext(), EditClassifyTabActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
} | |||
@@ -435,21 +447,22 @@ public class LocalGoodsFragment extends BaseFragment { | |||
public void updateData() { | |||
LogUtils.d("updateData"); | |||
goodsList.clear(); | |||
classifyList.clear(); | |||
goodClassifyList.clear(); | |||
classifyList.addAll(GoodsClassifyDBUtil.getAll()); | |||
if(!classifyList.isEmpty()){ | |||
int last = Math.max(classifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, classifyList.size()-1); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyList.get(last2).id)); | |||
goodClassifyList.addAll(GoodsClassifyDBUtil.getAll()); | |||
if(!goodClassifyList.isEmpty()){ | |||
int last = Math.max(goodClassifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, goodClassifyList.size()-1); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(goodClassifyList.get(last2).id)); | |||
} | |||
goodsAdapter.setNewData(goodsList); | |||
int last = Math.max(classifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, classifyList.size()-1); | |||
classifyAdapter.setCurrentPosition(last2); | |||
classifyAdapter.setNewData(classifyList); | |||
int last = Math.max(goodClassifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, goodClassifyList.size()-1); | |||
goodClassifyAdapter.setCurrentPosition(last2); | |||
goodClassifyAdapter.setNewData(goodClassifyList); | |||
propClassifyList.addAll(PropClassifyDBUtil.getAll()); | |||
} | |||
@Override | |||
@@ -479,13 +492,13 @@ public class LocalGoodsFragment extends BaseFragment { | |||
EventBus.getDefault().unregister(this); | |||
if(goodsList!=null){ | |||
goodsList.clear(); | |||
classifyList.clear(); | |||
goodClassifyList.clear(); | |||
goodsList = null; | |||
classifyList = null; | |||
goodClassifyList = null; | |||
} | |||
if(goodsAdapter!=null){ | |||
goodsAdapter = null; | |||
classifyAdapter = null; | |||
goodClassifyAdapter = null; | |||
} | |||
if(handler!=null){ | |||
handler.removeCallbacksAndMessages(null); | |||
@@ -17,6 +17,7 @@ import android.app.Activity; | |||
import android.app.Service; | |||
import android.content.pm.ActivityInfo; | |||
import android.util.DisplayMetrics; | |||
import android.util.Log; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.TextView; | |||
@@ -450,13 +451,13 @@ public class DisplayManager | |||
{ | |||
for (int i = 0, n = root.getChildCount(); i < n; i++) | |||
{ | |||
View v = root.getChildAt(i); | |||
scaleView(v); | |||
if (v instanceof ViewGroup) | |||
{ | |||
scaleViewGroup((ViewGroup) v); | |||
try{ | |||
View v = root.getChildAt(i); | |||
scaleView(v); | |||
if (v instanceof ViewGroup) | |||
scaleViewGroup((ViewGroup) v); | |||
}catch (Exception e){ | |||
Log.e("error", "布局适配异常: "+e.getMessage()); | |||
} | |||
} | |||
} | |||
@@ -17,17 +17,17 @@ import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.MaterialUtil; | |||
import com.bonait.bnframework.common.db.util.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.model.GoodsClassifyBean; | |||
@@ -48,7 +48,6 @@ import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
/** | |||
* @author: liup | |||
@@ -167,15 +166,15 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
public void downLoadCloudGoods(BPA_GOODS goods, BPA_GOODS_CLASSIFY goodsClassify){ | |||
public void downLoadCloudGoods(BPA_GOODS goods, BPA_PROPERTY_CLASSIFY goodsClassify){ | |||
RecordManager.getInstance().addLogRecord("角色操作日志",goods.name+"-下载"); | |||
long curTime6 = System.currentTimeMillis(); | |||
LogUtils.d(" downLoadCloudGoods usetime="+(curTime6-lastTime)); | |||
lastTime = curTime6; | |||
//商品不存在情况 | |||
//判断分类是否存在 | |||
if(GoodsClassifyDBUtil.getById(goodsClassify.id)==null){ | |||
GoodsClassifyDBUtil.add(goodsClassify); | |||
if(PropClassifyDBUtil.getById(goodsClassify.id)==null){ | |||
PropClassifyDBUtil.add(goodsClassify); | |||
}else { | |||
for (GoodsClassifyBean bean : cloudGoodsList.getValue()) { | |||
if (goodsClassify.id.equals(bean.getGoodsTypeId())) { | |||
@@ -333,31 +332,31 @@ public class HomeGoodsViewModel extends ViewModel { | |||
return; | |||
} | |||
LogUtils.d("GoodTypeSynchronous1"); | |||
List<BPA_GOODS_CLASSIFY> datas = new ArrayList<>(); | |||
List<BPA_GOODS_CLASSIFY> dataHas = new ArrayList<>(); | |||
List<BPA_PROPERTY_CLASSIFY> datas = new ArrayList<>(); | |||
List<BPA_PROPERTY_CLASSIFY> dataHas = new ArrayList<>(); | |||
for(GoodsClassifyBean item : cloudGoodsList.getValue()){ | |||
BPA_GOODS_CLASSIFY bpa_goodstype = new BPA_GOODS_CLASSIFY(); | |||
BPA_PROPERTY_CLASSIFY bpa_goodstype = new BPA_PROPERTY_CLASSIFY(); | |||
bpa_goodstype.name = item.getGoodsTypeName(); | |||
bpa_goodstype.id = item.getGoodsTypeId(); | |||
bpa_goodstype.userID="超级管理员"; | |||
datas.add(bpa_goodstype); | |||
if(item.getGoodsTypeName()!=null){ | |||
List<BPA_GOODS_CLASSIFY> bean = GoodsClassifyDBUtil.getListByName(item.getGoodsTypeName()); | |||
List<BPA_PROPERTY_CLASSIFY> bean = PropClassifyDBUtil.getListByName(item.getGoodsTypeName()); | |||
if(!bean.isEmpty()){ | |||
dataHas.addAll(bean); | |||
} | |||
} | |||
} | |||
//删除重复的分类 | |||
GoodsClassifyDBUtil.DeleteList(dataHas); | |||
for(BPA_GOODS_CLASSIFY bean : dataHas){ | |||
PropClassifyDBUtil.DeleteList(dataHas); | |||
for(BPA_PROPERTY_CLASSIFY bean : dataHas){ | |||
AttributeDBUtil.deleteByClassifyId(bean.id); | |||
GoodsDBUtil.deleteByClassifyId(bean.id); | |||
SubAttributeGroupDBUtil.deleteByClassifyId(bean.id); | |||
SubAttributeDBUtil.deleteByClassifyId(bean.id); | |||
} | |||
//批量添加 | |||
GoodsClassifyDBUtil.addList(datas); | |||
PropClassifyDBUtil.addList(datas); | |||
} | |||
/** | |||
@@ -421,7 +420,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
BPA_GOODS bpa_goods =new BPA_GOODS(); | |||
bpa_goods.id = item.getGoodsInfoList().get(i).getGoodsId(); | |||
bpa_goods.name = item.getGoodsInfoList().get(i).getGoodsName(); | |||
bpa_goods.classifyId=item.getGoodsTypeId(); | |||
bpa_goods.propClassifyId =item.getGoodsTypeId(); | |||
bpa_goods.status=1; | |||
bpa_goods.url=item.getGoodsInfoList().get(i).getImgUrl()==null?"":item.getGoodsInfoList().get(i).getImgUrl(); | |||
bpa_goods.sort= i+1; | |||
@@ -11,7 +11,7 @@ import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
@@ -19,14 +19,12 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.MaterialUtil; | |||
import com.bonait.bnframework.common.db.util.ProcessModelUtil; | |||
import com.bonait.bnframework.common.db.util.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.helper.I.IRun; | |||
import com.bonait.bnframework.common.helper.I.IRunT; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.model.upload.ProcessModelBean; | |||
@@ -268,7 +266,7 @@ public class UpdateAllDataService { | |||
WaitProcessUtil.getInstance().Show("正在上传分类信息,请耐心稍等...","Uploading category information, please be patient..."); | |||
List<UpClassifyBean> upClassifyBeans = new ArrayList<>(); | |||
goods.forEach(good->{ | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(good.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(good.propClassifyId); | |||
if(classify!=null){ | |||
UpClassifyBean upClassifyBean = new UpClassifyBean(); | |||
upClassifyBean.id = classify.id; | |||
@@ -329,9 +327,9 @@ public class UpdateAllDataService { | |||
WaitProcessUtil.getInstance().Show("正在上传商品信息,请耐心稍等...","Uploading product information, please be patient for a moment"); | |||
List<GoodsDataInfo> upMaterialBean = new ArrayList<>(); | |||
for(BPA_GOODS good : goods){ | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(good.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(good.propClassifyId); | |||
if(classify!=null){ | |||
upMaterialBean.add(new GoodsDataInfo(good.id,good.name,"",good.url,"0",false,good.classifyId,classify.name)); | |||
upMaterialBean.add(new GoodsDataInfo(good.id,good.name,"",good.url,"0",false,good.propClassifyId,classify.name)); | |||
} | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
@@ -355,7 +353,7 @@ public class UpdateAllDataService { | |||
goodsProcessDetail.deviceId = ConfigName.getInstance().DeviceAutoKey; | |||
goodsProcessDetail.goodsId = goods.id; | |||
List<GoodsProcessDetail.TechnologyActionList> technologyActionLists = new ArrayList<>(); | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(goods.propClassifyId); | |||
assert classify != null; | |||
List<BPA_GOODS_SUBATTRIBUTE_GROUP> groups = SubAttributeGroupDBUtil.getByGoodsId(goods.id); | |||
@@ -2,19 +2,15 @@ package com.bonait.bnframework.ui.viewmodel; | |||
import android.content.Context; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.MainApplication; | |||
import com.bonait.bnframework.business.RecordManager; | |||
import com.bonait.bnframework.common.API.APIHelper; | |||
import com.bonait.bnframework.common.Result.OperateResult; | |||
import com.bonait.bnframework.common.Result.OperateResultT; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
@@ -22,14 +18,13 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.MaterialUtil; | |||
import com.bonait.bnframework.common.db.util.ProcessModelUtil; | |||
import com.bonait.bnframework.common.db.util.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.helper.I.IRun; | |||
import com.bonait.bnframework.common.helper.I.IRunT; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.model.upload.ProcessModelBean; | |||
@@ -40,11 +35,8 @@ import com.bonait.bnframework.common.model.upload.UpAttributeBean; | |||
import com.bonait.bnframework.common.model.upload.UpClassifyBean; | |||
import com.bonait.bnframework.common.model.upload.UpResData; | |||
import com.bonait.bnframework.common.model.upload.UploadRes; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.event.FreshSystemSeason; | |||
import com.bonait.bnframework.ui.dialog.WaiteProgressDialog; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import com.bonait.bnframework.ui.widget.WaitProcessUtil; | |||
import com.google.gson.Gson; | |||
@@ -301,7 +293,7 @@ public class UpdateDataService { | |||
WaitProcessUtil.getInstance().Show("正在上传分类信息,请耐心稍等...","Uploading category information, please be patient..."); | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodsId); | |||
assert goods != null; | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(goods.propClassifyId); | |||
assert classify != null; | |||
List<UpClassifyBean> upClassifyBeans = new ArrayList<>(); | |||
UpClassifyBean upClassifyBean = new UpClassifyBean(); | |||
@@ -338,7 +330,7 @@ public class UpdateDataService { | |||
WaitProcessUtil.getInstance().Show("正在上传分类属性信息,请耐心稍等...","Uploading classified attribute information, please wait..."); | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodsId); | |||
assert goods != null; | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(goods.propClassifyId); | |||
assert classify != null; | |||
List<UpAttributeBean> upAttributeBeans = new ArrayList<>(); | |||
@@ -378,12 +370,12 @@ public class UpdateDataService { | |||
WaitProcessUtil.getInstance().Show("正在上传商品信息,请耐心稍等...","Uploading product information, please be patient for a moment"); | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodsId); | |||
assert goods != null; | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(goods.propClassifyId); | |||
assert classify != null; | |||
List<GoodsDataInfo> upMaterialBean = new ArrayList<>(); | |||
upMaterialBean.add(new GoodsDataInfo(goods.id,goods.name,"",goods.url,"0",false,goods.classifyId, | |||
upMaterialBean.add(new GoodsDataInfo(goods.id,goods.name,"",goods.url,"0",false,goods.propClassifyId, | |||
classify.name)); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
@@ -409,7 +401,7 @@ public class UpdateDataService { | |||
WaitProcessUtil.getInstance().Show("正在上传工艺信息,请耐心稍等...","Uploading process information, please wait..."); | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodsId); | |||
assert goods != null; | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(goods.propClassifyId); | |||
assert classify != null; | |||
List<BPA_GOODS_SUBATTRIBUTE_GROUP> groups = SubAttributeGroupDBUtil.getByGoodsId(goodsId); | |||
@@ -35,7 +35,7 @@ | |||
app:water_mark_dx="300px" | |||
app:water_mark_dy="340px" | |||
app:water_mark_sync="true" | |||
app:water_mark_text="黑菠萝技术部" | |||
app:water_mark_text="" | |||
app:water_mark_textColor="@color/watermarkcolor" | |||
app:water_mark_textBold="true" | |||
app:water_mark_textSize="14px" /> | |||
@@ -33,7 +33,7 @@ | |||
app:water_mark_dx="300px" | |||
app:water_mark_dy="340px" | |||
app:water_mark_sync="true" | |||
app:water_mark_text="黑菠萝技术部" | |||
app:water_mark_text="" | |||
app:water_mark_textColor="@color/watermarkcolor" | |||
app:water_mark_textBold="true" | |||
app:water_mark_textSize="14px" /> | |||
@@ -0,0 +1,58 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:orientation="vertical" | |||
android:id="@+id/root" | |||
android:fitsSystemWindows="true"> | |||
<com.google.android.material.bottomnavigation.BottomNavigationView | |||
android:id="@+id/navigation" | |||
android:layout_marginTop="54dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="50dp" | |||
android:layout_gravity="top" | |||
android:background="@drawable/qmui_list_item_bg_with_border_bottom" | |||
app:itemHorizontalTranslationEnabled="false" | |||
app:labelVisibilityMode="labeled" | |||
app:menu="@menu/classifytb" | |||
app:itemIconTint="@null" | |||
app:itemIconSize="0dp" | |||
android:fitsSystemWindows="true"/> | |||
<com.qmuiteam.qmui.widget.QMUIViewPager | |||
android:id="@+id/viewpager" | |||
android:layout_marginTop="104dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:background="?attr/app_content_bg_color" /> | |||
<com.qmuiteam.qmui.widget.QMUITopBarLayout | |||
android:id="@+id/topbar" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/home_tab_height" > | |||
<TextView | |||
android:id="@+id/back" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textColor="@color/white" | |||
android:textSize="30dp" | |||
android:text="@string/btn_return" | |||
android:paddingRight="@dimen/dp_50" | |||
android:drawableLeft="@mipmap/fanhui" | |||
android:gravity="center" | |||
android:paddingLeft="@dimen/dp_5" | |||
android:drawablePadding="@dimen/dp_5" | |||
/> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:text="@string/top_editclass" | |||
android:textColor="@color/white" | |||
android:textSize="36sp" | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
/> | |||
</com.qmuiteam.qmui.widget.QMUITopBarLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,129 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:orientation="vertical" | |||
android:id="@+id/root" | |||
android:fitsSystemWindows="true"> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:id="@+id/content" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<TextView | |||
android:id="@+id/desc" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_70" | |||
android:text="" | |||
android:gravity="center" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="#823E17" | |||
/> | |||
<Spinner | |||
android:id="@+id/spinner_classify" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_375" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_centerVertical="true" | |||
app:layout_constraintLeft_toRightOf="@id/desc" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_add_classify" | |||
android:layout_width="@dimen/dp_110" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="@string/btn_new" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
app:layout_constraintLeft_toRightOf="@id/spinner_classify" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_delete_classify" | |||
android:layout_width="@dimen/dp_110" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="@string/btn_delete" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
app:layout_constraintLeft_toRightOf="@id/btn_add_classify" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_update_classify" | |||
android:layout_width="@dimen/dp_110" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="@string/btn_revise" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
app:layout_constraintLeft_toRightOf="@id/btn_delete_classify" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<TextView | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_1" | |||
app:layout_constraintTop_toBottomOf="@id/desc" | |||
android:layout_marginTop="@dimen/dp_90" | |||
android:background="@color/color3" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> | |||
<!-- <com.qmuiteam.qmui.widget.QMUITopBarLayout--> | |||
<!-- android:id="@+id/topbar"--> | |||
<!-- android:layout_width="match_parent"--> | |||
<!-- android:layout_height="@dimen/home_tab_height" >--> | |||
<!-- <TextView--> | |||
<!-- android:id="@+id/back"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="match_parent"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="30dp"--> | |||
<!-- android:text="@string/btn_return"--> | |||
<!-- android:paddingRight="@dimen/dp_50"--> | |||
<!-- android:drawableLeft="@mipmap/fanhui"--> | |||
<!-- android:gravity="center"--> | |||
<!-- android:paddingLeft="@dimen/dp_5"--> | |||
<!-- android:drawablePadding="@dimen/dp_5"--> | |||
<!-- />--> | |||
<!-- <TextView--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="match_parent"--> | |||
<!-- android:text="@string/top_editclass"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="36sp"--> | |||
<!-- android:layout_gravity="center"--> | |||
<!-- android:gravity="center"--> | |||
<!-- />--> | |||
<!-- </com.qmuiteam.qmui.widget.QMUITopBarLayout>--> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -10,7 +10,6 @@ | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:id="@+id/content" | |||
android:layout_marginTop="@dimen/home_tab_height" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
@@ -243,31 +242,31 @@ | |||
</androidx.constraintlayout.widget.ConstraintLayout> | |||
<com.qmuiteam.qmui.widget.QMUITopBarLayout | |||
android:id="@+id/topbar" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/home_tab_height" > | |||
<TextView | |||
android:id="@+id/back" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textColor="@color/white" | |||
android:textSize="30dp" | |||
android:text="@string/btn_return" | |||
android:paddingRight="@dimen/dp_50" | |||
android:drawableLeft="@mipmap/fanhui" | |||
android:gravity="center" | |||
android:paddingLeft="@dimen/dp_5" | |||
android:drawablePadding="@dimen/dp_5" | |||
/> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:text="@string/top_editclass" | |||
android:textColor="@color/white" | |||
android:textSize="36sp" | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
/> | |||
</com.qmuiteam.qmui.widget.QMUITopBarLayout> | |||
<!-- <com.qmuiteam.qmui.widget.QMUITopBarLayout--> | |||
<!-- android:id="@+id/topbar"--> | |||
<!-- android:layout_width="match_parent"--> | |||
<!-- android:layout_height="@dimen/home_tab_height" >--> | |||
<!-- <TextView--> | |||
<!-- android:id="@+id/back"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="match_parent"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="30dp"--> | |||
<!-- android:text="@string/btn_return"--> | |||
<!-- android:paddingRight="@dimen/dp_50"--> | |||
<!-- android:drawableLeft="@mipmap/fanhui"--> | |||
<!-- android:gravity="center"--> | |||
<!-- android:paddingLeft="@dimen/dp_5"--> | |||
<!-- android:drawablePadding="@dimen/dp_5"--> | |||
<!-- />--> | |||
<!-- <TextView--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="match_parent"--> | |||
<!-- android:text="@string/top_editclass"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="36sp"--> | |||
<!-- android:layout_gravity="center"--> | |||
<!-- android:gravity="center"--> | |||
<!-- />--> | |||
<!-- </com.qmuiteam.qmui.widget.QMUITopBarLayout>--> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,11 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item | |||
android:id="@+id/bottom_device_1" | |||
android:title="属性分类编辑" | |||
android:textSize="20sp"/> | |||
<item | |||
android:id="@+id/bottom_device_2" | |||
android:title="商品分类编辑" | |||
android:textSize="20sp"/> | |||
</menu> |
@@ -362,4 +362,9 @@ | |||
<item name="android:windowEnterAnimation">@anim/anim_top_in</item> | |||
<item name="android:windowExitAnimation">@anim/anim_top_out</item> | |||
</style> | |||
<!-- Tab菜单项字体样式 --> | |||
<style name="MenuTextStyle" parent="Widget.AppCompat.PopupMenu"> | |||
<item name="android:textSize">20sp</item> <!-- 设置你想要的字体大小 --> | |||
</style> | |||
</resources> |