mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-23 03:22:37 +01:00
Some general-purpose lint cleanup
This commit is contained in:
parent
273c287fbf
commit
f86b40302d
@ -114,8 +114,8 @@ public final class DownloaderImpl extends Downloader {
|
||||
// Necessary because some servers (e.g. Framatube.org)
|
||||
// don't support the old cipher suites.
|
||||
// https://github.com/square/okhttp/issues/4053#issuecomment-402579554
|
||||
final List<CipherSuite> cipherSuites = new ArrayList<>();
|
||||
cipherSuites.addAll(ConnectionSpec.MODERN_TLS.cipherSuites());
|
||||
final List<CipherSuite> cipherSuites =
|
||||
new ArrayList<>(ConnectionSpec.MODERN_TLS.cipherSuites());
|
||||
cipherSuites.add(CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA);
|
||||
cipherSuites.add(CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA);
|
||||
final ConnectionSpec legacyTLS = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
|
||||
|
@ -568,7 +568,7 @@ public class RouterActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toArray(new String[result.size()]);
|
||||
return result.toArray(new String[0]);
|
||||
}
|
||||
|
||||
private static class AdapterChoiceItem {
|
||||
|
@ -672,7 +672,8 @@ public class VideoDetailFragment
|
||||
}
|
||||
break;
|
||||
case R.id.detail_title_root_layout:
|
||||
ShareUtils.copyToClipboard(requireContext(), videoTitleTextView.getText().toString());
|
||||
ShareUtils.copyToClipboard(requireContext(),
|
||||
videoTitleTextView.getText().toString());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -166,12 +166,10 @@ public class RelatedVideosFragment extends BaseListInfoFragment<RelatedStreamInf
|
||||
|
||||
@Override
|
||||
public void setTitle(final String title) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
|
||||
return;
|
||||
}
|
||||
|
||||
private void setInitialData(final StreamInfo info) {
|
||||
|
@ -252,7 +252,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
|
||||
}
|
||||
})
|
||||
|
||||
subscriptionGroupAdapter?.setOnItemClickListener(subscriptionPickerItemListener)
|
||||
subscriptionGroupAdapter.setOnItemClickListener(subscriptionPickerItemListener)
|
||||
}
|
||||
|
||||
private fun handlePositiveButton() = when {
|
||||
|
@ -115,7 +115,7 @@ public class VideoPlaybackResolver implements PlaybackResolver {
|
||||
return mediaSources.get(0);
|
||||
} else {
|
||||
return new MergingMediaSource(mediaSources.toArray(
|
||||
new MediaSource[mediaSources.size()]));
|
||||
new MediaSource[0]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
|
||||
}
|
||||
}
|
||||
|
||||
final ListPreference durations = (ListPreference) findPreference(
|
||||
final ListPreference durations = findPreference(
|
||||
getString(R.string.seek_duration_key));
|
||||
durations.setEntryValues(displayedDurationValues.toArray(new CharSequence[0]));
|
||||
durations.setEntries(displayedDescriptionValues.toArray(new CharSequence[0]));
|
||||
|
@ -236,7 +236,7 @@ public class DataReader {
|
||||
|
||||
if (read != amount) {
|
||||
throw new EOFException("Truncated stream, missing "
|
||||
+ String.valueOf(amount - read) + " bytes");
|
||||
+ (amount - read) + " bytes");
|
||||
}
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
|
@ -5,8 +5,8 @@ import org.schabi.newpipe.streams.io.SharpStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
@ -259,11 +259,7 @@ public class Mp4DashReader {
|
||||
}
|
||||
|
||||
private String boxName(final int type) {
|
||||
try {
|
||||
return new String(ByteBuffer.allocate(4).putInt(type).array(), "UTF-8");
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
return "0x" + Integer.toHexString(type);
|
||||
}
|
||||
return new String(ByteBuffer.allocate(4).putInt(type).array(), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private Box readBox() throws IOException {
|
||||
|
@ -293,7 +293,7 @@ public class WebMReader {
|
||||
if (metadataExpected && (obj.info == null || obj.tracks == null)) {
|
||||
throw new RuntimeException(
|
||||
"Cluster element found without Info and/or Tracks element at position "
|
||||
+ String.valueOf(ref.offset));
|
||||
+ ref.offset);
|
||||
}
|
||||
|
||||
return obj;
|
||||
@ -389,7 +389,7 @@ public class WebMReader {
|
||||
|
||||
final Element elem = untilElement(ref, ID_TIMECODE);
|
||||
if (elem == null) {
|
||||
throw new NoSuchElementException("Cluster at " + String.valueOf(ref.offset)
|
||||
throw new NoSuchElementException("Cluster at " + ref.offset
|
||||
+ " without Timecode element");
|
||||
}
|
||||
obj.timecode = readNumber(elem);
|
||||
@ -520,7 +520,7 @@ public class WebMReader {
|
||||
|
||||
currentSimpleBlock = readSimpleBlock(elem);
|
||||
if (currentSimpleBlock.trackNumber == tracks[selectedTrack].trackNumber) {
|
||||
currentSimpleBlock.data = stream.getView((int) currentSimpleBlock.dataSize);
|
||||
currentSimpleBlock.data = stream.getView(currentSimpleBlock.dataSize);
|
||||
|
||||
// calculate the timestamp in nanoseconds
|
||||
currentSimpleBlock.absoluteTimeCodeNs = currentSimpleBlock.relativeTimeCode
|
||||
|
@ -422,7 +422,7 @@ public final class AnimationUtils {
|
||||
final long duration, final long delay,
|
||||
final Runnable execOnEnd) {
|
||||
if (enterOrExit) {
|
||||
view.setTranslationY(-view.getHeight() / 2);
|
||||
view.setTranslationY(-view.getHeight() / 2.0f);
|
||||
view.setAlpha(0f);
|
||||
view.animate()
|
||||
.setInterpolator(new FastOutSlowInInterpolator()).alpha(1f).translationY(0)
|
||||
@ -437,7 +437,7 @@ public final class AnimationUtils {
|
||||
}).start();
|
||||
} else {
|
||||
view.animate().setInterpolator(new FastOutSlowInInterpolator())
|
||||
.alpha(0f).translationY(-view.getHeight() / 2)
|
||||
.alpha(0f).translationY(-view.getHeight() / 2.0f)
|
||||
.setDuration(duration).setStartDelay(delay)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
|
@ -20,8 +20,7 @@ public class RelatedStreamInfo extends ListInfo<InfoItem> {
|
||||
info.getOriginalUrl(), info.getUrl(), info.getId(), Collections.emptyList(), null);
|
||||
final RelatedStreamInfo relatedStreamInfo = new RelatedStreamInfo(
|
||||
info.getServiceId(), handler, info.getName());
|
||||
final List<InfoItem> streams = new ArrayList<>();
|
||||
streams.addAll(info.getRelatedStreams());
|
||||
final List<InfoItem> streams = new ArrayList<>(info.getRelatedStreams());
|
||||
relatedStreamInfo.setRelatedItems(streams);
|
||||
return relatedStreamInfo;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class TLSSocketFactoryCompat extends SSLSocketFactory {
|
||||
}
|
||||
|
||||
private Socket enableTLSOnSocket(final Socket socket) {
|
||||
if (socket != null && (socket instanceof SSLSocket)) {
|
||||
if (socket instanceof SSLSocket) {
|
||||
((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"});
|
||||
}
|
||||
return socket;
|
||||
|
@ -633,7 +633,7 @@ public class DownloadMission extends Mission {
|
||||
calculated = offsets[current < offsets.length ? current : (offsets.length - 1)] + length;
|
||||
calculated -= offsets[0];// don't count reserved space
|
||||
|
||||
return calculated > nearLength ? calculated : nearLength;
|
||||
return Math.max(calculated, nearLength);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,12 +30,12 @@ public class FileStream extends SharpStream {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte b[]) throws IOException {
|
||||
public int read(byte[] b) throws IOException {
|
||||
return source.read(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte b[], int off, int len) throws IOException {
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
return source.read(b, off, len);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public abstract class Postprocessing implements Serializable {
|
||||
mission.done = 0;
|
||||
|
||||
long length = mission.storage.length() - mission.offsets[0];
|
||||
mission.length = length > mission.nearLength ? length : mission.nearLength;
|
||||
mission.length = Math.max(length, mission.nearLength);
|
||||
|
||||
final ProgressReport readProgress = (long position) -> {
|
||||
position -= mission.offsets[0];
|
||||
|
@ -49,6 +49,7 @@ import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
import us.shandian.giga.get.DownloadMission;
|
||||
@ -302,9 +303,7 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
|
||||
float averageSpeed = speed;
|
||||
|
||||
if (h.lastSpeedIdx < 0) {
|
||||
for (int i = 0; i < h.lastSpeed.length; i++) {
|
||||
h.lastSpeed[i] = speed;
|
||||
}
|
||||
Arrays.fill(h.lastSpeed, speed);
|
||||
h.lastSpeedIdx = 0;
|
||||
} else {
|
||||
for (int i = 0; i < h.lastSpeed.length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user