Correct some other small lints

This commit is contained in:
TacoTheDank 2020-11-19 18:54:27 -05:00
parent 04cb6ba3d0
commit 2669ba944d
9 changed files with 20 additions and 25 deletions

View file

@ -139,8 +139,7 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (getSupportFragmentManager() != null
&& getSupportFragmentManager().getBackStackEntryCount() == 0) {
if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
initFragments();
}

View file

@ -519,7 +519,7 @@ public class RouterActivity extends AppCompatActivity {
disposables.add(ExtractorHelper.getStreamInfo(currentServiceId, currentUrl, true)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe((@NonNull StreamInfo result) -> {
.subscribe(result -> {
final List<VideoStream> sortedVideoStreams = ListHelper
.getSortedStreamVideosList(this, result.getVideoStreams(),
result.getVideoOnlyStreams(), false);
@ -534,7 +534,7 @@ public class RouterActivity extends AppCompatActivity {
downloadDialog.show(fm, "downloadDialog");
fm.executePendingTransactions();
downloadDialog.requireDialog().setOnDismissListener(dialog -> finish());
}, (@NonNull Throwable throwable) ->
}, throwable ->
showUnsupportedUrlDialog(currentUrl)));
}

View file

@ -19,7 +19,6 @@ import android.view.ViewTreeObserver;
import androidx.core.text.HtmlCompat;
import androidx.preference.PreferenceManager;
import android.provider.Settings;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.util.Linkify;
import android.util.DisplayMetrics;
@ -731,7 +730,7 @@ public final class VideoDetailFragment
}
private View.OnTouchListener getOnControlsTouchListener() {
return (View view, MotionEvent motionEvent) -> {
return (view, motionEvent) -> {
if (!PreferenceManager.getDefaultSharedPreferences(activity)
.getBoolean(getString(R.string.show_hold_to_append_key), true)) {
return false;
@ -948,7 +947,7 @@ public final class VideoDetailFragment
currentWorker = ExtractorHelper.getStreamInfo(serviceId, url, forceLoad)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe((@NonNull final StreamInfo result) -> {
.subscribe(result -> {
isLoading.set(false);
hideMainPlayer();
if (result.getAgeLimit() != NO_AGE_LIMIT && !prefs.getBoolean(
@ -969,7 +968,7 @@ public final class VideoDetailFragment
openVideoPlayer();
}
}
}, (@NonNull final Throwable throwable) -> {
}, throwable -> {
isLoading.set(false);
onError(throwable);
});
@ -1224,12 +1223,12 @@ public final class VideoDetailFragment
if (description.getType() == Description.HTML) {
disposables.add(Single.just(description.getContent())
.map((@NonNull final String descriptionText) ->
.map(descriptionText ->
HtmlCompat.fromHtml(descriptionText,
HtmlCompat.FROM_HTML_MODE_LEGACY))
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe((@NonNull final Spanned spanned) -> {
.subscribe(spanned -> {
videoDescriptionView.setText(spanned);
videoDescriptionView.setVisibility(View.VISIBLE);
}));

View file

@ -1545,8 +1545,7 @@ public abstract class BasePlayer implements
if (simpleExoPlayer == null) {
return PlaybackParameters.DEFAULT;
}
final PlaybackParameters parameters = simpleExoPlayer.getPlaybackParameters();
return parameters == null ? PlaybackParameters.DEFAULT : parameters;
return simpleExoPlayer.getPlaybackParameters();
}
/**

View file

@ -337,7 +337,7 @@ public class VideoPlayerImpl extends VideoPlayer
view.setFixedTextSize(TypedValue.COMPLEX_UNIT_PX,
(float) minimumLength / captionRatioInverse);
}
view.setApplyEmbeddedStyles(captionStyle.equals(CaptionStyleCompat.DEFAULT));
view.setApplyEmbeddedStyles(captionStyle == CaptionStyleCompat.DEFAULT);
view.setStyle(captionStyle);
}

View file

@ -216,15 +216,15 @@ public class ErrorActivity extends AppCompatActivity {
addGuruMeditation();
currentTimeStamp = getCurrentTimeStamp();
reportEmailButton.setOnClickListener((View v) ->
reportEmailButton.setOnClickListener(v ->
openPrivacyPolicyDialog(this, "EMAIL"));
copyButton.setOnClickListener((View v) -> {
copyButton.setOnClickListener(v -> {
ShareUtils.copyToClipboard(this, buildMarkdown());
Toast.makeText(this, R.string.msg_copied, Toast.LENGTH_SHORT).show();
});
reportGithubButton.setOnClickListener((View v) ->
reportGithubButton.setOnClickListener(v ->
openPrivacyPolicyDialog(this, "GITHUB"));

View file

@ -3,7 +3,6 @@ package org.schabi.newpipe.settings;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
@ -134,7 +133,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
addPreferencesFromResource(R.xml.content_settings);
final Preference importDataPreference = findPreference(getString(R.string.import_data));
importDataPreference.setOnPreferenceClickListener((Preference p) -> {
importDataPreference.setOnPreferenceClickListener(p -> {
final Intent i = new Intent(getActivity(), FilePickerActivityHelper.class)
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_MULTIPLE, false)
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_CREATE_DIR, false)
@ -145,7 +144,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
});
final Preference exportDataPreference = findPreference(getString(R.string.export_data));
exportDataPreference.setOnPreferenceClickListener((Preference p) -> {
exportDataPreference.setOnPreferenceClickListener(p -> {
final Intent i = new Intent(getActivity(), FilePickerActivityHelper.class)
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_MULTIPLE, false)
.putExtra(FilePickerActivityHelper.EXTRA_ALLOW_CREATE_DIR, true)
@ -199,9 +198,9 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.override_current_data)
.setPositiveButton(getString(R.string.finish),
(DialogInterface d, int id) -> importDatabase(path))
(d, id) -> importDatabase(path))
.setNegativeButton(android.R.string.cancel,
(DialogInterface d, int id) -> d.cancel());
(d, id) -> d.cancel());
builder.create().show();
}
}

View file

@ -116,7 +116,7 @@ public abstract class Tab {
return true;
}
return obj instanceof Tab && obj.getClass().equals(this.getClass())
return obj instanceof Tab && obj.getClass() == this.getClass()
&& ((Tab) obj).getTabId() == this.getTabId();
}

View file

@ -2,7 +2,6 @@ package org.schabi.newpipe.util;
import android.content.Context;
import android.content.DialogInterface;
import androidx.appcompat.app.AlertDialog;
@ -20,9 +19,9 @@ public final class KoreUtil {
public static void showInstallKoreDialog(final Context context) {
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(R.string.kore_not_found)
.setPositiveButton(R.string.install, (DialogInterface dialog, int which) ->
.setPositiveButton(R.string.install, (dialog, which) ->
NavigationHelper.installKore(context))
.setNegativeButton(R.string.cancel, (DialogInterface dialog, int which) -> {
.setNegativeButton(R.string.cancel, (dialog, which) -> {
});
builder.create().show();
}