Merge pull request #5310 from khimaros/list-play-kodi
add list item to play video on kodi
This commit is contained in:
commit
92a87a5ed2
7 changed files with 34 additions and 5 deletions
|
|
@ -1,9 +1,9 @@
|
|||
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;
|
||||
|
|
@ -16,6 +16,12 @@ public final class KoreUtil {
|
|||
|| serviceId == ServiceList.SoundCloud.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);
|
||||
}
|
||||
|
||||
public static void showInstallKoreDialog(final Context context) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setMessage(R.string.kore_not_found)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.schabi.newpipe.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
|
|
@ -70,6 +71,15 @@ public enum StreamDialogEntry {
|
|||
}
|
||||
}),
|
||||
|
||||
play_with_kodi(R.string.play_with_kodi_title, (fragment, item) -> {
|
||||
final Uri videoUrl = Uri.parse(item.getUrl());
|
||||
try {
|
||||
NavigationHelper.playWithKore(fragment.getContext(), videoUrl);
|
||||
} catch (final Exception e) {
|
||||
KoreUtil.showInstallKoreDialog(fragment.getActivity());
|
||||
}
|
||||
}),
|
||||
|
||||
share(R.string.share, (fragment, item) ->
|
||||
ShareUtils.shareUrl(fragment.getContext(), item.getName(), item.getUrl()));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue