diff options
25 files changed, 78 insertions, 226 deletions
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 @@ -<?xml version="1.0" encoding="utf-8"?> -<ripple xmlns:android="http://schemas.android.com/apk/res/android" -android:color="?attr/colorControlHighlight"> - <item android:id="@android:id/mask"> - <shape - android:shape="rectangle"> - <corners - android:radius="8dp" - android:topRightRadius="8dp" - android:bottomRightRadius="8dp" - android:bottomLeftRadius="8dp" /> - <solid android:color="@android:color/white"/> - </shape> - </item> - <item> - <shape - android:shape="rectangle"> - <corners - android:radius="8dp" - android:topRightRadius="8dp" - android:bottomRightRadius="8dp" - android:bottomLeftRadius="8dp" /> - <stroke - android:width="1dp" - android:color="?android:attr/textColorSecondary" /> - <solid android:color="@android:color/transparent"/> - </shape> - </item> -</ripple> 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 @@ <?xml version="1.0" encoding="utf-8"?> -<selector> - - <item> - - <shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <corners - android:radius="8dp" - android:topRightRadius="8dp" - android:bottomRightRadius="8dp" - android:bottomLeftRadius="8dp" /> - <stroke - android:width="1dp" - android:color="@android:color/darker_gray" /> - <solid android:color="@android:color/transparent"/> - </shape> - - </item> - -</selector>
\ No newline at end of file +<ripple xmlns:android="http://schemas.android.com/apk/res/android" +android:color="?attr/colorControlHighlight"> + <item android:id="@android:id/mask"> + <shape + android:shape="rectangle"> + <corners + android:radius="8dp" + android:topRightRadius="8dp" + android:bottomRightRadius="8dp" + android:bottomLeftRadius="8dp" /> + <solid android:color="@android:color/white"/> + </shape> + </item> + <item> + <shape + android:shape="rectangle"> + <corners + android:radius="8dp" + android:topRightRadius="8dp" + android:bottomRightRadius="8dp" + android:bottomLeftRadius="8dp" /> + <stroke + android:width="1dp" + android:color="?android:attr/textColorSecondary" /> + <solid android:color="@android:color/transparent"/> + </shape> + </item> +</ripple> 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" /> <ImageView android:id="@+id/icon" @@ -42,7 +42,7 @@ android:layout_height="64dp" android:layout_gravity="center_horizontal" android:layout_marginBottom="16dp" - android:src="@mipmap/ic_launcher" /> + app:srcCompat="@mipmap/ic_launcher" /> <TextView android:layout_width="match_parent" diff --git a/common.gradle b/common.gradle index bff699af9..258f512f1 100644 --- a/common.gradle +++ b/common.gradle @@ -2,7 +2,7 @@ android { compileSdk 31 defaultConfig { - minSdk 19 + minSdk 21 targetSdk 31 multiDexEnabled true diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index 7f718140a..30745a60d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -7,7 +7,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.os.Build; import android.os.IBinder; import android.text.TextUtils; import android.util.Log; @@ -135,10 +134,8 @@ public class DownloadService extends Service { cancelDownloadReceiverFilter.addAction(ACTION_CANCEL_DOWNLOAD); registerReceiver(cancelDownloadReceiver, cancelDownloadReceiverFilter); - if (Build.VERSION.SDK_INT >= 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<FastDocumentFile> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?attr/colorSurfaceVariant"> - <item android:id="@android:id/mask"> - <shape android:shape="rectangle"> - <solid android:color="@color/black"/> - <corners android:radius="32dp"/> - </shape> - </item> - <item> - <selector> - <item android:state_selected="true"> - <shape android:shape="rectangle"> - <solid android:color="?attr/colorSurfaceVariant"/> - <corners android:radius="32dp"/> - </shape> - </item> - <item android:drawable="@android:color/transparent" /> - </selector> - </item> -</ripple> 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 @@ <?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_pressed="true"> +<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?attr/colorSurfaceVariant"> + <item android:id="@android:id/mask"> <shape android:shape="rectangle"> - <solid android:color="?attr/colorSurfaceVariant"/> + <solid android:color="@color/black"/> <corners android:radius="32dp"/> </shape> </item> - <item android:state_selected="true"> - <shape android:shape="rectangle"> - <solid android:color="?attr/colorSurfaceVariant" /> - <corners android:radius="32dp" /> - </shape> + <item> + <selector> + <item android:state_selected="true"> + <shape android:shape="rectangle"> + <solid android:color="?attr/colorSurfaceVariant"/> + <corners android:radius="32dp"/> + </shape> + </item> + <item android:drawable="@android:color/transparent" /> + </selector> </item> - <item android:drawable="@android:color/transparent" /> -</selector> +</ripple> 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 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="Theme.AntennaPod.Dynamic.Light" parent="Theme.Base.AntennaPod.Dynamic.Light"> - <!-- To make icons visible --> - <item name="android:statusBarColor">@color/grey600</item> - <item name="android:navigationBarColor">@color/grey600</item> - </style> -</resources> 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 @@ <style name="Theme.AntennaPod.Dynamic.Light" parent="Theme.Base.AntennaPod.Dynamic.Light"> <!-- Room for API dependent attributes --> + + <!-- To make icons visible on API 21-23. Overwritten in API-specific folder --> + <item name="android:statusBarColor">@color/grey600</item> + <item name="android:navigationBarColor">@color/grey600</item> </style> <style name="Theme.Base.AntennaPod.Dynamic.Light" parent="Theme.Material3.DynamicColors.Light"> @@ -22,7 +26,7 @@ <item name="icon_gray">#25365A</item> <item name="android:splitMotionEvents">false</item> <item name="android:fitsSystemWindows">false</item> - <item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item> + <item name="android:windowContentTransitions">true</item> </style> <style name="Theme.AntennaPod.Light" parent="Theme.AntennaPod.Dynamic.Light"> @@ -59,10 +63,10 @@ <item name="icon_gray">#CDD9E4</item> <item name="android:splitMotionEvents">false</item> <item name="android:fitsSystemWindows">false</item> - <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowLightStatusBar" tools:targetApi="m">false</item> - <item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item> - <item name="android:navigationBarColor" tools:targetApi="lollipop">@color/background_darktheme</item> + <item name="android:windowContentTransitions">true</item> + <item name="android:navigationBarColor">@color/background_darktheme</item> </style> <style name="Theme.AntennaPod.Dark" parent="Theme.AntennaPod.Dynamic.Dark"> @@ -85,7 +89,7 @@ <item name="colorSurface">@color/black</item> <item name="background_color">@color/black</item> <item name="background_elevated">@color/black</item> - <item name="android:navigationBarColor" tools:targetApi="lollipop">@color/black</item> + <item name="android:navigationBarColor">@color/black</item> </style> <style name="Theme.AntennaPod.TrueBlack" parent="Theme.AntennaPod.Dark"> @@ -95,7 +99,7 @@ <item name="colorSurface">@color/black</item> <item name="background_color">@color/black</item> <item name="background_elevated">@color/black</item> - <item name="android:navigationBarColor" tools:targetApi="lollipop">@color/black</item> + <item name="android:navigationBarColor">@color/black</item> </style> <style name="Theme.AntennaPod.Dynamic.Light.NoTitle" parent="Theme.AntennaPod.Dynamic.Light"> @@ -135,7 +139,7 @@ </style> <style name="Theme.AntennaPod.Dynamic.Light.Translucent" parent="Theme.AntennaPod.Dynamic.Light.NoTitle"> - <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowLightStatusBar" tools:targetApi="M">false</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> @@ -146,7 +150,7 @@ </style> <style name="Theme.AntennaPod.Light.Translucent" parent="Theme.AntennaPod.Light.NoTitle"> - <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowLightStatusBar" tools:targetApi="M">false</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> @@ -157,7 +161,7 @@ </style> <style name="Theme.AntennaPod.Dynamic.Dark.Translucent" parent="Theme.AntennaPod.Dynamic.Dark.NoTitle"> - <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowLightStatusBar" tools:targetApi="M">false</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> @@ -168,7 +172,7 @@ </style> <style name="Theme.AntennaPod.Dark.Translucent" parent="Theme.AntennaPod.Dark.NoTitle"> - <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowLightStatusBar" tools:targetApi="M">false</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> @@ -179,7 +183,7 @@ </style> <style name="Theme.AntennaPod.Dynamic.TrueBlack.Translucent" parent="Theme.AntennaPod.Dynamic.TrueBlack.NoTitle"> - <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowLightStatusBar" tools:targetApi="M">false</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> @@ -190,7 +194,7 @@ </style> <style name="Theme.AntennaPod.TrueBlack.Translucent" parent="Theme.AntennaPod.TrueBlack.NoTitle"> - <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item> + <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowLightStatusBar" tools:targetApi="M">false</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> @@ -209,7 +213,7 @@ <item name="android:windowBackground">@drawable/bg_splash</item> <item name="colorPrimary">@color/icon_background_gradient_start</item> <item name="colorPrimaryDark">@color/icon_background_gradient_start</item> - <item name="android:navigationBarColor" tools:targetApi="lollipop">@color/icon_background_gradient_end</item> + <item name="android:navigationBarColor">@color/icon_background_gradient_end</item> </style> <style name="Theme.AntennaPod.VideoPlayer" parent="@style/Theme.AntennaPod.Dark"> diff --git a/net/ssl/src/main/java/de/danoeh/antennapod/net/ssl/SslClientSetup.java b/net/ssl/src/main/java/de/danoeh/antennapod/net/ssl/SslClientSetup.java index 45bae160d..aa70514f6 100644 --- a/net/ssl/src/main/java/de/danoeh/antennapod/net/ssl/SslClientSetup.java +++ b/net/ssl/src/main/java/de/danoeh/antennapod/net/ssl/SslClientSetup.java @@ -1,31 +1,15 @@ package de.danoeh.antennapod.net.ssl; -import android.os.Build; -import okhttp3.CipherSuite; import okhttp3.ConnectionSpec; import okhttp3.OkHttpClient; import javax.net.ssl.X509TrustManager; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; public class SslClientSetup { public static void installCertificates(OkHttpClient.Builder builder) { X509TrustManager trustManager = BackportTrustManager.create(); builder.sslSocketFactory(new AntennaPodSslSocketFactory(trustManager), trustManager); - - ConnectionSpec tlsSpec = ConnectionSpec.MODERN_TLS; - if (BuildConfig.FLAVOR.equals("play") && Build.VERSION.SDK_INT < 21) { - // workaround for Android 4.x for certain web sites. - // see: https://github.com/square/okhttp/issues/4053#issuecomment-402579554 - List<CipherSuite> cipherSuites = new ArrayList<>(ConnectionSpec.MODERN_TLS.cipherSuites()); - cipherSuites.add(CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA); - cipherSuites.add(CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA); - tlsSpec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) - .cipherSuites(cipherSuites.toArray(new CipherSuite[0])) - .build(); - } - builder.connectionSpecs(Arrays.asList(tlsSpec, ConnectionSpec.CLEARTEXT)); + builder.connectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS, ConnectionSpec.CLEARTEXT)); } } diff --git a/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/PlaybackSpeedActivityStarter.java b/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/PlaybackSpeedActivityStarter.java index ac7e72a4e..b8cf6d6ce 100644 --- a/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/PlaybackSpeedActivityStarter.java +++ b/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/PlaybackSpeedActivityStarter.java @@ -18,11 +18,7 @@ public class PlaybackSpeedActivityStarter { this.context = context; intent = new Intent(INTENT); intent.setPackage(context.getPackageName()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); - } else { - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); - } + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); } public Intent getIntent() { diff --git a/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/VideoPlayerActivityStarter.java b/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/VideoPlayerActivityStarter.java index 53f8719de..7245e2c68 100644 --- a/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/VideoPlayerActivityStarter.java +++ b/ui/app-start-intent/src/main/java/de/danoeh/antennapod/ui/appstartintent/VideoPlayerActivityStarter.java @@ -18,9 +18,7 @@ public class VideoPlayerActivityStarter { this.context = context; intent = new Intent(INTENT); intent.setPackage(context.getPackageName()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); - } + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); } public Intent getIntent() { diff --git a/ui/common/src/main/java/de/danoeh/antennapod/ui/common/TriangleLabelView.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/TriangleLabelView.java index ff6342655..97bcede2f 100644 --- a/ui/common/src/main/java/de/danoeh/antennapod/ui/common/TriangleLabelView.java +++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/TriangleLabelView.java @@ -20,7 +20,6 @@ package de.danoeh.antennapod.ui.common; import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; @@ -29,7 +28,6 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.Rect; import android.graphics.Typeface; -import android.os.Build; import android.util.AttributeSet; import android.view.View; @@ -60,7 +58,6 @@ public class TriangleLabelView extends View { init(context, attrs); } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) public TriangleLabelView(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); |