From 522288260cc613f400488168b9ca27f29da42ebd Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Wed, 6 Mar 2024 02:55:01 -0500 Subject: [PATCH] Clean up some old SpotBugs rules --- .../antennapod/activity/MainActivity.java | 2 +- .../antennapod/adapter/NavListAdapter.java | 2 +- .../fragment/NavDrawerFragment.java | 10 +++--- config/spotbugs/exclude.xml | 33 ------------------- .../core/storage/NavDrawerData.java | 12 +++++-- .../ui/glide/FastBlurTransformation.java | 2 +- 6 files changed, 18 insertions(+), 43 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index 369489bf8..46c62b9f4 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -551,7 +551,7 @@ public class MainActivity extends CastEnabledActivity { @Override public void onBackPressed() { - if (isDrawerOpen()) { + if (isDrawerOpen() && drawerLayout != null) { drawerLayout.closeDrawer(navDrawer); } else if (sheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) { sheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java index a304ead3c..176828308 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java @@ -341,7 +341,7 @@ public class NavListAdapter extends RecyclerView.Adapter if (context == null) { return; } - if (tag.isOpen) { + if (tag.isOpen()) { holder.count.setVisibility(View.GONE); } Glide.with(context).clear(holder.image); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/NavDrawerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/NavDrawerFragment.java index 636c0245b..4c3647669 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/NavDrawerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/NavDrawerFragment.java @@ -359,10 +359,10 @@ public class NavDrawerFragment extends Fragment implements SharedPreferences.OnS .setState(BottomSheetBehavior.STATE_COLLAPSED); } else { NavDrawerData.TagDrawerItem folder = ((NavDrawerData.TagDrawerItem) clickedItem); - if (openFolders.contains(folder.name)) { - openFolders.remove(folder.name); + if (openFolders.contains(folder.getTitle())) { + openFolders.remove(folder.getTitle()); } else { - openFolders.add(folder.name); + openFolders.add(folder.getTitle()); } getContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE) @@ -438,8 +438,8 @@ public class NavDrawerFragment extends Fragment implements SharedPreferences.OnS flatItems.add(item); if (item.type == NavDrawerData.DrawerItem.Type.TAG) { NavDrawerData.TagDrawerItem folder = ((NavDrawerData.TagDrawerItem) item); - folder.isOpen = openFolders.contains(folder.name); - if (folder.isOpen) { + folder.setOpen(openFolders.contains(folder.getTitle())); + if (folder.isOpen()) { flatItems.addAll(makeFlatDrawerData(((NavDrawerData.TagDrawerItem) item).children, layer + 1)); } } diff --git a/config/spotbugs/exclude.xml b/config/spotbugs/exclude.xml index 7802c7c74..b80c0550c 100644 --- a/config/spotbugs/exclude.xml +++ b/config/spotbugs/exclude.xml @@ -4,10 +4,6 @@ - - - - @@ -40,10 +36,6 @@ - - - - @@ -56,10 +48,6 @@ - - - - @@ -68,18 +56,6 @@ - - - - - - - - - - - - @@ -100,18 +76,9 @@ - - - - - - - - - diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java b/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java index af02a7733..024c5d357 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java @@ -57,8 +57,8 @@ public class NavDrawerData { public static class TagDrawerItem extends DrawerItem { public final List children = new ArrayList<>(); - public final String name; - public boolean isOpen; + private final String name; + private boolean isOpen; public TagDrawerItem(String name) { // Keep IDs >0 but make room for many feeds @@ -70,6 +70,14 @@ public class NavDrawerData { return name; } + public boolean isOpen() { + return isOpen; + } + + public void setOpen(final boolean open) { + isOpen = open; + } + public int getCounter() { int sum = 0; for (DrawerItem item : children) { diff --git a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/FastBlurTransformation.java b/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/FastBlurTransformation.java index a19611100..54040e4b4 100644 --- a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/FastBlurTransformation.java +++ b/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/FastBlurTransformation.java @@ -12,7 +12,7 @@ import java.nio.charset.Charset; import java.security.MessageDigest; public class FastBlurTransformation extends BitmapTransformation { - private static final String ID = "de.danoeh.antennapod.core.glide.FastBlurTransformation"; + private static final String ID = "de.danoeh.antennapod.ui.glide.FastBlurTransformation"; private static final String TAG = FastBlurTransformation.class.getSimpleName();