Merge branch 'dev' into daynight
This commit is contained in:
commit
ef0999b9c3
105 changed files with 1017 additions and 942 deletions
|
|
@ -20,6 +20,13 @@ public final class DeviceUtils {
|
|||
private static final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv";
|
||||
private static Boolean isTV = null;
|
||||
|
||||
/*
|
||||
* Devices that do not support media tunneling
|
||||
*/
|
||||
// Formuler Z8 Pro, Z8, CC, Z Alpha, Z+ Neo
|
||||
private static final boolean HI3798MV200 = Build.VERSION.SDK_INT == 24
|
||||
&& Build.DEVICE.equals("Hi3798MV200");
|
||||
|
||||
private DeviceUtils() {
|
||||
}
|
||||
|
||||
|
|
@ -88,4 +95,15 @@ public final class DeviceUtils {
|
|||
sp,
|
||||
context.getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
/**
|
||||
* Some devices have broken tunneled video playback but claim to support it.
|
||||
* See https://github.com/TeamNewPipe/NewPipe/issues/5911
|
||||
* @return false if Kitkat (does not support tunneling) or affected device
|
||||
*/
|
||||
public static boolean shouldSupportMediaTunneling() {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
|
||||
&& !HI3798MV200;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -9,19 +9,19 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class RelatedStreamInfo extends ListInfo<InfoItem> {
|
||||
public RelatedStreamInfo(final int serviceId, final ListLinkHandler listUrlIdHandler,
|
||||
final String name) {
|
||||
public class RelatedItemInfo extends ListInfo<InfoItem> {
|
||||
public RelatedItemInfo(final int serviceId, final ListLinkHandler listUrlIdHandler,
|
||||
final String name) {
|
||||
super(serviceId, listUrlIdHandler, name);
|
||||
}
|
||||
|
||||
public static RelatedStreamInfo getInfo(final StreamInfo info) {
|
||||
public static RelatedItemInfo getInfo(final StreamInfo info) {
|
||||
final ListLinkHandler handler = new ListLinkHandler(
|
||||
info.getOriginalUrl(), info.getUrl(), info.getId(), Collections.emptyList(), null);
|
||||
final RelatedStreamInfo relatedStreamInfo = new RelatedStreamInfo(
|
||||
final RelatedItemInfo relatedItemInfo = new RelatedItemInfo(
|
||||
info.getServiceId(), handler, info.getName());
|
||||
final List<InfoItem> streams = new ArrayList<>(info.getRelatedStreams());
|
||||
relatedStreamInfo.setRelatedItems(streams);
|
||||
return relatedStreamInfo;
|
||||
final List<InfoItem> relatedItems = new ArrayList<>(info.getRelatedItems());
|
||||
relatedItemInfo.setRelatedItems(relatedItems);
|
||||
return relatedItemInfo;
|
||||
}
|
||||
}
|
||||
|
|
@ -24,6 +24,12 @@ public enum StreamDialogEntry {
|
|||
// enum values with DEFAULT actions //
|
||||
//////////////////////////////////////
|
||||
|
||||
show_channel_details(R.string.show_channel_details, (fragment, item) ->
|
||||
// For some reason `getParentFragmentManager()` doesn't work, but this does.
|
||||
NavigationHelper.openChannelFragment(fragment.getActivity().getSupportFragmentManager(),
|
||||
item.getServiceId(), item.getUploaderUrl(), item.getUploaderName())
|
||||
),
|
||||
|
||||
/**
|
||||
* Enqueues the stream automatically to the current PlayerType.<br>
|
||||
* <br>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue