Merge pull request #10435 from TeamNewPipe/imp/codequality

Improve codequality
This commit is contained in:
Stypox 2023-09-20 21:24:44 +02:00 committed by GitHub
commit b798ff5c92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 18 deletions

View File

@ -167,6 +167,10 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
/*////////////////////////////////////////////////////////////////////////*/
/**
* TextWatcher to remove rich-text formatting on the search EditText when pasting content
* from the clipboard.
*/
private TextWatcher textWatcher;
public static SearchFragment getInstance(final int serviceId, final String searchString) {
@ -583,11 +587,13 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
@Override
public void beforeTextChanged(final CharSequence s, final int start,
final int count, final int after) {
// Do nothing, old text is already clean
}
@Override
public void onTextChanged(final CharSequence s, final int start,
final int before, final int count) {
// Changes are handled in afterTextChanged; CharSequence cannot be changed here.
}
@Override

View File

@ -91,11 +91,6 @@ public final class BookmarkFragment extends BaseLocalListFragment<List<PlaylistL
// Fragment LifeCycle - Views
///////////////////////////////////////////////////////////////////////////
@Override
protected void initViews(final View rootView, final Bundle savedInstanceState) {
super.initViews(rootView, savedInstanceState);
}
@Override
protected void initListeners() {
super.initListeners();

View File

@ -1,5 +1,7 @@
package org.schabi.newpipe.player.playqueue;
import androidx.annotation.NonNull;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
@ -20,11 +22,11 @@ public final class SinglePlayQueue extends PlayQueue {
getItem().setRecoveryPosition(startPosition);
}
public SinglePlayQueue(final List<StreamInfoItem> items, final int index) {
public SinglePlayQueue(@NonNull final List<StreamInfoItem> items, final int index) {
super(index, playQueueItemsOf(items));
}
private static List<PlayQueueItem> playQueueItemsOf(final List<StreamInfoItem> items) {
private static List<PlayQueueItem> playQueueItemsOf(@NonNull final List<StreamInfoItem> items) {
final List<PlayQueueItem> 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
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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";