1
This commit is contained in:
@@ -90,8 +90,8 @@ public class Main2Fragment extends BaseFragment<FragmentMain2Binding> implements
|
||||
if (context instanceof OnFragmentInteractionListener) {
|
||||
mListener = (OnFragmentInteractionListener) context;
|
||||
} else {
|
||||
throw new RuntimeException(context.toString()
|
||||
+ " must implement OnFragmentInteractionListener");
|
||||
// throw new RuntimeException(context.toString()
|
||||
// + " must implement OnFragmentInteractionListener");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -218,6 +218,15 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
});
|
||||
mDataBinding.tvOrder7.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), OrderActivity.class);
|
||||
intent.putExtra("type", 1);
|
||||
intent.putExtra("orderType", 4);
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
});
|
||||
mDataBinding.tvOrder4.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -245,6 +254,15 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
});
|
||||
mDataBinding.tvOrder8.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), OrderActivity.class);
|
||||
intent.putExtra("type", 2);
|
||||
intent.putExtra("orderType", 4);
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// private void initMyReycyView() {
|
||||
|
||||
@@ -4,9 +4,12 @@ import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -19,9 +22,8 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.lzy.ninegrid.ImageInfo;
|
||||
import com.lzy.ninegrid.preview.NineGridViewClickAdapter;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.sl.house_property.BaseActivity;
|
||||
import com.sl.house_property.MainFragment;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.ItemCommentBinding;
|
||||
import com.sl.house_property.databinding.ItemDiscoveryBinding;
|
||||
@@ -55,6 +57,8 @@ public class HistoryRecordActivity extends BaseActivity<LayoutHistoryRecordBindi
|
||||
private String userId;
|
||||
private Loader loader;
|
||||
private ArrayList<DiscoveryListEntity> discoveryListEntities = new ArrayList<>();
|
||||
private ArrayList<Fragment> fragments;
|
||||
private String[] strings;
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
@@ -73,60 +77,93 @@ public class HistoryRecordActivity extends BaseActivity<LayoutHistoryRecordBindi
|
||||
// | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) //软键盘自动弹出
|
||||
.init();
|
||||
userId = getIntent().getStringExtra("userId");
|
||||
String userName = getIntent().getStringExtra("userName");
|
||||
mDataBinding.tvTitle.setText(userName);
|
||||
|
||||
// mDataBinding.tvTitle.setText(userName);
|
||||
mDataBinding.left.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
mDataBinding.tv1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (type == 2) {
|
||||
type = 1;
|
||||
page = 1;
|
||||
getData();
|
||||
mDataBinding.tv1.setTextColor(getResources().getColor(R.color.white));
|
||||
mDataBinding.tv1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
mDataBinding.tv2.setTextColor(getResources().getColor(R.color.black));
|
||||
mDataBinding.tv2.setBackgroundColor(getResources().getColor(R.color.white));
|
||||
}
|
||||
}
|
||||
});
|
||||
mDataBinding.tv2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (type == 1) {
|
||||
type = 2;
|
||||
page = 1;
|
||||
getData();
|
||||
mDataBinding.tv2.setTextColor(getResources().getColor(R.color.white));
|
||||
mDataBinding.tv2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
mDataBinding.tv1.setTextColor(getResources().getColor(R.color.black));
|
||||
mDataBinding.tv1.setBackgroundColor(getResources().getColor(R.color.white));
|
||||
}
|
||||
}
|
||||
});
|
||||
mDataBinding.dw.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
getData();
|
||||
}
|
||||
});
|
||||
intRecycleView();
|
||||
mDataBinding.dw.autoRefresh();
|
||||
strings = new String[2];
|
||||
strings[0] = "说说";
|
||||
strings[1] = "商品";
|
||||
fragments = new ArrayList<>();
|
||||
fragments.add(HistoryRecordFragment.newInstance(1, userId));
|
||||
fragments.add(HistoryRecordFragment.newInstance(2, userId));
|
||||
MyViewPagerAdapter myViewPagerAdapter = new MyViewPagerAdapter(getSupportFragmentManager());
|
||||
mDataBinding.fl.setAdapter(myViewPagerAdapter);
|
||||
mDataBinding.tb.setupWithViewPager(mDataBinding.fl);
|
||||
// mDataBinding.tv1.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
//
|
||||
// if (type == 2) {
|
||||
// type = 1;
|
||||
// page = 1;
|
||||
// getData();
|
||||
// mDataBinding.tv1.setTextColor(getResources().getColor(R.color.white));
|
||||
// mDataBinding.tv1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
// mDataBinding.tv2.setTextColor(getResources().getColor(R.color.black));
|
||||
// mDataBinding.tv2.setBackgroundColor(getResources().getColor(R.color.white));
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// mDataBinding.tv2.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// if (type == 1) {
|
||||
// type = 2;
|
||||
// page = 1;
|
||||
// getData();
|
||||
// mDataBinding.tv2.setTextColor(getResources().getColor(R.color.white));
|
||||
// mDataBinding.tv2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
// mDataBinding.tv1.setTextColor(getResources().getColor(R.color.black));
|
||||
// mDataBinding.tv1.setBackgroundColor(getResources().getColor(R.color.white));
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// mDataBinding.dw.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
// @Override
|
||||
// public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
// getData();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// page = 1;
|
||||
// getData();
|
||||
// }
|
||||
// });
|
||||
// intRecycleView();
|
||||
// mDataBinding.dw.autoRefresh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
class MyViewPagerAdapter extends FragmentPagerAdapter {
|
||||
public MyViewPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return fragments.get(position);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return fragments.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return strings[position];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void intRecycleView() {
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
package com.sl.house_property.discovery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.internal.LinkedTreeMap;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.lzy.ninegrid.ImageInfo;
|
||||
import com.lzy.ninegrid.preview.NineGridViewClickAdapter;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.sl.house_property.BaseFragment;
|
||||
import com.sl.house_property.Main2Fragment;
|
||||
import com.sl.house_property.R;
|
||||
import com.sl.house_property.databinding.FragmentHistoryRecordBinding;
|
||||
import com.sl.house_property.databinding.ItemCommentBinding;
|
||||
import com.sl.house_property.databinding.ItemDiscoveryBinding;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.squareup.picasso.Target;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import adapter.BaseRecycleViewAdapter;
|
||||
import entity.DiscoveryListEntity;
|
||||
import http.ApiConfig;
|
||||
import my_loader.Loader;
|
||||
import my_loader.Resultcode;
|
||||
import my_view.tao_bao_refresh.FullyGridLayoutManager;
|
||||
import rx.Subscription;
|
||||
import rx.functions.Action1;
|
||||
import tools.PicassoRoundTransform;
|
||||
import utils.DateUtils;
|
||||
import utils.Md5;
|
||||
|
||||
public class HistoryRecordFragment extends BaseFragment<FragmentHistoryRecordBinding> {
|
||||
private Context context;
|
||||
private int type = 2;
|
||||
private int page = 1;
|
||||
private String userId;
|
||||
private Loader loader;
|
||||
private ArrayList<DiscoveryListEntity> discoveryListEntities = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_history_record;
|
||||
}
|
||||
|
||||
public static HistoryRecordFragment newInstance(int param1, String param2) {
|
||||
HistoryRecordFragment fragment = new HistoryRecordFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("param1", param1);
|
||||
args.putString("param2", param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
type = getArguments().getInt("param1");
|
||||
userId = getArguments().getString("param2");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadData() {
|
||||
|
||||
|
||||
context = getContext();
|
||||
loader = new Loader();
|
||||
mDataBinding.dw.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
getData();
|
||||
}
|
||||
});
|
||||
intRecycleView();
|
||||
mDataBinding.dw.autoRefresh();
|
||||
}
|
||||
|
||||
|
||||
private void intRecycleView() {
|
||||
|
||||
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
|
||||
mDataBinding.recyView.setNestedScrollingEnabled(false);//禁止rcyc嵌套滑动
|
||||
mDataBinding.recyView.setLayoutManager(linearLayoutManager);
|
||||
BaseRecycleViewAdapter<DiscoveryListEntity, ItemDiscoveryBinding> baseRecycleViewAdapter = new BaseRecycleViewAdapter(context, R.layout.item_discovery);
|
||||
baseRecycleViewAdapter.setHasStableIds(true);
|
||||
|
||||
discoveryListEntities = new ArrayList<>();
|
||||
baseRecycleViewAdapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView() {
|
||||
@Override
|
||||
public void onBindViewHolder(Object b, final int position) {
|
||||
if (!(position >= discoveryListEntities.size())) {
|
||||
final ItemDiscoveryBinding homeGridAdapterItemBinding = (ItemDiscoveryBinding) b;
|
||||
// homeGridAdapterItemBinding.setMyentity(discoveryListEntities.get(position));
|
||||
homeGridAdapterItemBinding.ivComment.setVisibility(View.GONE);
|
||||
final DiscoveryListEntity discoveryListEntity = discoveryListEntities.get(position);
|
||||
homeGridAdapterItemBinding.tvNikeName.setText(discoveryListEntity.getNickname());
|
||||
homeGridAdapterItemBinding.tvContent.setText(discoveryListEntity.getGoods_detail());
|
||||
|
||||
|
||||
if (discoveryListEntity.getLike().isEmpty()) {
|
||||
homeGridAdapterItemBinding.tvLike.setVisibility(View.GONE);
|
||||
} else {
|
||||
homeGridAdapterItemBinding.tvLike.setVisibility(View.VISIBLE);
|
||||
StringBuilder likeString = new StringBuilder();
|
||||
for (int i = 0; i < discoveryListEntity.getLike().size(); i++) {
|
||||
if (i == 0) {
|
||||
likeString.append("❤");
|
||||
|
||||
} else {
|
||||
likeString.append(",");
|
||||
}
|
||||
likeString.append(discoveryListEntity.getLike().get(i).getNickname());
|
||||
}
|
||||
homeGridAdapterItemBinding.tvLike.setText(likeString.toString());
|
||||
|
||||
homeGridAdapterItemBinding.tvTime.setText(DateUtils.getDate(discoveryListEntity.getCtime()));
|
||||
|
||||
}
|
||||
if (discoveryListEntity.getDis_content().isEmpty()) {
|
||||
homeGridAdapterItemBinding.rvComment.setVisibility(View.GONE);
|
||||
} else {
|
||||
homeGridAdapterItemBinding.rvComment.setVisibility(View.VISIBLE);
|
||||
FullyGridLayoutManager mgr = new FullyGridLayoutManager(context, 1);
|
||||
mgr.setOrientation(FullyGridLayoutManager.VERTICAL);
|
||||
mgr.setSmoothScrollbarEnabled(true);
|
||||
homeGridAdapterItemBinding.rvComment.setLayoutManager(mgr);
|
||||
BaseRecycleViewAdapter<DiscoveryListEntity.Dis_content, ItemCommentBinding> baseRecycleViewAdapter = new BaseRecycleViewAdapter(context, R.layout.item_comment);
|
||||
homeGridAdapterItemBinding.rvComment.setAdapter(baseRecycleViewAdapter);
|
||||
final ArrayList<DiscoveryListEntity.Dis_content> dis_content = discoveryListEntity.getDis_content();
|
||||
baseRecycleViewAdapter.setOnBindViewHolder(new BaseRecycleViewAdapter.BindView() {
|
||||
@Override
|
||||
public void onBindViewHolder(Object b, int position) {
|
||||
ItemCommentBinding itemCommentBinding = (ItemCommentBinding) b;
|
||||
itemCommentBinding.tvName.setText(dis_content.get(position).getNickname() + ": ");
|
||||
itemCommentBinding.tvInfo.setText(dis_content.get(position).getContents());
|
||||
if (dis_content.get(position).getReply().isEmpty()) {
|
||||
itemCommentBinding.llHf.setVisibility(View.GONE);
|
||||
|
||||
} else {
|
||||
itemCommentBinding.llHf.setVisibility(View.VISIBLE);
|
||||
itemCommentBinding.tvName2.setText(discoveryListEntity.getNickname());
|
||||
itemCommentBinding.tvInfo2.setText("回复");
|
||||
itemCommentBinding.tvName3.setText(dis_content.get(position).getNickname() + ":");
|
||||
itemCommentBinding.tvInfo3.setText(dis_content.get(position).getReply());
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
baseRecycleViewAdapter.setData(dis_content);
|
||||
|
||||
}
|
||||
|
||||
|
||||
RequestOptions requestOptions = new RequestOptions();
|
||||
requestOptions.placeholder(R.mipmap.icon_default_rectangle);
|
||||
requestOptions.error(R.mipmap.icon_default_rectangle);
|
||||
|
||||
Glide.with(context).load(discoveryListEntity.getAvatar())
|
||||
.apply(requestOptions)
|
||||
.into(homeGridAdapterItemBinding.imageHead);
|
||||
ArrayList<ImageInfo> imageInfos = new ArrayList<>();
|
||||
|
||||
if (discoveryListEntity.getPic().size() > 0) {
|
||||
|
||||
// Log.e("pic", discoveryListEntity.getPic().get(0));
|
||||
for (int i = 0; i < discoveryListEntity.getPic().size(); i++) {
|
||||
if (discoveryListEntity.getPic().get(i).endsWith(".mp4") || discoveryListEntity.getPic().get(i).endsWith(".avi")) {
|
||||
ImageInfo imageInfo = new ImageInfo();
|
||||
imageInfo.setType(2);
|
||||
imageInfo.setBigImageUrl(discoveryListEntity.getPic().get(i));
|
||||
imageInfo.setThumbnailUrl(discoveryListEntity.getPic().get(i));
|
||||
imageInfos.add(imageInfo);
|
||||
} else {
|
||||
ImageInfo imageInfo = new ImageInfo();
|
||||
imageInfo.setType(1);
|
||||
imageInfo.setBigImageUrl(discoveryListEntity.getPic().get(i));
|
||||
imageInfo.setThumbnailUrl(discoveryListEntity.getPic().get(i));
|
||||
imageInfos.add(imageInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
ImageInfo imageInfo = new ImageInfo();
|
||||
imageInfo.setType(1);
|
||||
imageInfo.setBigImageUrl(discoveryListEntity.getThumb());
|
||||
imageInfo.setThumbnailUrl(discoveryListEntity.getThumb());
|
||||
imageInfos.add(imageInfo);
|
||||
}
|
||||
homeGridAdapterItemBinding.nineGrid.setAdapter(new NineGridViewClickAdapter(context, imageInfos));
|
||||
}
|
||||
}
|
||||
});
|
||||
mDataBinding.recyView.setAdapter(baseRecycleViewAdapter);
|
||||
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
}
|
||||
|
||||
private void getData() {
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("userid", userId);
|
||||
map.put("type", type + "");
|
||||
map.put("app", "Goods");
|
||||
map.put("class", "MyGoodsLists");
|
||||
map.put("page", page + "");
|
||||
map.put("sign", Md5.md5("Goods" + "MyGoodsLists" + Md5.secret));
|
||||
Subscription subscribe = loader.getMovie(ApiConfig.BASE_URL, map).subscribe(new Action1<Resultcode>() {
|
||||
@Override
|
||||
public void call(Resultcode resultcode) {
|
||||
mDataBinding.dw.finishRefresh();
|
||||
mDataBinding.dw.finishLoadMore();
|
||||
progressDialog.dismiss();
|
||||
if (!(resultcode.status == 0)) {
|
||||
Toast.makeText(context, resultcode.msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
if (resultcode.status == 0) {
|
||||
// intRecycleView();
|
||||
Gson gs = new Gson();
|
||||
LinkedTreeMap adta = (LinkedTreeMap) resultcode.data;
|
||||
String s = gs.toJson(adta);
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(s);
|
||||
org.json.JSONArray array = jsonObject.getJSONArray("info");
|
||||
Type type = new TypeToken<ArrayList<DiscoveryListEntity>>() {
|
||||
}.getType();
|
||||
if (page == 1) {
|
||||
String fengmian = jsonObject.getString("fengmian");
|
||||
String avatar = jsonObject.getString("avatar");
|
||||
Picasso.with(context).load(fengmian)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.into(target);
|
||||
Picasso.with(context).load(avatar)
|
||||
.placeholder(R.mipmap.icon_default_rectangle)
|
||||
.transform(new PicassoRoundTransform())
|
||||
.into(mDataBinding.head);
|
||||
ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
discoveryListEntities.clear();
|
||||
discoveryListEntities.addAll(o);
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
page++;
|
||||
} else {
|
||||
ArrayList<DiscoveryListEntity> o = new Gson().fromJson(array.toString(), type);
|
||||
discoveryListEntities.addAll(o);
|
||||
|
||||
BaseRecycleViewAdapter baseRecycleViewAdapter = (BaseRecycleViewAdapter) mDataBinding.recyView.getAdapter();
|
||||
baseRecycleViewAdapter.setData(discoveryListEntities);
|
||||
Log.e("sizi", discoveryListEntities.size() + "");
|
||||
// int count = jsonObject.getInt("count");
|
||||
if (o.isEmpty()) {
|
||||
mDataBinding.dw.finishLoadMoreWithNoMoreData();
|
||||
} else {
|
||||
|
||||
page++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, new Action1<Throwable>() {
|
||||
@Override
|
||||
public void call(Throwable throwable) {
|
||||
progressDialog.dismiss();
|
||||
mDataBinding.dw.finishRefresh();
|
||||
mDataBinding.dw.finishLoadMore();
|
||||
Toast.makeText(context, getString(R.string.getdatafailure), Toast.LENGTH_SHORT).show();
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private Target target = new Target() {
|
||||
@Override
|
||||
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
|
||||
Drawable drawable = new BitmapDrawable(bitmap);
|
||||
mDataBinding.v.setBackground(drawable);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBitmapFailed(Drawable errorDrawable) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareLoad(Drawable placeHolderDrawable) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class OrderActivity extends BaseActivity<ActivityOrderBinding> {
|
||||
} else if (orderType == 3) {
|
||||
mDataBinding.tvTitle.setText("待收货");
|
||||
} else if (orderType == 4) {
|
||||
mDataBinding.tvTitle.setText("待评价");
|
||||
mDataBinding.tvTitle.setText("已完成");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
80
app/src/main/res/layout/fragment_history_record.xml
Normal file
80
app/src/main/res/layout/fragment_history_record.xml
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/dw"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/white"
|
||||
app:srlDisableContentWhenLoading="true"
|
||||
app:srlEnableLoadMore="true"
|
||||
|
||||
>
|
||||
|
||||
<com.scwang.smartrefresh.layout.header.ClassicsHeader
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/sv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/v"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="230dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/head"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_below="@id/v"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="-30dp"
|
||||
android:layout_marginRight="16dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recy_view"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<com.scwang.smartrefresh.layout.footer.ClassicsFooter
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
@@ -354,6 +354,17 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="待收货" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_order7"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@mipmap/qianbao"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="已完成" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -422,6 +433,16 @@
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="待收货" />
|
||||
<TextView
|
||||
android:id="@+id/tv_order8"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:drawableTop="@mipmap/qianbao"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="已完成" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
@@ -21,52 +21,29 @@
|
||||
android:layout_gravity="center"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingRight="5dp"
|
||||
android:src="@mipmap/fanhui" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="0dp"
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center_horizontal" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/fl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/white"
|
||||
android:gravity="center"
|
||||
android:text="说说"
|
||||
android:textColor="@color/black"
|
||||
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/colorPrimary"
|
||||
android:gravity="center"
|
||||
android:text="商品"
|
||||
android:textColor="@color/white"
|
||||
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</android.support.v4.view.ViewPager>
|
||||
|
||||
<com.scwang.smartrefresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/dw"
|
||||
@@ -74,6 +51,7 @@
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/white"
|
||||
android:visibility="gone"
|
||||
app:srlDisableContentWhenLoading="true"
|
||||
app:srlEnableLoadMore="true"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user