NewPipe/app/src/main/java/org/schabi/newpipe/util/external_communication/KoreUtils.java

36 lines
1.3 KiB
Java
Raw Normal View History

package org.schabi.newpipe.util.external_communication;
import android.content.Context;
import androidx.appcompat.app.AlertDialog;
2020-12-30 23:40:21 +01:00
import androidx.preference.PreferenceManager;
import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.util.NavigationHelper;
public final class KoreUtils {
private KoreUtils() { }
public static boolean isServiceSupportedByKore(final int serviceId) {
return (serviceId == ServiceList.YouTube.getServiceId()
|| serviceId == ServiceList.SoundCloud.getServiceId());
}
public static boolean shouldShowPlayWithKodi(final Context context, final int serviceId) {
return isServiceSupportedByKore(serviceId)
2020-12-30 23:40:21 +01:00
&& 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)
2020-11-20 00:54:27 +01:00
.setPositiveButton(R.string.install, (dialog, which) ->
NavigationHelper.installKore(context))
2020-11-20 00:54:27 +01:00
.setNegativeButton(R.string.cancel, (dialog, which) -> {
});
builder.create().show();
}
}