|
@@ -23,9 +23,11 @@ import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
import com.sheep.gamegroup.absBase.BaseRefreshLoadMoreFragment;
|
|
import com.sheep.gamegroup.absBase.BaseRefreshLoadMoreFragment;
|
|
|
import com.sheep.gamegroup.absBase.ILoadMore;
|
|
import com.sheep.gamegroup.absBase.ILoadMore;
|
|
|
import com.sheep.gamegroup.absBase.IRefresh;
|
|
import com.sheep.gamegroup.absBase.IRefresh;
|
|
|
|
|
+import com.sheep.gamegroup.greendao.DDProviderHelper;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.Lp;
|
|
import com.sheep.gamegroup.model.entity.Lp;
|
|
|
import com.sheep.gamegroup.model.entity.UserAssets;
|
|
import com.sheep.gamegroup.model.entity.UserAssets;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.WebParams;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.module.personal.fragment.FgtRechargeBalanceLog;
|
|
import com.sheep.gamegroup.module.personal.fragment.FgtRechargeBalanceLog;
|
|
|
import com.sheep.gamegroup.module.personal.fragment.FgtRechargeLog;
|
|
import com.sheep.gamegroup.module.personal.fragment.FgtRechargeLog;
|
|
@@ -39,9 +41,11 @@ import com.sheep.gamegroup.util.RefreshUtil;
|
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
|
|
import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
|
|
|
import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
|
|
import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.Config;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
|
|
|
|
|
import org.afinal.simplecache.ApiKey;
|
|
import org.afinal.simplecache.ApiKey;
|
|
@@ -102,11 +106,13 @@ public class ActMyMoney extends BaseActivity {
|
|
|
protected int getLayoutId() {
|
|
protected int getLayoutId() {
|
|
|
return R.layout.act_my_money;
|
|
return R.layout.act_my_money;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
public static final String[] tabNames = {"充值记录", "提现记录", "收支明细"};
|
|
public static final String[] tabNames = {"充值记录", "提现记录", "收支明细"};
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void initView() {
|
|
public void initView() {
|
|
|
TitleBarUtils.getInstance()
|
|
TitleBarUtils.getInstance()
|
|
|
- .setTitle(this,"我的资产")
|
|
|
|
|
|
|
+ .setTitle(this, "我的资产")
|
|
|
.setTitleFinish(this);
|
|
.setTitleFinish(this);
|
|
|
//顶部背景添加弧度
|
|
//顶部背景添加弧度
|
|
|
GlideImageLoader.setImage(act_my_money_bg_iv, ViewUtil.getNetImgByName("home_blue_bg_hb"), R.mipmap.home_blue_bg);
|
|
GlideImageLoader.setImage(act_my_money_bg_iv, ViewUtil.getNetImgByName("home_blue_bg_hb"), R.mipmap.home_blue_bg);
|
|
@@ -116,7 +122,7 @@ public class ActMyMoney extends BaseActivity {
|
|
|
mAdapter.add(new FgtRechargeLog(), tabNames[2]);
|
|
mAdapter.add(new FgtRechargeLog(), tabNames[2]);
|
|
|
for (int i = 0; i < mAdapter.getCount(); i++) {
|
|
for (int i = 0; i < mAdapter.getCount(); i++) {
|
|
|
Fragment fragment = mAdapter.getItem(i);
|
|
Fragment fragment = mAdapter.getItem(i);
|
|
|
- if(fragment instanceof BaseRefreshLoadMoreFragment){
|
|
|
|
|
|
|
+ if (fragment instanceof BaseRefreshLoadMoreFragment) {
|
|
|
((BaseRefreshLoadMoreFragment) fragment).setSmartRefreshLayout(refresh);
|
|
((BaseRefreshLoadMoreFragment) fragment).setSmartRefreshLayout(refresh);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -146,13 +152,14 @@ public class ActMyMoney extends BaseActivity {
|
|
|
// }
|
|
// }
|
|
|
// });
|
|
// });
|
|
|
}
|
|
}
|
|
|
- private void new_tab(){
|
|
|
|
|
|
|
+
|
|
|
|
|
+ private void new_tab() {
|
|
|
indicator.addTab(indicator.newTab().setCustomView(tab_icon(tabNames[0], true)));
|
|
indicator.addTab(indicator.newTab().setCustomView(tab_icon(tabNames[0], true)));
|
|
|
indicator.addTab(indicator.newTab().setCustomView(tab_icon(tabNames[1], true)));
|
|
indicator.addTab(indicator.newTab().setCustomView(tab_icon(tabNames[1], true)));
|
|
|
indicator.addTab(indicator.newTab().setCustomView(tab_icon(tabNames[2], false)));
|
|
indicator.addTab(indicator.newTab().setCustomView(tab_icon(tabNames[2], false)));
|
|
|
//Tablayout自定义view绑定ViewPager
|
|
//Tablayout自定义view绑定ViewPager
|
|
|
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(indicator));
|
|
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(indicator));
|
|
|
- indicator.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager){
|
|
|
|
|
|
|
+ indicator.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager) {
|
|
|
@Override
|
|
@Override
|
|
|
public void onTabReselected(TabLayout.Tab tab) {
|
|
public void onTabReselected(TabLayout.Tab tab) {
|
|
|
super.onTabReselected(tab);
|
|
super.onTabReselected(tab);
|
|
@@ -183,13 +190,16 @@ public class ActMyMoney extends BaseActivity {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
private int refreshDataCount = 0;
|
|
private int refreshDataCount = 0;
|
|
|
|
|
+
|
|
|
//刷新数据
|
|
//刷新数据
|
|
|
- public void refreshData(){
|
|
|
|
|
|
|
+ public void refreshData() {
|
|
|
refreshData(viewPager.getCurrentItem());
|
|
refreshData(viewPager.getCurrentItem());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//刷新数据
|
|
//刷新数据
|
|
|
- public void refreshData(int position){
|
|
|
|
|
|
|
+ public void refreshData(int position) {
|
|
|
boolean isRefresh = false;
|
|
boolean isRefresh = false;
|
|
|
if (refreshDataCount != 0) {
|
|
if (refreshDataCount != 0) {
|
|
|
Fragment item = mAdapter.getItem(position);
|
|
Fragment item = mAdapter.getItem(position);
|
|
@@ -199,9 +209,10 @@ public class ActMyMoney extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
refreshDataCount++;
|
|
refreshDataCount++;
|
|
|
- if(!isRefresh)
|
|
|
|
|
|
|
+ if (!isRefresh)
|
|
|
notifyDataSetChanged();
|
|
notifyDataSetChanged();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//加载更多数据
|
|
//加载更多数据
|
|
|
private void loadMoreData() {
|
|
private void loadMoreData() {
|
|
|
Fragment item = mAdapter.getItem(viewPager.getCurrentItem());
|
|
Fragment item = mAdapter.getItem(viewPager.getCurrentItem());
|
|
@@ -219,11 +230,11 @@ public class ActMyMoney extends BaseActivity {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private View tab_icon(String name,boolean isShow){
|
|
|
|
|
- View newtab = LayoutInflater.from(this).inflate(R.layout.tab_item,null);
|
|
|
|
|
|
|
+ private View tab_icon(String name, boolean isShow) {
|
|
|
|
|
+ View newtab = LayoutInflater.from(this).inflate(R.layout.tab_item, null);
|
|
|
TextView tv = newtab.findViewById(R.id.tabtext);
|
|
TextView tv = newtab.findViewById(R.id.tabtext);
|
|
|
View tab_line = newtab.findViewById(R.id.tab_line);
|
|
View tab_line = newtab.findViewById(R.id.tab_line);
|
|
|
- tab_line.setVisibility(isShow ? View.VISIBLE: View.INVISIBLE);
|
|
|
|
|
|
|
+ tab_line.setVisibility(isShow ? View.VISIBLE : View.INVISIBLE);
|
|
|
tv.setText(name);
|
|
tv.setText(name);
|
|
|
return newtab;
|
|
return newtab;
|
|
|
}
|
|
}
|
|
@@ -236,7 +247,12 @@ public class ActMyMoney extends BaseActivity {
|
|
|
public void initListener() {
|
|
public void initListener() {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- @OnClick({ R.id.my_money_withdraw_tv, R.id.my_money_recharge_tv, R.id.my_money_dingxiang_amount_iv})
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @OnClick({R.id.my_money_withdraw_tv,
|
|
|
|
|
+ R.id.my_money_recharge_tv,
|
|
|
|
|
+ R.id.my_money_dingxiang_amount_iv,
|
|
|
|
|
+ R.id.my_money_dingxiang_amount,
|
|
|
|
|
+ R.id.my_money_dingxiang_tag})
|
|
|
public void onViewClicked(View view) {
|
|
public void onViewClicked(View view) {
|
|
|
switch (view.getId()) {
|
|
switch (view.getId()) {
|
|
|
case R.id.my_money_withdraw_tv://提现
|
|
case R.id.my_money_withdraw_tv://提现
|
|
@@ -246,41 +262,46 @@ public class ActMyMoney extends BaseActivity {
|
|
|
Jump2View.getInstance().goRechargeAct(ActMyMoney.this, "我的资产");
|
|
Jump2View.getInstance().goRechargeAct(ActMyMoney.this, "我的资产");
|
|
|
break;
|
|
break;
|
|
|
case R.id.my_money_dingxiang_amount_iv://定向货币详情
|
|
case R.id.my_money_dingxiang_amount_iv://定向货币详情
|
|
|
- ViewUtil.showOrienteeringDetails(ActMyMoney.this);
|
|
|
|
|
|
|
+ case R.id.my_money_dingxiang_amount://定向货币详情
|
|
|
|
|
+ case R.id.my_money_dingxiang_tag://定向货币详情
|
|
|
|
|
+ String url = Config.URL_DIRECTIONAL_LIST + "?authorization=" + SpUtils.getToken(this);
|
|
|
|
|
+ WebParams webParams = new WebParams(url, "定向消费").setShowTitle(false);
|
|
|
|
|
+ Jump2View.getInstance().goWeb(this, webParams);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void initData() {
|
|
public void initData() {
|
|
|
showProgress();
|
|
showProgress();
|
|
|
resetData();
|
|
resetData();
|
|
|
SheepApp.getInstance().getNetComponent().getApiService().getMyAssets()
|
|
SheepApp.getInstance().getNetComponent().getApiService().getMyAssets()
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
- .subscribe(new SheepSubscriber<BaseMessage>(this) {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
- boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.MY_ASSETS);
|
|
|
|
|
- if(isNewData){
|
|
|
|
|
- CommonUtil.getInstance().updateUserInfo(null);
|
|
|
|
|
- }
|
|
|
|
|
- UserAssets userAssets = baseMessage.getData(UserAssets.class);
|
|
|
|
|
-
|
|
|
|
|
- loadData(userAssets);
|
|
|
|
|
- hideProgress();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onError(BaseMessage baseMessage) {
|
|
|
|
|
- G.showToast(baseMessage);
|
|
|
|
|
- resetData();
|
|
|
|
|
- hideProgress();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(this) {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
|
|
+ boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.MY_ASSETS);
|
|
|
|
|
+ if (isNewData) {
|
|
|
|
|
+ CommonUtil.getInstance().updateUserInfo(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ UserAssets userAssets = baseMessage.getData(UserAssets.class);
|
|
|
|
|
+
|
|
|
|
|
+ loadData(userAssets);
|
|
|
|
|
+ hideProgress();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
|
|
+ G.showToast(baseMessage);
|
|
|
|
|
+ resetData();
|
|
|
|
|
+ hideProgress();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void loadData(UserAssets userAssets) {
|
|
private void loadData(UserAssets userAssets) {
|
|
|
- if(my_money_total_money == null){
|
|
|
|
|
|
|
+ if (my_money_total_money == null) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
my_money_total_money.setText(getString(R.string.total_money, NumberFormatUtils.retainMost2W(userAssets.getSheep_bi_total())));
|
|
my_money_total_money.setText(getString(R.string.total_money, NumberFormatUtils.retainMost2W(userAssets.getSheep_bi_total())));
|
|
@@ -290,8 +311,9 @@ public class ActMyMoney extends BaseActivity {
|
|
|
my_money_available_amount.setText(getString(R.string.available_amount, NumberFormatUtils.retainMost2W(userAssets.getCash_withdrawal())));
|
|
my_money_available_amount.setText(getString(R.string.available_amount, NumberFormatUtils.retainMost2W(userAssets.getCash_withdrawal())));
|
|
|
my_money_dingxiang_amount.setText(getString(R.string.total_money, NumberFormatUtils.retainMost2W(userAssets.getDirectional_currency())));
|
|
my_money_dingxiang_amount.setText(getString(R.string.total_money, NumberFormatUtils.retainMost2W(userAssets.getDirectional_currency())));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
private void resetData() {
|
|
private void resetData() {
|
|
|
- if(my_money_total_money == null){
|
|
|
|
|
|
|
+ if (my_money_total_money == null) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
my_money_total_money.setText(getString(R.string.total_money, "0.00"));
|
|
my_money_total_money.setText(getString(R.string.total_money, "0.00"));
|
|
@@ -301,6 +323,7 @@ public class ActMyMoney extends BaseActivity {
|
|
|
my_money_available_amount.setText(getString(R.string.available_amount, "0.00"));
|
|
my_money_available_amount.setText(getString(R.string.available_amount, "0.00"));
|
|
|
my_money_dingxiang_amount.setText(getString(R.string.total_money, "0.00"));
|
|
my_money_dingxiang_amount.setText(getString(R.string.total_money, "0.00"));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//点击优惠购物
|
|
//点击优惠购物
|
|
|
public void onClickCoupons(View view) {
|
|
public void onClickCoupons(View view) {
|
|
|
Jump2View.getInstance().gotoYfShop(this);
|
|
Jump2View.getInstance().gotoYfShop(this);
|