bring everything to compile and run
This commit is contained in:
parent
d10f9a5f25
commit
d5a500c037
15 changed files with 238 additions and 138 deletions
|
@ -54,7 +54,7 @@ dependencies {
|
||||||
exclude module: 'support-annotations'
|
exclude module: 'support-annotations'
|
||||||
}
|
}
|
||||||
|
|
||||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:39332a283b1c911'
|
implementation 'com.github.TeamNewPipe:NewPipeExtractor:4746a1c48a8682'
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:2.8.9'
|
testImplementation 'org.mockito:mockito-core:2.8.9'
|
||||||
|
|
|
@ -49,6 +49,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.StreamingService;
|
import org.schabi.newpipe.extractor.StreamingService;
|
||||||
|
import org.schabi.newpipe.extractor.uih.SearchQIHandler;
|
||||||
import org.schabi.newpipe.fragments.BackPressable;
|
import org.schabi.newpipe.fragments.BackPressable;
|
||||||
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;
|
||||||
|
@ -61,6 +62,8 @@ import org.schabi.newpipe.util.ServiceHelper;
|
||||||
import org.schabi.newpipe.util.StateSaver;
|
import org.schabi.newpipe.util.StateSaver;
|
||||||
import org.schabi.newpipe.util.ThemeHelper;
|
import org.schabi.newpipe.util.ThemeHelper;
|
||||||
|
|
||||||
|
import static org.schabi.newpipe.extractor.InfoItem.InfoType.PLAYLIST;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
private static final String TAG = "MainActivity";
|
private static final String TAG = "MainActivity";
|
||||||
public static final boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release");
|
public static final boolean DEBUG = !BuildConfig.BUILD_TYPE.equals("release");
|
||||||
|
@ -392,31 +395,51 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleIntent(Intent intent) {
|
private void handleIntent(Intent intent) {
|
||||||
if (DEBUG) Log.d(TAG, "handleIntent() called with: intent = [" + intent + "]");
|
try {
|
||||||
|
if (DEBUG) Log.d(TAG, "handleIntent() called with: intent = [" + intent + "]");
|
||||||
|
|
||||||
if (intent.hasExtra(Constants.KEY_LINK_TYPE)) {
|
if (intent.hasExtra(Constants.KEY_LINK_TYPE)) {
|
||||||
String url = intent.getStringExtra(Constants.KEY_URL);
|
String url = intent.getStringExtra(Constants.KEY_URL);
|
||||||
int serviceId = intent.getIntExtra(Constants.KEY_SERVICE_ID, 0);
|
int serviceId = intent.getIntExtra(Constants.KEY_SERVICE_ID, 0);
|
||||||
String title = intent.getStringExtra(Constants.KEY_TITLE);
|
String title = intent.getStringExtra(Constants.KEY_TITLE);
|
||||||
switch (((StreamingService.LinkType) intent.getSerializableExtra(Constants.KEY_LINK_TYPE))) {
|
switch (((StreamingService.LinkType) intent.getSerializableExtra(Constants.KEY_LINK_TYPE))) {
|
||||||
case STREAM:
|
case STREAM:
|
||||||
boolean autoPlay = intent.getBooleanExtra(VideoDetailFragment.AUTO_PLAY, false);
|
boolean autoPlay = intent.getBooleanExtra(VideoDetailFragment.AUTO_PLAY, false);
|
||||||
NavigationHelper.openVideoDetailFragment(getSupportFragmentManager(), serviceId, url, title, autoPlay);
|
NavigationHelper.openVideoDetailFragment(getSupportFragmentManager(), serviceId, url, title, autoPlay);
|
||||||
break;
|
break;
|
||||||
case CHANNEL:
|
case CHANNEL:
|
||||||
NavigationHelper.openChannelFragment(getSupportFragmentManager(), serviceId, url, title);
|
NavigationHelper.openChannelFragment(getSupportFragmentManager(),
|
||||||
break;
|
serviceId,
|
||||||
case PLAYLIST:
|
NewPipe.getService(serviceId)
|
||||||
NavigationHelper.openPlaylistFragment(getSupportFragmentManager(), serviceId, url, title);
|
.getChannelUIHFactory()
|
||||||
break;
|
.fromUrl(url),
|
||||||
|
title);
|
||||||
|
break;
|
||||||
|
case PLAYLIST:
|
||||||
|
NavigationHelper.openPlaylistFragment(getSupportFragmentManager(),
|
||||||
|
serviceId,
|
||||||
|
NewPipe.getService(serviceId)
|
||||||
|
.getChannelUIHFactory()
|
||||||
|
.fromUrl(url),
|
||||||
|
title);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (intent.hasExtra(Constants.KEY_OPEN_SEARCH)) {
|
||||||
|
String searchString = intent.getStringExtra(Constants.KEY_SEARCH_STRING);
|
||||||
|
if (searchString == null) searchString = "";
|
||||||
|
int serviceId = intent.getIntExtra(Constants.KEY_SERVICE_ID, 0);
|
||||||
|
NavigationHelper.openSearchFragment(
|
||||||
|
getSupportFragmentManager(),
|
||||||
|
serviceId,
|
||||||
|
NewPipe.getService(serviceId)
|
||||||
|
.getSearchQIHFactory()
|
||||||
|
.fromQuery(searchString));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
NavigationHelper.gotoMainFragment(getSupportFragmentManager());
|
||||||
}
|
}
|
||||||
} else if (intent.hasExtra(Constants.KEY_OPEN_SEARCH)) {
|
} catch (Exception e) {
|
||||||
String searchQuery = intent.getStringExtra(Constants.KEY_QUERY);
|
ErrorActivity.reportUiError(this, e);
|
||||||
if (searchQuery == null) searchQuery = "";
|
|
||||||
int serviceId = intent.getIntExtra(Constants.KEY_SERVICE_ID, 0);
|
|
||||||
NavigationHelper.openSearchFragment(getSupportFragmentManager(), serviceId, searchQuery);
|
|
||||||
} else {
|
|
||||||
NavigationHelper.gotoMainFragment(getSupportFragmentManager());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentPagerAdapter;
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.preference.PreferenceManager;
|
import android.support.v7.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -127,7 +128,16 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.action_search:
|
case R.id.action_search:
|
||||||
NavigationHelper.openSearchFragment(getFragmentManager(), ServiceHelper.getSelectedServiceId(activity), "");
|
try {
|
||||||
|
NavigationHelper.openSearchFragment(
|
||||||
|
getFragmentManager(),
|
||||||
|
ServiceHelper.getSelectedServiceId(activity),
|
||||||
|
NewPipe.getService(currentServiceId)
|
||||||
|
.getSearchQIHFactory()
|
||||||
|
.fromQuery(""));
|
||||||
|
} catch (Exception e) {
|
||||||
|
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
@ -226,7 +236,9 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
FALLBACK_CHANNEL_URL);
|
FALLBACK_CHANNEL_URL);
|
||||||
String name = preferences.getString(getString(R.string.main_page_selected_channel_name),
|
String name = preferences.getString(getString(R.string.main_page_selected_channel_name),
|
||||||
FALLBACK_CHANNEL_NAME);
|
FALLBACK_CHANNEL_NAME);
|
||||||
ChannelFragment fragment = ChannelFragment.getInstance(serviceId, url, name);
|
ChannelFragment fragment = ChannelFragment.getInstance(serviceId,
|
||||||
|
NewPipe.getService(currentServiceId).getPlaylistUIHFactory().fromUrl(url),
|
||||||
|
name);
|
||||||
fragment.useAsFrontPage(true);
|
fragment.useAsFrontPage(true);
|
||||||
return fragment;
|
return fragment;
|
||||||
} else {
|
} else {
|
||||||
|
@ -255,20 +267,13 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||||
for (final String ks : kl.getAvailableKiosks()) {
|
for (final String ks : kl.getAvailableKiosks()) {
|
||||||
menu.add(0, KIOSK_MENU_OFFSET + 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(menuItem -> {
|
||||||
@Override
|
|
||||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
|
||||||
try {
|
try {
|
||||||
NavigationHelper.openKioskFragment(getFragmentManager(), currentServiceId, ks);
|
NavigationHelper.openKioskFragment(getFragmentManager(), currentServiceId, ks);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ErrorActivity.reportError(activity, e,
|
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
|
||||||
activity.getClass(),
|
|
||||||
null,
|
|
||||||
ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR,
|
|
||||||
"none", "", R.string.app_ui_crash));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.support.v4.content.ContextCompat;
|
||||||
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;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -54,7 +55,7 @@ import org.schabi.newpipe.extractor.InfoItem;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
|
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.YoutubeStreamExtractor;
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
|
||||||
import org.schabi.newpipe.extractor.stream.AudioStream;
|
import org.schabi.newpipe.extractor.stream.AudioStream;
|
||||||
import org.schabi.newpipe.extractor.stream.Stream;
|
import org.schabi.newpipe.extractor.stream.Stream;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
||||||
|
@ -64,6 +65,7 @@ import org.schabi.newpipe.extractor.stream.VideoStream;
|
||||||
import org.schabi.newpipe.fragments.BackPressable;
|
import org.schabi.newpipe.fragments.BackPressable;
|
||||||
import org.schabi.newpipe.fragments.BaseStateFragment;
|
import org.schabi.newpipe.fragments.BaseStateFragment;
|
||||||
import org.schabi.newpipe.local.history.HistoryRecordManager;
|
import org.schabi.newpipe.local.history.HistoryRecordManager;
|
||||||
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
import org.schabi.newpipe.util.StreamItemAdapter;
|
import org.schabi.newpipe.util.StreamItemAdapter;
|
||||||
import org.schabi.newpipe.util.StreamItemAdapter.StreamSizeWrapper;
|
import org.schabi.newpipe.util.StreamItemAdapter.StreamSizeWrapper;
|
||||||
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
|
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
|
||||||
|
@ -365,11 +367,17 @@ public class VideoDetailFragment
|
||||||
if (TextUtils.isEmpty(currentInfo.getUploaderUrl())) {
|
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(
|
try {
|
||||||
getFragmentManager(),
|
NavigationHelper.openChannelFragment(
|
||||||
currentInfo.getServiceId(),
|
getFragmentManager(),
|
||||||
currentInfo.getUploaderUrl(),
|
currentInfo.getServiceId(),
|
||||||
currentInfo.getUploaderName());
|
NewPipe.getService(currentInfo.getServiceId())
|
||||||
|
.getChannelUIHFactory()
|
||||||
|
.fromUrl(currentInfo.getUploaderUrl()),
|
||||||
|
currentInfo.getUploaderName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.detail_thumbnail_root_layout:
|
case R.id.detail_thumbnail_root_layout:
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -15,15 +16,18 @@ import android.view.View;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.extractor.InfoItem;
|
import org.schabi.newpipe.extractor.InfoItem;
|
||||||
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||||
import org.schabi.newpipe.extractor.playlist.PlaylistInfoItem;
|
import org.schabi.newpipe.extractor.playlist.PlaylistInfoItem;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||||
|
import org.schabi.newpipe.extractor.uih.ListUIHandler;
|
||||||
import org.schabi.newpipe.fragments.BaseStateFragment;
|
import org.schabi.newpipe.fragments.BaseStateFragment;
|
||||||
import org.schabi.newpipe.fragments.OnScrollBelowItemsListener;
|
import org.schabi.newpipe.fragments.OnScrollBelowItemsListener;
|
||||||
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
|
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
|
||||||
import org.schabi.newpipe.info_list.InfoItemDialog;
|
import org.schabi.newpipe.info_list.InfoItemDialog;
|
||||||
import org.schabi.newpipe.info_list.InfoListAdapter;
|
import org.schabi.newpipe.info_list.InfoListAdapter;
|
||||||
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
|
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
|
||||||
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
import org.schabi.newpipe.util.NavigationHelper;
|
import org.schabi.newpipe.util.NavigationHelper;
|
||||||
import org.schabi.newpipe.util.OnClickGesture;
|
import org.schabi.newpipe.util.OnClickGesture;
|
||||||
import org.schabi.newpipe.util.StateSaver;
|
import org.schabi.newpipe.util.StateSaver;
|
||||||
|
@ -152,18 +156,40 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I> implem
|
||||||
infoListAdapter.setOnChannelSelectedListener(new OnClickGesture<ChannelInfoItem>() {
|
infoListAdapter.setOnChannelSelectedListener(new OnClickGesture<ChannelInfoItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void selected(ChannelInfoItem selectedItem) {
|
public void selected(ChannelInfoItem selectedItem) {
|
||||||
onItemSelected(selectedItem);
|
try {
|
||||||
NavigationHelper.openChannelFragment(useAsFrontPage ? getParentFragment().getFragmentManager() : getFragmentManager(),
|
onItemSelected(selectedItem);
|
||||||
selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
|
NavigationHelper.openChannelFragment(useAsFrontPage ?
|
||||||
|
getParentFragment().getFragmentManager()
|
||||||
|
: getFragmentManager(),
|
||||||
|
selectedItem.getServiceId(),
|
||||||
|
NewPipe.getService(selectedItem
|
||||||
|
.getServiceId())
|
||||||
|
.getChannelUIHFactory()
|
||||||
|
.fromUrl(selectedItem.getUrl()),
|
||||||
|
selectedItem.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
infoListAdapter.setOnPlaylistSelectedListener(new OnClickGesture<PlaylistInfoItem>() {
|
infoListAdapter.setOnPlaylistSelectedListener(new OnClickGesture<PlaylistInfoItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void selected(PlaylistInfoItem selectedItem) {
|
public void selected(PlaylistInfoItem selectedItem) {
|
||||||
onItemSelected(selectedItem);
|
try {
|
||||||
NavigationHelper.openPlaylistFragment(useAsFrontPage ? getParentFragment().getFragmentManager() : getFragmentManager(),
|
onItemSelected(selectedItem);
|
||||||
selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
|
NavigationHelper.openPlaylistFragment(
|
||||||
|
useAsFrontPage
|
||||||
|
? getParentFragment().getFragmentManager()
|
||||||
|
: getFragmentManager(),
|
||||||
|
selectedItem.getServiceId(),
|
||||||
|
NewPipe.getService(selectedItem.getServiceId())
|
||||||
|
.getPlaylistUIHFactory()
|
||||||
|
.fromUrl(selectedItem.getUrl()),
|
||||||
|
selectedItem.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,9 @@ import android.view.View;
|
||||||
|
|
||||||
import org.schabi.newpipe.extractor.ListExtractor;
|
import org.schabi.newpipe.extractor.ListExtractor;
|
||||||
import org.schabi.newpipe.extractor.ListInfo;
|
import org.schabi.newpipe.extractor.ListInfo;
|
||||||
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.uih.ListUIHandler;
|
||||||
|
import org.schabi.newpipe.extractor.uih.UIHandler;
|
||||||
import org.schabi.newpipe.util.Constants;
|
import org.schabi.newpipe.util.Constants;
|
||||||
|
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
@ -27,7 +30,7 @@ public abstract class BaseListInfoFragment<I extends ListInfo>
|
||||||
@State
|
@State
|
||||||
protected String name;
|
protected String name;
|
||||||
@State
|
@State
|
||||||
protected String url;
|
protected ListUIHandler uiHandler;
|
||||||
|
|
||||||
protected I currentInfo;
|
protected I currentInfo;
|
||||||
protected String currentNextPageUrl;
|
protected String currentNextPageUrl;
|
||||||
|
@ -166,7 +169,6 @@ public abstract class BaseListInfoFragment<I extends ListInfo>
|
||||||
public void handleResult(@NonNull I result) {
|
public void handleResult(@NonNull I result) {
|
||||||
super.handleResult(result);
|
super.handleResult(result);
|
||||||
|
|
||||||
url = result.getUrl();
|
|
||||||
name = result.getName();
|
name = result.getName();
|
||||||
setTitle(name);
|
setTitle(name);
|
||||||
|
|
||||||
|
@ -185,9 +187,9 @@ public abstract class BaseListInfoFragment<I extends ListInfo>
|
||||||
// Utils
|
// Utils
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
protected void setInitialData(int serviceId, String url, String name) {
|
protected void setInitialData(int serviceId, ListUIHandler uiHandler, String name) {
|
||||||
this.serviceId = serviceId;
|
this.serviceId = serviceId;
|
||||||
this.url = url;
|
this.uiHandler = uiHandler;
|
||||||
this.name = !TextUtils.isEmpty(name) ? name : "";
|
this.name = !TextUtils.isEmpty(name) ? name : "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.channel.ChannelInfo;
|
import org.schabi.newpipe.extractor.channel.ChannelInfo;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||||
|
import org.schabi.newpipe.extractor.uih.ListUIHandler;
|
||||||
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
|
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
|
||||||
import org.schabi.newpipe.info_list.InfoItemDialog;
|
import org.schabi.newpipe.info_list.InfoItemDialog;
|
||||||
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
|
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
|
||||||
|
@ -90,9 +91,9 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||||
|
|
||||||
private MenuItem menuRssButton;
|
private MenuItem menuRssButton;
|
||||||
|
|
||||||
public static ChannelFragment getInstance(int serviceId, String url, String name) {
|
public static ChannelFragment getInstance(int serviceId, ListUIHandler uiHandler, String name) {
|
||||||
ChannelFragment instance = new ChannelFragment();
|
ChannelFragment instance = new ChannelFragment();
|
||||||
instance.setInitialData(serviceId, url, name);
|
instance.setInitialData(serviceId, uiHandler, name);
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,10 +237,10 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||||
openRssFeed();
|
openRssFeed();
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_openInBrowser:
|
case R.id.menu_item_openInBrowser:
|
||||||
openUrlInBrowser(url);
|
openUrlInBrowser(uiHandler.getUrl());
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_share:
|
case R.id.menu_item_share:
|
||||||
shareUrl(name, url);
|
shareUrl(name, uiHandler.getUrl());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
@ -405,12 +406,12 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Single<ListExtractor.InfoItemsPage> loadMoreItemsLogic() {
|
protected Single<ListExtractor.InfoItemsPage> loadMoreItemsLogic() {
|
||||||
return ExtractorHelper.getMoreChannelItems(serviceId, url, currentNextPageUrl);
|
return ExtractorHelper.getMoreChannelItems(serviceId, uiHandler.getUrl(), currentNextPageUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Single<ChannelInfo> loadResult(boolean forceLoad) {
|
protected Single<ChannelInfo> loadResult(boolean forceLoad) {
|
||||||
return ExtractorHelper.getChannelInfo(serviceId, url, forceLoad);
|
return ExtractorHelper.getChannelInfo(serviceId, uiHandler.getUrl(), forceLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -488,7 +489,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||||
|
|
||||||
if (!result.getErrors().isEmpty()) {
|
if (!result.getErrors().isEmpty()) {
|
||||||
showSnackBarError(result.getErrors(), 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: " + uiHandler.getUrl(), R.string.general_error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +502,11 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
||||||
if (super.onError(exception)) return true;
|
if (super.onError(exception)) return true;
|
||||||
|
|
||||||
int errorId = exception instanceof ExtractionException ? R.string.parsing_error : R.string.general_error;
|
int errorId = exception instanceof ExtractionException ? R.string.parsing_error : R.string.general_error;
|
||||||
onUnrecoverableError(exception, UserAction.REQUESTED_CHANNEL, NewPipe.getNameOfService(serviceId), url, errorId);
|
onUnrecoverableError(exception,
|
||||||
|
UserAction.REQUESTED_CHANNEL,
|
||||||
|
NewPipe.getNameOfService(serviceId),
|
||||||
|
uiHandler.getUrl(),
|
||||||
|
errorId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,22 +11,20 @@ import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.extractor.ListExtractor;
|
import org.schabi.newpipe.extractor.ListExtractor;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.StreamingService;
|
import org.schabi.newpipe.extractor.StreamingService;
|
||||||
import org.schabi.newpipe.extractor.UrlIdHandler;
|
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.kiosk.KioskInfo;
|
import org.schabi.newpipe.extractor.kiosk.KioskInfo;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
|
||||||
|
import org.schabi.newpipe.extractor.uih.ListUIHandler;
|
||||||
|
import org.schabi.newpipe.extractor.uih.UIHFactory;
|
||||||
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
|
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
|
||||||
import org.schabi.newpipe.info_list.InfoItemBuilder;
|
|
||||||
import org.schabi.newpipe.report.UserAction;
|
import org.schabi.newpipe.report.UserAction;
|
||||||
import org.schabi.newpipe.util.ExtractorHelper;
|
import org.schabi.newpipe.util.ExtractorHelper;
|
||||||
import org.schabi.newpipe.util.KioskTranslator;
|
import org.schabi.newpipe.util.KioskTranslator;
|
||||||
import org.schabi.newpipe.util.NavigationHelper;
|
|
||||||
|
|
||||||
import icepick.State;
|
import icepick.State;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
|
@ -74,10 +72,10 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
||||||
throws ExtractionException {
|
throws ExtractionException {
|
||||||
KioskFragment instance = new KioskFragment();
|
KioskFragment instance = new KioskFragment();
|
||||||
StreamingService service = NewPipe.getService(serviceId);
|
StreamingService service = NewPipe.getService(serviceId);
|
||||||
UrlIdHandler kioskTypeUrlIdHandler = service.getKioskList()
|
ListUIHFactory kioskUIHFactory = service.getKioskList()
|
||||||
.getUrlIdHandlerByType(kioskId);
|
.getUIHFactoryByType(kioskId);
|
||||||
instance.setInitialData(serviceId,
|
instance.setInitialData(serviceId,
|
||||||
kioskTypeUrlIdHandler.getUrl(kioskId), kioskId);
|
kioskUIHFactory.fromId(kioskId), kioskId);
|
||||||
instance.kioskId = kioskId;
|
instance.kioskId = kioskId;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -136,7 +134,10 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
||||||
.getDefaultSharedPreferences(activity)
|
.getDefaultSharedPreferences(activity)
|
||||||
.getString(getString(R.string.content_country_key),
|
.getString(getString(R.string.content_country_key),
|
||||||
getString(R.string.default_country_value));
|
getString(R.string.default_country_value));
|
||||||
return ExtractorHelper.getKioskInfo(serviceId, url, contentCountry, forceReload);
|
return ExtractorHelper.getKioskInfo(serviceId,
|
||||||
|
uiHandler.getUrl(),
|
||||||
|
contentCountry,
|
||||||
|
forceReload);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -145,7 +146,10 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
||||||
.getDefaultSharedPreferences(activity)
|
.getDefaultSharedPreferences(activity)
|
||||||
.getString(getString(R.string.content_country_key),
|
.getString(getString(R.string.content_country_key),
|
||||||
getString(R.string.default_country_value));
|
getString(R.string.default_country_value));
|
||||||
return ExtractorHelper.getMoreKioskItems(serviceId, url, currentNextPageUrl, contentCountry);
|
return ExtractorHelper.getMoreKioskItems(serviceId,
|
||||||
|
uiHandler.getUrl(),
|
||||||
|
currentNextPageUrl,
|
||||||
|
contentCountry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -179,7 +183,7 @@ public class KioskFragment extends BaseListInfoFragment<KioskInfo> {
|
||||||
if (!result.getErrors().isEmpty()) {
|
if (!result.getErrors().isEmpty()) {
|
||||||
showSnackBarError(result.getErrors(),
|
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: " + uiHandler.getUrl(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -19,6 +20,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import org.reactivestreams.Subscriber;
|
import org.reactivestreams.Subscriber;
|
||||||
import org.reactivestreams.Subscription;
|
import org.reactivestreams.Subscription;
|
||||||
|
import org.schabi.newpipe.App;
|
||||||
import org.schabi.newpipe.NewPipeDatabase;
|
import org.schabi.newpipe.NewPipeDatabase;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity;
|
import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity;
|
||||||
|
@ -28,12 +30,14 @@ import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
|
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||||
|
import org.schabi.newpipe.extractor.uih.ListUIHandler;
|
||||||
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
|
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
|
||||||
import org.schabi.newpipe.info_list.InfoItemDialog;
|
import org.schabi.newpipe.info_list.InfoItemDialog;
|
||||||
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
|
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
|
||||||
import org.schabi.newpipe.player.playqueue.PlayQueue;
|
import org.schabi.newpipe.player.playqueue.PlayQueue;
|
||||||
import org.schabi.newpipe.player.playqueue.PlaylistPlayQueue;
|
import org.schabi.newpipe.player.playqueue.PlaylistPlayQueue;
|
||||||
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
|
import org.schabi.newpipe.player.playqueue.SinglePlayQueue;
|
||||||
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
import org.schabi.newpipe.report.UserAction;
|
import org.schabi.newpipe.report.UserAction;
|
||||||
import org.schabi.newpipe.util.ExtractorHelper;
|
import org.schabi.newpipe.util.ExtractorHelper;
|
||||||
import org.schabi.newpipe.util.ImageDisplayConstants;
|
import org.schabi.newpipe.util.ImageDisplayConstants;
|
||||||
|
@ -79,9 +83,9 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||||
|
|
||||||
private MenuItem playlistBookmarkButton;
|
private MenuItem playlistBookmarkButton;
|
||||||
|
|
||||||
public static PlaylistFragment getInstance(int serviceId, String url, String name) {
|
public static PlaylistFragment getInstance(int serviceId, ListUIHandler uiHandler, String name) {
|
||||||
PlaylistFragment instance = new PlaylistFragment();
|
PlaylistFragment instance = new PlaylistFragment();
|
||||||
instance.setInitialData(serviceId, url, name);
|
instance.setInitialData(serviceId, uiHandler, name);
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,22 +220,22 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Single<ListExtractor.InfoItemsPage> loadMoreItemsLogic() {
|
protected Single<ListExtractor.InfoItemsPage> loadMoreItemsLogic() {
|
||||||
return ExtractorHelper.getMorePlaylistItems(serviceId, url, currentNextPageUrl);
|
return ExtractorHelper.getMorePlaylistItems(serviceId, uiHandler.getUrl(), currentNextPageUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Single<PlaylistInfo> loadResult(boolean forceLoad) {
|
protected Single<PlaylistInfo> loadResult(boolean forceLoad) {
|
||||||
return ExtractorHelper.getPlaylistInfo(serviceId, url, forceLoad);
|
return ExtractorHelper.getPlaylistInfo(serviceId, uiHandler.getUrl(), forceLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.menu_item_openInBrowser:
|
case R.id.menu_item_openInBrowser:
|
||||||
openUrlInBrowser(url);
|
openUrlInBrowser(uiHandler.getUrl());
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_share:
|
case R.id.menu_item_share:
|
||||||
shareUrl(name, url);
|
shareUrl(name, uiHandler.getUrl());
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_bookmark:
|
case R.id.menu_item_bookmark:
|
||||||
onBookmarkClicked();
|
onBookmarkClicked();
|
||||||
|
@ -267,11 +271,18 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||||
if (!TextUtils.isEmpty(result.getUploaderName())) {
|
if (!TextUtils.isEmpty(result.getUploaderName())) {
|
||||||
headerUploaderName.setText(result.getUploaderName());
|
headerUploaderName.setText(result.getUploaderName());
|
||||||
if (!TextUtils.isEmpty(result.getUploaderUrl())) {
|
if (!TextUtils.isEmpty(result.getUploaderUrl())) {
|
||||||
headerUploaderLayout.setOnClickListener(v ->
|
headerUploaderLayout.setOnClickListener(v -> {
|
||||||
|
try {
|
||||||
NavigationHelper.openChannelFragment(getFragmentManager(),
|
NavigationHelper.openChannelFragment(getFragmentManager(),
|
||||||
result.getServiceId(), result.getUploaderUrl(),
|
result.getServiceId(),
|
||||||
result.getUploaderName())
|
NewPipe.getService(serviceId)
|
||||||
);
|
.getChannelUIHFactory()
|
||||||
|
.fromUrl(result.getUploaderUrl()),
|
||||||
|
result.getUploaderName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +337,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||||
|
|
||||||
if (!result.getErrors().isEmpty()) {
|
if (!result.getErrors().isEmpty()) {
|
||||||
showSnackBarError(result.getErrors(), 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: " + uiHandler.getUrl(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +350,11 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
|
||||||
if (super.onError(exception)) return true;
|
if (super.onError(exception)) return true;
|
||||||
|
|
||||||
int errorId = exception instanceof ExtractionException ? R.string.parsing_error : R.string.general_error;
|
int errorId = exception instanceof ExtractionException ? R.string.parsing_error : R.string.general_error;
|
||||||
onUnrecoverableError(exception, UserAction.REQUESTED_PLAYLIST, NewPipe.getNameOfService(serviceId), url, errorId);
|
onUnrecoverableError(exception,
|
||||||
|
UserAction.REQUESTED_PLAYLIST,
|
||||||
|
NewPipe.getNameOfService(serviceId),
|
||||||
|
uiHandler.getUrl(),
|
||||||
|
errorId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,8 @@ import org.schabi.newpipe.extractor.ListExtractor;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.StreamingService;
|
import org.schabi.newpipe.extractor.StreamingService;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.search.SearchEngine;
|
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
||||||
import org.schabi.newpipe.extractor.search.SearchInfo;
|
import org.schabi.newpipe.extractor.search.SearchInfo;
|
||||||
import org.schabi.newpipe.extractor.search.SearchResult;
|
|
||||||
import org.schabi.newpipe.extractor.uih.SearchQIHandler;
|
import org.schabi.newpipe.extractor.uih.SearchQIHandler;
|
||||||
import org.schabi.newpipe.fragments.BackPressable;
|
import org.schabi.newpipe.fragments.BackPressable;
|
||||||
import org.schabi.newpipe.fragments.list.BaseListFragment;
|
import org.schabi.newpipe.fragments.list.BaseListFragment;
|
||||||
|
@ -59,7 +58,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import icepick.State;
|
import icepick.State;
|
||||||
|
@ -103,8 +101,6 @@ public class SearchFragment
|
||||||
protected SearchQIHandler lastSearchedQuery;
|
protected SearchQIHandler lastSearchedQuery;
|
||||||
@State
|
@State
|
||||||
protected boolean wasSearchFocused = false;
|
protected boolean wasSearchFocused = false;
|
||||||
@State
|
|
||||||
List<String> contentFilter;
|
|
||||||
|
|
||||||
private StreamingService service;
|
private StreamingService service;
|
||||||
private String currentPageUrl;
|
private String currentPageUrl;
|
||||||
|
@ -381,8 +377,6 @@ public class SearchFragment
|
||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
|
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
contentFilter.clear();
|
|
||||||
contentFilter.add(menu.getItem(itemId).getTitle().toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,8 +697,7 @@ public class SearchFragment
|
||||||
super.startLoading(forceLoad);
|
super.startLoading(forceLoad);
|
||||||
if (disposables != null) disposables.clear();
|
if (disposables != null) disposables.clear();
|
||||||
if (searchDisposable != null) searchDisposable.dispose();
|
if (searchDisposable != null) searchDisposable.dispose();
|
||||||
searchDisposable = ExtractorHelper.searchFor(serviceId,
|
searchDisposable = ExtractorHelper.searchFor(serviceId, searchQuery, contentCountry)
|
||||||
searchQuery, currentPageUrl, contentCountry, contentFilter, "")
|
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.doOnEvent((searchResult, throwable) -> isLoading.set(false))
|
.doOnEvent((searchResult, throwable) -> isLoading.set(false))
|
||||||
|
@ -716,9 +709,8 @@ public class SearchFragment
|
||||||
isLoading.set(true);
|
isLoading.set(true);
|
||||||
showListFooter(true);
|
showListFooter(true);
|
||||||
if (searchDisposable != null) searchDisposable.dispose();
|
if (searchDisposable != null) searchDisposable.dispose();
|
||||||
currentNextPage = currentPage + 1;
|
|
||||||
searchDisposable = ExtractorHelper.getMoreSearchItems(serviceId,
|
searchDisposable = ExtractorHelper.getMoreSearchItems(serviceId,
|
||||||
searchQuery, currentNextPage, contentCountry, filter)
|
searchQuery, nextPageUrl, contentCountry)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.doOnEvent((nextItemsResult, throwable) -> isLoading.set(false))
|
.doOnEvent((nextItemsResult, throwable) -> isLoading.set(false))
|
||||||
|
@ -745,7 +737,6 @@ public class SearchFragment
|
||||||
this.filterItemCheckedId = item.getItemId();
|
this.filterItemCheckedId = item.getItemId();
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
|
|
||||||
this.contentFilter = contentFilter;
|
|
||||||
searchQuery = getSearchQuery(searchQuery.getSearchString(), contentFilter, "");
|
searchQuery = getSearchQuery(searchQuery.getSearchString(), contentFilter, "");
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(searchQuery.getSearchString())) {
|
if (!TextUtils.isEmpty(searchQuery.getSearchString())) {
|
||||||
|
@ -765,12 +756,12 @@ public class SearchFragment
|
||||||
return service.getSearchQIHFactory()
|
return service.getSearchQIHFactory()
|
||||||
.fromQuery(searchString, contentFilter, sortFilter);
|
.fromQuery(searchString, contentFilter, sortFilter);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ErrorActivity.reportError(getActivity(), e, getActivity().getClass(),
|
onUnrecoverableError(e, UserAction.SEARCHED,
|
||||||
getActivity().findViewById(android.R.id.content),
|
service.getServiceInfo().getName(),
|
||||||
ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR,
|
searchQuery.getSearchString(),
|
||||||
"",
|
R.string.general_error);
|
||||||
"", R.string.general_error));
|
|
||||||
}
|
}
|
||||||
|
return searchQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -795,7 +786,7 @@ public class SearchFragment
|
||||||
? R.string.parsing_error
|
? R.string.parsing_error
|
||||||
: R.string.general_error;
|
: R.string.general_error;
|
||||||
onUnrecoverableError(exception, UserAction.GET_SUGGESTIONS,
|
onUnrecoverableError(exception, UserAction.GET_SUGGESTIONS,
|
||||||
NewPipe.getNameOfService(serviceId), searchQuery, errorId);
|
NewPipe.getNameOfService(serviceId), searchQuery.getSearchString(), errorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -820,17 +811,17 @@ public class SearchFragment
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleResult(@NonNull SearchResult result) {
|
public void handleResult(@NonNull SearchInfo result) {
|
||||||
if (!result.errors.isEmpty()) {
|
if (!result.getErrors().isEmpty()) {
|
||||||
showSnackBarError(result.errors, UserAction.SEARCHED,
|
showSnackBarError(result.getErrors(), UserAction.SEARCHED,
|
||||||
NewPipe.getNameOfService(serviceId), searchQuery, 0);
|
NewPipe.getNameOfService(serviceId), searchQuery.getSearchString(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastSearchedQuery = searchQuery;
|
lastSearchedQuery = searchQuery;
|
||||||
|
|
||||||
if (infoListAdapter.getItemsList().size() == 0) {
|
if (infoListAdapter.getItemsList().size() == 0) {
|
||||||
if (!result.getResults().isEmpty()) {
|
if (!result.getRelatedItems().isEmpty()) {
|
||||||
infoListAdapter.addInfoItemList(result.getResults());
|
infoListAdapter.addInfoItemList(result.getRelatedItems());
|
||||||
} else {
|
} else {
|
||||||
infoListAdapter.clearStreamItemList();
|
infoListAdapter.clearStreamItemList();
|
||||||
showEmptyState();
|
showEmptyState();
|
||||||
|
@ -844,13 +835,13 @@ public class SearchFragment
|
||||||
@Override
|
@Override
|
||||||
public void handleNextItems(ListExtractor.InfoItemsPage result) {
|
public void handleNextItems(ListExtractor.InfoItemsPage result) {
|
||||||
showListFooter(false);
|
showListFooter(false);
|
||||||
currentPage = Integer.parseInt(result.getNextPageUrl());
|
currentPageUrl = result.getNextPageUrl();
|
||||||
infoListAdapter.addInfoItemList(result.getItems());
|
infoListAdapter.addInfoItemList(result.getItems());
|
||||||
|
|
||||||
if (!result.getErrors().isEmpty()) {
|
if (!result.getErrors().isEmpty()) {
|
||||||
showSnackBarError(result.getErrors(), UserAction.SEARCHED,
|
showSnackBarError(result.getErrors(), UserAction.SEARCHED,
|
||||||
NewPipe.getNameOfService(serviceId)
|
NewPipe.getNameOfService(serviceId)
|
||||||
, "\"" + searchQuery + "\" → page " + currentPage, 0);
|
, "\"" + searchQuery + "\" → page: " + nextPageUrl, 0);
|
||||||
}
|
}
|
||||||
super.handleNextItems(result);
|
super.handleNextItems(result);
|
||||||
}
|
}
|
||||||
|
@ -859,7 +850,7 @@ public class SearchFragment
|
||||||
protected boolean onError(Throwable exception) {
|
protected boolean onError(Throwable exception) {
|
||||||
if (super.onError(exception)) return true;
|
if (super.onError(exception)) return true;
|
||||||
|
|
||||||
if (exception instanceof SearchEngine.NothingFoundException) {
|
if (exception instanceof SearchExtractor.NothingFoundException) {
|
||||||
infoListAdapter.clearStreamItemList();
|
infoListAdapter.clearStreamItemList();
|
||||||
showEmptyState();
|
showEmptyState();
|
||||||
} else {
|
} else {
|
||||||
|
@ -867,7 +858,7 @@ public class SearchFragment
|
||||||
? R.string.parsing_error
|
? R.string.parsing_error
|
||||||
: R.string.general_error;
|
: R.string.general_error;
|
||||||
onUnrecoverableError(exception, UserAction.SEARCHED,
|
onUnrecoverableError(exception, UserAction.SEARCHED,
|
||||||
NewPipe.getNameOfService(serviceId), searchQuery, errorId);
|
NewPipe.getNameOfService(serviceId), searchQuery.getSearchString(), errorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.os.Parcelable;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -19,9 +20,11 @@ import org.schabi.newpipe.database.LocalItem;
|
||||||
import org.schabi.newpipe.database.playlist.PlaylistLocalItem;
|
import org.schabi.newpipe.database.playlist.PlaylistLocalItem;
|
||||||
import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry;
|
import org.schabi.newpipe.database.playlist.PlaylistMetadataEntry;
|
||||||
import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity;
|
import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity;
|
||||||
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.local.BaseLocalListFragment;
|
import org.schabi.newpipe.local.BaseLocalListFragment;
|
||||||
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
|
import org.schabi.newpipe.local.playlist.LocalPlaylistManager;
|
||||||
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
|
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
|
||||||
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
import org.schabi.newpipe.report.UserAction;
|
import org.schabi.newpipe.report.UserAction;
|
||||||
import org.schabi.newpipe.util.NavigationHelper;
|
import org.schabi.newpipe.util.NavigationHelper;
|
||||||
import org.schabi.newpipe.util.OnClickGesture;
|
import org.schabi.newpipe.util.OnClickGesture;
|
||||||
|
@ -99,19 +102,28 @@ public final class BookmarkFragment
|
||||||
itemListAdapter.setSelectedListener(new OnClickGesture<LocalItem>() {
|
itemListAdapter.setSelectedListener(new OnClickGesture<LocalItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void selected(LocalItem selectedItem) {
|
public void selected(LocalItem selectedItem) {
|
||||||
// Requires the parent fragment to find holder for fragment replacement
|
try {
|
||||||
if (getParentFragment() == null) return;
|
// Requires the parent fragment to find holder for fragment replacement
|
||||||
final FragmentManager fragmentManager = getParentFragment().getFragmentManager();
|
if (getParentFragment() == null) return;
|
||||||
|
final FragmentManager fragmentManager = getParentFragment().getFragmentManager();
|
||||||
|
|
||||||
if (selectedItem instanceof PlaylistMetadataEntry) {
|
if (selectedItem instanceof PlaylistMetadataEntry) {
|
||||||
final PlaylistMetadataEntry entry = ((PlaylistMetadataEntry) selectedItem);
|
final PlaylistMetadataEntry entry = ((PlaylistMetadataEntry) selectedItem);
|
||||||
NavigationHelper.openLocalPlaylistFragment(fragmentManager, entry.uid,
|
NavigationHelper.openLocalPlaylistFragment(fragmentManager, entry.uid,
|
||||||
entry.name);
|
entry.name);
|
||||||
|
|
||||||
} else if (selectedItem instanceof PlaylistRemoteEntity) {
|
} else if (selectedItem instanceof PlaylistRemoteEntity) {
|
||||||
final PlaylistRemoteEntity entry = ((PlaylistRemoteEntity) selectedItem);
|
final PlaylistRemoteEntity entry = ((PlaylistRemoteEntity) selectedItem);
|
||||||
NavigationHelper.openPlaylistFragment(fragmentManager, entry.getServiceId(),
|
NavigationHelper.openPlaylistFragment(
|
||||||
entry.getUrl(), entry.getName());
|
fragmentManager,
|
||||||
|
entry.getServiceId(),
|
||||||
|
NewPipe.getService(entry.getServiceId())
|
||||||
|
.getPlaylistUIHFactory()
|
||||||
|
.fromUrl(entry.getUrl()),
|
||||||
|
entry.getName());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -38,6 +39,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
|
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
|
||||||
import org.schabi.newpipe.fragments.BaseStateFragment;
|
import org.schabi.newpipe.fragments.BaseStateFragment;
|
||||||
import org.schabi.newpipe.info_list.InfoListAdapter;
|
import org.schabi.newpipe.info_list.InfoListAdapter;
|
||||||
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
import org.schabi.newpipe.report.UserAction;
|
import org.schabi.newpipe.report.UserAction;
|
||||||
import org.schabi.newpipe.local.subscription.services.SubscriptionsExportService;
|
import org.schabi.newpipe.local.subscription.services.SubscriptionsExportService;
|
||||||
import org.schabi.newpipe.local.subscription.services.SubscriptionsImportService;
|
import org.schabi.newpipe.local.subscription.services.SubscriptionsImportService;
|
||||||
|
@ -318,9 +320,17 @@ public class SubscriptionFragment extends BaseStateFragment<List<SubscriptionEnt
|
||||||
infoListAdapter.setOnChannelSelectedListener(new OnClickGesture<ChannelInfoItem>() {
|
infoListAdapter.setOnChannelSelectedListener(new OnClickGesture<ChannelInfoItem>() {
|
||||||
@Override
|
@Override
|
||||||
public void selected(ChannelInfoItem selectedItem) {
|
public void selected(ChannelInfoItem selectedItem) {
|
||||||
// Requires the parent fragment to find holder for fragment replacement
|
try {
|
||||||
NavigationHelper.openChannelFragment(getParentFragment().getFragmentManager(),
|
// Requires the parent fragment to find holder for fragment replacement
|
||||||
selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName());
|
NavigationHelper.openChannelFragment(getParentFragment().getFragmentManager(),
|
||||||
|
selectedItem.getServiceId(),
|
||||||
|
NewPipe.getService(selectedItem.getServiceId())
|
||||||
|
.getChannelUIHFactory()
|
||||||
|
.fromUrl(selectedItem.getUrl()),
|
||||||
|
selectedItem.getName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ public class Constants {
|
||||||
public static final String KEY_TITLE = "key_title";
|
public static final String KEY_TITLE = "key_title";
|
||||||
public static final String KEY_LINK_TYPE = "key_link_type";
|
public static final String KEY_LINK_TYPE = "key_link_type";
|
||||||
public static final String KEY_OPEN_SEARCH = "key_open_search";
|
public static final String KEY_OPEN_SEARCH = "key_open_search";
|
||||||
public static final String KEY_QUERY = "key_query";
|
public static final String KEY_SEARCH_STRING = "key_search_string";
|
||||||
|
|
||||||
public static final String KEY_THEME_CHANGE = "key_theme_change";
|
public static final String KEY_THEME_CHANGE = "key_theme_change";
|
||||||
public static final String KEY_MAIN_PAGE_CHANGE = "key_main_page_change";
|
public static final String KEY_MAIN_PAGE_CHANGE = "key_main_page_change";
|
||||||
|
|
|
@ -37,10 +37,8 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
||||||
import org.schabi.newpipe.extractor.kiosk.KioskInfo;
|
import org.schabi.newpipe.extractor.kiosk.KioskInfo;
|
||||||
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
|
import org.schabi.newpipe.extractor.playlist.PlaylistInfo;
|
||||||
import org.schabi.newpipe.extractor.search.SearchEngine;
|
|
||||||
import org.schabi.newpipe.extractor.search.SearchInfo;
|
import org.schabi.newpipe.extractor.search.SearchInfo;
|
||||||
import org.schabi.newpipe.extractor.search.SearchResult;
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.YoutubeStreamExtractor;
|
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
||||||
import org.schabi.newpipe.extractor.uih.SearchQIHandler;
|
import org.schabi.newpipe.extractor.uih.SearchQIHandler;
|
||||||
import org.schabi.newpipe.report.ErrorActivity;
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
|
@ -52,7 +50,6 @@ import java.util.List;
|
||||||
|
|
||||||
import io.reactivex.Maybe;
|
import io.reactivex.Maybe;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
import io.reactivex.annotations.NonNull;
|
|
||||||
|
|
||||||
public final class ExtractorHelper {
|
public final class ExtractorHelper {
|
||||||
private static final String TAG = ExtractorHelper.class.getSimpleName();
|
private static final String TAG = ExtractorHelper.class.getSimpleName();
|
||||||
|
@ -82,8 +79,7 @@ public final class ExtractorHelper {
|
||||||
final String contentCountry) {
|
final String contentCountry) {
|
||||||
checkServiceId(serviceId);
|
checkServiceId(serviceId);
|
||||||
return Single.fromCallable(() ->
|
return Single.fromCallable(() ->
|
||||||
SearchInfo.get
|
SearchInfo.getMoreItems(NewPipe.getService(serviceId), query, contentCountry, pageUrl));
|
||||||
NewPipe.getService(serviceId).getSearchExtractor(query, contentCountry))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,13 @@ import org.schabi.newpipe.download.DownloadActivity;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.StreamingService;
|
import org.schabi.newpipe.extractor.StreamingService;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||||
|
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
||||||
import org.schabi.newpipe.extractor.stream.AudioStream;
|
import org.schabi.newpipe.extractor.stream.AudioStream;
|
||||||
import org.schabi.newpipe.extractor.stream.Stream;
|
import org.schabi.newpipe.extractor.stream.Stream;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
||||||
import org.schabi.newpipe.extractor.stream.VideoStream;
|
import org.schabi.newpipe.extractor.stream.VideoStream;
|
||||||
|
import org.schabi.newpipe.extractor.uih.ListUIHandler;
|
||||||
|
import org.schabi.newpipe.extractor.uih.SearchQIHandler;
|
||||||
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;
|
||||||
|
@ -283,7 +286,7 @@ public class NavigationHelper {
|
||||||
return fragmentManager.popBackStackImmediate(SEARCH_FRAGMENT_TAG, 0);
|
return fragmentManager.popBackStackImmediate(SEARCH_FRAGMENT_TAG, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openSearchFragment(FragmentManager fragmentManager, int serviceId, String query) {
|
public static void openSearchFragment(FragmentManager fragmentManager, int serviceId, SearchQIHandler query) {
|
||||||
defaultTransaction(fragmentManager)
|
defaultTransaction(fragmentManager)
|
||||||
.replace(R.id.fragment_holder, SearchFragment.getInstance(serviceId, query))
|
.replace(R.id.fragment_holder, SearchFragment.getInstance(serviceId, query))
|
||||||
.addToBackStack(SEARCH_FRAGMENT_TAG)
|
.addToBackStack(SEARCH_FRAGMENT_TAG)
|
||||||
|
@ -314,18 +317,18 @@ public class NavigationHelper {
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openChannelFragment(FragmentManager fragmentManager, int serviceId, String url, String name) {
|
public static void openChannelFragment(FragmentManager fragmentManager, int serviceId, ListUIHandler uiHandler, String name) {
|
||||||
if (name == null) name = "";
|
if (name == null) name = "";
|
||||||
defaultTransaction(fragmentManager)
|
defaultTransaction(fragmentManager)
|
||||||
.replace(R.id.fragment_holder, ChannelFragment.getInstance(serviceId, url, name))
|
.replace(R.id.fragment_holder, ChannelFragment.getInstance(serviceId, uiHandler, name))
|
||||||
.addToBackStack(null)
|
.addToBackStack(null)
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openPlaylistFragment(FragmentManager fragmentManager, int serviceId, String url, String name) {
|
public static void openPlaylistFragment(FragmentManager fragmentManager, int serviceId, ListUIHandler uiHandler, String name) {
|
||||||
if (name == null) name = "";
|
if (name == null) name = "";
|
||||||
defaultTransaction(fragmentManager)
|
defaultTransaction(fragmentManager)
|
||||||
.replace(R.id.fragment_holder, PlaylistFragment.getInstance(serviceId, url, name))
|
.replace(R.id.fragment_holder, PlaylistFragment.getInstance(serviceId, uiHandler, name))
|
||||||
.addToBackStack(null)
|
.addToBackStack(null)
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
@ -370,10 +373,10 @@ public class NavigationHelper {
|
||||||
// Through Intents
|
// Through Intents
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
public static void openSearch(Context context, int serviceId, String query) {
|
public static void openSearch(Context context, int serviceId, String searchString) {
|
||||||
Intent mIntent = new Intent(context, MainActivity.class);
|
Intent mIntent = new Intent(context, MainActivity.class);
|
||||||
mIntent.putExtra(Constants.KEY_SERVICE_ID, serviceId);
|
mIntent.putExtra(Constants.KEY_SERVICE_ID, serviceId);
|
||||||
mIntent.putExtra(Constants.KEY_QUERY, query);
|
mIntent.putExtra(Constants.KEY_SEARCH_STRING, searchString);
|
||||||
mIntent.putExtra(Constants.KEY_OPEN_SEARCH, true);
|
mIntent.putExtra(Constants.KEY_OPEN_SEARCH, true);
|
||||||
context.startActivity(mIntent);
|
context.startActivity(mIntent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue