Add the special appbar for the notifications again (#4022)

This commit is contained in:
UlrichKu 2023-09-13 09:21:08 +02:00 committed by GitHub
commit f63c662275
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 21 deletions

View file

@ -275,6 +275,9 @@ public class NotificationsFragment extends SFragment implements
updateAdapter();
binding.buttonClear.setOnClickListener(v -> confirmClearNotifications());
binding.buttonFilter.setOnClickListener(v -> showFilterMenu());
if (notifications.isEmpty()) {
binding.swipeRefreshLayout.setEnabled(false);
sendFetchNotificationsRequest(null, null, FetchEnd.BOTTOM, -1);
@ -306,25 +309,31 @@ public class NotificationsFragment extends SFragment implements
binding.swipeRefreshLayout.setRefreshing(true);
onRefresh();
return true;
} else if (menuItem.getItemId() == R.id.action_edit_notification_filter) {
showFilterMenu();
return true;
} else if (menuItem.getItemId() == R.id.action_clear_notifications) {
confirmClearNotifications();
return true;
}
return false;
}
private void updateFilterVisibility() {
// CoordinatorLayout.LayoutParams params =
// (CoordinatorLayout.LayoutParams) binding.swipeRefreshLayout.getLayoutParams();
// if (showNotificationsFilter && !showingError) {
// binding.appBarOptions.setExpanded(true, false);
// binding.appBarOptions.setVisibility(View.VISIBLE);
// // Set content behaviour to hide filter on scroll
// params.setBehavior(new AppBarLayout.ScrollingViewBehavior());
// } else {
// binding.appBarOptions.setExpanded(false, false);
// binding.appBarOptions.setVisibility(View.GONE);
// // Clear behaviour to hide app bar
// params.setBehavior(null);
// }
CoordinatorLayout.LayoutParams params =
(CoordinatorLayout.LayoutParams) binding.swipeRefreshLayout.getLayoutParams();
if (showNotificationsFilter && !showingError) {
binding.appBarOptions.setExpanded(true, false);
binding.appBarOptions.setVisibility(View.VISIBLE);
// Set content behaviour to hide filter on scroll
params.setBehavior(new AppBarLayout.ScrollingViewBehavior());
} else {
binding.appBarOptions.setExpanded(false, false);
binding.appBarOptions.setVisibility(View.GONE);
// Clear behaviour to hide app bar
params.setBehavior(null);
}
}
private void confirmClearNotifications() {