From 91a0257c8f1a4b190936bc933ed18f8ee081d876 Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Wed, 22 Jul 2020 17:19:32 +0300 Subject: [PATCH] Fixes for Android API <21 --- .../schabi/newpipe/player/VideoPlayerImpl.java | 18 +++++++++--------- .../fragment_video_detail.xml | 2 +- .../main/res/layout/fragment_video_detail.xml | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java index 435396fd6..70642481e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java +++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java @@ -370,7 +370,7 @@ public class VideoPlayerImpl extends VideoPlayer getTopControlsRoot().setOrientation(LinearLayout.VERTICAL); primaryControls.getLayoutParams().width = LinearLayout.LayoutParams.MATCH_PARENT; secondaryControls.setVisibility(View.INVISIBLE); - moreOptionsButton.setImageDrawable(service.getResources().getDrawable( + moreOptionsButton.setImageDrawable(AppCompatResources.getDrawable(service, R.drawable.ic_expand_more_white_24dp)); shareButton.setVisibility(View.VISIBLE); showHideKodiButton(); @@ -921,9 +921,9 @@ public class VideoPlayerImpl extends VideoPlayer final boolean showButton = videoPlayerSelected() && (orientationLocked || isVerticalVideo || tabletInLandscape); screenRotationButton.setVisibility(showButton ? View.VISIBLE : View.GONE); - screenRotationButton.setImageDrawable(service.getResources().getDrawable(isFullscreen() - ? R.drawable.ic_fullscreen_exit_white_24dp - : R.drawable.ic_fullscreen_white_24dp)); + screenRotationButton.setImageDrawable(AppCompatResources.getDrawable(service, isFullscreen() + ? R.drawable.ic_fullscreen_exit_white_24dp + : R.drawable.ic_fullscreen_white_24dp)); } private void prepareOrientation() { @@ -1077,7 +1077,7 @@ public class VideoPlayerImpl extends VideoPlayer getRootView().setKeepScreenOn(false); service.resetNotification(); - service.updateNotification(R.drawable.ic_play_arrow_white_24dp); + service.updateNotification(R.drawable.exo_controls_play); } @Override @@ -1086,7 +1086,7 @@ public class VideoPlayerImpl extends VideoPlayer getRootView().setKeepScreenOn(true); service.resetNotification(); - service.updateNotification(R.drawable.ic_play_arrow_white_24dp); + service.updateNotification(R.drawable.exo_controls_play); } @Override @@ -1103,7 +1103,7 @@ public class VideoPlayerImpl extends VideoPlayer getRootView().setKeepScreenOn(true); service.resetNotification(); - service.updateNotification(R.drawable.ic_pause_white_24dp); + service.updateNotification(R.drawable.exo_controls_pause); service.startForeground(NOTIFICATION_ID, service.getNotBuilder().build()); } @@ -1120,7 +1120,7 @@ public class VideoPlayerImpl extends VideoPlayer updateWindowFlags(IDLE_WINDOW_FLAGS); service.resetNotification(); - service.updateNotification(R.drawable.ic_play_arrow_white_24dp); + service.updateNotification(R.drawable.exo_controls_play); // Remove running notification when user don't want music (or video in popup) // to be played in background @@ -1138,7 +1138,7 @@ public class VideoPlayerImpl extends VideoPlayer getRootView().setKeepScreenOn(true); service.resetNotification(); - service.updateNotification(R.drawable.ic_play_arrow_white_24dp); + service.updateNotification(R.drawable.exo_controls_play); } diff --git a/app/src/main/res/layout-large-land/fragment_video_detail.xml b/app/src/main/res/layout-large-land/fragment_video_detail.xml index 192993c82..e2a611b08 100644 --- a/app/src/main/res/layout-large-land/fragment_video_detail.xml +++ b/app/src/main/res/layout-large-land/fragment_video_detail.xml @@ -675,7 +675,7 @@ android:layout_marginRight="2dp" android:padding="10dp" android:scaleType="center" - android:src="?attr/ic_play_arrow" + app:srcCompat="?attr/ic_play_arrow" android:background="?attr/selectableItemBackground" tools:ignore="ContentDescription,RtlHardcoded"/> diff --git a/app/src/main/res/layout/fragment_video_detail.xml b/app/src/main/res/layout/fragment_video_detail.xml index cc1f25646..1dd5a7135 100644 --- a/app/src/main/res/layout/fragment_video_detail.xml +++ b/app/src/main/res/layout/fragment_video_detail.xml @@ -648,7 +648,7 @@ android:layout_marginRight="2dp" android:padding="10dp" android:scaleType="center" - android:src="?attr/ic_play_arrow" + app:srcCompat="?attr/ic_play_arrow" android:background="?attr/selectableItemBackground" tools:ignore="ContentDescription,RtlHardcoded"/>