1
0
mirror of https://github.com/TeamNewPipe/NewPipe-legacy synced 2025-10-06 00:22:51 +02:00

Apply legacy patches

Closes #33
Closes #37
Closes #38
Closes #39
Closes #54
Closes #55
Closes #58
This commit is contained in:
friendlyanon
2021-01-10 19:21:24 +01:00
parent 7d86901316
commit 15153d68bb
23 changed files with 32 additions and 29 deletions

View File

@@ -14,7 +14,6 @@ import org.schabi.newpipelegacy.util.ThemeHelper;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
@@ -38,7 +37,7 @@ public final class LicenseFragmentHelper {
final StringBuilder licenseContent = new StringBuilder();
final String webViewData;
try (BufferedReader in = new BufferedReader(new InputStreamReader(
context.getAssets().open(license.getFilename()), StandardCharsets.UTF_8))) {
context.getAssets().open(license.getFilename()), "utf-8"))) {
String str;
while ((str = in.readLine()) != null) {
licenseContent.append(str);
@@ -84,6 +83,7 @@ public final class LicenseFragmentHelper {
return context.getResources().getString(color).substring(3);
}
@SuppressWarnings("CharsetObjectCanBeUsed")
static Disposable showLicense(@Nullable final Context context, @NonNull final License license) {
if (context == null) {
return Disposable.empty();
@@ -94,7 +94,7 @@ public final class LicenseFragmentHelper {
.observeOn(AndroidSchedulers.mainThread())
.subscribe(formattedLicense -> {
final String webViewData = Base64.encodeToString(formattedLicense
.getBytes(StandardCharsets.UTF_8), Base64.NO_PADDING);
.getBytes("utf-8"), Base64.NO_PADDING);
final WebView webView = new WebView(context);
webView.loadData(webViewData, "text/html; charset=UTF-8", "base64");

View File

@@ -2,11 +2,11 @@ package org.schabi.newpipelegacy.database.playlist
import androidx.room.ColumnInfo
import androidx.room.Embedded
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.database.LocalItem
import org.schabi.newpipelegacy.database.playlist.model.PlaylistStreamEntity
import org.schabi.newpipelegacy.database.stream.model.StreamEntity
import org.schabi.newpipelegacy.database.stream.model.StreamStateEntity
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import kotlin.jvm.Throws
data class PlaylistStreamEntry(

View File

@@ -2,11 +2,11 @@ package org.schabi.newpipelegacy.database.stream
import androidx.room.ColumnInfo
import androidx.room.Embedded
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.database.LocalItem
import org.schabi.newpipelegacy.database.history.model.StreamHistoryEntity
import org.schabi.newpipelegacy.database.stream.model.StreamEntity
import org.schabi.newpipelegacy.database.stream.model.StreamStateEntity.STREAM_PROGRESS_TIME
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import java.time.OffsetDateTime
class StreamStatisticsEntry(

View File

@@ -7,12 +7,12 @@ import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import io.reactivex.rxjava3.core.Flowable
import org.schabi.newpipelegacy.database.BasicDAO
import org.schabi.newpipelegacy.database.stream.model.StreamEntity
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_ID
import org.schabi.newpipe.extractor.stream.StreamType
import org.schabi.newpipe.extractor.stream.StreamType.AUDIO_LIVE_STREAM
import org.schabi.newpipe.extractor.stream.StreamType.LIVE_STREAM
import org.schabi.newpipelegacy.database.BasicDAO
import org.schabi.newpipelegacy.database.stream.model.StreamEntity
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_ID
import java.time.OffsetDateTime
@Dao

View File

@@ -5,13 +5,13 @@ import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.Index
import androidx.room.PrimaryKey
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_SERVICE_ID
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_TABLE
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_URL
import org.schabi.newpipe.extractor.localization.DateWrapper
import org.schabi.newpipe.extractor.stream.StreamInfo
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipe.extractor.stream.StreamType
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_SERVICE_ID
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_TABLE
import org.schabi.newpipelegacy.database.stream.model.StreamEntity.Companion.STREAM_URL
import org.schabi.newpipelegacy.player.playqueue.PlayQueueItem
import java.io.Serializable
import java.time.OffsetDateTime

View File

@@ -1,6 +1,7 @@
package org.schabi.newpipelegacy.fragments.detail;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -1593,6 +1594,7 @@ public final class VideoDetailFragment
noVideoStreams ? R.drawable.ic_headset_shadow : R.drawable.ic_play_arrow_shadow);
}
@SuppressLint("StringFormatInvalid")
private void hideAgeRestrictedContent() {
showError(getString(R.string.restricted_video,
getString(R.string.show_age_restricted_content_title)), false);

View File

@@ -48,7 +48,7 @@ public abstract class BaseListFragment<I, N> extends BaseStateFragment<I>
implements ListViewContract<I, N>, StateSaver.WriteRead,
SharedPreferences.OnSharedPreferenceChangeListener {
private static final int LIST_MODE_UPDATE_FLAG = 0x32;
protected org.schabi.newpipe.util.SavedState savedState;
protected org.schabi.newpipelegacy.util.SavedState savedState;
private boolean useDefaultStateSaving = true;
private int updateFlags = 0;

View File

@@ -17,7 +17,7 @@ import java.util.Queue;
public abstract class PlaylistDialog extends DialogFragment implements StateSaver.WriteRead {
private List<StreamEntity> streamEntities;
private org.schabi.newpipe.util.SavedState savedState;
private org.schabi.newpipelegacy.util.SavedState savedState;
protected void setInfo(final List<StreamEntity> entities) {
this.streamEntities = entities;

View File

@@ -7,14 +7,14 @@ import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.core.Flowable
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.schedulers.Schedulers
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipe.extractor.stream.StreamType
import org.schabi.newpipelegacy.MainActivity.DEBUG
import org.schabi.newpipelegacy.NewPipeDatabase
import org.schabi.newpipelegacy.database.feed.model.FeedEntity
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipelegacy.database.feed.model.FeedLastUpdatedEntity
import org.schabi.newpipelegacy.database.stream.model.StreamEntity
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipe.extractor.stream.StreamType
import org.schabi.newpipelegacy.local.subscription.FeedGroupIcon
import java.time.LocalDate
import java.time.OffsetDateTime

View File

@@ -9,8 +9,8 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Flowable
import io.reactivex.rxjava3.functions.Function4
import io.reactivex.rxjava3.schedulers.Schedulers
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipelegacy.ktx.toCalendar
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager.Event.ErrorResultEvent

View File

@@ -43,13 +43,13 @@ import io.reactivex.rxjava3.processors.PublishProcessor
import io.reactivex.rxjava3.schedulers.Schedulers
import org.reactivestreams.Subscriber
import org.reactivestreams.Subscription
import org.schabi.newpipe.extractor.ListInfo
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.App
import org.schabi.newpipelegacy.MainActivity.DEBUG
import org.schabi.newpipelegacy.R
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipe.extractor.ListInfo
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.local.feed.FeedDatabaseManager
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager.Event.ErrorResultEvent
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager.Event.ProgressEvent

View File

@@ -33,6 +33,8 @@ import kotlinx.android.synthetic.main.dialog_title.view.itemAdditionalDetails
import kotlinx.android.synthetic.main.dialog_title.view.itemTitleView
import kotlinx.android.synthetic.main.fragment_subscription.items_list
import org.schabi.newpipe.extractor.channel.ChannelInfoItem
import org.schabi.newpipelegacy.R
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipelegacy.fragments.BaseStateFragment
import org.schabi.newpipelegacy.local.subscription.SubscriptionViewModel.SubscriptionState
import org.schabi.newpipelegacy.local.subscription.dialog.FeedGroupDialog

View File

@@ -5,10 +5,6 @@ import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.core.Flowable
import io.reactivex.rxjava3.schedulers.Schedulers
import org.schabi.newpipelegacy.NewPipeDatabase
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipelegacy.database.subscription.SubscriptionDAO
import org.schabi.newpipelegacy.database.subscription.SubscriptionEntity
import org.schabi.newpipe.extractor.ListInfo
import org.schabi.newpipe.extractor.channel.ChannelInfo
import org.schabi.newpipe.extractor.feed.FeedInfo

View File

@@ -19,6 +19,7 @@
package org.schabi.newpipelegacy.local.subscription.services;
import android.annotation.SuppressLint;
import android.app.Service;
import android.content.Intent;
import android.os.Build;
@@ -211,6 +212,7 @@ public abstract class BaseImportExportService extends Service {
// Error handling
//////////////////////////////////////////////////////////////////////////*/
@SuppressLint("StringFormatInvalid")
protected void handleError(@StringRes final int errorTitle, @NonNull final Throwable error) {
String message = getErrorMessage(error);

View File

@@ -33,8 +33,6 @@ import org.schabi.newpipelegacy.util.KioskTranslator;
import org.schabi.newpipelegacy.util.ServiceHelper;
import org.schabi.newpipelegacy.util.ThemeHelper;
import java.util.Objects;
public abstract class Tab {
private static final String JSON_TAB_ID_KEY = "tab_id";

View File

@@ -20,7 +20,6 @@ public class SrtFromTtmlWriter {
private final SharpStream out;
private final boolean ignoreEmptyFrames;
private final Charset charset = StandardCharsets.UTF_8;
private int frameIndex = 0;

View File

@@ -18,6 +18,7 @@
*/
package org.schabi.newpipelegacy.views;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
@@ -211,6 +212,7 @@ public final class FocusOverlayView extends Drawable implements
setupOverlay(window, overlay);
}
@SuppressLint("RestrictedAPI")
private static void setupOverlay(final Window window, final FocusOverlayView overlay) {
final ViewGroup decor = (ViewGroup) window.getDecorView();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {

View File

@@ -1,5 +1,6 @@
package us.shandian.giga.get;
import android.annotation.SuppressLint;
import android.util.Log;
import androidx.annotation.NonNull;
@@ -48,6 +49,7 @@ public class DownloadRunnableFallback extends Thread {
if (mF != null) mF.close();
}
@SuppressLint("LongLogTag")
@Override
public void run() {
boolean done;

View File

@@ -62,15 +62,15 @@
<suppress checks="EqualsHashCode"
files="Tab.java"
lines="112,358,432,577"/>
lines="113,359,433,578"/>
<suppress checks="EqualsHashCode"
files="StreamStateEntity.java"
lines="69"/>
lines="72"/>
<suppress checks="EqualsHashCode"
files="PlayQueue.java"
lines="517"/>
lines="504"/>
<suppress checks="FileLength"
files="VideoPlayerImpl.java"/>