update project to the latest dev branch

This commit is contained in:
Zhidong Piao 2022-10-26 04:51:35 +11:00
parent 2069347079
commit fb3ed83d51
24 changed files with 49 additions and 49 deletions

View File

@ -9,7 +9,7 @@ plugins {
android { android {
compileSdk 31 compileSdk 31
buildToolsVersion '31.0.0' namespace 'org.schabi.newpipe'
defaultConfig { defaultConfig {
applicationId "org.schabi.newpipe" applicationId "org.schabi.newpipe"

View File

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
package="org.schabi.newpipe">
<application <application
android:name=".DebugApp" android:name=".DebugApp"

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="org.schabi.newpipe"
android:installLocation="auto"> android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
@ -14,6 +13,9 @@
<uses-feature <uses-feature
android:name="android.hardware.touchscreen" android:name="android.hardware.touchscreen"
android:required="false" /> android:required="false" />
<uses-feature
android:name="android.software.leanback"
android:required="false" />
<application <application
android:name=".App" android:name=".App"

View File

@ -35,7 +35,7 @@ import java.util.ArrayList;
// TODO: Replace this deprecated class with its ViewPager2 counterpart // TODO: Replace this deprecated class with its ViewPager2 counterpart
/** /**
* This is a copy from {@link androidx.fragment.app.FragmentStatePagerAdapter}. * This is a copy from {@link FragmentStatePagerAdapter}.
* <p> * <p>
* It includes a workaround to fix the menu visibility when the adapter is restored. * It includes a workaround to fix the menu visibility when the adapter is restored.
* </p> * </p>

View File

@ -163,7 +163,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
// Navigate to blank page (unloads youtube to prevent background playback) // Navigate to blank page (unloads youtube to prevent background playback)
recaptchaBinding.reCaptchaWebView.loadUrl("about:blank"); recaptchaBinding.reCaptchaWebView.loadUrl("about:blank");
final Intent intent = new Intent(this, org.schabi.newpipe.MainActivity.class); final Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
NavUtils.navigateUpTo(this, intent); NavUtils.navigateUpTo(this, intent);
} }

View File

@ -1358,7 +1358,7 @@ public final class Player implements PlaybackListener, Listener {
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
//region Errors //region Errors
/** /**
* Process exceptions produced by {@link com.google.android.exoplayer2.ExoPlayer ExoPlayer}. * Process exceptions produced by {@link ExoPlayer ExoPlayer}.
* <p>There are multiple types of errors:</p> * <p>There are multiple types of errors:</p>
* <ul> * <ul>
* <li>{@link PlaybackException#ERROR_CODE_BEHIND_LIVE_WINDOW BEHIND_LIVE_WINDOW}: * <li>{@link PlaybackException#ERROR_CODE_BEHIND_LIVE_WINDOW BEHIND_LIVE_WINDOW}:
@ -1383,7 +1383,7 @@ public final class Player implements PlaybackListener, Listener {
* For any error above that is <b>not</b> explicitly <b>catchable</b>, the player will * For any error above that is <b>not</b> explicitly <b>catchable</b>, the player will
* create a notification so users are aware. * create a notification so users are aware.
* </ul> * </ul>
* @see com.google.android.exoplayer2.Player.Listener#onPlayerError(PlaybackException) * @see Listener#onPlayerError(PlaybackException)
* */ * */
// Any error code not explicitly covered here are either unrelated to NewPipe use case // Any error code not explicitly covered here are either unrelated to NewPipe use case
// (e.g. DRM) or not recoverable (e.g. Decoder error). In both cases, the player should // (e.g. DRM) or not recoverable (e.g. Decoder error). In both cases, the player should

View File

@ -41,7 +41,7 @@ public final class PlayerService extends Service {
private Player player; private Player player;
private final IBinder mBinder = new PlayerService.LocalBinder(); private final IBinder mBinder = new LocalBinder();
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////

View File

@ -64,7 +64,7 @@ import java.util.zip.GZIPInputStream;
/** /**
* An {@link HttpDataSource} that uses Android's {@link HttpURLConnection}, based on * An {@link HttpDataSource} that uses Android's {@link HttpURLConnection}, based on
* {@link com.google.android.exoplayer2.upstream.DefaultHttpDataSource}, for YouTube streams. * {@link DefaultHttpDataSource}, for YouTube streams.
* *
* <p> * <p>
* It adds more headers to {@code videoplayback} URLs, such as {@code Origin}, {@code Referer} * It adds more headers to {@code videoplayback} URLs, such as {@code Origin}, {@code Referer}
@ -73,7 +73,7 @@ import java.util.zip.GZIPInputStream;
* </p> * </p>
* *
* There are many unused methods in this class because everything was copied from {@link * There are many unused methods in this class because everything was copied from {@link
* com.google.android.exoplayer2.upstream.DefaultHttpDataSource} with as little changes as possible. * DefaultHttpDataSource} with as little changes as possible.
* SonarQube warnings were also suppressed for the same reason. * SonarQube warnings were also suppressed for the same reason.
*/ */
@SuppressWarnings({"squid:S3011", "squid:S4738"}) @SuppressWarnings({"squid:S3011", "squid:S4738"})
@ -197,7 +197,7 @@ public final class YoutubeHttpDataSource extends BaseDataSource implements HttpD
/** /**
* Sets a content type {@link Predicate}. If a content type is rejected by the predicate * Sets a content type {@link Predicate}. If a content type is rejected by the predicate
* then a {@link HttpDataSource.InvalidContentTypeException} is thrown from * then a {@link InvalidContentTypeException} is thrown from
* {@link YoutubeHttpDataSource#open(DataSpec)}. * {@link YoutubeHttpDataSource#open(DataSpec)}.
* *
* <p> * <p>

View File

@ -280,11 +280,11 @@ public final class PlayerHelper {
public static boolean isAutoplayAllowedByUser(@NonNull final Context context) { public static boolean isAutoplayAllowedByUser(@NonNull final Context context) {
switch (PlayerHelper.getAutoplayType(context)) { switch (PlayerHelper.getAutoplayType(context)) {
case PlayerHelper.AutoplayType.AUTOPLAY_TYPE_NEVER: case AutoplayType.AUTOPLAY_TYPE_NEVER:
return false; return false;
case PlayerHelper.AutoplayType.AUTOPLAY_TYPE_WIFI: case AutoplayType.AUTOPLAY_TYPE_WIFI:
return !ListHelper.isMeteredNetwork(context); return !ListHelper.isMeteredNetwork(context);
case PlayerHelper.AutoplayType.AUTOPLAY_TYPE_ALWAYS: case AutoplayType.AUTOPLAY_TYPE_ALWAYS:
default: default:
return true; return true;
} }
@ -382,7 +382,7 @@ public final class PlayerHelper {
public static boolean globalScreenOrientationLocked(final Context context) { public static boolean globalScreenOrientationLocked(final Context context) {
// 1: Screen orientation changes using accelerometer // 1: Screen orientation changes using accelerometer
// 0: Screen orientation is locked // 0: Screen orientation is locked
return android.provider.Settings.System.getInt( return Settings.System.getInt(
context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 0; context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 0;
} }

View File

@ -23,12 +23,12 @@ public final class StreamInfoTag implements MediaItemTag {
@NonNull @NonNull
private final StreamInfo streamInfo; private final StreamInfo streamInfo;
@Nullable @Nullable
private final MediaItemTag.Quality quality; private final Quality quality;
@Nullable @Nullable
private final Object extras; private final Object extras;
private StreamInfoTag(@NonNull final StreamInfo streamInfo, private StreamInfoTag(@NonNull final StreamInfo streamInfo,
@Nullable final MediaItemTag.Quality quality, @Nullable final Quality quality,
@Nullable final Object extras) { @Nullable final Object extras) {
this.streamInfo = streamInfo; this.streamInfo = streamInfo;
this.quality = quality; this.quality = quality;

View File

@ -121,7 +121,7 @@ public class FailedMediaSource extends BaseMediaSource implements ManagedMediaSo
* {@link com.google.android.exoplayer2.Player.Listener#onPlayerError(PlaybackException)}. * {@link com.google.android.exoplayer2.Player.Listener#onPlayerError(PlaybackException)}.
* *
* @throws IOException An error which will always result in * @throws IOException An error which will always result in
* {@link com.google.android.exoplayer2.PlaybackException#ERROR_CODE_IO_UNSPECIFIED}. * {@link PlaybackException#ERROR_CODE_IO_UNSPECIFIED}.
*/ */
@Override @Override
public void maybeThrowSourceInfoRefreshError() throws IOException { public void maybeThrowSourceInfoRefreshError() throws IOException {

View File

@ -1425,7 +1425,7 @@ public abstract class VideoPlayerUi extends PlayerUi
break; break;
} }
if (player.getCurrentState() == org.schabi.newpipe.player.Player.STATE_BLOCKED) { if (player.getCurrentState() == Player.STATE_BLOCKED) {
return true; return true;
} }

View File

@ -339,14 +339,14 @@ public class PeertubeInstanceListFragment extends Fragment {
@NonNull @NonNull
@Override @Override
public InstanceListAdapter.TabViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, public TabViewHolder onCreateViewHolder(@NonNull final ViewGroup parent,
final int viewType) { final int viewType) {
return new InstanceListAdapter.TabViewHolder(ItemInstanceBinding.inflate(inflater, return new TabViewHolder(ItemInstanceBinding.inflate(inflater,
parent, false)); parent, false));
} }
@Override @Override
public void onBindViewHolder(@NonNull final InstanceListAdapter.TabViewHolder holder, public void onBindViewHolder(@NonNull final TabViewHolder holder,
final int position) { final int position) {
holder.bind(position); holder.bind(position);
} }

View File

@ -45,7 +45,7 @@ public class ChooseTabsFragment extends Fragment {
private TabsManager tabsManager; private TabsManager tabsManager;
private final List<Tab> tabList = new ArrayList<>(); private final List<Tab> tabList = new ArrayList<>();
private ChooseTabsFragment.SelectedTabsAdapter selectedTabsAdapter; private SelectedTabsAdapter selectedTabsAdapter;
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
// Lifecycle // Lifecycle
@ -316,7 +316,7 @@ public class ChooseTabsFragment extends Fragment {
} }
private class SelectedTabsAdapter private class SelectedTabsAdapter
extends RecyclerView.Adapter<ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder> { extends RecyclerView.Adapter<SelectedTabsAdapter.TabViewHolder> {
private final LayoutInflater inflater; private final LayoutInflater inflater;
private final ItemTouchHelper itemTouchHelper; private final ItemTouchHelper itemTouchHelper;
@ -332,15 +332,15 @@ public class ChooseTabsFragment extends Fragment {
@NonNull @NonNull
@Override @Override
public ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder onCreateViewHolder( public TabViewHolder onCreateViewHolder(
@NonNull final ViewGroup parent, final int viewType) { @NonNull final ViewGroup parent, final int viewType) {
final View view = inflater.inflate(R.layout.list_choose_tabs, parent, false); final View view = inflater.inflate(R.layout.list_choose_tabs, parent, false);
return new ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder(view); return new TabViewHolder(view);
} }
@Override @Override
public void onBindViewHolder( public void onBindViewHolder(
@NonNull final ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder holder, @NonNull final TabViewHolder holder,
final int position) { final int position) {
holder.bind(position, holder); holder.bind(position, holder);
} }

View File

@ -27,7 +27,7 @@ public class WebMWriter implements Closeable {
private static final int CUE_RESERVE_SIZE = 65535; private static final int CUE_RESERVE_SIZE = 65535;
private static final byte MINIMUM_EBML_VOID_SIZE = 4; private static final byte MINIMUM_EBML_VOID_SIZE = 4;
private WebMReader.WebMTrack[] infoTracks; private WebMTrack[] infoTracks;
private SharpStream[] sourceTracks; private SharpStream[] sourceTracks;
private WebMReader[] readers; private WebMReader[] readers;

View File

@ -42,7 +42,7 @@ public final class SparseItemUtil {
* @param item item which is checked and eventually loaded completely * @param item item which is checked and eventually loaded completely
* @param callback callback to call with the single play queue built from the original item if * @param callback callback to call with the single play queue built from the original item if
* all info was available, otherwise from the fetched {@link * all info was available, otherwise from the fetched {@link
* org.schabi.newpipe.extractor.stream.StreamInfo} * StreamInfo}
*/ */
public static void fetchItemInfoIfSparse(@NonNull final Context context, public static void fetchItemInfoIfSparse(@NonNull final Context context,
@NonNull final StreamInfoItem item, @NonNull final StreamInfoItem item,
@ -72,7 +72,7 @@ public final class SparseItemUtil {
* @param uploaderUrl uploaderUrl of the item; if null or empty will be fetched * @param uploaderUrl uploaderUrl of the item; if null or empty will be fetched
* @param callback callback to be called with either the original uploaderUrl, if it was a * @param callback callback to be called with either the original uploaderUrl, if it was a
* valid url, otherwise with the uploader url obtained by fetching the {@link * valid url, otherwise with the uploader url obtained by fetching the {@link
* org.schabi.newpipe.extractor.stream.StreamInfo} corresponding to the item * StreamInfo} corresponding to the item
*/ */
public static void fetchUploaderUrlIfSparse(@NonNull final Context context, public static void fetchUploaderUrlIfSparse(@NonNull final Context context,
final int serviceId, final int serviceId,

View File

@ -92,7 +92,7 @@ public final class StateSaver {
/** /**
* Try to restore the state from memory and disk, * Try to restore the state from memory and disk,
* using the {@link StateSaver.WriteRead#readFrom(Queue)} from the writeRead. * using the {@link WriteRead#readFrom(Queue)} from the writeRead.
* *
* @param savedState * @param savedState
* @param writeRead * @param writeRead
@ -176,7 +176,7 @@ public final class StateSaver {
/** /**
* If it's not changing configuration (i.e. rotating screen), * If it's not changing configuration (i.e. rotating screen),
* try to write the state from {@link StateSaver.WriteRead#writeTo(Queue)} * try to write the state from {@link WriteRead#writeTo(Queue)}
* to the file with the name of prefixFileName + suffixFileName, * to the file with the name of prefixFileName + suffixFileName,
* in a cache folder got from the {@link #init(Context)}. * in a cache folder got from the {@link #init(Context)}.
* <p> * <p>

View File

@ -163,12 +163,12 @@ public final class ShareUtils {
/** /**
* Open the system chooser to launch an intent. * Open the system chooser to launch an intent.
* <p> * <p>
* This method opens an {@link android.content.Intent#ACTION_CHOOSER} of the intent putted * This method opens an {@link Intent#ACTION_CHOOSER} of the intent putted
* as the intent param. If the setTitleChooser boolean is true, the string "Open with" will be * as the intent param. If the setTitleChooser boolean is true, the string "Open with" will be
* set as the title of the system chooser. * set as the title of the system chooser.
* For Android P and higher, title for {@link android.content.Intent#ACTION_SEND} system * For Android P and higher, title for {@link Intent#ACTION_SEND} system
* choosers must be set on this intent, not on the * choosers must be set on this intent, not on the
* {@link android.content.Intent#ACTION_CHOOSER} intent. * {@link Intent#ACTION_CHOOSER} intent.
* *
* @param context the context to use * @param context the context to use
* @param intent the intent to open * @param intent the intent to open

View File

@ -57,8 +57,8 @@ public final class FocusAwareDrawerLayout extends DrawerLayout {
for (int i = 0; i < getChildCount(); ++i) { for (int i = 0; i < getChildCount(); ++i) {
final View child = getChildAt(i); final View child = getChildAt(i);
final DrawerLayout.LayoutParams lp = final LayoutParams lp =
(DrawerLayout.LayoutParams) child.getLayoutParams(); (LayoutParams) child.getLayoutParams();
if (lp.gravity != 0 && isDrawerVisible(child)) { if (lp.gravity != 0 && isDrawerVisible(child)) {
hasOpenPanels = true; hasOpenPanels = true;
@ -85,8 +85,8 @@ public final class FocusAwareDrawerLayout extends DrawerLayout {
for (int i = 0; i < getChildCount(); ++i) { for (int i = 0; i < getChildCount(); ++i) {
final View child = getChildAt(i); final View child = getChildAt(i);
final DrawerLayout.LayoutParams lp = final LayoutParams lp =
(DrawerLayout.LayoutParams) child.getLayoutParams(); (LayoutParams) child.getLayoutParams();
if (lp.gravity == 0) { if (lp.gravity == 0) {
content = child; content = child;

View File

@ -94,7 +94,7 @@ public class DownloadRunnable extends Thread {
continue; continue;
} }
throw new DownloadMission.HttpError(416); throw new HttpError(416);
} }
retry = false; retry = false;
@ -104,7 +104,7 @@ public class DownloadRunnable extends Thread {
if (DEBUG) { if (DEBUG) {
Log.e(TAG, mId + ":Unsupported " + mConn.getResponseCode()); Log.e(TAG, mId + ":Unsupported " + mConn.getResponseCode());
} }
mMission.notifyError(new DownloadMission.HttpError(mConn.getResponseCode())); mMission.notifyError(new HttpError(mConn.getResponseCode()));
break; break;
} }

View File

@ -75,7 +75,7 @@ public class DownloadRunnableFallback extends Thread {
mMission.notifyProgress(-start); mMission.notifyProgress(-start);
start = 0; start = 0;
mRetryCount--; mRetryCount--;
throw new DownloadMission.HttpError(416); throw new HttpError(416);
} }
// secondary check for the file length // secondary check for the file length

View File

@ -20,7 +20,7 @@ import us.shandian.giga.get.Mission;
import org.schabi.newpipe.streams.io.StoredFileHelper; import org.schabi.newpipe.streams.io.StoredFileHelper;
/** /**
* SQLite helper to store finished {@link us.shandian.giga.get.FinishedMission}'s * SQLite helper to store finished {@link FinishedMission}'s
*/ */
public class FinishedMissionStore extends SQLiteOpenHelper { public class FinishedMissionStore extends SQLiteOpenHelper {

View File

@ -837,7 +837,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
} }
class ViewHolderItem extends RecyclerView.ViewHolder { class ViewHolderItem extends ViewHolder {
DownloadManager.MissionItem item; DownloadManager.MissionItem item;
TextView status; TextView status;
@ -980,7 +980,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
} }
} }
static class ViewHolderHeader extends RecyclerView.ViewHolder { static class ViewHolderHeader extends ViewHolder {
TextView header; TextView header;
ViewHolderHeader(View view) { ViewHolderHeader(View view) {

View File

@ -7,7 +7,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.2.2' classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong