Skip to content

Commit

Permalink
Fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
XiangRongLin committed Aug 13, 2022
1 parent e4a22a4 commit b5ddc82
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import org.schabi.newpipe.report.ErrorInfo;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.AndroidTvUtils;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.ImageDisplayConstants;
Expand Down Expand Up @@ -619,7 +620,7 @@ private View.OnTouchListener getOnControlsTouchListener() {
private void initThumbnailViews(@NonNull final StreamInfo info) {
thumbnailImageView.setImageResource(R.drawable.dummy_thumbnail_dark);
if (!TextUtils.isEmpty(info.getThumbnailUrl())) {
final String infoServiceName = NewPipe.getNameOfService(info.getServiceId());
final String infoServiceName = CompatibilityUtil.getNameOfService(info.getServiceId());
final ImageLoadingListener onFailListener = new SimpleImageLoadingListener() {
@Override
public void onLoadingFailed(final String imageUri, final View view,
Expand Down Expand Up @@ -1262,7 +1263,7 @@ public void handleResult(@NonNull final StreamInfo info) {
if (!info.getErrors().isEmpty()) {
showSnackBarError(info.getErrors(),
UserAction.REQUESTED_STREAM,
NewPipe.getNameOfService(info.getServiceId()),
CompatibilityUtil.getNameOfService(info.getServiceId()),
info.getUrl(),
0);
}
Expand Down Expand Up @@ -1372,7 +1373,7 @@ protected boolean onError(final Throwable exception) {
: R.string.general_error;

onUnrecoverableError(exception, UserAction.REQUESTED_STREAM,
NewPipe.getNameOfService(serviceId), url, errorId);
CompatibilityUtil.getNameOfService(serviceId), url, errorId);

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.ImageDisplayConstants;
import org.schabi.newpipe.util.Localization;
Expand Down Expand Up @@ -244,7 +245,7 @@ private void monitorSubscription(final ChannelInfo info) {
final Consumer<Throwable> onError = (Throwable throwable) -> {
animateView(headerSubscribeButton, false, 100);
showSnackBarError(throwable, UserAction.SUBSCRIPTION,
NewPipe.getNameOfService(currentInfo.getServiceId()),
CompatibilityUtil.getNameOfService(currentInfo.getServiceId()),
"Get subscription status", 0);
};

Expand Down Expand Up @@ -297,7 +298,7 @@ private void updateSubscription(final ChannelInfo info) {
final Consumer<Throwable> onError = (@NonNull Throwable throwable) ->
onUnrecoverableError(throwable,
UserAction.SUBSCRIPTION,
NewPipe.getNameOfService(info.getServiceId()),
CompatibilityUtil.getNameOfService(info.getServiceId()),
"Updating Subscription for " + info.getUrl(),
R.string.subscription_update_failed);

Expand All @@ -318,7 +319,7 @@ private Disposable monitorSubscribeButton(final Button subscribeButton,
final Consumer<Throwable> onError = (@NonNull Throwable throwable) ->
onUnrecoverableError(throwable,
UserAction.SUBSCRIPTION,
NewPipe.getNameOfService(currentInfo.getServiceId()),
CompatibilityUtil.getNameOfService(currentInfo.getServiceId()),
"Subscription Change",
R.string.subscription_change_failed);

Expand Down Expand Up @@ -505,7 +506,7 @@ public void handleResult(@NonNull final ChannelInfo result) {

if (!errors.isEmpty()) {
showSnackBarError(errors, UserAction.REQUESTED_CHANNEL,
NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);
CompatibilityUtil.getNameOfService(result.getServiceId()), result.getUrl(), 0);
}
}

Expand Down Expand Up @@ -565,7 +566,7 @@ public void handleNextItems(final ListExtractor.InfoItemsPage result) {
if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(),
UserAction.REQUESTED_CHANNEL,
NewPipe.getNameOfService(serviceId),
CompatibilityUtil.getNameOfService(serviceId),
"Get next page of: " + url,
R.string.general_error);
}
Expand All @@ -585,7 +586,7 @@ protected boolean onError(final Throwable exception) {
? R.string.parsing_error : R.string.general_error;

onUnrecoverableError(exception, UserAction.REQUESTED_CHANNEL,
NewPipe.getNameOfService(serviceId), url, errorId);
CompatibilityUtil.getNameOfService(serviceId), url, errorId);

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.ExtractorHelper;

import io.reactivex.Single;
Expand Down Expand Up @@ -96,7 +97,7 @@ public void handleResult(@NonNull final CommentsInfo result) {

if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(), UserAction.REQUESTED_COMMENTS,
NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);
CompatibilityUtil.getNameOfService(result.getServiceId()), result.getUrl(), 0);
}

if (disposables != null) {
Expand All @@ -110,7 +111,7 @@ public void handleNextItems(final ListExtractor.InfoItemsPage result) {

if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(), UserAction.REQUESTED_COMMENTS,
NewPipe.getNameOfService(serviceId), "Get next page of: " + url,
CompatibilityUtil.getNameOfService(serviceId), "Get next page of: " + url,
R.string.general_error);
}
}
Expand All @@ -127,7 +128,7 @@ protected boolean onError(final Throwable exception) {

hideLoading();
showSnackBarError(exception, UserAction.REQUESTED_COMMENTS,
NewPipe.getNameOfService(serviceId), url, R.string.error_unable_to_load_comments);
CompatibilityUtil.getNameOfService(serviceId), url, R.string.error_unable_to_load_comments);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.schabi.newpipe.extractor.localization.ContentCountry;
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.Localization;
Expand Down Expand Up @@ -173,7 +174,7 @@ public void handleResult(@NonNull final KioskInfo result) {
if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(),
UserAction.REQUESTED_KIOSK,
NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);
CompatibilityUtil.getNameOfService(result.getServiceId()), result.getUrl(), 0);
}
}

Expand All @@ -183,7 +184,7 @@ public void handleNextItems(final ListExtractor.InfoItemsPage result) {

if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(),
UserAction.REQUESTED_PLAYLIST, NewPipe.getNameOfService(serviceId),
UserAction.REQUESTED_PLAYLIST, CompatibilityUtil.getNameOfService(serviceId),
"Get next page of: " + url, 0);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.schabi.newpipe.player.playqueue.PlaylistPlayQueue;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.ImageDisplayConstants;
import org.schabi.newpipe.util.Localization;
Expand Down Expand Up @@ -308,7 +309,7 @@ public void handleResult(@NonNull final PlaylistInfo result) {

if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(), UserAction.REQUESTED_PLAYLIST,
NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);
CompatibilityUtil.getNameOfService(result.getServiceId()), result.getUrl(), 0);
}

remotePlaylistManager.getPlaylist(result)
Expand Down Expand Up @@ -361,7 +362,7 @@ public void handleNextItems(final ListExtractor.InfoItemsPage result) {

if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(), UserAction.REQUESTED_PLAYLIST,
NewPipe.getNameOfService(serviceId), "Get next page of: " + url, 0);
CompatibilityUtil.getNameOfService(serviceId), "Get next page of: " + url, 0);
}
}

Expand All @@ -378,7 +379,7 @@ protected boolean onError(final Throwable exception) {
int errorId = exception instanceof ExtractionException
? R.string.parsing_error : R.string.general_error;
onUnrecoverableError(exception, UserAction.REQUESTED_PLAYLIST,
NewPipe.getNameOfService(serviceId), url, errorId);
CompatibilityUtil.getNameOfService(serviceId), url, errorId);
return true;
}

Expand Down Expand Up @@ -431,7 +432,8 @@ public void onError(final Throwable t) {
}

@Override
public void onComplete() { }
public void onComplete() {
}
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.AndroidTvUtils;
import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.NavigationHelper;
Expand Down Expand Up @@ -830,7 +831,7 @@ private void search(final String ss, final String[] cf, final String sf) {
ignored -> {
},
error -> showSnackBarError(error, UserAction.SEARCHED,
NewPipe.getNameOfService(serviceId), ss, 0)
CompatibilityUtil.getNameOfService(serviceId), ss, 0)
);
suggestionPublisher.onNext(ss);
startLoading(false);
Expand Down Expand Up @@ -940,7 +941,7 @@ public void onSuggestionError(final Throwable exception) {
? R.string.parsing_error
: R.string.general_error;
onUnrecoverableError(exception, UserAction.GET_SUGGESTIONS,
NewPipe.getNameOfService(serviceId), searchString, errorId);
CompatibilityUtil.getNameOfService(serviceId), searchString, errorId);
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -971,7 +972,7 @@ public void handleResult(@NonNull final SearchInfo result) {
&& !(exceptions.size() == 1
&& exceptions.get(0) instanceof SearchExtractor.NothingFoundException)) {
showSnackBarError(result.getErrors(), UserAction.SEARCHED,
NewPipe.getNameOfService(serviceId), searchString, 0);
CompatibilityUtil.getNameOfService(serviceId), searchString, 0);
}

searchSuggestion = result.getSearchSuggestion();
Expand Down Expand Up @@ -1034,7 +1035,7 @@ public void handleNextItems(final ListExtractor.InfoItemsPage result) {

if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(), UserAction.SEARCHED,
NewPipe.getNameOfService(serviceId),
CompatibilityUtil.getNameOfService(serviceId),
"\"" + searchString + "\" → pageUrl: " + nextPage.getUrl() + ", "
+ "pageIds: " + nextPage.getIds() + ", "
+ "pageCookies: " + nextPage.getCookies(), 0);
Expand All @@ -1056,7 +1057,7 @@ protected boolean onError(final Throwable exception) {
? R.string.parsing_error
: R.string.general_error;
onUnrecoverableError(exception, UserAction.SEARCHED,
NewPipe.getNameOfService(serviceId), searchString, errorId);
CompatibilityUtil.getNameOfService(serviceId), searchString, errorId);
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.RelatedStreamInfo;

import java.io.Serializable;
Expand Down Expand Up @@ -123,7 +124,7 @@ public void handleResult(@NonNull final RelatedStreamInfo result) {

if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(), UserAction.REQUESTED_STREAM,
NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);
CompatibilityUtil.getNameOfService(result.getServiceId()), result.getUrl(), 0);
}

if (disposables != null) {
Expand All @@ -138,7 +139,7 @@ public void handleNextItems(final ListExtractor.InfoItemsPage result) {
if (!result.getErrors().isEmpty()) {
showSnackBarError(result.getErrors(),
UserAction.REQUESTED_STREAM,
NewPipe.getNameOfService(serviceId),
CompatibilityUtil.getNameOfService(serviceId),
"Get next page of: " + url,
R.string.general_error);
}
Expand All @@ -156,7 +157,7 @@ protected boolean onError(final Throwable exception) {

hideLoading();
showSnackBarError(exception, UserAction.REQUESTED_STREAM,
NewPipe.getNameOfService(serviceId), url, R.string.general_error);
CompatibilityUtil.getNameOfService(serviceId), url, R.string.general_error);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public void updateFromItem(final InfoItem infoItem,
case AUDIO_LIVE_STREAM:
enableLongClick(item);
break;
case FILE:
case NONE:
default:
disableLongClick();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.schabi.newpipe.local.LocalItemBuilder;
import org.schabi.newpipe.local.history.HistoryRecordManager;
import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.ImageDisplayConstants;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.views.AnimatedProgressBar;
Expand Down Expand Up @@ -61,7 +62,7 @@ public void updateFromItem(final LocalItem localItem,
itemVideoTitleView.setText(item.getStreamEntity().getTitle());
itemAdditionalDetailsView.setText(Localization
.concatenateStrings(item.getStreamEntity().getUploader(),
NewPipe.getNameOfService(item.getStreamEntity().getServiceId())));
CompatibilityUtil.getNameOfService(item.getStreamEntity().getServiceId())));

if (item.getStreamEntity().getDuration() > 0) {
itemDurationView.setText(Localization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.schabi.newpipe.local.LocalItemBuilder;
import org.schabi.newpipe.local.history.HistoryRecordManager;
import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.ImageDisplayConstants;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.views.AnimatedProgressBar;
Expand Down Expand Up @@ -75,7 +76,7 @@ private String getStreamInfoDetailLine(final StreamStatisticsEntry entry,
final String watchCount = Localization
.shortViewCount(itemBuilder.getContext(), entry.getWatchCount());
final String uploadDate = dateFormat.format(entry.getLatestAccessDate());
final String serviceName = NewPipe.getNameOfService(entry.getStreamEntity().getServiceId());
final String serviceName = CompatibilityUtil.getNameOfService(entry.getStreamEntity().getServiceId());
return Localization.concatenateStrings(watchCount, uploadDate, serviceName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.local.LocalItemBuilder;
import org.schabi.newpipe.local.history.HistoryRecordManager;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.ImageDisplayConstants;
import org.schabi.newpipe.util.Localization;

Expand Down Expand Up @@ -39,9 +40,9 @@ public void updateFromItem(final LocalItem localItem,
// Here is where the uploader name is set in the bookmarked playlists library
if (!TextUtils.isEmpty(item.getUploader())) {
itemUploaderView.setText(Localization.concatenateStrings(item.getUploader(),
NewPipe.getNameOfService(item.getServiceId())));
CompatibilityUtil.getNameOfService(item.getServiceId())));
} else {
itemUploaderView.setText(NewPipe.getNameOfService(item.getServiceId()));
itemUploaderView.setText(CompatibilityUtil.getNameOfService(item.getServiceId()));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.ErrorInfo;
import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.FilePickerActivityHelper;
import org.schabi.newpipe.util.ServiceHelper;
Expand Down Expand Up @@ -86,7 +87,7 @@ public void onCreate(final Bundle savedInstanceState) {
if (supportedSources.isEmpty() && currentServiceId != Constants.NO_SERVICE_ID) {
ErrorActivity.reportError(activity, Collections.emptyList(), null, null,
ErrorInfo.make(UserAction.SOMETHING_ELSE,
NewPipe.getNameOfService(currentServiceId),
CompatibilityUtil.getNameOfService(currentServiceId),
"Service don't support importing", R.string.general_error));
activity.finish();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.nostra13.universalimageloader.core.ImageLoader;

import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.util.CompatibilityUtil;
import org.schabi.newpipe.util.ImageDisplayConstants;
import org.schabi.newpipe.util.Localization;

Expand All @@ -27,7 +28,7 @@ public void buildStreamInfoItem(final PlayQueueItemHolder holder, final PlayQueu
holder.itemVideoTitleView.setText(item.getTitle());
}
holder.itemAdditionalDetailsView.setText(Localization.concatenateStrings(item.getUploader(),
NewPipe.getNameOfService(item.getServiceId())));
CompatibilityUtil.getNameOfService(item.getServiceId())));

if (item.getDuration() > 0) {
holder.itemDurationView.setText(Localization.getDurationString(item.getDuration()));
Expand Down
Loading

0 comments on commit b5ddc82

Please sign in to comment.