依赖
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/universal-image-loader-1.9.3-with-sources.jar')
compile 'com.hjm:BottomTabBar:1.1.1'
compile 'com.bigkoo:convenientbanner:2.0.5'
compile 'cn.yipianfengye.android:zxing-library:2.2'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'org.xutils:xutils:3.5.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.facebook.fresco:fresco:0.12.0'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.greenrobot:eventbus:3.0.0'
testCompile 'junit:junit:4.12'自定义view加减
public class AddDeleteView extends LinearLayout {
private OnAddDelClickListener listener;
private EditText etNumber;
//对外提供一个点击的回调接口
public interface OnAddDelClickListener{
void onAddClick(View v);
void onDelClick(View v);
}
public void setOnAddDelClickListener(OnAddDelClickListener listener){
if(listener!=null){
this.listener=listener;
}
}
public AddDeleteView(Context context) {
this(context,null);
}
public AddDeleteView(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public AddDeleteView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context, attrs, defStyleAttr);
}
private void initView(Context context, AttributeSet attrs, int defStyleAttr) {
View.inflate(context, R.layout.layout_add_delete,this);
//获取控件
TextView txtDelete=findViewById(R.id.txt_delete);
TextView txtAdd=findViewById(R.id.txt_add);
etNumber = findViewById(R.id.et_number);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.AddDeleteViewStyle);
String leftText = typedArray.getString(R.styleable.AddDeleteViewStyle_left_text);
String rightText = typedArray.getString(R.styleable.AddDeleteViewStyle_right_text);
String middleText = typedArray.getString(R.styleable.AddDeleteViewStyle_middle_text);
int color = typedArray.getColor(R.styleable.AddDeleteViewStyle_left_text_color, Color.BLACK);
txtDelete.setText(leftText);
txtAdd.setText(rightText);
etNumber.setText(middleText);
txtDelete.setTextColor(color);
//回收
typedArray.recycle();
txtDelete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
listener.onDelClick(view);
}
});
txtAdd.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
listener.onAddClick(view);
}
});
}
//对外提供一个修改数字的方法
public void setNumber(int number){
if(number>0){
etNumber.setText(number+"");
}
}
//对外提供一个获取当前数字的方法
public int getNumber(){
String string = etNumber.getText().toString();
int i = Integer.parseInt(string);
return i;
}
}
Event
public class MessageEvent {
private boolean checked;
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
}价格event
public class PriceAndCountEvent {
private int price;
private int count;
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}二级列表适配
public class ShopcartAdapter extends BaseExpandableListAdapter
{
private Context context;
private List<ShopCarBean.DataBean> groupList;
private List<List<ShopCarBean.DataBean.ListBean>> childList;
private int num;
public ShopcartAdapter(List<ShopCarBean.DataBean> groupList, List<List<ShopCarBean.DataBean.ListBean>> childList, Context context) {
this.context =context;
this.groupList = groupList;
this.childList = childList;
}
@Override
public int getGroupCount() {
return groupList.size();
}
@Override
public int getChildrenCount(int i) {
return childList.get(i).size();
}
@Override
public Object getGroup(int i) {
return groupList.get(i);
}
@Override
public Object getChild(int i, int i1) {
return childList.get(i).get(i1);
}
@Override
public long getGroupId(int i) {
return i;
}
@Override
public long getChildId(int i, int i1) {
return i1;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public View getGroupView(final int i, boolean b, View view, ViewGroup viewGroup) {
final GroupViewHolder holder;
if (view == null) {
holder = new GroupViewHolder();
view = view.inflate(context, R.layout.item_shopcart_group, null);
holder.determineChekbox = view.findViewById(R.id.determine_chekbox);
holder.tvSourceName = view.findViewById(R.id.tv_source_name);
holder.tvStoreEdtor = view.findViewById(R.id.tv_store_edtor);
view.setTag(holder);
} else {
holder = (GroupViewHolder) view.getTag();
}
final ShopCarBean.DataBean dataBean = groupList.get(i);
holder.determineChekbox.setChecked(dataBean.isChecked());
// holder.tv_number.setText(dataBean.getTitle());
holder.tvSourceName.setText(dataBean.getSellerName());
//一级checkbox
holder.determineChekbox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dataBean.setChecked(holder.determineChekbox.isChecked());
changeChildCbState(i, holder.determineChekbox.isChecked());
EventBus.getDefault().post(compute());
changeAllCbState(isAllGroupCbSelected());
notifyDataSetChanged();
}
});
if (dataBean.isEdtor()) {
holder.tvStoreEdtor.setText("完成");
} else {
holder.tvStoreEdtor.setText("编辑");
}
holder.tvStoreEdtor.setOnClickListener(new GroupViewClick(i, holder.tvStoreEdtor,dataBean));
notifyDataSetChanged();
return view;
}
@Override
public View getChildView(final int i, final int i1, boolean b, View view, ViewGroup viewGroup) {
final ChildViewHolder holder;
if (view == null) {
holder = new ChildViewHolder();
view = view.inflate(context,R.layout.item_shopcart_product, null);
holder.checkBox = view.findViewById(R.id.check_box);
holder.tvIntro = view.findViewById(R.id.tv_intro);
// holder.tv_content = view.findViewById(R.id.tv_content);
// holder.tv_time = view.findViewById(R.id.tv_time);
holder.ivAdapterListPic = view.findViewById(R.id.iv_adapter_list_pic);
holder.tvPrice = view.findViewById(R.id.tv_price);
holder.tvGoodsDelete = view.findViewById(R.id.tv_goods_delete);
holder.btAdd = view.findViewById(R.id.bt_add);
holder.btReduce = view.findViewById(R.id.bt_reduce);
holder.etNum = view.findViewById(R.id.et_num);
holder.llEdtor = view.findViewById(R.id.ll_edtor);
holder.rlNoEdtor = view.findViewById(R.id.rl_no_edtor);
holder.stub = view.findViewById(R.id.stub);
holder.tvBuyNum=view.findViewById(R.id.tv_buy_num);
view.setTag(holder);
} else {
holder = (ChildViewHolder) view.getTag();
}
if (groupList.get(i).isEdtor() == true) {
holder.llEdtor.setVisibility(View.VISIBLE);
holder.rlNoEdtor.setVisibility(View.GONE);
} else {
holder.llEdtor.setVisibility(View.GONE);
holder.rlNoEdtor.setVisibility(View.VISIBLE);
}
final ShopCarBean.DataBean.ListBean datasBean = childList.get(i).get(i1);
if(b&&getChild(i,i1)!=null){
holder.stub.setVisibility(View.VISIBLE);
// TextView tv= (TextView) cholder.stub.findViewById(R.id.txtFooter);//这里用来动态显示店铺满99元包邮文字内容
}else{
holder.stub.setVisibility(View.GONE);
}
if (childList!=null){
holder.checkBox.setChecked(datasBean.isChecked());
// holder.tv_tel.setText(datasBean.getType_name());
holder.tvIntro.setText(datasBean.getTitle());
// holder.tv_content.setText(datasBean.getMsg());
// holder.tv_time.setText(datasBean.getAdd_time());
holder.tvPrice.setText("¥"+datasBean.getPrice() );
holder.etNum.setText(datasBean.getNum() + "");
String images = datasBean.getImages().trim();
String[] split = images.split("[|]");
holder.tvBuyNum.setText("X"+childList.get(i).get(i1).getNum());
Glide.with(context).load(split[0]).into(holder.ivAdapterListPic);
//二级checkbox
holder.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//设置该条目对象里的checked属性值
datasBean.setChecked(holder.checkBox.isChecked());
PriceAndCountEvent priceAndCountEvent = compute();
EventBus.getDefault().post(priceAndCountEvent);
if (holder.checkBox.isChecked()) {
//当前checkbox是选中状态
if (isAllChildCbSelected(i)) {
changGroupCbState(i, true);
changeAllCbState(isAllGroupCbSelected());
}
} else {
changGroupCbState(i, false);
changeAllCbState(isAllGroupCbSelected());
}
notifyDataSetChanged();
}
});
//加号
holder.btAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
num = datasBean.getNum();
holder.etNum.setText(++num + "");
datasBean.setNum(num);
if (holder.checkBox.isChecked()) {
EventBus.getDefault().post(compute());
}
}
});
//减号
holder.btReduce.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int num = datasBean.getNum();
if (num == 1) {
return;
}
holder.etNum.setText(--num + "");
datasBean.setNum(num);
if (holder.checkBox.isChecked()) {
EventBus.getDefault().post(compute());
}
}
});
//删除
holder.tvGoodsDelete.setOnClickListener(new View.OnClickListener() {
private AlertDialog dialog;
@Override
public void onClick(View v) {
final List<ShopCarBean.DataBean.ListBean> datasBeen = childList.get(i);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("提示");
builder.setMessage("确认是否删除?");
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int ii) {
ShopCarBean.DataBean.ListBean remove = datasBeen.remove(i1);
if (datasBeen.size() == 0) {
childList.remove(i);
groupList.remove(i);
Retrofit build = new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create())
.baseUrl("http://120.27.23.105/")
.build();
ShangchuJieko jieko = build.create(ShangchuJieko.class);
int a=i;
int b=i1;
Log.d("sasa","删除"+childList.get(i).get(i1).getPid());
Call<ShangchuBean> data = jieko.getData(2983, childList.get(a).get(b).getPid());
data.enqueue(new Callback<ShangchuBean>() {
@Override
public void onResponse(Call<ShangchuBean> call, Response<ShangchuBean> response) {
}
@Override
public void onFailure(Call<ShangchuBean> call, Throwable t) {
}
});
}
EventBus.getDefault().post(compute());
notifyDataSetChanged();
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialog.dismiss();
}
});
dialog = builder.create();
dialog.show();
}
});
}
return view;
}
@Override
public boolean isChildSelectable(int i, int i1) {
return false;
}
class GroupViewHolder {
private CheckBox determineChekbox;
private TextView tvSourceName;
private Button tvStoreEdtor;
}
class ChildViewHolder {
CheckBox checkBox;
ImageView ivAdapterListPic;
TextView tvIntro;
TextView tvColorSize;
TextView tvPrice;
TextView tvDiscountPrice;
TextView tvBuyNum;
RelativeLayout rlNoEdtor;
Button btReduce;
EditText etNum;
Button btAdd;
RelativeLayout llChangeNum;
TextView tvColorsize;
TextView tvGoodsDelete;
LinearLayout llEdtor;
ViewStub stub;
}
/**
* 改变全选的状态
*
* @param flag
*/
private void changeAllCbState(boolean flag) {
MessageEvent messageEvent = new MessageEvent();
messageEvent.setChecked(flag);
EventBus.getDefault().post(messageEvent);
}
/**
* 改变一级列表checkbox状态
*
* @param groupPosition
*/
private void changGroupCbState(int groupPosition, boolean flag) {
// GoosBean.DataBean dataBean = groupList.get(groupPosition);
ShopCarBean.DataBean dataBean = groupList.get(groupPosition);
dataBean.setChecked(flag);
}
/**
* 改变二级列表checkbox状态
*
* @param groupPosition
* @param flag
*/
private void changeChildCbState(int groupPosition, boolean flag) {
List<ShopCarBean.DataBean.ListBean> datasBeen = childList.get(groupPosition);
for (int i = 0; i < datasBeen.size(); i++) {
ShopCarBean.DataBean.ListBean datasBean = datasBeen.get(i);
datasBean.setChecked(flag);
}
}
/**
* 判断一级列表是否全部选中
*
* @return
*/
private boolean isAllGroupCbSelected() {
for (int i = 0; i < groupList.size(); i++) {
ShopCarBean.DataBean dataBean = groupList.get(i);
if (!dataBean.isChecked()) {
return false;
}
}
return true;
}
/**
* 判断二级列表是否全部选中
*
* @param groupPosition
* @return
*/
private boolean isAllChildCbSelected(int groupPosition) {
List<ShopCarBean.DataBean.ListBean> datasBeen = childList.get(groupPosition);
for (int i = 0; i < datasBeen.size(); i++) {
ShopCarBean.DataBean.ListBean datasBean = datasBeen.get(i);
if (!datasBean.isChecked()) {
return false;
}
}
return true;
}
/**
* 计算列表中,选中的钱和数量
*/
private PriceAndCountEvent compute() {
int count = 0;
int price = 0;
for (int i = 0; i < childList.size(); i++) {
List<ShopCarBean.DataBean.ListBean> datasBeen = childList.get(i);
for (int j = 0; j < datasBeen.size(); j++) {
ShopCarBean.DataBean.ListBean datasBean = datasBeen.get(j);
if (datasBean.isChecked()) {
price += datasBean.getNum() * datasBean.getPrice();
count += datasBean.getNum();
}
}
}
PriceAndCountEvent priceAndCountEvent = new PriceAndCountEvent();
priceAndCountEvent.setCount(count);
priceAndCountEvent.setPrice(price);
return priceAndCountEvent;
}
/**
* 设置全选、反选
*
* @param flag
*/
public void changeAllListCbState(boolean flag) {
for (int i = 0; i < groupList.size(); i++) {
changGroupCbState(i, flag);
changeChildCbState(i, flag);
}
EventBus.getDefault().post(compute());
notifyDataSetChanged();
}
class GroupViewClick implements View.OnClickListener {
private int groupPosition;
private Button edtor;
private ShopCarBean.DataBean dataBean;
public GroupViewClick(int groupPosition, Button edtor, ShopCarBean.DataBean dataBean) {
this.groupPosition = groupPosition;
this.edtor = edtor;
this.dataBean = dataBean;
}
@Override
public void onClick(View v) {
int groupId = v.getId();
if (groupId == edtor.getId()) {
if (dataBean.isEdtor()) {
dataBean.setEdtor(false);
} else {
dataBean.setEdtor(true);
}
notifyDataSetChanged();
}
}
}
}
fragment类public class ThreeFragment extends Fragment implements MyNews,MyNews2,CartView,View.OnClickListener{
private FenleiZuoPresenter presenter1;
private ExpandableListView exlistView;
private boolean flagedit=true;
private View view;
private RecyclerView relav;
private TuijianAdapter adapter;
private List<JsonBean.TuijianBean.ListBean> list;
private LinearLayout llShar;
private LinearLayout llInfo;
private TextView title;
private TextView subtitle;
private TextView tvTotalPrice;
private CheckBox allChekbox;
private TextView tvDelete;
private TextView tvGoToPay;
private TextView tvShare;
private TextView tvSave;
private LinearLayout llCart;
private LinearLayout cart_empty;
private double totalPrice = 0.00;// 购买的商品总价
private int totalCount = 0;// 购买的商品总数量
private ShopcartAdapter selva;
private CartPresenter presenter;
private List<ShopCarBean.DataBean> groupList = new ArrayList<>();
private List<List<ShopCarBean.DataBean.ListBean>> childList = new ArrayList<>();private int flag = 0;
private Handler handler= new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(msg.arg1==1) {
JsonBean bean = (JsonBean) msg.obj;
list = bean.getTuijian().getList();
adapter = new TuijianAdapter(getActivity(), list);
GridLayoutManager manager3 = new GridLayoutManager(getActivity(), 2);
relav.setLayoutManager(manager3);
relav.setAdapter(adapter);
}
}
};
private LinearLayout xia;
private RelativeLayout gwc_denglu;
private Button gwcdlbut;
private int shu;
private SharedPreferences name;
@Nullable
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.gouwuche_layout, container, false);
initView(view);
initEvents();
EventBus.getDefault().register(this);
EvenBuslei buslei = new EvenBuslei(true);
EventBus.getDefault().post(buslei);
presenter1 = new FenleiZuoPresenter();
presenter1.atta(this);
presenter1.getNews("http://120.27.23.105/ad/getAd");
presenter = new CartPresenter();
presenter.attachView(this);
presenter.getShows();
if(name.getInt("shu",-1)==1) {
exlistView.setVisibility(View.VISIBLE);
}else{
exlistView.setVisibility(View.GONE);
}
selva = new ShopcartAdapter(groupList, childList, getActivity());
exlistView.setAdapter(selva);
return view;
}
@Subscribe
public void getZt(XiangqingEven even){
if(even.getA()==10){
Log.d("sasa","sssasa");
groupList.clear();
childList.clear();
presenter = new CartPresenter();
presenter.attachView(this);
presenter.getShows();
selva.notifyDataSetChanged();
}
}
@Subscribe
public void getZt(EvenBuslei buslei){
name = getContext().getSharedPreferences("name", Context.MODE_APPEND);
if(name.getInt("shu",-1)==1){
exlistView.setVisibility(View.VISIBLE);
gwc_denglu.setVisibility(View.GONE);
xia.setVisibility(View.VISIBLE);
}else{
exlistView.setVisibility(View.GONE);
xia.setVisibility(View.GONE);
gwc_denglu.setVisibility(View.VISIBLE);
gwcdlbut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), Yhdlzc.class);
startActivity(intent);
}
});
}
}
private void initView(View view) {
relav = view.findViewById(R.id.gwc_rela_tuijian);
exlistView = (ExpandableListView) view.findViewById(exListView);
allChekbox = view.findViewById(R.id.all_chekbox);
subtitle = view.findViewById(R.id.subtitle);
title = view.findViewById(R.id.gwctext);
tvTotalPrice = view.findViewById(tv_total_price);
tvDelete = view.findViewById(R.id.tv_delete);
tvGoToPay = view.findViewById(R.id.tv_go_to_pay);
tvShare = view.findViewById(R.id.tv_share);
tvSave = view.findViewById(R.id.tv_save);
llShar = view.findViewById(R.id.ll_shar);
llInfo = view.findViewById(R.id.ll_info);
xia = view.findViewById(R.id.gwc_xia);
gwc_denglu = view.findViewById(R.id.gwc_denglu);
gwcdlbut = view.findViewById(R.id.gwc_dl_but);
cart_empty=view.findViewById(R.id.layout_cart_empty);
}
private void initEvents() {
allChekbox.setOnClickListener(this);
tvDelete.setOnClickListener(this);
tvGoToPay.setOnClickListener(this);
subtitle.setOnClickListener(this);
tvSave.setOnClickListener(this);
tvShare.setOnClickListener(this);
}
@Override
public void onsuess(String s) {
Gson gson = new Gson();
JsonBean jsonBean = gson.fromJson(s, JsonBean.class);
Message message=Message.obtain();
message.arg1=1;
message.obj=jsonBean;
handler.sendMessage(message);
}
@Override
public void onsuessright(String s) {
Gson gson = new Gson();
Log.d("asa","bbbb"+s);
ShopCarBean bean = gson.fromJson(s, ShopCarBean.class);
for(int i=0;i<bean.getData().size();i++){
if(bean.getData().get(i).getList()==null||bean.getData().get(i).getList().size()==0){
bean.getData().remove(i);
}
}
List<ShopCarBean.DataBean> data = bean.getData();
exlistView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView expandableListView, View view, int i, long l) {
return true;
}
});
}
@Subscribe
public void onMessageEvent(MessageEvent event) {
allChekbox.setChecked(event.isChecked());
}
@Subscribe
public void onMessageEvent(PriceAndCountEvent event) {
tvGoToPay.setText("结算(" + event.getCount() + ")");
tvTotalPrice.setText("¥"+event.getPrice() );
totalCount = event.getCount();
totalPrice = event.getPrice();
}
private void clearCart() {
subtitle.setText("编辑");
relav.setVisibility(View.VISIBLE);
tvTotalPrice.setText("¥:0.00");
}
@Override
public void onClick(View view) {
AlertDialog alert;
switch (view.getId()) {
case R.id.all_chekbox:
selva.changeAllListCbState(allChekbox.isChecked());
break;
case R.id.tv_delete:
if (totalCount == 0) {
Toast.makeText(getActivity(), "请选择要移除的商品", Toast.LENGTH_LONG).show();
return;
}
alert = new AlertDialog.Builder(getActivity()).create();
alert.setTitle("操作提示");
alert.setMessage("您确定要将这些商品从购物车中移除吗?");
alert.setButton(DialogInterface.BUTTON_NEGATIVE, "取消",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alert.setButton(DialogInterface.BUTTON_POSITIVE, "确定",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (allChekbox.isChecked()){
groupList.clear();
clearCart();
selva.notifyDataSetChanged();
}
}
});
alert.show();
break;
case R.id.tv_go_to_pay:
if (totalCount == 0) {
Toast.makeText(getActivity(), "请选择要支付的商品", Toast.LENGTH_LONG).show();
return;
}
alert = new AlertDialog.Builder(getActivity()).create();
alert.setTitle("操作提示");
alert.setMessage("总计:\n" + totalCount + "种商品\n" + totalPrice + "元");
alert.setButton(DialogInterface.BUTTON_NEGATIVE, "取消",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alert.setButton(DialogInterface.BUTTON_POSITIVE, "确定",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alert.show();
break;
case R.id.subtitle:
if (flag == 0) {
llInfo.setVisibility(View.GONE);
tvGoToPay.setVisibility(View.GONE);
llShar.setVisibility(View.VISIBLE);
relav.setVisibility(View.GONE);
subtitle.setText("完成");
} else if (flag == 1) {
llInfo.setVisibility(View.VISIBLE);
tvGoToPay.setVisibility(View.VISIBLE);
llShar.setVisibility(View.GONE);
subtitle.setText("编辑");
relav.setVisibility(View.VISIBLE);
}
flag = (flag + 1) % 2;//其余得到循环执行上面2个不同的功能
break;
case R.id.tv_share:
if (totalCount == 0) {
Toast.makeText(getActivity(), "请选择要分享的商品", Toast.LENGTH_LONG).show();
return;
}
Toast.makeText(getActivity(), "分享成功", Toast.LENGTH_SHORT).show();
break;
case R.id.tv_save:
if (totalCount == 0) {
Toast.makeText(getActivity(), "请选择要保存的商品", Toast.LENGTH_LONG).show();
return;
}
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
break;
}
}
@Override
public void onDestroy() {
super.onDestroy();
selva = null;
groupList.clear();
totalPrice = 0;
totalCount = 0;
childList.clear();
EventBus.getDefault().unregister(this);
if (presenter != null) {
presenter.detachView();
}
}
@Override
public void success(List<ShopCarBean.DataBean> data) {
for (int i = 0; i < data.size(); i++) {
if(data==null||data.get(i).getList().size()==0){
data.remove(i);
}
List<ShopCarBean.DataBean.ListBean> datas = data.get(i).getList();
childList.add(datas);
}
groupList.addAll(data);
selva.notifyDataSetChanged();
exlistView.setGroupIndicator(null);
for (int i=0;i<groupList.size();i++){
exlistView.expandGroup(i);
}
}
@Override
public void failed(Exception e) {
}
}
bean
public class ShopCarBean {
private String msg;
private String code;
private java.util.List<DataBean> data;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public java.util.List<DataBean> getData() {
return data;
}
public void setData(java.util.List<DataBean> data) {
this.data = data;
}
public class DataBean {
/**
* sellerName :
* sellerid : 0
* list : [{"bargainPrice":11800,"createtime":"2017-10-14T21:38:26","detailUrl":"https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1","images":"https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg","num":1,"pid":80,"price":777,"pscid":40,"selected":1,"sellerid":1,"subhead":"购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)","title":"全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G"},{"bargainPrice":99,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg","num":6,"pid":45,"price":2999,"pscid":39,"selected":0,"sellerid":1,"subhead":"高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!","title":"一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机"},{"bargainPrice":11800,"createtime":"2017-10-10T17:33:37","detailUrl":"https://item.m.jd.com/product/4338107.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6700/155/2098998076/156185/6cf95035/595dd5a5Nc3a7dab5.jpg!q70.jpg","num":11,"pid":57,"price":5199,"pscid":40,"selected":0,"sellerid":1,"subhead":"【i5 MX150 2G显存】全高清窄边框 8G内存 256固态硬盘 支持指纹识别 预装WIN10系统","title":"小米(MI)Air 13.3英寸全金属轻薄笔记本(i5-7200U 8G 256G PCle SSD MX150 2G独显 FHD 指纹识别 Win10)银\r\n"},{"bargainPrice":159,"createtime":"2017-10-14T21:49:15","detailUrl":"https://item.m.jd.com/product/5061723.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8716/197/1271594444/173291/2f40bb4f/59b743bcN8509428e.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8347/264/1286771527/92188/5cf5ec04/59b7420fN65378e9e.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7363/165/3000956253/190883/179a372/59b743bfNd0c79d93.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7399/112/2935531768/183594/b77c7d4a/59b7441aNc3d40133.jpg!q70.jpg","num":1,"pid":90,"price":1233,"pscid":112,"selected":0,"sellerid":1,"subhead":"针织针织闪闪闪亮你的眼","title":"维迩旎 2017秋冬新款长袖针织连衣裙韩版气质中长款名媛包臀A字裙 zx179709 黑色 XL"},{"bargainPrice":111.99,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/4719303.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9004/210/1160833155/647627/ad6be059/59b4f4e1N9a2b1532.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7504/338/63721388/491286/f5957f53/598e95f1N7f2adb87.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7441/10/64242474/419246/adb30a7d/598e95fbNd989ba0a.jpg!q70.jpg","num":2,"pid":8,"price":324,"pscid":1,"selected":0,"sellerid":1,"subhead":"每个中秋都不能简单,无论身在何处,你总需要一块饼让生活更圆满,京东月饼让爱更圆满京东自营,闪电配送,更多惊喜,快用手指戳一下","title":"北京稻香村 稻香村中秋节月饼 老北京月饼礼盒655g"}]
*/
private boolean isChecked;
private String sellerName;
private String sellerid;
private boolean isEdtor;
private java.util.List<ListBean> list;
public boolean isEdtor() {
return isEdtor;
}
public void setEdtor(boolean edtor) {
isEdtor = edtor;
}
public boolean isChecked() {
return isChecked;
}
public void setChecked(boolean checked) {
isChecked = checked;
}
public String getSellerName() {
return sellerName;
}
public void setSellerName(String sellerName) {
this.sellerName = sellerName;
}
public String getSellerid() {
return sellerid;
}
public void setSellerid(String sellerid) {
this.sellerid = sellerid;
}
public java.util.List<ListBean> getList() {
return list;
}
public void setList(java.util.List<ListBean> list) {
this.list = list;
}
public class ListBean {
/**
* bargainPrice : 11800.0
* createtime : 2017-10-14T21:38:26
* detailUrl : https://mitem.jd.hk/ware/view.action?wareId=1988853309&cachekey=1acb07a701ece8d2434a6ae7fa6870a1
* images : https://m.360buyimg.com/n0/jfs/t6130/97/1370670410/180682/1109582a/593276b1Nd81fe723.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5698/110/2617517836/202970/c9388feb/593276b7Nbd94ef1f.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5815/178/2614671118/51656/7f52d137/593276c7N107b725a.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5878/60/2557817477/30873/4502b606/593276caN5a7d6357.jpg!q70.jpg
* num : 1
* pid : 80
* price : 777.0
* pscid : 40
* selected : 1
* sellerid : 1
* subhead : 购买电脑办公部分商品满1元返火车票5元优惠券(返完即止)
* title : 全球购 新款Apple MacBook Pro 苹果笔记本电脑 银色VP2新13英寸Bar i5/8G/256G
*/
private boolean isChecked;
private double bargainPrice;
private String createtime;
private String detailUrl;
private String images;
private int num;
private int pid;
private double price;
private int pscid;
private int selected;
private int sellerid;
private String subhead;
private String title;
public boolean isChecked() {
return isChecked;
}
public void setChecked(boolean checked) {
isChecked = checked;
}
public double getBargainPrice() {
return bargainPrice;
}
public void setBargainPrice(double bargainPrice) {
this.bargainPrice = bargainPrice;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
public String getDetailUrl() {
return detailUrl;
}
public void setDetailUrl(String detailUrl) {
this.detailUrl = detailUrl;
}
public String getImages() {
return images;
}
public void setImages(String images) {
this.images = images;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getPscid() {
return pscid;
}
public void setPscid(int pscid) {
this.pscid = pscid;
}
public int getSelected() {
return selected;
}
public void setSelected(int selected) {
this.selected = selected;
}
public int getSellerid() {
return sellerid;
}
public void setSellerid(int sellerid) {
this.sellerid = sellerid;
}
public String getSubhead() {
return subhead;
}
public void setSubhead(String subhead) {
this.subhead = subhead;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "ListBean{" +
"isChecked=" + isChecked +
", bargainPrice=" + bargainPrice +
", createtime='" + createtime + '\'' +
", detailUrl='" + detailUrl + '\'' +
", images='" + images + '\'' +
", num=" + num +
", pid=" + pid +
", price=" + price +
", pscid=" + pscid +
", selected=" + selected +
", sellerid=" + sellerid +
", subhead='" + subhead + '\'' +
", title='" + title + '\'' +
'}';
}
}
}
}
视图xml
加减view
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="@+id/txt_delete"
android:layout_width="30dp"
android:layout_height="30dp"
android:text="-"
android:gravity="center"
android:background="#8b948b"/>
<EditText
android:id="@+id/et_number"
android:layout_marginTop="2dp"
android:layout_width="50dp"
android:layout_height="30dp"
android:background="@drawable/edit"
android:layout_weight="0.00"
android:gravity="center"
android:text="1"/>
<TextView
android:id="@+id/txt_add"
android:layout_width="30dp"
android:layout_height="30dp"
android:text="+"
android:gravity="center"
android:background="#8b948b"/>
</LinearLayout>商家xml item_shopcart_group
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white" >
<CheckBox
android:id="@+id/determine_chekbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="4dp"
android:button="@drawable/check_box_bg"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:gravity="center"
android:minHeight="38dp"
android:minWidth="32dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="visible" />
<TextView
android:id="@+id/tv_source_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@id/determine_chekbox"
android:background="@android:color/white"
android:drawableLeft="@drawable/shop_ico"
android:drawablePadding="10dp"
android:text="第八号当铺"
android:textColor="@color/grey_color2"
android:textSize="@dimen/txt_14" />
<Button
android:id="@+id/tv_store_edtor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="4dp"
android:background="@null"
android:text="编辑"/>
</RelativeLayout>
</LinearLayout>商品xml item_shopcart_product
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#CCCCCC" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/page_backgroup"
android:orientation="horizontal">
<CheckBox
android:id="@+id/check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="4dp"
android:button="@drawable/check_box_bg"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:gravity="center"
android:minHeight="64dp"
android:minWidth="32dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="visible" />
<ImageView
android:id="@+id/iv_adapter_list_pic"
android:layout_width="85dp"
android:layout_height="85dp"
android:layout_marginBottom="15dp"
android:layout_marginTop="13dp"
android:scaleType="centerCrop" />
<RelativeLayout
android:id="@+id/rl_no_edtor"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="13dp">
<TextView
android:id="@+id/tv_intro"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:ellipsize="end"
android:maxLines="2"
android:singleLine="true"
android:text="第八号店铺"
android:textColor="@color/grey_color1"
android:textSize="@dimen/txt_12" />
<TextView
android:id="@+id/tv_color_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginTop="5dp"
android:text="颜色:黑色;尺码:29"
android:textColor="@color/gray" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="20dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:singleLine="true"
android:text="¥ 308.00"
android:textColor="@color/orange_color"
android:textSize="@dimen/txt_14"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_discount_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/tv_price"
android:text=""
android:textColor="@color/gray"
android:textSize="@dimen/txt_10" />
<TextView
android:id="@+id/tv_buy_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:text="X 1"
android:textColor="@color/gray"
android:textSize="@dimen/txt_10" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_edtor"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="13dp"
android:orientation="horizontal"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/ll_change_num"
android:layout_width="match_parent"
android:layout_height="26dip"
android:layout_marginTop="20dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/bt_reduce"
android:layout_width="26dip"
android:layout_height="26dip"
android:background="@drawable/cart_minus_selector"
android:clickable="false"
android:focusableInTouchMode="false" />
<EditText
android:id="@+id/et_num"
style="@style/textStyle.Normal.black"
android:layout_width="40dip"
android:layout_height="26dip"
android:layout_toRightOf="@id/bt_reduce"
android:background="@drawable/icon_cart_count"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:inputType="number"
android:text="1" />
<Button
android:id="@+id/bt_add"
android:layout_width="26dip"
android:layout_height="26dip"
android:layout_toRightOf="@id/et_num"
android:background="@drawable/cart_plus_selector"
android:focusable="false"
android:focusableInTouchMode="false" />
</RelativeLayout>
<TextView
android:id="@+id/tv_colorsize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="10dp"
android:text="颜色:黑色;尺码:29"
android:textColor="@color/gray" />
</LinearLayout>
<TextView
android:id="@+id/tv_goods_delete"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="3"
android:background="@color/orange"
android:gravity="center"
android:text="删除"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
<ViewStub
android:id="@+id/stub"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout="@layout/child_footer"
/>
</LinearLayout>购物车xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/gwc_re1"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="购物车"
android:id="@+id/gwctext"
android:paddingBottom="5dp"
android:textSize="25dp"
android:layout_centerInParent="true"/>
<TextView
android:id="@+id/subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="40dp"
android:gravity="center"
android:minHeight="48dp"
android:text="编辑"
android:textColor="#1a1a1a"
android:textSize="14sp"
android:visibility="visible" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:src="@drawable/xiaoxi"/>
</RelativeLayout>
<TextView
android:layout_below="@+id/gwc_re1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/gwc_text1"
android:background="#ccc"/>
<RelativeLayout
android:layout_below="@+id/gwc_text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:id="@+id/gwc_denglu">
<Button
android:background="@drawable/bg_button"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:id="@+id/gwc_dl_but"
android:text="登录"
android:layout_marginLeft="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="登录后同步电脑与手机和购物中的商品"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/gwc_dl_but"
android:layout_marginLeft="15dp"
/>
</RelativeLayout>
<ScrollView
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/gwc_denglu">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.bawei.daohan.zidingyilei.My2View
android:layout_below="@+id/gwc_text1"
android:id="@+id/exListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginBottom="50dp"
android:childIndicator="@null"
android:groupIndicator="@null" >
</com.bawei.daohan.zidingyilei.My2View>
<include
android:id="@+id/layout_cart_empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
layout="@layout/cart_empty"
android:visibility="gone"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/gwc_tuijian"
android:id="@+id/tuijiantupian"
android:layout_marginTop="50dp"
android:layout_below="@+id/exListView"
android:layout_alignParentStart="true" />
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/gwc_rela_tuijian"
android:layout_below="@+id/tuijiantupian"
>
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
</ScrollView>
<LinearLayout
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#fff"
android:id="@+id/gwc_xia"
android:gravity="center_vertical"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/all_chekbox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:layout_marginRight="4dp"
android:button="@drawable/check_box_bg"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:gravity="center"
android:minHeight="64dp"
android:layout_marginLeft="10dp"
android:text="全选"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<LinearLayout
android:id="@+id/ll_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginRight="20dp"
android:layout_weight="1"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="right"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="合计:"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_total_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥0.00"
android:textColor="@color/orangered"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="不含运费"
android:gravity="right"
android:textColor="@color/gray"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/tv_go_to_pay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:background="@color/orange"
android:clickable="true"
android:gravity="center"
android:text="结算(0)"
android:textColor="#FAFAFA"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_shar"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:orientation="horizontal"
android:visibility="gone"
>
<TextView
android:id="@+id/tv_share"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_weight="1"
android:layout_marginLeft="5dp"
android:text="分享宝贝"
android:textColor="@color/white"
android:background="@color/orange"
android:textSize="16sp"
android:layout_marginRight="5dp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_save"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="移到收藏夹"
android:background="@color/orange"
android:textColor="@color/white"
android:layout_marginRight="5dp"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_delete"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/crimson"
android:clickable="true"
android:gravity="center"
android:text="删除"
android:textColor="#FAFAFA"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
child_footer <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/txtFooter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#345746"
android:textColor="#ffffff"
android:text="店铺满99元包邮"/>
</LinearLayout>cart_empty
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="100dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center"
android:orientation="vertical"
>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/empty_cart" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="购物车还没有商品" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="快去逛逛吧" />
</LinearLayout>
</LinearLayout>styles xml
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="textStyle"></style>
<style name="textStyle.Normal">
<item name="android:textSize">14sp</item>
</style>
<!-- 普通号 , 黑色 -->
<style name="textStyle.Normal.black" parent="textStyle.Normal">
<item name="android:textColor">@android:color/black</item>
</style>dimens
<dimen name="txt_8">8sp</dimen>
<dimen name="txt_10">14sp</dimen>
<dimen name="txt_12">16sp</dimen>
<dimen name="txt_14">18sp</dimen>
<dimen name="txt_16">16sp</dimen>
<dimen name="txt_18">18sp</dimen>
<dimen name="txt_20">20sp</dimen>
<dimen name="txt_22">22sp</dimen>
<dimen name="txt_24">24sp</dimen>
<dimen name="txt_26">26sp</dimen>
<dimen name="txt_28">28sp</dimen>color xml
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="software_textColor_selected">#f00</color>
<color name="software_textColor_unselected">#000</color>
<color name="miaosha_tv_time">#fff</color>
<color name="miaosha_tv_item_now">#f00</color>
<color name="miaoshao_tvbg">#f00</color>
<color name="white">#FFFFFF</color>
<color name="black">#000</color>
<color name="background">#f1f1f1</color>
<color name="btn_back">#e1e1e3</color>
<color name="tex_color">#b3b3b3</color>
<color name="asss">#FFFAFAFA</color>
<color name="sred">#ff4141</color>
<color name="gold">#d8ab5c</color>
<color name="orange">#ffa500</color>
<color name="pink">#ffc0cb</color>
<color name="transparent">#00000000</color>
<color name="green">#FF34A350</color>
<!-- 列表分割线 色值#999999 -->
<color name="list_divider">#999999</color>
<!-- 选中态色块 色值#D7D7D7 -->
<color name="list_item_pressed">#D7D7D7</color>
<!-- 白色 -->
<color name="ivory">#fffff0</color>
<!-- 象牙色 -->
<color name="lightyellow">#ffffe0</color>
<color name="capture_text_cover_bg">#3060a4e3</color>
<!-- 亮黄色 -->
<color name="yellow">#ffff00</color>
<!-- 黄色 -->
<color name="snow">#fffafa</color>
<!-- 雪白色 -->
<color name="floralwhite">#fffaf0</color>
<!-- 花白色 -->
<color name="lemonchiffon">#fffacd</color>
<!-- 柠檬绸色 -->
<color name="cornsilk">#fff8dc</color>
<!-- 米绸色 -->
<color name="seaShell">#fff5ee</color>
<!-- 海贝色 -->
<color name="lavenderblush">#fff0f5</color>
<!-- 淡紫红 -->
<color name="papayawhip">#ffefd5</color>
<!-- 番木色 -->
<color name="blanchedalmond">#ffebcd</color>
<!-- 白杏色 -->
<color name="mistyrose">#ffe4e1</color>
<!-- 浅玫瑰色 -->
<color name="bisque">#ffe4c4</color>
<!-- 桔黄色 -->
<color name="moccasin">#ffe4b5</color>
<!-- 鹿皮色 -->
<color name="navajowhite">#ffdead</color>
<!-- 纳瓦白 -->
<color name="peachpuff">#ffdab9</color>
<!-- 桃色 -->
<!-- 金色 -->
<!-- 粉红色 -->
<color name="lightpink">#ffb6c1</color>
<!-- 亮粉红色 -->
<!-- 橙色 -->
<color name="lightsalmon">#ffa07a</color>
<!-- 亮肉色 -->
<color name="darkorange">#ff8c00</color>
<!-- 暗桔黄色 -->
<color name="coral">#ff7f50</color>
<!-- 珊瑚色 -->
<color name="hotpink">#ff69b4</color>
<!-- 热粉红色 -->
<color name="tomato">#ff6347</color>
<!-- 西红柿色 -->
<color name="orangered">#ff4500</color>
<!-- 红橙色 -->
<color name="deeppink">#ff1493</color>
<!-- 深粉红色 -->
<color name="fuchsia">#ff00ff</color>
<!-- 紫红色 -->
<color name="magenta">#ff00ff</color>
<!-- 红紫色 -->
<color name="red">#ff0000</color>
<!-- 红色 -->
<color name="oldlace">#fdf5e6</color>
<!-- 老花色 -->
<color name="lightgoldenrodyellow">#fafad2</color>
<!-- 亮金黄色 -->
<color name="linen">#faf0e6</color>
<!-- 亚麻色 -->
<color name="antiquewhite">#faebd7</color>
<!-- 古董白 -->
<color name="salmon">#fa8072</color>
<!-- 鲜肉色 -->
<color name="ghostwhite">#f8f8ff</color>
<!-- 幽灵白 -->
<color name="mintcream">#f5fffa</color>
<!-- 薄荷色 -->
<color name="whitesmoke">#f5f5f5</color>
<!-- 烟白色 -->
<color name="beige">#f5f5dc</color>
<!-- 米色 -->
<color name="wheat">#f5deb3</color>
<!-- 浅黄色 -->
<color name="sandybrown">#f4a460</color>
<!-- 沙褐色 -->
<color name="azure">#f0ffff</color>
<!-- 天蓝色 -->
<color name="honeydew">#f0fff0</color>
<!-- 蜜色 -->
<color name="aliceblue">#f0f8ff</color>
<!-- 艾利斯兰 -->
<color name="khaki">#f0e68c</color>
<!-- 黄褐色 -->
<color name="lightcoral">#f08080</color>
<!-- 亮珊瑚色 -->
<color name="palegoldenrod">#eee8aa</color>
<!-- 苍麒麟色 -->
<color name="violet">#ee82ee</color>
<!-- 紫罗兰色 -->
<color name="darksalmon">#e9967a</color>
<!-- 暗肉色 -->
<color name="lavender">#e6e6fa</color>
<!-- 淡紫色 -->
<color name="lightcyan">#e0ffff</color>
<!-- 亮青色 -->
<color name="burlywood">#deb887</color>
<!-- 实木色 -->
<color name="plum">#dda0dd</color>
<!-- 洋李色 -->
<color name="gainsboro">#dcdcdc</color>
<!-- 淡灰色 -->
<color name="crimson">#dc143c</color>
<!-- 暗深红色 -->
<color name="palevioletred">#db7093</color>
<!-- 苍紫罗兰色 -->
<color name="goldenrod">#daa520</color>
<!-- 金麒麟色 -->
<color name="orchid">#da70d6</color>
<!-- 淡紫色 -->
<color name="thistle">#d8bfd8</color>
<!-- 蓟色 -->
<color name="lightgray">#d3d3d3</color>
<!-- 亮灰色 -->
<color name="lightgrey">#d3d3d3</color>
<!-- 亮灰色 -->
<color name="tan">#d2b48c</color>
<!-- 茶色 -->
<color name="chocolate">#d2691e</color>
<!-- 巧可力色 -->
<color name="peru">#cd853f</color>
<!-- 秘鲁色 -->
<color name="indianred">#cd5c5c</color>
<!-- 印第安红 -->
<color name="mediumvioletred">#c71585</color>
<!-- 中紫罗兰色 -->
<color name="silver">#c0c0c0</color>
<!-- 银色 -->
<color name="darkkhaki">#bdb76b</color>
<!-- 暗黄褐色 -->
<color name="rosybrown">#bc8f8f</color>
<!-- 褐玫瑰红 -->
<color name="mediumorchid">#ba55d3</color>
<!-- 中粉紫色 -->
<color name="darkgoldenrod">#b8860b</color>
<!-- 暗金黄色 -->
<color name="firebrick">#b22222</color>
<!-- 火砖色 -->
<color name="powderblue">#b0e0e6</color>
<!-- 粉蓝色 -->
<color name="lightsteelblue">#b0c4de</color>
<!-- 亮钢兰色 -->
<color name="paleturquoise">#afeeee</color>
<!-- 苍宝石绿 -->
<color name="greenyellow">#adff2f</color>
<!-- 黄绿色 -->
<color name="lightblue">#add8e6</color>
<!-- 亮蓝色 -->
<color name="darkgray">#a9a9a9</color>
<!-- 暗灰色 -->
<color name="darkgrey">#a9a9a9</color>
<!-- 暗灰色 -->
<color name="brown">#a52a2a</color>
<!-- 褐色 -->
<color name="sienna">#a0522d</color>
<!-- 赭色 -->
<color name="darkorchid">#9932cc</color>
<!-- 暗紫色 -->
<color name="palegreen">#98fb98</color>
<!-- 苍绿色 -->
<color name="darkviolet">#9400d3</color>
<!-- 暗紫罗兰色 -->
<color name="mediumpurple">#9370db</color>
<!-- 中紫色 -->
<color name="lightgreen">#90ee90</color>
<!-- 亮绿色 -->
<color name="darkseagreen">#8fbc8f</color>
<!-- 暗海兰色 -->
<color name="saddlebrown">#8b4513</color>
<!-- 重褐色 -->
<color name="darkmagenta">#8b008b</color>
<!-- 暗洋红 -->
<color name="darkred">#8b0000</color>
<!-- 暗红色 -->
<color name="blueviolet">#8a2be2</color>
<!-- 紫罗兰蓝色 -->
<color name="lightskyblue">#87cefa</color>
<!-- 亮天蓝色 -->
<color name="skyblue">#87ceeb</color>
<!-- 天蓝色 -->
<color name="gray">#808080</color>
<!-- 灰色 -->
<color name="grey">#7c7b7b</color>
<!-- 灰色 -->
<color name="olive">#808000</color>
<!-- 橄榄色 -->
<color name="purple">#800080</color>
<!-- 紫色 -->
<color name="maroon">#800000</color>
<!-- 粟色 -->
<color name="aquamarine">#7fffd4</color>
<!-- 碧绿色 -->
<color name="chartreuse">#7fff00</color>
<!-- 黄绿色 -->
<color name="lawngreen">#7cfc00</color>
<!-- 草绿色 -->
<color name="mediumslateblue">#7b68ee</color>
<!-- 中暗蓝色 -->
<color name="lightslategray">#778899</color>
<!-- 亮蓝灰 -->
<color name="lightslategrey">#778899</color>
<!-- 亮蓝灰 -->
<color name="slategray">#708090</color>
<!-- 灰石色 -->
<color name="slategrey">#708090</color>
<!-- 灰石色 -->
<color name="olivedrab">#6b8e23</color>
<!-- 深绿褐色 -->
<color name="slateblue">#6a5acd</color>
<!-- 石蓝色 -->
<color name="dimgray">#696969</color>
<!-- 暗灰色 -->
<color name="dimgrey">#696969</color>
<!-- 暗灰色 -->
<color name="mediumaquamarine">#66cdaa</color>
<!-- 中绿色 -->
<color name="cornflowerblue">#6495ed</color>
<!-- 菊兰色 -->
<color name="cadetblue">#5f9ea0</color>
<!-- 军兰色 -->
<color name="darkolivegreen">#556b2f</color>
<!-- 暗橄榄绿 -->
<color name="indigo">#4b0082</color>
<!-- 靛青色 -->
<color name="mediumturquoise">#48d1cc</color>
<!-- 中绿宝石 -->
<color name="darkslateblue">#483d8b</color>
<!-- 暗灰蓝色 -->
<color name="steelblue">#4682b4</color>
<!-- 钢兰色 -->
<color name="royalblue">#4169e1</color>
<!-- 皇家蓝 -->
<color name="turquoise">#40e0d0</color>
<!-- 青绿色 -->
<color name="mediumseagreen">#3cb371</color>
<!-- 中海蓝 -->
<color name="limegreen">#32cd32</color>
<!-- 橙绿色 -->
<color name="darkslategray">#2f4f4f</color>
<!-- 暗瓦灰色 -->
<color name="darkslategrey">#2f4f4f</color>
<!-- 暗瓦灰色 -->
<color name="seagreen">#2e8b57</color>
<!-- 海绿色 -->
<color name="forestgreen">#228b22</color>
<!-- 森林绿 -->
<color name="lightseagreen">#20b2aa</color>
<!-- 亮海蓝色 -->
<color name="dodgerblue">#1e90ff</color>
<!-- 闪兰色 -->
<color name="midnightblue">#191970</color>
<!-- 中灰兰色 -->
<color name="aqua">#00ffff</color>
<!-- 浅绿色 -->
<color name="cyan">#00ffff</color>
<!-- 青色 -->
<color name="springgreen">#00ff7f</color>
<!-- 春绿色 -->
<color name="lime">#00ff00</color>
<!-- 酸橙色 -->
<color name="mediumspringgreen">#00fa9a</color>
<!-- 中春绿色 -->
<color name="darkturquoise">#00ced1</color>
<!-- 暗宝石绿 -->
<color name="deepskyblue">#00bfff</color>
<!-- 深天蓝色 -->
<color name="darkcyan">#008b8b</color>
<!-- 暗青色 -->
<color name="teal">#008080</color>
<!-- 水鸭色 -->
<!-- 绿色 -->
<color name="darkgreen">#006400</color>
<!-- 暗绿色 -->
<color name="blue">#005dc1</color>
<!-- 蓝色 -->
<color name="mediumblue">#0000cd</color>
<!-- 中兰色 -->
<color name="darkblue">#00008b</color>
<!-- 暗蓝色 -->
<color name="navy">#000080</color>
<!-- 海军色 -->
<!-- 黑色 -->
<!-- #2b4f6d 退改签 、选择配送信息中地址 文字的颜色值 -->
<!-- 通用颜色统一风格 -->
<color name="text_click">#0174E1</color>
<color name="table_background">#cbcbcb</color>
<color name="light_white">#fcfcfc</color>
<color name="tab_main_color">#1e1d1d</color>
<color name="comm_bg">#eaeaea</color>
<!-- 加黑 -->
<color name="comm_text_black">#464646</color>
<!-- 常用左侧文字颜色 -->
<color name="comm_text_left">#3c3c3c</color>
<!-- 常用右侧文字颜色 -->
<color name="comm_text_right">#3c3c3c</color>
<color name="comm_text_red">#da1609</color>
<color name="comm_text_blue">#0f90e3</color>
<color name="comm_text_green">#66c058</color>
<color name="comm_text_yellow">#DAE532</color>
<color name="comm_button_blue">#0074E1</color>
<!-- 常用提示文字颜色 -->
<color name="comm_text_tips">#949494</color>
<!-- 分割线颜色 -->
<color name="comm_cutline">#c4c4c4</color>
<!-- 内容条目按下时的样式 -->
<color name="pressed_bg">#f2f2f2</color>
<color name="nopressed_bg">#fff</color>
<!-- 助手内容颜色 -->
<color name="title_content_color">#484848</color>
<color name="content_color">#7d7d7d</color>
<!-- 理财 -->
<color name="new_red">#D21A3E</color>
<color name="new_red_press">#B41131</color>
<color name="text_black">#515151</color>
<color name="text_left">#646464</color>
<color name="text_right">#a1a1a1</color>
<color name="text_gray">#b5b5b5</color>
<color name="cutline_gray">#c4c4c4</color>
<color name="text_yellow">#b18500</color>
<color name="btn_bg_gray">#f7f7f7</color>
<color name="new_green">#00FF99</color>
<!-- 首页快捷菜单 -->
<color name="menu_item_bg">#f6f6f6</color>
<color name="text_tips">#929292</color>
<!-- 账户总览 -->
<color name="text_left_account">#464646</color>
<color name="text_bom_account">#464646</color>
<!-- 品质生活 商品列表 -->
<color name="text_price_red">#ed3b3b</color>
<color name="text_sold_greay">#b0b0b0</color>
<color name="text_title_black">#232323</color>
<!-- 帮助中心-常见问题 -->
<color name="text_question">#333333</color>
<color name="text_answer">#777777</color>
<color name="result_view">#b0000000</color>
<color name="viewfinder_mask">#60000000</color>
<color name="possible_result_points">#c0ffff00</color>
<color name="comm_card_bg">#ffffff</color>
<color name="grey_50">#fafafa</color>
<color name="grey_200">#eeeeee</color>
<color name="btn_blue">#0067db</color>
<!-- 右边菜单点击颜色 -->
<color name="right_menu_unpressed">#CDCEC9</color>
<color name="right_menu_pressed">#C3C3C3</color>
<color name="menu_item_press">#2e000000</color>
<color name="page_backgroup">#f2f2f2</color>
<!-- 灰色 -->
<color name="grey_color1">#333333</color>
<color name="grey_color2">#666666</color>
<color name="grey_color3">#999999</color>
<!-- 橙色 -->
<color name="orange_color">#de6838</color>
</resources>
attrs xml
<resources>
<declare-styleable name="AddDeleteViewStyle">
<attr name="left_text" format="string"></attr>
<attr name="right_text" format="string"></attr>
<attr name="middle_text" format="string"></attr>
<attr name="left_text_color" format="color"></attr>
</declare-styleable>
</resources>
2203

被折叠的 条评论
为什么被折叠?



