- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Dictionary d =
new Hashtable()
Bundle bundle;bundle.getHeaders()
new Properties()
- Smart code suggestions by Codota
}
public ChannelPlayQueue(final int serviceId, final String url, final String nextPageUrl, final List<StreamInfoItem> streams, final int index) { super(serviceId, url, nextPageUrl, streams, index); }
public void selected(ChannelInfoItem selectedItem) { final FragmentManager fragmentManager = getFM(); NavigationHelper.openChannelFragment(fragmentManager, selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName()); }
private boolean isSubscriptionUpToDate(final ChannelInfo info, final SubscriptionEntity entity) { return info.getUrl().equals(entity.getUrl()) && info.getServiceId() == entity.getServiceId() && info.getName().equals(entity.getName()) && info.getAvatarUrl().equals(entity.getAvatarUrl()) && info.getDescription().equals(entity.getDescription()) && info.getSubscriberCount() == entity.getSubscriberCount(); } }
@Ignore public ChannelInfoItem toChannelInfoItem() { ChannelInfoItem item = new ChannelInfoItem(getServiceId(), getUrl(), getName()); item.setThumbnailUrl(getAvatarUrl()); item.setSubscriberCount(getSubscriberCount()); item.setDescription(getDescription()); return item; }
@SuppressLint("CheckResult") private void deleteChannel (ChannelInfoItem selectedItem) { subscriptionService.subscriptionTable() .getSubscription(selectedItem.getServiceId(), selectedItem.getUrl()) .toObservable() .observeOn(Schedulers.io()) .subscribe(getDeleteObserver()); Toast.makeText(activity, getString(R.string.channel_unsubscribed), Toast.LENGTH_SHORT).show(); }
private PlayQueue getPlayQueue(final int index) { final List<StreamInfoItem> streamItems = new ArrayList<>(); for(InfoItem i : infoListAdapter.getItemsList()) { if(i instanceof StreamInfoItem) { streamItems.add((StreamInfoItem) i); } } return new ChannelPlayQueue( currentInfo.getServiceId(), currentInfo.getUrl(), currentInfo.getNextPageUrl(), streamItems, index ); }
protected String getDetailLine(final ChannelInfoItem item) { String details = ""; if (item.getSubscriberCount() >= 0) { details += Localization.shortSubscriberCount(itemBuilder.getContext(), item.getSubscriberCount()); } return details; } }
public Completable updateChannelInfo(final ChannelInfo info) { final Function<List<SubscriptionEntity>, CompletableSource> update = new Function<List<SubscriptionEntity>, CompletableSource>() { @Override public CompletableSource apply(@NonNull List<SubscriptionEntity> subscriptionEntities) { if (DEBUG) Log.d(TAG, "updateChannelInfo() called with: subscriptionEntities = [" + subscriptionEntities + "]"); if (subscriptionEntities.size() == 1) { SubscriptionEntity subscription = subscriptionEntities.get(0); // Subscriber count changes very often, making this check almost unnecessary. // Consider removing it later. if (!isSubscriptionUpToDate(info, subscription)) { subscription.setData(info.getName(), info.getAvatarUrl(), info.getDescription(), info.getSubscriberCount()); return Completable.fromRunnable(() -> subscriptionTable().update(subscription)); } } return Completable.complete(); } }; return subscriptionTable().getSubscription(info.getServiceId(), info.getUrl()) .firstOrError() .flatMapCompletable(update); }
public static Single<ChannelInfo> getChannelInfo(final int serviceId, final String url, boolean forceLoad) { checkServiceId(serviceId); return checkCache(forceLoad, serviceId, url, Single.fromCallable(() -> ChannelInfo.getInfo(NewPipe.getService(serviceId), url))); }
@Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if(activity != null && useAsFrontPage && isVisibleToUser) { setTitle(currentInfo != null ? currentInfo.getName() : name); } }
@Override public void updateFromItem(final InfoItem infoItem) { super.updateFromItem(infoItem); if (!(infoItem instanceof ChannelInfoItem)) return; final ChannelInfoItem item = (ChannelInfoItem) infoItem; itemChannelDescriptionView.setText(item.getDescription()); }
private void openRssFeed() { final ChannelInfo info = currentInfo; if(info != null) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(info.getFeedUrl())); startActivity(intent); } }
@Override protected String getDetailLine(final ChannelInfoItem item) { String details = super.getDetailLine(item); if (item.getStreamCount() >= 0) { String formattedVideoAmount = Localization.localizeStreamCount(itemBuilder.getContext(), item.getStreamCount()); if (!details.isEmpty()) { details += " • " + formattedVideoAmount; } else { details = formattedVideoAmount; } } return details; } }
@Override public void onSuccess(final ChannelInfo channelInfo) { if (infoListAdapter == null || channelInfo.getRelatedItems().isEmpty()) { onDone(); return; } final InfoItem item = channelInfo.getRelatedItems().get(0); // Keep requesting new items if the current one already exists boolean itemExists = doesItemExist(infoListAdapter.getItemsList(), item); if (!itemExists) { infoListAdapter.addInfoItem(item); //updateSubscription(channelInfo); } else { requestFeed(1); } onDone(); }
public static Single<InfoItemsPage> getMoreChannelItems(final int serviceId, final String url, final String nextStreamsUrl) { checkServiceId(serviceId); return Single.fromCallable(() -> ChannelInfo.getMoreItems(NewPipe.getService(serviceId), url, nextStreamsUrl)); }
@Ignore public static SubscriptionEntity from(@NonNull ChannelInfo info) { SubscriptionEntity result = new SubscriptionEntity(); result.setServiceId(info.getServiceId()); result.setUrl(info.getUrl()); result.setData(info.getName(), info.getAvatarUrl(), info.getDescription(), info.getSubscriberCount()); return result; } }
@Override public void selected(ChannelInfoItem selectedItem) { try { onItemSelected(selectedItem); NavigationHelper.openChannelFragment(getFM(), selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName()); } catch (Exception e) { ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e); } } });
private Consumer<Notification<ChannelInfo>> getNotificationsConsumer() { return notification -> { if (notification.isOnNext()) { String name = notification.getValue().getName(); eventListener.onItemCompleted(!TextUtils.isEmpty(name) ? name : ""); } else if (notification.isOnError()) { final Throwable error = notification.getError(); final Throwable cause = error.getCause(); if (error instanceof IOException) { throw (IOException) error; } else if (cause != null && cause instanceof IOException) { throw (IOException) cause; } eventListener.onItemCompleted(""); } }; }
private Consumer<List<SubscriptionEntity>> getSubscribeUpdateMonitor(final ChannelInfo info) { return (List<SubscriptionEntity> subscriptionEntities) -> { if (DEBUG) Log.d(TAG, "subscriptionService.subscriptionTable.doOnNext() called with: subscriptionEntities = [" + subscriptionEntities + "]"); if (subscribeButtonMonitor != null) subscribeButtonMonitor.dispose(); if (subscriptionEntities.isEmpty()) { if (DEBUG) Log.d(TAG, "No subscription to this channel!"); SubscriptionEntity channel = new SubscriptionEntity(); channel.setServiceId(info.getServiceId()); channel.setUrl(info.getUrl()); channel.setData(info.getName(), info.getAvatarUrl(), info.getDescription(), info.getSubscriberCount()); subscribeButtonMonitor = monitorSubscribeButton(headerSubscribeButton, mapOnSubscribe(channel)); } else { if (DEBUG) Log.d(TAG, "Found subscription to this channel!"); final SubscriptionEntity subscription = subscriptionEntities.get(0); subscribeButtonMonitor = monitorSubscribeButton(headerSubscribeButton, mapOnUnsubscribe(subscription)); } }; }