Lint: Make a bunch of stuff final

This commit is contained in:
TacoTheDank 2020-11-18 17:50:00 -05:00
parent e25622df4b
commit 39e5d8ccc2
27 changed files with 55 additions and 55 deletions

View file

@ -86,8 +86,8 @@ public abstract class FragmentStatePagerAdapterMenuWorkaround extends PagerAdapt
private final int mBehavior; private final int mBehavior;
private FragmentTransaction mCurTransaction = null; private FragmentTransaction mCurTransaction = null;
private ArrayList<Fragment.SavedState> mSavedState = new ArrayList<Fragment.SavedState>(); private final ArrayList<Fragment.SavedState> mSavedState = new ArrayList<Fragment.SavedState>();
private ArrayList<Fragment> mFragments = new ArrayList<Fragment>(); private final ArrayList<Fragment> mFragments = new ArrayList<Fragment>();
private Fragment mCurrentPrimaryItem = null; private Fragment mCurrentPrimaryItem = null;
/** /**

View file

@ -50,8 +50,8 @@ public final class DownloaderImpl extends Downloader {
public static final String YOUTUBE_DOMAIN = "youtube.com"; public static final String YOUTUBE_DOMAIN = "youtube.com";
private static DownloaderImpl instance; private static DownloaderImpl instance;
private Map<String, String> mCookies; private final Map<String, String> mCookies;
private OkHttpClient client; private final OkHttpClient client;
private DownloaderImpl(final OkHttpClient.Builder builder) { private DownloaderImpl(final OkHttpClient.Builder builder) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {

View file

@ -23,7 +23,7 @@ public class License implements Parcelable, Serializable {
}; };
private final String abbreviation; private final String abbreviation;
private final String name; private final String name;
private String filename; private final String filename;
public License(final String name, final String abbreviation, final String filename) { public License(final String name, final String abbreviation, final String filename) {
if (name == null) { if (name == null) {

View file

@ -43,7 +43,7 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
private SelectedTabsPagerAdapter pagerAdapter; private SelectedTabsPagerAdapter pagerAdapter;
private ScrollableTabLayout tabLayout; private ScrollableTabLayout tabLayout;
private List<Tab> tabsList = new ArrayList<>(); private final List<Tab> tabsList = new ArrayList<>();
private TabsManager tabsManager; private TabsManager tabsManager;
private boolean hasTabsChanged = false; private boolean hasTabsChanged = false;

View file

@ -24,7 +24,7 @@ import io.reactivex.Single;
import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.CompositeDisposable;
public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> { public class CommentsFragment extends BaseListInfoFragment<CommentsInfo> {
private CompositeDisposable disposables = new CompositeDisposable(); private final CompositeDisposable disposables = new CompositeDisposable();
public static CommentsFragment getInstance(final int serviceId, final String url, public static CommentsFragment getInstance(final int serviceId, final String url,
final String name) { final String name) {

View file

@ -31,7 +31,7 @@ import io.reactivex.disposables.CompositeDisposable;
public class RelatedVideosFragment extends BaseListInfoFragment<RelatedStreamInfo> public class RelatedVideosFragment extends BaseListInfoFragment<RelatedStreamInfo>
implements SharedPreferences.OnSharedPreferenceChangeListener { implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String INFO_KEY = "related_info_key"; private static final String INFO_KEY = "related_info_key";
private CompositeDisposable disposables = new CompositeDisposable(); private final CompositeDisposable disposables = new CompositeDisposable();
private RelatedStreamInfo relatedStreamInfo; private RelatedStreamInfo relatedStreamInfo;
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////

View file

@ -38,7 +38,7 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
private RecyclerView playlistRecyclerView; private RecyclerView playlistRecyclerView;
private LocalItemListAdapter playlistAdapter; private LocalItemListAdapter playlistAdapter;
private CompositeDisposable playlistDisposables = new CompositeDisposable(); private final CompositeDisposable playlistDisposables = new CompositeDisposable();
public static Disposable onPlaylistFound( public static Disposable onPlaylistFound(
final Context context, final Runnable onSuccess, final Runnable onFailed final Context context, final Runnable onSuccess, final Runnable onFailed

View file

@ -48,7 +48,7 @@ public final class NotificationUtil {
@Nullable private static NotificationUtil instance = null; @Nullable private static NotificationUtil instance = null;
@NotificationConstants.Action @NotificationConstants.Action
private int[] notificationSlots = NotificationConstants.SLOT_DEFAULTS.clone(); private final int[] notificationSlots = NotificationConstants.SLOT_DEFAULTS.clone();
private NotificationManagerCompat notificationManager; private NotificationManagerCompat notificationManager;
private NotificationCompat.Builder notificationBuilder; private NotificationCompat.Builder notificationBuilder;

View file

@ -123,7 +123,7 @@ public class MediaSourceManager {
@NonNull @NonNull
private ManagedMediaSourcePlaylist playlist; private ManagedMediaSourcePlaylist playlist;
private Handler removeMediaSourceHandler = new Handler(); private final Handler removeMediaSourceHandler = new Handler();
public MediaSourceManager(@NonNull final PlaybackListener listener, public MediaSourceManager(@NonNull final PlaybackListener listener,
@NonNull final PlayQueue playQueue) { @NonNull final PlayQueue playQueue) {

View file

@ -53,7 +53,7 @@ import io.reactivex.schedulers.Schedulers;
public class PeertubeInstanceListFragment extends Fragment { public class PeertubeInstanceListFragment extends Fragment {
private static final int MENU_ITEM_RESTORE_ID = 123456; private static final int MENU_ITEM_RESTORE_ID = 123456;
private List<PeertubeInstance> instanceList = new ArrayList<>(); private final List<PeertubeInstance> instanceList = new ArrayList<>();
private PeertubeInstance selectedInstance; private PeertubeInstance selectedInstance;
private String savedInstanceListKey; private String savedInstanceListKey;
private InstanceListAdapter instanceListAdapter; private InstanceListAdapter instanceListAdapter;
@ -344,7 +344,7 @@ public class PeertubeInstanceListFragment extends Fragment {
private class InstanceListAdapter private class InstanceListAdapter
extends RecyclerView.Adapter<InstanceListAdapter.TabViewHolder> { extends RecyclerView.Adapter<InstanceListAdapter.TabViewHolder> {
private final LayoutInflater inflater; private final LayoutInflater inflater;
private ItemTouchHelper itemTouchHelper; private final ItemTouchHelper itemTouchHelper;
private RadioButton lastChecked; private RadioButton lastChecked;
InstanceListAdapter(final Context context, final ItemTouchHelper itemTouchHelper) { InstanceListAdapter(final Context context, final ItemTouchHelper itemTouchHelper) {
@ -377,11 +377,11 @@ public class PeertubeInstanceListFragment extends Fragment {
} }
class TabViewHolder extends RecyclerView.ViewHolder { class TabViewHolder extends RecyclerView.ViewHolder {
private AppCompatImageView instanceIconView; private final AppCompatImageView instanceIconView;
private TextView instanceNameView; private final TextView instanceNameView;
private TextView instanceUrlView; private final TextView instanceUrlView;
private RadioButton instanceRB; private final RadioButton instanceRB;
private ImageView handle; private final ImageView handle;
TabViewHolder(final View itemView) { TabViewHolder(final View itemView) {
super(itemView); super(itemView);

View file

@ -8,7 +8,7 @@ import androidx.preference.Preference;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
public class UpdateSettingsFragment extends BasePreferenceFragment { public class UpdateSettingsFragment extends BasePreferenceFragment {
private Preference.OnPreferenceChangeListener updatePreferenceChange private final Preference.OnPreferenceChangeListener updatePreferenceChange
= (preference, newValue) -> { = (preference, newValue) -> {
defaultPreferences.edit() defaultPreferences.edit()
.putBoolean(getString(R.string.update_app_key), (boolean) newValue).apply(); .putBoolean(getString(R.string.update_app_key), (boolean) newValue).apply();

View file

@ -334,7 +334,7 @@ public class ChooseTabsFragment extends Fragment {
private class SelectedTabsAdapter private class SelectedTabsAdapter
extends RecyclerView.Adapter<ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder> { extends RecyclerView.Adapter<ChooseTabsFragment.SelectedTabsAdapter.TabViewHolder> {
private final LayoutInflater inflater; private final LayoutInflater inflater;
private ItemTouchHelper itemTouchHelper; private final ItemTouchHelper itemTouchHelper;
SelectedTabsAdapter(final Context context, final ItemTouchHelper itemTouchHelper) { SelectedTabsAdapter(final Context context, final ItemTouchHelper itemTouchHelper) {
this.itemTouchHelper = itemTouchHelper; this.itemTouchHelper = itemTouchHelper;
@ -367,9 +367,9 @@ public class ChooseTabsFragment extends Fragment {
} }
class TabViewHolder extends RecyclerView.ViewHolder { class TabViewHolder extends RecyclerView.ViewHolder {
private AppCompatImageView tabIconView; private final AppCompatImageView tabIconView;
private TextView tabNameView; private final TextView tabNameView;
private ImageView handle; private final ImageView handle;
TabViewHolder(final View itemView) { TabViewHolder(final View itemView) {
super(itemView); super(itemView);

View file

@ -156,7 +156,7 @@ public abstract class Tab {
CHANNEL(new ChannelTab()), CHANNEL(new ChannelTab()),
PLAYLIST(new PlaylistTab()); PLAYLIST(new PlaylistTab());
private Tab tab; private final Tab tab;
Type(final Tab tab) { Type(final Tab tab) {
this.tab = tab; this.tab = tab;

View file

@ -31,8 +31,8 @@ public class OggFromWebMWriter implements Closeable {
private boolean done = false; private boolean done = false;
private boolean parsed = false; private boolean parsed = false;
private SharpStream source; private final SharpStream source;
private SharpStream output; private final SharpStream output;
private int sequenceCount = 0; private int sequenceCount = 0;
private final int streamId; private final int streamId;

View file

@ -20,8 +20,8 @@ import java.nio.charset.StandardCharsets;
public class SrtFromTtmlWriter { public class SrtFromTtmlWriter {
private static final String NEW_LINE = "\r\n"; private static final String NEW_LINE = "\r\n";
private SharpStream out; private final SharpStream out;
private boolean ignoreEmptyFrames; private final boolean ignoreEmptyFrames;
private final Charset charset = StandardCharsets.UTF_8; private final Charset charset = StandardCharsets.UTF_8;
private int frameIndex = 0; private int frameIndex = 0;

View file

@ -49,7 +49,7 @@ public class WebMReader {
Audio/*2*/, Video/*1*/, Other Audio/*2*/, Video/*1*/, Other
} }
private DataReader stream; private final DataReader stream;
private Segment segment; private Segment segment;
private WebMTrack[] tracks; private WebMTrack[] tracks;
private int selectedTrack; private int selectedTrack;

View file

@ -24,7 +24,7 @@ public class TLSSocketFactoryCompat extends SSLSocketFactory {
private static TLSSocketFactoryCompat instance = null; private static TLSSocketFactoryCompat instance = null;
private SSLSocketFactory internalSSLSocketFactory; private final SSLSocketFactory internalSSLSocketFactory;
public TLSSocketFactoryCompat() throws KeyManagementException, NoSuchAlgorithmException { public TLSSocketFactoryCompat() throws KeyManagementException, NoSuchAlgorithmException {
final SSLContext context = SSLContext.getInstance("TLS"); final SSLContext context = SSLContext.getInstance("TLS");

View file

@ -33,8 +33,8 @@ import androidx.recyclerview.widget.RecyclerView;
public class NewPipeRecyclerView extends RecyclerView { public class NewPipeRecyclerView extends RecyclerView {
private static final String TAG = "NewPipeRecyclerView"; private static final String TAG = "NewPipeRecyclerView";
private Rect focusRect = new Rect(); private final Rect focusRect = new Rect();
private Rect tempFocus = new Rect(); private final Rect tempFocus = new Rect();
private boolean allowDpadScroll = true; private boolean allowDpadScroll = true;

View file

@ -23,7 +23,7 @@ public class DownloadInitializer extends Thread {
private final static int RESERVE_SPACE_DEFAULT = 5 * 1024 * 1024;// 5 MiB 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 final static int RESERVE_SPACE_MAXIMUM = 150 * 1024 * 1024;// 150 MiB
private DownloadMission mMission; private final DownloadMission mMission;
private HttpURLConnection mConn; private HttpURLConnection mConn;
DownloadInitializer(@NonNull DownloadMission mission) { DownloadInitializer(@NonNull DownloadMission mission) {

View file

@ -68,7 +68,7 @@ public class FinishedMissionStore extends SQLiteOpenHelper {
" UNIQUE(" + KEY_TIMESTAMP + ", " + KEY_PATH + "));"; " UNIQUE(" + KEY_TIMESTAMP + ", " + KEY_PATH + "));";
private Context context; private final Context context;
public FinishedMissionStore(Context context) { public FinishedMissionStore(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION); super(context, DATABASE_NAME, null, DATABASE_VERSION);

View file

@ -15,7 +15,7 @@ public class CircularFileWriter extends SharpStream {
private final static int NOTIFY_BYTES_INTERVAL = 64 * 1024;// 64 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 final static int THRESHOLD_AUX_LENGTH = 15 * 1024 * 1024;// 15 MiB
private OffsetChecker callback; private final OffsetChecker callback;
public ProgressReport onProgress; public ProgressReport onProgress;
public WriteErrorHandle onWriteError; public WriteErrorHandle onWriteError;

View file

@ -31,7 +31,7 @@ public class StoredDirectoryHelper {
private Context context; private Context context;
private String tag; private final String tag;
public StoredDirectoryHelper(@NonNull Context context, @NonNull Uri path, String tag) throws IOException { public StoredDirectoryHelper(@NonNull Context context, @NonNull Uri path, String tag) throws IOException {
this.tag = tag; this.tag = tag;

View file

@ -73,7 +73,7 @@ public abstract class Postprocessing implements Serializable {
/** /**
* Gets the given algorithm short name * Gets the given algorithm short name
*/ */
private String name; private final String name;
private String[] args; private String[] args;

View file

@ -109,7 +109,7 @@ public class DownloadManagerService extends Service {
private int downloadFailedNotificationID = DOWNLOADS_NOTIFICATION_ID + 1; private int downloadFailedNotificationID = DOWNLOADS_NOTIFICATION_ID + 1;
private Builder downloadFailedNotification = null; private Builder downloadFailedNotification = null;
private SparseArray<DownloadMission> mFailedDownloads = new SparseArray<>(5); private final SparseArray<DownloadMission> mFailedDownloads = new SparseArray<>(5);
private Bitmap icLauncher; private Bitmap icLauncher;
private Bitmap icDownloadDone; private Bitmap icDownloadDone;

View file

@ -96,21 +96,21 @@ public class MissionAdapter extends Adapter<ViewHolder> implements Handler.Callb
ALGORITHMS.put(R.id.sha1, "SHA1"); ALGORITHMS.put(R.id.sha1, "SHA1");
} }
private Context mContext; private final Context mContext;
private LayoutInflater mInflater; private final LayoutInflater mInflater;
private DownloadManager mDownloadManager; private final DownloadManager mDownloadManager;
private Deleter mDeleter; private final Deleter mDeleter;
private int mLayout; private int mLayout;
private DownloadManager.MissionIterator mIterator; private final DownloadManager.MissionIterator mIterator;
private ArrayList<ViewHolderItem> mPendingDownloadsItems = new ArrayList<>(); private final ArrayList<ViewHolderItem> mPendingDownloadsItems = new ArrayList<>();
private Handler mHandler; private final Handler mHandler;
private MenuItem mClear; private MenuItem mClear;
private MenuItem mStartButton; private MenuItem mStartButton;
private MenuItem mPauseButton; private MenuItem mPauseButton;
private View mEmptyMessage; private final View mEmptyMessage;
private RecoverHelper mRecover; private RecoverHelper mRecover;
private View mView; private final View mView;
private ArrayList<Mission> mHidden; private final ArrayList<Mission> mHidden;
private Snackbar mSnackbar; private Snackbar mSnackbar;
private final Runnable rUpdater = this::updater; private final Runnable rUpdater = this::updater;

View file

@ -27,12 +27,12 @@ public class Deleter {
private ArrayList<Mission> items; private ArrayList<Mission> items;
private boolean running = true; private boolean running = true;
private Context mContext; private final Context mContext;
private MissionAdapter mAdapter; private final MissionAdapter mAdapter;
private DownloadManager mDownloadManager; private final DownloadManager mDownloadManager;
private MissionIterator mIterator; private final MissionIterator mIterator;
private Handler mHandler; private final Handler mHandler;
private View mView; private final View mView;
private final Runnable rShow; private final Runnable rShow;
private final Runnable rNext; private final Runnable rNext;

View file

@ -66,7 +66,7 @@ public class MissionsFragment extends Fragment {
private DownloadMission unsafeMissionTarget = null; private DownloadMission unsafeMissionTarget = null;
private ServiceConnection mConnection = new ServiceConnection() { private final ServiceConnection mConnection = new ServiceConnection() {
@Override @Override
public void onServiceConnected(ComponentName name, IBinder binder) { public void onServiceConnected(ComponentName name, IBinder binder) {