|
|
@@ -11,22 +11,28 @@ import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.kfzs.duanduan.fragment.FgtCreditCardProgressQuery;
|
|
|
-import com.kfzs.duanduan.fragment.FgtMyMoney;
|
|
|
+import com.kfzs.duanduan.fragment.FgtMyMoney1;
|
|
|
+import com.kfzs.duanduan.fragment.FgtMyMoney2;
|
|
|
import com.kfzs.duanduan.mine.GiftpackListAdapter;
|
|
|
import com.kfzs.duanduan.utils.StatusBarUtils;
|
|
|
import com.sheep.gamegroup.absBase.AbsChooseImageActivity;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.CreditCardProgressQuery;
|
|
|
+import com.sheep.gamegroup.model.entity.UserAssets;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
+import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
|
+import com.sheep.jiuyan.samllsheep.BuildConfig;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
+import butterknife.OnClick;
|
|
|
import rx.android.schedulers.AndroidSchedulers;
|
|
|
import rx.schedulers.Schedulers;
|
|
|
|
|
|
@@ -43,6 +49,17 @@ public class ActMyMoney extends AbsChooseImageActivity {
|
|
|
@BindView(R.id.pager)
|
|
|
ViewPager pager;
|
|
|
|
|
|
+ @BindView(R.id.my_money_total_money)
|
|
|
+ TextView my_money_total_money;
|
|
|
+ @BindView(R.id.my_money_task_reward)
|
|
|
+ TextView my_money_task_reward;
|
|
|
+ @BindView(R.id.my_money_agent_extract)
|
|
|
+ TextView my_money_agent_extract;
|
|
|
+ @BindView(R.id.my_money_recharge_amount)
|
|
|
+ TextView my_money_recharge_amount;
|
|
|
+ @BindView(R.id.my_money_available_amount)
|
|
|
+ TextView my_money_available_amount;
|
|
|
+
|
|
|
private GiftpackListAdapter mAdapter;
|
|
|
|
|
|
@Override
|
|
|
@@ -64,8 +81,8 @@ public class ActMyMoney extends AbsChooseImageActivity {
|
|
|
// String sr = "可提现金额 <font color='#ff2d4b'><big>" + balanceAmount + "</big></font> 元";
|
|
|
// tv.setText(Html.fromHtml(sr));
|
|
|
mAdapter = new GiftpackListAdapter(getSupportFragmentManager(), getApplicationContext());
|
|
|
- mAdapter.add(new FgtMyMoney(), "充值记录");
|
|
|
- mAdapter.add(new FgtMyMoney(), "提现&消费记录");
|
|
|
+ mAdapter.add(new FgtMyMoney1(), "充值记录");
|
|
|
+ mAdapter.add(new FgtMyMoney2(), "提现&消费记录");
|
|
|
pager.setAdapter(mAdapter);
|
|
|
// indicator.setupWithViewPager(pager);
|
|
|
pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
|
|
@@ -119,10 +136,56 @@ public class ActMyMoney extends AbsChooseImageActivity {
|
|
|
public void initListener() {
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ @OnClick({ R.id.my_money_withdraw_tv, R.id.my_money_recharge_tv })
|
|
|
+ public void onViewClicked(View view) {
|
|
|
+ switch (view.getId()) {
|
|
|
+ case R.id.my_money_withdraw_tv://提现
|
|
|
+ Jump2View.getInstance().goWithdrawal(ActMyMoney.this, null);
|
|
|
+ break;
|
|
|
+ case R.id.my_money_recharge_tv://充值
|
|
|
+ //TODO 添加充值入口
|
|
|
+ G.showToast(R.string.coming_soon);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
@Override
|
|
|
public void initData() {
|
|
|
+ resetData();
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().getMyAssets()
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(this) {
|
|
|
+ @Override
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
+ if(BuildConfig.DEBUG)
|
|
|
+ System.out.println("baseMessage onNext "+ JSON.toJSONString(baseMessage));
|
|
|
+ UserAssets userAssets = baseMessage.getData(UserAssets.class);
|
|
|
+ loadData(userAssets);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
+ if(BuildConfig.DEBUG)
|
|
|
+ System.out.println("baseMessage onError "+JSON.toJSONString(baseMessage));
|
|
|
+ G.showToast(TextUtils.isEmpty(baseMessage.getMsg()) ? "服务器错误,请稍候再试" : baseMessage.getMsg());
|
|
|
+ resetData();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
+ private void loadData(UserAssets userAssets) {
|
|
|
+ my_money_total_money.setText(getString(R.string.total_money, userAssets.getSheep_bi_total()));
|
|
|
+ my_money_task_reward.setText(getString(R.string.task_reward, userAssets.getTask_reward()));
|
|
|
+ my_money_agent_extract.setText(getString(R.string.agent_extract, userAssets.getProxy_commission()));
|
|
|
+ my_money_recharge_amount.setText(getString(R.string.recharge_amount, userAssets.getRecharge_amount()));
|
|
|
+ my_money_available_amount.setText(getString(R.string.available_amount, userAssets.getCash_withdrawal()));
|
|
|
+ }
|
|
|
+ private void resetData() {
|
|
|
+ my_money_total_money.setText(getString(R.string.total_money, "0.00"));
|
|
|
+ my_money_task_reward.setText(getString(R.string.task_reward, "0.00"));
|
|
|
+ my_money_agent_extract.setText(getString(R.string.agent_extract, "0.00"));
|
|
|
+ my_money_recharge_amount.setText(getString(R.string.recharge_amount, "0.00"));
|
|
|
+ my_money_available_amount.setText(getString(R.string.available_amount, "0.00"));
|
|
|
}
|
|
|
|
|
|
@Override
|