fixed crashes

This commit is contained in:
Mariotaku Lee 2016-07-12 09:26:23 +08:00
parent 40d79d0113
commit 943a5f8357
2 changed files with 16 additions and 13 deletions

View File

@ -28,8 +28,8 @@ android {
applicationId "org.mariotaku.twidere"
minSdkVersion 14
targetSdkVersion 24
versionCode 200
versionName "3.1.11"
versionCode 201
versionName "3.1.12"
multiDexEnabled true
buildConfigField 'boolean', 'LEAK_CANARY_ENABLED', 'Boolean.parseBoolean("false")'

View File

@ -213,6 +213,7 @@ public class UserProfileEditorFragment extends BaseSupportFragment implements On
final int backgroundColor = mBackgroundColor.getColor();
mTask = new UpdateProfileTaskInternal(this, mAccountId, mUser, name, url, location,
description, linkColor, backgroundColor);
mTask.setResultHandler(this);
TaskStarter.execute(mTask);
return true;
}
@ -522,7 +523,7 @@ public class UserProfileEditorFragment extends BaseSupportFragment implements On
}
@Override
protected void afterExecute(UserProfileEditorFragment callback, SingleResponse<ParcelableUser> result) {
protected void afterExecute(@Nullable UserProfileEditorFragment callback, SingleResponse<ParcelableUser> result) {
super.afterExecute(callback, result);
if (result.hasData()) {
final ParcelableAccount account = result.getExtras().getParcelable(EXTRA_ACCOUNT);
@ -532,16 +533,18 @@ public class UserProfileEditorFragment extends BaseSupportFragment implements On
TaskStarter.execute(task);
}
}
callback.executeAfterFragmentResumed(new Action() {
@Override
public void execute(IBaseFragment fragment) {
final Fragment f = ((UserProfileEditorFragment) fragment).getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG);
if (f instanceof DialogFragment) {
((DialogFragment) f).dismissAllowingStateLoss();
if (callback != null) {
callback.executeAfterFragmentResumed(new Action() {
@Override
public void execute(IBaseFragment fragment) {
final Fragment f = ((UserProfileEditorFragment) fragment).getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG);
if (f instanceof DialogFragment) {
((DialogFragment) f).dismissAllowingStateLoss();
}
f.getActivity().finish();
}
f.getActivity().finish();
}
});
});
}
}
@Override
@ -575,7 +578,7 @@ public class UserProfileEditorFragment extends BaseSupportFragment implements On
}
@Override
protected void afterExecute(UserProfileEditorFragment callback, final SingleResponse<Boolean> result) {
protected void afterExecute(@Nullable UserProfileEditorFragment callback, final SingleResponse<Boolean> result) {
super.afterExecute(callback, result);
if (result.getData() != null && result.getData()) {
getUserInfo();