1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-23 05:16:58 +00:00
This commit is contained in:
Austin Huang 2021-05-30 19:23:09 -04:00
parent 972f71c480
commit 241c9437c5
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

@ -84,6 +84,7 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
private int downloadChildPosition = -1;
private CollectionService collectionService;
private PostsLayoutPreferences layoutPreferences = Utils.getPostsLayoutPreferences(Constants.PREF_SAVED_POSTS_LAYOUT);
private MenuItem deleteMenu, editMenu;
private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(false) {
@Override
@ -281,8 +282,13 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
@Override
public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) {
// delaying to make toolbar resume animation smooth, otherwise lags
binding.getRoot().postDelayed(() -> inflater.inflate(R.menu.collection_posts_menu, menu), 500);
inflater.inflate(R.menu.collection_posts_menu, menu);
deleteMenu = menu.findItem(R.id.delete);
if (deleteMenu != null)
deleteMenu.setVisible(savedCollection.getCollectionType().equals("MEDIA"));
editMenu = menu.findItem(R.id.edit);
if (editMenu != null)
editMenu.setVisible(savedCollection.getCollectionType().equals("MEDIA"));
}
@Override
@ -493,7 +499,7 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
private void showPostsLayoutPreferences() {
final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment(
Constants.PREF_TOPIC_POSTS_LAYOUT,
Constants.PREF_SAVED_POSTS_LAYOUT,
preferences -> {
layoutPreferences = preferences;
new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200);