mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Fix IllegalStateException in ViewPostDetailFragment.
This commit is contained in:
parent
85a51d7dc8
commit
9ab1e6904c
@ -626,10 +626,10 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
|
|
||||||
if (mPost.isHidden()) {
|
if (mPost.isHidden()) {
|
||||||
hideItem.setVisible(true);
|
hideItem.setVisible(true);
|
||||||
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, hideItem, getString(R.string.action_unhide_post));
|
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, hideItem, activity.getString(R.string.action_unhide_post));
|
||||||
} else {
|
} else {
|
||||||
hideItem.setVisible(true);
|
hideItem.setVisible(true);
|
||||||
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, hideItem, getString(R.string.action_hide_post));
|
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, hideItem, activity.getString(R.string.action_hide_post));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
saveItem.setVisible(false);
|
saveItem.setVisible(false);
|
||||||
@ -645,17 +645,17 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
MenuItem nsfwItem = mMenu.findItem(R.id.action_nsfw_view_post_detail_fragment);
|
MenuItem nsfwItem = mMenu.findItem(R.id.action_nsfw_view_post_detail_fragment);
|
||||||
nsfwItem.setVisible(true);
|
nsfwItem.setVisible(true);
|
||||||
if (mPost.isNSFW()) {
|
if (mPost.isNSFW()) {
|
||||||
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, nsfwItem, getString(R.string.action_unmark_nsfw));
|
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, nsfwItem, activity.getString(R.string.action_unmark_nsfw));
|
||||||
} else {
|
} else {
|
||||||
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, nsfwItem, getString(R.string.action_mark_nsfw));
|
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, nsfwItem, activity.getString(R.string.action_mark_nsfw));
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem spoilerItem = mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment);
|
MenuItem spoilerItem = mMenu.findItem(R.id.action_spoiler_view_post_detail_fragment);
|
||||||
spoilerItem.setVisible(true);
|
spoilerItem.setVisible(true);
|
||||||
if (mPost.isSpoiler()) {
|
if (mPost.isSpoiler()) {
|
||||||
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, spoilerItem, getString(R.string.action_unmark_spoiler));
|
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, spoilerItem, activity.getString(R.string.action_unmark_spoiler));
|
||||||
} else {
|
} else {
|
||||||
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, spoilerItem, getString(R.string.action_mark_spoiler));
|
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, spoilerItem, activity.getString(R.string.action_mark_spoiler));
|
||||||
}
|
}
|
||||||
|
|
||||||
mMenu.findItem(R.id.action_edit_flair_view_post_detail_fragment).setVisible(true);
|
mMenu.findItem(R.id.action_edit_flair_view_post_detail_fragment).setVisible(true);
|
||||||
@ -953,21 +953,17 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
HidePost.unhidePost(mOauthRetrofit, mAccessToken, mPost.getFullName(), new HidePost.HidePostListener() {
|
HidePost.unhidePost(mOauthRetrofit, mAccessToken, mPost.getFullName(), new HidePost.HidePostListener() {
|
||||||
@Override
|
@Override
|
||||||
public void success() {
|
public void success() {
|
||||||
if (isAdded()) {
|
mPost.setHidden(false);
|
||||||
mPost.setHidden(false);
|
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, activity.getString(R.string.action_hide_post));
|
||||||
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, getString(R.string.action_hide_post));
|
showMessage(R.string.post_unhide_success);
|
||||||
showMessage(R.string.post_unhide_success);
|
|
||||||
}
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void failed() {
|
public void failed() {
|
||||||
if (isAdded()) {
|
mPost.setHidden(true);
|
||||||
mPost.setHidden(true);
|
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, activity.getString(R.string.action_unhide_post));
|
||||||
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, getString(R.string.action_unhide_post));
|
showMessage(R.string.post_unhide_failed);
|
||||||
showMessage(R.string.post_unhide_failed);
|
|
||||||
}
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -977,21 +973,17 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
HidePost.hidePost(mOauthRetrofit, mAccessToken, mPost.getFullName(), new HidePost.HidePostListener() {
|
HidePost.hidePost(mOauthRetrofit, mAccessToken, mPost.getFullName(), new HidePost.HidePostListener() {
|
||||||
@Override
|
@Override
|
||||||
public void success() {
|
public void success() {
|
||||||
if (isAdded()) {
|
mPost.setHidden(true);
|
||||||
mPost.setHidden(true);
|
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, activity.getString(R.string.action_unhide_post));
|
||||||
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, getString(R.string.action_unhide_post));
|
showMessage(R.string.post_hide_success);
|
||||||
showMessage(R.string.post_hide_success);
|
|
||||||
}
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void failed() {
|
public void failed() {
|
||||||
if (isAdded()) {
|
mPost.setHidden(false);
|
||||||
mPost.setHidden(false);
|
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, activity.getString(R.string.action_hide_post));
|
||||||
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, getString(R.string.action_hide_post));
|
showMessage(R.string.post_hide_failed);
|
||||||
showMessage(R.string.post_hide_failed);
|
|
||||||
}
|
|
||||||
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user