icon-default问题修改
This commit is contained in:
@ -484,7 +484,7 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
Log.e("TD_CHANNEL_ID", (String) PackageUtils.getMetaData(this, getPackageName(), "TD_CHANNEL_ID"));
|
||||
|
||||
if (sp.getBoolean("changeDefaultIcon", false) && sp.getInt("default_user_icon", 0) != 0) {
|
||||
postDefaultIcon(true, sp.getInt("default_user_icon", 0));
|
||||
postDefaultIcon(true, sp.getInt("default_user_icon", 0), 1);
|
||||
}
|
||||
|
||||
getSuggestionType();
|
||||
@ -1536,14 +1536,14 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
DownloadManager.getInstance(this).removeObserver(dataWatcher);
|
||||
|
||||
if (sp.getBoolean("changeDefaultIcon", false) && sp.getInt("default_user_icon", 0) != 0) {
|
||||
postDefaultIcon(true, sp.getInt("default_user_icon", 0));
|
||||
postDefaultIcon(true, sp.getInt("default_user_icon", 0), 1);
|
||||
}
|
||||
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
// 提交默认头像
|
||||
private void postDefaultIcon(boolean isCheck, final int i) {
|
||||
private void postDefaultIcon(boolean isCheck, final int i, final int count) {
|
||||
TokenUtils.getToken(this, isCheck)
|
||||
.flatMap(new Func1<String, Observable<ResponseBody>>() {
|
||||
@Override
|
||||
@ -1560,19 +1560,15 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
.subscribe(new JSONObjectResponse() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
super.onResponse(response);
|
||||
sp.edit().putBoolean("changeDefaultIcon", false);
|
||||
sp.edit().putBoolean("changeDefaultIcon", false).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(HttpException e) {
|
||||
super.onFailure(e);
|
||||
if (e != null) {
|
||||
if (e.code() == 401) {
|
||||
postDefaultIcon(true, i);
|
||||
return;
|
||||
postDefaultIcon(true, i, count - 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user