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" applicationId "org.mariotaku.twidere"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 24 targetSdkVersion 24
versionCode 200 versionCode 201
versionName "3.1.11" versionName "3.1.12"
multiDexEnabled true multiDexEnabled true
buildConfigField 'boolean', 'LEAK_CANARY_ENABLED', 'Boolean.parseBoolean("false")' 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(); final int backgroundColor = mBackgroundColor.getColor();
mTask = new UpdateProfileTaskInternal(this, mAccountId, mUser, name, url, location, mTask = new UpdateProfileTaskInternal(this, mAccountId, mUser, name, url, location,
description, linkColor, backgroundColor); description, linkColor, backgroundColor);
mTask.setResultHandler(this);
TaskStarter.execute(mTask); TaskStarter.execute(mTask);
return true; return true;
} }
@ -522,7 +523,7 @@ public class UserProfileEditorFragment extends BaseSupportFragment implements On
} }
@Override @Override
protected void afterExecute(UserProfileEditorFragment callback, SingleResponse<ParcelableUser> result) { protected void afterExecute(@Nullable UserProfileEditorFragment callback, SingleResponse<ParcelableUser> result) {
super.afterExecute(callback, result); super.afterExecute(callback, result);
if (result.hasData()) { if (result.hasData()) {
final ParcelableAccount account = result.getExtras().getParcelable(EXTRA_ACCOUNT); final ParcelableAccount account = result.getExtras().getParcelable(EXTRA_ACCOUNT);
@ -532,16 +533,18 @@ public class UserProfileEditorFragment extends BaseSupportFragment implements On
TaskStarter.execute(task); TaskStarter.execute(task);
} }
} }
callback.executeAfterFragmentResumed(new Action() { if (callback != null) {
@Override callback.executeAfterFragmentResumed(new Action() {
public void execute(IBaseFragment fragment) { @Override
final Fragment f = ((UserProfileEditorFragment) fragment).getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG); public void execute(IBaseFragment fragment) {
if (f instanceof DialogFragment) { final Fragment f = ((UserProfileEditorFragment) fragment).getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG);
((DialogFragment) f).dismissAllowingStateLoss(); if (f instanceof DialogFragment) {
((DialogFragment) f).dismissAllowingStateLoss();
}
f.getActivity().finish();
} }
f.getActivity().finish(); });
} }
});
} }
@Override @Override
@ -575,7 +578,7 @@ public class UserProfileEditorFragment extends BaseSupportFragment implements On
} }
@Override @Override
protected void afterExecute(UserProfileEditorFragment callback, final SingleResponse<Boolean> result) { protected void afterExecute(@Nullable UserProfileEditorFragment callback, final SingleResponse<Boolean> result) {
super.afterExecute(callback, result); super.afterExecute(callback, result);
if (result.getData() != null && result.getData()) { if (result.getData() != null && result.getData()) {
getUserInfo(); getUserInfo();