diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java index 10527d1896d..a40ff1bf319 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/BaseListFragment.java @@ -333,7 +333,6 @@ protected void onScrollToBottom() { } } - protected void showStreamDialog(final StreamInfoItem item) { final Context context = getContext(); final Activity activity = getActivity(); @@ -360,7 +359,7 @@ protected void showStreamDialog(final StreamInfoItem item) { StreamDialogEntry.share )); } - if (KoreUtil.shouldShowPlayWithKodi(context, item)) { + if (KoreUtil.shouldShowPlayWithKodi(context, item.getServiceId())) { entries.add(StreamDialogEntry.play_with_kodi); } StreamDialogEntry.setEnabledEntries(entries); diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java index 0eed5f4b00b..8f7d6128b94 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java @@ -175,7 +175,7 @@ protected void showStreamDialog(final StreamInfoItem item) { StreamDialogEntry.share )); } - if (KoreUtil.shouldShowPlayWithKodi(context, item)) { + if (KoreUtil.shouldShowPlayWithKodi(context, item.getServiceId())) { entries.add(StreamDialogEntry.play_with_kodi); } StreamDialogEntry.setEnabledEntries(entries); diff --git a/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java index a6a73e05f93..0d549ecf91a 100644 --- a/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/history/StatisticsPlaylistFragment.java @@ -414,7 +414,7 @@ private void showStreamDialog(final StreamStatisticsEntry item) { StreamDialogEntry.share )); } - if (KoreUtil.shouldShowPlayWithKodi(context, infoItem)) { + if (KoreUtil.shouldShowPlayWithKodi(context, infoItem.getServiceId())) { entries.add(StreamDialogEntry.play_with_kodi); } StreamDialogEntry.setEnabledEntries(entries); diff --git a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java index 94f76cc754d..17f7a4ff9ef 100644 --- a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistFragment.java @@ -782,7 +782,7 @@ protected void showStreamItemDialog(final PlaylistStreamEntry item) { StreamDialogEntry.share )); } - if (KoreUtil.shouldShowPlayWithKodi(context, infoItem)) { + if (KoreUtil.shouldShowPlayWithKodi(context, infoItem.getServiceId())) { entries.add(StreamDialogEntry.play_with_kodi); } StreamDialogEntry.setEnabledEntries(entries); 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 a304b44300b..9ae26cf33aa 100644 --- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java +++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java @@ -932,9 +932,7 @@ private void showHideKodiButton() { service.getString(R.string.show_play_with_kodi_key), false); // show kodi button if it supports the current service and it is enabled in settings final boolean showKodiButton = playQueue != null && playQueue.getItem() != null - && KoreUtil.isServiceSupportedByKore(playQueue.getItem().getServiceId()) - && PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(context.getString(R.string.show_play_with_kodi_key), false); + && KoreUtil.shouldShowPlayWithKodi(context, playQueue.getItem().getServiceId()); playWithKodi.setVisibility(videoPlayerSelected() && kodiEnabled && showKodiButton ? View.VISIBLE : View.GONE); } diff --git a/app/src/main/java/org/schabi/newpipe/util/KoreUtil.java b/app/src/main/java/org/schabi/newpipe/util/KoreUtil.java index 26019cd1f50..de6f3fa9a8d 100644 --- a/app/src/main/java/org/schabi/newpipe/util/KoreUtil.java +++ b/app/src/main/java/org/schabi/newpipe/util/KoreUtil.java @@ -1,6 +1,5 @@ package org.schabi.newpipe.util; - import android.content.Context; import androidx.appcompat.app.AlertDialog; @@ -8,7 +7,6 @@ import org.schabi.newpipe.R; import org.schabi.newpipe.extractor.ServiceList; -import org.schabi.newpipe.extractor.stream.StreamInfoItem; public final class KoreUtil { private KoreUtil() { } @@ -18,8 +16,8 @@ public static boolean isServiceSupportedByKore(final int serviceId) { || serviceId == ServiceList.SoundCloud.getServiceId()); } - public static boolean shouldShowPlayWithKodi(final Context context, final StreamInfoItem item) { - return isServiceSupportedByKore(item.getServiceId()) + public static boolean shouldShowPlayWithKodi(final Context context, final int serviceId) { + return isServiceSupportedByKore(serviceId) && PreferenceManager.getDefaultSharedPreferences(context) .getBoolean(context.getString(R.string.show_play_with_kodi_key), false); }