可提现接口数据添加
This commit is contained in:
parent
758b87e426
commit
b90a8a69f5
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -40,4 +40,9 @@ public class MyArnAdapter extends RecyclerView.Adapter {
|
||||
friendAppMoneyLogModels.addAll(mFriendAppMoneyLogModels);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addLst(List<FriendAppMoneyLogModel> mFriendAppMoneyLogModels) {
|
||||
this.friendAppMoneyLogModels.addAll(mFriendAppMoneyLogModels);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,17 @@ public class FriendAppMoneySumModel extends BaseModel {
|
||||
private String today;
|
||||
@SerializedName("sum")
|
||||
private String sum;
|
||||
@SerializedName("withdrawal")
|
||||
private WithdrawalModel withdrawalModel;
|
||||
|
||||
public WithdrawalModel getWithdrawalModel() {
|
||||
return withdrawalModel;
|
||||
}
|
||||
|
||||
public FriendAppMoneySumModel setWithdrawalModel(WithdrawalModel withdrawalModel) {
|
||||
this.withdrawalModel = withdrawalModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getToday() {
|
||||
return today;
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.shayu.onetoone.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class WithdrawalModel extends BaseModel {
|
||||
|
||||
@SerializedName("sum")
|
||||
private String sum;
|
||||
@SerializedName("money")
|
||||
private int money;
|
||||
|
||||
public String getSum() {
|
||||
return sum;
|
||||
}
|
||||
|
||||
public void setSum(String sum) {
|
||||
this.sum = sum;
|
||||
}
|
||||
|
||||
public int getMoney() {
|
||||
return money;
|
||||
}
|
||||
|
||||
public void setMoney(int money) {
|
||||
this.money = money;
|
||||
}
|
||||
}
|
@ -1122,9 +1122,9 @@ public class OTONetManager {
|
||||
* @param currencyType 1星币 2砖石 3社交新币种
|
||||
* @param income 1收入 2支出
|
||||
*/
|
||||
public void getFriendAppMoneyLogModel(String currencyType, String income, HttpCallback<List<FriendAppMoneyLogModel>> callback) {
|
||||
public void getFriendAppMoneyLogModel(String currencyType, String income, int page, HttpCallback<List<FriendAppMoneyLogModel>> callback) {
|
||||
API.get().otoApi(mContext).
|
||||
getFriendAppMoneyLogModel(currencyType, income)
|
||||
getFriendAppMoneyLogModel(currencyType, income,page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<FriendAppMoneyLogModel>>>() {
|
||||
|
@ -226,7 +226,8 @@ public interface OneToOneApi {
|
||||
@GET("/api/public/?service=Friendappmoney.logs")
|
||||
Observable<ResponseModel<List<FriendAppMoneyLogModel>>> getFriendAppMoneyLogModel(
|
||||
@Query("currency_type") String currencyType,
|
||||
@Query("income") String income
|
||||
@Query("income") String income,
|
||||
@Query("p") int page
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/background_my_arnings"
|
||||
@ -63,8 +64,12 @@
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/withdrawal_sum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="100dp"
|
||||
android:singleLine="true"
|
||||
android:text="1000"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
@ -89,9 +94,13 @@
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/withdrawal_money"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="2dp"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="100dp"
|
||||
android:singleLine="true"
|
||||
android:text="$ 10"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
@ -200,10 +209,20 @@
|
||||
app:cardCornerRadius="14dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/my_arn_list"
|
||||
<io.rong.imkit.widget.refresh.SmartRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.yanzhenjie.recyclerview.SwipeRecyclerView
|
||||
android:id="@+id/my_arn_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/view_my_arn_item_holder" />
|
||||
</io.rong.imkit.widget.refresh.SmartRefreshLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<FrameLayout
|
||||
|
Loading…
x
Reference in New Issue
Block a user