diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2022-02-22 20:55:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 20:55:30 +0100 |
commit | ecaba7525ff63b7837a370c2ccc3b5f8b1c52aed (patch) | |
tree | f6f21dfcc601055dda743a25c4c0190ba7e97c78 | |
parent | 2f3efa5d3383732b52a4d9bf78b1b7502573151f (diff) | |
parent | 48852e081a374c495fec1162f4dce3f31dc5b2c0 (diff) | |
download | AntennaPod-ecaba7525ff63b7837a370c2ccc3b5f8b1c52aed.zip |
Merge pull request #5741 from ByteHamster/remove-unused
Delete a few unused things
38 files changed, 57 insertions, 342 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/Rss2Generator.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/Rss2Generator.java index 6b294244a..6b85f3bf8 100644 --- a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/Rss2Generator.java +++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/Rss2Generator.java @@ -127,15 +127,9 @@ public class Rss2Generator implements FeedGenerator { } } - writeAdditionalAttributes(xml); - xml.endTag(null, "channel"); xml.endTag(null, "rss"); xml.endDocument(); } - - protected void writeAdditionalAttributes(XmlSerializer xml) throws IOException { - - } } diff --git a/app/src/main/java/de/danoeh/antennapod/activity/WidgetConfigActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/WidgetConfigActivity.java index 674071294..4cf925860 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/WidgetConfigActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/WidgetConfigActivity.java @@ -47,7 +47,7 @@ public class WidgetConfigActivity extends AppCompatActivity { opacityTextView = findViewById(R.id.widget_opacity_textView); opacitySeekBar = findViewById(R.id.widget_opacity_seekBar); widgetPreview = findViewById(R.id.widgetLayout); - findViewById(R.id.butConfirm).setOnClickListener(this::confirmCreateWidget); + findViewById(R.id.butConfirm).setOnClickListener(v -> confirmCreateWidget()); opacitySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override @@ -94,7 +94,7 @@ public class WidgetConfigActivity extends AppCompatActivity { widgetPreview.findViewById(R.id.butRew).setVisibility(ckRewind.isChecked() ? View.VISIBLE : View.GONE); } - private void confirmCreateWidget(View v) { + private void confirmCreateWidget() { int backgroundColor = getColorWithAlpha(PlayerWidget.DEFAULT_COLOR, opacitySeekBar.getProgress()); SharedPreferences prefs = getSharedPreferences(PlayerWidget.PREFS_NAME, MODE_PRIVATE); diff --git a/app/src/main/java/de/danoeh/antennapod/discovery/PodcastSearchResult.java b/app/src/main/java/de/danoeh/antennapod/discovery/PodcastSearchResult.java index 767845cb4..c8096e9c5 100644 --- a/app/src/main/java/de/danoeh/antennapod/discovery/PodcastSearchResult.java +++ b/app/src/main/java/de/danoeh/antennapod/discovery/PodcastSearchResult.java @@ -39,10 +39,6 @@ public class PodcastSearchResult { this.author = author; } - private PodcastSearchResult(String title, @Nullable String imageUrl, @Nullable String feedUrl) { - this(title, imageUrl, feedUrl, ""); - } - public static PodcastSearchResult dummy() { return new PodcastSearchResult("", "", "", ""); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java index 715786921..7d9814998 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java @@ -283,7 +283,7 @@ public class ItemFragment extends Fragment { if (item.getPubDate() != null) { String pubDateStr = DateFormatter.formatAbbrev(getActivity(), item.getPubDate()); txtvPublished.setText(pubDateStr); - txtvPublished.setContentDescription(DateFormatter.formatForAccessibility(getContext(), item.getPubDate())); + txtvPublished.setContentDescription(DateFormatter.formatForAccessibility(item.getPubDate())); } RequestOptions options = new RequestOptions() diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java index 6526be005..1a3962de2 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java @@ -335,8 +335,8 @@ public class SearchFragment extends Fragment { return new Pair<>(Collections.emptyList(), Collections.emptyList()); } long feed = getArguments().getLong(ARG_FEED); - List<FeedItem> items = FeedSearcher.searchFeedItems(getContext(), query, feed); - List<Feed> feeds = FeedSearcher.searchFeeds(getContext(), query); + List<FeedItem> items = FeedSearcher.searchFeedItems(query, feed); + List<Feed> feeds = FeedSearcher.searchFeeds(query); return new Pair<>(items, feeds); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/actions/FeedMultiSelectActionHandler.java b/app/src/main/java/de/danoeh/antennapod/fragment/actions/FeedMultiSelectActionHandler.java index e3dfe8ade..9067b17a7 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/actions/FeedMultiSelectActionHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/actions/FeedMultiSelectActionHandler.java @@ -8,8 +8,6 @@ import androidx.core.util.Consumer; import com.google.android.material.snackbar.Snackbar; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -66,9 +64,6 @@ public class FeedMultiSelectActionHandler { preferenceSwitchDialog.openDialog(); } - private static final DecimalFormat SPEED_FORMAT = - new DecimalFormat("0.00", DecimalFormatSymbols.getInstance(Locale.US)); - private void playbackSpeedPrefHandler() { PlaybackSpeedFeedSettingDialogBinding viewBinding = PlaybackSpeedFeedSettingDialogBinding.inflate(activity.getLayoutInflater()); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java index 62e2e30d1..655cd6ed4 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/TagFragment.java @@ -15,8 +15,6 @@ import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetTag; * Use the newInstance method of this class to create a new TagFragment. */ public class TagFragment extends PodcastListFragment { - - private static final String TAG = "TagFragment"; private static final int PODCAST_COUNT = 50; private GpodnetTag tag; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/StoragePreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/StoragePreferencesFragment.java index e5617b8ea..00ff9fb64 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/StoragePreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/StoragePreferencesFragment.java @@ -10,7 +10,6 @@ import de.danoeh.antennapod.dialog.ChooseDataFolderDialog; import java.io.File; public class StoragePreferencesFragment extends PreferenceFragmentCompat { - private static final String TAG = "StoragePrefFragment"; private static final String PREF_CHOOSE_DATA_DIR = "prefChooseDataDir"; private static final String PREF_IMPORT_EXPORT = "prefImportExport"; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/SwipePreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/SwipePreferencesFragment.java index 3d9709f74..19099a380 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/SwipePreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/SwipePreferencesFragment.java @@ -11,8 +11,6 @@ import de.danoeh.antennapod.fragment.QueueFragment; public class SwipePreferencesFragment extends PreferenceFragmentCompat { private static final String PREF_SWIPE_FEED = "prefSwipeFeed"; private static final String PREF_SWIPE_QUEUE = "prefSwipeQueue"; - //private static final String PREF_SWIPE_INBOX = "prefSwipeInbox"; - //private static final String PREF_SWIPE_EPISODES = "prefSwipeEpisodes"; @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/ContributorsPagerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/ContributorsPagerFragment.java index 3e55379fd..caa8031ae 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/ContributorsPagerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/about/ContributorsPagerFragment.java @@ -17,9 +17,6 @@ import de.danoeh.antennapod.activity.PreferenceActivity; * Displays the 'about->Contributors' pager screen. */ public class ContributorsPagerFragment extends Fragment { - - public static final String TAG = "StatisticsFragment"; - private static final int POS_DEVELOPERS = 0; private static final int POS_TRANSLATORS = 1; private static final int POS_SPECIAL_THANKS = 2; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java index 9dfe6840c..358985cea 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/synchronization/GpodderAuthenticationFragment.java @@ -250,18 +250,6 @@ public class GpodderAuthenticationFragment extends DialogFragment { return false; } - private GpodnetDevice findDevice(String id) { - if (devices == null) { - return null; - } - for (GpodnetDevice device : devices) { - if (device.getId().equals(id)) { - return device; - } - } - return null; - } - private void setupFinishView(View view) { final Button sync = view.findViewById(R.id.butSyncNow); diff --git a/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java b/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java index d231e522f..c1ab3a7a6 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java +++ b/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java @@ -104,7 +104,7 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder { title.setText(item.getTitle()); leftPadding.setContentDescription(item.getTitle()); pubDate.setText(DateFormatter.formatAbbrev(activity, item.getPubDate())); - pubDate.setContentDescription(DateFormatter.formatForAccessibility(activity, item.getPubDate())); + pubDate.setContentDescription(DateFormatter.formatForAccessibility(item.getPubDate())); isNew.setVisibility(item.isNew() ? View.VISIBLE : View.GONE); isFavorite.setVisibility(item.isTagged(FeedItem.TAG_FAVORITE) ? View.VISIBLE : View.GONE); isInQueue.setVisibility(item.isTagged(FeedItem.TAG_QUEUE) ? View.VISIBLE : View.GONE); diff --git a/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java index c9fe886fb..47b5dcd09 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java +++ b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java @@ -13,50 +13,43 @@ import de.danoeh.antennapod.core.R; */ public abstract class ConfirmationDialog { - private static final String TAG = ConfirmationDialog.class.getSimpleName(); + private static final String TAG = ConfirmationDialog.class.getSimpleName(); - private final Context context; - private final int titleId; - private final String message; + private final Context context; + private final int titleId; + private final String message; - private int positiveText; - private int negativeText; + private int positiveText; - public ConfirmationDialog(Context context, int titleId, int messageId) { - this(context, titleId, context.getString(messageId)); - } + public ConfirmationDialog(Context context, int titleId, int messageId) { + this(context, titleId, context.getString(messageId)); + } - public ConfirmationDialog(Context context, int titleId, String message) { - this.context = context; - this.titleId = titleId; - this.message = message; - } + public ConfirmationDialog(Context context, int titleId, String message) { + this.context = context; + this.titleId = titleId; + this.message = message; + } - private void onCancelButtonPressed(DialogInterface dialog) { - Log.d(TAG, "Dialog was cancelled"); - dialog.dismiss(); - } + private void onCancelButtonPressed(DialogInterface dialog) { + Log.d(TAG, "Dialog was cancelled"); + dialog.dismiss(); + } public void setPositiveText(int id) { this.positiveText = id; } - public void setNegativeText(int id) { - this.negativeText = id; + public abstract void onConfirmButtonPressed(DialogInterface dialog); + + public final AlertDialog createNewDialog() { + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(titleId); + builder.setMessage(message); + builder.setPositiveButton(positiveText != 0 ? positiveText : R.string.confirm_label, + (dialog, which) -> onConfirmButtonPressed(dialog)); + builder.setNegativeButton(R.string.cancel_label, (dialog, which) -> onCancelButtonPressed(dialog)); + builder.setOnCancelListener(ConfirmationDialog.this::onCancelButtonPressed); + return builder.create(); } - - - public abstract void onConfirmButtonPressed(DialogInterface dialog); - - public final AlertDialog createNewDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(titleId); - builder.setMessage(message); - builder.setPositiveButton(positiveText != 0 ? positiveText : R.string.confirm_label, - (dialog, which) -> onConfirmButtonPressed(dialog)); - builder.setNegativeButton(negativeText != 0 ? negativeText : R.string.cancel_label, - (dialog, which) -> onCancelButtonPressed(dialog)); - builder.setOnCancelListener(ConfirmationDialog.this::onCancelButtonPressed); - return builder.create(); - } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/glide/AudioCoverFetcher.java b/core/src/main/java/de/danoeh/antennapod/core/glide/AudioCoverFetcher.java index b6b607904..9d270360a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/glide/AudioCoverFetcher.java +++ b/core/src/main/java/de/danoeh/antennapod/core/glide/AudioCoverFetcher.java @@ -16,9 +16,6 @@ import java.io.InputStream; // see https://github.com/bumptech/glide/issues/699 class AudioCoverFetcher implements DataFetcher<InputStream> { - - private static final String TAG = "AudioCoverFetcher"; - private final String path; private final Context context; diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java index 82ad27dcd..82e1fb55a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java @@ -125,12 +125,9 @@ public class UserPreferences { private static final String PREF_FAST_FORWARD_SECS = "prefFastForwardSecs"; private static final String PREF_REWIND_SECS = "prefRewindSecs"; private static final String PREF_QUEUE_LOCKED = "prefQueueLocked"; - private static final String PREF_LEFT_VOLUME = "prefLeftVolume"; - private static final String PREF_RIGHT_VOLUME = "prefRightVolume"; // Experimental private static final String PREF_STEREO_TO_MONO = "PrefStereoToMono"; - public static final String PREF_CAST_ENABLED = "prefCast"; //Used for enabling Chromecast support public static final int EPISODE_CLEANUP_QUEUE = -1; public static final int EPISODE_CLEANUP_NULL = -2; public static final int EPISODE_CLEANUP_EXCEPT_FAVORITE = -3; @@ -827,10 +824,6 @@ public class UserPreferences { return getMediaPlayer().equals(PREF_MEDIA_PLAYER_EXOPLAYER); } - public static void enableSonic() { - prefs.edit().putString(PREF_MEDIA_PLAYER, "sonic").apply(); - } - public static void enableExoplayer() { prefs.edit().putString(PREF_MEDIA_PLAYER, PREF_MEDIA_PLAYER_EXOPLAYER).apply(); } @@ -956,13 +949,6 @@ public class UserPreferences { return getUpdateTimeOfDay().length == 2; } - /** - * Evaluates whether Cast support (Chromecast, Audio Cast, etc) is enabled on the preferences. - */ - public static boolean isCastEnabled() { - return prefs.getBoolean(PREF_CAST_ENABLED, false); - } - public enum BackButtonBehavior { DEFAULT, OPEN_DRAWER, DOUBLE_TAP, SHOW_PROMPT, GO_TO_PAGE } @@ -1059,9 +1045,4 @@ public class UserPreferences { public static boolean shouldShowSubscriptionTitle() { return prefs.getBoolean(PREF_SUBSCRIPTION_TITLE, false); } - - public static void setSubscriptionTitleSetting(boolean showTitle) { - prefs.edit().putBoolean(PREF_SUBSCRIPTION_TITLE, showTitle).apply(); - } - } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java index 9760c57b1..8f559a889 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java @@ -9,7 +9,6 @@ import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.parser.feed.FeedHandlerResult; public class FeedSyncTask { - private static final String TAG = "FeedParserTask"; private final DownloadRequest request; private final Context context; private DownloadStatus downloadStatus; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java index d54d10dc6..f1b9510d9 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java @@ -713,7 +713,6 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { return stream; } - /** * Releases internally used resources. This method should only be called when the object is not used anymore. */ @@ -738,16 +737,6 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { releaseWifiLockIfNecessary(); } - /** - * Releases internally used resources. This method should only be called when the object is not used anymore. - * This method is executed on an internal executor service. - */ - @Override - public void shutdownQuietly() { - executor.submit(this::shutdown); - executor.shutdown(); - } - @Override public void setVideoSurface(final SurfaceHolder surface) { executor.submit(() -> { diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index d6d11bc8a..07e197752 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -82,7 +82,6 @@ import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.core.util.playback.PlayableUtils; import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; import de.danoeh.antennapod.core.widget.WidgetUpdater; -import de.danoeh.antennapod.model.feed.Chapter; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; @@ -1663,24 +1662,15 @@ public class PlaybackService extends MediaBrowserServiceCompat { mediaPlayer.setStartWhenPrepared(s); } - public void seekTo(final int t) { mediaPlayer.seekTo(t); } - private void seekDelta(final int d) { mediaPlayer.seekDelta(d); } /** - * Seek to the start of the specified chapter. - */ - public void seekToChapter(Chapter c) { - seekTo((int) c.getStart()); - } - - /** * call getDuration() on mediaplayer or return INVALID_TIME if player is in * an invalid state. */ @@ -1792,7 +1782,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { public void onPlayFromSearch(String query, Bundle extras) { Log.d(TAG, "onPlayFromSearch query=" + query + " extras=" + extras.toString()); - List<FeedItem> results = FeedSearcher.searchFeedItems(getBaseContext(), query, 0); + List<FeedItem> results = FeedSearcher.searchFeedItems(query, 0); if (results.size() > 0 && results.get(0).getMedia() != null) { FeedMedia media = results.get(0).getMedia(); startPlaying(media, false); diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceStateManager.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceStateManager.java index 83c065e0e..addc6b996 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceStateManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceStateManager.java @@ -36,10 +36,6 @@ class PlaybackServiceStateManager { isInForeground = false; } - boolean isInForeground() { - return isInForeground; - } - boolean hasReceivedValidStartCommand() { return hasReceivedValidStartCommand; } diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java index d1c041723..f447090a8 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java @@ -176,7 +176,7 @@ public final class DBTasks { media.setDownloaded(false); media.setFile_url(null); DBWriter.setFeedMedia(media); - EventBus.getDefault().post(FeedItemEvent.deletedMedia(media.getItem())); + EventBus.getDefault().post(FeedItemEvent.updated(media.getItem())); EventBus.getDefault().post(new MessageEvent(context.getString(R.string.error_file_not_found))); } @@ -230,36 +230,7 @@ public final class DBTasks { UserPreferences.getEpisodeCleanupAlgorithm().performCleanup(context); } - /** - * Returns the successor of a FeedItem in the queue. - * - * @param itemId ID of the FeedItem - * @param queue Used for determining the successor of the item. If this parameter is null, the method will load - * the queue from the database in the same thread. - * @return Successor of the FeedItem or null if the FeedItem is not in the queue or has no successor. - */ - public static FeedItem getQueueSuccessorOfItem(final long itemId, List<FeedItem> queue) { - FeedItem result = null; - if (queue == null) { - queue = DBReader.getQueue(); - } - if (queue != null) { - Iterator<FeedItem> iterator = queue.iterator(); - while (iterator.hasNext()) { - FeedItem item = iterator.next(); - if (item.getId() == itemId) { - if (iterator.hasNext()) { - result = iterator.next(); - } - break; - } - } - } - return result; - } - - private static Feed searchFeedByIdentifyingValueOrID(PodDBAdapter adapter, - Feed feed) { + private static Feed searchFeedByIdentifyingValueOrID(Feed feed) { if (feed.getId() != 0) { return DBReader.getFeed(feed.getId()); } else { @@ -322,7 +293,7 @@ public final class DBTasks { adapter.open(); // Look up feed in the feedslist - final Feed savedFeed = searchFeedByIdentifyingValueOrID(adapter, newFeed); + final Feed savedFeed = searchFeedByIdentifyingValueOrID(newFeed); if (savedFeed == null) { Log.d(TAG, "Found no existing Feed with title " + newFeed.getTitle() + ". Adding as new one."); @@ -456,7 +427,7 @@ public final class DBTasks { if (savedFeed == null) { DBWriter.addNewFeed(context, newFeed).get(); // Update with default values that are set in database - resultFeed = searchFeedByIdentifyingValueOrID(adapter, newFeed); + resultFeed = searchFeedByIdentifyingValueOrID(newFeed); } else { DBWriter.setCompleteFeed(savedFeed).get(); } @@ -487,15 +458,13 @@ public final class DBTasks { /** * Searches the FeedItems of a specific Feed for a given string. * - * @param context Used for accessing the DB. * @param feedID The id of the feed whose items should be searched. * @param query The search string. * @return A FutureTask object that executes the search request * and returns the search result as a List of FeedItems. */ - public static FutureTask<List<FeedItem>> searchFeedItems(final Context context, - final long feedID, final String query) { - return new FutureTask<>(new QueryTask<List<FeedItem>>(context) { + public static FutureTask<List<FeedItem>> searchFeedItems(final long feedID, final String query) { + return new FutureTask<>(new QueryTask<List<FeedItem>>() { @Override public void execute(PodDBAdapter adapter) { Cursor searchResult = adapter.searchItems(feedID, query); @@ -507,8 +476,8 @@ public final class DBTasks { }); } - public static FutureTask<List<Feed>> searchFeeds(final Context context, final String query) { - return new FutureTask<>(new QueryTask<List<Feed>>(context) { + public static FutureTask<List<Feed>> searchFeeds(final String query) { + return new FutureTask<>(new QueryTask<List<Feed>>() { @Override public void execute(PodDBAdapter adapter) { Cursor cursor = adapter.searchFeeds(query); @@ -533,7 +502,7 @@ public final class DBTasks { abstract static class QueryTask<T> implements Callable<T> { private T result; - public QueryTask(Context context) { + public QueryTask() { } @Override diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java index af57cbdae..e572b4d8c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java @@ -13,7 +13,6 @@ import org.greenrobot.eventbus.EventBus; import java.io.File; import java.util.ArrayList; -import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Locale; @@ -142,7 +141,7 @@ public class DBWriter { .build(); SynchronizationQueueSink.enqueueEpisodeActionIfSynchronizationIsActive(context, action); } - EventBus.getDefault().post(FeedItemEvent.deletedMedia(Collections.singletonList(media.getItem()))); + EventBus.getDefault().post(FeedItemEvent.updated(media.getItem())); return true; } @@ -550,7 +549,7 @@ public class DBWriter { adapter.addFavoriteItem(item); adapter.close(); item.addTag(FeedItem.TAG_FAVORITE); - EventBus.getDefault().post(FavoritesEvent.added(item)); + EventBus.getDefault().post(new FavoritesEvent()); EventBus.getDefault().post(FeedItemEvent.updated(item)); }); } @@ -561,7 +560,7 @@ public class DBWriter { adapter.removeFavoriteItem(item); adapter.close(); item.removeTag(FeedItem.TAG_FAVORITE); - EventBus.getDefault().post(FavoritesEvent.removed(item)); + EventBus.getDefault().post(new FavoritesEvent()); EventBus.getDefault().post(FeedItemEvent.updated(item)); }); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java index c3dd52b49..68ce7b7ef 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java @@ -1,6 +1,5 @@ package de.danoeh.antennapod.core.storage; -import android.content.Context; import androidx.annotation.NonNull; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedItem; @@ -19,9 +18,9 @@ public class FeedSearcher { } @NonNull - public static List<FeedItem> searchFeedItems(final Context context, final String query, final long selectedFeed) { + public static List<FeedItem> searchFeedItems(final String query, final long selectedFeed) { try { - FutureTask<List<FeedItem>> itemSearchTask = DBTasks.searchFeedItems(context, selectedFeed, query); + FutureTask<List<FeedItem>> itemSearchTask = DBTasks.searchFeedItems(selectedFeed, query); itemSearchTask.run(); return itemSearchTask.get(); } catch (ExecutionException | InterruptedException e) { @@ -31,9 +30,9 @@ public class FeedSearcher { } @NonNull - public static List<Feed> searchFeeds(final Context context, final String query) { + public static List<Feed> searchFeeds(final String query) { try { - FutureTask<List<Feed>> feedSearchTask = DBTasks.searchFeeds(context, query); + FutureTask<List<Feed>> feedSearchTask = DBTasks.searchFeeds(query); feedSearchTask.run(); return feedSearchTask.get(); } catch (ExecutionException | InterruptedException e) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/DateFormatter.java b/core/src/main/java/de/danoeh/antennapod/core/util/DateFormatter.java index 99628dfcc..dc7ed4508 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/DateFormatter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/DateFormatter.java @@ -37,7 +37,7 @@ public class DateFormatter { return android.text.format.DateUtils.formatDateTime(context, date.getTime(), format); } - public static String formatForAccessibility(final Context context, final Date date) { + public static String formatForAccessibility(final Date date) { if (date == null) { return ""; } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java index 0bf301366..85be3c787 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java @@ -5,7 +5,6 @@ import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkInfo; -import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Build; import android.text.TextUtils; @@ -146,18 +145,6 @@ public class NetworkUtils { return selectedNetworks.contains(Integer.toString(wm.getConnectionInfo().getNetworkId())); } - /** - * Returns the SSID of the wifi connection, or <code>null</code> if there is no wifi. - */ - public static String getWifiSsid() { - WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); - WifiInfo wifiInfo = wifiManager.getConnectionInfo(); - if (wifiInfo != null) { - return wifiInfo.getSSID(); - } - return null; - } - public static boolean wasDownloadBlocked(Throwable throwable) { String message = throwable.getMessage(); if (message != null) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/PowerUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/PowerUtils.java index 39deea36a..a1fadb4dc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/PowerUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/PowerUtils.java @@ -10,8 +10,6 @@ import android.os.BatteryManager; */ public class PowerUtils { - private static final String TAG = "PowerUtils"; - private PowerUtils() { } diff --git a/core/src/play/java/de/danoeh/antennapod/core/service/playback/WearMediaSession.java b/core/src/play/java/de/danoeh/antennapod/core/service/playback/WearMediaSession.java index 2167d9f2c..8df05d10d 100644 --- a/core/src/play/java/de/danoeh/antennapod/core/service/playback/WearMediaSession.java +++ b/core/src/play/java/de/danoeh/antennapod/core/service/playback/WearMediaSession.java @@ -6,8 +6,6 @@ import android.support.v4.media.session.PlaybackStateCompat; import android.support.wearable.media.MediaControlConstants; public class WearMediaSession { - public static final String TAG = "WearMediaSession"; - static void sessionStateAddActionForWear(PlaybackStateCompat.Builder sessionState, String actionName, CharSequence name, int icon) { PlaybackStateCompat.CustomAction.Builder actionBuilder = diff --git a/event/src/main/java/de/danoeh/antennapod/event/FavoritesEvent.java b/event/src/main/java/de/danoeh/antennapod/event/FavoritesEvent.java index 8b27f74ab..0a3c65adc 100644 --- a/event/src/main/java/de/danoeh/antennapod/event/FavoritesEvent.java +++ b/event/src/main/java/de/danoeh/antennapod/event/FavoritesEvent.java @@ -1,26 +1,7 @@ package de.danoeh.antennapod.event; -import de.danoeh.antennapod.model.feed.FeedItem; - public class FavoritesEvent { - public enum Action { - ADDED, REMOVED - } - - private final Action action; - private final FeedItem item; - - private FavoritesEvent(Action action, FeedItem item) { - this.action = action; - this.item = item; - } - - public static FavoritesEvent added(FeedItem item) { - return new FavoritesEvent(Action.ADDED, item); - } - - public static FavoritesEvent removed(FeedItem item) { - return new FavoritesEvent(Action.REMOVED, item); + public FavoritesEvent() { } } diff --git a/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java b/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java index 6c7adc2d7..125d113d6 100644 --- a/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java +++ b/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java @@ -9,33 +9,17 @@ import java.util.List; import de.danoeh.antennapod.model.feed.FeedItem; public class FeedItemEvent { - - public enum Action { - UPDATE, DELETE_MEDIA - } - - @NonNull - private final Action action; @NonNull public final List<FeedItem> items; - private FeedItemEvent(@NonNull Action action, @NonNull List<FeedItem> items) { - this.action = action; + public FeedItemEvent(@NonNull List<FeedItem> items) { this.items = items; } - public static FeedItemEvent deletedMedia(List<FeedItem> items) { - return new FeedItemEvent(Action.DELETE_MEDIA, items); - } - - public static FeedItemEvent deletedMedia(FeedItem... items) { - return deletedMedia(Arrays.asList(items)); - } - public static FeedItemEvent updated(List<FeedItem> items) { - return new FeedItemEvent(Action.UPDATE, items); + return new FeedItemEvent(items); } public static FeedItemEvent updated(FeedItem... items) { - return updated(Arrays.asList(items)); + return new FeedItemEvent(Arrays.asList(items)); } } diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedMedia.java b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedMedia.java index d2e4e4556..2fb1a5c0c 100644 --- a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedMedia.java +++ b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedMedia.java @@ -226,10 +226,6 @@ public class FeedMedia extends FeedFile implements Playable { return mime_type; } - public void setMime_type(String mime_type) { - this.mime_type = mime_type; - } - @Nullable public FeedItem getItem() { return item; diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java index 21a362a40..7c0d7cb51 100644 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java +++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java @@ -19,7 +19,6 @@ import java.net.URISyntaxException; import java.net.URL; import java.nio.charset.Charset; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Locale; @@ -213,45 +212,6 @@ public class GpodnetService implements ISyncService { } /** - * Returns synchronization status of devices. - * <p/> - * This method requires authentication. - * - * @throws GpodnetServiceAuthenticationException If there is an authentication error. - */ - public List<List<String>> getSynchronizedDevices() throws GpodnetServiceException { - requireLoggedIn(); - try { - URL url = new URI(baseScheme, null, baseHost, basePort, - String.format("/api/2/sync-devices/%s.json", username), null, null).toURL(); - Request.Builder request = new Request.Builder().url(url); - String response = executeRequest(request); - JSONObject syncStatus = new JSONObject(response); - List<List<String>> result = new ArrayList<>(); - - JSONArray synchronizedDevices = syncStatus.getJSONArray("synchronized"); - for (int i = 0; i < synchronizedDevices.length(); i++) { - JSONArray groupDevices = synchronizedDevices.getJSONArray(i); - List<String> group = new ArrayList<>(); - for (int j = 0; j < groupDevices.length(); j++) { - group.add(groupDevices.getString(j)); - } - result.add(group); - } - - JSONArray notSynchronizedDevices = syncStatus.getJSONArray("not-synchronized"); - for (int i = 0; i < notSynchronizedDevices.length(); i++) { - result.add(Collections.singletonList(notSynchronizedDevices.getString(i))); - } - - return result; - } catch (JSONException | MalformedURLException | URISyntaxException e) { - e.printStackTrace(); - throw new GpodnetServiceException(e); - } - } - - /** * Configures the device of a given user. * <p/> * This method requires authentication. @@ -288,39 +248,6 @@ public class GpodnetService implements ISyncService { } /** - * Links devices for synchronization. - * <p/> - * This method requires authentication. - * - * @throws GpodnetServiceAuthenticationException If there is an authentication error. - */ - public void linkDevices(@NonNull List<String> deviceIds) throws GpodnetServiceException { - requireLoggedIn(); - try { - final URL url = new URI(baseScheme, null, baseHost, basePort, - String.format("/api/2/sync-devices/%s.json", username), null, null).toURL(); - JSONObject jsonContent = new JSONObject(); - JSONArray group = new JSONArray(); - for (String deviceId : deviceIds) { - group.put(deviceId); - } - - JSONArray synchronizedGroups = new JSONArray(); - synchronizedGroups.put(group); - jsonContent.put("synchronize", synchronizedGroups); - jsonContent.put("stop-synchronize", new JSONArray()); - - Log.d("aaaa", jsonContent.toString()); - RequestBody body = RequestBody.create(JSON, jsonContent.toString()); - Request.Builder request = new Request.Builder().post(body).url(url); - executeRequest(request); - } catch (JSONException | MalformedURLException | URISyntaxException e) { - e.printStackTrace(); - throw new GpodnetServiceException(e); - } - } - - /** * Uploads the subscriptions of a specific device. * <p/> * This method requires authentication. diff --git a/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/DublinCore.java b/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/DublinCore.java index 003f72e9b..7e2f68a17 100644 --- a/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/DublinCore.java +++ b/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/DublinCore.java @@ -8,7 +8,6 @@ import org.xml.sax.Attributes; import de.danoeh.antennapod.model.feed.FeedItem; public class DublinCore extends Namespace { - private static final String TAG = "NSDublinCore"; public static final String NSTAG = "dc"; public static final String NSURI = "http://purl.org/dc/elements/1.1/"; diff --git a/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/Namespace.java b/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/Namespace.java index 5273c6731..f65d124eb 100644 --- a/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/Namespace.java +++ b/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/Namespace.java @@ -5,10 +5,7 @@ import de.danoeh.antennapod.parser.feed.element.SyndElement; import org.xml.sax.Attributes; public abstract class Namespace { - public static final String NSTAG = null; - public static final String NSURI = null; - - /** Called by a Feedhandler when in startElement and it detects a namespace element + /** Called by a Feedhandler when in startElement and it detects a namespace element * @return The SyndElement to push onto the stack * */ public abstract SyndElement handleElementStart(String localName, HandlerState state, Attributes attributes); diff --git a/parser/media/src/main/java/de/danoeh/antennapod/parser/media/id3/ID3Chapter.java b/parser/media/src/main/java/de/danoeh/antennapod/parser/media/id3/ID3Chapter.java index fc594ab5a..5396025e9 100644 --- a/parser/media/src/main/java/de/danoeh/antennapod/parser/media/id3/ID3Chapter.java +++ b/parser/media/src/main/java/de/danoeh/antennapod/parser/media/id3/ID3Chapter.java @@ -30,9 +30,4 @@ public class ID3Chapter extends Chapter { public int getChapterType() { return CHAPTERTYPE_ID3CHAPTER; } - - public String getId3ID() { - return id3ID; - } - } diff --git a/parser/media/src/main/java/de/danoeh/antennapod/parser/media/vorbis/VorbisCommentReaderException.java b/parser/media/src/main/java/de/danoeh/antennapod/parser/media/vorbis/VorbisCommentReaderException.java index 8de1b29c0..f1a46bda0 100644 --- a/parser/media/src/main/java/de/danoeh/antennapod/parser/media/vorbis/VorbisCommentReaderException.java +++ b/parser/media/src/main/java/de/danoeh/antennapod/parser/media/vorbis/VorbisCommentReaderException.java @@ -3,14 +3,6 @@ package de.danoeh.antennapod.parser.media.vorbis; public class VorbisCommentReaderException extends Exception { private static final long serialVersionUID = 1L; - public VorbisCommentReaderException() { - super(); - } - - public VorbisCommentReaderException(String message, Throwable cause) { - super(message, cause); - } - public VorbisCommentReaderException(String message) { super(message); } diff --git a/playback/base/src/main/java/de/danoeh/antennapod/playback/base/PlaybackServiceMediaPlayer.java b/playback/base/src/main/java/de/danoeh/antennapod/playback/base/PlaybackServiceMediaPlayer.java index d03695896..a2ccb3f88 100644 --- a/playback/base/src/main/java/de/danoeh/antennapod/playback/base/PlaybackServiceMediaPlayer.java +++ b/playback/base/src/main/java/de/danoeh/antennapod/playback/base/PlaybackServiceMediaPlayer.java @@ -179,12 +179,6 @@ public abstract class PlaybackServiceMediaPlayer { */ public abstract void shutdown(); - /** - * Releases internally used resources. This method should only be called when the object is not used anymore. - * This method is executed on an internal executor service. - */ - public abstract void shutdownQuietly(); - public abstract void setVideoSurface(SurfaceHolder surface); public abstract void resetVideoSurface(); diff --git a/playback/base/src/main/java/de/danoeh/antennapod/playback/base/PlayerStatus.java b/playback/base/src/main/java/de/danoeh/antennapod/playback/base/PlayerStatus.java index d995ae21f..154fc0c83 100644 --- a/playback/base/src/main/java/de/danoeh/antennapod/playback/base/PlayerStatus.java +++ b/playback/base/src/main/java/de/danoeh/antennapod/playback/base/PlayerStatus.java @@ -23,10 +23,6 @@ public enum PlayerStatus { statusValue = val; } - public static PlayerStatus fromOrdinal(int o) { - return fromOrdinalLookup[o]; - } - public boolean isAtLeast(PlayerStatus other) { return other == null || this.statusValue >= other.statusValue; } diff --git a/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastEnabledActivity.java b/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastEnabledActivity.java index 2cebde6a3..83abd98b7 100644 --- a/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastEnabledActivity.java +++ b/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastEnabledActivity.java @@ -13,7 +13,6 @@ import com.google.android.gms.common.GoogleApiAvailability; * network. */ public abstract class CastEnabledActivity extends AppCompatActivity { - private static final String TAG = "CastEnabledActivity"; private boolean canCast = false; @Override diff --git a/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastPsmp.java b/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastPsmp.java index 8e74154e8..d3c4f3468 100644 --- a/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastPsmp.java +++ b/playback/cast/src/play/java/de/danoeh/antennapod/playback/cast/CastPsmp.java @@ -456,11 +456,6 @@ public class CastPsmp extends PlaybackServiceMediaPlayer { } @Override - public void shutdownQuietly() { - shutdown(); - } - - @Override public void setVideoSurface(SurfaceHolder surface) { throw new UnsupportedOperationException("Setting Video Surface unsupported in Remote Media Player"); } |