1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-25 01:20:34 +00:00

Merge branch 'feature-small-code-improvements' of https://github.com/coffeemakr/NewPipe into coffe

This commit is contained in:
Christian Schabesberger 2017-12-11 18:06:38 +01:00
commit 33fa30ab78
28 changed files with 213 additions and 185 deletions

View File

@ -48,7 +48,7 @@ public class WatchHistoryEntry extends HistoryEntry {
} }
public WatchHistoryEntry(StreamInfo streamInfo) { public WatchHistoryEntry(StreamInfo streamInfo) {
this(new Date(), streamInfo.service_id, streamInfo.name, streamInfo.url, this(new Date(), streamInfo.getServiceId(), streamInfo.getName(), streamInfo.getUrl(),
streamInfo.id, streamInfo.thumbnail_url, streamInfo.uploader_name, streamInfo.duration); streamInfo.id, streamInfo.thumbnail_url, streamInfo.uploader_name, streamInfo.duration);
} }

View File

@ -108,8 +108,8 @@ public class DownloadDialog extends DialogFragment implements RadioGroup.OnCheck
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
nameEditText = view.findViewById(R.id.file_name); nameEditText = view.findViewById(R.id.file_name);
nameEditText.setText(FilenameUtils.createFilename(getContext(), currentInfo.name)); nameEditText.setText(FilenameUtils.createFilename(getContext(), currentInfo.getName()));
selectedAudioIndex = ListHelper.getDefaultAudioFormat(getContext(), currentInfo.audio_streams); selectedAudioIndex = ListHelper.getDefaultAudioFormat(getContext(), currentInfo.getAudioStreams());
streamsSpinner = view.findViewById(R.id.quality_spinner); streamsSpinner = view.findViewById(R.id.quality_spinner);
streamsSpinner.setOnItemSelectedListener(this); streamsSpinner.setOnItemSelectedListener(this);
@ -183,7 +183,7 @@ public class DownloadDialog extends DialogFragment implements RadioGroup.OnCheck
String[] items = new String[audioStreams.size()]; String[] items = new String[audioStreams.size()];
for (int i = 0; i < audioStreams.size(); i++) { for (int i = 0; i < audioStreams.size(); i++) {
AudioStream audioStream = audioStreams.get(i); AudioStream audioStream = audioStreams.get(i);
items[i] = MediaFormat.getNameById(audioStream.format) + " " + audioStream.average_bitrate + "kbps"; items[i] = audioStream.getFormat().getName() + " " + audioStream.getAverageBitrate() + "kbps";
} }
ArrayAdapter<String> itemAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_dropdown_item, items); ArrayAdapter<String> itemAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_dropdown_item, items);
@ -242,7 +242,7 @@ public class DownloadDialog extends DialogFragment implements RadioGroup.OnCheck
RadioButton audioButton = view.findViewById(R.id.audio_button); RadioButton audioButton = view.findViewById(R.id.audio_button);
RadioButton videoButton = view.findViewById(R.id.video_button); RadioButton videoButton = view.findViewById(R.id.video_button);
if (currentInfo.audio_streams == null || currentInfo.audio_streams.size() == 0) { if (currentInfo.getAudioStreams() == null || currentInfo.getAudioStreams().size() == 0) {
audioButton.setVisibility(View.GONE); audioButton.setVisibility(View.GONE);
videoButton.setChecked(true); videoButton.setChecked(true);
} else if (sortedStreamVideosList == null || sortedStreamVideosList.size() == 0) { } else if (sortedStreamVideosList == null || sortedStreamVideosList.size() == 0) {
@ -256,14 +256,18 @@ public class DownloadDialog extends DialogFragment implements RadioGroup.OnCheck
String url, location; String url, location;
String fileName = nameEditText.getText().toString().trim(); String fileName = nameEditText.getText().toString().trim();
if (fileName.isEmpty()) fileName = FilenameUtils.createFilename(getContext(), currentInfo.name); if (fileName.isEmpty()) fileName = FilenameUtils.createFilename(getContext(), currentInfo.getName());
boolean isAudio = radioVideoAudioGroup.getCheckedRadioButtonId() == R.id.audio_button; boolean isAudio = radioVideoAudioGroup.getCheckedRadioButtonId() == R.id.audio_button;
url = isAudio ? currentInfo.audio_streams.get(selectedAudioIndex).url : sortedStreamVideosList.get(selectedVideoIndex).url; if (isAudio) {
location = isAudio ? NewPipeSettings.getAudioDownloadPath(getContext()) : NewPipeSettings.getVideoDownloadPath(getContext()); url = currentInfo.getAudioStreams().get(selectedAudioIndex).getUrl();
location = NewPipeSettings.getAudioDownloadPath(getContext());
if (isAudio) fileName += "." + MediaFormat.getSuffixById(currentInfo.audio_streams.get(selectedAudioIndex).format); fileName += "." + currentInfo.getAudioStreams().get(selectedAudioIndex).getFormat().getSuffix();
else fileName += "." + MediaFormat.getSuffixById(sortedStreamVideosList.get(selectedVideoIndex).format); } else {
url = sortedStreamVideosList.get(selectedVideoIndex).getUrl();
location = NewPipeSettings.getVideoDownloadPath(getContext());
fileName += "." + sortedStreamVideosList.get(selectedVideoIndex).getFormat().getSuffix();
}
DownloadManagerService.startMission(getContext(), url, location, fileName, isAudio, threadsSeekBar.getProgress() + 1); DownloadManagerService.startMission(getContext(), url, location, fileName, isAudio, threadsSeekBar.getProgress() + 1);
getDialog().dismiss(); getDialog().dismiss();

View File

@ -2,6 +2,7 @@ package org.schabi.newpipe.fragments;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -30,30 +31,28 @@ import org.schabi.newpipe.fragments.list.kiosk.KioskFragment;
import org.schabi.newpipe.fragments.subscription.SubscriptionFragment; import org.schabi.newpipe.fragments.subscription.SubscriptionFragment;
import org.schabi.newpipe.report.ErrorActivity; import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.ThemeHelper; import org.schabi.newpipe.util.ThemeHelper;
import java.util.concurrent.ExecutionException;
public class MainFragment extends BaseFragment implements TabLayout.OnTabSelectedListener { public class MainFragment extends BaseFragment implements TabLayout.OnTabSelectedListener {
private ViewPager viewPager; private ViewPager viewPager;
private boolean showBlankTab = false; private boolean showBlankTab = false;
private static final int FALLBACK_SERVICE_ID = 0; // Youtbe public int currentServiceId = -1;
/*//////////////////////////////////////////////////////////////////////////
// Constants
//////////////////////////////////////////////////////////////////////////*/
private static final int FALLBACK_SERVICE_ID = 0; // Youtube
private static final String FALLBACK_CHANNEL_URL = private static final String FALLBACK_CHANNEL_URL =
"https://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ"; "https://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ";
private static final String FALLBACK_CHANNEL_NAME = "Music"; private static final String FALLBACK_CHANNEL_NAME = "Music";
private static final String FALLBACK_KIOSK_ID = "Trending"; private static final String FALLBACK_KIOSK_ID = "Trending";
private static final int KIOSK_MENU_OFFSET = 2000;
public int currentServiceId = -1;
/*//////////////////////////////////////////////////////////////////////////
// Konst
//////////////////////////////////////////////////////////////////////////*/
private static final int KIOSK_MENU_OFFSETT = 2000;
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
// Fragment's LifeCycle // Fragment's LifeCycle
@ -66,7 +65,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
currentServiceId = Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(getActivity()) currentServiceId = Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(getActivity())
.getString(getString(R.string.current_service_key), "0")); .getString(getString(R.string.current_service_key), "0"));
return inflater.inflate(R.layout.fragment_main, container, false); return inflater.inflate(R.layout.fragment_main, container, false);
@ -86,27 +85,27 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
tabLayout.setupWithViewPager(viewPager); tabLayout.setupWithViewPager(viewPager);
if(ThemeHelper.isLightThemeSelected(getActivity())) { int channelIcon;
int whatsHotIcon;
if (ThemeHelper.isLightThemeSelected(getActivity())) {
tabLayout.setBackgroundColor(getResources().getColor(R.color.light_youtube_primary_color)); tabLayout.setBackgroundColor(getResources().getColor(R.color.light_youtube_primary_color));
channelIcon = R.drawable.ic_channel_black_24dp;
whatsHotIcon = R.drawable.ic_whatshot_black_24dp;
} else {
channelIcon = R.drawable.ic_channel_white_24dp;
whatsHotIcon = R.drawable.ic_whatshot_white_24dp;
} }
if(PreferenceManager.getDefaultSharedPreferences(getActivity())
if (PreferenceManager.getDefaultSharedPreferences(getActivity())
.getString(getString(R.string.main_page_content_key), getString(R.string.blank_page_key)) .getString(getString(R.string.main_page_content_key), getString(R.string.blank_page_key))
.equals(getString(R.string.subscription_page_key))) { .equals(getString(R.string.subscription_page_key))) {
if(ThemeHelper.isLightThemeSelected(getActivity())) { tabLayout.getTabAt(0).setIcon(channelIcon);
tabLayout.getTabAt(0).setIcon(R.drawable.ic_channel_black_24dp); } else {
} else{ tabLayout.getTabAt(0).setIcon(whatsHotIcon);
tabLayout.getTabAt(0).setIcon(R.drawable.ic_channel_white_24dp); tabLayout.getTabAt(1).setIcon(channelIcon);
} }
} else {
if(ThemeHelper.isLightThemeSelected(getActivity())) {
tabLayout.getTabAt(0).setIcon(R.drawable.ic_whatshot_black_24dp);
tabLayout.getTabAt(1).setIcon(R.drawable.ic_channel_black_24dp);
} else {
tabLayout.getTabAt(0).setIcon(R.drawable.ic_whatshot_white_24dp);
tabLayout.getTabAt(1).setIcon(R.drawable.ic_channel_white_24dp);
}
}
} }
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
@ -182,7 +181,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
.equals(getString(R.string.subscription_page_key))) { .equals(getString(R.string.subscription_page_key))) {
return new SubscriptionFragment(); return new SubscriptionFragment();
} else { } else {
return getMainPageFramgent(); return getMainPageFragment();
} }
case 1: case 1:
return new SubscriptionFragment(); return new SubscriptionFragment();
@ -213,7 +212,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
// Main page content // Main page content
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
private Fragment getMainPageFramgent() { private Fragment getMainPageFragment() {
try { try {
SharedPreferences preferences = SharedPreferences preferences =
PreferenceManager.getDefaultSharedPreferences(getActivity()); PreferenceManager.getDefaultSharedPreferences(getActivity());
@ -268,7 +267,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
KioskList kl = service.getKioskList(); KioskList kl = service.getKioskList();
int i = 0; int i = 0;
for(final String ks : kl.getAvailableKiosks()) { for(final String ks : kl.getAvailableKiosks()) {
menu.add(0, KIOSK_MENU_OFFSETT + i, Menu.NONE, menu.add(0, KIOSK_MENU_OFFSET + i, Menu.NONE,
KioskTranslator.getTranslatedKioskName(ks, getContext())) KioskTranslator.getTranslatedKioskName(ks, getContext()))
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override

View File

@ -60,7 +60,7 @@ public class SpinnerToolbarAdapter extends BaseAdapter {
ImageView woSoundIcon = convertView.findViewById(R.id.wo_sound_icon); ImageView woSoundIcon = convertView.findViewById(R.id.wo_sound_icon);
TextView text = convertView.findViewById(android.R.id.text1); TextView text = convertView.findViewById(android.R.id.text1);
VideoStream item = (VideoStream) getItem(position); VideoStream item = (VideoStream) getItem(position);
text.setText(MediaFormat.getNameById(item.format) + " " + item.resolution); text.setText(item.getFormat().getName() + " " + item.getResolution());
int visibility = !showIconNoAudio ? View.GONE int visibility = !showIconNoAudio ? View.GONE
: item.isVideoOnly ? View.VISIBLE : item.isVideoOnly ? View.VISIBLE

View File

@ -4,7 +4,8 @@ import java.io.Serializable;
class StackItem implements Serializable { class StackItem implements Serializable {
private int serviceId; private int serviceId;
private String title, url; private String title;
private String url;
StackItem(int serviceId, String url, String title) { StackItem(int serviceId, String url, String title) {
this.serviceId = serviceId; this.serviceId = serviceId;

View File

@ -13,6 +13,7 @@ import android.support.annotation.DrawableRes;
import android.support.annotation.FloatRange; import android.support.annotation.FloatRange;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.text.TextUtilsCompat;
import android.support.v4.view.animation.FastOutSlowInInterpolator; import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
@ -283,7 +284,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
// Check if the next video label and video is visible, // Check if the next video label and video is visible,
// if it is, include the two elements in the next check // if it is, include the two elements in the next check
int nextCount = currentInfo != null && currentInfo.next_video != null ? 2 : 0; int nextCount = currentInfo != null && currentInfo.getNextVideo() != null ? 2 : 0;
if (relatedStreamsView != null && relatedStreamsView.getChildCount() > INITIAL_RELATED_VIDEOS + nextCount) { if (relatedStreamsView != null && relatedStreamsView.getChildCount() > INITIAL_RELATED_VIDEOS + nextCount) {
outState.putSerializable(WAS_RELATED_EXPANDED_KEY, true); outState.putSerializable(WAS_RELATED_EXPANDED_KEY, true);
} }
@ -330,10 +331,14 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
openPopupPlayer(false); openPopupPlayer(false);
break; break;
case R.id.detail_uploader_root_layout: case R.id.detail_uploader_root_layout:
if (currentInfo.uploader_url == null || currentInfo.uploader_url.isEmpty()) { if (TextUtils.isEmpty(currentInfo.getUploaderUrl())) {
Log.w(TAG, "Can't open channel because we got no channel URL"); Log.w(TAG, "Can't open channel because we got no channel URL");
} else { } else {
NavigationHelper.openChannelFragment(getFragmentManager(), currentInfo.service_id, currentInfo.uploader_url, currentInfo.uploader_name); NavigationHelper.openChannelFragment(
getFragmentManager(),
currentInfo.getServiceId(),
currentInfo.getUploaderUrl(),
currentInfo.getUploaderName());
} }
break; break;
case R.id.detail_thumbnail_root_layout: case R.id.detail_thumbnail_root_layout:
@ -380,7 +385,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
if (DEBUG) Log.d(TAG, "toggleExpandRelatedVideos() called with: info = [" + info + "]"); if (DEBUG) Log.d(TAG, "toggleExpandRelatedVideos() called with: info = [" + info + "]");
if (!showRelatedStreams) return; if (!showRelatedStreams) return;
int nextCount = info.next_video != null ? 2 : 0; int nextCount = info.getNextVideo() != null ? 2 : 0;
int initialCount = INITIAL_RELATED_VIDEOS + nextCount; int initialCount = INITIAL_RELATED_VIDEOS + nextCount;
if (relatedStreamsView.getChildCount() > initialCount) { if (relatedStreamsView.getChildCount() > initialCount) {
@ -390,8 +395,8 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
} }
//Log.d(TAG, "toggleExpandRelatedVideos() called with: info = [" + info + "], from = [" + INITIAL_RELATED_VIDEOS + "]"); //Log.d(TAG, "toggleExpandRelatedVideos() called with: info = [" + info + "], from = [" + INITIAL_RELATED_VIDEOS + "]");
for (int i = INITIAL_RELATED_VIDEOS; i < info.related_streams.size(); i++) { for (int i = INITIAL_RELATED_VIDEOS; i < info.getRelatedStreams().size(); i++) {
InfoItem item = info.related_streams.get(i); InfoItem item = info.getRelatedStreams().get(i);
//Log.d(TAG, "i = " + i); //Log.d(TAG, "i = " + i);
relatedStreamsView.addView(infoItemBuilder.buildView(relatedStreamsView, item)); relatedStreamsView.addView(infoItemBuilder.buildView(relatedStreamsView, item));
} }
@ -459,7 +464,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
infoItemBuilder.setOnStreamSelectedListener(new InfoItemBuilder.OnInfoItemSelectedListener<StreamInfoItem>() { infoItemBuilder.setOnStreamSelectedListener(new InfoItemBuilder.OnInfoItemSelectedListener<StreamInfoItem>() {
@Override @Override
public void selected(StreamInfoItem selectedItem) { public void selected(StreamInfoItem selectedItem) {
selectAndLoadVideo(selectedItem.service_id, selectedItem.url, selectedItem.name); selectAndLoadVideo(selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
} }
@Override @Override
@ -532,35 +537,35 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
private void initThumbnailViews(StreamInfo info) { private void initThumbnailViews(StreamInfo info) {
thumbnailImageView.setImageResource(R.drawable.dummy_thumbnail_dark); thumbnailImageView.setImageResource(R.drawable.dummy_thumbnail_dark);
if (info.thumbnail_url != null && !info.thumbnail_url.isEmpty()) { if (!TextUtils.isEmpty(info.getThumbnailUrl())) {
imageLoader.displayImage(info.thumbnail_url, thumbnailImageView, DISPLAY_THUMBNAIL_OPTIONS, new SimpleImageLoadingListener() { imageLoader.displayImage(info.getThumbnailUrl(), thumbnailImageView, DISPLAY_THUMBNAIL_OPTIONS, new SimpleImageLoadingListener() {
@Override @Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) { public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
ErrorActivity.reportError(activity, failReason.getCause(), null, activity.findViewById(android.R.id.content), ErrorActivity.ErrorInfo.make(UserAction.LOAD_IMAGE, NewPipe.getNameOfService(currentInfo.service_id), imageUri, R.string.could_not_load_thumbnails)); ErrorActivity.reportError(activity, failReason.getCause(), null, activity.findViewById(android.R.id.content), ErrorActivity.ErrorInfo.make(UserAction.LOAD_IMAGE, NewPipe.getNameOfService(currentInfo.getServiceId()), imageUri, R.string.could_not_load_thumbnails));
} }
}); });
} }
if (info.uploader_avatar_url != null && !info.uploader_avatar_url.isEmpty()) { if (TextUtils.isEmpty(info.getUploaderAvatarUrl())) {
imageLoader.displayImage(info.uploader_avatar_url, uploaderThumb, DISPLAY_AVATAR_OPTIONS); imageLoader.displayImage(info.getUploaderAvatarUrl(), uploaderThumb, DISPLAY_AVATAR_OPTIONS);
} }
} }
private void initRelatedVideos(StreamInfo info) { private void initRelatedVideos(StreamInfo info) {
if (relatedStreamsView.getChildCount() > 0) relatedStreamsView.removeAllViews(); if (relatedStreamsView.getChildCount() > 0) relatedStreamsView.removeAllViews();
if (info.next_video != null && showRelatedStreams) { if (info.getNextVideo() != null && showRelatedStreams) {
nextStreamTitle.setVisibility(View.VISIBLE); nextStreamTitle.setVisibility(View.VISIBLE);
relatedStreamsView.addView(infoItemBuilder.buildView(relatedStreamsView, info.next_video)); relatedStreamsView.addView(infoItemBuilder.buildView(relatedStreamsView, info.getNextVideo()));
relatedStreamsView.addView(getSeparatorView()); relatedStreamsView.addView(getSeparatorView());
relatedStreamRootLayout.setVisibility(View.VISIBLE); relatedStreamRootLayout.setVisibility(View.VISIBLE);
} else nextStreamTitle.setVisibility(View.GONE); } else nextStreamTitle.setVisibility(View.GONE);
if (info.related_streams != null && !info.related_streams.isEmpty() && showRelatedStreams) { if (info.related_streams != null && !info.related_streams.isEmpty() && showRelatedStreams) {
//long first = System.nanoTime(), each; //long first = System.nanoTime(), each;
int to = info.related_streams.size() >= INITIAL_RELATED_VIDEOS ? INITIAL_RELATED_VIDEOS : info.related_streams.size(); int to = info.getRelatedStreams().size() >= INITIAL_RELATED_VIDEOS ? INITIAL_RELATED_VIDEOS : info.getRelatedStreams().size();
for (int i = 0; i < to; i++) { for (int i = 0; i < to; i++) {
InfoItem item = info.related_streams.get(i); InfoItem item = info.getRelatedStreams().get(i);
//each = System.nanoTime(); //each = System.nanoTime();
relatedStreamsView.addView(infoItemBuilder.buildView(relatedStreamsView, item)); relatedStreamsView.addView(infoItemBuilder.buildView(relatedStreamsView, item));
//if (DEBUG) Log.d(TAG, "each took " + ((System.nanoTime() - each) / 1000000L) + "ms"); //if (DEBUG) Log.d(TAG, "each took " + ((System.nanoTime() - each) / 1000000L) + "ms");
@ -572,7 +577,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
relatedStreamExpandButton.setImageDrawable(ContextCompat.getDrawable(activity, resolveResourceIdFromAttr(R.attr.expand))); relatedStreamExpandButton.setImageDrawable(ContextCompat.getDrawable(activity, resolveResourceIdFromAttr(R.attr.expand)));
} else { } else {
if (info.next_video == null) relatedStreamRootLayout.setVisibility(View.GONE); if (info.getNextVideo() == null) relatedStreamRootLayout.setVisibility(View.GONE);
relatedStreamExpandButton.setVisibility(View.GONE); relatedStreamExpandButton.setVisibility(View.GONE);
} }
} }
@ -616,14 +621,14 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
private void setupActionBarHandler(final StreamInfo info) { private void setupActionBarHandler(final StreamInfo info) {
if (DEBUG) Log.d(TAG, "setupActionBarHandler() called with: info = [" + info + "]"); if (DEBUG) Log.d(TAG, "setupActionBarHandler() called with: info = [" + info + "]");
sortedStreamVideosList = new ArrayList<>(ListHelper.getSortedStreamVideosList(activity, info.video_streams, info.video_only_streams, false)); sortedStreamVideosList = new ArrayList<>(ListHelper.getSortedStreamVideosList(activity, info.getVideoStreams(), info.getVideoOnlyStreams(), false));
actionBarHandler.setupStreamList(sortedStreamVideosList, spinnerToolbar); actionBarHandler.setupStreamList(sortedStreamVideosList, spinnerToolbar);
actionBarHandler.setOnShareListener(new ActionBarHandler.OnActionListener() { actionBarHandler.setOnShareListener(new ActionBarHandler.OnActionListener() {
@Override @Override
public void onActionSelected(int selectedStreamId) { public void onActionSelected(int selectedStreamId) {
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND); intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, info.url); intent.putExtra(Intent.EXTRA_TEXT, info.getUrl());
intent.setType("text/plain"); intent.setType("text/plain");
startActivity(Intent.createChooser(intent, activity.getString(R.string.share_dialog_title))); startActivity(Intent.createChooser(intent, activity.getString(R.string.share_dialog_title)));
} }
@ -634,7 +639,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
public void onActionSelected(int selectedStreamId) { public void onActionSelected(int selectedStreamId) {
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW); intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(info.url)); intent.setData(Uri.parse(info.getUrl()));
startActivity(Intent.createChooser(intent, activity.getString(R.string.choose_browser))); startActivity(Intent.createChooser(intent, activity.getString(R.string.choose_browser)));
} }
}); });
@ -643,7 +648,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
@Override @Override
public void onActionSelected(int selectedStreamId) { public void onActionSelected(int selectedStreamId) {
try { try {
NavigationHelper.playWithKore(activity, Uri.parse(info.url.replace("https", "http"))); NavigationHelper.playWithKore(activity, Uri.parse(info.getUrl().replace("https", "http")));
if(activity instanceof HistoryListener) { if(activity instanceof HistoryListener) {
((HistoryListener) activity).onVideoPlayed(info, null); ((HistoryListener) activity).onVideoPlayed(info, null);
} }
@ -742,7 +747,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
public void prepareAndHandleInfo(final StreamInfo info, boolean scrollToTop) { public void prepareAndHandleInfo(final StreamInfo info, boolean scrollToTop) {
if (DEBUG) Log.d(TAG, "prepareAndHandleInfo() called with: info = [" + info + "], scrollToTop = [" + scrollToTop + "]"); if (DEBUG) Log.d(TAG, "prepareAndHandleInfo() called with: info = [" + info + "], scrollToTop = [" + scrollToTop + "]");
setInitialData(info.service_id, info.url, info.name); setInitialData(info.getServiceId(), info.getUrl(), info.getName());
pushToStack(serviceId, url, name); pushToStack(serviceId, url, name);
showLoading(); showLoading();
@ -798,7 +803,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
private void openBackgroundPlayer(final boolean append) { private void openBackgroundPlayer(final boolean append) {
AudioStream audioStream = currentInfo.audio_streams.get(ListHelper.getDefaultAudioFormat(activity, currentInfo.audio_streams)); AudioStream audioStream = currentInfo.getAudioStreams().get(ListHelper.getDefaultAudioFormat(activity, currentInfo.getAudioStreams()));
if (activity instanceof HistoryListener) { if (activity instanceof HistoryListener) {
((HistoryListener) activity).onAudioPlayed(currentInfo, audioStream); ((HistoryListener) activity).onAudioPlayed(currentInfo, audioStream);
@ -868,9 +873,9 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
intent = new Intent(); intent = new Intent();
try { try {
intent.setAction(Intent.ACTION_VIEW); intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(audioStream.url), MediaFormat.getMimeById(audioStream.format)); intent.setDataAndType(Uri.parse(audioStream.getUrl()), audioStream.getFormat().getMimeType());
intent.putExtra(Intent.EXTRA_TITLE, currentInfo.name); intent.putExtra(Intent.EXTRA_TITLE, currentInfo.getName());
intent.putExtra("title", currentInfo.name); intent.putExtra("title", currentInfo.getName());
activity.startActivity(intent); activity.startActivity(intent);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -903,14 +908,14 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
if (!useOldPlayer) { if (!useOldPlayer) {
// ExoPlayer // ExoPlayer
final PlayQueue playQueue = new SinglePlayQueue(currentInfo); final PlayQueue playQueue = new SinglePlayQueue(currentInfo);
mIntent = NavigationHelper.getPlayerIntent(activity, MainVideoPlayer.class, playQueue, getSelectedVideoStream().resolution); mIntent = NavigationHelper.getPlayerIntent(activity, MainVideoPlayer.class, playQueue, getSelectedVideoStream().getResolution());
} else { } else {
// Internal Player // Internal Player
mIntent = new Intent(activity, PlayVideoActivity.class) mIntent = new Intent(activity, PlayVideoActivity.class)
.putExtra(PlayVideoActivity.VIDEO_TITLE, currentInfo.name) .putExtra(PlayVideoActivity.VIDEO_TITLE, currentInfo.getName())
.putExtra(PlayVideoActivity.STREAM_URL, selectedVideoStream.url) .putExtra(PlayVideoActivity.STREAM_URL, selectedVideoStream.getUrl())
.putExtra(PlayVideoActivity.VIDEO_URL, currentInfo.url) .putExtra(PlayVideoActivity.VIDEO_URL, currentInfo.getUrl())
.putExtra(PlayVideoActivity.START_POSITION, currentInfo.start_position); .putExtra(PlayVideoActivity.START_POSITION, currentInfo.getStartPosition());
} }
startActivity(mIntent); startActivity(mIntent);
} }
@ -920,9 +925,9 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
Intent intent = new Intent(); Intent intent = new Intent();
try { try {
intent.setAction(Intent.ACTION_VIEW) intent.setAction(Intent.ACTION_VIEW)
.setDataAndType(Uri.parse(selectedVideoStream.url), MediaFormat.getMimeById(selectedVideoStream.format)) .setDataAndType(Uri.parse(selectedVideoStream.getUrl()), selectedVideoStream.getFormat().getMimeType())
.putExtra(Intent.EXTRA_TITLE, currentInfo.name) .putExtra(Intent.EXTRA_TITLE, currentInfo.getName())
.putExtra("title", currentInfo.name); .putExtra("title", currentInfo.getName());
this.startActivity(intent); this.startActivity(intent);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -1095,20 +1100,28 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
public void handleResult(@NonNull StreamInfo info) { public void handleResult(@NonNull StreamInfo info) {
super.handleResult(info); super.handleResult(info);
setInitialData(info.service_id, info.url, info.name); setInitialData(info.getServiceId(), info.getUrl(), info.getName());
pushToStack(serviceId, url, name); pushToStack(serviceId, url, name);
animateView(thumbnailPlayButton, true, 200); animateView(thumbnailPlayButton, true, 200);
videoTitleTextView.setText(name); videoTitleTextView.setText(name);
if (!TextUtils.isEmpty(info.uploader_name)) uploaderTextView.setText(info.uploader_name); if (!TextUtils.isEmpty(info.getUploaderName())) {
uploaderTextView.setVisibility(!TextUtils.isEmpty(info.uploader_name) ? View.VISIBLE : View.GONE); uploaderTextView.setText(info.getUploaderName());
uploaderTextView.setVisibility(View.VISIBLE);
} else {
uploaderTextView.setVisibility(View.GONE);
}
uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy));
if (info.view_count >= 0) videoCountView.setText(Localization.localizeViewCount(activity, info.view_count)); if (info.getViewCount() >= 0) {
videoCountView.setVisibility(info.view_count >= 0 ? View.VISIBLE : View.GONE); videoCountView.setText(Localization.localizeViewCount(activity, info.getViewCount()));
videoCountView.setVisibility(View.VISIBLE);
} else {
videoCountView.setVisibility(View.GONE);
}
if (info.dislike_count == -1 && info.like_count == -1) { if (info.getDislikeCount() == -1 && info.getLikeCount() == -1) {
thumbsDownImageView.setVisibility(View.VISIBLE); thumbsDownImageView.setVisibility(View.VISIBLE);
thumbsUpImageView.setVisibility(View.VISIBLE); thumbsUpImageView.setVisibility(View.VISIBLE);
thumbsUpTextView.setVisibility(View.GONE); thumbsUpTextView.setVisibility(View.GONE);
@ -1116,14 +1129,23 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
thumbsDisabledTextView.setVisibility(View.VISIBLE); thumbsDisabledTextView.setVisibility(View.VISIBLE);
} else { } else {
if (info.dislike_count >= 0) thumbsDownTextView.setText(Localization.shortCount(activity, info.dislike_count)); if (info.getDislikeCount() >= 0) {
thumbsDownTextView.setVisibility(info.dislike_count >= 0 ? View.VISIBLE : View.GONE); thumbsDownTextView.setText(Localization.shortCount(activity, info.getDislikeCount()));
thumbsDownImageView.setVisibility(info.dislike_count >= 0 ? View.VISIBLE : View.GONE); thumbsDownTextView.setVisibility(View.VISIBLE);
thumbsDownImageView.setVisibility(View.VISIBLE);
if (info.like_count >= 0) thumbsUpTextView.setText(Localization.shortCount(activity, info.like_count)); } else {
thumbsUpTextView.setVisibility(info.like_count >= 0 ? View.VISIBLE : View.GONE); thumbsDownTextView.setVisibility(View.GONE);
thumbsUpImageView.setVisibility(info.like_count >= 0 ? View.VISIBLE : View.GONE); thumbsDownImageView.setVisibility(View.GONE);
}
if (info.getLikeCount() >= 0) {
thumbsUpTextView.setText(Localization.shortCount(activity, info.getLikeCount()));
thumbsUpTextView.setVisibility(View.VISIBLE);
thumbsUpImageView.setVisibility(View.VISIBLE);
} else {
thumbsUpTextView.setVisibility(View.GONE);
thumbsUpImageView.setVisibility(View.GONE);
}
thumbsDisabledTextView.setVisibility(View.GONE); thumbsDisabledTextView.setVisibility(View.GONE);
} }
@ -1132,10 +1154,10 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); videoTitleToggleArrow.setImageResource(R.drawable.arrow_down);
videoDescriptionView.setVisibility(View.GONE); videoDescriptionView.setVisibility(View.GONE);
videoDescriptionRootLayout.setVisibility(View.GONE); videoDescriptionRootLayout.setVisibility(View.GONE);
if (!TextUtils.isEmpty(info.upload_date)) { if (!TextUtils.isEmpty(info.getUploadDate())) {
videoUploadDateView.setText(Localization.localizeDate(activity, info.upload_date)); videoUploadDateView.setText(Localization.localizeDate(activity, info.getUploadDate()));
} }
prepareDescription(info.description); prepareDescription(info.getDescription());
animateView(spinnerToolbar, true, 500); animateView(spinnerToolbar, true, 500);
setupActionBarHandler(info); setupActionBarHandler(info);
@ -1145,10 +1167,10 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
toggleExpandRelatedVideos(currentInfo); toggleExpandRelatedVideos(currentInfo);
wasRelatedStreamsExpanded = false; wasRelatedStreamsExpanded = false;
} }
setTitleToUrl(info.service_id, info.url, info.name); setTitleToUrl(info.getServiceId(), info.getUrl(), info.getName());
if (!info.errors.isEmpty()) { if (!info.getErrors().isEmpty()) {
showSnackBarError(info.errors, UserAction.REQUESTED_STREAM, NewPipe.getNameOfService(info.service_id), info.url, 0); showSnackBarError(info.getErrors(), UserAction.REQUESTED_STREAM, NewPipe.getNameOfService(info.getServiceId()), info.getUrl(), 0);
} }
if (autoPlayEnabled) { if (autoPlayEnabled) {

View File

@ -140,7 +140,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I> implem
onItemSelected(selectedItem); onItemSelected(selectedItem);
NavigationHelper.openVideoDetailFragment( NavigationHelper.openVideoDetailFragment(
useAsFrontPage?getParentFragment().getFragmentManager():getFragmentManager(), useAsFrontPage?getParentFragment().getFragmentManager():getFragmentManager(),
selectedItem.service_id, selectedItem.url, selectedItem.name); selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
} }
@Override @Override
@ -155,7 +155,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I> implem
onItemSelected(selectedItem); onItemSelected(selectedItem);
NavigationHelper.openChannelFragment( NavigationHelper.openChannelFragment(
useAsFrontPage?getParentFragment().getFragmentManager():getFragmentManager(), useAsFrontPage?getParentFragment().getFragmentManager():getFragmentManager(),
selectedItem.service_id, selectedItem.url, selectedItem.name); selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
} }
@Override @Override
@ -168,7 +168,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I> implem
onItemSelected(selectedItem); onItemSelected(selectedItem);
NavigationHelper.openPlaylistFragment( NavigationHelper.openPlaylistFragment(
useAsFrontPage?getParentFragment().getFragmentManager():getFragmentManager(), useAsFrontPage?getParentFragment().getFragmentManager():getFragmentManager(),
selectedItem.service_id, selectedItem.url, selectedItem.name); selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
} }
@Override @Override

View File

@ -190,8 +190,8 @@ public abstract class BaseListInfoFragment<I extends ListInfo> extends BaseListF
public void handleResult(@NonNull I result) { public void handleResult(@NonNull I result) {
super.handleResult(result); super.handleResult(result);
url = result.url; url = result.getUrl();
name = result.name; name = result.getName();
setTitle(name); setTitle(name);
if (infoListAdapter.getItemsList().size() == 0) { if (infoListAdapter.getItemsList().size() == 0) {

View File

@ -105,7 +105,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
&& useAsFrontPage && useAsFrontPage
&& isVisibleToUser) { && isVisibleToUser) {
try { try {
activity.getSupportActionBar().setTitle(currentInfo.name); activity.getSupportActionBar().setTitle(currentInfo.getName());
} catch (Exception e) { } catch (Exception e) {
onError(e); onError(e);
} }
@ -208,7 +208,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
if (DEBUG) Log.d(TAG, "onCreateOptionsMenu() called with: menu = [" + menu + "], inflater = [" + inflater + "]"); if (DEBUG) Log.d(TAG, "onCreateOptionsMenu() called with: menu = [" + menu + "], inflater = [" + inflater + "]");
menuRssButton = menu.findItem(R.id.menu_item_rss); menuRssButton = menu.findItem(R.id.menu_item_rss);
if (currentInfo != null) { if (currentInfo != null) {
menuRssButton.setVisible(!TextUtils.isEmpty(currentInfo.feed_url)); menuRssButton.setVisible(!TextUtils.isEmpty(currentInfo.getFeedUrl()));
} }
} }
@ -217,7 +217,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
private void openRssFeed() { private void openRssFeed() {
final ChannelInfo info = currentInfo; final ChannelInfo info = currentInfo;
if(info != null) { if(info != null) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(info.feed_url)); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(info.getFeedUrl()));
startActivity(intent); startActivity(intent);
} }
} }
@ -264,12 +264,12 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
@Override @Override
public void accept(Throwable throwable) throws Exception { public void accept(Throwable throwable) throws Exception {
animateView(headerSubscribeButton, false, 100); animateView(headerSubscribeButton, false, 100);
showSnackBarError(throwable, UserAction.SUBSCRIPTION, NewPipe.getNameOfService(currentInfo.service_id), "Get subscription status", 0); showSnackBarError(throwable, UserAction.SUBSCRIPTION, NewPipe.getNameOfService(currentInfo.getServiceId()), "Get subscription status", 0);
} }
}; };
final Observable<List<SubscriptionEntity>> observable = subscriptionService.subscriptionTable() final Observable<List<SubscriptionEntity>> observable = subscriptionService.subscriptionTable()
.getSubscription(info.service_id, info.url) .getSubscription(info.getServiceId(), info.getUrl())
.toObservable(); .toObservable();
disposables.add(observable disposables.add(observable
@ -315,14 +315,14 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
final Action onComplete = new Action() { final Action onComplete = new Action() {
@Override @Override
public void run() throws Exception { public void run() throws Exception {
if (DEBUG) Log.d(TAG, "Updated subscription: " + info.url); if (DEBUG) Log.d(TAG, "Updated subscription: " + info.getUrl());
} }
}; };
final Consumer<Throwable> onError = new Consumer<Throwable>() { final Consumer<Throwable> onError = new Consumer<Throwable>() {
@Override @Override
public void accept(@NonNull Throwable throwable) throws Exception { public void accept(@NonNull Throwable throwable) throws Exception {
onUnrecoverableError(throwable, UserAction.SUBSCRIPTION, NewPipe.getNameOfService(info.service_id), "Updating Subscription for " + info.url, R.string.subscription_update_failed); onUnrecoverableError(throwable, UserAction.SUBSCRIPTION, NewPipe.getNameOfService(info.getServiceId()), "Updating Subscription for " + info.getUrl(), R.string.subscription_update_failed);
} }
}; };
@ -343,7 +343,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
final Consumer<Throwable> onError = new Consumer<Throwable>() { final Consumer<Throwable> onError = new Consumer<Throwable>() {
@Override @Override
public void accept(@NonNull Throwable throwable) throws Exception { public void accept(@NonNull Throwable throwable) throws Exception {
onUnrecoverableError(throwable, UserAction.SUBSCRIPTION, NewPipe.getNameOfService(currentInfo.service_id), "Subscription Change", R.string.subscription_change_failed); onUnrecoverableError(throwable, UserAction.SUBSCRIPTION, NewPipe.getNameOfService(currentInfo.getServiceId()), "Subscription Change", R.string.subscription_change_failed);
} }
}; };
@ -367,9 +367,9 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
if (subscriptionEntities.isEmpty()) { if (subscriptionEntities.isEmpty()) {
if (DEBUG) Log.d(TAG, "No subscription to this channel!"); if (DEBUG) Log.d(TAG, "No subscription to this channel!");
SubscriptionEntity channel = new SubscriptionEntity(); SubscriptionEntity channel = new SubscriptionEntity();
channel.setServiceId(info.service_id); channel.setServiceId(info.getServiceId());
channel.setUrl(info.url); channel.setUrl(info.getUrl());
channel.setData(info.name, info.avatar_url, info.description, info.subscriber_count); channel.setData(info.getName(), info.getAvatarUrl(), info.getDescription(), info.getSubscriberCount());
subscribeButtonMonitor = monitorSubscribeButton(headerSubscribeButton, mapOnSubscribe(channel)); subscribeButtonMonitor = monitorSubscribeButton(headerSubscribeButton, mapOnSubscribe(channel));
} else { } else {
if (DEBUG) Log.d(TAG, "Found subscription to this channel!"); if (DEBUG) Log.d(TAG, "Found subscription to this channel!");
@ -440,16 +440,16 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
imageLoader.displayImage(result.banner_url, headerChannelBanner, DISPLAY_BANNER_OPTIONS); imageLoader.displayImage(result.banner_url, headerChannelBanner, DISPLAY_BANNER_OPTIONS);
imageLoader.displayImage(result.avatar_url, headerAvatarView, DISPLAY_AVATAR_OPTIONS); imageLoader.displayImage(result.avatar_url, headerAvatarView, DISPLAY_AVATAR_OPTIONS);
if (result.subscriber_count != -1) { if (result.getSubscriberCount() != -1) {
headerSubscribersTextView.setText(Localization.localizeSubscribersCount(activity, result.subscriber_count)); headerSubscribersTextView.setText(Localization.localizeSubscribersCount(activity, result.getSubscriberCount()));
headerSubscribersTextView.setVisibility(View.VISIBLE); headerSubscribersTextView.setVisibility(View.VISIBLE);
} else headerSubscribersTextView.setVisibility(View.GONE); } else headerSubscribersTextView.setVisibility(View.GONE);
if (menuRssButton != null) menuRssButton.setVisible(!TextUtils.isEmpty(result.feed_url)); if (menuRssButton != null) menuRssButton.setVisible(!TextUtils.isEmpty(result.getFeedUrl()));
playlistCtrl.setVisibility(View.VISIBLE); playlistCtrl.setVisibility(View.VISIBLE);
if (!result.errors.isEmpty()) { if (!result.errors.isEmpty()) {
showSnackBarError(result.errors, UserAction.REQUESTED_CHANNEL, NewPipe.getNameOfService(result.service_id), result.url, 0); showSnackBarError(result.errors, UserAction.REQUESTED_CHANNEL, NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);
} }
if (disposables != null) disposables.clear(); if (disposables != null) disposables.clear();
@ -490,9 +490,9 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
private PlayQueue getPlayQueue(final int index) { private PlayQueue getPlayQueue(final int index) {
return new ChannelPlayQueue( return new ChannelPlayQueue(
currentInfo.service_id, currentInfo.getServiceId(),
currentInfo.url, currentInfo.getUrl(),
currentInfo.next_streams_url, currentInfo.getNextStreamsUrl(),
infoListAdapter.getItemsList(), infoListAdapter.getItemsList(),
index index
); );
@ -502,8 +502,8 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
public void handleNextItems(ListExtractor.NextItemsResult result) { public void handleNextItems(ListExtractor.NextItemsResult result) {
super.handleNextItems(result); super.handleNextItems(result);
if (!result.errors.isEmpty()) { if (!result.getErrors().isEmpty()) {
showSnackBarError(result.errors, UserAction.REQUESTED_CHANNEL, NewPipe.getNameOfService(serviceId), showSnackBarError(result.getErrors(), UserAction.REQUESTED_CHANNEL, NewPipe.getNameOfService(serviceId),
"Get next page of: " + url, R.string.general_error); "Get next page of: " + url, R.string.general_error);
} }
} }

View File

@ -297,12 +297,12 @@ public class FeedFragment extends BaseListFragment<List<SubscriptionEntity>, Voi
// Called only when response is non-empty // Called only when response is non-empty
@Override @Override
public void onSuccess(final ChannelInfo channelInfo) { public void onSuccess(final ChannelInfo channelInfo) {
if (infoListAdapter == null || channelInfo.related_streams.isEmpty()) { if (infoListAdapter == null || channelInfo.getRelatedStreams().isEmpty()) {
onDone(); onDone();
return; return;
} }
final InfoItem item = channelInfo.related_streams.get(0); final InfoItem item = channelInfo.getRelatedStreams().get(0);
// Keep requesting new items if the current one already exists // Keep requesting new items if the current one already exists
boolean itemExists = doesItemExist(infoListAdapter.getItemsList(), item); boolean itemExists = doesItemExist(infoListAdapter.getItemsList(), item);
if (!itemExists) { if (!itemExists) {
@ -412,9 +412,9 @@ public class FeedFragment extends BaseListFragment<List<SubscriptionEntity>, Voi
private boolean doesItemExist(final List<InfoItem> items, final InfoItem item) { private boolean doesItemExist(final List<InfoItem> items, final InfoItem item) {
for (final InfoItem existingItem : items) { for (final InfoItem existingItem : items) {
if (existingItem.info_type == item.info_type && if (existingItem.info_type == item.info_type &&
existingItem.service_id == item.service_id && existingItem.getServiceId() == item.getServiceId() &&
existingItem.name.equals(item.name) && existingItem.getName().equals(item.getName()) &&
existingItem.url.equals(item.url)) return true; existingItem.getUrl().equals(item.getUrl())) return true;
} }
return false; return false;
} }

View File

@ -155,10 +155,10 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
ActionBar supportActionBar = activity.getSupportActionBar(); ActionBar supportActionBar = activity.getSupportActionBar();
supportActionBar.setTitle(title); supportActionBar.setTitle(title);
if (!result.errors.isEmpty()) { if (!result.getErrors().isEmpty()) {
showSnackBarError(result.errors, showSnackBarError(result.getErrors(),
UserAction.REQUESTED_PLAYLIST, UserAction.REQUESTED_PLAYLIST,
NewPipe.getNameOfService(result.service_id), result.url, 0); NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);
} }
} }
@ -166,8 +166,8 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
public void handleNextItems(ListExtractor.NextItemsResult result) { public void handleNextItems(ListExtractor.NextItemsResult result) {
super.handleNextItems(result); super.handleNextItems(result);
if (!result.errors.isEmpty()) { if (!result.getErrors().isEmpty()) {
showSnackBarError(result.errors, showSnackBarError(result.getErrors(),
UserAction.REQUESTED_PLAYLIST, NewPipe.getNameOfService(serviceId) UserAction.REQUESTED_PLAYLIST, NewPipe.getNameOfService(serviceId)
, "Get next page of: " + url, 0); , "Get next page of: " + url, 0);
} }

View File

@ -181,13 +181,13 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
animateView(headerRootLayout, true, 100); animateView(headerRootLayout, true, 100);
animateView(headerUploaderLayout, true, 300); animateView(headerUploaderLayout, true, 300);
headerUploaderLayout.setOnClickListener(null); headerUploaderLayout.setOnClickListener(null);
if (!TextUtils.isEmpty(result.uploader_name)) { if (!TextUtils.isEmpty(result.getUploaderName())) {
headerUploaderName.setText(result.uploader_name); headerUploaderName.setText(result.getUploaderName());
if (!TextUtils.isEmpty(result.uploader_url)) { if (!TextUtils.isEmpty(result.getUploaderUrl())) {
headerUploaderLayout.setOnClickListener(new View.OnClickListener() { headerUploaderLayout.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
NavigationHelper.openChannelFragment(getFragmentManager(), result.service_id, result.uploader_url, result.uploader_name); NavigationHelper.openChannelFragment(getFragmentManager(), result.getServiceId(), result.getUploaderUrl(), result.getUploaderName());
} }
}); });
} }
@ -195,11 +195,11 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
playlistCtrl.setVisibility(View.VISIBLE); playlistCtrl.setVisibility(View.VISIBLE);
imageLoader.displayImage(result.uploader_avatar_url, headerUploaderAvatar, DISPLAY_AVATAR_OPTIONS); imageLoader.displayImage(result.getUploaderAvatarUrl(), headerUploaderAvatar, DISPLAY_AVATAR_OPTIONS);
headerStreamCount.setText(getResources().getQuantityString(R.plurals.videos, (int) result.stream_count, (int) result.stream_count)); headerStreamCount.setText(getResources().getQuantityString(R.plurals.videos, (int) result.stream_count, (int) result.stream_count));
if (!result.errors.isEmpty()) { if (!result.getErrors().isEmpty()) {
showSnackBarError(result.errors, UserAction.REQUESTED_PLAYLIST, NewPipe.getNameOfService(result.service_id), result.url, 0); showSnackBarError(result.getErrors(), UserAction.REQUESTED_PLAYLIST, NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);
} }
headerPlayAllButton.setOnClickListener(new View.OnClickListener() { headerPlayAllButton.setOnClickListener(new View.OnClickListener() {
@ -235,9 +235,9 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
private PlayQueue getPlayQueue(final int index) { private PlayQueue getPlayQueue(final int index) {
return new PlaylistPlayQueue( return new PlaylistPlayQueue(
currentInfo.service_id, currentInfo.getServiceId(),
currentInfo.url, currentInfo.getUrl(),
currentInfo.next_streams_url, currentInfo.getNextStreamsUrl(),
infoListAdapter.getItemsList(), infoListAdapter.getItemsList(),
index index
); );
@ -247,8 +247,8 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
public void handleNextItems(ListExtractor.NextItemsResult result) { public void handleNextItems(ListExtractor.NextItemsResult result) {
super.handleNextItems(result); super.handleNextItems(result);
if (!result.errors.isEmpty()) { if (!result.getErrors().isEmpty()) {
showSnackBarError(result.errors, UserAction.REQUESTED_PLAYLIST, NewPipe.getNameOfService(serviceId) showSnackBarError(result.getErrors(), UserAction.REQUESTED_PLAYLIST, NewPipe.getNameOfService(serviceId)
, "Get next page of: " + url, 0); , "Get next page of: " + url, 0);
} }
} }

View File

@ -861,8 +861,8 @@ public class SearchFragment extends BaseListFragment<SearchResult, ListExtractor
lastSearchedQuery = searchQuery; lastSearchedQuery = searchQuery;
if (infoListAdapter.getItemsList().size() == 0) { if (infoListAdapter.getItemsList().size() == 0) {
if (result.resultList.size() > 0) { if (!result.getResults().isEmpty()) {
infoListAdapter.addInfoItemList(result.resultList); infoListAdapter.addInfoItemList(result.getResults());
} else { } else {
infoListAdapter.clearStreamItemList(); infoListAdapter.clearStreamItemList();
showEmptyState(); showEmptyState();
@ -876,11 +876,11 @@ public class SearchFragment extends BaseListFragment<SearchResult, ListExtractor
@Override @Override
public void handleNextItems(ListExtractor.NextItemsResult result) { public void handleNextItems(ListExtractor.NextItemsResult result) {
showListFooter(false); showListFooter(false);
currentPage = Integer.parseInt(result.nextItemsUrl); currentPage = Integer.parseInt(result.getNextItemsUrl());
infoListAdapter.addInfoItemList(result.nextItemsList); infoListAdapter.addInfoItemList(result.getNextItemsList());
if (!result.errors.isEmpty()) { if (!result.getErrors().isEmpty()) {
showSnackBarError(result.errors, UserAction.SEARCHED, NewPipe.getNameOfService(serviceId) showSnackBarError(result.getErrors(), UserAction.SEARCHED, NewPipe.getNameOfService(serviceId)
, "\"" + searchQuery + "\" → page " + currentPage, 0); , "\"" + searchQuery + "\" → page " + currentPage, 0);
} }
super.handleNextItems(result); super.handleNextItems(result);

View File

@ -129,7 +129,7 @@ public class SubscriptionFragment extends BaseStateFragment<List<SubscriptionEnt
@Override @Override
public void selected(ChannelInfoItem selectedItem) { public void selected(ChannelInfoItem selectedItem) {
// Requires the parent fragment to find holder for fragment replacement // Requires the parent fragment to find holder for fragment replacement
NavigationHelper.openChannelFragment(getParentFragment().getFragmentManager(), selectedItem.service_id, selectedItem.url, selectedItem.name); NavigationHelper.openChannelFragment(getParentFragment().getFragmentManager(), selectedItem.getServiceId(), selectedItem.url, selectedItem.getName());
} }

View File

@ -112,7 +112,7 @@ public class SubscriptionService {
// Subscriber count changes very often, making this check almost unnecessary. // Subscriber count changes very often, making this check almost unnecessary.
// Consider removing it later. // Consider removing it later.
if (!isSubscriptionUpToDate(info, subscription)) { if (!isSubscriptionUpToDate(info, subscription)) {
subscription.setData(info.name, info.avatar_url, info.description, info.subscriber_count); subscription.setData(info.getName(), info.getAvatarUrl(), info.getDescription(), info.getSubscriberCount());
return update(subscription); return update(subscription);
} }
@ -122,7 +122,7 @@ public class SubscriptionService {
} }
}; };
return subscriptionTable().getSubscription(info.service_id, info.url) return subscriptionTable().getSubscription(info.getServiceId(), info.getUrl())
.firstOrError() .firstOrError()
.flatMapCompletable(update); .flatMapCompletable(update);
} }
@ -137,11 +137,11 @@ public class SubscriptionService {
} }
private boolean isSubscriptionUpToDate(final ChannelInfo info, final SubscriptionEntity entity) { private boolean isSubscriptionUpToDate(final ChannelInfo info, final SubscriptionEntity entity) {
return info.url.equals(entity.getUrl()) && return info.getUrl().equals(entity.getUrl()) &&
info.service_id == entity.getServiceId() && info.getServiceId() == entity.getServiceId() &&
info.name.equals(entity.getName()) && info.getName().equals(entity.getName()) &&
info.avatar_url.equals(entity.getAvatarUrl()) && info.getAvatarUrl().equals(entity.getAvatarUrl()) &&
info.description.equals(entity.getDescription()) && info.getDescription().equals(entity.getDescription()) &&
info.subscriber_count == entity.getSubscriberCount(); info.getSubscriberCount() == entity.getSubscriberCount();
} }
} }

View File

@ -19,7 +19,7 @@ public class InfoItemDialog {
@NonNull final StreamInfoItem info, @NonNull final StreamInfoItem info,
@NonNull final String[] commands, @NonNull final String[] commands,
@NonNull final DialogInterface.OnClickListener actions) { @NonNull final DialogInterface.OnClickListener actions) {
this(activity, commands, actions, info.name, info.uploader_name); this(activity, commands, actions, info.getName(), info.uploader_name);
} }
public InfoItemDialog(@NonNull final Activity activity, public InfoItemDialog(@NonNull final Activity activity,

View File

@ -36,7 +36,7 @@ public class ChannelMiniInfoItemHolder extends InfoItemHolder {
if (!(infoItem instanceof ChannelInfoItem)) return; if (!(infoItem instanceof ChannelInfoItem)) return;
final ChannelInfoItem item = (ChannelInfoItem) infoItem; final ChannelInfoItem item = (ChannelInfoItem) infoItem;
itemTitleView.setText(item.name); itemTitleView.setText(item.getName());
itemAdditionalDetailView.setText(getDetailLine(item)); itemAdditionalDetailView.setText(getDetailLine(item));
itemBuilder.getImageLoader() itemBuilder.getImageLoader()

View File

@ -32,7 +32,7 @@ public class PlaylistInfoItemHolder extends InfoItemHolder {
if (!(infoItem instanceof PlaylistInfoItem)) return; if (!(infoItem instanceof PlaylistInfoItem)) return;
final PlaylistInfoItem item = (PlaylistInfoItem) infoItem; final PlaylistInfoItem item = (PlaylistInfoItem) infoItem;
itemTitleView.setText(item.name); itemTitleView.setText(item.getName());
itemStreamCountView.setText(item.stream_count + ""); itemStreamCountView.setText(item.stream_count + "");
itemUploaderView.setText(item.uploader_name); itemUploaderView.setText(item.uploader_name);

View File

@ -40,7 +40,7 @@ public class StreamMiniInfoItemHolder extends InfoItemHolder {
if (!(infoItem instanceof StreamInfoItem)) return; if (!(infoItem instanceof StreamInfoItem)) return;
final StreamInfoItem item = (StreamInfoItem) infoItem; final StreamInfoItem item = (StreamInfoItem) infoItem;
itemVideoTitleView.setText(item.name); itemVideoTitleView.setText(item.getName());
itemUploaderView.setText(item.uploader_name); itemUploaderView.setText(item.uploader_name);
if (item.duration > 0) { if (item.duration > 0) {

View File

@ -393,7 +393,7 @@ public final class BackgroundPlayer extends Service {
if (index < 0 || index >= info.audio_streams.size()) return null; if (index < 0 || index >= info.audio_streams.size()) return null;
final AudioStream audio = info.audio_streams.get(index); final AudioStream audio = info.audio_streams.get(index);
return buildMediaSource(audio.url, MediaFormat.getSuffixById(audio.format)); return buildMediaSource(audio.getUrl(), MediaFormat.getSuffixById(audio.format));
} }
@Override @Override

View File

@ -462,7 +462,7 @@ public final class PopupVideoPlayer extends Service {
} else { } else {
intent = new Intent(PopupVideoPlayer.this, PlayVideoActivity.class) intent = new Intent(PopupVideoPlayer.this, PlayVideoActivity.class)
.putExtra(PlayVideoActivity.VIDEO_TITLE, getVideoTitle()) .putExtra(PlayVideoActivity.VIDEO_TITLE, getVideoTitle())
.putExtra(PlayVideoActivity.STREAM_URL, getSelectedVideoStream().url) .putExtra(PlayVideoActivity.STREAM_URL, getSelectedVideoStream().getUrl())
.putExtra(PlayVideoActivity.VIDEO_URL, getVideoUrl()) .putExtra(PlayVideoActivity.VIDEO_URL, getVideoUrl())
.putExtra(PlayVideoActivity.START_POSITION, Math.round(getPlayer().getCurrentPosition() / 1000f)); .putExtra(PlayVideoActivity.START_POSITION, Math.round(getPlayer().getCurrentPosition() / 1000f));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

View File

@ -529,7 +529,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
@Override @Override
public void onMetadataUpdate(StreamInfo info) { public void onMetadataUpdate(StreamInfo info) {
if (info != null) { if (info != null) {
metadataTitle.setText(info.name); metadataTitle.setText(info.getName());
metadataArtist.setText(info.uploader_name); metadataArtist.setText(info.uploader_name);
scrollToSelected(); scrollToSelected();
} }

View File

@ -282,12 +282,12 @@ public abstract class VideoPlayer extends BasePlayer implements SimpleExoPlayer.
if (index < 0 || index >= videos.size()) return null; if (index < 0 || index >= videos.size()) return null;
final VideoStream video = videos.get(index); final VideoStream video = videos.get(index);
final MediaSource streamSource = buildMediaSource(video.url, MediaFormat.getSuffixById(video.format)); final MediaSource streamSource = buildMediaSource(video.getUrl(), MediaFormat.getSuffixById(video.format));
final AudioStream audio = ListHelper.getHighestQualityAudio(info.audio_streams); final AudioStream audio = ListHelper.getHighestQualityAudio(info.audio_streams);
if (!video.isVideoOnly || audio == null) return streamSource; if (!video.isVideoOnly || audio == null) return streamSource;
// Merge with audio stream in case if video does not contain audio // Merge with audio stream in case if video does not contain audio
final MediaSource audioSource = buildMediaSource(audio.url, MediaFormat.getSuffixById(audio.format)); final MediaSource audioSource = buildMediaSource(audio.getUrl(), MediaFormat.getSuffixById(audio.format));
return new MergingMediaSource(streamSource, audioSource); return new MergingMediaSource(streamSource, audioSource);
} }

View File

@ -26,7 +26,7 @@ abstract class AbstractInfoPlayQueue<T extends ListInfo, U extends InfoItem> ext
transient Disposable fetchReactor; transient Disposable fetchReactor;
AbstractInfoPlayQueue(final U item) { AbstractInfoPlayQueue(final U item) {
this(item.service_id, item.url, null, Collections.<InfoItem>emptyList(), 0); this(item.getServiceId(), item.getUrl(), null, Collections.<InfoItem>emptyList(), 0);
} }
AbstractInfoPlayQueue(final int serviceId, AbstractInfoPlayQueue(final int serviceId,

View File

@ -30,12 +30,12 @@ public class PlayQueueItem implements Serializable {
private transient Single<StreamInfo> stream; private transient Single<StreamInfo> stream;
PlayQueueItem(@NonNull final StreamInfo info) { PlayQueueItem(@NonNull final StreamInfo info) {
this(info.name, info.url, info.service_id, info.duration, info.thumbnail_url, info.uploader_name); this(info.getName(), info.getUrl(), info.getServiceId(), info.duration, info.thumbnail_url, info.uploader_name);
this.stream = Single.just(info); this.stream = Single.just(info);
} }
PlayQueueItem(@NonNull final StreamInfoItem item) { PlayQueueItem(@NonNull final StreamInfoItem item) {
this(item.name, item.url, item.service_id, item.duration, item.thumbnail_url, item.uploader_name); this(item.getName(), item.getUrl(), item.getServiceId(), item.duration, item.thumbnail_url, item.uploader_name);
} }
private PlayQueueItem(final String name, final String url, final int serviceId, private PlayQueueItem(final String name, final String url, final int serviceId,

View File

@ -103,7 +103,7 @@ public final class InfoCache {
} }
private static String keyOf(@NonNull final Info info) { private static String keyOf(@NonNull final Info info) {
return keyOf(info.service_id, info.url); return keyOf(info.getServiceId(), info.getUrl());
} }
private static String keyOf(final int serviceId, @NonNull final String url) { private static String keyOf(final int serviceId, @NonNull final String url) {

View File

@ -95,7 +95,7 @@ public final class ListHelper {
int highestQualityIndex = 0; int highestQualityIndex = 0;
if (audioStreams.size() > 1) for (int i = 1; i < audioStreams.size(); i++) { if (audioStreams.size() > 1) for (int i = 1; i < audioStreams.size(); i++) {
AudioStream audioStream = audioStreams.get(i); AudioStream audioStream = audioStreams.get(i);
if (audioStream.average_bitrate >= audioStreams.get(highestQualityIndex).average_bitrate) highestQualityIndex = i; if (audioStream.getAverageBitrate() >= audioStreams.get(highestQualityIndex).getAverageBitrate()) highestQualityIndex = i;
} }
return highestQualityIndex; return highestQualityIndex;
} }
@ -124,10 +124,10 @@ public final class ListHelper {
int highestQualityIndex = -1; int highestQualityIndex = -1;
for (int i = 0; i < audioStreams.size(); i++) { for (int i = 0; i < audioStreams.size(); i++) {
AudioStream audioStream = audioStreams.get(i); AudioStream audioStream = audioStreams.get(i);
if (highestQualityIndex == -1 && audioStream.format == defaultFormat.id) highestQualityIndex = i; if (highestQualityIndex == -1 && audioStream.getFormat() == defaultFormat) highestQualityIndex = i;
if (highestQualityIndex != -1 && audioStream.format == defaultFormat.id if (highestQualityIndex != -1 && audioStream.getFormat() == defaultFormat
&& audioStream.average_bitrate > audioStreams.get(highestQualityIndex).average_bitrate) { && audioStream.getAverageBitrate() > audioStreams.get(highestQualityIndex).getAverageBitrate()) {
highestQualityIndex = i; highestQualityIndex = i;
} }
} }
@ -171,23 +171,23 @@ public final class ListHelper {
if (videoOnlyStreams != null) { if (videoOnlyStreams != null) {
for (VideoStream stream : videoOnlyStreams) { for (VideoStream stream : videoOnlyStreams) {
if (!showHigherResolutions && HIGH_RESOLUTION_LIST.contains(stream.resolution)) continue; if (!showHigherResolutions && HIGH_RESOLUTION_LIST.contains(stream.getResolution())) continue;
retList.add(stream); retList.add(stream);
} }
} }
if (videoStreams != null) { if (videoStreams != null) {
for (VideoStream stream : videoStreams) { for (VideoStream stream : videoStreams) {
if (!showHigherResolutions && HIGH_RESOLUTION_LIST.contains(stream.resolution)) continue; if (!showHigherResolutions && HIGH_RESOLUTION_LIST.contains(stream.getResolution())) continue;
retList.add(stream); retList.add(stream);
} }
} }
// Add all to the hashmap // Add all to the hashmap
for (VideoStream videoStream : retList) hashMap.put(videoStream.resolution, videoStream); for (VideoStream videoStream : retList) hashMap.put(videoStream.getResolution(), videoStream);
// Override the values when the key == resolution, with the defaultFormat // Override the values when the key == resolution, with the defaultFormat
for (VideoStream videoStream : retList) { for (VideoStream videoStream : retList) {
if (videoStream.format == defaultFormat.id) hashMap.put(videoStream.resolution, videoStream); if (videoStream.getFormat() == defaultFormat) hashMap.put(videoStream.getResolution(), videoStream);
} }
retList.clear(); retList.clear();
@ -219,8 +219,8 @@ public final class ListHelper {
Collections.sort(videoStreams, new Comparator<VideoStream>() { Collections.sort(videoStreams, new Comparator<VideoStream>() {
@Override @Override
public int compare(VideoStream o1, VideoStream o2) { public int compare(VideoStream o1, VideoStream o2) {
int res1 = Integer.parseInt(o1.resolution.replace("0p60", "1").replaceAll("[^\\d.]", "")); int res1 = Integer.parseInt(o1.getResolution().replace("0p60", "1").replaceAll("[^\\d.]", ""));
int res2 = Integer.parseInt(o2.resolution.replace("0p60", "1").replaceAll("[^\\d.]", "")); int res2 = Integer.parseInt(o2.getResolution().replace("0p60", "1").replaceAll("[^\\d.]", ""));
return ascendingOrder ? res1 - res2 : res2 - res1; return ascendingOrder ? res1 - res2 : res2 - res1;
} }
@ -235,9 +235,9 @@ public final class ListHelper {
int defaultStreamIndex = -1; int defaultStreamIndex = -1;
for (int i = 0; i < videoStreams.size(); i++) { for (int i = 0; i < videoStreams.size(); i++) {
VideoStream stream = videoStreams.get(i); VideoStream stream = videoStreams.get(i);
if (defaultStreamIndex == -1 && stream.resolution.equals(defaultResolution)) defaultStreamIndex = i; if (defaultStreamIndex == -1 && stream.getResolution().equals(defaultResolution)) defaultStreamIndex = i;
if (stream.format == defaultFormat.id && stream.resolution.equals(defaultResolution)) { if (stream.getFormat() == defaultFormat && stream.getResolution().equals(defaultResolution)) {
return i; return i;
} }
} }

View File

@ -20,7 +20,9 @@ import org.schabi.newpipe.download.DownloadActivity;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.ServiceList; import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.fragments.MainFragment; import org.schabi.newpipe.fragments.MainFragment;
import org.schabi.newpipe.fragments.detail.VideoDetailFragment; import org.schabi.newpipe.fragments.detail.VideoDetailFragment;
import org.schabi.newpipe.fragments.list.channel.ChannelFragment; import org.schabi.newpipe.fragments.list.channel.ChannelFragment;