1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-26 00:27:30 +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 int downloadChildPosition = -1;
private CollectionService collectionService; private CollectionService collectionService;
private PostsLayoutPreferences layoutPreferences = Utils.getPostsLayoutPreferences(Constants.PREF_SAVED_POSTS_LAYOUT); private PostsLayoutPreferences layoutPreferences = Utils.getPostsLayoutPreferences(Constants.PREF_SAVED_POSTS_LAYOUT);
private MenuItem deleteMenu, editMenu;
private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(false) { private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(false) {
@Override @Override
@ -281,8 +282,13 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
@Override @Override
public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) {
// delaying to make toolbar resume animation smooth, otherwise lags inflater.inflate(R.menu.collection_posts_menu, menu);
binding.getRoot().postDelayed(() -> inflater.inflate(R.menu.collection_posts_menu, menu), 500); 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 @Override
@ -493,7 +499,7 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
private void showPostsLayoutPreferences() { private void showPostsLayoutPreferences() {
final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment( final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment(
Constants.PREF_TOPIC_POSTS_LAYOUT, Constants.PREF_SAVED_POSTS_LAYOUT,
preferences -> { preferences -> {
layoutPreferences = preferences; layoutPreferences = preferences;
new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200); new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200);