Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.

Commit

Permalink
Apply legacy patches
Browse files Browse the repository at this point in the history
Closes #33
Closes #37
Closes #38
Closes #39
Closes #54
Closes #55
Closes #58
  • Loading branch information
friendlyanon committed Jan 10, 2021
1 parent 7d86901 commit 15153d6
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 29 deletions.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
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;
Expand All @@ -38,7 +37,7 @@ private static String getFormattedLicense(@NonNull final Context context,
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);
Expand Down Expand Up @@ -84,6 +83,7 @@ private static String getHexRGBColor(@NonNull final Context context, final int c
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();
Expand All @@ -94,7 +94,7 @@ static Disposable showLicense(@Nullable final Context context, @NonNull final Li
.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");

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -1593,6 +1594,7 @@ public void handleResult(@NonNull final StreamInfo info) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -211,6 +212,7 @@ protected void showToast(final String message) {
// Error handling
//////////////////////////////////////////////////////////////////////////*/

@SuppressLint("StringFormatInvalid")
protected void handleError(@StringRes final int errorTitle, @NonNull final Throwable error) {
String message = getErrorMessage(error);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -211,6 +212,7 @@ public static void setupFocusObserver(final Activity activity) {
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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package us.shandian.giga.get;

import android.annotation.SuppressLint;
import android.util.Log;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -48,6 +49,7 @@ private void dispose() {
if (mF != null) mF.close();
}

@SuppressLint("LongLogTag")
@Override
public void run() {
boolean done;
Expand Down
6 changes: 3 additions & 3 deletions checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down

0 comments on commit 15153d6

Please sign in to comment.