Remove support for Android 4.4

This commit is contained in:
ByteHamster 2022-12-18 13:48:31 +01:00
parent 1d251492b0
commit d8d6f1c72f
25 changed files with 78 additions and 226 deletions

View File

@ -3,12 +3,9 @@ package de.danoeh.antennapod.activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter; import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.widget.ProgressBar; import android.widget.ProgressBar;
@ -29,14 +26,8 @@ public class SplashActivity extends AppCompatActivity {
setContentView(R.layout.splash); setContentView(R.layout.splash);
ProgressBar progressBar = findViewById(R.id.progressBar); ProgressBar progressBar = findViewById(R.id.progressBar);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { progressBar.getIndeterminateDrawable().setColorFilter(
Drawable wrapDrawable = DrawableCompat.wrap(progressBar.getIndeterminateDrawable()); new PorterDuffColorFilter(0xffffffff, PorterDuff.Mode.SRC_IN));
DrawableCompat.setTint(wrapDrawable, 0xffffffff);
progressBar.setIndeterminateDrawable(DrawableCompat.unwrap(wrapDrawable));
} else {
progressBar.getIndeterminateDrawable().setColorFilter(
new PorterDuffColorFilter(0xffffffff, PorterDuff.Mode.SRC_IN));
}
Completable.create(subscriber -> { Completable.create(subscriber -> {
// Trigger schema updates // Trigger schema updates

View File

@ -6,7 +6,6 @@ import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -19,7 +18,6 @@ import androidx.activity.result.contract.ActivityResultContracts;
import androidx.activity.result.contract.ActivityResultContracts.GetContent; import androidx.activity.result.contract.ActivityResultContracts.GetContent;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.documentfile.provider.DocumentFile; import androidx.documentfile.provider.DocumentFile;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
@ -105,9 +103,6 @@ public class AddFeedFragment extends Fragment {
}); });
viewBinding.addLocalFolderButton.setOnClickListener(v -> { viewBinding.addLocalFolderButton.setOnClickListener(v -> {
if (Build.VERSION.SDK_INT < 21) {
return;
}
try { try {
addLocalFolderLauncher.launch(null); addLocalFolderLauncher.launch(null);
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {
@ -116,10 +111,6 @@ public class AddFeedFragment extends Fragment {
.showSnackbarAbovePlayer(R.string.unable_to_start_system_file_manager, Snackbar.LENGTH_LONG); .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()); viewBinding.searchButton.setOnClickListener(view -> performSearch());
return viewBinding.getRoot(); return viewBinding.getRoot();
@ -205,9 +196,6 @@ public class AddFeedFragment extends Fragment {
} }
private Feed addLocalFolder(Uri uri) { private Feed addLocalFolder(Uri uri) {
if (Build.VERSION.SDK_INT < 21) {
return null;
}
getActivity().getContentResolver() getActivity().getContentResolver()
.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); .takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
DocumentFile documentFile = DocumentFile.fromTreeUri(getContext(), uri); DocumentFile documentFile = DocumentFile.fromTreeUri(getContext(), uri);
@ -227,7 +215,6 @@ public class AddFeedFragment extends Fragment {
} }
private static class AddLocalFolder extends ActivityResultContracts.OpenDocumentTree { private static class AddLocalFolder extends ActivityResultContracts.OpenDocumentTree {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@NonNull @NonNull
@Override @Override
public Intent createIntent(@NonNull final Context context, @Nullable final Uri input) { public Intent createIntent(@NonNull final Context context, @Nullable final Uri input) {

View File

@ -1,6 +1,5 @@
package de.danoeh.antennapod.fragment; package de.danoeh.antennapod.fragment;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -80,9 +79,7 @@ public class DownloadLogFragment extends BottomSheetDialogFragment
adapter = new DownloadLogAdapter(getActivity()); adapter = new DownloadLogAdapter(getActivity());
viewBinding.list.setAdapter(adapter); viewBinding.list.setAdapter(adapter);
viewBinding.list.setOnItemClickListener(this); 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); EventBus.getDefault().register(this);
return viewBinding.getRoot(); return viewBinding.getRoot();
} }

View File

@ -7,7 +7,6 @@ import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.LightingColorFilter; import android.graphics.LightingColorFilter;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -22,7 +21,6 @@ import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts; import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import com.google.android.material.appbar.MaterialToolbar; 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); 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()); MaterialAlertDialogBuilder alert = new MaterialAlertDialogBuilder(getContext());
alert.setMessage(R.string.reconnect_local_folder_warning); alert.setMessage(R.string.reconnect_local_folder_warning);
alert.setPositiveButton(android.R.string.ok, (dialog, which) -> { 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) { private void reconnectLocalFolder(Uri uri) {
if (Build.VERSION.SDK_INT < 21 || feed == null) { if (feed == null) {
return; return;
} }
@ -353,7 +351,6 @@ public class FeedInfoFragment extends Fragment implements MaterialToolbar.OnMenu
} }
private static class AddLocalFolder extends ActivityResultContracts.OpenDocumentTree { private static class AddLocalFolder extends ActivityResultContracts.OpenDocumentTree {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@NonNull @NonNull
@Override @Override
public Intent createIntent(@NonNull final Context context, @Nullable final Uri input) { public Intent createIntent(@NonNull final Context context, @Nullable final Uri input) {

View File

@ -1,9 +1,7 @@
package de.danoeh.antennapod.preferences; package de.danoeh.antennapod.preferences;
import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Build;
import androidx.preference.SwitchPreferenceCompat; import androidx.preference.SwitchPreferenceCompat;
import androidx.preference.PreferenceViewHolder; import androidx.preference.PreferenceViewHolder;
import android.util.AttributeSet; import android.util.AttributeSet;
@ -18,7 +16,6 @@ public class MasterSwitchPreference extends SwitchPreferenceCompat {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public MasterSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { public MasterSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);
} }

View File

@ -21,7 +21,6 @@ package de.danoeh.antennapod.view;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
@ -31,7 +30,6 @@ import android.widget.FrameLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.viewpager2.widget.ViewPager2; import androidx.viewpager2.widget.ViewPager2;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
@ -75,7 +73,6 @@ public class NestedScrollableHost extends FrameLayout {
setAttributes(context, attrs); setAttributes(context, attrs);
} }
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public NestedScrollableHost(@NonNull Context context, @Nullable AttributeSet attrs, public NestedScrollableHost(@NonNull Context context, @Nullable AttributeSet attrs,
int defStyleAttr, int defStyleRes) { int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);

View File

@ -6,7 +6,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
@ -63,9 +62,7 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene
getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
// Use cached resources, even if they have expired // 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().setUseWideViewPort(false);
getSettings().setLoadWithOverviewMode(true); getSettings().setLoadWithOverviewMode(true);
setOnLongClickListener(this); setOnLongClickListener(this);

View File

@ -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>

View File

@ -1,21 +1,29 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector> <ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item> <item android:id="@android:id/mask">
<shape
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
android:shape="rectangle"> <corners
<corners android:radius="8dp"
android:radius="8dp" android:topRightRadius="8dp"
android:topRightRadius="8dp" android:bottomRightRadius="8dp"
android:bottomRightRadius="8dp" android:bottomLeftRadius="8dp" />
android:bottomLeftRadius="8dp" /> <solid android:color="@android:color/white"/>
<stroke </shape>
android:width="1dp" </item>
android:color="@android:color/darker_gray" /> <item>
<solid android:color="@android:color/transparent"/> <shape
</shape> android:shape="rectangle">
<corners
</item> android:radius="8dp"
android:topRightRadius="8dp"
</selector> android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp" />
<stroke
android:width="1dp"
android:color="?android:attr/textColorSecondary" />
<solid android:color="@android:color/transparent"/>
</shape>
</item>
</ripple>

View File

@ -34,7 +34,7 @@
android:layout_height="80dp" android:layout_height="80dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:layout_gravity="start" android:layout_gravity="start"
android:src="@drawable/ic_curved_arrow" /> app:srcCompat="@drawable/ic_curved_arrow" />
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"
@ -42,7 +42,7 @@
android:layout_height="64dp" android:layout_height="64dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:src="@mipmap/ic_launcher" /> app:srcCompat="@mipmap/ic_launcher" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -2,7 +2,7 @@ android {
compileSdk 31 compileSdk 31
defaultConfig { defaultConfig {
minSdk 19 minSdk 21
targetSdk 31 targetSdk 31
multiDexEnabled true multiDexEnabled true

View File

@ -7,7 +7,6 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Build;
import android.os.IBinder; import android.os.IBinder;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -135,10 +134,8 @@ public class DownloadService extends Service {
cancelDownloadReceiverFilter.addAction(ACTION_CANCEL_DOWNLOAD); cancelDownloadReceiverFilter.addAction(ACTION_CANCEL_DOWNLOAD);
registerReceiver(cancelDownloadReceiver, cancelDownloadReceiverFilter); registerReceiver(cancelDownloadReceiver, cancelDownloadReceiverFilter);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { connectionMonitor = new ConnectionStateMonitor();
connectionMonitor = new ConnectionStateMonitor(); connectionMonitor.enable(getApplicationContext());
connectionMonitor.enable(getApplicationContext());
}
} }
public static boolean isDownloadingFeeds() { public static boolean isDownloadingFeeds() {
@ -206,9 +203,7 @@ public class DownloadService extends Service {
} }
unregisterReceiver(cancelDownloadReceiver); unregisterReceiver(cancelDownloadReceiver);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { connectionMonitor.disable(getApplicationContext());
connectionMonitor.disable(getApplicationContext());
}
EventBus.getDefault().postSticky(DownloadEvent.refresh(Collections.emptyList())); EventBus.getDefault().postSticky(DownloadEvent.refresh(Collections.emptyList()));
cancelNotificationUpdater(); cancelNotificationUpdater();

View File

@ -4,7 +4,6 @@ import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.os.Build;
import android.util.Log; import android.util.Log;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.ClientConfig;
@ -37,9 +36,7 @@ public class DownloadServiceNotification {
.setShowWhen(false) .setShowWhen(false)
.setContentIntent(ClientConfig.downloadServiceCallbacks.getNotificationContentIntent(context)) .setContentIntent(ClientConfig.downloadServiceCallbacks.getNotificationContentIntent(context))
.setSmallIcon(R.drawable.ic_notification_sync); .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"); Log.d(TAG, "Notification set up");
} }
@ -208,9 +205,7 @@ public class DownloadServiceNotification {
.setSmallIcon(iconId) .setSmallIcon(iconId)
.setContentIntent(intent) .setContentIntent(intent)
.setAutoCancel(true); .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); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(id, builder.build()); nm.notify(id, builder.build());
Log.d(TAG, "Download report notification was posted"); Log.d(TAG, "Download report notification was posted");
@ -232,9 +227,7 @@ public class DownloadServiceNotification {
.setSmallIcon(R.drawable.ic_notification_key) .setSmallIcon(R.drawable.ic_notification_key)
.setAutoCancel(true) .setAutoCancel(true)
.setContentIntent(ClientConfig.downloadServiceCallbacks.getAuthentificationNotificationContentIntent(context, downloadRequest)); .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); NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(downloadRequest.getSource().hashCode(), builder.build()); nm.notify(downloadRequest.getSource().hashCode(), builder.build());
} }

View File

@ -1168,20 +1168,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
| PlaybackStateCompat.ACTION_SEEK_TO | PlaybackStateCompat.ACTION_SEEK_TO
| PlaybackStateCompat.ACTION_SET_PLAYBACK_SPEED; | 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() UiModeManager uiModeManager = (UiModeManager) getApplicationContext()
.getSystemService(Context.UI_MODE_SERVICE); .getSystemService(Context.UI_MODE_SERVICE);
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) { if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) {
@ -1216,14 +1202,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
mediaSession.setPlaybackState(sessionState.build()); 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) { private void updateNotificationAndMediaSession(final Playable p) {
setupNotification(p); setupNotification(p);
updateMediaSessionMetadata(p); updateMediaSessionMetadata(p);

View File

@ -1,6 +1,5 @@
package de.danoeh.antennapod.core.service.playback; package de.danoeh.antennapod.core.service.playback;
import android.annotation.TargetApi;
import android.app.Notification; import android.app.Notification;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
@ -110,7 +109,6 @@ public class PlaybackServiceNotificationBuilder {
return defaultIcon; return defaultIcon;
} }
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static Bitmap getBitmap(VectorDrawable vectorDrawable) { private static Bitmap getBitmap(VectorDrawable vectorDrawable) {
Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
@ -124,7 +122,7 @@ public class PlaybackServiceNotificationBuilder {
Drawable drawable = ContextCompat.getDrawable(context, drawableId); Drawable drawable = ContextCompat.getDrawable(context, drawableId);
if (drawable instanceof BitmapDrawable) { if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap(); 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); return getBitmap((VectorDrawable) drawable);
} else { } else {
return null; return null;

View File

@ -6,7 +6,6 @@ import android.net.Uri;
import android.provider.DocumentsContract; import android.provider.DocumentsContract;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -21,10 +20,6 @@ public class FastDocumentFile {
private final long lastModified; private final long lastModified;
public static List<FastDocumentFile> list(Context context, Uri folderUri) { 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, Uri childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(folderUri,
DocumentsContract.getDocumentId(folderUri)); DocumentsContract.getDocumentId(folderUri));
Cursor cursor = context.getContentResolver().query(childrenUri, new String[] { Cursor cursor = context.getContentResolver().query(childrenUri, new String[] {

View File

@ -4,12 +4,8 @@ import android.content.Context;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.net.NetworkRequest; import android.net.NetworkRequest;
import android.os.Build;
import android.util.Log; import android.util.Log;
import androidx.annotation.RequiresApi;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public class ConnectionStateMonitor public class ConnectionStateMonitor
extends ConnectivityManager.NetworkCallback extends ConnectivityManager.NetworkCallback
implements ConnectivityManager.OnNetworkActiveListener { implements ConnectivityManager.OnNetworkActiveListener {

View File

@ -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>

View File

@ -1,16 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?attr/colorSurfaceVariant">
<item android:state_pressed="true"> <item android:id="@android:id/mask">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<solid android:color="?attr/colorSurfaceVariant"/> <solid android:color="@color/black"/>
<corners android:radius="32dp"/> <corners android:radius="32dp"/>
</shape> </shape>
</item> </item>
<item android:state_selected="true"> <item>
<shape android:shape="rectangle"> <selector>
<solid android:color="?attr/colorSurfaceVariant" /> <item android:state_selected="true">
<corners android:radius="32dp" /> <shape android:shape="rectangle">
</shape> <solid android:color="?attr/colorSurfaceVariant"/>
<corners android:radius="32dp"/>
</shape>
</item>
<item android:drawable="@android:color/transparent" />
</selector>
</item> </item>
<item android:drawable="@android:color/transparent" /> </ripple>
</selector>

View File

@ -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>

View File

@ -3,6 +3,10 @@
<style name="Theme.AntennaPod.Dynamic.Light" parent="Theme.Base.AntennaPod.Dynamic.Light"> <style name="Theme.AntennaPod.Dynamic.Light" parent="Theme.Base.AntennaPod.Dynamic.Light">
<!-- Room for API dependent attributes --> <!-- 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>
<style name="Theme.Base.AntennaPod.Dynamic.Light" parent="Theme.Material3.DynamicColors.Light"> <style name="Theme.Base.AntennaPod.Dynamic.Light" parent="Theme.Material3.DynamicColors.Light">
@ -22,7 +26,7 @@
<item name="icon_gray">#25365A</item> <item name="icon_gray">#25365A</item>
<item name="android:splitMotionEvents">false</item> <item name="android:splitMotionEvents">false</item>
<item name="android:fitsSystemWindows">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>
<style name="Theme.AntennaPod.Light" parent="Theme.AntennaPod.Dynamic.Light"> <style name="Theme.AntennaPod.Light" parent="Theme.AntennaPod.Dynamic.Light">
@ -59,10 +63,10 @@
<item name="icon_gray">#CDD9E4</item> <item name="icon_gray">#CDD9E4</item>
<item name="android:splitMotionEvents">false</item> <item name="android:splitMotionEvents">false</item>
<item name="android:fitsSystemWindows">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:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowContentTransitions" tools:targetApi="lollipop">true</item> <item name="android:windowContentTransitions">true</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">@color/background_darktheme</item> <item name="android:navigationBarColor">@color/background_darktheme</item>
</style> </style>
<style name="Theme.AntennaPod.Dark" parent="Theme.AntennaPod.Dynamic.Dark"> <style name="Theme.AntennaPod.Dark" parent="Theme.AntennaPod.Dynamic.Dark">
@ -85,7 +89,7 @@
<item name="colorSurface">@color/black</item> <item name="colorSurface">@color/black</item>
<item name="background_color">@color/black</item> <item name="background_color">@color/black</item>
<item name="background_elevated">@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>
<style name="Theme.AntennaPod.TrueBlack" parent="Theme.AntennaPod.Dark"> <style name="Theme.AntennaPod.TrueBlack" parent="Theme.AntennaPod.Dark">
@ -95,7 +99,7 @@
<item name="colorSurface">@color/black</item> <item name="colorSurface">@color/black</item>
<item name="background_color">@color/black</item> <item name="background_color">@color/black</item>
<item name="background_elevated">@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>
<style name="Theme.AntennaPod.Dynamic.Light.NoTitle" parent="Theme.AntennaPod.Dynamic.Light"> <style name="Theme.AntennaPod.Dynamic.Light.NoTitle" parent="Theme.AntennaPod.Dynamic.Light">
@ -135,7 +139,7 @@
</style> </style>
<style name="Theme.AntennaPod.Dynamic.Light.Translucent" parent="Theme.AntennaPod.Dynamic.Light.NoTitle"> <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:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
@ -146,7 +150,7 @@
</style> </style>
<style name="Theme.AntennaPod.Light.Translucent" parent="Theme.AntennaPod.Light.NoTitle"> <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:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
@ -157,7 +161,7 @@
</style> </style>
<style name="Theme.AntennaPod.Dynamic.Dark.Translucent" parent="Theme.AntennaPod.Dynamic.Dark.NoTitle"> <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:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
@ -168,7 +172,7 @@
</style> </style>
<style name="Theme.AntennaPod.Dark.Translucent" parent="Theme.AntennaPod.Dark.NoTitle"> <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:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
@ -179,7 +183,7 @@
</style> </style>
<style name="Theme.AntennaPod.Dynamic.TrueBlack.Translucent" parent="Theme.AntennaPod.Dynamic.TrueBlack.NoTitle"> <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:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
@ -190,7 +194,7 @@
</style> </style>
<style name="Theme.AntennaPod.TrueBlack.Translucent" parent="Theme.AntennaPod.TrueBlack.NoTitle"> <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:windowLightStatusBar" tools:targetApi="M">false</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
@ -209,7 +213,7 @@
<item name="android:windowBackground">@drawable/bg_splash</item> <item name="android:windowBackground">@drawable/bg_splash</item>
<item name="colorPrimary">@color/icon_background_gradient_start</item> <item name="colorPrimary">@color/icon_background_gradient_start</item>
<item name="colorPrimaryDark">@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>
<style name="Theme.AntennaPod.VideoPlayer" parent="@style/Theme.AntennaPod.Dark"> <style name="Theme.AntennaPod.VideoPlayer" parent="@style/Theme.AntennaPod.Dark">

View File

@ -1,31 +1,15 @@
package de.danoeh.antennapod.net.ssl; package de.danoeh.antennapod.net.ssl;
import android.os.Build;
import okhttp3.CipherSuite;
import okhttp3.ConnectionSpec; import okhttp3.ConnectionSpec;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import javax.net.ssl.X509TrustManager; import javax.net.ssl.X509TrustManager;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
public class SslClientSetup { public class SslClientSetup {
public static void installCertificates(OkHttpClient.Builder builder) { public static void installCertificates(OkHttpClient.Builder builder) {
X509TrustManager trustManager = BackportTrustManager.create(); X509TrustManager trustManager = BackportTrustManager.create();
builder.sslSocketFactory(new AntennaPodSslSocketFactory(trustManager), trustManager); builder.sslSocketFactory(new AntennaPodSslSocketFactory(trustManager), trustManager);
builder.connectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS, ConnectionSpec.CLEARTEXT));
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));
} }
} }

View File

@ -18,11 +18,7 @@ public class PlaybackSpeedActivityStarter {
this.context = context; this.context = context;
intent = new Intent(INTENT); intent = new Intent(INTENT);
intent.setPackage(context.getPackageName()); 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);
} else {
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
}
} }
public Intent getIntent() { public Intent getIntent() {

View File

@ -18,9 +18,7 @@ public class VideoPlayerActivityStarter {
this.context = context; this.context = context;
intent = new Intent(INTENT); intent = new Intent(INTENT);
intent.setPackage(context.getPackageName()); 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() { public Intent getIntent() {

View File

@ -20,7 +20,6 @@
package de.danoeh.antennapod.ui.common; package de.danoeh.antennapod.ui.common;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Canvas; import android.graphics.Canvas;
@ -29,7 +28,6 @@ import android.graphics.Paint;
import android.graphics.Path; import android.graphics.Path;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.os.Build;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
@ -60,7 +58,6 @@ public class TriangleLabelView extends View {
init(context, attrs); init(context, attrs);
} }
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public TriangleLabelView(final Context context, final AttributeSet attrs, public TriangleLabelView(final Context context, final AttributeSet attrs,
final int defStyleAttr, final int defStyleRes) { final int defStyleAttr, final int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);