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
public void onBackPressed() {
if (isDrawerOpen()) {
if (isDrawerOpen() && drawerLayout != null) {
drawerLayout.closeDrawer(navDrawer);
} else if (sheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
sheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);

View File

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

View File

@ -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));
}
}

View File

@ -4,10 +4,6 @@
<Bug pattern="BC_UNCONFIRMED_CAST"/>
<Class name="de.danoeh.antennapod.adapter.NavListAdapter"/>
</Match>
<Match>
<Bug pattern="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE"/>
<Class name="de.danoeh.antennapod.net.ssl.NoV1SslSocketFactory"/>
</Match>
<Match>
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
<Class name="de.danoeh.antennapod.ui.statistics.StatisticsFragment"/>
@ -40,10 +36,6 @@
<Bug pattern="MS_MUTABLE_ARRAY"/>
<Class name="de.danoeh.antennapod.fragment.NavDrawerFragment"/>
</Match>
<Match>
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
<Class name="de.danoeh.antennapod.menuhandler.MenuItemUtils"/>
</Match>
<Match>
<Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
<Class name="de.danoeh.antennapod.activity.MainActivity"/>
@ -56,10 +48,6 @@
<Bug pattern="NP_NULL_ON_SOME_PATH"/>
<Class name="de.danoeh.antennapod.model.feed.FeedMedia"/>
</Match>
<Match>
<Bug pattern="NP_NULL_PARAM_DEREF"/>
<Class name="de.danoeh.antennapod.model.feed.FeedMedia"/>
</Match>
<Match>
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
<Class name="de.danoeh.antennapod.core.service.download.DownloadRequestCreator"/>
@ -68,18 +56,6 @@
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
<Class name="de.danoeh.antennapod.preferences.PreferenceUpgrader"/>
</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>
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
<Class name="de.danoeh.antennapod.core.service.playback.PlaybackService"/>
@ -100,18 +76,9 @@
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
<Class name="de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer$PSMPInfo"/>
</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><Package name="de.danoeh.antennapod.core.glide"/></Match>
<Match><Package name="de.danoeh.antennapod.databinding"/></Match>
<Match><Package name="de.danoeh.antennapod.core.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 final List<DrawerItem> 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) {

View File

@ -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();