diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index 1baa90d28..34aaaa39b 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -241,8 +241,9 @@ public class MainActivity extends CastEnabledActivity { outState.putInt(KEY_GENERATED_VIEW_ID, View.generateViewId()); } - private final BottomSheetBehavior.BottomSheetCallback bottomSheetCallback = - new BottomSheetBehavior.BottomSheetCallback() { + private final BottomSheetBehavior.BottomSheetCallback bottomSheetCallback = new AntennaPodBottomSheetCallback(); + + private class AntennaPodBottomSheetCallback extends BottomSheetBehavior.BottomSheetCallback { @Override public void onStateChanged(@NonNull View view, int state) { if (state == BottomSheetBehavior.STATE_COLLAPSED) { @@ -266,7 +267,7 @@ public class MainActivity extends CastEnabledActivity { audioPlayer.fadePlayerToToolbar(slideOffset); } - }; + } public void setupToolbarToggle(@NonNull MaterialToolbar toolbar, boolean displayUpArrow) { if (drawerLayout != null) { // Tablet layout does not have a drawer diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/DownloadsPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/DownloadsPreferencesFragment.java index c17066fef..91ffa1c4f 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/preferences/DownloadsPreferencesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/preferences/DownloadsPreferencesFragment.java @@ -96,13 +96,13 @@ public class DownloadsPreferencesFragment extends PreferenceFragmentCompat private void showAutoDeleteEnableDialog() { new MaterialAlertDialogBuilder(requireContext()) - .setMessage(R.string.pref_auto_local_delete_dialog_body) - .setPositiveButton(R.string.yes, (dialog, which) -> { - blockAutoDeleteLocal = false; - ((TwoStatePreference) findPreference(PREF_AUTO_DELETE_LOCAL)).setChecked(true); - blockAutoDeleteLocal = true; - }) - .setNegativeButton(R.string.cancel_label, null) - .show(); + .setMessage(R.string.pref_auto_local_delete_dialog_body) + .setPositiveButton(R.string.yes, (dialog, which) -> { + blockAutoDeleteLocal = false; + ((TwoStatePreference) findPreference(PREF_AUTO_DELETE_LOCAL)).setChecked(true); + blockAutoDeleteLocal = true; + }) + .setNegativeButton(R.string.cancel_label, null) + .show(); } } diff --git a/app/src/main/java/de/danoeh/antennapod/view/LocalDeleteModal.java b/app/src/main/java/de/danoeh/antennapod/view/LocalDeleteModal.java index 4241cadca..a3f541e06 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/LocalDeleteModal.java +++ b/app/src/main/java/de/danoeh/antennapod/view/LocalDeleteModal.java @@ -23,10 +23,10 @@ public class LocalDeleteModal { } new MaterialAlertDialogBuilder(context) - .setTitle(R.string.delete_episode_label) - .setMessage(R.string.delete_local_feed_warning_body) - .setPositiveButton(R.string.delete_label, (dialog, which) -> deleteCommand.run()) - .setNegativeButton(R.string.cancel_label, null) - .show(); + .setTitle(R.string.delete_episode_label) + .setMessage(R.string.delete_local_feed_warning_body) + .setPositiveButton(R.string.delete_label, (dialog, which) -> deleteCommand.run()) + .setNegativeButton(R.string.cancel_label, null) + .show(); } } diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 95203de5a..ffd6f6497 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -125,6 +125,14 @@ value="GenericWhitespace ''{0}'' is not preceded with whitespace."/> + + + + + + + + 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 2ad8f2b8a..4c486c4d1 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 @@ -221,8 +221,7 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { if (playerStatus == PlayerStatus.PREPARED && media.getPosition() > 0) { int newPosition = RewindAfterPauseUtils.calculatePositionWithRewind( - media.getPosition(), - media.getLastPlayedTime()); + media.getPosition(), media.getLastPlayedTime()); seekTo(newPosition); } mediaPlayer.start(); 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 401d09ad7..067f8abff 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 @@ -1195,7 +1195,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { this.autoSkippedFeedMediaId = feedMedia.getItem().getIdentifyingValue(); mediaPlayer.skip(); } - } + } /** * Updates the Media Session for the corresponding status. @@ -1624,11 +1624,10 @@ public class PlaybackService extends MediaBrowserServiceCompat { if (getPlayable() instanceof FeedMedia) { if (((FeedMedia) getPlayable()).getItem().getFeed().getId() == event.getFeedId()) { if (event.getSkipEnding() != 0) { - FeedPreferences feedPreferences - = ((FeedMedia) getPlayable()).getItem().getFeed().getPreferences(); - feedPreferences.setFeedSkipIntro(event.getSkipIntro()); - feedPreferences.setFeedSkipEnding(event.getSkipEnding()); - + FeedPreferences feedPreferences + = ((FeedMedia) getPlayable()).getItem().getFeed().getPreferences(); + feedPreferences.setFeedSkipIntro(event.getSkipIntro()); + feedPreferences.setFeedSkipEnding(event.getSkipEnding()); } } } diff --git a/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/Atom.java b/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/Atom.java index a79556c2c..863f65d48 100644 --- a/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/Atom.java +++ b/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/namespace/Atom.java @@ -108,9 +108,9 @@ public class Atom extends Namespace { * feed-object has no link yet b) type of link is * LINK_TYPE_HTML or LINK_TYPE_XHTML */ - if (state.getFeed() != null && - ((type == null && state.getFeed().getLink() == null) || - (LINK_TYPE_HTML.equals(type) || LINK_TYPE_XHTML.equals(type)))) { + if (state.getFeed() != null + && ((type == null && state.getFeed().getLink() == null) + || (LINK_TYPE_HTML.equals(type) || LINK_TYPE_XHTML.equals(type)))) { state.getFeed().setLink(href); } else if (LINK_TYPE_ATOM.equals(type) || LINK_TYPE_RSS.equals(type)) { // treat as podlove alternate feed @@ -188,17 +188,17 @@ public class Atom extends Namespace { } else if (ENTRY.equals(second) && state.getCurrentItem() != null) { state.getCurrentItem().setTitle(textElement.getProcessedContent()); } - } else if (SUBTITLE.equals(top) && FEED.equals(second) && textElement != null && - state.getFeed() != null) { + } else if (SUBTITLE.equals(top) && FEED.equals(second) && textElement != null + && state.getFeed() != null) { state.getFeed().setDescription(textElement.getProcessedContent()); - } else if (CONTENT.equals(top) && ENTRY.equals(second) && textElement != null && - state.getCurrentItem() != null) { + } else if (CONTENT.equals(top) && ENTRY.equals(second) && textElement != null + && state.getCurrentItem() != null) { state.getCurrentItem().setDescriptionIfLonger(textElement.getProcessedContent()); } else if (SUMMARY.equals(top) && ENTRY.equals(second) && textElement != null && state.getCurrentItem() != null) { state.getCurrentItem().setDescriptionIfLonger(textElement.getProcessedContent()); - } else if (UPDATED.equals(top) && ENTRY.equals(second) && state.getCurrentItem() != null && - state.getCurrentItem().getPubDate() == null) { + } else if (UPDATED.equals(top) && ENTRY.equals(second) && state.getCurrentItem() != null + && state.getCurrentItem().getPubDate() == null) { state.getCurrentItem().setPubDate(DateUtils.parseOrNullIfFuture(content)); } else if (PUBLISHED.equals(top) && ENTRY.equals(second) && state.getCurrentItem() != null) { state.getCurrentItem().setPubDate(DateUtils.parseOrNullIfFuture(content)); @@ -206,8 +206,8 @@ public class Atom extends Namespace { state.getFeed().setImageUrl(content); } else if (IMAGE_ICON.equals(top) && state.getFeed() != null) { state.getFeed().setImageUrl(content); - } else if (AUTHOR_NAME.equals(top) && AUTHOR.equals(second) && - state.getFeed() != null && state.getCurrentItem() == null) { + } else if (AUTHOR_NAME.equals(top) && AUTHOR.equals(second) + && state.getFeed() != null && state.getCurrentItem() == null) { String currentName = state.getFeed().getAuthor(); if (currentName == null) { state.getFeed().setAuthor(content); 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 7e2f68a17..ead449845 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 @@ -22,8 +22,8 @@ public class DublinCore extends Namespace { @Override public void handleElementEnd(String localName, HandlerState state) { - if (state.getCurrentItem() != null && state.getContentBuf() != null && - state.getTagstack() != null && state.getTagstack().size() >= 2) { + if (state.getCurrentItem() != null && state.getContentBuf() != null + && state.getTagstack() != null && state.getTagstack().size() >= 2) { FeedItem currentItem = state.getCurrentItem(); String top = state.getTagstack().peek().getName(); String second = state.getSecondTag().getName(); diff --git a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java index 2e38d55f1..a42493692 100644 --- a/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java +++ b/storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences/UserPreferences.java @@ -372,7 +372,9 @@ public class UserPreferences { prefs.edit().putBoolean(UserPreferences.PREF_FOLLOW_QUEUE, value).apply(); } - public static boolean shouldSkipKeepEpisode() { return prefs.getBoolean(PREF_SKIP_KEEPS_EPISODE, true); } + public static boolean shouldSkipKeepEpisode() { + return prefs.getBoolean(PREF_SKIP_KEEPS_EPISODE, true); + } public static boolean shouldFavoriteKeepEpisode() { return prefs.getBoolean(PREF_FAVORITE_KEEPS_EPISODE, true); @@ -589,33 +591,23 @@ public class UserPreferences { } public static void setFastForwardSecs(int secs) { - prefs.edit() - .putInt(PREF_FAST_FORWARD_SECS, secs) - .apply(); + prefs.edit().putInt(PREF_FAST_FORWARD_SECS, secs).apply(); } public static void setRewindSecs(int secs) { - prefs.edit() - .putInt(PREF_REWIND_SECS, secs) - .apply(); + prefs.edit().putInt(PREF_REWIND_SECS, secs).apply(); } public static void setPlaybackSpeed(float speed) { - prefs.edit() - .putString(PREF_PLAYBACK_SPEED, String.valueOf(speed)) - .apply(); + prefs.edit().putString(PREF_PLAYBACK_SPEED, String.valueOf(speed)).apply(); } public static void setVideoPlaybackSpeed(float speed) { - prefs.edit() - .putString(PREF_VIDEO_PLAYBACK_SPEED, String.valueOf(speed)) - .apply(); + prefs.edit().putString(PREF_VIDEO_PLAYBACK_SPEED, String.valueOf(speed)).apply(); } public static void setSkipSilence(boolean skipSilence) { - prefs.edit() - .putBoolean(PREF_PLAYBACK_SKIP_SILENCE, skipSilence) - .apply(); + prefs.edit().putBoolean(PREF_PLAYBACK_SKIP_SILENCE, skipSilence).apply(); } public static void setPlaybackSpeedArray(List speeds) { @@ -626,15 +618,11 @@ public class UserPreferences { for (float speed : speeds) { jsonArray.put(speedFormat.format(speed)); } - prefs.edit() - .putString(PREF_PLAYBACK_SPEED_ARRAY, jsonArray.toString()) - .apply(); + prefs.edit().putString(PREF_PLAYBACK_SPEED_ARRAY, jsonArray.toString()).apply(); } public static void setAutodownloadSelectedNetworks(String[] value) { - prefs.edit() - .putString(PREF_AUTODL_SELECTED_NETWORKS, TextUtils.join(",", value)) - .apply(); + prefs.edit().putString(PREF_AUTODL_SELECTED_NETWORKS, TextUtils.join(",", value)).apply(); } public static boolean gpodnetNotificationsEnabled() { @@ -652,29 +640,21 @@ public class UserPreferences { } public static void setGpodnetNotificationsEnabled() { - prefs.edit() - .putBoolean(PREF_GPODNET_NOTIFICATIONS, true) - .apply(); + prefs.edit().putBoolean(PREF_GPODNET_NOTIFICATIONS, true).apply(); } public static void setHiddenDrawerItems(List items) { String str = TextUtils.join(",", items); - prefs.edit() - .putString(PREF_HIDDEN_DRAWER_ITEMS, str) - .apply(); + prefs.edit().putString(PREF_HIDDEN_DRAWER_ITEMS, str).apply(); } public static void setFullNotificationButtons(List items) { String str = TextUtils.join(",", items); - prefs.edit() - .putString(PREF_FULL_NOTIFICATION_BUTTONS, str) - .apply(); + prefs.edit().putString(PREF_FULL_NOTIFICATION_BUTTONS, str).apply(); } public static void setQueueLocked(boolean locked) { - prefs.edit() - .putBoolean(PREF_QUEUE_LOCKED, locked) - .apply(); + prefs.edit().putBoolean(PREF_QUEUE_LOCKED, locked).apply(); } private static List readPlaybackSpeedArray(String valueFromPrefs) { @@ -700,9 +680,7 @@ public class UserPreferences { } public static void setEpisodeCleanupValue(int episodeCleanupValue) { - prefs.edit() - .putString(PREF_EPISODE_CLEANUP, Integer.toString(episodeCleanupValue)) - .apply(); + prefs.edit().putString(PREF_EPISODE_CLEANUP, Integer.toString(episodeCleanupValue)).apply(); } /** @@ -748,9 +726,7 @@ public class UserPreferences { public static void setDataFolder(String dir) { Log.d(TAG, "setDataFolder(dir: " + dir + ")"); - prefs.edit() - .putString(PREF_DATA_FOLDER, dir) - .apply(); + prefs.edit().putString(PREF_DATA_FOLDER, dir).apply(); } /** @@ -808,9 +784,7 @@ public class UserPreferences { * @see #setQueueKeepSortedOrder(SortOrder) */ public static void setQueueKeepSorted(boolean keepSorted) { - prefs.edit() - .putBoolean(PREF_QUEUE_KEEP_SORTED, keepSorted) - .apply(); + prefs.edit().putBoolean(PREF_QUEUE_KEEP_SORTED, keepSorted).apply(); } /** @@ -833,9 +807,7 @@ public class UserPreferences { if (sortOrder == null) { return; } - prefs.edit() - .putString(PREF_QUEUE_KEEP_SORTED_ORDER, sortOrder.name()) - .apply(); + prefs.edit().putString(PREF_QUEUE_KEEP_SORTED_ORDER, sortOrder.name()).apply(); } public static FeedPreferences.NewEpisodesAction getNewEpisodesAction() { @@ -874,9 +846,7 @@ public class UserPreferences { } public static void setSubscriptionsFilter(SubscriptionsFilter value) { - prefs.edit() - .putString(PREF_FILTER_FEED, value.serialize()) - .apply(); + prefs.edit().putString(PREF_FILTER_FEED, value.serialize()).apply(); } public static boolean shouldShowSubscriptionTitle() {