diff --git a/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt b/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt index daa59850949..a1c89454a30 100644 --- a/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt +++ b/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt @@ -54,7 +54,11 @@ class ErrorUtil { */ @JvmStatic fun showSnackbar(context: Context, errorInfo: ErrorInfo) { - val rootView = if (context is Activity) context.findViewById(R.id.content) else null + val rootView = if (context is Activity) { + context.findViewById(androidx.constraintlayout.widget.R.id.content) + } else { + null + } showSnackbar(context, rootView, errorInfo) } @@ -71,7 +75,8 @@ class ErrorUtil { fun showSnackbar(fragment: Fragment, errorInfo: ErrorInfo) { var rootView = fragment.view if (rootView == null && fragment.activity != null) { - rootView = fragment.requireActivity().findViewById(R.id.content) + rootView = fragment.requireActivity() + .findViewById(androidx.constraintlayout.widget.R.id.content) } showSnackbar(fragment.requireContext(), rootView, errorInfo) } diff --git a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java index d50f0b0d87a..750e256da3f 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java @@ -245,10 +245,12 @@ private void updateTabLayoutPosition() { // change the background and icon color of the tab layout: // service-colored at the top, app-background-colored at the bottom tabLayout.setBackgroundColor(ThemeHelper.resolveColorFromAttr(requireContext(), - bottom ? R.attr.colorSecondary : R.attr.colorPrimary)); + bottom ? com.google.android.material.R.attr.colorSecondary : R.attr.colorPrimary)); @ColorInt final int iconColor = bottom - ? ThemeHelper.resolveColorFromAttr(requireContext(), R.attr.colorAccent) + ? ThemeHelper.resolveColorFromAttr( + requireContext(), + androidx.appcompat.R.attr.colorAccent) : Color.WHITE; tabLayout.setTabRippleColor(ColorStateList.valueOf(iconColor).withAlpha(32)); tabLayout.setTabIconTint(ColorStateList.valueOf(iconColor)); diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt index 0b61f45fb19..4148c3b167f 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt @@ -549,7 +549,7 @@ class FeedFragment : BaseStateFragment() { var typeface = Typeface.DEFAULT var backgroundSupplier = { ctx: Context -> - resolveDrawable(ctx, R.attr.selectableItemBackground) + resolveDrawable(ctx, androidx.appcompat.R.attr.selectableItemBackground) } if (doCheck) { // If the uploadDate is null or true we should highlight the item @@ -562,7 +562,7 @@ class FeedFragment : BaseStateFragment() { LayerDrawable( arrayOf( resolveDrawable(ctx, R.attr.dashed_border), - resolveDrawable(ctx, R.attr.selectableItemBackground) + resolveDrawable(ctx, androidx.appcompat.R.attr.selectableItemBackground) ) ) } diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java b/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java index c012f6008cd..8d0f18f1b7a 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java @@ -570,15 +570,18 @@ private void onPlayModeChanged(final int repeatMode, final boolean shuffled) { switch (repeatMode) { case com.google.android.exoplayer2.Player.REPEAT_MODE_OFF: queueControlBinding.controlRepeat - .setImageResource(R.drawable.exo_controls_repeat_off); + .setImageResource(com.google.android.exoplayer2.ui.R.drawable + .exo_controls_repeat_off); break; case com.google.android.exoplayer2.Player.REPEAT_MODE_ONE: queueControlBinding.controlRepeat - .setImageResource(R.drawable.exo_controls_repeat_one); + .setImageResource(com.google.android.exoplayer2.ui.R.drawable + .exo_controls_repeat_one); break; case com.google.android.exoplayer2.Player.REPEAT_MODE_ALL: queueControlBinding.controlRepeat - .setImageResource(R.drawable.exo_controls_repeat_all); + .setImageResource(com.google.android.exoplayer2.ui.R.drawable + .exo_controls_repeat_all); break; } diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java index 796208a0498..4388af8a036 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java @@ -342,14 +342,16 @@ private void changePitchControlMode(final boolean semitones) { final Map pitchCtrlModeComponentMapping = getPitchControlModeComponentMappings(); pitchCtrlModeComponentMapping.forEach((v, textView) -> textView.setBackground( - resolveDrawable(requireContext(), R.attr.selectableItemBackground))); + resolveDrawable(requireContext(), + androidx.appcompat.R.attr.selectableItemBackground))); // Mark the selected textview final TextView textView = pitchCtrlModeComponentMapping.get(semitones); if (textView != null) { textView.setBackground(new LayerDrawable(new Drawable[]{ resolveDrawable(requireContext(), R.attr.dashed_border), - resolveDrawable(requireContext(), R.attr.selectableItemBackground) + resolveDrawable(requireContext(), + androidx.appcompat.R.attr.selectableItemBackground) })); } @@ -415,14 +417,16 @@ private void setStepSizeToUI(final double newStepSize) { // Bring all textviews into a normal state final Map stepSiteComponentMapping = getStepSizeComponentMappings(); stepSiteComponentMapping.forEach((v, textView) -> textView.setBackground( - resolveDrawable(requireContext(), R.attr.selectableItemBackground))); + resolveDrawable(requireContext(), + androidx.appcompat.R.attr.selectableItemBackground))); // Mark the selected textview final TextView textView = stepSiteComponentMapping.get(newStepSize); if (textView != null) { textView.setBackground(new LayerDrawable(new Drawable[]{ resolveDrawable(requireContext(), R.attr.dashed_border), - resolveDrawable(requireContext(), R.attr.selectableItemBackground) + resolveDrawable(requireContext(), + androidx.appcompat.R.attr.selectableItemBackground) })); } diff --git a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationActionData.java b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationActionData.java index b3abcd0b514..6e439366f77 100644 --- a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationActionData.java +++ b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationActionData.java @@ -69,41 +69,49 @@ public static NotificationActionData fromNotificationActionEnum( switch (selectedAction) { case NotificationConstants.PREVIOUS: return new NotificationActionData(ACTION_PLAY_PREVIOUS, - ctx.getString(R.string.exo_controls_previous_description), baseActionIcon); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_previous_description), baseActionIcon); case NotificationConstants.NEXT: return new NotificationActionData(ACTION_PLAY_NEXT, - ctx.getString(R.string.exo_controls_next_description), baseActionIcon); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_next_description), baseActionIcon); case NotificationConstants.REWIND: return new NotificationActionData(ACTION_FAST_REWIND, - ctx.getString(R.string.exo_controls_rewind_description), baseActionIcon); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_rewind_description), baseActionIcon); case NotificationConstants.FORWARD: return new NotificationActionData(ACTION_FAST_FORWARD, - ctx.getString(R.string.exo_controls_fastforward_description), + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_fastforward_description), baseActionIcon); case NotificationConstants.SMART_REWIND_PREVIOUS: if (player.getPlayQueue() != null && player.getPlayQueue().size() > 1) { return new NotificationActionData(ACTION_PLAY_PREVIOUS, - ctx.getString(R.string.exo_controls_previous_description), - R.drawable.exo_notification_previous); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_previous_description), + com.google.android.exoplayer2.ui.R.drawable.exo_notification_previous); } else { return new NotificationActionData(ACTION_FAST_REWIND, - ctx.getString(R.string.exo_controls_rewind_description), - R.drawable.exo_controls_rewind); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_rewind_description), + com.google.android.exoplayer2.ui.R.drawable.exo_controls_rewind); } case NotificationConstants.SMART_FORWARD_NEXT: if (player.getPlayQueue() != null && player.getPlayQueue().size() > 1) { return new NotificationActionData(ACTION_PLAY_NEXT, - ctx.getString(R.string.exo_controls_next_description), - R.drawable.exo_notification_next); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_next_description), + com.google.android.exoplayer2.ui.R.drawable.exo_notification_next); } else { return new NotificationActionData(ACTION_FAST_FORWARD, - ctx.getString(R.string.exo_controls_fastforward_description), - R.drawable.exo_controls_fastforward); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_fastforward_description), + com.google.android.exoplayer2.ui.R.drawable.exo_controls_fastforward); } case NotificationConstants.PLAY_PAUSE_BUFFERING: @@ -119,45 +127,56 @@ public static NotificationActionData fromNotificationActionEnum( case NotificationConstants.PLAY_PAUSE: if (player.getCurrentState() == Player.STATE_COMPLETED) { return new NotificationActionData(ACTION_PLAY_PAUSE, - ctx.getString(R.string.exo_controls_pause_description), + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_pause_description), R.drawable.ic_replay); } else if (player.isPlaying() || player.getCurrentState() == Player.STATE_PREFLIGHT || player.getCurrentState() == Player.STATE_BLOCKED || player.getCurrentState() == Player.STATE_BUFFERING) { return new NotificationActionData(ACTION_PLAY_PAUSE, - ctx.getString(R.string.exo_controls_pause_description), - R.drawable.exo_notification_pause); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_pause_description), + com.google.android.exoplayer2.ui.R.drawable.exo_notification_pause); } else { return new NotificationActionData(ACTION_PLAY_PAUSE, - ctx.getString(R.string.exo_controls_play_description), - R.drawable.exo_notification_play); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_play_description), + com.google.android.exoplayer2.ui.R.drawable.exo_notification_play); } case NotificationConstants.REPEAT: if (player.getRepeatMode() == REPEAT_MODE_ALL) { return new NotificationActionData(ACTION_REPEAT, - ctx.getString(R.string.exo_controls_repeat_all_description), - R.drawable.exo_media_action_repeat_all); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_repeat_all_description), + com.google.android.exoplayer2.ext.mediasession + .R.drawable.exo_media_action_repeat_all); } else if (player.getRepeatMode() == REPEAT_MODE_ONE) { return new NotificationActionData(ACTION_REPEAT, - ctx.getString(R.string.exo_controls_repeat_one_description), - R.drawable.exo_media_action_repeat_one); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_repeat_one_description), + com.google.android.exoplayer2.ext.mediasession + .R.drawable.exo_media_action_repeat_one); } else /* player.getRepeatMode() == REPEAT_MODE_OFF */ { return new NotificationActionData(ACTION_REPEAT, - ctx.getString(R.string.exo_controls_repeat_off_description), - R.drawable.exo_media_action_repeat_off); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_repeat_off_description), + com.google.android.exoplayer2.ext.mediasession + .R.drawable.exo_media_action_repeat_off); } case NotificationConstants.SHUFFLE: if (player.getPlayQueue() != null && player.getPlayQueue().isShuffled()) { return new NotificationActionData(ACTION_SHUFFLE, - ctx.getString(R.string.exo_controls_shuffle_on_description), - R.drawable.exo_controls_shuffle_on); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_shuffle_on_description), + com.google.android.exoplayer2.ui.R.drawable.exo_controls_shuffle_on); } else { return new NotificationActionData(ACTION_SHUFFLE, - ctx.getString(R.string.exo_controls_shuffle_off_description), - R.drawable.exo_controls_shuffle_off); + ctx.getString(com.google.android.exoplayer2.ui + .R.string.exo_controls_shuffle_off_description), + com.google.android.exoplayer2.ui.R.drawable.exo_controls_shuffle_off); } case NotificationConstants.CLOSE: diff --git a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationConstants.java b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationConstants.java index b9607f7eabb..4f304b4056f 100644 --- a/app/src/main/java/org/schabi/newpipe/player/notification/NotificationConstants.java +++ b/app/src/main/java/org/schabi/newpipe/player/notification/NotificationConstants.java @@ -78,16 +78,16 @@ private NotificationConstants() { @DrawableRes public static final int[] ACTION_ICONS = { 0, - R.drawable.exo_icon_previous, - R.drawable.exo_icon_next, - R.drawable.exo_icon_rewind, - R.drawable.exo_icon_fastforward, - R.drawable.exo_icon_previous, - R.drawable.exo_icon_next, + com.google.android.exoplayer2.ui.R.drawable.exo_icon_previous, + com.google.android.exoplayer2.ui.R.drawable.exo_icon_next, + com.google.android.exoplayer2.ui.R.drawable.exo_icon_rewind, + com.google.android.exoplayer2.ui.R.drawable.exo_icon_fastforward, + com.google.android.exoplayer2.ui.R.drawable.exo_icon_previous, + com.google.android.exoplayer2.ui.R.drawable.exo_icon_next, R.drawable.ic_pause, R.drawable.ic_hourglass_top, - R.drawable.exo_icon_repeat_all, - R.drawable.exo_icon_shuffle_on, + com.google.android.exoplayer2.ui.R.drawable.exo_icon_repeat_all, + com.google.android.exoplayer2.ui.R.drawable.exo_icon_shuffle_on, R.drawable.ic_close, }; @@ -122,29 +122,41 @@ private NotificationConstants() { public static String getActionName(@NonNull final Context context, @Action final int action) { switch (action) { case PREVIOUS: - return context.getString(R.string.exo_controls_previous_description); + return context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_previous_description); case NEXT: - return context.getString(R.string.exo_controls_next_description); + return context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_next_description); case REWIND: - return context.getString(R.string.exo_controls_rewind_description); + return context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_rewind_description); case FORWARD: - return context.getString(R.string.exo_controls_fastforward_description); + return context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_fastforward_description); case SMART_REWIND_PREVIOUS: return Localization.concatenateStrings( - context.getString(R.string.exo_controls_rewind_description), - context.getString(R.string.exo_controls_previous_description)); + context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_rewind_description), + context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_previous_description)); case SMART_FORWARD_NEXT: return Localization.concatenateStrings( - context.getString(R.string.exo_controls_fastforward_description), - context.getString(R.string.exo_controls_next_description)); + context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_fastforward_description), + context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_next_description)); case PLAY_PAUSE: return Localization.concatenateStrings( - context.getString(R.string.exo_controls_play_description), - context.getString(R.string.exo_controls_pause_description)); + context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_play_description), + context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_pause_description)); case PLAY_PAUSE_BUFFERING: return Localization.concatenateStrings( - context.getString(R.string.exo_controls_play_description), - context.getString(R.string.exo_controls_pause_description), + context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_play_description), + context.getString(com.google.android.exoplayer2.ui.R.string + .exo_controls_pause_description), context.getString(R.string.notification_action_buffering)); case REPEAT: return context.getString(R.string.notification_action_repeat); diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java index b51aaa6382f..b0e12042bf6 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java @@ -952,11 +952,14 @@ public void onRepeatModeChanged(@RepeatMode final int repeatMode) { super.onRepeatModeChanged(repeatMode); if (repeatMode == REPEAT_MODE_ALL) { - binding.repeatButton.setImageResource(R.drawable.exo_controls_repeat_all); + binding.repeatButton.setImageResource(com.google.android.exoplayer2.ui.R.drawable + .exo_controls_repeat_all); } else if (repeatMode == REPEAT_MODE_ONE) { - binding.repeatButton.setImageResource(R.drawable.exo_controls_repeat_one); + binding.repeatButton.setImageResource(com.google.android.exoplayer2.ui.R.drawable + .exo_controls_repeat_one); } else /* repeatMode == REPEAT_MODE_OFF */ { - binding.repeatButton.setImageResource(R.drawable.exo_controls_repeat_off); + binding.repeatButton.setImageResource(com.google.android.exoplayer2.ui.R.drawable + .exo_controls_repeat_off); } } diff --git a/gradle.properties b/gradle.properties index 7b138b24e7f..0ca9132222a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ android.defaults.buildfeatures.buildconfig=true android.enableJetifier=false android.nonFinalResIds=false -android.nonTransitiveRClass=false +android.nonTransitiveRClass=true android.useAndroidX=true org.gradle.jvmargs=-Xmx2048M --add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED systemProp.file.encoding=utf-8