完成购物车
This commit is contained in:
parent
e191fc9108
commit
a10de2e4b2
@ -10,12 +10,13 @@ import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
public class BaseUrlApi {
|
||||
|
||||
// public static final String IP = "http://192.168.0.113:7001/usercenter/";/* 测试IP */
|
||||
public static final String IP = "http://49.233.36.36:58099/xzszwhy/";/* 测试IP */
|
||||
// public static final String IP = "http://49.233.36.36:58099/xzszwhy/";/* 测试IP */
|
||||
public static final String IP = "http://v3.xzszwhy.cn/xzszwhy/";/* 测试IP */
|
||||
public static final String IP_URL = "http://v3.xzszwhy.cn/";/* 测试IP */
|
||||
// public static final String IP = "https://www.wgink.ink/usercenter/";/* 正式IP */
|
||||
// public static final String IP = "https://www.xzszwhy.cn/usercenter/";/* 正式IP */
|
||||
// public static final String BASE_SYSTEM_IP = "http://192.168.0.115:8082/";
|
||||
public static final String BASE_SYSTEM_IP = "http://49.233.36.36:58099/xzszwhy/";
|
||||
public static final String BASE_SYSTEM_IP = "http://v3.xzszwhy.cn/xzszwhy/";
|
||||
// public static final String BASE_SYSTEM_IP = "https://www.xzszwhy.cn/";
|
||||
// public static final String IP = "http://192.168.0.113:7001/usercenter/";/* 测试IP */
|
||||
public static final String PROJECT_NAME = "app/";
|
||||
|
@ -618,6 +618,15 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否登录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected boolean isLogin() {
|
||||
return !TextUtils.isEmpty(UserLgUtils.getToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将view的点击区域放大
|
||||
*
|
||||
|
@ -3,6 +3,7 @@ package com.sucstepsoft.cm_utils.core.widget.base;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -17,6 +18,7 @@ import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.sucstepsoft.cm_utils.R;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
|
||||
public abstract class BaseFragment extends Fragment {
|
||||
public static final int STATE_LOAD = 1234;//加载中
|
||||
@ -158,6 +160,9 @@ public abstract class BaseFragment extends Fragment {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean isLogin() {
|
||||
return !TextUtils.isEmpty(UserLgUtils.getToken());
|
||||
}
|
||||
// @Override
|
||||
// public void onDetach() {
|
||||
// super.onDetach();
|
||||
|
@ -133,7 +133,7 @@ public abstract class BaseRecyclerAdapter<T, H extends RecyclerView.ViewHolder>
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
private OnItemPositionClickListener mPosListener;
|
||||
protected OnItemPositionClickListener mPosListener;
|
||||
|
||||
public void addOnItemPosClickListener(OnItemPositionClickListener<T> listener) {
|
||||
this.mPosListener = listener;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 868 B After Width: | Height: | Size: 809 B |
Binary file not shown.
Before Width: | Height: | Size: 750 B After Width: | Height: | Size: 696 B |
11
cm_utils/src/main/res/drawable/shape_circle_grad.xml
Executable file
11
cm_utils/src/main/res/drawable/shape_circle_grad.xml
Executable file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/app_title_9f_no" />
|
||||
<corners android:radius="5dp" />
|
||||
<gradient
|
||||
android:angle="45"
|
||||
android:centerColor="#FF9800"
|
||||
android:endColor="#FFC107"
|
||||
android:startColor="#FFEB3B" />
|
||||
</shape>
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
@ -23,9 +24,11 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:focusable="false"
|
||||
android:gravity="center"
|
||||
android:inputType="number"
|
||||
android:minWidth="30dp" />
|
||||
android:minWidth="30dp"
|
||||
tools:text="23" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_add"
|
||||
|
@ -40,6 +40,7 @@ dependencies {
|
||||
// implementation files('libs/tbs.jar')
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.3.0-alpha03'
|
||||
implementation 'org.jetbrains:annotations:15.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
@ -114,6 +114,7 @@ public class GoodsDetailActivity extends BaseActivity {
|
||||
private GoodsStandardAdapter mStandardAdapter;
|
||||
private List<GoodsStandardBean> mStandardBeanList;
|
||||
private List<ShopGoodsDetailBean> mCarDatas = new ArrayList<>();
|
||||
private ShopGoodsDetailBean mCurrentBean;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
@ -145,11 +146,15 @@ public class GoodsDetailActivity extends BaseActivity {
|
||||
}
|
||||
mStandardAdapter.addOnItemPosClickListener((b, p) -> {
|
||||
setPrice(b.getGoodsItemUnitPrice());
|
||||
mDetailBean.setGoodsPrice(b.getGoodsItemUnitPrice()+"");
|
||||
mCurrentBean = mDetailBean.clone();
|
||||
mCurrentBean.setGoodsPrice(b.getGoodsItemUnitPrice());
|
||||
LogUtils.e("选中的类型===" + b.getGoodsItemId());
|
||||
mCurrentBean.setGoodsStandarId(b.getGoodsItemId());
|
||||
mCurrentBean.setGoodsStandarName(b.getGoodsItemName());
|
||||
mTvGoodsStock.setText("库存:" + b.getGoodsItemTotal());
|
||||
mStandardAdapter.setSelPos(p);
|
||||
});
|
||||
mTvAddCar.setOnClickListener(v -> addToCar(mDetailBean));
|
||||
mTvAddCar.setOnClickListener(v -> addToCar(mCurrentBean));
|
||||
mLlCar.setOnClickListener(v -> ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_SHOP_ACTIVITY_SHOP_CAR)
|
||||
.navigation());
|
||||
@ -179,27 +184,24 @@ public class GoodsDetailActivity extends BaseActivity {
|
||||
if (bean != null) {
|
||||
int pos = -1;
|
||||
for (int i = 0; i < mCarDatas.size(); i++) {
|
||||
if (bean.getGoodsId().equals(mCarDatas.get(i).getGoodsId())) {
|
||||
LogUtils.e(bean.getGoodsStandarId() + "==\n==" + mCarDatas.get(i).getGoodsStandarId());
|
||||
if (bean.getGoodsId().equals(mCarDatas.get(i).getGoodsId()) && bean.getGoodsStandarId().equals(mCarDatas.get(i).getGoodsStandarId())) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos != -1) {
|
||||
LogUtils.e(pos + "====" + mCarDatas.get(pos).getCarAmount());
|
||||
mCarDatas.get(pos).setCarAmount(mCarDatas.get(pos).getCarAmount() + 1);
|
||||
} else {
|
||||
bean.setCarAmount(1);
|
||||
bean.setGoodsPrice("");
|
||||
mCarDatas.add(bean);
|
||||
}
|
||||
}
|
||||
int num = 0;
|
||||
for (int i = 0; i < mCarDatas.size(); i++) {
|
||||
int carAmount = mCarDatas.get(i).getCarAmount();
|
||||
LogUtils.e(carAmount + "==============");
|
||||
num += carAmount;
|
||||
}
|
||||
LogUtils.e(num + "==数量==");
|
||||
if (num > 99) {
|
||||
mTvCarAmount.setText("99+");
|
||||
} else {
|
||||
@ -378,6 +380,7 @@ public class GoodsDetailActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
@ -412,6 +415,7 @@ public class GoodsDetailActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
refreshView(STATE_LOAD_ERROR);
|
||||
ExceptionHandler.handleException(e);
|
||||
}
|
||||
@ -430,10 +434,15 @@ public class GoodsDetailActivity extends BaseActivity {
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
GoodsStandardBean b = list.get(0);
|
||||
setPrice(b.getGoodsItemUnitPrice());
|
||||
mCurrentBean = mDetailBean.clone();
|
||||
mCurrentBean.setGoodsPrice(b.getGoodsItemUnitPrice());
|
||||
LogUtils.e("默认的===" + b.getGoodsItemId());
|
||||
mCurrentBean.setGoodsStandarId(b.getGoodsItemId());
|
||||
mCurrentBean.setGoodsStandarName(b.getGoodsItemName());
|
||||
mTvGoodsStock.setText("库存:" + b.getGoodsItemTotal());
|
||||
mTvGoodsSales.setText("销量:" + mDetailBean.getGoodsSalesVolume());
|
||||
mTvGoodsEvaluate.setText("评分:" + mDetailBean.getUserEvaluate());
|
||||
mTvGoodsFreight.setText("1".equals(mDetailBean.getGoodsNotFreight()) ? "包邮" : "不包邮");
|
||||
mTvGoodsSales.setText("销量:" + mCurrentBean.getGoodsSalesVolume());
|
||||
mTvGoodsEvaluate.setText("评分:" + mCurrentBean.getUserEvaluate());
|
||||
mTvGoodsFreight.setText("1".equals(mCurrentBean.getGoodsNotFreight()) ? "包邮" : "不包邮");
|
||||
mStandardBeanList.clear();
|
||||
mStandardBeanList = list;
|
||||
mStandardAdapter.setData(mStandardBeanList);
|
||||
|
@ -4,6 +4,7 @@ import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -46,6 +47,8 @@ public class GoodsListActivity extends BaseActivity {
|
||||
ImageView mIvEData;
|
||||
@BindView(R2.id.tv_hint)
|
||||
TypeFaceTextView mTvEHint;
|
||||
@BindView(R2.id.ll_car)
|
||||
LinearLayout mLlCar;
|
||||
private int mCurrentPage = 1;
|
||||
private int mRows = 15;
|
||||
private String mCategoryId;
|
||||
@ -88,6 +91,17 @@ public class GoodsListActivity extends BaseActivity {
|
||||
.build(PathConfig.PATH_MODULE_SHOP_ACTIVITY_GOODS_DETAIL)
|
||||
.withString("id", rowsBean.getGoodsId())
|
||||
.navigation());
|
||||
mLlCar.setOnClickListener(v -> {
|
||||
if (isLogin()) {
|
||||
ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_SHOP_ACTIVITY_SHOP_CAR)
|
||||
.navigation();
|
||||
} else {
|
||||
ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_MAIN_LOGIN)
|
||||
.navigation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -135,7 +149,10 @@ public class GoodsListActivity extends BaseActivity {
|
||||
if (shopListBean.getRows() != null && shopListBean.getRows().size() > 0) {
|
||||
mDatas.addAll(shopListBean.getRows());
|
||||
} else {
|
||||
setStateView(STATE_LOAD_EMPTY);
|
||||
mSrlContent.setNoMoreData(true);
|
||||
if (mCurrentPage <= 1) {
|
||||
setStateView(STATE_LOAD_EMPTY);
|
||||
}
|
||||
}
|
||||
mAdapter.setData(mDatas);
|
||||
}
|
||||
|
@ -1,6 +1,11 @@
|
||||
package com.tenlionsoft.moduleshop.activitys;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.RelativeSizeSpan;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -10,10 +15,12 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.tengshisoft.moduleshop.R;
|
||||
import com.tengshisoft.moduleshop.R2;
|
||||
import com.tenlionsoft.moduleshop.adapter.GoodsCarAdapter;
|
||||
import com.tenlionsoft.moduleshop.adapter.CarGoodsAdapter;
|
||||
import com.tenlionsoft.moduleshop.beans.CustomCarBean;
|
||||
import com.tenlionsoft.moduleshop.beans.ShopGoodsDetailBean;
|
||||
|
||||
@ -31,9 +38,15 @@ import butterknife.ButterKnife;
|
||||
public class ShopCarActivity extends BaseActivity {
|
||||
@BindView(R2.id.rlv_car)
|
||||
RecyclerView mRlvCar;
|
||||
private List<ShopGoodsDetailBean> mCarDatas;
|
||||
@BindView(R2.id.cb_all)
|
||||
CheckBox mCbAll;
|
||||
@BindView(R2.id.tv_price)
|
||||
TypeFaceTextView mTvPrice;
|
||||
@BindView(R2.id.tv_confirm)
|
||||
TypeFaceTextView mTvConfirm;
|
||||
private List<ShopGoodsDetailBean> mCarDatas = new ArrayList<>();
|
||||
private List<CustomCarBean> mDatas;
|
||||
private GoodsCarAdapter mAdapter;
|
||||
private CarGoodsAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
@ -45,12 +58,102 @@ public class ShopCarActivity extends BaseActivity {
|
||||
ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("购物车");
|
||||
mDatas = new ArrayList<>();
|
||||
mAdapter = new GoodsCarAdapter(mActivity, mDatas);
|
||||
mAdapter = new CarGoodsAdapter(mActivity, mCarDatas);
|
||||
mRlvCar.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||
mRlvCar.setAdapter(mAdapter);
|
||||
mAdapter.addClick((b, i) -> new AlertDialog.Builder(mActivity)
|
||||
.setTitle("提示")
|
||||
.setMessage("确定要删除该商品吗?")
|
||||
.setPositiveButton("确定", (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
mCarDatas.remove(b);
|
||||
toSaveLocalData();
|
||||
mAdapter.setData(mCarDatas);
|
||||
countPrice();
|
||||
if (mCarDatas.size() <= 0) {
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
mTvErrorHint.setText("购物车暂无数据");
|
||||
}
|
||||
})
|
||||
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss())
|
||||
.create()
|
||||
.show());
|
||||
//点击条目
|
||||
mAdapter.addItemC((bean, i) -> {
|
||||
bean.setCheck(!bean.isCheck());
|
||||
mAdapter.setData(mCarDatas);
|
||||
countPrice();
|
||||
});
|
||||
//全选
|
||||
mCbAll.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
double totalPrice = 0.00;
|
||||
for (int i = 0; i < mCarDatas.size(); i++) {
|
||||
ShopGoodsDetailBean bean = mCarDatas.get(i);
|
||||
if (buttonView.isPressed()) {
|
||||
bean.setCheck(isChecked);
|
||||
} else {
|
||||
if (!bean.isCheck()) {
|
||||
bean.setCheck(isChecked);
|
||||
}
|
||||
}
|
||||
double v = bean.getGoodsPrice() * bean.getCarAmount();
|
||||
totalPrice += v;
|
||||
}
|
||||
if (isChecked) {
|
||||
setPrice(totalPrice);
|
||||
} else {
|
||||
setPrice(0.00);
|
||||
}
|
||||
mAdapter.setData(mCarDatas);
|
||||
});
|
||||
|
||||
mAdapter.addCheckListener((b, j, check) -> {
|
||||
//刷新价格
|
||||
countPrice();
|
||||
});
|
||||
parserShopCar();
|
||||
mTvConfirm.setOnClickListener(v -> doSaveOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交订单
|
||||
*/
|
||||
private void doSaveOrder() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void countPrice() {
|
||||
double totalPrice = 0.00;
|
||||
boolean isAll = true;
|
||||
for (int i = 0; i < mCarDatas.size(); i++) {
|
||||
ShopGoodsDetailBean bean = mCarDatas.get(i);
|
||||
if (bean.isCheck()) {
|
||||
totalPrice += (bean.getGoodsPrice() * bean.getCarAmount());
|
||||
}
|
||||
if (!bean.isCheck()) {
|
||||
isAll = false;
|
||||
}
|
||||
}
|
||||
mCbAll.setChecked(isAll);
|
||||
setPrice(totalPrice);
|
||||
}
|
||||
|
||||
private void toSaveLocalData() {
|
||||
Gson gson = new Gson();
|
||||
String s = gson.toJson(mCarDatas);
|
||||
UserLgUtils.setShopCar(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置订单价格
|
||||
*/
|
||||
private void setPrice(double price) {
|
||||
SpannableString spannableString = new SpannableString("¥" + price);
|
||||
RelativeSizeSpan relativeSizeSpan = new RelativeSizeSpan(0.6f);
|
||||
spannableString.setSpan(relativeSizeSpan, 0, 1, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
mTvPrice.setText(spannableString);
|
||||
}
|
||||
|
||||
private void parserShopCar() {
|
||||
try {
|
||||
@ -60,7 +163,15 @@ public class ShopCarActivity extends BaseActivity {
|
||||
Type type = new TypeToken<List<ShopGoodsDetailBean>>() {
|
||||
}.getType();
|
||||
mCarDatas = gson.fromJson(shopCar, type);
|
||||
parserDatas();
|
||||
LogUtils.e("购物车数据===" + mCarDatas);
|
||||
if (mCarDatas != null && mCarDatas.size() > 0) {
|
||||
countPrice();
|
||||
mAdapter.setData(mCarDatas);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
} else {
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
mTvErrorHint.setText("购物车暂无数据");
|
||||
}
|
||||
} else {
|
||||
refreshView(STATE_LOAD_EMPTY);
|
||||
mTvErrorHint.setText("购物车暂无数据");
|
||||
@ -70,25 +181,41 @@ public class ShopCarActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建数据
|
||||
*/
|
||||
private void parserDatas() {
|
||||
mDatas = new ArrayList<>();
|
||||
for (int i = 0; i < mCarDatas.size(); i++) {
|
||||
ShopGoodsDetailBean bean = mCarDatas.get(i);
|
||||
CustomCarBean b = new CustomCarBean();
|
||||
b.setShopId(bean.getShopId());
|
||||
b.setShopName(bean.getShopName());
|
||||
b.setGoods(new ArrayList<>());
|
||||
for (int j = 0; j < mCarDatas.size(); j++) {
|
||||
if (bean.getShopId().equals(mCarDatas.get(j).getShopId())) {
|
||||
b.getGoods().add(mCarDatas.get(j));
|
||||
}
|
||||
}
|
||||
mDatas.add(b);
|
||||
}
|
||||
mAdapter.setData(mDatas);
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
toSaveLocalData();
|
||||
}
|
||||
// /**
|
||||
// * 构建数据
|
||||
// */
|
||||
// private void parserDatas() {
|
||||
// mDatas = new ArrayList<>();
|
||||
// for (int i = 0; i < mCarDatas.size(); i++) {
|
||||
// ShopGoodsDetailBean bean = mCarDatas.get(i);
|
||||
// int pos = -1;
|
||||
// boolean flag = false;
|
||||
// for (int j = 0; j < mDatas.size(); j++) {
|
||||
// CustomCarBean b = mDatas.get(j);
|
||||
// if (b.getShopId().equals(bean.getShopId())) {
|
||||
// flag = true;
|
||||
// pos = j;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (flag) {
|
||||
// mDatas.get(pos).getGoods().add(bean);
|
||||
// } else {
|
||||
// CustomCarBean b = new CustomCarBean();
|
||||
// b.setShopId(bean.getShopId());
|
||||
// b.setShopName(bean.getShopName());
|
||||
// b.setGoods(new ArrayList<>());
|
||||
// b.getGoods().add(bean);
|
||||
// mDatas.add(b);
|
||||
// }
|
||||
// }
|
||||
// mAdapter.setData(mDatas);
|
||||
// refreshView(STATE_LOAD_SUCCESS);
|
||||
// }
|
||||
|
||||
}
|
@ -46,19 +46,64 @@ public class CarGoodsAdapter extends BaseRecyclerAdapter<ShopGoodsDetailBean, Ca
|
||||
h.mTvSales.setText("销量:" + bean.getGoodsSalesVolume() + "");
|
||||
h.mTvFreight.setText("1".equals(bean.getGoodsNotFreight()) ? "不包邮" : "包邮");
|
||||
h.mTvEvaluate.setText("评分:" + bean.getGoodStar() + "");
|
||||
h.mTvGoodsStandard.setText(bean.getGoodsStandarName());
|
||||
h.mAodView.setNumber(bean.getCarAmount());
|
||||
h.mAodView.setOnAddDelClickListener(new AddOrDelView.OnAddDelClickListener() {
|
||||
@Override
|
||||
public void onAddClick(View v) {
|
||||
bean.setCarAmount(bean.getCarAmount() + 1);
|
||||
notifyDataSetChanged();
|
||||
mOnCheckListener.onClick(bean, i, bean.isCheck());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDelClick(View v) {
|
||||
bean.setCarAmount(bean.getCarAmount() - 1);
|
||||
notifyDataSetChanged();
|
||||
if (bean.getCarAmount() > 1) {
|
||||
bean.setCarAmount(bean.getCarAmount() - 1);
|
||||
notifyDataSetChanged();
|
||||
mOnCheckListener.onClick(bean, i, bean.isCheck());
|
||||
}
|
||||
}
|
||||
});
|
||||
if (mOnClickLis != null) {
|
||||
h.mIvDelItem.setOnClickListener(v -> mOnClickLis.onClick(bean, i));
|
||||
}
|
||||
h.mCbCheck.setChecked(bean.isCheck());
|
||||
// h.mCbCheck.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
// mOnCheckListener.onClick(bean, i, isChecked);
|
||||
// });
|
||||
h.mLlItem.setOnClickListener(v ->mOnItemC.onItemC(bean, i));
|
||||
}
|
||||
|
||||
public OnItemC mOnItemC;
|
||||
|
||||
public void addItemC(OnItemC c) {
|
||||
this.mOnItemC = c;
|
||||
}
|
||||
|
||||
public interface OnItemC {
|
||||
void onItemC(ShopGoodsDetailBean bean, int i);
|
||||
}
|
||||
|
||||
protected OnCheckListener mOnCheckListener;
|
||||
|
||||
public void addCheckListener(OnCheckListener clickLis) {
|
||||
this.mOnCheckListener = clickLis;
|
||||
}
|
||||
|
||||
public interface OnCheckListener {
|
||||
void onClick(ShopGoodsDetailBean b, int i, boolean check);
|
||||
}
|
||||
|
||||
|
||||
protected OnClickLis mOnClickLis;
|
||||
|
||||
public void addClick(OnClickLis clickLis) {
|
||||
this.mOnClickLis = clickLis;
|
||||
}
|
||||
|
||||
public interface OnClickLis {
|
||||
void onClick(ShopGoodsDetailBean b, int i);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.tengshisoft.moduleshop.R;
|
||||
import com.tenlionsoft.moduleshop.beans.CustomCarBean;
|
||||
import com.tenlionsoft.moduleshop.beans.ShopGoodsDetailBean;
|
||||
import com.tenlionsoft.moduleshop.holder.GoodsCarHolder;
|
||||
|
||||
import java.util.List;
|
||||
@ -36,5 +37,16 @@ public class GoodsCarAdapter extends BaseRecyclerAdapter<CustomCarBean, GoodsCar
|
||||
CarGoodsAdapter adapter = new CarGoodsAdapter(mContext, bean.getGoods());
|
||||
h.mRlvGoods.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
h.mRlvGoods.setAdapter(adapter);
|
||||
adapter.addOnItemPosClickListener((shopGoodsDetailBean, p) -> mOnClickLis.onClick(shopGoodsDetailBean, i,p));
|
||||
}
|
||||
|
||||
protected OnClickLis mOnClickLis;
|
||||
|
||||
public void addClick(OnClickLis clickLis) {
|
||||
this.mOnClickLis = clickLis;
|
||||
}
|
||||
|
||||
public interface OnClickLis {
|
||||
void onClick(ShopGoodsDetailBean b, int p,int i);
|
||||
}
|
||||
}
|
||||
|
@ -15,26 +15,9 @@ public class GoodsStandardBean {
|
||||
private int goodsItemTotal;
|
||||
private String goodsItemUnit;
|
||||
private double goodsItemUnitPrice;
|
||||
private int goodsItemWeight;
|
||||
private double goodsItemWeight;
|
||||
private int isDelete;
|
||||
private String modifier;
|
||||
private boolean isCheck;
|
||||
|
||||
public String getModifier() {
|
||||
return modifier;
|
||||
}
|
||||
|
||||
public void setModifier(String modifier) {
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public boolean isCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setCheck(boolean check) {
|
||||
isCheck = check;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
@ -140,11 +123,11 @@ public class GoodsStandardBean {
|
||||
this.goodsItemUnitPrice = goodsItemUnitPrice;
|
||||
}
|
||||
|
||||
public int getGoodsItemWeight() {
|
||||
public double getGoodsItemWeight() {
|
||||
return goodsItemWeight;
|
||||
}
|
||||
|
||||
public void setGoodsItemWeight(int goodsItemWeight) {
|
||||
public void setGoodsItemWeight(double goodsItemWeight) {
|
||||
this.goodsItemWeight = goodsItemWeight;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.tenlionsoft.moduleshop.beans;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ShopGoodsDetailBean {
|
||||
public class ShopGoodsDetailBean implements Cloneable {
|
||||
|
||||
private String categoryId;
|
||||
private String categoryName;
|
||||
@ -36,13 +38,48 @@ public class ShopGoodsDetailBean {
|
||||
|
||||
//自定义 购物车中数量与商品单价
|
||||
private int carAmount;
|
||||
private String goodsPrice;
|
||||
private double goodsPrice;
|
||||
private String goodsStandarId;
|
||||
private String goodsStandarName;
|
||||
private boolean isCheck;
|
||||
|
||||
public String getGoodsPrice() {
|
||||
public boolean isCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setCheck(boolean check) {
|
||||
isCheck = check;
|
||||
}
|
||||
|
||||
public String getModifier() {
|
||||
return modifier;
|
||||
}
|
||||
|
||||
public void setModifier(String modifier) {
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public String getGoodsStandarId() {
|
||||
return goodsStandarId;
|
||||
}
|
||||
|
||||
public void setGoodsStandarId(String goodsStandarId) {
|
||||
this.goodsStandarId = goodsStandarId;
|
||||
}
|
||||
|
||||
public String getGoodsStandarName() {
|
||||
return goodsStandarName;
|
||||
}
|
||||
|
||||
public void setGoodsStandarName(String goodsStandarName) {
|
||||
this.goodsStandarName = goodsStandarName;
|
||||
}
|
||||
|
||||
public double getGoodsPrice() {
|
||||
return goodsPrice;
|
||||
}
|
||||
|
||||
public void setGoodsPrice(String goodsPrice) {
|
||||
public void setGoodsPrice(double goodsPrice) {
|
||||
this.goodsPrice = goodsPrice;
|
||||
}
|
||||
|
||||
@ -378,4 +415,20 @@ public class ShopGoodsDetailBean {
|
||||
this.shopGoodsParameterId = shopGoodsParameterId;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new Gson().toJson(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopGoodsDetailBean clone() {
|
||||
|
||||
try {
|
||||
return (ShopGoodsDetailBean) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ public class ShopSortFragment extends BaseFragment {
|
||||
RecyclerView mRlvOneSort;
|
||||
@BindView(R2.id.rlv_sort)
|
||||
RecyclerView mRlvSort;
|
||||
@BindView(R2.id.ll_car)
|
||||
LinearLayout mLlCar;
|
||||
private Unbinder mBind;
|
||||
private List<ShopSortListBean> mDatas;
|
||||
private List<ShopSortListBean.SubListBean> mSubListBeans = new ArrayList<>();
|
||||
@ -57,6 +59,17 @@ public class ShopSortFragment extends BaseFragment {
|
||||
mBind = ButterKnife.bind(this, dataView);
|
||||
setStateView(STATE_LOAD);
|
||||
mDatas = new ArrayList<>();
|
||||
mLlCar.setOnClickListener(v -> {
|
||||
if (isLogin()) {
|
||||
ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_SHOP_ACTIVITY_SHOP_CAR)
|
||||
.navigation();
|
||||
} else {
|
||||
ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_MAIN_LOGIN)
|
||||
.navigation();
|
||||
}
|
||||
});
|
||||
mOneAdapter = new ShopSortOneAdapter(mActivity, mDatas);
|
||||
mRlvOneSort.setLayoutManager(new LinearLayoutManager(mActivity));
|
||||
mRlvOneSort.setAdapter(mOneAdapter);
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.tenlionsoft.moduleshop.holder;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -21,6 +23,10 @@ public class CarGoodsHolder extends RecyclerView.ViewHolder {
|
||||
public TypeFaceTextView mTvEvaluate;
|
||||
public TypeFaceTextView mTvFreight;
|
||||
public AddOrDelView mAodView;
|
||||
public ImageView mIvDelItem;
|
||||
public TypeFaceTextView mTvGoodsStandard;
|
||||
public CheckBox mCbCheck;
|
||||
public LinearLayout mLlItem;
|
||||
|
||||
public CarGoodsHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@ -31,5 +37,9 @@ public class CarGoodsHolder extends RecyclerView.ViewHolder {
|
||||
mTvEvaluate = itemView.findViewById(R.id.tv_goods_evaluate);
|
||||
mTvFreight = itemView.findViewById(R.id.tv_goods_freight);
|
||||
mAodView = itemView.findViewById(R.id.aod_control);
|
||||
mIvDelItem = itemView.findViewById(R.id.iv_del_item);
|
||||
mTvGoodsStandard = itemView.findViewById(R.id.tv_goods_standard);
|
||||
mCbCheck = itemView.findViewById(R.id.cb_check);
|
||||
mLlItem = itemView.findViewById(R.id.ll_item);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.tenlionsoft.moduleshop.net;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.beans.BaseSuccessBean;
|
||||
import com.tenlionsoft.moduleshop.beans.GoodsListBean;
|
||||
import com.tenlionsoft.moduleshop.beans.GoodsStandardBean;
|
||||
import com.tenlionsoft.moduleshop.beans.ShopGoodsDetailBean;
|
||||
@ -8,8 +9,12 @@ import com.tenlionsoft.moduleshop.beans.ShopSortListBean;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Path;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
@ -62,4 +67,12 @@ public interface ShopApi {
|
||||
@Headers({"base_url_name:shop", "Content-Type:application/json", "Accept:application/json"})
|
||||
@GET("app/shopgoodsitem/listrelease/{goodsId}")
|
||||
Observable<List<GoodsStandardBean>> getStandardListByGoodsId(@Path("goodsId") String goodsId);
|
||||
|
||||
|
||||
/**
|
||||
* 提交订单
|
||||
*/
|
||||
@Headers({"base_url_name:shop", "Content-Type:application/json", "Accept:application/json"})
|
||||
@POST("app/order/savebycart")
|
||||
Observable<BaseSuccessBean> doSaveOrder(@Body RequestBody goods, @Header("token") String token);
|
||||
}
|
||||
|
@ -0,0 +1,143 @@
|
||||
package com.tenlionsoft.moduleshop.utils;
|
||||
|
||||
import com.sucstepsoft.cm_utils.utils.StringUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class TreeUtils {
|
||||
|
||||
// 默认 id 字段名
|
||||
private static final String ID_DEFAULT_FIELD = "shopId";
|
||||
// 默认 父级字段名
|
||||
private static final String PARENT_DEFAULT_FIELD = "shopId";
|
||||
// 默认 子级字段名
|
||||
private static final String CHILDREN_DEFAULT_FIELD = "shopId";
|
||||
|
||||
/**
|
||||
* 构建树状结构
|
||||
*
|
||||
* @param list 原数据集
|
||||
* @param parentId 父级字段名
|
||||
* @param id id字段名
|
||||
* @param children 子级字段名
|
||||
* @param clazz 数据实体
|
||||
* @param <T> 泛型
|
||||
* @return 树状结构
|
||||
*/
|
||||
public static <T> List<T> buildTree(List<T> list, String parentId, String id, String children,
|
||||
@NotNull Class clazz) {
|
||||
if (list == null) {
|
||||
return null;
|
||||
}
|
||||
// 如果被依赖字段名称为空则默认为id
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
id = ID_DEFAULT_FIELD;
|
||||
}
|
||||
// 如果依赖字段为空则默认为 parentId
|
||||
if (StringUtils.isEmpty(parentId)) {
|
||||
parentId = PARENT_DEFAULT_FIELD;
|
||||
}
|
||||
// 如果子节点集合属性名称为空则默认为children
|
||||
if (StringUtils.isEmpty(children)) {
|
||||
children = CHILDREN_DEFAULT_FIELD;
|
||||
}
|
||||
|
||||
try {
|
||||
// 获取 id 字段, 从当前对象或其父类
|
||||
Field idField;
|
||||
try {
|
||||
idField = clazz.getDeclaredField(id);
|
||||
} catch (NoSuchFieldException e1) {
|
||||
idField = clazz.getSuperclass().getDeclaredField(id);
|
||||
}
|
||||
|
||||
// 获取 parentId 字段, 从当前对象或其父类
|
||||
Field parentField;
|
||||
try {
|
||||
parentField = clazz.getDeclaredField(parentId);
|
||||
} catch (NoSuchFieldException e1) {
|
||||
parentField = clazz.getSuperclass().getDeclaredField(parentId);
|
||||
}
|
||||
|
||||
// 获取 children 字段, 从当前对象或其父类
|
||||
Field childrenField;
|
||||
try {
|
||||
childrenField = clazz.getDeclaredField(children);
|
||||
} catch (NoSuchFieldException e1) {
|
||||
childrenField = clazz.getSuperclass().getDeclaredField(children);
|
||||
}
|
||||
|
||||
// 设置为可访问
|
||||
idField.setAccessible(true);
|
||||
parentField.setAccessible(true);
|
||||
childrenField.setAccessible(true);
|
||||
return buildTree(list, parentField, idField, childrenField);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建树状结构
|
||||
*
|
||||
* @param list 数据集
|
||||
* @param parentField 父级ID字段
|
||||
* @param idField id字段
|
||||
* @param childrenField 子集字段
|
||||
* @param <T> 数据类型
|
||||
* @return 树状结构
|
||||
* @throws IllegalAccessException 异常
|
||||
*/
|
||||
public static <T> List<T> buildTree(List<T> list, Field parentField, Field idField, Field childrenField) throws IllegalAccessException {
|
||||
List<T> result = new ArrayList<>();
|
||||
|
||||
Iterator<T> iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
T root = iterator.next();
|
||||
iterator.remove();
|
||||
childrenField.set(root, findChild(root, list, parentField, idField, childrenField));
|
||||
// 刷新 iterator
|
||||
iterator = list.iterator();
|
||||
result.add(root);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找子集
|
||||
*
|
||||
* @param root 节点
|
||||
* @param list 所有集合
|
||||
* @param parentField 父级字段
|
||||
* @param idField id字段
|
||||
* @param childrenField 子级字段
|
||||
* @param <T>
|
||||
* @return 子级集合
|
||||
* @throws IllegalAccessException 异常信息
|
||||
*/
|
||||
private static <T> List<T> findChild(T root, List<T> list, Field parentField, Field idField, Field childrenField)
|
||||
throws IllegalAccessException {
|
||||
Object id = idField.get(root);
|
||||
List<T> children = new ArrayList<>();
|
||||
|
||||
Iterator<T> iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
T node = iterator.next();
|
||||
Object parentId = parentField.get(node);
|
||||
if (id.equals(parentId)) {
|
||||
iterator.remove();
|
||||
childrenField.set(node, findChild(node, list, parentField, idField, childrenField));
|
||||
// 刷新 iterator
|
||||
iterator = list.iterator();
|
||||
children.add(node);
|
||||
}
|
||||
}
|
||||
return children;
|
||||
}
|
||||
}
|
@ -46,5 +46,32 @@
|
||||
android:textColor="@color/black"
|
||||
tools:text="加载数据失败" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_car"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:background="@drawable/shape_circle_grad"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ic_shop_car_icon" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="购物车"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -10,5 +10,51 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_car"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="55dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_all"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:button="@drawable/sel_checkbox_red"
|
||||
android:text=" 全选" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_toRightOf="@id/cb_all"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="¥ 37666" />
|
||||
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/sel_btn_red_grad"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingRight="15dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="去结算"
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
@ -51,4 +51,31 @@
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_car"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:background="@drawable/shape_circle_grad"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ic_shop_car_icon" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="购物车"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
@ -6,10 +6,20 @@
|
||||
android:background="@color/white"
|
||||
android:padding="8dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_check"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:button="@drawable/sel_checkbox_red"
|
||||
android:enabled="false" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_goods_icon"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_toRightOf="@id/cb_check"
|
||||
android:scaleType="fitXY"
|
||||
tools:src="@drawable/ic_img_default" />
|
||||
|
||||
@ -20,22 +30,43 @@
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="10dp">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_goods_name"
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
tools:text="Redmi Note 12 %G 120Hz OLED屏幕 晓龙4移动平台 5000mAh 长续航 6GbOLED屏幕 晓龙4移动平台 5000mAh 长续航 6GbOLED屏幕 晓龙4移动平台 5000mAh 长续航 6Gb" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_goods_price"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
android:textSize="16sp"
|
||||
tools:text="¥1299" />
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_goods_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
tools:text="Redmi Note 12 %G 120Hz OLED屏幕 晓龙4移动平台 5000mAh 长续航 6GbOLED屏幕 晓龙4移动平台 5000mAh 长续航 6GbOLED屏幕 晓龙4移动平台 5000mAh 长续航 6Gb" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_goods_price"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
android:textSize="16sp"
|
||||
tools:text="¥1299" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_goods_standard"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/shp_sel_red_border"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
android:textSize="14sp"
|
||||
tools:text="¥1299" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -68,10 +99,10 @@
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="8dp"
|
||||
android:visibility="gone"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
android:textSize="10sp"
|
||||
android:visibility="gone"
|
||||
tools:text="评分" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
@ -94,8 +125,17 @@
|
||||
android:id="@+id/aod_control"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_toLeftOf="@id/iv_del_item" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_del_item"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/ic_del_tong" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user