Delete a few unused things

This commit is contained in:
ByteHamster 2022-02-21 22:39:59 +01:00
parent 2f3efa5d33
commit 48852e081a
38 changed files with 57 additions and 342 deletions

View File

@ -127,15 +127,9 @@ public class Rss2Generator implements FeedGenerator {
} }
} }
writeAdditionalAttributes(xml);
xml.endTag(null, "channel"); xml.endTag(null, "channel");
xml.endTag(null, "rss"); xml.endTag(null, "rss");
xml.endDocument(); xml.endDocument();
} }
protected void writeAdditionalAttributes(XmlSerializer xml) throws IOException {
}
} }

View File

@ -47,7 +47,7 @@ public class WidgetConfigActivity extends AppCompatActivity {
opacityTextView = findViewById(R.id.widget_opacity_textView); opacityTextView = findViewById(R.id.widget_opacity_textView);
opacitySeekBar = findViewById(R.id.widget_opacity_seekBar); opacitySeekBar = findViewById(R.id.widget_opacity_seekBar);
widgetPreview = findViewById(R.id.widgetLayout); widgetPreview = findViewById(R.id.widgetLayout);
findViewById(R.id.butConfirm).setOnClickListener(this::confirmCreateWidget); findViewById(R.id.butConfirm).setOnClickListener(v -> confirmCreateWidget());
opacitySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { opacitySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override @Override
@ -94,7 +94,7 @@ public class WidgetConfigActivity extends AppCompatActivity {
widgetPreview.findViewById(R.id.butRew).setVisibility(ckRewind.isChecked() ? View.VISIBLE : View.GONE); 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()); int backgroundColor = getColorWithAlpha(PlayerWidget.DEFAULT_COLOR, opacitySeekBar.getProgress());
SharedPreferences prefs = getSharedPreferences(PlayerWidget.PREFS_NAME, MODE_PRIVATE); SharedPreferences prefs = getSharedPreferences(PlayerWidget.PREFS_NAME, MODE_PRIVATE);

View File

@ -39,10 +39,6 @@ public class PodcastSearchResult {
this.author = author; this.author = author;
} }
private PodcastSearchResult(String title, @Nullable String imageUrl, @Nullable String feedUrl) {
this(title, imageUrl, feedUrl, "");
}
public static PodcastSearchResult dummy() { public static PodcastSearchResult dummy() {
return new PodcastSearchResult("", "", "", ""); return new PodcastSearchResult("", "", "", "");
} }

View File

@ -283,7 +283,7 @@ public class ItemFragment extends Fragment {
if (item.getPubDate() != null) { if (item.getPubDate() != null) {
String pubDateStr = DateFormatter.formatAbbrev(getActivity(), item.getPubDate()); String pubDateStr = DateFormatter.formatAbbrev(getActivity(), item.getPubDate());
txtvPublished.setText(pubDateStr); txtvPublished.setText(pubDateStr);
txtvPublished.setContentDescription(DateFormatter.formatForAccessibility(getContext(), item.getPubDate())); txtvPublished.setContentDescription(DateFormatter.formatForAccessibility(item.getPubDate()));
} }
RequestOptions options = new RequestOptions() RequestOptions options = new RequestOptions()

View File

@ -335,8 +335,8 @@ public class SearchFragment extends Fragment {
return new Pair<>(Collections.emptyList(), Collections.emptyList()); return new Pair<>(Collections.emptyList(), Collections.emptyList());
} }
long feed = getArguments().getLong(ARG_FEED); long feed = getArguments().getLong(ARG_FEED);
List<FeedItem> items = FeedSearcher.searchFeedItems(getContext(), query, feed); List<FeedItem> items = FeedSearcher.searchFeedItems(query, feed);
List<Feed> feeds = FeedSearcher.searchFeeds(getContext(), query); List<Feed> feeds = FeedSearcher.searchFeeds(query);
return new Pair<>(items, feeds); return new Pair<>(items, feeds);
} }

View File

@ -8,8 +8,6 @@ import androidx.core.util.Consumer;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -66,9 +64,6 @@ public class FeedMultiSelectActionHandler {
preferenceSwitchDialog.openDialog(); preferenceSwitchDialog.openDialog();
} }
private static final DecimalFormat SPEED_FORMAT =
new DecimalFormat("0.00", DecimalFormatSymbols.getInstance(Locale.US));
private void playbackSpeedPrefHandler() { private void playbackSpeedPrefHandler() {
PlaybackSpeedFeedSettingDialogBinding viewBinding = PlaybackSpeedFeedSettingDialogBinding viewBinding =
PlaybackSpeedFeedSettingDialogBinding.inflate(activity.getLayoutInflater()); PlaybackSpeedFeedSettingDialogBinding.inflate(activity.getLayoutInflater());

View File

@ -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. * Use the newInstance method of this class to create a new TagFragment.
*/ */
public class TagFragment extends PodcastListFragment { public class TagFragment extends PodcastListFragment {
private static final String TAG = "TagFragment";
private static final int PODCAST_COUNT = 50; private static final int PODCAST_COUNT = 50;
private GpodnetTag tag; private GpodnetTag tag;

View File

@ -10,7 +10,6 @@ import de.danoeh.antennapod.dialog.ChooseDataFolderDialog;
import java.io.File; import java.io.File;
public class StoragePreferencesFragment extends PreferenceFragmentCompat { 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_CHOOSE_DATA_DIR = "prefChooseDataDir";
private static final String PREF_IMPORT_EXPORT = "prefImportExport"; private static final String PREF_IMPORT_EXPORT = "prefImportExport";

View File

@ -11,8 +11,6 @@ import de.danoeh.antennapod.fragment.QueueFragment;
public class SwipePreferencesFragment extends PreferenceFragmentCompat { public class SwipePreferencesFragment extends PreferenceFragmentCompat {
private static final String PREF_SWIPE_FEED = "prefSwipeFeed"; private static final String PREF_SWIPE_FEED = "prefSwipeFeed";
private static final String PREF_SWIPE_QUEUE = "prefSwipeQueue"; 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 @Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {

View File

@ -17,9 +17,6 @@ import de.danoeh.antennapod.activity.PreferenceActivity;
* Displays the 'about->Contributors' pager screen. * Displays the 'about->Contributors' pager screen.
*/ */
public class ContributorsPagerFragment extends Fragment { public class ContributorsPagerFragment extends Fragment {
public static final String TAG = "StatisticsFragment";
private static final int POS_DEVELOPERS = 0; private static final int POS_DEVELOPERS = 0;
private static final int POS_TRANSLATORS = 1; private static final int POS_TRANSLATORS = 1;
private static final int POS_SPECIAL_THANKS = 2; private static final int POS_SPECIAL_THANKS = 2;

View File

@ -250,18 +250,6 @@ public class GpodderAuthenticationFragment extends DialogFragment {
return false; 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) { private void setupFinishView(View view) {
final Button sync = view.findViewById(R.id.butSyncNow); final Button sync = view.findViewById(R.id.butSyncNow);

View File

@ -104,7 +104,7 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder {
title.setText(item.getTitle()); title.setText(item.getTitle());
leftPadding.setContentDescription(item.getTitle()); leftPadding.setContentDescription(item.getTitle());
pubDate.setText(DateFormatter.formatAbbrev(activity, item.getPubDate())); 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); isNew.setVisibility(item.isNew() ? View.VISIBLE : View.GONE);
isFavorite.setVisibility(item.isTagged(FeedItem.TAG_FAVORITE) ? 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); isInQueue.setVisibility(item.isTagged(FeedItem.TAG_QUEUE) ? View.VISIBLE : View.GONE);

View File

@ -13,50 +13,43 @@ import de.danoeh.antennapod.core.R;
*/ */
public abstract class ConfirmationDialog { 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 Context context;
private final int titleId; private final int titleId;
private final String message; private final String message;
private int positiveText; private int positiveText;
private int negativeText;
public ConfirmationDialog(Context context, int titleId, int messageId) { public ConfirmationDialog(Context context, int titleId, int messageId) {
this(context, titleId, context.getString(messageId)); this(context, titleId, context.getString(messageId));
} }
public ConfirmationDialog(Context context, int titleId, String message) { public ConfirmationDialog(Context context, int titleId, String message) {
this.context = context; this.context = context;
this.titleId = titleId; this.titleId = titleId;
this.message = message; this.message = message;
} }
private void onCancelButtonPressed(DialogInterface dialog) { private void onCancelButtonPressed(DialogInterface dialog) {
Log.d(TAG, "Dialog was cancelled"); Log.d(TAG, "Dialog was cancelled");
dialog.dismiss(); dialog.dismiss();
} }
public void setPositiveText(int id) { public void setPositiveText(int id) {
this.positiveText = id; this.positiveText = id;
} }
public void setNegativeText(int id) { public abstract void onConfirmButtonPressed(DialogInterface dialog);
this.negativeText = id;
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();
}
} }

View File

@ -16,9 +16,6 @@ import java.io.InputStream;
// see https://github.com/bumptech/glide/issues/699 // see https://github.com/bumptech/glide/issues/699
class AudioCoverFetcher implements DataFetcher<InputStream> { class AudioCoverFetcher implements DataFetcher<InputStream> {
private static final String TAG = "AudioCoverFetcher";
private final String path; private final String path;
private final Context context; private final Context context;

View File

@ -125,12 +125,9 @@ public class UserPreferences {
private static final String PREF_FAST_FORWARD_SECS = "prefFastForwardSecs"; private static final String PREF_FAST_FORWARD_SECS = "prefFastForwardSecs";
private static final String PREF_REWIND_SECS = "prefRewindSecs"; private static final String PREF_REWIND_SECS = "prefRewindSecs";
private static final String PREF_QUEUE_LOCKED = "prefQueueLocked"; 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 // Experimental
private static final String PREF_STEREO_TO_MONO = "PrefStereoToMono"; 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_QUEUE = -1;
public static final int EPISODE_CLEANUP_NULL = -2; public static final int EPISODE_CLEANUP_NULL = -2;
public static final int EPISODE_CLEANUP_EXCEPT_FAVORITE = -3; public static final int EPISODE_CLEANUP_EXCEPT_FAVORITE = -3;
@ -827,10 +824,6 @@ public class UserPreferences {
return getMediaPlayer().equals(PREF_MEDIA_PLAYER_EXOPLAYER); return getMediaPlayer().equals(PREF_MEDIA_PLAYER_EXOPLAYER);
} }
public static void enableSonic() {
prefs.edit().putString(PREF_MEDIA_PLAYER, "sonic").apply();
}
public static void enableExoplayer() { public static void enableExoplayer() {
prefs.edit().putString(PREF_MEDIA_PLAYER, PREF_MEDIA_PLAYER_EXOPLAYER).apply(); prefs.edit().putString(PREF_MEDIA_PLAYER, PREF_MEDIA_PLAYER_EXOPLAYER).apply();
} }
@ -956,13 +949,6 @@ public class UserPreferences {
return getUpdateTimeOfDay().length == 2; 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 { public enum BackButtonBehavior {
DEFAULT, OPEN_DRAWER, DOUBLE_TAP, SHOW_PROMPT, GO_TO_PAGE DEFAULT, OPEN_DRAWER, DOUBLE_TAP, SHOW_PROMPT, GO_TO_PAGE
} }
@ -1059,9 +1045,4 @@ public class UserPreferences {
public static boolean shouldShowSubscriptionTitle() { public static boolean shouldShowSubscriptionTitle() {
return prefs.getBoolean(PREF_SUBSCRIPTION_TITLE, false); return prefs.getBoolean(PREF_SUBSCRIPTION_TITLE, false);
} }
public static void setSubscriptionTitleSetting(boolean showTitle) {
prefs.edit().putBoolean(PREF_SUBSCRIPTION_TITLE, showTitle).apply();
}
} }

View File

@ -9,7 +9,6 @@ import de.danoeh.antennapod.core.storage.DBTasks;
import de.danoeh.antennapod.parser.feed.FeedHandlerResult; import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
public class FeedSyncTask { public class FeedSyncTask {
private static final String TAG = "FeedParserTask";
private final DownloadRequest request; private final DownloadRequest request;
private final Context context; private final Context context;
private DownloadStatus downloadStatus; private DownloadStatus downloadStatus;

View File

@ -713,7 +713,6 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
return stream; return stream;
} }
/** /**
* Releases internally used resources. This method should only be called when the object is not used anymore. * 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(); 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 @Override
public void setVideoSurface(final SurfaceHolder surface) { public void setVideoSurface(final SurfaceHolder surface) {
executor.submit(() -> { executor.submit(() -> {

View File

@ -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.PlayableUtils;
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;
import de.danoeh.antennapod.core.widget.WidgetUpdater; 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.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.feed.FeedMedia;
@ -1663,23 +1662,14 @@ public class PlaybackService extends MediaBrowserServiceCompat {
mediaPlayer.setStartWhenPrepared(s); mediaPlayer.setStartWhenPrepared(s);
} }
public void seekTo(final int t) { public void seekTo(final int t) {
mediaPlayer.seekTo(t); mediaPlayer.seekTo(t);
} }
private void seekDelta(final int d) { private void seekDelta(final int d) {
mediaPlayer.seekDelta(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 * call getDuration() on mediaplayer or return INVALID_TIME if player is in
* an invalid state. * an invalid state.
@ -1792,7 +1782,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
public void onPlayFromSearch(String query, Bundle extras) { public void onPlayFromSearch(String query, Bundle extras) {
Log.d(TAG, "onPlayFromSearch query=" + query + " extras=" + extras.toString()); 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) { if (results.size() > 0 && results.get(0).getMedia() != null) {
FeedMedia media = results.get(0).getMedia(); FeedMedia media = results.get(0).getMedia();
startPlaying(media, false); startPlaying(media, false);

View File

@ -36,10 +36,6 @@ class PlaybackServiceStateManager {
isInForeground = false; isInForeground = false;
} }
boolean isInForeground() {
return isInForeground;
}
boolean hasReceivedValidStartCommand() { boolean hasReceivedValidStartCommand() {
return hasReceivedValidStartCommand; return hasReceivedValidStartCommand;
} }

View File

@ -176,7 +176,7 @@ public final class DBTasks {
media.setDownloaded(false); media.setDownloaded(false);
media.setFile_url(null); media.setFile_url(null);
DBWriter.setFeedMedia(media); 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))); 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); UserPreferences.getEpisodeCleanupAlgorithm().performCleanup(context);
} }
/** private static Feed searchFeedByIdentifyingValueOrID(Feed feed) {
* 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) {
if (feed.getId() != 0) { if (feed.getId() != 0) {
return DBReader.getFeed(feed.getId()); return DBReader.getFeed(feed.getId());
} else { } else {
@ -322,7 +293,7 @@ public final class DBTasks {
adapter.open(); adapter.open();
// Look up feed in the feedslist // Look up feed in the feedslist
final Feed savedFeed = searchFeedByIdentifyingValueOrID(adapter, newFeed); final Feed savedFeed = searchFeedByIdentifyingValueOrID(newFeed);
if (savedFeed == null) { if (savedFeed == null) {
Log.d(TAG, "Found no existing Feed with title " Log.d(TAG, "Found no existing Feed with title "
+ newFeed.getTitle() + ". Adding as new one."); + newFeed.getTitle() + ". Adding as new one.");
@ -456,7 +427,7 @@ public final class DBTasks {
if (savedFeed == null) { if (savedFeed == null) {
DBWriter.addNewFeed(context, newFeed).get(); DBWriter.addNewFeed(context, newFeed).get();
// Update with default values that are set in database // Update with default values that are set in database
resultFeed = searchFeedByIdentifyingValueOrID(adapter, newFeed); resultFeed = searchFeedByIdentifyingValueOrID(newFeed);
} else { } else {
DBWriter.setCompleteFeed(savedFeed).get(); DBWriter.setCompleteFeed(savedFeed).get();
} }
@ -487,15 +458,13 @@ public final class DBTasks {
/** /**
* Searches the FeedItems of a specific Feed for a given string. * 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 feedID The id of the feed whose items should be searched.
* @param query The search string. * @param query The search string.
* @return A FutureTask object that executes the search request * @return A FutureTask object that executes the search request
* and returns the search result as a List of FeedItems. * and returns the search result as a List of FeedItems.
*/ */
public static FutureTask<List<FeedItem>> searchFeedItems(final Context context, public static FutureTask<List<FeedItem>> searchFeedItems(final long feedID, final String query) {
final long feedID, final String query) { return new FutureTask<>(new QueryTask<List<FeedItem>>() {
return new FutureTask<>(new QueryTask<List<FeedItem>>(context) {
@Override @Override
public void execute(PodDBAdapter adapter) { public void execute(PodDBAdapter adapter) {
Cursor searchResult = adapter.searchItems(feedID, query); 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) { public static FutureTask<List<Feed>> searchFeeds(final String query) {
return new FutureTask<>(new QueryTask<List<Feed>>(context) { return new FutureTask<>(new QueryTask<List<Feed>>() {
@Override @Override
public void execute(PodDBAdapter adapter) { public void execute(PodDBAdapter adapter) {
Cursor cursor = adapter.searchFeeds(query); Cursor cursor = adapter.searchFeeds(query);
@ -533,7 +502,7 @@ public final class DBTasks {
abstract static class QueryTask<T> implements Callable<T> { abstract static class QueryTask<T> implements Callable<T> {
private T result; private T result;
public QueryTask(Context context) { public QueryTask() {
} }
@Override @Override

View File

@ -13,7 +13,6 @@ import org.greenrobot.eventbus.EventBus;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -142,7 +141,7 @@ public class DBWriter {
.build(); .build();
SynchronizationQueueSink.enqueueEpisodeActionIfSynchronizationIsActive(context, action); SynchronizationQueueSink.enqueueEpisodeActionIfSynchronizationIsActive(context, action);
} }
EventBus.getDefault().post(FeedItemEvent.deletedMedia(Collections.singletonList(media.getItem()))); EventBus.getDefault().post(FeedItemEvent.updated(media.getItem()));
return true; return true;
} }
@ -550,7 +549,7 @@ public class DBWriter {
adapter.addFavoriteItem(item); adapter.addFavoriteItem(item);
adapter.close(); adapter.close();
item.addTag(FeedItem.TAG_FAVORITE); item.addTag(FeedItem.TAG_FAVORITE);
EventBus.getDefault().post(FavoritesEvent.added(item)); EventBus.getDefault().post(new FavoritesEvent());
EventBus.getDefault().post(FeedItemEvent.updated(item)); EventBus.getDefault().post(FeedItemEvent.updated(item));
}); });
} }
@ -561,7 +560,7 @@ public class DBWriter {
adapter.removeFavoriteItem(item); adapter.removeFavoriteItem(item);
adapter.close(); adapter.close();
item.removeTag(FeedItem.TAG_FAVORITE); item.removeTag(FeedItem.TAG_FAVORITE);
EventBus.getDefault().post(FavoritesEvent.removed(item)); EventBus.getDefault().post(new FavoritesEvent());
EventBus.getDefault().post(FeedItemEvent.updated(item)); EventBus.getDefault().post(FeedItemEvent.updated(item));
}); });
} }

View File

@ -1,6 +1,5 @@
package de.danoeh.antennapod.core.storage; package de.danoeh.antennapod.core.storage;
import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
@ -19,9 +18,9 @@ public class FeedSearcher {
} }
@NonNull @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 { try {
FutureTask<List<FeedItem>> itemSearchTask = DBTasks.searchFeedItems(context, selectedFeed, query); FutureTask<List<FeedItem>> itemSearchTask = DBTasks.searchFeedItems(selectedFeed, query);
itemSearchTask.run(); itemSearchTask.run();
return itemSearchTask.get(); return itemSearchTask.get();
} catch (ExecutionException | InterruptedException e) { } catch (ExecutionException | InterruptedException e) {
@ -31,9 +30,9 @@ public class FeedSearcher {
} }
@NonNull @NonNull
public static List<Feed> searchFeeds(final Context context, final String query) { public static List<Feed> searchFeeds(final String query) {
try { try {
FutureTask<List<Feed>> feedSearchTask = DBTasks.searchFeeds(context, query); FutureTask<List<Feed>> feedSearchTask = DBTasks.searchFeeds(query);
feedSearchTask.run(); feedSearchTask.run();
return feedSearchTask.get(); return feedSearchTask.get();
} catch (ExecutionException | InterruptedException e) { } catch (ExecutionException | InterruptedException e) {

View File

@ -37,7 +37,7 @@ public class DateFormatter {
return android.text.format.DateUtils.formatDateTime(context, date.getTime(), format); 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) { if (date == null) {
return ""; return "";
} }

View File

@ -5,7 +5,6 @@ import android.net.ConnectivityManager;
import android.net.Network; import android.net.Network;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.os.Build; import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
@ -146,18 +145,6 @@ public class NetworkUtils {
return selectedNetworks.contains(Integer.toString(wm.getConnectionInfo().getNetworkId())); 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) { public static boolean wasDownloadBlocked(Throwable throwable) {
String message = throwable.getMessage(); String message = throwable.getMessage();
if (message != null) { if (message != null) {

View File

@ -10,8 +10,6 @@ import android.os.BatteryManager;
*/ */
public class PowerUtils { public class PowerUtils {
private static final String TAG = "PowerUtils";
private PowerUtils() { private PowerUtils() {
} }

View File

@ -6,8 +6,6 @@ import android.support.v4.media.session.PlaybackStateCompat;
import android.support.wearable.media.MediaControlConstants; import android.support.wearable.media.MediaControlConstants;
public class WearMediaSession { public class WearMediaSession {
public static final String TAG = "WearMediaSession";
static void sessionStateAddActionForWear(PlaybackStateCompat.Builder sessionState, String actionName, static void sessionStateAddActionForWear(PlaybackStateCompat.Builder sessionState, String actionName,
CharSequence name, int icon) { CharSequence name, int icon) {
PlaybackStateCompat.CustomAction.Builder actionBuilder = PlaybackStateCompat.CustomAction.Builder actionBuilder =

View File

@ -1,26 +1,7 @@
package de.danoeh.antennapod.event; package de.danoeh.antennapod.event;
import de.danoeh.antennapod.model.feed.FeedItem;
public class FavoritesEvent { public class FavoritesEvent {
public enum Action { public FavoritesEvent() {
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);
} }
} }

View File

@ -9,33 +9,17 @@ import java.util.List;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
public class FeedItemEvent { public class FeedItemEvent {
public enum Action {
UPDATE, DELETE_MEDIA
}
@NonNull
private final Action action;
@NonNull public final List<FeedItem> items; @NonNull public final List<FeedItem> items;
private FeedItemEvent(@NonNull Action action, @NonNull List<FeedItem> items) { public FeedItemEvent(@NonNull List<FeedItem> items) {
this.action = action;
this.items = 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) { public static FeedItemEvent updated(List<FeedItem> items) {
return new FeedItemEvent(Action.UPDATE, items); return new FeedItemEvent(items);
} }
public static FeedItemEvent updated(FeedItem... items) { public static FeedItemEvent updated(FeedItem... items) {
return updated(Arrays.asList(items)); return new FeedItemEvent(Arrays.asList(items));
} }
} }

View File

@ -226,10 +226,6 @@ public class FeedMedia extends FeedFile implements Playable {
return mime_type; return mime_type;
} }
public void setMime_type(String mime_type) {
this.mime_type = mime_type;
}
@Nullable @Nullable
public FeedItem getItem() { public FeedItem getItem() {
return item; return item;

View File

@ -19,7 +19,6 @@ import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -212,45 +211,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. * Configures the device of a given user.
* <p/> * <p/>
@ -287,39 +247,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. * Uploads the subscriptions of a specific device.
* <p/> * <p/>

View File

@ -8,7 +8,6 @@ import org.xml.sax.Attributes;
import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedItem;
public class DublinCore extends Namespace { public class DublinCore extends Namespace {
private static final String TAG = "NSDublinCore";
public static final String NSTAG = "dc"; public static final String NSTAG = "dc";
public static final String NSURI = "http://purl.org/dc/elements/1.1/"; public static final String NSURI = "http://purl.org/dc/elements/1.1/";

View File

@ -5,10 +5,7 @@ import de.danoeh.antennapod.parser.feed.element.SyndElement;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
public abstract class Namespace { public abstract class Namespace {
public static final String NSTAG = null; /** Called by a Feedhandler when in startElement and it detects a namespace element
public static final String NSURI = null;
/** Called by a Feedhandler when in startElement and it detects a namespace element
* @return The SyndElement to push onto the stack * @return The SyndElement to push onto the stack
* */ * */
public abstract SyndElement handleElementStart(String localName, HandlerState state, Attributes attributes); public abstract SyndElement handleElementStart(String localName, HandlerState state, Attributes attributes);

View File

@ -30,9 +30,4 @@ public class ID3Chapter extends Chapter {
public int getChapterType() { public int getChapterType() {
return CHAPTERTYPE_ID3CHAPTER; return CHAPTERTYPE_ID3CHAPTER;
} }
public String getId3ID() {
return id3ID;
}
} }

View File

@ -3,14 +3,6 @@ package de.danoeh.antennapod.parser.media.vorbis;
public class VorbisCommentReaderException extends Exception { public class VorbisCommentReaderException extends Exception {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public VorbisCommentReaderException() {
super();
}
public VorbisCommentReaderException(String message, Throwable cause) {
super(message, cause);
}
public VorbisCommentReaderException(String message) { public VorbisCommentReaderException(String message) {
super(message); super(message);
} }

View File

@ -179,12 +179,6 @@ public abstract class PlaybackServiceMediaPlayer {
*/ */
public abstract void shutdown(); 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 setVideoSurface(SurfaceHolder surface);
public abstract void resetVideoSurface(); public abstract void resetVideoSurface();

View File

@ -23,10 +23,6 @@ public enum PlayerStatus {
statusValue = val; statusValue = val;
} }
public static PlayerStatus fromOrdinal(int o) {
return fromOrdinalLookup[o];
}
public boolean isAtLeast(PlayerStatus other) { public boolean isAtLeast(PlayerStatus other) {
return other == null || this.statusValue >= other.statusValue; return other == null || this.statusValue >= other.statusValue;
} }

View File

@ -13,7 +13,6 @@ import com.google.android.gms.common.GoogleApiAvailability;
* network. * network.
*/ */
public abstract class CastEnabledActivity extends AppCompatActivity { public abstract class CastEnabledActivity extends AppCompatActivity {
private static final String TAG = "CastEnabledActivity";
private boolean canCast = false; private boolean canCast = false;
@Override @Override

View File

@ -455,11 +455,6 @@ public class CastPsmp extends PlaybackServiceMediaPlayer {
remoteMediaClient.unregisterCallback(remoteMediaClientCallback); remoteMediaClient.unregisterCallback(remoteMediaClientCallback);
} }
@Override
public void shutdownQuietly() {
shutdown();
}
@Override @Override
public void setVideoSurface(SurfaceHolder surface) { public void setVideoSurface(SurfaceHolder surface) {
throw new UnsupportedOperationException("Setting Video Surface unsupported in Remote Media Player"); throw new UnsupportedOperationException("Setting Video Surface unsupported in Remote Media Player");