diff options
Diffstat (limited to 'core')
10 files changed, 38 insertions, 103 deletions
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"> |