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 FragmentTransaction mCurTransaction = null;
private ArrayList<Fragment.SavedState> mSavedState = new ArrayList<Fragment.SavedState>();
private ArrayList<Fragment> mFragments = new ArrayList<Fragment>();
private final ArrayList<Fragment.SavedState> mSavedState = new ArrayList<Fragment.SavedState>();
private final ArrayList<Fragment> mFragments = new ArrayList<Fragment>();
private Fragment mCurrentPrimaryItem = null;
/**

View file

@ -50,8 +50,8 @@ public final class DownloaderImpl extends Downloader {
public static final String YOUTUBE_DOMAIN = "youtube.com";
private static DownloaderImpl instance;
private Map<String, String> mCookies;
private OkHttpClient client;
private final Map<String, String> mCookies;
private final OkHttpClient client;
private DownloaderImpl(final OkHttpClient.Builder builder) {
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 name;
private String filename;
private final String filename;
public License(final String name, final String abbreviation, final String filename) {
if (name == null) {

View file

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

View file

@ -24,7 +24,7 @@ import io.reactivex.Single;
import io.reactivex.disposables.CompositeDisposable;
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,
final String name) {

View file

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

View file

@ -38,7 +38,7 @@ public final class PlaylistAppendDialog extends PlaylistDialog {
private RecyclerView playlistRecyclerView;
private LocalItemListAdapter playlistAdapter;
private CompositeDisposable playlistDisposables = new CompositeDisposable();
private final CompositeDisposable playlistDisposables = new CompositeDisposable();
public static Disposable onPlaylistFound(
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;
@NotificationConstants.Action
private int[] notificationSlots = NotificationConstants.SLOT_DEFAULTS.clone();
private final int[] notificationSlots = NotificationConstants.SLOT_DEFAULTS.clone();
private NotificationManagerCompat notificationManager;
private NotificationCompat.Builder notificationBuilder;

View file

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

View file

@ -53,7 +53,7 @@ import io.reactivex.schedulers.Schedulers;
public class PeertubeInstanceListFragment extends Fragment {
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 String savedInstanceListKey;
private InstanceListAdapter instanceListAdapter;
@ -344,7 +344,7 @@ public class PeertubeInstanceListFragment extends Fragment {
private class InstanceListAdapter
extends RecyclerView.Adapter<InstanceListAdapter.TabViewHolder> {
private final LayoutInflater inflater;
private ItemTouchHelper itemTouchHelper;
private final ItemTouchHelper itemTouchHelper;
private RadioButton lastChecked;
InstanceListAdapter(final Context context, final ItemTouchHelper itemTouchHelper) {
@ -377,11 +377,11 @@ public class PeertubeInstanceListFragment extends Fragment {
}
class TabViewHolder extends RecyclerView.ViewHolder {
private AppCompatImageView instanceIconView;
private TextView instanceNameView;
private TextView instanceUrlView;
private RadioButton instanceRB;
private ImageView handle;
private final AppCompatImageView instanceIconView;
private final TextView instanceNameView;
private final TextView instanceUrlView;
private final RadioButton instanceRB;
private final ImageView handle;
TabViewHolder(final View itemView) {
super(itemView);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -33,8 +33,8 @@ import androidx.recyclerview.widget.RecyclerView;
public class NewPipeRecyclerView extends RecyclerView {
private static final String TAG = "NewPipeRecyclerView";
private Rect focusRect = new Rect();
private Rect tempFocus = new Rect();
private final Rect focusRect = new Rect();
private final Rect tempFocus = new Rect();
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_MAXIMUM = 150 * 1024 * 1024;// 150 MiB
private DownloadMission mMission;
private final DownloadMission mMission;
private HttpURLConnection mConn;
DownloadInitializer(@NonNull DownloadMission mission) {

View file

@ -68,7 +68,7 @@ public class FinishedMissionStore extends SQLiteOpenHelper {
" UNIQUE(" + KEY_TIMESTAMP + ", " + KEY_PATH + "));";
private Context context;
private final Context context;
public FinishedMissionStore(Context context) {
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 THRESHOLD_AUX_LENGTH = 15 * 1024 * 1024;// 15 MiB
private OffsetChecker callback;
private final OffsetChecker callback;
public ProgressReport onProgress;
public WriteErrorHandle onWriteError;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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