From 90d6095dad5c53435f8dc4ee7e9641bece42d39b Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Sun, 14 May 2023 17:01:26 -0400 Subject: [PATCH 1/2] Centralize stream library version --- app/build.gradle | 2 +- build.gradle | 1 + core/build.gradle | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d8dac6b63..2fab1731b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -124,7 +124,7 @@ dependencies { implementation 'com.github.ByteHamster:SearchPreference:v2.0.0' implementation 'com.github.skydoves:balloon:1.4.0' implementation 'com.github.xabaras:RecyclerViewSwipeDecorator:1.3' - implementation 'com.annimon:stream:1.2.2' + implementation "com.annimon:stream:$annimonStreamVersion" // Non-free dependencies: playImplementation 'com.google.android.play:core:1.8.0' diff --git a/build.gradle b/build.gradle index 1a16e1dac..925a50fb7 100644 --- a/build.gradle +++ b/build.gradle @@ -44,6 +44,7 @@ project.ext { rxAndroidVersion = "2.1.1" rxJavaVersion = "2.2.2" iconifyVersion = "2.2.2" + annimonStreamVersion = "1.2.2" exoPlayerVersion = "2.14.2" // Google Play build diff --git a/core/build.gradle b/core/build.gradle index 526589230..a44f67c61 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -62,7 +62,7 @@ dependencies { annotationProcessor "org.greenrobot:eventbus-annotation-processor:$eventbusVersion" implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion" implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion" - implementation 'com.annimon:stream:1.2.2' + implementation "com.annimon:stream:$annimonStreamVersion" implementation "com.google.android.exoplayer:exoplayer-core:$exoPlayerVersion" implementation "com.google.android.exoplayer:exoplayer-ui:$exoPlayerVersion" From cf4345564c13b72b805d7aac58e88559e77643b9 Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Sun, 14 May 2023 17:02:34 -0400 Subject: [PATCH 2/2] Remove no longer needed Compat stuff --- app/build.gradle | 1 - .../material/bottomsheet/ViewPagerBottomSheetBehavior.java | 3 +-- app/src/main/java/de/danoeh/antennapod/PodcastApp.java | 4 ++-- .../de/danoeh/antennapod/activity/VideoplayerActivity.java | 6 ++---- .../de/danoeh/antennapod/dialog/SwipeActionsDialog.java | 6 +++--- .../main/java/de/danoeh/antennapod/ui/home/HomeSection.java | 4 +--- .../de/danoeh/antennapod/view/LiftOnScrollListener.java | 3 +-- .../java/de/danoeh/antennapod/view/ShownotesWebView.java | 3 +-- common.gradle | 1 - .../playback/PlaybackServiceNotificationBuilder.java | 4 ++-- core/src/main/res/layout/player_widget.xml | 3 +-- 11 files changed, 14 insertions(+), 24 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2fab1731b..816a1073f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -98,7 +98,6 @@ dependencies { implementation "androidx.fragment:fragment:$fragmentVersion" implementation 'androidx.gridlayout:gridlayout:1.0.0' implementation "androidx.media:media:$mediaVersion" - implementation 'androidx.multidex:multidex:2.0.1' implementation "androidx.palette:palette:$paletteVersion" implementation "androidx.preference:preference:$preferenceVersion" implementation "androidx.recyclerview:recyclerview:$recyclerViewVersion" diff --git a/app/src/main/java/com/google/android/material/bottomsheet/ViewPagerBottomSheetBehavior.java b/app/src/main/java/com/google/android/material/bottomsheet/ViewPagerBottomSheetBehavior.java index d9b912634..b50232fcc 100644 --- a/app/src/main/java/com/google/android/material/bottomsheet/ViewPagerBottomSheetBehavior.java +++ b/app/src/main/java/com/google/android/material/bottomsheet/ViewPagerBottomSheetBehavior.java @@ -5,7 +5,6 @@ import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; -import androidx.core.view.ViewCompat; import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager2.widget.ViewPager2; @@ -29,7 +28,7 @@ public class ViewPagerBottomSheetBehavior extends BottomSheetBeh @Override View findScrollingChild(View view) { - if (ViewCompat.isNestedScrollingEnabled(view)) { + if (view.isNestedScrollingEnabled()) { return view; } diff --git a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java index 942e2cf24..bd93e3ea9 100644 --- a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java +++ b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java @@ -1,10 +1,10 @@ package de.danoeh.antennapod; +import android.app.Application; import android.content.ComponentName; import android.content.Intent; import android.os.StrictMode; -import androidx.multidex.MultiDexApplication; import com.google.android.material.color.DynamicColors; import com.joanzapata.iconify.Iconify; import com.joanzapata.iconify.fonts.FontAwesomeModule; @@ -21,7 +21,7 @@ import de.danoeh.antennapod.spa.SPAUtil; import org.greenrobot.eventbus.EventBus; /** Main application class. */ -public class PodcastApp extends MultiDexApplication { +public class PodcastApp extends Application { private static PodcastApp singleton; diff --git a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index 9070cd6f8..fe5eb369c 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -1,6 +1,5 @@ package de.danoeh.antennapod.activity; -import android.annotation.SuppressLint; import android.content.Intent; import android.graphics.PixelFormat; import android.graphics.drawable.ColorDrawable; @@ -20,6 +19,7 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.View; +import android.view.Window; import android.view.WindowManager; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; @@ -30,7 +30,6 @@ import android.widget.EditText; import android.widget.FrameLayout; import android.widget.SeekBar; import androidx.annotation.Nullable; -import androidx.core.view.WindowCompat; import androidx.interpolator.view.animation.FastOutSlowInInterpolator; import com.bumptech.glide.Glide; import de.danoeh.antennapod.R; @@ -95,13 +94,12 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar. private Disposable disposable; private float prog; - @SuppressLint("AppCompatMethod") @Override protected void onCreate(Bundle savedInstanceState) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); // has to be called before setting layout content - supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY); + supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); setTheme(R.style.Theme_AntennaPod_VideoPlayer); super.onCreate(savedInstanceState); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java index 4e579fce4..257158f15 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SwipeActionsDialog.java @@ -156,12 +156,12 @@ public class SwipeActionsDialog { Drawable icon = DrawableCompat.wrap(AppCompatResources.getDrawable(context, action.getActionIcon())); icon.mutate(); - DrawableCompat.setTintMode(icon, PorterDuff.Mode.SRC_ATOP); + icon.setTintMode(PorterDuff.Mode.SRC_ATOP); if ((direction == LEFT && leftAction == action) || (direction == RIGHT && rightAction == action)) { - DrawableCompat.setTint(icon, ThemeUtils.getColorFromAttr(context, action.getActionColor())); + icon.setTint(ThemeUtils.getColorFromAttr(context, action.getActionColor())); item.swipeActionLabel.setTextColor(ThemeUtils.getColorFromAttr(context, action.getActionColor())); } else { - DrawableCompat.setTint(icon, ThemeUtils.getColorFromAttr(context, R.attr.action_icon_color)); + icon.setTint(ThemeUtils.getColorFromAttr(context, R.attr.action_icon_color)); } item.swipeIcon.setImageDrawable(icon); diff --git a/app/src/main/java/de/danoeh/antennapod/ui/home/HomeSection.java b/app/src/main/java/de/danoeh/antennapod/ui/home/HomeSection.java index 6cde2927b..03036d267 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/home/HomeSection.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/home/HomeSection.java @@ -9,8 +9,6 @@ import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.core.text.TextUtilsCompat; -import androidx.core.view.ViewCompat; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.DefaultItemAnimator; import de.danoeh.antennapod.adapter.EpisodeItemListAdapter; @@ -38,7 +36,7 @@ public abstract class HomeSection extends Fragment implements View.OnCreateConte @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { viewBinding = HomeSectionBinding.inflate(inflater); viewBinding.titleLabel.setText(getSectionTitle()); - if (TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_LTR) { + if (TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_LTR) { viewBinding.moreButton.setText(getMoreLinkTitle() + "\u00A0»"); } else { viewBinding.moreButton.setText("«\u00A0" + getMoreLinkTitle()); diff --git a/app/src/main/java/de/danoeh/antennapod/view/LiftOnScrollListener.java b/app/src/main/java/de/danoeh/antennapod/view/LiftOnScrollListener.java index ed1b3fdd0..1e53ee828 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/LiftOnScrollListener.java +++ b/app/src/main/java/de/danoeh/antennapod/view/LiftOnScrollListener.java @@ -3,7 +3,6 @@ package de.danoeh.antennapod.view; import android.animation.ValueAnimator; import android.view.View; import androidx.annotation.NonNull; -import androidx.core.view.ViewCompat; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -18,7 +17,7 @@ public class LiftOnScrollListener extends RecyclerView.OnScrollListener public LiftOnScrollListener(View appBar) { animator = ValueAnimator.ofFloat(0, appBar.getContext().getResources().getDisplayMetrics().density * 8); - animator.addUpdateListener(animation -> ViewCompat.setElevation(appBar, (float) animation.getAnimatedValue())); + animator.addUpdateListener(animation -> appBar.setElevation((float) animation.getAnimatedValue())); } @Override 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 a289e630a..ea3c73f15 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java +++ b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java @@ -19,7 +19,6 @@ import android.webkit.WebViewClient; import androidx.core.content.ContextCompat; import androidx.core.util.Consumer; -import androidx.core.view.ViewCompat; import com.google.android.material.snackbar.Snackbar; @@ -133,7 +132,7 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene cm.setPrimaryClip(clipData); if (Build.VERSION.SDK_INT < 32) { Snackbar s = Snackbar.make(this, R.string.copied_to_clipboard, Snackbar.LENGTH_LONG); - ViewCompat.setElevation(s.getView(), 100); + s.getView().setElevation(100); s.show(); } } else if (itemId == R.id.go_to_position_item) { diff --git a/common.gradle b/common.gradle index e7f55e082..65eed001c 100644 --- a/common.gradle +++ b/common.gradle @@ -5,7 +5,6 @@ android { minSdk 21 targetSdk 33 - multiDexEnabled true vectorDrawables.useSupportLibrary true vectorDrawables.generatedDensities = [] 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 d8cef7ec2..fe98dbc8f 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 @@ -14,8 +14,8 @@ import android.support.v4.media.session.MediaSessionCompat; import android.util.Log; import android.view.KeyEvent; import androidx.annotation.NonNull; +import androidx.appcompat.content.res.AppCompatResources; import androidx.core.app.NotificationCompat; -import androidx.core.content.ContextCompat; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import de.danoeh.antennapod.core.R; @@ -119,7 +119,7 @@ public class PlaybackServiceNotificationBuilder { } private static Bitmap getBitmap(Context context, int drawableId) { - Drawable drawable = ContextCompat.getDrawable(context, drawableId); + Drawable drawable = AppCompatResources.getDrawable(context, drawableId); if (drawable instanceof BitmapDrawable) { return ((BitmapDrawable) drawable).getBitmap(); } else if (drawable instanceof VectorDrawable) { diff --git a/core/src/main/res/layout/player_widget.xml b/core/src/main/res/layout/player_widget.xml index 227cb1cc5..616e61e91 100644 --- a/core/src/main/res/layout/player_widget.xml +++ b/core/src/main/res/layout/player_widget.xml @@ -4,8 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:padding="@dimen/widget_margin" - tools:ignore="VectorDrawableCompat"> + android:padding="@dimen/widget_margin">