|
|
@@ -20,6 +20,7 @@ import com.sheep.gamegroup.model.entity.FriendAndAwardEntity;
|
|
|
import com.sheep.gamegroup.model.entity.UserEntity;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
+import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.StringUtils;
|
|
|
@@ -31,6 +32,7 @@ import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.base.BaseFragment;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
|
|
|
+import org.afinal.simplecache.ApiKey;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
@@ -161,10 +163,8 @@ public class FgtAskGetMoney extends BaseFragment {
|
|
|
|
|
|
private UserEntity userEntity;
|
|
|
|
|
|
- public void initData(final boolean isShow) {
|
|
|
- if (isShow){
|
|
|
- showProgress();
|
|
|
- }else {
|
|
|
+ public void initData(final boolean isNotRefresh) {
|
|
|
+ if (!isNotRefresh){
|
|
|
EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.ASK_GETMONEY_FRIEND_REFRESH));
|
|
|
}
|
|
|
SheepApp.getInstance().getNetComponent().getApiService().FriendCountAndAward()
|
|
|
@@ -173,8 +173,6 @@ public class FgtAskGetMoney extends BaseFragment {
|
|
|
.subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
@Override
|
|
|
public void onError(BaseMessage baseMessage) {
|
|
|
- if (isShow)
|
|
|
- hideProgress();
|
|
|
if (BuildConfig.DEBUG)
|
|
|
G.showToast(baseMessage);
|
|
|
}
|
|
|
@@ -182,19 +180,19 @@ public class FgtAskGetMoney extends BaseFragment {
|
|
|
@Override
|
|
|
public void onNext(BaseMessage baseMessage) {
|
|
|
if (baseMessage != null) {
|
|
|
- mEntity = baseMessage.getData(FriendAndAwardEntity.class);
|
|
|
- if (isShow)
|
|
|
- hideProgress();
|
|
|
- activity.runOnUiThread(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- tvSize.setText(mEntity.getFriend_count() + "");
|
|
|
- tvMoney.setText(mEntity.getAward());
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- if (isShow)
|
|
|
- hideProgress();
|
|
|
+ boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.FRIEND_COUNT_AND_AWARD);
|
|
|
+ if(mEntity == null || isNewData){
|
|
|
+ mEntity = baseMessage.getData(FriendAndAwardEntity.class);
|
|
|
+ activity.runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ if(mEntity != null) {
|
|
|
+ ViewUtil.setText(tvSize, String.valueOf(mEntity.getFriend_count()));
|
|
|
+ ViewUtil.setText(tvMoney, String.valueOf(mEntity.getAward()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -203,10 +201,13 @@ public class FgtAskGetMoney extends BaseFragment {
|
|
|
@Override
|
|
|
public void call(UserEntity result) {
|
|
|
if (result != null) {
|
|
|
- userEntity = result;
|
|
|
- String audit_total_audit = String.format(activity.getResources().getString(R.string.my_invitation_str), userEntity.getInvitation_code());
|
|
|
- ask_act_code.setText(audit_total_audit);
|
|
|
- my_invitation_tv.setText(audit_total_audit);
|
|
|
+ boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.get_info);
|
|
|
+ if(userEntity == null || isNewData) {
|
|
|
+ userEntity = result;
|
|
|
+ String audit_total_audit = String.format(activity.getResources().getString(R.string.my_invitation_str), userEntity.getInvitation_code());
|
|
|
+ ask_act_code.setText(audit_total_audit);
|
|
|
+ my_invitation_tv.setText(audit_total_audit);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|