Clean up some old SpotBugs rules

This commit is contained in:
TacoTheDank 2024-03-06 02:55:01 -05:00
parent c2ccc28b95
commit 522288260c
6 changed files with 18 additions and 43 deletions

View File

@ -551,7 +551,7 @@ public class MainActivity extends CastEnabledActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (isDrawerOpen()) { if (isDrawerOpen() && drawerLayout != null) {
drawerLayout.closeDrawer(navDrawer); drawerLayout.closeDrawer(navDrawer);
} else if (sheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) { } else if (sheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
sheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); sheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);

View File

@ -341,7 +341,7 @@ public class NavListAdapter extends RecyclerView.Adapter<NavListAdapter.Holder>
if (context == null) { if (context == null) {
return; return;
} }
if (tag.isOpen) { if (tag.isOpen()) {
holder.count.setVisibility(View.GONE); holder.count.setVisibility(View.GONE);
} }
Glide.with(context).clear(holder.image); Glide.with(context).clear(holder.image);

View File

@ -359,10 +359,10 @@ public class NavDrawerFragment extends Fragment implements SharedPreferences.OnS
.setState(BottomSheetBehavior.STATE_COLLAPSED); .setState(BottomSheetBehavior.STATE_COLLAPSED);
} else { } else {
NavDrawerData.TagDrawerItem folder = ((NavDrawerData.TagDrawerItem) clickedItem); NavDrawerData.TagDrawerItem folder = ((NavDrawerData.TagDrawerItem) clickedItem);
if (openFolders.contains(folder.name)) { if (openFolders.contains(folder.getTitle())) {
openFolders.remove(folder.name); openFolders.remove(folder.getTitle());
} else { } else {
openFolders.add(folder.name); openFolders.add(folder.getTitle());
} }
getContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE) getContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE)
@ -438,8 +438,8 @@ public class NavDrawerFragment extends Fragment implements SharedPreferences.OnS
flatItems.add(item); flatItems.add(item);
if (item.type == NavDrawerData.DrawerItem.Type.TAG) { if (item.type == NavDrawerData.DrawerItem.Type.TAG) {
NavDrawerData.TagDrawerItem folder = ((NavDrawerData.TagDrawerItem) item); NavDrawerData.TagDrawerItem folder = ((NavDrawerData.TagDrawerItem) item);
folder.isOpen = openFolders.contains(folder.name); folder.setOpen(openFolders.contains(folder.getTitle()));
if (folder.isOpen) { if (folder.isOpen()) {
flatItems.addAll(makeFlatDrawerData(((NavDrawerData.TagDrawerItem) item).children, layer + 1)); flatItems.addAll(makeFlatDrawerData(((NavDrawerData.TagDrawerItem) item).children, layer + 1));
} }
} }

View File

@ -4,10 +4,6 @@
<Bug pattern="BC_UNCONFIRMED_CAST"/> <Bug pattern="BC_UNCONFIRMED_CAST"/>
<Class name="de.danoeh.antennapod.adapter.NavListAdapter"/> <Class name="de.danoeh.antennapod.adapter.NavListAdapter"/>
</Match> </Match>
<Match>
<Bug pattern="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE"/>
<Class name="de.danoeh.antennapod.net.ssl.NoV1SslSocketFactory"/>
</Match>
<Match> <Match>
<Bug pattern="DLS_DEAD_LOCAL_STORE"/> <Bug pattern="DLS_DEAD_LOCAL_STORE"/>
<Class name="de.danoeh.antennapod.ui.statistics.StatisticsFragment"/> <Class name="de.danoeh.antennapod.ui.statistics.StatisticsFragment"/>
@ -40,10 +36,6 @@
<Bug pattern="MS_MUTABLE_ARRAY"/> <Bug pattern="MS_MUTABLE_ARRAY"/>
<Class name="de.danoeh.antennapod.fragment.NavDrawerFragment"/> <Class name="de.danoeh.antennapod.fragment.NavDrawerFragment"/>
</Match> </Match>
<Match>
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
<Class name="de.danoeh.antennapod.menuhandler.MenuItemUtils"/>
</Match>
<Match> <Match>
<Bug pattern="NP_NONNULL_PARAM_VIOLATION"/> <Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
<Class name="de.danoeh.antennapod.activity.MainActivity"/> <Class name="de.danoeh.antennapod.activity.MainActivity"/>
@ -56,10 +48,6 @@
<Bug pattern="NP_NULL_ON_SOME_PATH"/> <Bug pattern="NP_NULL_ON_SOME_PATH"/>
<Class name="de.danoeh.antennapod.model.feed.FeedMedia"/> <Class name="de.danoeh.antennapod.model.feed.FeedMedia"/>
</Match> </Match>
<Match>
<Bug pattern="NP_NULL_PARAM_DEREF"/>
<Class name="de.danoeh.antennapod.model.feed.FeedMedia"/>
</Match>
<Match> <Match>
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/> <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
<Class name="de.danoeh.antennapod.core.service.download.DownloadRequestCreator"/> <Class name="de.danoeh.antennapod.core.service.download.DownloadRequestCreator"/>
@ -68,18 +56,6 @@
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/> <Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
<Class name="de.danoeh.antennapod.preferences.PreferenceUpgrader"/> <Class name="de.danoeh.antennapod.preferences.PreferenceUpgrader"/>
</Match> </Match>
<Match>
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
<Class name="de.danoeh.antennapod.PodcastApp"/>
</Match>
<Match>
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
<Class name="de.danoeh.antennapod.core.service.download.DownloadService"/>
</Match>
<Match>
<Bug pattern="MS_CANNOT_BE_FINAL"/>
<Class name="de.danoeh.antennapod.core.service.download.DownloadService"/>
</Match>
<Match> <Match>
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/> <Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
<Class name="de.danoeh.antennapod.core.service.playback.PlaybackService"/> <Class name="de.danoeh.antennapod.core.service.playback.PlaybackService"/>
@ -100,18 +76,9 @@
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/> <Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
<Class name="de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer$PSMPInfo"/> <Class name="de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer$PSMPInfo"/>
</Match> </Match>
<Match>
<Bug pattern="UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD"/>
<Class name="de.danoeh.antennapod.core.storage.NavDrawerData$TagDrawerItem"/>
</Match>
<Match>
<Bug pattern="UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD"/>
<Class name="de.danoeh.antennapod.core.cast.CastButtonVisibilityManager"/>
</Match>
<Match><Class name="de.danoeh.antennapod.core.ClientConfig"/></Match> <Match><Class name="de.danoeh.antennapod.core.ClientConfig"/></Match>
<Match><Package name="de.danoeh.antennapod.core.glide"/></Match>
<Match><Package name="de.danoeh.antennapod.databinding"/></Match> <Match><Package name="de.danoeh.antennapod.databinding"/></Match>
<Match><Package name="de.danoeh.antennapod.core.databinding"/></Match> <Match><Package name="de.danoeh.antennapod.core.databinding"/></Match>
<Match><Package name="de.danoeh.antennapod.ui.common.databinding"/></Match> <Match><Package name="de.danoeh.antennapod.ui.common.databinding"/></Match>

View File

@ -57,8 +57,8 @@ public class NavDrawerData {
public static class TagDrawerItem extends DrawerItem { public static class TagDrawerItem extends DrawerItem {
public final List<DrawerItem> children = new ArrayList<>(); public final List<DrawerItem> children = new ArrayList<>();
public final String name; private final String name;
public boolean isOpen; private boolean isOpen;
public TagDrawerItem(String name) { public TagDrawerItem(String name) {
// Keep IDs >0 but make room for many feeds // Keep IDs >0 but make room for many feeds
@ -70,6 +70,14 @@ public class NavDrawerData {
return name; return name;
} }
public boolean isOpen() {
return isOpen;
}
public void setOpen(final boolean open) {
isOpen = open;
}
public int getCounter() { public int getCounter() {
int sum = 0; int sum = 0;
for (DrawerItem item : children) { for (DrawerItem item : children) {

View File

@ -12,7 +12,7 @@ import java.nio.charset.Charset;
import java.security.MessageDigest; import java.security.MessageDigest;
public class FastBlurTransformation extends BitmapTransformation { 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(); private static final String TAG = FastBlurTransformation.class.getSimpleName();