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