金币兑换砖石,星币页面,消费记录页面
This commit is contained in:
parent
be02488180
commit
d7e4ad9aca
@ -145,9 +145,12 @@
|
||||
<activity
|
||||
android:name=".activity.MyArnActivity"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||
<activity
|
||||
<activity
|
||||
android:name=".activity.DiamondExchangeActivity"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".activity.ExchangeRecordActivity"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".activity.HomeScreenActivity"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||
|
@ -2,6 +2,11 @@ package com.shayu.onetoone.activity;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -10,11 +15,17 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.adapter.DiamondExchangeAdapter;
|
||||
import com.shayu.onetoone.bean.ExchangeModel;
|
||||
import com.shayu.onetoone.event.DiamondExchangeEvent;
|
||||
import com.shayu.onetoone.manager.OTONetManager;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.yunbao.common.custom.ItemDecoration;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -22,6 +33,12 @@ import java.util.List;
|
||||
public class DiamondExchangeActivity extends AbsOTOActivity {
|
||||
private RecyclerView diamondExchangeList;
|
||||
private DiamondExchangeAdapter exchangeAdapter;
|
||||
private TextView title, totalConvertibility;
|
||||
private String type = "yuanbao";
|
||||
|
||||
private EditText diamondExchangeInput;
|
||||
private String number;
|
||||
private int index = 0;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@ -30,23 +47,150 @@ public class DiamondExchangeActivity extends AbsOTOActivity {
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
Bus.getOn(this);
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
Bus.getOff(this);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
diamondExchangeList = findViewById(R.id.diamond_exchange_list);
|
||||
title = findViewById(R.id.title);
|
||||
diamondExchangeInput = findViewById(R.id.diamond_exchange_input);
|
||||
totalConvertibility = findViewById(R.id.total_convertibility);
|
||||
diamondExchangeList.addItemDecoration(new ItemDecoration(mContext, Color.parseColor("#ffffff"), 10, 2));
|
||||
diamondExchangeList.setLayoutManager(new GridLayoutManager(mContext, 3));
|
||||
exchangeAdapter = new DiamondExchangeAdapter();
|
||||
diamondExchangeList.setAdapter(exchangeAdapter);
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.arn_toggle), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (TextUtils.equals(type, "yuanbao")) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type", "coin");
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE, bundle);
|
||||
finish();
|
||||
} else {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type", "yuanbao");
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE, bundle);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.exchange_record), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (TextUtils.equals(type, "yuanbao")) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type", "coin");
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_EXCHANGE_RECORD, bundle);
|
||||
} else {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type", "yuanbao");
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_EXCHANGE_RECORD, bundle);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.immediate_exchange), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
String exchangeNumber = "";
|
||||
if (TextUtils.isEmpty(number)) {
|
||||
exchangeNumber = diamondExchangeInput.getText().toString();
|
||||
} else {
|
||||
exchangeNumber = number;
|
||||
}
|
||||
OTONetManager.getInstance(mContext).getTransform(type, exchangeNumber, new HttpCallback<List<ExchangeModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ExchangeModel> data) {
|
||||
if (data.size() > 0) {
|
||||
if ((data.size() - 1) > index && index > 0) {
|
||||
data.get(index).setSelect(true);
|
||||
totalConvertibility.setText(String.valueOf(data.get(0).getNum()));
|
||||
number = data.get(index).getNum();
|
||||
} else {
|
||||
if (TextUtils.isEmpty(diamondExchangeInput.getText().toString())) {
|
||||
data.get(0).setSelect(true);
|
||||
totalConvertibility.setText(String.valueOf(data.get(0).getNum()));
|
||||
number = data.get(0).getNum();
|
||||
} else {
|
||||
totalConvertibility.setText(String.valueOf(data.get(0).getNum()));
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
data.get(i).setSelect(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exchangeAdapter.addData(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
diamondExchangeInput.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
if (!TextUtils.isEmpty(diamondExchangeInput.getText().toString()) && !TextUtils.isEmpty(number)) {
|
||||
exchangeAdapter.unSelect();
|
||||
number = null;
|
||||
index = -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.one_back), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
OTONetManager.getInstance(mContext).getExchangeList("yuanbao", new HttpCallback<List<ExchangeModel>>() {
|
||||
|
||||
if (getIntent() != null && getIntent().getBundleExtra("bundle") != null) {
|
||||
type = getIntent().getBundleExtra("bundle").getString("type");
|
||||
if (TextUtils.equals(type, "yuanbao")) {
|
||||
title.setText(getString(R.string.my_arnings_exchange_star));
|
||||
} else {
|
||||
title.setText(getString(R.string.my_arnings_exchange_diamond));
|
||||
}
|
||||
}
|
||||
OTONetManager.getInstance(mContext).getExchangeList(type, new HttpCallback<List<ExchangeModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ExchangeModel> data) {
|
||||
exchangeAdapter.addData(data);
|
||||
if (data.size() > 0) {
|
||||
data.get(0).setSelect(true);
|
||||
totalConvertibility.setText(String.valueOf(data.get(0).getNum()));
|
||||
number = data.get(0).getNum();
|
||||
exchangeAdapter.addData(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,4 +199,11 @@ public class DiamondExchangeActivity extends AbsOTOActivity {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onExchangeModel(DiamondExchangeEvent event) {
|
||||
number = event.getNum();
|
||||
index = event.getIndex();
|
||||
diamondExchangeInput.setText("");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,114 @@
|
||||
package com.shayu.onetoone.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.adapter.ExchangeRecordAdapter;
|
||||
import com.shayu.onetoone.bean.ExchangeRecordModel;
|
||||
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.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_EXCHANGE_RECORD)
|
||||
public class ExchangeRecordActivity extends AbsOTOActivity {
|
||||
private ExchangeRecordAdapter recordAdapter;
|
||||
private SmartRefreshLayout mRefreshLayout;
|
||||
private SwipeRecyclerView recyclerView;
|
||||
private int page = 1;
|
||||
|
||||
private String type = "10";
|
||||
private String mType = "10";
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_exchange_record;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
if (getIntent() != null && getIntent().getBundleExtra("bundle") != null) {
|
||||
mType = getIntent().getBundleExtra("bundle").getString("type");
|
||||
if (TextUtils.equals(mType, "yuanbao")) {
|
||||
type = "11";
|
||||
} else {
|
||||
type = "10";
|
||||
}
|
||||
}
|
||||
initView();
|
||||
initData();
|
||||
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
mRefreshLayout = findViewById(R.id.swipeRefreshLayout);
|
||||
recordAdapter = new ExchangeRecordAdapter();
|
||||
recyclerView.setAdapter(recordAdapter);
|
||||
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;
|
||||
initData();
|
||||
}
|
||||
});
|
||||
this.mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
onConversationListLoadMore();
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.one_back), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
OTONetManager.getInstance(mContext).
|
||||
getExchangeRecord(type, "3", "2", page, new HttpCallback<List<ExchangeRecordModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ExchangeRecordModel> data) {
|
||||
if (page != 1 && data.isEmpty()) {
|
||||
mRefreshLayout.finishLoadMore();
|
||||
return;
|
||||
}
|
||||
if (page != 1) {
|
||||
recordAdapter.addLst(data);
|
||||
} else {
|
||||
recordAdapter.setList(data);
|
||||
}
|
||||
mRefreshLayout.finishRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
mRefreshLayout.finishRefresh();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void onConversationListLoadMore() {
|
||||
page++;
|
||||
initData();
|
||||
mRefreshLayout.finishLoadMore();
|
||||
}
|
||||
}
|
@ -56,7 +56,9 @@ public class MyArnActivity extends AbsOTOActivity {
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.diamond_star_coins), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type","yuanbao");
|
||||
RouteManager.forwardActivity(RouteManager.ACTIVITY_DIAMOND_EXCHANGE,bundle);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -27,7 +27,16 @@ public class DiamondExchangeAdapter extends RecyclerView.Adapter {
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
DiamondExchangeViewHolder exchangeViewHolder = (DiamondExchangeViewHolder) holder;
|
||||
exchangeViewHolder.showData(exchangeModels.get(position));
|
||||
exchangeViewHolder.showData(exchangeModels.get(position), position);
|
||||
exchangeViewHolder.setListener(new DiamondExchangeViewHolder.DiamondExchangeClickListener() {
|
||||
@Override
|
||||
public void onDiamondExchangeClickListener(ExchangeModel model, int position) {
|
||||
for (int i = 0; i < exchangeModels.size(); i++) {
|
||||
exchangeModels.get(i).setSelect(i == position);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -38,5 +47,13 @@ public class DiamondExchangeAdapter extends RecyclerView.Adapter {
|
||||
public void addData(List<ExchangeModel> mExchangeModels) {
|
||||
exchangeModels.clear();
|
||||
exchangeModels.addAll(mExchangeModels);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void unSelect() {
|
||||
for (int i = 0; i < exchangeModels.size(); i++) {
|
||||
exchangeModels.get(i).setSelect(false);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
package com.shayu.onetoone.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.ExchangeRecordModel;
|
||||
import com.shayu.onetoone.view.ExchangeRecordViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ExchangeRecordAdapter extends RecyclerView.Adapter<ExchangeRecordViewHolder> {
|
||||
private List<ExchangeRecordModel> exchangeRecordModels = new ArrayList<>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ExchangeRecordViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View bodyView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_exchange_record_item_holder, parent, false);
|
||||
return new ExchangeRecordViewHolder(bodyView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ExchangeRecordViewHolder holder, int position) {
|
||||
holder.setData(exchangeRecordModels.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return exchangeRecordModels.size();
|
||||
}
|
||||
|
||||
public void setList(List<ExchangeRecordModel> mExchangeRecordModels) {
|
||||
this.exchangeRecordModels = mExchangeRecordModels;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addLst(List<ExchangeRecordModel> mExchangeRecordModels) {
|
||||
this.exchangeRecordModels.addAll(mExchangeRecordModels);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
@ -12,7 +12,17 @@ public class ExchangeModel extends BaseModel {
|
||||
@SerializedName("title")
|
||||
private String title;
|
||||
@SerializedName("num")
|
||||
private int num;
|
||||
private String num;
|
||||
private boolean select = false;
|
||||
|
||||
public boolean isSelect() {
|
||||
return select;
|
||||
}
|
||||
|
||||
public ExchangeModel setSelect(boolean select) {
|
||||
this.select = select;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTop() {
|
||||
return top;
|
||||
@ -41,11 +51,11 @@ public class ExchangeModel extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
public String getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public ExchangeModel setNum(int num) {
|
||||
public ExchangeModel setNum(String num) {
|
||||
this.num = num;
|
||||
return this;
|
||||
}
|
||||
|
@ -0,0 +1,140 @@
|
||||
package com.shayu.onetoone.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class ExchangeRecordModel extends BaseModel {
|
||||
|
||||
@SerializedName("id")
|
||||
private int id;
|
||||
@SerializedName("uid")
|
||||
private int uid;
|
||||
@SerializedName("income")
|
||||
private int income;
|
||||
@SerializedName("before_money")
|
||||
private String beforeMoney;
|
||||
@SerializedName("money")
|
||||
private String money;
|
||||
@SerializedName("after_money")
|
||||
private String afterMoney;
|
||||
@SerializedName("memo")
|
||||
private String memo;
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
@SerializedName("currency_type")
|
||||
private String currencyType;
|
||||
@SerializedName("service_id")
|
||||
private String serviceId;
|
||||
@SerializedName("create_time")
|
||||
private long createTime;
|
||||
@SerializedName("tuid")
|
||||
private int tuid;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setId(int id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setUid(int uid) {
|
||||
this.uid = uid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getIncome() {
|
||||
return income;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setIncome(int income) {
|
||||
this.income = income;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBeforeMoney() {
|
||||
return beforeMoney;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setBeforeMoney(String beforeMoney) {
|
||||
this.beforeMoney = beforeMoney;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMoney() {
|
||||
return money;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setMoney(String money) {
|
||||
this.money = money;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAfterMoney() {
|
||||
return afterMoney;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setAfterMoney(String afterMoney) {
|
||||
this.afterMoney = afterMoney;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCurrencyType() {
|
||||
return currencyType;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setCurrencyType(String currencyType) {
|
||||
this.currencyType = currencyType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getServiceId() {
|
||||
return serviceId;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setServiceId(String serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getTuid() {
|
||||
return tuid;
|
||||
}
|
||||
|
||||
public ExchangeRecordModel setTuid(int tuid) {
|
||||
this.tuid = tuid;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.shayu.onetoone.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class DiamondExchangeEvent extends BaseModel {
|
||||
private String top;
|
||||
private String name;
|
||||
private String title;
|
||||
private String num;
|
||||
|
||||
private int index = 0;
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public DiamondExchangeEvent setIndex(int index) {
|
||||
this.index = index;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTop() {
|
||||
return top;
|
||||
}
|
||||
|
||||
public DiamondExchangeEvent setTop(String top) {
|
||||
this.top = top;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public DiamondExchangeEvent setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public DiamondExchangeEvent setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public DiamondExchangeEvent setNum(String num) {
|
||||
this.num = num;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import com.shayu.onetoone.bean.AuthBean;
|
||||
import com.shayu.onetoone.bean.AuthBloggerBean;
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.bean.ExchangeModel;
|
||||
import com.shayu.onetoone.bean.ExchangeRecordModel;
|
||||
import com.shayu.onetoone.bean.FollowBean;
|
||||
import com.shayu.onetoone.bean.FriendAppMoneyLogModel;
|
||||
import com.shayu.onetoone.bean.FriendAppMoneySumModel;
|
||||
@ -1170,8 +1171,7 @@ public class OTONetManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type coin砖石 yuanbao 星币
|
||||
* @param type coin砖石 yuanbao 星币
|
||||
* @param callback
|
||||
*/
|
||||
public void getExchangeList(String type, HttpCallback<List<ExchangeModel>> callback) {
|
||||
@ -1197,4 +1197,66 @@ public class OTONetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 收益转换星币或砖石
|
||||
*
|
||||
* @param type coin砖石 yuanbao 星币
|
||||
* @param number 转换 星币 或 砖石 数量
|
||||
* @param callback
|
||||
*/
|
||||
public void getTransform(String type, String number, HttpCallback<List<ExchangeModel>> callback) {
|
||||
API.get().otoApi(mContext).
|
||||
getTransform(type, number)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<ExchangeModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<ExchangeModel>> listResponseModel) throws Exception {
|
||||
if (listResponseModel.getData().getCode() == 0) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
} else {
|
||||
callback.onError(listResponseModel.getData().getMsg());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type 10 转换星币 11转换砖石
|
||||
* @param currencyType 1星币 2砖石 3社交新币种
|
||||
* @param income 1收入 2支出
|
||||
* @param page
|
||||
* @param callback
|
||||
*/
|
||||
public void getExchangeRecord(String type, String currencyType, String income, int page, HttpCallback<List<ExchangeRecordModel>> callback) {
|
||||
API.get().otoApi(mContext).
|
||||
getExchangeRecord(type, currencyType, income, page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<ExchangeRecordModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<ExchangeRecordModel>> listResponseModel) throws Exception {
|
||||
if (listResponseModel.getData().getCode() == 0) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
} else {
|
||||
callback.onError(listResponseModel.getData().getMsg());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public class RouteManager {
|
||||
public static final String ACTIVITY_HOME_RANK = "/activity/HomepageRankingActivity";
|
||||
public static final String ACTIVITY_MY_ARN = "/activity/MyAarningsActivity";
|
||||
public static final String ACTIVITY_DIAMOND_EXCHANGE = "/activity/DiamondExchangeActivity";
|
||||
public static final String ACTIVITY_EXCHANGE_RECORD = "/activity/ExchangeRecordActivity";
|
||||
public static final String ACTIVITY_HOME_SEARCH = "/activity/HomeSearchActivity";
|
||||
public static final String ACTIVITY_HOME_SCREEN = "/activity/HomeScreenActivity";
|
||||
public static final String ACTIVITY_CALL_VIDEO = "/activity/CallVideoActivity";
|
||||
|
@ -4,6 +4,7 @@ import com.shayu.onetoone.bean.AuthBean;
|
||||
import com.shayu.onetoone.bean.AuthBloggerBean;
|
||||
import com.shayu.onetoone.bean.AvatarBean;
|
||||
import com.shayu.onetoone.bean.ExchangeModel;
|
||||
import com.shayu.onetoone.bean.ExchangeRecordModel;
|
||||
import com.shayu.onetoone.bean.FollowBean;
|
||||
import com.shayu.onetoone.bean.FriendAppMoneyLogModel;
|
||||
import com.shayu.onetoone.bean.FriendAppMoneySumModel;
|
||||
@ -244,6 +245,7 @@ public interface OneToOneApi {
|
||||
Observable<ResponseModel<List<ExchangeModel>>> getExchangeList(
|
||||
@Query("type") String type
|
||||
);
|
||||
|
||||
/**
|
||||
* 设置基本信息
|
||||
*/
|
||||
@ -305,6 +307,25 @@ public interface OneToOneApi {
|
||||
@GET("/api/public/?service=Friendappinfos.getSage")
|
||||
Observable<ResponseModel<AuthBloggerBean>> getBloggerInfo(
|
||||
);
|
||||
/**
|
||||
* 收益转换星币或砖石
|
||||
*/
|
||||
@GET("/api/public/?service=Friendappmoney.transform")
|
||||
Observable<ResponseModel<List<ExchangeModel>>> getTransform(
|
||||
@Query("type") String type,
|
||||
@Query("num") String number
|
||||
);
|
||||
|
||||
/**
|
||||
* 收益转换星币或砖石
|
||||
*/
|
||||
@GET("/api/public/?service=Friendappmoney.logs")
|
||||
Observable<ResponseModel<List<ExchangeRecordModel>>> getExchangeRecord(
|
||||
@Query("type") String type,
|
||||
@Query("currency_type") String currencyType,
|
||||
@Query("income") String income,
|
||||
@Query("p") int page
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.shayu.onetoone.view;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
@ -9,6 +11,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.ExchangeModel;
|
||||
import com.shayu.onetoone.event.DiamondExchangeEvent;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
public class DiamondExchangeViewHolder extends RecyclerView.ViewHolder {
|
||||
private LinearLayout diamondExchangeBtn;
|
||||
@ -22,7 +27,57 @@ public class DiamondExchangeViewHolder extends RecyclerView.ViewHolder {
|
||||
goldCoin = itemView.findViewById(R.id.gold_coin);
|
||||
}
|
||||
|
||||
public void showData(ExchangeModel model) {
|
||||
public void showData(ExchangeModel model, int position) {
|
||||
diamondExchangeBtn.setSelected(model.isSelect());
|
||||
coins.setText(model.getName());
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("(")
|
||||
.append(model.getTitle())
|
||||
.append(")");
|
||||
goldCoin.setText(stringBuffer);
|
||||
if (!TextUtils.isEmpty(model.getTop())) {
|
||||
fullConversion.setVisibility(View.VISIBLE);
|
||||
fullConversion.setText(model.getTop());
|
||||
if (model.isSelect()) {
|
||||
fullConversion.setTextColor(Color.parseColor("#C274EC"));
|
||||
} else {
|
||||
fullConversion.setTextColor(Color.parseColor("#333333"));
|
||||
}
|
||||
} else {
|
||||
fullConversion.setVisibility(View.GONE);
|
||||
}
|
||||
if (model.isSelect()) {
|
||||
coins.setTextColor(Color.parseColor("#C274EC"));
|
||||
goldCoin.setTextColor(Color.parseColor("#C274EC"));
|
||||
} else {
|
||||
coins.setTextColor(Color.parseColor("#333333"));
|
||||
goldCoin.setTextColor(Color.parseColor("#333333"));
|
||||
}
|
||||
ViewClicksAntiShake.clicksAntiShake(diamondExchangeBtn, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (listener != null) {
|
||||
listener.onDiamondExchangeClickListener(model, position);
|
||||
Bus.get().post(new DiamondExchangeEvent()
|
||||
.setName(model.getName())
|
||||
.setTitle(model.getTitle())
|
||||
.setTop(model.getTop())
|
||||
.setNum(model.getNum())
|
||||
.setIndex(position));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private DiamondExchangeClickListener listener;
|
||||
|
||||
public DiamondExchangeViewHolder setListener(DiamondExchangeClickListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface DiamondExchangeClickListener {
|
||||
void onDiamondExchangeClickListener(ExchangeModel model, int position);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
package com.shayu.onetoone.view;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.bean.ExchangeRecordModel;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class ExchangeRecordViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView memoName, createTime, money;
|
||||
|
||||
public ExchangeRecordViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
memoName = itemView.findViewById(R.id.memo_name);
|
||||
createTime = itemView.findViewById(R.id.create_time);
|
||||
money = itemView.findViewById(R.id.money);
|
||||
}
|
||||
|
||||
public void setData(ExchangeRecordModel model, int position) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder
|
||||
.append(model.getMoney());
|
||||
memoName.setText(model.getMemo());
|
||||
money.setText(builder.toString());
|
||||
createTime.setText(getDateStr(new Date((model.getCreateTime()) * 1000), null));
|
||||
}
|
||||
|
||||
public String getDateStr(Date date, String format) {
|
||||
if (format == null || format.isEmpty()) {
|
||||
format = "yyyy-MM-dd HH:mm";
|
||||
}
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(format);
|
||||
return formatter.format(date);
|
||||
}
|
||||
}
|
@ -16,7 +16,17 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/one_back"
|
||||
android:layout_width="21dp"
|
||||
android:layout_height="28dp"
|
||||
android:padding="5dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="16dp"
|
||||
android:src="@mipmap/icon_one_back" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@ -25,6 +35,7 @@
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exchange_record"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
@ -83,6 +94,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/arn_toggle"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="21dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
@ -120,10 +132,13 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/diamond_exchange_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_marginTop="29dp" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="29dp"
|
||||
android:layout_marginEnd="16dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/diamond_exchange_input"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:layout_marginStart="34dp"
|
||||
@ -140,6 +155,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/immediate_exchange"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="47dp"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
|
62
OneToOne/src/main/res/layout/activity_exchange_record.xml
Normal file
62
OneToOne/src/main/res/layout/activity_exchange_record.xml
Normal file
@ -0,0 +1,62 @@
|
||||
<?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="@color/white"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/one_back"
|
||||
android:layout_width="21dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="16dp"
|
||||
android:padding="5dp"
|
||||
android:src="@mipmap/icon_one_back" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/my_arnings_exchange_record"
|
||||
android:textColor="#333333"
|
||||
android:textSize="18sp" />
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/my_arnings_exchange_record"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<io.rong.imkit.widget.refresh.SmartRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.yanzhenjie.recyclerview.SwipeRecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:overScrollMode="never"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/view_exchange_record_item_holder" />
|
||||
</io.rong.imkit.widget.refresh.SmartRefreshLayout>
|
||||
</LinearLayout>
|
@ -2,10 +2,12 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="1dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/diamond_exchange_btn"
|
||||
android:layout_margin="1dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="92dp"
|
||||
android:background="@drawable/bg_diamond_exchange_btn"
|
||||
|
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/memo_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="170dp"
|
||||
android:singleLine="true"
|
||||
android:text="收到×××的×××禮物"
|
||||
android:textColor="#333333"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/create_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="170dp"
|
||||
android:singleLine="true"
|
||||
android:text="2023-08-10 15:30"
|
||||
android:textColor="#ACA9A9"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="19dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/money"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="100dp"
|
||||
android:singleLine="true"
|
||||
android:text="+1111111110.5"
|
||||
android:textColor="#333333"
|
||||
android:textSize="16sp" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="100dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/my_arnings_gold_coin"
|
||||
android:textColor="#333333"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="#80999999" />
|
||||
</FrameLayout>
|
BIN
OneToOne/src/main/res/mipmap-xxhdpi/icon_one_back.png
Normal file
BIN
OneToOne/src/main/res/mipmap-xxhdpi/icon_one_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -23,6 +23,7 @@
|
||||
<string name="my_arnings_incentive_withdrawal">獎勵提現</string>
|
||||
<string name="my_arnings_incentive_withdrawal_minimum">(最低$ %s)</string>
|
||||
<string name="my_arnings_exchange_star">兌換星幣</string>
|
||||
<string name="my_arnings_exchange_diamond">兌換鑽石</string>
|
||||
<string name="my_arnings_exchange_record">兌換記錄</string>
|
||||
<string name="my_arnings_total_convertibility">可兌換總額</string>
|
||||
<string name="my_arnings_gold_coin">金幣</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user