Add the special appbar for the notifications again (#4022)
This commit is contained in:
parent
f99cb6d1d5
commit
f63c662275
|
@ -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() {
|
||||
|
|
|
@ -22,6 +22,48 @@
|
|||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/colorBackground">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBarOptions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorSurface"
|
||||
app:elevation="0dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/topButtonsLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonClear"
|
||||
style="@style/TuskyButton.TextButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/notifications_clear"
|
||||
android:textSize="?attr/status_text_medium" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonFilter"
|
||||
style="@style/TuskyButton.TextButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/notifications_apply_filter"
|
||||
android:textSize="?attr/status_text_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_scrollFlags="scroll|enterAlways" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefreshLayout"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -23,15 +23,10 @@
|
|||
android:title="@string/action_refresh"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/load_newest"
|
||||
android:title="@string/load_newest_notifications"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_edit_notification_filter"
|
||||
android:title="@string/notifications_apply_filter"
|
||||
app:showAsAction="ifRoom" />
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_clear_notifications"
|
||||
|
|
|
@ -613,8 +613,8 @@
|
|||
<string name="error_list_load">Error loading lists</string>
|
||||
<string name="list_exclusive_label">Hide from the home timeline</string>
|
||||
<string name="list">List</string>
|
||||
<string name="notifications_clear">Delete notifications</string>
|
||||
<string name="notifications_apply_filter">Filter notifications</string>
|
||||
<string name="notifications_clear">Delete</string>
|
||||
<string name="notifications_apply_filter">Filter</string>
|
||||
<string name="filter_apply">Apply</string>
|
||||
|
||||
<string name="muting_hashtag_success_format">Muting hashtag #%s as a warning</string>
|
||||
|
|
Loading…
Reference in New Issue