diff --git a/app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java index 271bdd7f6..4e300ef25 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/SplashActivity.java @@ -3,12 +3,9 @@ package de.danoeh.antennapod.activity; import android.content.Intent; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; -import android.graphics.drawable.Drawable; -import android.os.Build; import android.os.Bundle; import android.widget.Toast; import androidx.annotation.Nullable; -import androidx.core.graphics.drawable.DrawableCompat; import androidx.appcompat.app.AppCompatActivity; import android.widget.ProgressBar; @@ -29,14 +26,8 @@ public class SplashActivity extends AppCompatActivity { setContentView(R.layout.splash); ProgressBar progressBar = findViewById(R.id.progressBar); - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { - Drawable wrapDrawable = DrawableCompat.wrap(progressBar.getIndeterminateDrawable()); - DrawableCompat.setTint(wrapDrawable, 0xffffffff); - progressBar.setIndeterminateDrawable(DrawableCompat.unwrap(wrapDrawable)); - } else { - progressBar.getIndeterminateDrawable().setColorFilter( - new PorterDuffColorFilter(0xffffffff, PorterDuff.Mode.SRC_IN)); - } + progressBar.getIndeterminateDrawable().setColorFilter( + new PorterDuffColorFilter(0xffffffff, PorterDuff.Mode.SRC_IN)); Completable.create(subscriber -> { // Trigger schema updates diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java index 4b6beac13..864e23d7d 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java @@ -6,7 +6,6 @@ import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.net.Uri; -import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; @@ -19,7 +18,6 @@ import androidx.activity.result.contract.ActivityResultContracts; import androidx.activity.result.contract.ActivityResultContracts.GetContent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.annotation.RequiresApi; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.documentfile.provider.DocumentFile; import androidx.fragment.app.Fragment; @@ -105,9 +103,6 @@ public class AddFeedFragment extends Fragment { }); viewBinding.addLocalFolderButton.setOnClickListener(v -> { - if (Build.VERSION.SDK_INT < 21) { - return; - } try { addLocalFolderLauncher.launch(null); } catch (ActivityNotFoundException e) { @@ -116,10 +111,6 @@ public class AddFeedFragment extends Fragment { .showSnackbarAbovePlayer(R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG); } }); - if (Build.VERSION.SDK_INT < 21) { - viewBinding.addLocalFolderButton.setVisibility(View.GONE); - } - viewBinding.searchButton.setOnClickListener(view -> performSearch()); return viewBinding.getRoot(); @@ -205,9 +196,6 @@ public class AddFeedFragment extends Fragment { } private Feed addLocalFolder(Uri uri) { - if (Build.VERSION.SDK_INT < 21) { - return null; - } getActivity().getContentResolver() .takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); DocumentFile documentFile = DocumentFile.fromTreeUri(getContext(), uri); @@ -227,7 +215,6 @@ public class AddFeedFragment extends Fragment { } private static class AddLocalFolder extends ActivityResultContracts.OpenDocumentTree { - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @NonNull @Override public Intent createIntent(@NonNull final Context context, @Nullable final Uri input) { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java index 26533f50f..c27d8c058 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadLogFragment.java @@ -1,6 +1,5 @@ package de.danoeh.antennapod.fragment; -import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; @@ -80,9 +79,7 @@ public class DownloadLogFragment extends BottomSheetDialogFragment adapter = new DownloadLogAdapter(getActivity()); viewBinding.list.setAdapter(adapter); viewBinding.list.setOnItemClickListener(this); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - viewBinding.list.setNestedScrollingEnabled(true); - } + viewBinding.list.setNestedScrollingEnabled(true); EventBus.getDefault().register(this); return viewBinding.getRoot(); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java index 4fe2f0386..32ab5d9e5 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedInfoFragment.java @@ -7,7 +7,6 @@ import android.content.Intent; import android.content.res.Configuration; import android.graphics.LightingColorFilter; import android.net.Uri; -import android.os.Build; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; @@ -22,7 +21,6 @@ import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.annotation.RequiresApi; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import androidx.appcompat.content.res.AppCompatResources; import com.google.android.material.appbar.MaterialToolbar; @@ -290,7 +288,7 @@ public class FeedInfoFragment extends Fragment implements MaterialToolbar.OnMenu } boolean handled = FeedMenuHandler.onOptionsItemClicked(getContext(), item, feed); - if (item.getItemId() == R.id.reconnect_local_folder && Build.VERSION.SDK_INT >= 21) { + if (item.getItemId() == R.id.reconnect_local_folder) { MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(getContext()); alert.setMessage(R.string.reconnect_local_folder_warning); alert.setPositiveButton(android.R.string.ok, (dialog, which) -> { @@ -329,7 +327,7 @@ public class FeedInfoFragment extends Fragment implements MaterialToolbar.OnMenu } private void reconnectLocalFolder(Uri uri) { - if (Build.VERSION.SDK_INT < 21 || feed == null) { + if (feed == null) { return; } @@ -353,7 +351,6 @@ public class FeedInfoFragment extends Fragment implements MaterialToolbar.OnMenu } private static class AddLocalFolder extends ActivityResultContracts.OpenDocumentTree { - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @NonNull @Override public Intent createIntent(@NonNull final Context context, @Nullable final Uri input) { diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java b/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java index 62e162a7c..ef527967a 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java @@ -1,9 +1,7 @@ package de.danoeh.antennapod.preferences; -import android.annotation.TargetApi; import android.content.Context; import android.graphics.Typeface; -import android.os.Build; import androidx.preference.SwitchPreferenceCompat; import androidx.preference.PreferenceViewHolder; import android.util.AttributeSet; @@ -18,7 +16,6 @@ public class MasterSwitchPreference extends SwitchPreferenceCompat { super(context, attrs, defStyleAttr); } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) public MasterSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } diff --git a/app/src/main/java/de/danoeh/antennapod/view/NestedScrollableHost.java b/app/src/main/java/de/danoeh/antennapod/view/NestedScrollableHost.java index ff52df71f..660aa1ea9 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/NestedScrollableHost.java +++ b/app/src/main/java/de/danoeh/antennapod/view/NestedScrollableHost.java @@ -21,7 +21,6 @@ package de.danoeh.antennapod.view; import android.content.Context; import android.content.res.TypedArray; -import android.os.Build; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; @@ -31,7 +30,6 @@ import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.annotation.RequiresApi; import androidx.viewpager2.widget.ViewPager2; import de.danoeh.antennapod.R; @@ -75,7 +73,6 @@ public class NestedScrollableHost extends FrameLayout { setAttributes(context, attrs); } - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public NestedScrollableHost(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); diff --git a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java index 9dc4a76c6..b284aa2d6 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java +++ b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java @@ -6,7 +6,6 @@ import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.net.Uri; -import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.ContextMenu; @@ -63,9 +62,7 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); // Use cached resources, even if they have expired } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); - } + getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); getSettings().setUseWideViewPort(false); getSettings().setLoadWithOverviewMode(true); setOnLongClickListener(this); diff --git a/app/src/main/res/drawable-v21/grey_border.xml b/app/src/main/res/drawable-v21/grey_border.xml deleted file mode 100644 index beccf9e85..000000000 --- a/app/src/main/res/drawable-v21/grey_border.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/grey_border.xml b/app/src/main/res/drawable/grey_border.xml index 4362f05b6..beccf9e85 100644 --- a/app/src/main/res/drawable/grey_border.xml +++ b/app/src/main/res/drawable/grey_border.xml @@ -1,21 +1,29 @@ - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/home_fragment.xml b/app/src/main/res/layout/home_fragment.xml index fca9406a8..3ef602334 100644 --- a/app/src/main/res/layout/home_fragment.xml +++ b/app/src/main/res/layout/home_fragment.xml @@ -34,7 +34,7 @@ android:layout_height="80dp" android:layout_marginBottom="8dp" android:layout_gravity="start" - android:src="@drawable/ic_curved_arrow" /> + app:srcCompat="@drawable/ic_curved_arrow" /> + app:srcCompat="@mipmap/ic_launcher" /> = Build.VERSION_CODES.LOLLIPOP) { - connectionMonitor = new ConnectionStateMonitor(); - connectionMonitor.enable(getApplicationContext()); - } + connectionMonitor = new ConnectionStateMonitor(); + connectionMonitor.enable(getApplicationContext()); } public static boolean isDownloadingFeeds() { @@ -206,9 +203,7 @@ public class DownloadService extends Service { } unregisterReceiver(cancelDownloadReceiver); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - connectionMonitor.disable(getApplicationContext()); - } + connectionMonitor.disable(getApplicationContext()); EventBus.getDefault().postSticky(DownloadEvent.refresh(Collections.emptyList())); cancelNotificationUpdater(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java index ea1e68bbf..fd24a716e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java @@ -4,7 +4,6 @@ import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; -import android.os.Build; import android.util.Log; import androidx.core.app.NotificationCompat; import de.danoeh.antennapod.core.ClientConfig; @@ -37,9 +36,7 @@ public class DownloadServiceNotification { .setShowWhen(false) .setContentIntent(ClientConfig.downloadServiceCallbacks.getNotificationContentIntent(context)) .setSmallIcon(R.drawable.ic_notification_sync); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - notificationCompatBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); - } + notificationCompatBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); Log.d(TAG, "Notification set up"); } @@ -208,9 +205,7 @@ public class DownloadServiceNotification { .setSmallIcon(iconId) .setContentIntent(intent) .setAutoCancel(true); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); - } + builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(id, builder.build()); Log.d(TAG, "Download report notification was posted"); @@ -232,9 +227,7 @@ public class DownloadServiceNotification { .setSmallIcon(R.drawable.ic_notification_key) .setAutoCancel(true) .setContentIntent(ClientConfig.downloadServiceCallbacks.getAuthentificationNotificationContentIntent(context, downloadRequest)); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); - } + builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(downloadRequest.getSource().hashCode(), builder.build()); } 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 4c201ac63..bf8cf7778 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 @@ -1168,20 +1168,6 @@ public class PlaybackService extends MediaBrowserServiceCompat { | PlaybackStateCompat.ACTION_SEEK_TO | PlaybackStateCompat.ACTION_SET_PLAYBACK_SPEED; - if (useSkipToPreviousForRewindInLockscreen()) { - // Workaround to fool Android so that Lockscreen will expose a skip-to-previous button, - // which will be used for rewind. - // The workaround is used for pre Lollipop (Androidv5) devices. - // For Androidv5+, lockscreen widges are really notifications (compact), - // with an independent codepath - // - // @see #sessionCallback in the backing callback, skipToPrevious implementation - // is actually the same as rewind. So no new inconsistency is created. - // @see #setupNotification() for the method to create Androidv5+ lockscreen UI - // with notification (compact) - capabilities = capabilities | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS; - } - UiModeManager uiModeManager = (UiModeManager) getApplicationContext() .getSystemService(Context.UI_MODE_SERVICE); if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) { @@ -1216,14 +1202,6 @@ public class PlaybackService extends MediaBrowserServiceCompat { mediaSession.setPlaybackState(sessionState.build()); } - private static boolean useSkipToPreviousForRewindInLockscreen() { - // showRewindOnCompactNotification() corresponds to the "Set Lockscreen Buttons" - // Settings in UI. - // Hence, from user perspective, he/she is setting the buttons for Lockscreen - return (UserPreferences.showRewindOnCompactNotification() && - (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)); - } - private void updateNotificationAndMediaSession(final Playable p) { setupNotification(p); updateMediaSessionMetadata(p); diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java index 9c70675fd..d8cef7ec2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java @@ -1,6 +1,5 @@ package de.danoeh.antennapod.core.service.playback; -import android.annotation.TargetApi; import android.app.Notification; import android.app.PendingIntent; import android.content.Context; @@ -110,7 +109,6 @@ public class PlaybackServiceNotificationBuilder { return defaultIcon; } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) private static Bitmap getBitmap(VectorDrawable vectorDrawable) { Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); @@ -124,7 +122,7 @@ public class PlaybackServiceNotificationBuilder { Drawable drawable = ContextCompat.getDrawable(context, drawableId); if (drawable instanceof BitmapDrawable) { return ((BitmapDrawable) drawable).getBitmap(); - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && drawable instanceof VectorDrawable) { + } else if (drawable instanceof VectorDrawable) { return getBitmap((VectorDrawable) drawable); } else { return null; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/FastDocumentFile.java b/core/src/main/java/de/danoeh/antennapod/core/util/FastDocumentFile.java index 885d66687..a86bf0bcf 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/FastDocumentFile.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/FastDocumentFile.java @@ -6,7 +6,6 @@ import android.net.Uri; import android.provider.DocumentsContract; import java.util.ArrayList; -import java.util.Collections; import java.util.List; /** @@ -21,10 +20,6 @@ public class FastDocumentFile { private final long lastModified; public static List list(Context context, Uri folderUri) { - if (android.os.Build.VERSION.SDK_INT < 21) { - return Collections.emptyList(); - } - Uri childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(folderUri, DocumentsContract.getDocumentId(folderUri)); Cursor cursor = context.getContentResolver().query(childrenUri, new String[] { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/download/ConnectionStateMonitor.java b/core/src/main/java/de/danoeh/antennapod/core/util/download/ConnectionStateMonitor.java index e88752e4a..a8d9437ee 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/download/ConnectionStateMonitor.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/download/ConnectionStateMonitor.java @@ -4,12 +4,8 @@ import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkCapabilities; import android.net.NetworkRequest; -import android.os.Build; import android.util.Log; -import androidx.annotation.RequiresApi; - -@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public class ConnectionStateMonitor extends ConnectivityManager.NetworkCallback implements ConnectivityManager.OnNetworkActiveListener { diff --git a/core/src/main/res/drawable-v21/drawer_item_background.xml b/core/src/main/res/drawable-v21/drawer_item_background.xml deleted file mode 100644 index 40727bf50..000000000 --- a/core/src/main/res/drawable-v21/drawer_item_background.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/core/src/main/res/drawable/drawer_item_background.xml b/core/src/main/res/drawable/drawer_item_background.xml index 1eb0d4e11..40727bf50 100644 --- a/core/src/main/res/drawable/drawer_item_background.xml +++ b/core/src/main/res/drawable/drawer_item_background.xml @@ -1,16 +1,20 @@ - - + + - + - - - - - + + + + + + + + + + - - + diff --git a/core/src/main/res/values-v21/styles.xml b/core/src/main/res/values-v21/styles.xml deleted file mode 100644 index eb3a3d03e..000000000 --- a/core/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index 463aa70c8..b9bb1689a 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -3,6 +3,10 @@