From 856a39855e8ddd6b2eea956aebd0247eadf1308d Mon Sep 17 00:00:00 2001 From: camo0112 <56369484+camo0112@users.noreply.github.com> Date: Wed, 31 Mar 2021 20:48:02 +0530 Subject: [PATCH] IssueFixed#5968 --- .../newpipe/about/LicenseFragmentHelper.kt | 28 ++++++++++--------- .../schabi/newpipe/util/NavigationHelper.java | 19 ++++++++----- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.kt b/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.kt index 89e356a42..bdb3edabd 100644 --- a/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.kt +++ b/app/src/main/java/org/schabi/newpipe/about/LicenseFragmentHelper.kt @@ -58,19 +58,21 @@ object LicenseFragmentHelper { */ private fun getLicenseStylesheet(context: Context): String { val isLightTheme = ThemeHelper.isLightThemeSelected(context) - return ("body{padding:12px 15px;margin:0;" + "background:#" + getHexRGBColor( - context, - if (isLightTheme) R.color.light_license_background_color - else R.color.dark_license_background_color - ) + ";" + "color:#" + getHexRGBColor( - context, - if (isLightTheme) R.color.light_license_text_color - else R.color.dark_license_text_color - ) + "}" + "a[href]{color:#" + getHexRGBColor( - context, - if (isLightTheme) R.color.light_youtube_primary_color - else R.color.dark_youtube_primary_color - ) + "}" + "pre{white-space:pre-wrap}") + return ( + "body{padding:12px 15px;margin:0;" + "background:#" + getHexRGBColor( + context, + if (isLightTheme) R.color.light_license_background_color + else R.color.dark_license_background_color + ) + ";" + "color:#" + getHexRGBColor( + context, + if (isLightTheme) R.color.light_license_text_color + else R.color.dark_license_text_color + ) + "}" + "a[href]{color:#" + getHexRGBColor( + context, + if (isLightTheme) R.color.light_youtube_primary_color + else R.color.dark_youtube_primary_color + ) + "}" + "pre{white-space:pre-wrap}" + ) } /** diff --git a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java index 4f4fd5283..df804136a 100644 --- a/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java @@ -62,7 +62,8 @@ public final class NavigationHelper { public static final String MAIN_FRAGMENT_TAG = "main_fragment_tag"; public static final String SEARCH_FRAGMENT_TAG = "search_fragment_tag"; - private NavigationHelper() { } + private NavigationHelper() { + } /*////////////////////////////////////////////////////////////////////////// // Players @@ -111,18 +112,22 @@ public final class NavigationHelper { public static void playOnMainPlayer(final AppCompatActivity activity, @NonNull final PlayQueue playQueue) { final PlayQueueItem item = playQueue.getItem(); - assert item != null; - openVideoDetailFragment(activity, activity.getSupportFragmentManager(), - item.getServiceId(), item.getUrl(), item.getTitle(), playQueue, false); + if (item != null) { + openVideoDetailFragment(activity, activity.getSupportFragmentManager(), + item.getServiceId(), item.getUrl(), item.getTitle(), playQueue, + false); + } } public static void playOnMainPlayer(final Context context, @NonNull final PlayQueue playQueue, final boolean switchingPlayers) { final PlayQueueItem item = playQueue.getItem(); - assert item != null; - openVideoDetail(context, - item.getServiceId(), item.getUrl(), item.getTitle(), playQueue, switchingPlayers); + if (item != null) { + openVideoDetail(context, + item.getServiceId(), item.getUrl(), item.getTitle(), playQueue, + switchingPlayers); + } } public static void playOnPopupPlayer(final Context context,