可提现接口数据添加

This commit is contained in:
18401019693
2023-10-23 15:24:38 +08:00
parent 758b87e426
commit b90a8a69f5
7 changed files with 136 additions and 21 deletions

View File

@@ -4,8 +4,8 @@ package com.shayu.onetoone.activity;
import android.os.Bundle;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.shayu.onetoone.R;
@@ -14,19 +14,28 @@ import com.shayu.onetoone.bean.FriendAppMoneyLogModel;
import com.shayu.onetoone.bean.FriendAppMoneySumModel;
import com.shayu.onetoone.manager.OTONetManager;
import com.shayu.onetoone.manager.RouteManager;
import com.yanzhenjie.recyclerview.SwipeRecyclerView;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import java.util.List;
import io.rong.imkit.widget.refresh.SmartRefreshLayout;
import io.rong.imkit.widget.refresh.api.RefreshLayout;
import io.rong.imkit.widget.refresh.listener.OnLoadMoreListener;
import io.rong.imkit.widget.refresh.listener.OnRefreshListener;
import io.rong.imkit.widget.refresh.wrapper.RongRefreshHeader;
@Route(path = RouteManager.ACTIVITY_MY_ARN)
public class MyArnActivity extends AbsOTOActivity {
private TextView todayEarnings, cumulativeIncome;
private TextView todayEarnings, cumulativeIncome, withdrawalSum,withdrawalMoney;
private MyArnAdapter myArnAdapter;
private RecyclerView myArnList;
private SwipeRecyclerView myArnList;
private SmartRefreshLayout mRefreshLayout;
private int page = 1;
@Override
protected int getLayoutId() {
@@ -44,9 +53,26 @@ public class MyArnActivity extends AbsOTOActivity {
todayEarnings = findViewById(R.id.today_earnings);
cumulativeIncome = findViewById(R.id.cumulative_income);
myArnList = findViewById(R.id.my_arn_list);
withdrawalSum = findViewById(R.id.withdrawal_sum);
withdrawalMoney = findViewById(R.id.withdrawal_money);
mRefreshLayout = findViewById(R.id.swipeRefreshLayout);
myArnList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
myArnAdapter = new MyArnAdapter();
myArnList.setAdapter(myArnAdapter);
mRefreshLayout.setNestedScrollingEnabled(false);
mRefreshLayout.setRefreshHeader(new RongRefreshHeader(mContext));
mRefreshLayout.setRefreshFooter(new RongRefreshHeader(mContext));
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
page = 1;
refreshMyArn();
}
});
this.mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
onConversationListLoadMore();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.my_arn_back), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
@@ -57,19 +83,48 @@ public class MyArnActivity extends AbsOTOActivity {
@Override
public void onViewClicks() {
Bundle bundle = new Bundle();
bundle.putString("type","yuanbao");
RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE,bundle);
bundle.putString("type", "yuanbao");
RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE, bundle);
}
});
}
private void refreshMyArn() {
OTONetManager.getInstance(mContext).getFriendAppMoneyLogModel("3", "1", page, new HttpCallback<List<FriendAppMoneyLogModel>>() {
@Override
public void onSuccess(List<FriendAppMoneyLogModel> data) {
if (page != 1 && data.isEmpty()) {
mRefreshLayout.finishLoadMore();
return;
}
if (page != 1) {
myArnAdapter.addLst(data);
} else {
myArnAdapter.showData(data);
}
mRefreshLayout.finishRefresh();
}
@Override
public void onError(String error) {
ToastUtil.show(error);
mRefreshLayout.finishRefresh();
}
});
}
private void initData() {
OTONetManager.getInstance(mContext).getFriendAppMoneySum(new HttpCallback<FriendAppMoneySumModel>() {
@Override
public void onSuccess(FriendAppMoneySumModel data) {
todayEarnings.setText(data.getToday());
cumulativeIncome.setText(data.getSum());
withdrawalSum.setText(data.getWithdrawalModel().getSum());
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("$ ")
.append(data.getWithdrawalModel().getMoney());
withdrawalMoney.setText(stringBuffer.toString());
}
@Override
@@ -77,16 +132,12 @@ public class MyArnActivity extends AbsOTOActivity {
ToastUtil.show(error);
}
});
OTONetManager.getInstance(mContext).getFriendAppMoneyLogModel("3", "1", new HttpCallback<List<FriendAppMoneyLogModel>>() {
@Override
public void onSuccess(List<FriendAppMoneyLogModel> data) {
myArnAdapter.showData(data);
}
refreshMyArn();
}
@Override
public void onError(String error) {
ToastUtil.show(error);
}
});
private void onConversationListLoadMore() {
page++;
refreshMyArn();
mRefreshLayout.finishLoadMore();
}
}