Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve codequality #10435

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -583,11 +587,13 @@ public void onSuggestionItemLongClick(final SuggestionItem item) {
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ public void onResume() {
// Fragment LifeCycle - Views
///////////////////////////////////////////////////////////////////////////

@Override
protected void initViews(final View rootView, final Bundle savedInstanceState) {
super.initViews(rootView, savedInstanceState);
}

@Override
protected void initListeners() {
super.initListeners();
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -20,11 +22,11 @@ public SinglePlayQueue(final StreamInfo info, final long startPosition) {
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));
Expand All @@ -39,5 +41,7 @@ public boolean isComplete() {

@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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
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;
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/us/shandian/giga/io/CircularFileWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

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;

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