Faster access to remove all notifications
This commit is contained in:
parent
bbcc9244e3
commit
25c372280f
|
@ -27,12 +27,10 @@ import android.view.ViewGroup;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.google.android.material.button.MaterialButton;
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
|
||||||
|
@ -93,23 +91,7 @@ public class FragmentNotificationContainer extends Fragment {
|
||||||
dialogBuilder.setView(dialogView.getRoot());
|
dialogBuilder.setView(dialogView.getRoot());
|
||||||
|
|
||||||
|
|
||||||
dialogView.clearAllNotif.setOnClickListener(v1 -> {
|
|
||||||
AlertDialog.Builder db = new MaterialAlertDialogBuilder(requireActivity());
|
|
||||||
db.setTitle(R.string.delete_notification_ask_all);
|
|
||||||
db.setMessage(R.string.delete_notification_all_warning);
|
|
||||||
db.setPositiveButton(R.string.delete_all, (dialog, id) -> {
|
|
||||||
changes.set(true);
|
|
||||||
NotificationsVM notificationsVM = new ViewModelProvider(FragmentNotificationContainer.this).get(NotificationsVM.class);
|
|
||||||
notificationsVM.clearNotification(BaseMainActivity.currentUserID, BaseMainActivity.currentInstance, BaseMainActivity.currentToken)
|
|
||||||
.observe(getViewLifecycleOwner(), unused -> {
|
|
||||||
Toasty.info(requireActivity(), R.string.delete_notification_all, Toasty.LENGTH_LONG).show();
|
|
||||||
});
|
|
||||||
dialog.dismiss();
|
|
||||||
});
|
|
||||||
db.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
|
||||||
AlertDialog alertDialog = db.create();
|
|
||||||
alertDialog.show();
|
|
||||||
});
|
|
||||||
|
|
||||||
boolean displayAllCategory = sharedpreferences.getBoolean(getString(R.string.SET_DISPLAY_ALL_NOTIFICATIONS_TYPE) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, false);
|
boolean displayAllCategory = sharedpreferences.getBoolean(getString(R.string.SET_DISPLAY_ALL_NOTIFICATIONS_TYPE) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, false);
|
||||||
dialogView.displayAllCategories.setChecked(displayAllCategory);
|
dialogView.displayAllCategories.setChecked(displayAllCategory);
|
||||||
|
@ -204,18 +186,27 @@ public class FragmentNotificationContainer extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogView.more.setOnClickListener(v1 -> {
|
|
||||||
if (dialogView.clearAllNotif.getVisibility() == View.VISIBLE) {
|
|
||||||
dialogView.clearAllNotif.setVisibility(View.GONE);
|
|
||||||
((MaterialButton) v1).setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_baseline_expand_more_24, requireContext().getTheme()));
|
|
||||||
} else {
|
|
||||||
dialogView.clearAllNotif.setVisibility(View.VISIBLE);
|
|
||||||
((MaterialButton) v1).setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_baseline_expand_less_24, requireContext().getTheme()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dialogBuilder.setOnDismissListener(dialogInterface -> doAction(changes.get(), excludedCategoriesList));
|
dialogBuilder.setOnDismissListener(dialogInterface -> doAction(changes.get(), excludedCategoriesList));
|
||||||
dialogBuilder.setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss());
|
dialogBuilder.setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss());
|
||||||
AlertDialog alertDialog = dialogBuilder.create();
|
AlertDialog alertDialog = dialogBuilder.create();
|
||||||
|
dialogView.clearAllNotif.setOnClickListener(v1 -> {
|
||||||
|
AlertDialog.Builder db = new MaterialAlertDialogBuilder(requireActivity());
|
||||||
|
db.setTitle(R.string.delete_notification_ask_all);
|
||||||
|
db.setMessage(R.string.delete_notification_all_warning);
|
||||||
|
db.setPositiveButton(R.string.delete_all, (dialog, id) -> {
|
||||||
|
changes.set(true);
|
||||||
|
NotificationsVM notificationsVM = new ViewModelProvider(FragmentNotificationContainer.this).get(NotificationsVM.class);
|
||||||
|
notificationsVM.clearNotification(BaseMainActivity.currentUserID, BaseMainActivity.currentInstance, BaseMainActivity.currentToken)
|
||||||
|
.observe(getViewLifecycleOwner(), unused -> {
|
||||||
|
Toasty.info(requireActivity(), R.string.delete_notification_all, Toasty.LENGTH_LONG).show();
|
||||||
|
});
|
||||||
|
dialog.dismiss();
|
||||||
|
alertDialog.dismiss();
|
||||||
|
});
|
||||||
|
db.setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
|
||||||
|
AlertDialog alertDialogDb = db.create();
|
||||||
|
alertDialogDb.show();
|
||||||
|
});
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -128,9 +128,8 @@
|
||||||
</com.google.android.material.button.MaterialButtonToggleGroup>
|
</com.google.android.material.button.MaterialButtonToggleGroup>
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:id="@+id/more"
|
style="@style/TextAppearance.Material3.TitleMedium"
|
||||||
style="@style/Widget.Material3.Button.TextButton"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
|
@ -138,18 +137,16 @@
|
||||||
android:text="@string/more_actions"
|
android:text="@string/more_actions"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textColor="?colorError"
|
android:textColor="?colorError"
|
||||||
app:icon="@drawable/ic_baseline_expand_more_24"
|
android:background="@drawable/red_border" />
|
||||||
app:iconTint="?colorError"
|
|
||||||
app:rippleColor="?colorError" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/clear_all_notif"
|
android:id="@+id/clear_all_notif"
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/clear_all_notif"
|
android:text="@string/clear_all_notif"
|
||||||
android:textColor="?colorError"
|
android:textColor="?colorError"
|
||||||
android:visibility="gone"
|
|
||||||
app:icon="@drawable/ic_baseline_delete_24"
|
app:icon="@drawable/ic_baseline_delete_24"
|
||||||
app:iconTint="?colorError"
|
app:iconTint="?colorError"
|
||||||
app:rippleColor="?colorError"
|
app:rippleColor="?colorError"
|
||||||
|
|
|
@ -4,6 +4,7 @@ Added:
|
||||||
|
|
||||||
Changed:
|
Changed:
|
||||||
- Maths formula aligned to the left
|
- Maths formula aligned to the left
|
||||||
|
- Faster access to delete all notifications
|
||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
- Fix an issue with Nitter and some URLs
|
- Fix an issue with Nitter and some URLs
|
||||||
|
|
Loading…
Reference in New Issue