kopia lustrzana https://github.com/TeamNewPipe/NewPipe
address pull request feedback
rodzic
83faf119a9
commit
48a5107296
|
@ -360,11 +360,8 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I>
|
|||
StreamDialogEntry.share
|
||||
));
|
||||
}
|
||||
final boolean enableKodiEntry = KoreUtil.isServiceSupportedByKore(item.getServiceId())
|
||||
&& PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(context.getString(R.string.show_play_with_kodi_key), false);
|
||||
if (enableKodiEntry) {
|
||||
entries.add(StreamDialogEntry.play_on_kodi);
|
||||
if (KoreUtil.shouldShowPlayWithKodi(context, item)) {
|
||||
entries.add(StreamDialogEntry.play_with_kodi);
|
||||
}
|
||||
StreamDialogEntry.setEnabledEntries(entries);
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.reactivestreams.Subscriber;
|
||||
import org.reactivestreams.Subscription;
|
||||
|
@ -176,11 +175,8 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
|||
StreamDialogEntry.share
|
||||
));
|
||||
}
|
||||
final boolean enableKodiEntry = KoreUtil.isServiceSupportedByKore(item.getServiceId())
|
||||
&& PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(context.getString(R.string.show_play_with_kodi_key), false);
|
||||
if (enableKodiEntry) {
|
||||
entries.add(StreamDialogEntry.play_on_kodi);
|
||||
if (KoreUtil.shouldShowPlayWithKodi(context, item)) {
|
||||
entries.add(StreamDialogEntry.play_with_kodi);
|
||||
}
|
||||
StreamDialogEntry.setEnabledEntries(entries);
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import android.widget.Toast;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
|
@ -415,11 +414,8 @@ public class StatisticsPlaylistFragment
|
|||
StreamDialogEntry.share
|
||||
));
|
||||
}
|
||||
final boolean enableKodiEntry = KoreUtil.isServiceSupportedByKore(infoItem.getServiceId())
|
||||
&& PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(context.getString(R.string.show_play_with_kodi_key), false);
|
||||
if (enableKodiEntry) {
|
||||
entries.add(StreamDialogEntry.play_on_kodi);
|
||||
if (KoreUtil.shouldShowPlayWithKodi(context, infoItem)) {
|
||||
entries.add(StreamDialogEntry.play_with_kodi);
|
||||
}
|
||||
StreamDialogEntry.setEnabledEntries(entries);
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import android.widget.Toast;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
|
@ -783,11 +782,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||
StreamDialogEntry.share
|
||||
));
|
||||
}
|
||||
final boolean enableKodiEntry = KoreUtil.isServiceSupportedByKore(infoItem.getServiceId())
|
||||
&& PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(context.getString(R.string.show_play_with_kodi_key), false);
|
||||
if (enableKodiEntry) {
|
||||
entries.add(StreamDialogEntry.play_on_kodi);
|
||||
if (KoreUtil.shouldShowPlayWithKodi(context, infoItem)) {
|
||||
entries.add(StreamDialogEntry.play_with_kodi);
|
||||
}
|
||||
StreamDialogEntry.setEnabledEntries(entries);
|
||||
|
||||
|
|
|
@ -4,9 +4,11 @@ package org.schabi.newpipe.util;
|
|||
import android.content.Context;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
import org.schabi.newpipe.extractor.ServiceList;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
|
||||
public final class KoreUtil {
|
||||
private KoreUtil() { }
|
||||
|
@ -16,6 +18,12 @@ public final class KoreUtil {
|
|||
|| serviceId == ServiceList.SoundCloud.getServiceId());
|
||||
}
|
||||
|
||||
public static boolean shouldShowPlayWithKodi(final Context context, final StreamInfoItem item) {
|
||||
return isServiceSupportedByKore(item.getServiceId())
|
||||
&& PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(context.getString(R.string.show_play_with_kodi_key), false);
|
||||
}
|
||||
|
||||
public static void showInstallKoreDialog(final Context context) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setMessage(R.string.kore_not_found)
|
||||
|
|
|
@ -71,7 +71,7 @@ public enum StreamDialogEntry {
|
|||
}
|
||||
}),
|
||||
|
||||
play_on_kodi(R.string.play_with_kodi_title, (fragment, item) -> {
|
||||
play_with_kodi(R.string.play_with_kodi_title, (fragment, item) -> {
|
||||
final Uri videoUrl = Uri.parse(item.getUrl());
|
||||
try {
|
||||
NavigationHelper.playWithKore(fragment.getContext(), videoUrl);
|
||||
|
|
Ładowanie…
Reference in New Issue