Commit 073956c6 authored by jianglx's avatar jianglx

个人中心分享有礼的完善

parent dc7993c9
......@@ -51,6 +51,7 @@ public class WelcomeActivity extends BaseActivity<CommonPresenter> {
public void onGetInfoFinish(String info) {
// 客户端获取到的参数是json字符串格式
LogUtil.d("ShareInstall", "info = " + info);
// info ="{\"from\":\"singlemessage\",\"code\":\"qRj5igja_P0101\"}";
if (info.contains("code"))
try {
JSONObject object = new JSONObject(info);
......
......@@ -86,5 +86,7 @@ public class ApiConfig {
public static String HTTP_URL_PERSON_SHARE_INFO = RvFrameConfig.HOST + "/api/admin/team/promote";
public static String HTTP_URL_INCOME_RECORD = RvFrameConfig.HOST + "api/activity/activityPopularize/app/unauth/popularize-list";
public static String HTTP_URL_INCOME_RECORD = RvFrameConfig.HOST + "/api/admin/sellingwater/page";
public static String HTTP_URL_INVITE_LIST = RvFrameConfig.HOST + "/api/admin/relation/pages";
}
......@@ -538,10 +538,29 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_item_share"
android:layout_width="0dp"
android:layout_height="@dimen/size_60"
android:layout_weight="1"
android:orientation="vertical"></RelativeLayout>
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="@drawable/mycenter_icon_visitors" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/size_18"
android:text="分享有礼"
android:textColor="@color/colorMain"
android:textSize="@dimen/size_12" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
......
......@@ -4,11 +4,12 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.base.utils.ui.image.round.RoundImageView;
......@@ -20,12 +21,14 @@ import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.DisplayUtil;
import com.rv.component.utils.ZxingUtils;
import com.rv.home.rv.module.basic.BaseStatusActivity;
import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.share.presenter.ReativeBillPresenter;
import com.yuyife.okgo.OkGoUtil;
import butterknife.BindView;
import butterknife.OnClick;
public class ReativeBillActivity extends BaseStatusActivity<ReativeBillPresenter> {
public class ReativeBillActivity extends BaseStatusActivity<CommonPresenter> {
private String url;
@BindView(R2.id.ring_header)
RoundImageView roundImageView;
......@@ -37,6 +40,8 @@ public class ReativeBillActivity extends BaseStatusActivity<CommonPresenter> {
Button btnSaveBill;
@BindView(R2.id.btn_share)
Button btnShare;
@BindView(R2.id.ll_bill_content)
LinearLayout llBillContent;
public static Intent getIntent(Context context, String url) {
Intent intent = new Intent(context, ReativeBillActivity.class);
......@@ -71,6 +76,16 @@ public class ReativeBillActivity extends BaseStatusActivity<CommonPresenter> {
@Override
public void onShowResult(int requestType, BaseBean result) {
}
@OnClick({R2.id.btn_save_bill, R2.id.btn_share})
public void onViewClicked(View view) {
int id = view.getId();
if (id == R.id.btn_save_bill) {
mPresenter.saveBill(llBillContent);
} else if (id == R.id.btn_share) {
mPresenter.saveShare(llBillContent);
}
}
}
......@@ -10,7 +10,9 @@ import android.widget.TextView;
import com.base.utils.ui.datetime.selector.util.TextUtil;
import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.SPConstance;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.DisplayUtil;
......@@ -50,7 +52,7 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> {
@BindView(R2.id.tv_more_detail)
TextView tvMoreDetail;
private String shareUrl;
@Override
public void onShowResult(int requestType, BaseBean result) {
......@@ -68,8 +70,9 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> {
tvPersonInval.setText(data.getInviteNumber() + "人");
tvPersonUse.setText(data.getActivatedNumber() + "人");
if (TextUtils.isEmpty(data.getLeaderHeadUrl()) && TextUtil.isEmpty(data.getLeaderUsername())) {
// ((View) tvParentPhone.getParent().getParent()).setVisibility(View.GONE);
((View) tvParentPhone.getParent().getParent()).setVisibility(View.GONE);
} else {
((View) tvParentPhone.getParent().getParent()).setVisibility(View.VISIBLE);
if (!TextUtils.isEmpty(data.getLeaderHeadUrl())) {
GlideManager.getInstance(getApplicationContext()).loadImage(data.getLeaderHeadUrl(), imgParent);
}
......@@ -105,18 +108,21 @@ public class ShareActivity extends BaseStatusActivity<SharePresenter> {
}
@OnClick({R2.id.tv_weixin, R2.id.tv_weixin_circle, R2.id.tv_bill, R2.id.tv_more, R2.id.tv_more_detail})
@OnClick({R2.id.tv_weixin, R2.id.tv_weixin_circle, R2.id.tv_bill, R2.id.tv_more, R2.id.tv_more_detail})
public void onViewClicked(View view) {
int id = view.getId();
if (TextUtils.isEmpty(shareUrl)) {
String code = UtilsManager.getInstance(OkGoUtil.application).getSPInstance(SPConstance.USER_JSON).getString(SPConstance.USER_JSON_CODE, "");
shareUrl = RvFrameConfig.HOST + "/h5/appHtml/view/download.html?code=" + code + "_P0101";
}
if (id == R.id.tv_weixin) {
mPresenter.shareWx(RvFrameConfig.HOST + "/h5/appHtml/view/download.html", "【滴房车】", "新人专享大礼包,快去领!");
mPresenter.shareWx(shareUrl, "【滴房车】", "新人专享大礼包,快去领!");
} else if (id == R.id.tv_weixin_circle) {
mPresenter.shareWxC(RvFrameConfig.HOST + "/h5/appHtml/view/download.html", "【滴房车】", "新人专享大礼包,快去领!");
mPresenter.shareWxC(shareUrl, "【滴房车】", "新人专享大礼包,快去领!");
} else if (id == R.id.tv_bill) {
startActivity(ReativeBillActivity.getIntent(this, RvFrameConfig.HOST + "/h5/appHtml/view/download.html"));
startActivity(ReativeBillActivity.getIntent(this, shareUrl));
} else if (id == R.id.tv_more) {
mPresenter.shareMore(RvFrameConfig.HOST + "/h5/appHtml/view/download.html", "【滴房车】", "新人专享大礼包,快去领!");
mPresenter.shareMore(shareUrl, "【滴房车】", "新人专享大礼包,快去领!");
} else if (id == R.id.tv_more_detail) {
startActivity(new Intent(this, PopularizeActivity.class));
}
......
......@@ -9,14 +9,11 @@ import android.widget.LinearLayout;
import android.widget.Toast;
import com.base.utils.tools.android.NetworkUtil;
import com.ruiwenliu.wrapper.SPConstance;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.home.rv.module.basic.BaseStatusActivity;
import com.rv.share.presenter.WebViewPresenter;
import com.rv.share.view.RvWebView;
import com.yuyife.okgo.OkGoUtil;
import butterknife.BindView;
......@@ -92,7 +89,7 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
private RvWebView.WebViewListener listener = new RvWebView.WebViewListener() {
@Override
public void share(String url, String title, String desc) {
mPresenter.showShareDialog(url +UtilsManager.getInstance(OkGoUtil.application).getSPInstance(SPConstance.USER_JSON).getString(SPConstance.USER_JSON_CODE, ""), title, desc);
mPresenter.showShareDialog(url, title, desc);
}
@Override
......
package com.rv.share.adapter;
import android.support.annotation.Nullable;
import android.widget.TextView;
import com.base.utils.ui.image.round.RoundImageView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.rv.component.utils.DateUtils;
import com.rv.home.rv.module.ui.main.home.order.bean.OrderListBean;
import com.rv.share.R;
import com.rv.share.bean.IncomeRecordsBean;
import java.util.ArrayList;
import java.util.List;
public class IncomeListAdapter extends BaseQuickAdapter<IncomeRecordsBean.IncomeItem, BaseViewHolder> {
public IncomeListAdapter() {
super(R.layout.item_income, null);
public IncomeListAdapter(@Nullable List<IncomeRecordsBean.IncomeItem> data) {
super(R.layout.item_income, data);
}
@Override
protected void convert(BaseViewHolder helper, IncomeRecordsBean.IncomeItem item) {
StringBuilder buffer = new StringBuilder();
buffer.append(item.getUsername()).append("成交").append(item.getPrice()).append("元");
helper.setText(R.id.tv_income_record, buffer.toString());
helper.setText(R.id.tv_income_time, DateUtils.timestampToString1(item.getCrtTime()));
StringBuilder builder = new StringBuilder();
builder.append("+").append(item.getCommission()).append("元");
helper.setText(R.id.tv_income_price, builder.toString());
GlideManager.getInstance(mContext).loadImage(item.getHeadUrl(), (RoundImageView) helper.itemView.findViewById(R.id.rimg_header));
}
}
......@@ -2,6 +2,7 @@ package com.rv.share.bean;
import com.ruiwenliu.wrapper.base.BaseBean;
import java.math.BigDecimal;
import java.util.List;
public class IncomeRecordsBean extends BaseBean {
......@@ -25,116 +26,82 @@ public class IncomeRecordsBean extends BaseBean {
}
public static class IncomeRecordData {
private int id;
private long crtTime;
private long updTime;
private String name;
private String descr;
private String value;
private int progress;
private int type;
private String code;
private List<IncomeItem> items;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public long getCrtTime() {
return crtTime;
}
public void setCrtTime(long crtTime) {
this.crtTime = crtTime;
}
public long getUpdTime() {
return updTime;
}
public void setUpdTime(long updTime) {
this.updTime = updTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
private BigDecimal totalIncome;
private List<IncomeItem> sellingWaters;
private int pageNum;
private int pageSize;
private int totalCount;
private int totalPage;
public String getDescr() {
return descr;
public int getPageNum() {
return pageNum;
}
public void setDescr(String descr) {
this.descr = descr;
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public String getValue() {
return value;
public int getPageSize() {
return pageSize;
}
public void setValue(String value) {
this.value = value;
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getProgress() {
return progress;
public int getTotalCount() {
return totalCount;
}
public void setProgress(int progress) {
this.progress = progress;
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public int getType() {
return type;
public int getTotalPage() {
return totalPage;
}
public void setType(int type) {
this.type = type;
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public String getCode() {
return code;
public BigDecimal getTotalIncome() {
return totalIncome;
}
public void setCode(String code) {
this.code = code;
public void setTotalIncome(BigDecimal totalIncome) {
this.totalIncome = totalIncome;
}
public List<IncomeItem> getItems() {
return items;
public List<IncomeItem> getSellingWaters() {
return sellingWaters;
}
public void setItems(List<IncomeItem> items) {
this.items = items;
public void setSellingWaters(List<IncomeItem> sellingWaters) {
this.sellingWaters = sellingWaters;
}
}
public static class IncomeItem {
private int id;
private BigDecimal commission;
private long crtTime;
private long updTime;
private String name;
private String descr;
private int popularizeId;
private int progress;
private int type;
private int sort;
private int goodNumber;
private String headUrl;
private String img;
private String nickName;
private BigDecimal price;
private int status;
private String title;
private long updTime;
private String username;
private int waiting;
public int getId() {
return id;
public BigDecimal getCommission() {
return commission;
}
public void setId(int id) {
this.id = id;
public void setCommission(BigDecimal commission) {
this.commission = commission;
}
public long getCrtTime() {
......@@ -145,68 +112,84 @@ public class IncomeRecordsBean extends BaseBean {
this.crtTime = crtTime;
}
public long getUpdTime() {
return updTime;
public int getGoodNumber() {
return goodNumber;
}
public void setUpdTime(long updTime) {
this.updTime = updTime;
public void setGoodNumber(int goodNumber) {
this.goodNumber = goodNumber;
}
public String getName() {
return name;
public String getHeadUrl() {
return headUrl;
}
public void setName(String name) {
this.name = name;
public void setHeadUrl(String headUrl) {
this.headUrl = headUrl;
}
public String getDescr() {
return descr;
public String getImg() {
return img;
}
public void setDescr(String descr) {
this.descr = descr;
public void setImg(String img) {
this.img = img;
}
public int getPopularizeId() {
return popularizeId;
public String getNickName() {
return nickName;
}
public void setPopularizeId(int popularizeId) {
this.popularizeId = popularizeId;
public void setNickName(String nickName) {
this.nickName = nickName;
}
public int getProgress() {
return progress;
public BigDecimal getPrice() {
return price;
}
public void setProgress(int progress) {
this.progress = progress;
public void setPrice(BigDecimal price) {
this.price = price;
}
public int getType() {
return type;
public int getStatus() {
return status;
}
public void setType(int type) {
this.type = type;
public void setStatus(int status) {
this.status = status;
}
public int getSort() {
return sort;
public String getTitle() {
return title;
}
public void setSort(int sort) {
this.sort = sort;
public void setTitle(String title) {
this.title = title;
}
public int getStatus() {
return status;
public long getUpdTime() {
return updTime;
}
public void setStatus(int status) {
this.status = status;
public void setUpdTime(long updTime) {
this.updTime = updTime;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getWaiting() {
return waiting;
}
public void setWaiting(int waiting) {
this.waiting = waiting;
}
}
}
package com.rv.share.fragment;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.widget.LinearLayout;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.share.R;
import com.rv.share.R2;
import com.rv.share.adapter.ActivationListAdapter;
import com.rv.share.adapter.InviteListAdapter;
import com.rv.share.bean.InviteListBean;
import com.yuyife.okgo.OkGoUtil;
public class ActivationFragment extends BaseFragment<CommonPresenter> {
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import butterknife.BindView;
public class ActivationFragment extends BaseFragment<CommonPresenter> implements BaseQuickAdapter.RequestLoadMoreListener, SimpleRefreshLayout.OnSimpleRefreshListener {
@BindView(R2.id.recyclerView)
RecyclerView recyclerView;
@BindView(R2.id.refresh)
SimpleRefreshLayout refreshLayout;
private ActivationListAdapter adapter;
private int currentPage = 1;
private int pageSize = 10;
private int pageTotal = 0;
public static ActivationFragment getInstance() {
ActivationFragment fragment = new ActivationFragment();
......@@ -16,21 +47,73 @@ public class ActivationFragment extends BaseFragment<CommonPresenter> {
@Override
public int getViewLayout() {
return R.layout.fragment_activation;
return R.layout.fragment_income_record;
}
@Override
protected void initView(Bundle savedInstanceState) {
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayout.VERTICAL, false));
adapter = new ActivationListAdapter(new ArrayList<InviteListBean.inviteMember>());
adapter.setOnLoadMoreListener(this, recyclerView);
refreshLayout.setHeaderView(new SimpleRefreshView(getContext()));
refreshLayout.setOnSimpleRefreshListener(this);
recyclerView.setAdapter(adapter);
}
@Override
protected void loadData(Bundle savedInstanceState) {
getActivationData();
}
@Override
public void onShowResult(int requestType, BaseBean result) {
if (requestType == 0) {
InviteListBean bean = (InviteListBean) result;
if (bean.isRel() && bean.getData() != null && bean.getData().getInviteMembers() != null) {
if (currentPage == 1) {
pageTotal = bean.getData().getTotalPage();
refreshLayout.onRefreshComplete();
if (bean.getData().getInviteMembers().size() == 0) {
adapter.setEmptyView(getEmptyView(recyclerView, -1, getString(R.string.rv_select_not_data)));
adapter.notifyDataSetChanged();
} else {
adapter.setNewData(bean.getData().getInviteMembers());
}
} else {
adapter.addData(bean.getData().getInviteMembers());
adapter.loadMoreComplete();
}
}
}
}
private void getActivationData() {
if (!TextUtils.isEmpty(OkGoUtil.getToken())) {
Map<String, Object> header = new HashMap<>();
header.put("Authorization", OkGoUtil.getToken());
Map<String, Object> map = new HashMap<>();
map.put("state", 1);
map.put("page", currentPage);
map.put("limit", pageSize);
mPresenter.getData(RvFrameConfig.HOST, 0, ApiConfig.HTTP_URL_INVITE_LIST, InviteListBean.class, map, header, true);
}
}
@Override
public void onLoadMoreRequested() {
if (currentPage >= pageTotal) {
adapter.loadMoreEnd();
} else {
currentPage++;
getActivationData();
}
}
@Override
public void onRefresh() {
currentPage = 1;
getActivationData();
}
}
package com.rv.share.fragment;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.widget.LinearLayout;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.rv.config.RvFrameConfig;
import com.google.gson.Gson;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.share.R;
import com.rv.share.R2;
import com.rv.share.adapter.IncomeListAdapter;
import com.rv.share.bean.IncomeRecordsBean;
import com.yuyife.okgo.OkGoUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class InComeRecordFragment extends BaseFragment<CommonPresenter> {
import butterknife.BindView;
public class InComeRecordFragment extends BaseFragment<CommonPresenter> implements BaseQuickAdapter.RequestLoadMoreListener, SimpleRefreshLayout.OnSimpleRefreshListener {
@BindView(R2.id.recyclerView)
RecyclerView recyclerView;
@BindView(R2.id.refresh)
SimpleRefreshLayout refreshLayout;
private IncomeListAdapter adapter;
private int currentPage = 1;
private int pageSize = 10;
private int pageTotal = 0;
public static InComeRecordFragment getInstance() {
InComeRecordFragment fragment = new InComeRecordFragment();
......@@ -29,14 +52,17 @@ public class InComeRecordFragment extends BaseFragment<CommonPresenter> {
@Override
protected void initView(Bundle savedInstanceState) {
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayout.VERTICAL, false));
adapter = new IncomeListAdapter(new ArrayList<IncomeRecordsBean.IncomeItem>());
adapter.setOnLoadMoreListener(this, recyclerView);
refreshLayout.setHeaderView(new SimpleRefreshView(getContext()));
refreshLayout.setOnSimpleRefreshListener(this);
recyclerView.setAdapter(adapter);
}
@Override
protected void loadData(Bundle savedInstanceState) {
getIncomeData();
}
private void getIncomeData() {
......@@ -45,7 +71,8 @@ public class InComeRecordFragment extends BaseFragment<CommonPresenter> {
header.put("Authorization", OkGoUtil.getToken());
Map<String, Object> map = new HashMap<>();
map.put("code", "0101");
map.put("pageNo", currentPage);
map.put("pageSize", pageSize);
mPresenter.getData(RvFrameConfig.HOST, 0, ApiConfig.HTTP_URL_INCOME_RECORD, IncomeRecordsBean.class, map, header, true);
}
}
......@@ -54,10 +81,37 @@ public class InComeRecordFragment extends BaseFragment<CommonPresenter> {
public void onShowResult(int requestType, BaseBean result) {
if (requestType == 0) {
IncomeRecordsBean bean = (IncomeRecordsBean) result;
if (bean.isRel() && bean.getData() != null) {
if (bean.isRel() && bean.getData() != null && bean.getData().getSellingWaters() != null) {
if (currentPage == 1) {
pageTotal = bean.getData().getTotalPage();
adapter.setNewData(bean.getData().getSellingWaters());
refreshLayout.onRefreshComplete();
if (bean.getData().getSellingWaters().size() == 0) {
adapter.setEmptyView(getEmptyView(recyclerView, -1, getString(R.string.rv_select_not_data)));
adapter.notifyDataSetChanged();
}
} else {
adapter.addData(bean.getData().getSellingWaters());
adapter.loadMoreComplete();
}
}
}
}
@Override
public void onLoadMoreRequested() {
if (currentPage >= pageTotal) {
adapter.loadMoreEnd();
} else {
currentPage++;
getIncomeData();
}
}
@Override
public void onRefresh() {
currentPage = 1;
getIncomeData();
}
}
package com.rv.share.fragment;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.widget.LinearLayout;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.frame.rv.config.RvFrameConfig;
import com.google.gson.Gson;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshLayout;
import com.ruiwenliu.wrapper.weight.refresh.SimpleRefreshView;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.share.R;
import com.rv.share.R2;
import com.rv.share.adapter.InviteListAdapter;
import com.rv.share.bean.InviteListBean;
import com.yuyife.okgo.OkGoUtil;
public class InviteFragment extends BaseFragment<CommonPresenter> {
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import butterknife.BindView;
public class InviteFragment extends BaseFragment<CommonPresenter> implements BaseQuickAdapter.RequestLoadMoreListener, SimpleRefreshLayout.OnSimpleRefreshListener {
@BindView(R2.id.recyclerView)
RecyclerView recyclerView;
@BindView(R2.id.refresh)
SimpleRefreshLayout refreshLayout;
private InviteListAdapter adapter;
private int currentPage = 1;
private int pageSize = 10;
private int pageTotal = 0;
private long failureTime;
public static InviteFragment getInstance() {
InviteFragment fragment = new InviteFragment();
......@@ -16,27 +48,100 @@ public class InviteFragment extends BaseFragment<CommonPresenter> {
@Override
public int getViewLayout() {
return R.layout.fragment_invite;
return R.layout.fragment_income_record;
}
@Override
protected void initView(Bundle savedInstanceState) {
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayout.VERTICAL, false));
adapter = new InviteListAdapter(new ArrayList<InviteListBean.inviteMember>());
adapter.setOnLoadMoreListener(this, recyclerView);
refreshLayout.setHeaderView(new SimpleRefreshView(getContext()));
refreshLayout.setOnSimpleRefreshListener(this);
recyclerView.setAdapter(adapter);
}
@Override
protected void loadData(Bundle savedInstanceState) {
getIncomeData();
getInviteData();
}
@Override
public void onShowResult(int requestType, BaseBean result) {
if (requestType == 0) {
InviteListBean bean = (InviteListBean) result;
if (bean.isRel() && bean.getData() != null && bean.getData().getInviteMembers() != null) {
if (currentPage == 1) {
failureTime = bean.getData().getFailureTime();
pageTotal = bean.getData().getTotalPage();
refreshLayout.onRefreshComplete();
if (bean.getData().getInviteMembers().size() == 0) {
adapter.setEmptyView(getEmptyView(recyclerView, -1, getString(R.string.rv_select_not_data)));
adapter.notifyDataSetChanged();
} else {
adapter.setEffTime(failureTime * 1000);
adapter.setNewData(bean.getData().getInviteMembers());
}
} else {
adapter.addData(bean.getData().getInviteMembers());
adapter.loadMoreComplete();
}
}
}
}
//
// private void getInviteData() {
// String result = "{\"status\":200,\"message\":\"Success\",\"data\":{\"failureTime\":5184000,\"inviteMembers\":[ {\n" +
// " \"username\": \"15814005696\",\n" +
// " \"headUrl\": \"https://xxtest.upyuns.com/image/app/default_%20avatar.png\",\n" +
// " \"joinTime\": 1562402775992,\n" +
// " \"bindTime\": 1562402775992\n" +
// " },\n" +
// " {\n" +
// " \"username\": \"18552854696\",\n" +
// " \"headUrl\": \"https://xxtest.upyuns.com/image/app/default_%20avatar.png\",\n" +
// " \"joinTime\": 1563346993152,\n" +
// " \"bindTime\": 1563346993152\n" +
// " },\n" +
// " {\n" +
// " \"username\": \"17612025866\",\n" +
// " \"headUrl\": \"http://thirdwx.qlogo.cn/mmopen/vi_32/IEiawcHX9Y3HpqxALj6cFL7WSc8UxH7BDIHUf9gthntPdM7Ly0xnZ6sVpXic281kPb1w3oTHVbosTjc7z7Ef7naQ/132\",\n" +
// " \"joinTime\": 1563346993152,\n" +
// " \"bindTime\": 1563346993152\n" +
// " }],\"page\":1,\"limit\":10},\"rel\":true}";
// InviteListBean bean = new Gson().fromJson(result, InviteListBean.class);
// onShowResult(0, bean);
// }
private void getInviteData() {
if (!TextUtils.isEmpty(OkGoUtil.getToken())) {
Map<String, Object> header = new HashMap<>();
header.put("Authorization", OkGoUtil.getToken());
Map<String, Object> map = new HashMap<>();
map.put("state", 2);
map.put("page", currentPage);
map.put("limit", pageSize);
mPresenter.getData(RvFrameConfig.HOST, 0, ApiConfig.HTTP_URL_INVITE_LIST, InviteListBean.class, map, header, true);
}
}
/*****
* 获取收益记录记录
*/
private void getIncomeData() {
@Override
public void onLoadMoreRequested() {
if (currentPage >= pageTotal) {
adapter.loadMoreEnd();
} else {
currentPage++;
getInviteData();
}
}
@Override
public void onRefresh() {
currentPage = 1;
getInviteData();
}
}
......@@ -171,13 +171,19 @@ public class BillPresenter extends CommonPresenter {
shareDeal();
}
if (image != null) {
share(SHARE_MEDIA.WEIXIN, image, "hello");
share(SHARE_MEDIA.WEIXIN, image, "");
}
}
@Override
public void wxCShare() {
share(SHARE_MEDIA.WEIXIN_CIRCLE, "hello");
if (image == null) {
shareDeal();
}
if (image != null) {
share(SHARE_MEDIA.WEIXIN_CIRCLE, image, "");
}
}
@Override
......
......@@ -4,114 +4,141 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FEE8C3"
android:orientation="vertical"
android:weightSum="19"
tools:context=".ReativeBillActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/size_140"
android:scaleType="fitXY"
android:src="@drawable/bg_bill" />
<LinearLayout
android:id="@+id/ll_bill_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FEE8C3"
android:layout_height="0dp"
android:layout_weight="17"
android:orientation="vertical"
android:padding="@dimen/dp_10"
android:weightSum="15">
android:weightSum="17">
<android.support.v7.widget.CardView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="11"
android:background="@color/white"
app:cardCornerRadius="@dimen/size_10">
android:layout_weight="15"
android:orientation="vertical">
<LinearLayout
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
android:layout_height="@dimen/size_140"
android:scaleType="fitXY"
android:src="@drawable/bg_bill" />
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:background="@color/white"
app:cardCornerRadius="@dimen/size_10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
android:orientation="vertical">
<com.base.utils.ui.image.round.RoundImageView
android:id="@+id/ring_header"
android:layout_width="@dimen/dp_40"
android:layout_height="@dimen/dp_40" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<com.base.utils.ui.image.round.RoundImageView
android:id="@+id/ring_header"
android:layout_width="@dimen/dp_40"
android:layout_height="@dimen/dp_40" />
<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_3"
android:text="155****5918 邀请你一起参与"
android:textColor="@color/gray_707070"
android:textSize="@dimen/sp_12" />
</LinearLayout>
<ImageView
android:id="@+id/img_qrcode"
android:layout_width="@dimen/size_150"
android:layout_height="@dimen/size_150" />
<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_3"
android:text="155****5918 邀请你一起参与"
android:textColor="@color/gray_707070"
android:textSize="@dimen/sp_12" />
</LinearLayout>
<ImageView
android:id="@+id/img_qrcode"
android:layout_width="@dimen/size_150"
android:layout_height="@dimen/size_150" />
android:layout_marginTop="@dimen/size_8"
android:text="长按识别二维码领奖励"
android:textSize="@dimen/sp_14" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_8"
android:text="长按识别二维码领奖励"
android:textSize="@dimen/sp_14" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.v7.widget.CardView>
</LinearLayout>
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:gravity="center_horizontal|bottom">
android:layout_weight="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_10"
android:layout_marginRight="@dimen/size_10"
android:orientation="horizontal">
<Button
android:id="@+id/btn_save_bill"
android:layout_width="0dp"
android:layout_height="@dimen/dp_40"
android:layout_weight="1"
android:background="@drawable/bg_btn_bill_save"
android:gravity="center"
android:text="保存海报"
android:textColor="@color/colorYellow"
android:textSize="@dimen/sp_16" />
<Button
android:id="@+id/btn_share"
android:layout_width="0dp"
android:layout_height="@dimen/dp_40"
android:layout_marginLeft="@dimen/size_10"
android:layout_weight="1"
android:background="@drawable/bg_bill_share"
android:gravity="center"
android:text="分享朋友圈"
android:textColor="@color/white"
android:textSize="@dimen/sp_16" />
<ImageView
android:layout_width="@dimen/size_80"
android:layout_height="@dimen/size_40"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@drawable/icon_reative_bill" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:gravity="center_horizontal|top">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_marginLeft="@dimen/size_10"
android:layout_marginRight="@dimen/size_10"
android:orientation="horizontal">
<Button
android:id="@+id/btn_save_bill"
android:layout_width="0dp"
android:layout_height="@dimen/dp_40"
android:layout_weight="1"
android:background="@drawable/bg_btn_bill_save"
android:gravity="center"
android:text="保存海报"
android:textColor="@color/colorYellow"
android:textSize="@dimen/sp_16" />
<Button
android:id="@+id/btn_share"
android:layout_width="0dp"
android:layout_height="@dimen/dp_40"
android:layout_marginLeft="@dimen/size_10"
android:layout_weight="1"
android:background="@drawable/bg_bill_share"
android:gravity="center"
android:text="分享朋友圈"
android:textColor="@color/white"
android:textSize="@dimen/sp_16" />
</LinearLayout>
</LinearLayout>
......
......@@ -159,7 +159,7 @@
android:id="@+id/tv_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10元" />
android:text="0元" />
<TextView
android:layout_width="wrap_content"
......@@ -188,7 +188,7 @@
android:id="@+id/tv_person_inval"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10人" />
android:text="0人" />
<TextView
android:layout_width="wrap_content"
......@@ -217,7 +217,7 @@
android:id="@+id/tv_person_use"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10人" />
android:text="0人" />
<TextView
android:layout_width="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="8dp"
android:background="@color/white" />
<include layout="@layout/common_refresh" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50">
android:layout_height="@dimen/size_60"
android:gravity="center">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_10"
android:layout_marginTop="@dimen/size_5"
android:layout_marginRight="@dimen/size_10"
android:layout_marginBottom="@dimen/size_5"
android:background="@drawable/bg_income_item">
<com.base.utils.ui.image.round.RoundImageView
android:id="@+id/rimg_header"
android:layout_width="@dimen/size_30"
android:layout_height="@dimen/size_30"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/size_5" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_5"
android:layout_toRightOf="@id/rimg_header"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/tv_income_record"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tv_income_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorGray"
android:textSize="@dimen/text_10" />
</LinearLayout>
<TextView
android:id="@+id/tv_income_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/text_10"
android:textColor="@color/gray_707070"
android:textSize="@dimen/sp_14" />
</RelativeLayout>
</LinearLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment