From 748c2babe9c34e533ed7fe97693d284f5d752fd1 Mon Sep 17 00:00:00 2001 From: TobiGr Date: Wed, 20 Sep 2023 15:41:21 +0200 Subject: [PATCH 1/3] Add comments and annotations --- .../newpipe/fragments/list/search/SearchFragment.java | 6 ++++++ .../schabi/newpipe/player/playqueue/SinglePlayQueue.java | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java index 26a283229..4bae6f1ca 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java @@ -167,6 +167,10 @@ public class SearchFragment extends BaseListFragment items, final int index) { + public SinglePlayQueue(@NonNull final List items, final int index) { super(index, playQueueItemsOf(items)); } - private static List playQueueItemsOf(final List items) { + private static List playQueueItemsOf(@NonNull final List items) { final List playQueueItems = new ArrayList<>(items.size()); for (final StreamInfoItem item : items) { playQueueItems.add(new PlayQueueItem(item)); @@ -39,5 +41,7 @@ public final class SinglePlayQueue extends PlayQueue { @Override public void fetch() { + // Item was already passed in constructor. + // No further items need to be fetched as this is a PlayQueue with only one item } } From 8bf2d996ea681271447e115cd3d535358e453e0c Mon Sep 17 00:00:00 2001 From: TobiGr Date: Wed, 20 Sep 2023 15:41:57 +0200 Subject: [PATCH 2/3] Reorder the modifiers to comply with the Java Language Specification. --- .../java/us/shandian/giga/get/DownloadInitializer.java | 8 ++++---- .../main/java/us/shandian/giga/io/CircularFileWriter.java | 8 ++++---- .../java/us/shandian/giga/service/DownloadManager.java | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/us/shandian/giga/get/DownloadInitializer.java b/app/src/main/java/us/shandian/giga/get/DownloadInitializer.java index 1d5a93588..84e968b43 100644 --- a/app/src/main/java/us/shandian/giga/get/DownloadInitializer.java +++ b/app/src/main/java/us/shandian/giga/get/DownloadInitializer.java @@ -18,10 +18,10 @@ import static org.schabi.newpipe.BuildConfig.DEBUG; import static us.shandian.giga.get.DownloadMission.ERROR_HTTP_FORBIDDEN; public class DownloadInitializer extends Thread { - private final static String TAG = "DownloadInitializer"; - final static int mId = 0; - private final static int RESERVE_SPACE_DEFAULT = 5 * 1024 * 1024;// 5 MiB - private final static int RESERVE_SPACE_MAXIMUM = 150 * 1024 * 1024;// 150 MiB + private static final String TAG = "DownloadInitializer"; + static final int mId = 0; + private static final int RESERVE_SPACE_DEFAULT = 5 * 1024 * 1024;// 5 MiB + private static final int RESERVE_SPACE_MAXIMUM = 150 * 1024 * 1024;// 150 MiB private final DownloadMission mMission; private HttpURLConnection mConn; diff --git a/app/src/main/java/us/shandian/giga/io/CircularFileWriter.java b/app/src/main/java/us/shandian/giga/io/CircularFileWriter.java index dbceeb091..4473fa7f9 100644 --- a/app/src/main/java/us/shandian/giga/io/CircularFileWriter.java +++ b/app/src/main/java/us/shandian/giga/io/CircularFileWriter.java @@ -11,10 +11,10 @@ import java.util.Objects; public class CircularFileWriter extends SharpStream { - private final static int QUEUE_BUFFER_SIZE = 8 * 1024;// 8 KiB - private final static int COPY_BUFFER_SIZE = 128 * 1024; // 128 KiB - private final static int NOTIFY_BYTES_INTERVAL = 64 * 1024;// 64 KiB - private final static int THRESHOLD_AUX_LENGTH = 15 * 1024 * 1024;// 15 MiB + private static final int QUEUE_BUFFER_SIZE = 8 * 1024;// 8 KiB + private static final int COPY_BUFFER_SIZE = 128 * 1024; // 128 KiB + private static final int NOTIFY_BYTES_INTERVAL = 64 * 1024;// 64 KiB + private static final int THRESHOLD_AUX_LENGTH = 15 * 1024 * 1024;// 15 MiB private final OffsetChecker callback; diff --git a/app/src/main/java/us/shandian/giga/service/DownloadManager.java b/app/src/main/java/us/shandian/giga/service/DownloadManager.java index 7c248c2b6..9b90fa14b 100644 --- a/app/src/main/java/us/shandian/giga/service/DownloadManager.java +++ b/app/src/main/java/us/shandian/giga/service/DownloadManager.java @@ -30,9 +30,9 @@ public class DownloadManager { enum NetworkState {Unavailable, Operating, MeteredOperating} - public final static int SPECIAL_NOTHING = 0; - public final static int SPECIAL_PENDING = 1; - public final static int SPECIAL_FINISHED = 2; + public static final int SPECIAL_NOTHING = 0; + public static final int SPECIAL_PENDING = 1; + public static final int SPECIAL_FINISHED = 2; public static final String TAG_AUDIO = "audio"; public static final String TAG_VIDEO = "video"; From 0acc3532c9cc29ca8b38375a65d878c095f7a376 Mon Sep 17 00:00:00 2001 From: TobiGr Date: Wed, 20 Sep 2023 15:42:09 +0200 Subject: [PATCH 3/3] Remove useless override --- .../org/schabi/newpipe/local/bookmark/BookmarkFragment.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java b/app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java index 0df84d6c0..7ae0563a5 100644 --- a/app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/bookmark/BookmarkFragment.java @@ -91,11 +91,6 @@ public final class BookmarkFragment extends BaseLocalListFragment