From fb3ed83d51af3149370343f9675770a19fe5ebb3 Mon Sep 17 00:00:00 2001 From: Zhidong Piao Date: Wed, 26 Oct 2022 04:51:35 +1100 Subject: [PATCH] update project to the latest dev branch --- app/build.gradle | 2 +- app/src/debug/AndroidManifest.xml | 6 ++---- app/src/main/AndroidManifest.xml | 4 +++- .../app/FragmentStatePagerAdapterMenuWorkaround.java | 2 +- .../org/schabi/newpipe/error/ReCaptchaActivity.java | 2 +- .../main/java/org/schabi/newpipe/player/Player.java | 4 ++-- .../java/org/schabi/newpipe/player/PlayerService.java | 2 +- .../player/datasource/YoutubeHttpDataSource.java | 6 +++--- .../org/schabi/newpipe/player/helper/PlayerHelper.java | 8 ++++---- .../schabi/newpipe/player/mediaitem/StreamInfoTag.java | 4 ++-- .../newpipe/player/mediasource/FailedMediaSource.java | 2 +- .../org/schabi/newpipe/player/ui/VideoPlayerUi.java | 2 +- .../newpipe/settings/PeertubeInstanceListFragment.java | 6 +++--- .../newpipe/settings/tabs/ChooseTabsFragment.java | 10 +++++----- .../java/org/schabi/newpipe/streams/WebMWriter.java | 2 +- .../java/org/schabi/newpipe/util/SparseItemUtil.java | 4 ++-- .../main/java/org/schabi/newpipe/util/StateSaver.java | 4 ++-- .../util/external_communication/ShareUtils.java | 6 +++--- .../schabi/newpipe/views/FocusAwareDrawerLayout.java | 8 ++++---- .../java/us/shandian/giga/get/DownloadRunnable.java | 4 ++-- .../us/shandian/giga/get/DownloadRunnableFallback.java | 2 +- .../shandian/giga/get/sqlite/FinishedMissionStore.java | 2 +- .../us/shandian/giga/ui/adapter/MissionAdapter.java | 4 ++-- build.gradle | 2 +- 24 files changed, 49 insertions(+), 49 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9d941d5a7..7d9eafdd0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ plugins { android { compileSdk 31 - buildToolsVersion '31.0.0' + namespace 'org.schabi.newpipe' defaultConfig { applicationId "org.schabi.newpipe" diff --git a/app/src/debug/AndroidManifest.xml b/app/src/debug/AndroidManifest.xml index 5cc2fa66a..02a0f6c74 100644 --- a/app/src/debug/AndroidManifest.xml +++ b/app/src/debug/AndroidManifest.xml @@ -1,8 +1,6 @@ - + @@ -14,6 +13,9 @@ + * It includes a workaround to fix the menu visibility when the adapter is restored. *

diff --git a/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java b/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java index e2780d215..ffc2017e7 100644 --- a/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java +++ b/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java @@ -163,7 +163,7 @@ public class ReCaptchaActivity extends AppCompatActivity { // Navigate to blank page (unloads youtube to prevent background playback) 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); NavUtils.navigateUpTo(this, intent); } diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 99d36f66e..1612cf15d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -1358,7 +1358,7 @@ public final class Player implements PlaybackListener, Listener { //////////////////////////////////////////////////////////////////////////*/ //region Errors /** - * Process exceptions produced by {@link com.google.android.exoplayer2.ExoPlayer ExoPlayer}. + * Process exceptions produced by {@link ExoPlayer ExoPlayer}. *

There are multiple types of errors:

*
    *
  • {@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 not explicitly catchable, the player will * create a notification so users are aware. *
- * @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 // (e.g. DRM) or not recoverable (e.g. Decoder error). In both cases, the player should diff --git a/app/src/main/java/org/schabi/newpipe/player/PlayerService.java b/app/src/main/java/org/schabi/newpipe/player/PlayerService.java index 33b024e3d..2f03f0ee8 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PlayerService.java +++ b/app/src/main/java/org/schabi/newpipe/player/PlayerService.java @@ -41,7 +41,7 @@ public final class PlayerService extends Service { private Player player; - private final IBinder mBinder = new PlayerService.LocalBinder(); + private final IBinder mBinder = new LocalBinder(); /*////////////////////////////////////////////////////////////////////////// diff --git a/app/src/main/java/org/schabi/newpipe/player/datasource/YoutubeHttpDataSource.java b/app/src/main/java/org/schabi/newpipe/player/datasource/YoutubeHttpDataSource.java index cf1f03b45..24620172b 100644 --- a/app/src/main/java/org/schabi/newpipe/player/datasource/YoutubeHttpDataSource.java +++ b/app/src/main/java/org/schabi/newpipe/player/datasource/YoutubeHttpDataSource.java @@ -64,7 +64,7 @@ import java.util.zip.GZIPInputStream; /** * 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. * *

* It adds more headers to {@code videoplayback} URLs, such as {@code Origin}, {@code Referer} @@ -73,7 +73,7 @@ import java.util.zip.GZIPInputStream; *

* * 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. */ @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 - * then a {@link HttpDataSource.InvalidContentTypeException} is thrown from + * then a {@link InvalidContentTypeException} is thrown from * {@link YoutubeHttpDataSource#open(DataSpec)}. * *

diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java index abde7c3d1..f9ca530b2 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java @@ -280,11 +280,11 @@ public final class PlayerHelper { public static boolean isAutoplayAllowedByUser(@NonNull final Context context) { switch (PlayerHelper.getAutoplayType(context)) { - case PlayerHelper.AutoplayType.AUTOPLAY_TYPE_NEVER: + case AutoplayType.AUTOPLAY_TYPE_NEVER: return false; - case PlayerHelper.AutoplayType.AUTOPLAY_TYPE_WIFI: + case AutoplayType.AUTOPLAY_TYPE_WIFI: return !ListHelper.isMeteredNetwork(context); - case PlayerHelper.AutoplayType.AUTOPLAY_TYPE_ALWAYS: + case AutoplayType.AUTOPLAY_TYPE_ALWAYS: default: return true; } @@ -382,7 +382,7 @@ public final class PlayerHelper { public static boolean globalScreenOrientationLocked(final Context context) { // 1: Screen orientation changes using accelerometer // 0: Screen orientation is locked - return android.provider.Settings.System.getInt( + return Settings.System.getInt( context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 0; } diff --git a/app/src/main/java/org/schabi/newpipe/player/mediaitem/StreamInfoTag.java b/app/src/main/java/org/schabi/newpipe/player/mediaitem/StreamInfoTag.java index 4095f2bc8..ad6c0b405 100644 --- a/app/src/main/java/org/schabi/newpipe/player/mediaitem/StreamInfoTag.java +++ b/app/src/main/java/org/schabi/newpipe/player/mediaitem/StreamInfoTag.java @@ -23,12 +23,12 @@ public final class StreamInfoTag implements MediaItemTag { @NonNull private final StreamInfo streamInfo; @Nullable - private final MediaItemTag.Quality quality; + private final Quality quality; @Nullable private final Object extras; private StreamInfoTag(@NonNull final StreamInfo streamInfo, - @Nullable final MediaItemTag.Quality quality, + @Nullable final Quality quality, @Nullable final Object extras) { this.streamInfo = streamInfo; this.quality = quality; diff --git a/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java b/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java index b9ca90d89..8bed2f240 100644 --- a/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java +++ b/app/src/main/java/org/schabi/newpipe/player/mediasource/FailedMediaSource.java @@ -121,7 +121,7 @@ public class FailedMediaSource extends BaseMediaSource implements ManagedMediaSo * {@link com.google.android.exoplayer2.Player.Listener#onPlayerError(PlaybackException)}. * * @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 public void maybeThrowSourceInfoRefreshError() throws IOException { diff --git a/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java b/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java index 1709755f2..e0e253181 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java +++ b/app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java @@ -1425,7 +1425,7 @@ public abstract class VideoPlayerUi extends PlayerUi break; } - if (player.getCurrentState() == org.schabi.newpipe.player.Player.STATE_BLOCKED) { + if (player.getCurrentState() == Player.STATE_BLOCKED) { return true; } diff --git a/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java b/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java index 1158b3d83..e6d281233 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java @@ -339,14 +339,14 @@ public class PeertubeInstanceListFragment extends Fragment { @NonNull @Override - public InstanceListAdapter.TabViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, + public TabViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) { - return new InstanceListAdapter.TabViewHolder(ItemInstanceBinding.inflate(inflater, + return new TabViewHolder(ItemInstanceBinding.inflate(inflater, parent, false)); } @Override - public void onBindViewHolder(@NonNull final InstanceListAdapter.TabViewHolder holder, + public void onBindViewHolder(@NonNull final TabViewHolder holder, final int position) { holder.bind(position); } diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java index 289c824ba..b6556db9e 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java @@ -45,7 +45,7 @@ public class ChooseTabsFragment extends Fragment { private TabsManager tabsManager; private final List tabList = new ArrayList<>(); - private ChooseTabsFragment.SelectedTabsAdapter selectedTabsAdapter; + private SelectedTabsAdapter selectedTabsAdapter; /*////////////////////////////////////////////////////////////////////////// // Lifecycle @@ -316,7 +316,7 @@ public class ChooseTabsFragment extends Fragment { } private class SelectedTabsAdapter - extends RecyclerView.Adapter { + extends RecyclerView.Adapter { private final LayoutInflater inflater; private final ItemTouchHelper itemTouchHelper; @@ -332,15 +332,15 @@ public class ChooseTabsFragment extends Fragment { @NonNull @Override - public ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder onCreateViewHolder( + public TabViewHolder onCreateViewHolder( @NonNull final ViewGroup parent, final int viewType) { final View view = inflater.inflate(R.layout.list_choose_tabs, parent, false); - return new ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder(view); + return new TabViewHolder(view); } @Override public void onBindViewHolder( - @NonNull final ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder holder, + @NonNull final TabViewHolder holder, final int position) { holder.bind(position, holder); } diff --git a/app/src/main/java/org/schabi/newpipe/streams/WebMWriter.java b/app/src/main/java/org/schabi/newpipe/streams/WebMWriter.java index 2b69f23ac..34b6d6703 100644 --- a/app/src/main/java/org/schabi/newpipe/streams/WebMWriter.java +++ b/app/src/main/java/org/schabi/newpipe/streams/WebMWriter.java @@ -27,7 +27,7 @@ public class WebMWriter implements Closeable { private static final int CUE_RESERVE_SIZE = 65535; private static final byte MINIMUM_EBML_VOID_SIZE = 4; - private WebMReader.WebMTrack[] infoTracks; + private WebMTrack[] infoTracks; private SharpStream[] sourceTracks; private WebMReader[] readers; diff --git a/app/src/main/java/org/schabi/newpipe/util/SparseItemUtil.java b/app/src/main/java/org/schabi/newpipe/util/SparseItemUtil.java index 6e9ea7a47..cd1a29381 100644 --- a/app/src/main/java/org/schabi/newpipe/util/SparseItemUtil.java +++ b/app/src/main/java/org/schabi/newpipe/util/SparseItemUtil.java @@ -42,7 +42,7 @@ public final class SparseItemUtil { * @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 * all info was available, otherwise from the fetched {@link - * org.schabi.newpipe.extractor.stream.StreamInfo} + * StreamInfo} */ public static void fetchItemInfoIfSparse(@NonNull final Context context, @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 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 - * org.schabi.newpipe.extractor.stream.StreamInfo} corresponding to the item + * StreamInfo} corresponding to the item */ public static void fetchUploaderUrlIfSparse(@NonNull final Context context, final int serviceId, diff --git a/app/src/main/java/org/schabi/newpipe/util/StateSaver.java b/app/src/main/java/org/schabi/newpipe/util/StateSaver.java index 3c901aacb..a70e9efad 100644 --- a/app/src/main/java/org/schabi/newpipe/util/StateSaver.java +++ b/app/src/main/java/org/schabi/newpipe/util/StateSaver.java @@ -92,7 +92,7 @@ public final class StateSaver { /** * 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 writeRead @@ -176,7 +176,7 @@ public final class StateSaver { /** * 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, * in a cache folder got from the {@link #init(Context)}. *

diff --git a/app/src/main/java/org/schabi/newpipe/util/external_communication/ShareUtils.java b/app/src/main/java/org/schabi/newpipe/util/external_communication/ShareUtils.java index debeb902c..f543def37 100644 --- a/app/src/main/java/org/schabi/newpipe/util/external_communication/ShareUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/external_communication/ShareUtils.java @@ -163,12 +163,12 @@ public final class ShareUtils { /** * Open the system chooser to launch an intent. *

- * 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 * 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 - * {@link android.content.Intent#ACTION_CHOOSER} intent. + * {@link Intent#ACTION_CHOOSER} intent. * * @param context the context to use * @param intent the intent to open diff --git a/app/src/main/java/org/schabi/newpipe/views/FocusAwareDrawerLayout.java b/app/src/main/java/org/schabi/newpipe/views/FocusAwareDrawerLayout.java index 5c694c3a9..4522999ba 100644 --- a/app/src/main/java/org/schabi/newpipe/views/FocusAwareDrawerLayout.java +++ b/app/src/main/java/org/schabi/newpipe/views/FocusAwareDrawerLayout.java @@ -57,8 +57,8 @@ public final class FocusAwareDrawerLayout extends DrawerLayout { for (int i = 0; i < getChildCount(); ++i) { final View child = getChildAt(i); - final DrawerLayout.LayoutParams lp = - (DrawerLayout.LayoutParams) child.getLayoutParams(); + final LayoutParams lp = + (LayoutParams) child.getLayoutParams(); if (lp.gravity != 0 && isDrawerVisible(child)) { hasOpenPanels = true; @@ -85,8 +85,8 @@ public final class FocusAwareDrawerLayout extends DrawerLayout { for (int i = 0; i < getChildCount(); ++i) { final View child = getChildAt(i); - final DrawerLayout.LayoutParams lp = - (DrawerLayout.LayoutParams) child.getLayoutParams(); + final LayoutParams lp = + (LayoutParams) child.getLayoutParams(); if (lp.gravity == 0) { content = child; diff --git a/app/src/main/java/us/shandian/giga/get/DownloadRunnable.java b/app/src/main/java/us/shandian/giga/get/DownloadRunnable.java index 6f504cea3..d1f0d6126 100644 --- a/app/src/main/java/us/shandian/giga/get/DownloadRunnable.java +++ b/app/src/main/java/us/shandian/giga/get/DownloadRunnable.java @@ -94,7 +94,7 @@ public class DownloadRunnable extends Thread { continue; } - throw new DownloadMission.HttpError(416); + throw new HttpError(416); } retry = false; @@ -104,7 +104,7 @@ public class DownloadRunnable extends Thread { if (DEBUG) { Log.e(TAG, mId + ":Unsupported " + mConn.getResponseCode()); } - mMission.notifyError(new DownloadMission.HttpError(mConn.getResponseCode())); + mMission.notifyError(new HttpError(mConn.getResponseCode())); break; } diff --git a/app/src/main/java/us/shandian/giga/get/DownloadRunnableFallback.java b/app/src/main/java/us/shandian/giga/get/DownloadRunnableFallback.java index eed5db463..8bc3630ad 100644 --- a/app/src/main/java/us/shandian/giga/get/DownloadRunnableFallback.java +++ b/app/src/main/java/us/shandian/giga/get/DownloadRunnableFallback.java @@ -75,7 +75,7 @@ public class DownloadRunnableFallback extends Thread { mMission.notifyProgress(-start); start = 0; mRetryCount--; - throw new DownloadMission.HttpError(416); + throw new HttpError(416); } // secondary check for the file length diff --git a/app/src/main/java/us/shandian/giga/get/sqlite/FinishedMissionStore.java b/app/src/main/java/us/shandian/giga/get/sqlite/FinishedMissionStore.java index 704385212..d6191fdb1 100644 --- a/app/src/main/java/us/shandian/giga/get/sqlite/FinishedMissionStore.java +++ b/app/src/main/java/us/shandian/giga/get/sqlite/FinishedMissionStore.java @@ -20,7 +20,7 @@ import us.shandian.giga.get.Mission; 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 { diff --git a/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java b/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java index 343b13ef8..494532f2b 100644 --- a/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java +++ b/app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java @@ -837,7 +837,7 @@ public class MissionAdapter extends Adapter implements Handler.Callb } - class ViewHolderItem extends RecyclerView.ViewHolder { + class ViewHolderItem extends ViewHolder { DownloadManager.MissionItem item; TextView status; @@ -980,7 +980,7 @@ public class MissionAdapter extends Adapter implements Handler.Callb } } - static class ViewHolderHeader extends RecyclerView.ViewHolder { + static class ViewHolderHeader extends ViewHolder { TextView header; ViewHolderHeader(View view) { diff --git a/build.gradle b/build.gradle index 739f2e618..a0c1fdf27 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { mavenCentral() } 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" // NOTE: Do not place your application dependencies here; they belong