可提现接口数据添加

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.os.Bundle;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
import com.shayu.onetoone.R; 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.bean.FriendAppMoneySumModel;
import com.shayu.onetoone.manager.OTONetManager; import com.shayu.onetoone.manager.OTONetManager;
import com.shayu.onetoone.manager.RouteManager; import com.shayu.onetoone.manager.RouteManager;
import com.yanzhenjie.recyclerview.SwipeRecyclerView;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import java.util.List; 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) @Route(path = RouteManager.ACTIVITY_MY_ARN)
public class MyArnActivity extends AbsOTOActivity { public class MyArnActivity extends AbsOTOActivity {
private TextView todayEarnings, cumulativeIncome; private TextView todayEarnings, cumulativeIncome, withdrawalSum,withdrawalMoney;
private MyArnAdapter myArnAdapter; private MyArnAdapter myArnAdapter;
private RecyclerView myArnList; private SwipeRecyclerView myArnList;
private SmartRefreshLayout mRefreshLayout;
private int page = 1;
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
@ -44,9 +53,26 @@ public class MyArnActivity extends AbsOTOActivity {
todayEarnings = findViewById(R.id.today_earnings); todayEarnings = findViewById(R.id.today_earnings);
cumulativeIncome = findViewById(R.id.cumulative_income); cumulativeIncome = findViewById(R.id.cumulative_income);
myArnList = findViewById(R.id.my_arn_list); 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)); myArnList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
myArnAdapter = new MyArnAdapter(); myArnAdapter = new MyArnAdapter();
myArnList.setAdapter(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() { ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.my_arn_back), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
@ -57,19 +83,48 @@ public class MyArnActivity extends AbsOTOActivity {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("type","yuanbao"); bundle.putString("type", "yuanbao");
RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE,bundle); 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() { private void initData() {
OTONetManager.getInstance(mContext).getFriendAppMoneySum(new HttpCallback<FriendAppMoneySumModel>() { OTONetManager.getInstance(mContext).getFriendAppMoneySum(new HttpCallback<FriendAppMoneySumModel>() {
@Override @Override
public void onSuccess(FriendAppMoneySumModel data) { public void onSuccess(FriendAppMoneySumModel data) {
todayEarnings.setText(data.getToday()); todayEarnings.setText(data.getToday());
cumulativeIncome.setText(data.getSum()); cumulativeIncome.setText(data.getSum());
withdrawalSum.setText(data.getWithdrawalModel().getSum());
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("$ ")
.append(data.getWithdrawalModel().getMoney());
withdrawalMoney.setText(stringBuffer.toString());
} }
@Override @Override
@ -77,16 +132,12 @@ public class MyArnActivity extends AbsOTOActivity {
ToastUtil.show(error); ToastUtil.show(error);
} }
}); });
OTONetManager.getInstance(mContext).getFriendAppMoneyLogModel("3", "1", new HttpCallback<List<FriendAppMoneyLogModel>>() { refreshMyArn();
@Override }
public void onSuccess(List<FriendAppMoneyLogModel> data) {
myArnAdapter.showData(data);
}
@Override private void onConversationListLoadMore() {
public void onError(String error) { page++;
ToastUtil.show(error); refreshMyArn();
} mRefreshLayout.finishLoadMore();
});
} }
} }

View File

@ -40,4 +40,9 @@ public class MyArnAdapter extends RecyclerView.Adapter {
friendAppMoneyLogModels.addAll(mFriendAppMoneyLogModels); friendAppMoneyLogModels.addAll(mFriendAppMoneyLogModels);
notifyDataSetChanged(); notifyDataSetChanged();
} }
public void addLst(List<FriendAppMoneyLogModel> mFriendAppMoneyLogModels) {
this.friendAppMoneyLogModels.addAll(mFriendAppMoneyLogModels);
notifyDataSetChanged();
}
} }

View File

@ -9,6 +9,17 @@ public class FriendAppMoneySumModel extends BaseModel {
private String today; private String today;
@SerializedName("sum") @SerializedName("sum")
private String 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() { public String getToday() {
return today; return today;

View File

@ -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;
}
}

View File

@ -1122,9 +1122,9 @@ public class OTONetManager {
* @param currencyType 1星币 2砖石 3社交新币种 * @param currencyType 1星币 2砖石 3社交新币种
* @param income 1收入 2支出 * @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). API.get().otoApi(mContext).
getFriendAppMoneyLogModel(currencyType, income) getFriendAppMoneyLogModel(currencyType, income,page)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<FriendAppMoneyLogModel>>>() { .subscribe(new Consumer<ResponseModel<List<FriendAppMoneyLogModel>>>() {

View File

@ -226,7 +226,8 @@ public interface OneToOneApi {
@GET("/api/public/?service=Friendappmoney.logs") @GET("/api/public/?service=Friendappmoney.logs")
Observable<ResponseModel<List<FriendAppMoneyLogModel>>> getFriendAppMoneyLogModel( Observable<ResponseModel<List<FriendAppMoneyLogModel>>> getFriendAppMoneyLogModel(
@Query("currency_type") String currencyType, @Query("currency_type") String currencyType,
@Query("income") String income @Query("income") String income,
@Query("p") int page
); );
/** /**

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@mipmap/background_my_arnings" android:background="@mipmap/background_my_arnings"
@ -63,8 +64,12 @@
android:gravity="center_vertical"> android:gravity="center_vertical">
<TextView <TextView
android:id="@+id/withdrawal_sum"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end"
android:maxWidth="100dp"
android:singleLine="true"
android:text="1000" android:text="1000"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="18sp" /> android:textSize="18sp" />
@ -89,9 +94,13 @@
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
android:id="@+id/withdrawal_money"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="2dp" android:layout_marginStart="2dp"
android:ellipsize="end"
android:maxWidth="100dp"
android:singleLine="true"
android:text="$ 10" android:text="$ 10"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="14sp" /> android:textSize="14sp" />
@ -200,10 +209,20 @@
app:cardCornerRadius="14dp" app:cardCornerRadius="14dp"
app:cardElevation="0dp"> app:cardElevation="0dp">
<androidx.recyclerview.widget.RecyclerView <io.rong.imkit.widget.refresh.SmartRefreshLayout
android:id="@+id/my_arn_list" android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent" 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> </androidx.cardview.widget.CardView>
<FrameLayout <FrameLayout