diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-01-04 10:10:17 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-01-04 10:10:17 +0000 |
commit | 05507f3597684e36ef6b1b684a258236691eb0fc (patch) | |
tree | 51cbb90d6ec83c6898dd0e059c7e92cd0be38a69 | |
parent | 255e052300341f070f078bd901cc70a47ffa6564 (diff) | |
download | infinity-for-reddit-05507f3597684e36ef6b1b684a258236691eb0fc.tar infinity-for-reddit-05507f3597684e36ef6b1b684a258236691eb0fc.tar.gz infinity-for-reddit-05507f3597684e36ef6b1b684a258236691eb0fc.tar.bz2 infinity-for-reddit-05507f3597684e36ef6b1b684a258236691eb0fc.tar.lz infinity-for-reddit-05507f3597684e36ef6b1b684a258236691eb0fc.tar.xz infinity-for-reddit-05507f3597684e36ef6b1b684a258236691eb0fc.tar.zst infinity-for-reddit-05507f3597684e36ef6b1b684a258236691eb0fc.zip |
Code cleanup.
Diffstat (limited to '')
149 files changed, 977 insertions, 976 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java index 6d82489c..eafc549f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java @@ -25,9 +25,9 @@ import retrofit2.Call; import retrofit2.Retrofit; class AccessTokenAuthenticator implements Authenticator { - private Retrofit mRetrofit; - private RedditDataRoomDatabase mRedditDataRoomDatabase; - private SharedPreferences mCurrentAccountSharedPreferences; + private final Retrofit mRetrofit; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + private final SharedPreferences mCurrentAccountSharedPreferences; AccessTokenAuthenticator(Retrofit retrofit, RedditDataRoomDatabase accountRoomDatabase, SharedPreferences currentAccountSharedPreferences) { mRetrofit = retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AnyAccountAccessTokenAuthenticator.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AnyAccountAccessTokenAuthenticator.java index 0819bd08..178ca1c3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AnyAccountAccessTokenAuthenticator.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AnyAccountAccessTokenAuthenticator.java @@ -25,10 +25,10 @@ import retrofit2.Call; import retrofit2.Retrofit; public class AnyAccountAccessTokenAuthenticator implements Authenticator { - private Retrofit mRetrofit; - private RedditDataRoomDatabase mRedditDataRoomDatabase; - private Account mAccount; - private SharedPreferences mCurrentAccountSharedPreferences; + private final Retrofit mRetrofit; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + private final Account mAccount; + private final SharedPreferences mCurrentAccountSharedPreferences; public AnyAccountAccessTokenAuthenticator(Retrofit retrofit, RedditDataRoomDatabase accountRoomDatabase, Account account, SharedPreferences currentAccountSharedPreferences) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchFlairs.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchFlairs.java index 42384e78..7ae7f746 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchFlairs.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchFlairs.java @@ -59,8 +59,8 @@ public class FetchFlairs { } private static class ParseFlairsAsyncTask extends AsyncTask<Void, ArrayList<Flair>, ArrayList<Flair>> { - private String response; - private ParseFlairsAsyncTaskListener parseFlairsAsyncTaskListener; + private final String response; + private final ParseFlairsAsyncTaskListener parseFlairsAsyncTaskListener; ParseFlairsAsyncTask(String response, ParseFlairsAsyncTaskListener parseFlairsAsyncTaskListener) { this.response = response; this.parseFlairsAsyncTaskListener = parseFlairsAsyncTaskListener; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchUserFlairs.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchUserFlairs.java index 86ae73cb..2d80e0a0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchUserFlairs.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchUserFlairs.java @@ -61,8 +61,8 @@ public class FetchUserFlairs { } private static class ParseUserFlairsAsyncTask extends AsyncTask<Void, ArrayList<UserFlair>, ArrayList<UserFlair>> { - private String response; - private ParseUserFlairsAsyncTaskListener parseFlairsAsyncTaskListener; + private final String response; + private final ParseUserFlairsAsyncTaskListener parseFlairsAsyncTaskListener; ParseUserFlairsAsyncTask(String response, ParseUserFlairsAsyncTaskListener parseFlairsAsyncTaskListener) { this.response = response; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ImgurMedia.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ImgurMedia.java index d2979b7f..356d48d5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ImgurMedia.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ImgurMedia.java @@ -7,9 +7,9 @@ public class ImgurMedia implements Parcelable { public static final int TYPE_IMAGE = 0; public static final int TYPE_VIDEO = 1; private String id; - private String title; - private String description; - private String link; + private final String title; + private final String description; + private final String link; private int type; public ImgurMedia(String id, String title, String description, String type, String link) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MaterialYouWorker.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MaterialYouWorker.java index afa7d7ce..1cc8ba8b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MaterialYouWorker.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MaterialYouWorker.java @@ -33,7 +33,7 @@ public class MaterialYouWorker extends Worker { RedditDataRoomDatabase redditDataRoomDatabase; @Inject CustomThemeWrapper customThemeWrapper; - private Context context; + private final Context context; public MaterialYouWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { super(context, workerParams); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java index 3ccf964e..7b6d6067 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java @@ -46,7 +46,7 @@ class ParseSubscribedThing { private ArrayList<SubscribedSubredditData> newSubscribedSubredditData; private ArrayList<SubscribedUserData> newSubscribedUserData; private ArrayList<SubredditData> newSubredditData; - private ParseSubscribedSubredditsListener parseSubscribedSubredditsListener; + private final ParseSubscribedSubredditsListener parseSubscribedSubredditsListener; ParseSubscribedSubredditsAsyncTask(String response, @NonNull String accountName, ArrayList<SubscribedSubredditData> subscribedSubredditData, ArrayList<SubscribedUserData> subscribedUserData, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java index 984f01f8..f8fbcdaf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java @@ -61,7 +61,7 @@ public class PullNotificationWorker extends Worker { SharedPreferences mCurrentAccountSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; - private Context context; + private final Context context; public PullNotificationWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) { super(context, workerParams); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedgifsAccessTokenAuthenticator.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedgifsAccessTokenAuthenticator.java index 11fd245d..07bd37a6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedgifsAccessTokenAuthenticator.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedgifsAccessTokenAuthenticator.java @@ -22,7 +22,7 @@ import retrofit2.Retrofit; import retrofit2.converter.scalars.ScalarsConverterFactory; public class RedgifsAccessTokenAuthenticator implements Interceptor { - private SharedPreferences mCurrentAccountSharedPreferences; + private final SharedPreferences mCurrentAccountSharedPreferences; public RedgifsAccessTokenAuthenticator(SharedPreferences currentAccountSharedPreferences) { this.mCurrentAccountSharedPreferences = currentAccountSharedPreferences; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ReportReason.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ReportReason.java index cedda1d8..04f139ef 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ReportReason.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ReportReason.java @@ -14,8 +14,8 @@ public class ReportReason implements Parcelable { public static final String REASON_RULE_REASON_SELECTED = "rule_reason_selected"; public static final String REASON_OTHER = "other"; - private String reportReason; - private String reasonType; + private final String reportReason; + private final String reasonType; private boolean isSelected; public ReportReason(String reportReason, String reasonType) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Rule.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Rule.java index 816ab714..95fa064a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Rule.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Rule.java @@ -1,8 +1,8 @@ package ml.docilealligator.infinityforreddit; public class Rule { - private String shortName; - private String descriptionHtml; + private final String shortName; + private final String descriptionHtml; public Rule(String shortName, String descriptionHtml) { this.shortName = shortName; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SelectUserFlair.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SelectUserFlair.java index 52012e28..85b40bdc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SelectUserFlair.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SelectUserFlair.java @@ -55,14 +55,10 @@ public class SelectUserFlair { private static class ParseErrorAsyncTask extends AsyncTask<Void, Void, Void> { - private String response; + private final String response; @Nullable private String errorMessage; - private SelectUserFlairListener selectUserFlairListener; - - interface ParseErrorAsyncTaskListener { - void parseFinished(@Nullable String errorMessage); - } + private final SelectUserFlairListener selectUserFlairListener; ParseErrorAsyncTask(String response, SelectUserFlairListener selectUserFlairListener) { this.response = response; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/UserFlair.java b/app/src/main/java/ml/docilealligator/infinityforreddit/UserFlair.java index 1854ee89..fdb8966e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/UserFlair.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/UserFlair.java @@ -4,11 +4,11 @@ import android.os.Parcel; import android.os.Parcelable; public class UserFlair implements Parcelable { - private String id; + private final String id; private String text; - private String htmlText; - private boolean editable; - private int maxEmojis; + private final String htmlText; + private final boolean editable; + private final int maxEmojis; public UserFlair(String id, String text, String htmlText, boolean editable, int maxEmojis) { this.id = id; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/account/Account.java b/app/src/main/java/ml/docilealligator/infinityforreddit/account/Account.java index 7c83c75a..67b40d2e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/account/Account.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/account/Account.java @@ -15,21 +15,21 @@ public class Account implements Parcelable { @PrimaryKey @NonNull @ColumnInfo(name = "username") - private String accountName; + private final String accountName; @ColumnInfo(name = "profile_image_url") - private String profileImageUrl; + private final String profileImageUrl; @ColumnInfo(name = "banner_image_url") - private String bannerImageUrl; + private final String bannerImageUrl; @ColumnInfo(name = "karma") - private int karma; + private final int karma; @ColumnInfo(name = "access_token") private String accessToken; @ColumnInfo(name = "refresh_token") - private String refreshToken; + private final String refreshToken; @ColumnInfo(name = "code") - private String code; + private final String code; @ColumnInfo(name = "is_current_user") - private boolean isCurrentUser; + private final boolean isCurrentUser; @Ignore protected Account(Parcel in) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/account/AccountRepository.java b/app/src/main/java/ml/docilealligator/infinityforreddit/account/AccountRepository.java index 80b25a5e..4a5cfb74 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/account/AccountRepository.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/account/AccountRepository.java @@ -9,10 +9,10 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class AccountRepository { - private AccountDao mAccountDao; - private LiveData<List<Account>> mAccountsExceptCurrentAccountLiveData; - private LiveData<Account> mCurrentAccountLiveData; - private LiveData<List<Account>> mAllAccountsLiveData; + private final AccountDao mAccountDao; + private final LiveData<List<Account>> mAccountsExceptCurrentAccountLiveData; + private final LiveData<Account> mCurrentAccountLiveData; + private final LiveData<List<Account>> mAllAccountsLiveData; AccountRepository(RedditDataRoomDatabase redditDataRoomDatabase) { mAccountDao = redditDataRoomDatabase.accountDao(); @@ -39,7 +39,7 @@ public class AccountRepository { private static class InsertAsyncTask extends AsyncTask<Account, Void, Void> { - private AccountDao mAsyncTaskDao; + private final AccountDao mAsyncTaskDao; InsertAsyncTask(AccountDao dao) { mAsyncTaskDao = dao; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/account/AccountViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/account/AccountViewModel.java index 12b7afc0..bc43fa28 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/account/AccountViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/account/AccountViewModel.java @@ -9,10 +9,10 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class AccountViewModel extends ViewModel { - private AccountRepository mAccountRepository; - private LiveData<List<Account>> mAccountsExceptCurrentAccountLiveData; - private LiveData<Account> mCurrentAccountLiveData; - private LiveData<List<Account>> mAllAccountsLiveData; + private final AccountRepository mAccountRepository; + private final LiveData<List<Account>> mAccountsExceptCurrentAccountLiveData; + private final LiveData<Account> mCurrentAccountLiveData; + private final LiveData<List<Account>> mAllAccountsLiveData; public AccountViewModel(RedditDataRoomDatabase redditDataRoomDatabase) { mAccountRepository = new AccountRepository(redditDataRoomDatabase); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java index b4d1fb8d..27c3d462 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterPreferenceActivity.java @@ -125,10 +125,8 @@ public class CommentFilterPreferenceActivity extends BaseActivity { intent.putExtra(CustomizeCommentFilterActivity.EXTRA_FROM_SETTINGS, true); for (int j = 0; j < selectedOptions.length; j++) { if (selectedOptions[j]) { - switch (j) { - case 0: - intent.putExtra(CustomizeCommentFilterActivity.EXTRA_EXCLUDE_USER, comment.getAuthor()); - break; + if (j == 0) { + intent.putExtra(CustomizeCommentFilterActivity.EXTRA_EXCLUDE_USER, comment.getAuthor()); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java index fc5dac54..38c0ac59 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentFilterUsageListingActivity.java @@ -92,10 +92,8 @@ public class CommentFilterUsageListingActivity extends BaseActivity { } public void newCommentFilterUsage(int type) { - switch (type) { - case CommentFilterUsage.SUBREDDIT_TYPE: - editAndCommentFilterUsageNameOfUsage(type, null); - break; + if (type == CommentFilterUsage.SUBREDDIT_TYPE) { + editAndCommentFilterUsageNameOfUsage(type, null); } } @@ -114,10 +112,8 @@ public class CommentFilterUsageListingActivity extends BaseActivity { } textInputEditText.requestFocus(); int titleStringId = R.string.subreddit; - switch (type) { - case CommentFilterUsage.SUBREDDIT_TYPE: - textInputEditText.setHint(R.string.settings_tab_subreddit_name); - break; + if (type == CommentFilterUsage.SUBREDDIT_TYPE) { + textInputEditText.setHint(R.string.settings_tab_subreddit_name); } Utils.showKeyboard(this, new Handler(), textInputEditText); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java index 96d55b09..7b535685 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java @@ -406,7 +406,7 @@ public class LinkResolverActivity extends AppCompatActivity { CustomTabsIntent customTabsIntent = builder.build(); customTabsIntent.intent.setPackage(resolveInfos.get(0).activityInfo.packageName); if (uri.getScheme() == null) { - uri = Uri.parse("http://" + uri.toString()); + uri = Uri.parse("http://" + uri); } try { customTabsIntent.launchUrl(this, uri); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java index 05dbbf6f..15c775ab 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java @@ -66,7 +66,6 @@ public class SelectUserFlairActivity extends BaseActivity implements ActivityToo @Inject CustomThemeWrapper mCustomThemeWrapper; private LinearLayoutManagerBugFixed mLinearLayoutManager; - private boolean mNullAccessToken = false; private String mAccessToken; private String mAccountName; private ArrayList<UserFlair> mUserFlairs; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java index f79d4667..def20919 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java @@ -73,8 +73,6 @@ import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; import retrofit2.Retrofit; -; - public class SubscribedThingListingActivity extends BaseActivity implements ActivityToolbarInterface { public static final String EXTRA_SHOW_MULTIREDDITS = "ESM"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java index e439aed1..bf2b0673 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java @@ -429,10 +429,10 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa private static class ParseImgurImagesAsyncTask extends AsyncTask<Void, Void, Void> { - private String response; + private final String response; private ArrayList<ImgurMedia> images; private boolean parseFailed = false; - private ParseImgurImagesAsyncTaskListener parseImgurImagesAsyncTaskListener; + private final ParseImgurImagesAsyncTaskListener parseImgurImagesAsyncTaskListener; interface ParseImgurImagesAsyncTaskListener { void success(ArrayList<ImgurMedia> images); @@ -484,10 +484,10 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa private static class ParseImgurImageAsyncTask extends AsyncTask<Void, Void, Void> { - private String response; + private final String response; private ImgurMedia image; private boolean parseFailed = false; - private ParseImgurImageAsyncTaskListener parseImgurImageAsyncTaskListener; + private final ParseImgurImageAsyncTaskListener parseImgurImageAsyncTaskListener; interface ParseImgurImageAsyncTaskListener { void success(ImgurMedia image); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index f4ab4b87..e57881f1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -1571,9 +1571,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private static class InsertUserDataAsyncTask extends AsyncTask<Void, Void, Void> { - private UserDao userDao; - private UserData subredditData; - private InsertUserDataAsyncTaskListener insertUserDataAsyncTaskListener; + private final UserDao userDao; + private final UserData subredditData; + private final InsertUserDataAsyncTaskListener insertUserDataAsyncTaskListener; InsertUserDataAsyncTask(UserDao userDao, UserData userData, InsertUserDataAsyncTaskListener insertUserDataAsyncTaskListener) { this.userDao = userDao; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AccountChooserRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AccountChooserRecyclerViewAdapter.java index c7572a53..e22057f1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AccountChooserRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AccountChooserRecyclerViewAdapter.java @@ -25,11 +25,11 @@ import pl.droidsonroids.gif.GifImageView; public class AccountChooserRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity baseActivity; + private final BaseActivity baseActivity; private ArrayList<Account> accounts; - private RequestManager glide; - private int primaryTextColor; - private ItemClickListener itemClickListener; + private final RequestManager glide; + private final int primaryTextColor; + private final ItemClickListener itemClickListener; public AccountChooserRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper, RequestManager glide, ItemClickListener itemClickListener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java index 3cc05331..9e563772 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java @@ -19,8 +19,8 @@ import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.settings.Acknowledgement; public class AcknowledgementRecyclerViewAdapter extends RecyclerView.Adapter<AcknowledgementRecyclerViewAdapter.AcknowledgementViewHolder> { - private ArrayList<Acknowledgement> acknowledgements; - private SettingsActivity activity; + private final ArrayList<Acknowledgement> acknowledgements; + private final SettingsActivity activity; public AcknowledgementRecyclerViewAdapter(SettingsActivity activity, ArrayList<Acknowledgement> acknowledgements) { this.activity = activity; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java index 0f958e3e..9f4c06ac 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageEmbeddedRecyclerViewAdapter.java @@ -16,7 +16,7 @@ import ml.docilealligator.infinityforreddit.commentfilter.CommentFilterUsage; import ml.docilealligator.infinityforreddit.databinding.ItemCommentFilterUsageEmbeddedBinding; public class CommentFilterUsageEmbeddedRecyclerViewAdapter extends RecyclerView.Adapter<CommentFilterUsageEmbeddedRecyclerViewAdapter.EntryViewHolder> { - private BaseActivity baseActivity; + private final BaseActivity baseActivity; private List<CommentFilterUsage> commentFilterUsageList; public CommentFilterUsageEmbeddedRecyclerViewAdapter(BaseActivity baseActivity) { @@ -37,10 +37,8 @@ public class CommentFilterUsageEmbeddedRecyclerViewAdapter extends RecyclerView. holder.textView.setText(baseActivity.getString(R.string.comment_filter_usage_embedded_more_count, commentFilterUsageList.size() - 5)); } else { CommentFilterUsage commentFilterUsage = commentFilterUsageList.get(holder.getBindingAdapterPosition()); - switch (commentFilterUsage.usage) { - case CommentFilterUsage.SUBREDDIT_TYPE: - holder.textView.setText("r/" + commentFilterUsage.nameOfUsage); - break; + if (commentFilterUsage.usage == CommentFilterUsage.SUBREDDIT_TYPE) { + holder.textView.setText("r/" + commentFilterUsage.nameOfUsage); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageRecyclerViewAdapter.java index 134e9c18..03f6c3de 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterUsageRecyclerViewAdapter.java @@ -17,9 +17,9 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; public class CommentFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private List<CommentFilterUsage> commentFilterUsages; - private BaseActivity activity; - private CustomThemeWrapper customThemeWrapper; - private CommentFilterUsageRecyclerViewAdapter.OnItemClickListener onItemClickListener; + private final BaseActivity activity; + private final CustomThemeWrapper customThemeWrapper; + private final CommentFilterUsageRecyclerViewAdapter.OnItemClickListener onItemClickListener; public interface OnItemClickListener { void onClick(CommentFilterUsage commentFilterUsage); @@ -41,10 +41,8 @@ public class CommentFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { CommentFilterUsage commentFilterUsage = commentFilterUsages.get(position); - switch (commentFilterUsage.usage) { - case CommentFilterUsage.SUBREDDIT_TYPE: - ((CommentFilterUsageRecyclerViewAdapter.CommentFilterUsageViewHolder) holder).usageTextView.setText(activity.getString(R.string.post_filter_usage_subreddit, commentFilterUsage.nameOfUsage)); - break; + if (commentFilterUsage.usage == CommentFilterUsage.SUBREDDIT_TYPE) { + ((CommentFilterUsageViewHolder) holder).usageTextView.setText(activity.getString(R.string.post_filter_usage_subreddit, commentFilterUsage.nameOfUsage)); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterWithUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterWithUsageRecyclerViewAdapter.java index 914c64f2..80f56439 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterWithUsageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentFilterWithUsageRecyclerViewAdapter.java @@ -15,10 +15,10 @@ import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFi import ml.docilealligator.infinityforreddit.databinding.ItemCommentFilterWithUsageBinding; public class CommentFilterWithUsageRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity activity; + private final BaseActivity activity; private final OnItemClickListener onItemClickListener; private List<CommentFilterWithUsage> commentFilterWithUsageList; - private RecyclerView.RecycledViewPool recycledViewPool; + private final RecyclerView.RecycledViewPool recycledViewPool; public interface OnItemClickListener { void onItemClick(CommentFilter commentFilter); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java index e7b3b61a..b66b5cd3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java @@ -83,38 +83,38 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment return comment.getCommentMarkdown().equals(t1.getCommentMarkdown()); } }; - private BaseActivity mActivity; - private Retrofit mOauthRetrofit; - private Locale mLocale; - private EmoteCloseBracketInlineProcessor mEmoteCloseBracketInlineProcessor; - private EmotePlugin mEmotePlugin; - private ImageAndGifPlugin mImageAndGifPlugin; - private Markwon mMarkwon; - private ImageAndGifEntry mImageAndGifEntry; - private RecyclerView.RecycledViewPool recycledViewPool; - private String mAccessToken; - private String mAccountName; - private int mColorPrimaryLightTheme; - private int mSecondaryTextColor; - private int mCommentBackgroundColor; + private final BaseActivity mActivity; + private final Retrofit mOauthRetrofit; + private final Locale mLocale; + private final EmoteCloseBracketInlineProcessor mEmoteCloseBracketInlineProcessor; + private final EmotePlugin mEmotePlugin; + private final ImageAndGifPlugin mImageAndGifPlugin; + private final Markwon mMarkwon; + private final ImageAndGifEntry mImageAndGifEntry; + private final RecyclerView.RecycledViewPool recycledViewPool; + private final String mAccessToken; + private final String mAccountName; + private final int mColorPrimaryLightTheme; + private final int mSecondaryTextColor; + private final int mCommentBackgroundColor; private int mCommentColor; - private int mDividerColor; - private int mUsernameColor; - private int mAuthorFlairColor; - private int mSubredditColor; - private int mUpvotedColor; - private int mDownvotedColor; - private int mButtonTextColor; - private int mColorAccent; - private int mCommentIconAndInfoColor; - private boolean mVoteButtonsOnTheRight; - private boolean mShowElapsedTime; - private String mTimeFormatPattern; - private boolean mShowCommentDivider; - private boolean mShowAbsoluteNumberOfVotes; + private final int mDividerColor; + private final int mUsernameColor; + private final int mAuthorFlairColor; + private final int mSubredditColor; + private final int mUpvotedColor; + private final int mDownvotedColor; + private final int mButtonTextColor; + private final int mColorAccent; + private final int mCommentIconAndInfoColor; + private final boolean mVoteButtonsOnTheRight; + private final boolean mShowElapsedTime; + private final String mTimeFormatPattern; + private final boolean mShowCommentDivider; + private final boolean mShowAbsoluteNumberOfVotes; private boolean canStartActivity = true; private NetworkState networkState; - private RetryLoadingMoreCallback mRetryLoadingMoreCallback; + private final RetryLoadingMoreCallback mRetryLoadingMoreCallback; public CommentsListingRecyclerViewAdapter(BaseActivity activity, Retrofit oauthRetrofit, CustomThemeWrapper customThemeWrapper, Locale locale, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java index 27c6f4f5..4978bdbd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -94,69 +94,69 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi private static final int VIEW_TYPE_LOAD_MORE_COMMENTS_FAILED = 16; private static final int VIEW_TYPE_VIEW_ALL_COMMENTS = 17; - private BaseActivity mActivity; - private ViewPostDetailFragment mFragment; - private Executor mExecutor; - private Retrofit mOauthRetrofit; - private EmoteCloseBracketInlineProcessor mEmoteCloseBracketInlineProcessor; - private EmotePlugin mEmotePlugin; - private ImageAndGifPlugin mImageAndGifPlugin; - private Markwon mCommentMarkwon; - private ImageAndGifEntry mImageAndGifEntry; - private String mAccessToken; - private String mAccountName; - private Post mPost; - private ArrayList<Comment> mVisibleComments; - private Locale mLocale; - private RequestManager mGlide; - private RecyclerView.RecycledViewPool recycledViewPool; + private final BaseActivity mActivity; + private final ViewPostDetailFragment mFragment; + private final Executor mExecutor; + private final Retrofit mOauthRetrofit; + private final EmoteCloseBracketInlineProcessor mEmoteCloseBracketInlineProcessor; + private final EmotePlugin mEmotePlugin; + private final ImageAndGifPlugin mImageAndGifPlugin; + private final Markwon mCommentMarkwon; + private final ImageAndGifEntry mImageAndGifEntry; + private final String mAccessToken; + private final String mAccountName; + private final Post mPost; + private final ArrayList<Comment> mVisibleComments; + private final Locale mLocale; + private final RequestManager mGlide; + private final RecyclerView.RecycledViewPool recycledViewPool; private String mSingleCommentId; private boolean mIsSingleCommentThreadMode; - private boolean mVoteButtonsOnTheRight; - private boolean mShowElapsedTime; - private String mTimeFormatPattern; - private boolean mExpandChildren; - private boolean mCommentToolbarHidden; - private boolean mCommentToolbarHideOnClick; - private boolean mSwapTapAndLong; - private boolean mShowCommentDivider; - private int mDividerType; - private boolean mShowAbsoluteNumberOfVotes; - private boolean mFullyCollapseComment; - private boolean mShowOnlyOneCommentLevelIndicator; - private boolean mShowAuthorAvatar; - private boolean mAlwaysShowChildCommentCount; - private boolean mHideTheNumberOfVotes; - private int mDepthThreshold; - private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback; + private final boolean mVoteButtonsOnTheRight; + private final boolean mShowElapsedTime; + private final String mTimeFormatPattern; + private final boolean mExpandChildren; + private final boolean mCommentToolbarHidden; + private final boolean mCommentToolbarHideOnClick; + private final boolean mSwapTapAndLong; + private final boolean mShowCommentDivider; + private final int mDividerType; + private final boolean mShowAbsoluteNumberOfVotes; + private final boolean mFullyCollapseComment; + private final boolean mShowOnlyOneCommentLevelIndicator; + private final boolean mShowAuthorAvatar; + private final boolean mAlwaysShowChildCommentCount; + private final boolean mHideTheNumberOfVotes; + private final int mDepthThreshold; + private final CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback; private boolean isInitiallyLoading; private boolean isInitiallyLoadingFailed; private boolean mHasMoreComments; private boolean loadMoreCommentsFailed; - private Drawable expandDrawable; - private Drawable collapseDrawable; - - private int mColorPrimaryLightTheme; - private int mColorAccent; - private int mCircularProgressBarBackgroundColor; - private int mSecondaryTextColor; - private int mPrimaryTextColor; - private int mCommentTextColor; - private int mCommentBackgroundColor; - private int mDividerColor; - private int mUsernameColor; - private int mSubmitterColor; - private int mModeratorColor; - private int mCurrentUserColor; - private int mAuthorFlairTextColor; - private int mUpvotedColor; - private int mDownvotedColor; - private int mSingleCommentThreadBackgroundColor; - private int mVoteAndReplyUnavailableVoteButtonColor; - private int mButtonTextColor; - private int mCommentIconAndInfoColor; - private int mFullyCollapsedCommentBackgroundColor; - private int[] verticalBlockColors; + private final Drawable expandDrawable; + private final Drawable collapseDrawable; + + private final int mColorPrimaryLightTheme; + private final int mColorAccent; + private final int mCircularProgressBarBackgroundColor; + private final int mSecondaryTextColor; + private final int mPrimaryTextColor; + private final int mCommentTextColor; + private final int mCommentBackgroundColor; + private final int mDividerColor; + private final int mUsernameColor; + private final int mSubmitterColor; + private final int mModeratorColor; + private final int mCurrentUserColor; + private final int mAuthorFlairTextColor; + private final int mUpvotedColor; + private final int mDownvotedColor; + private final int mSingleCommentThreadBackgroundColor; + private final int mVoteAndReplyUnavailableVoteButtonColor; + private final int mButtonTextColor; + private final int mCommentIconAndInfoColor; + private final int mFullyCollapsedCommentBackgroundColor; + private final int[] verticalBlockColors; private int mSearchCommentIndex = -1; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CrashReportsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CrashReportsRecyclerViewAdapter.java index 03fe2f7d..7323237a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CrashReportsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CrashReportsRecyclerViewAdapter.java @@ -14,8 +14,8 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.SettingsActivity; public class CrashReportsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private SettingsActivity activity; - private List<String> crashReports; + private final SettingsActivity activity; + private final List<String> crashReports; public CrashReportsRecyclerViewAdapter(SettingsActivity activity, List<String> crashReports) { this.activity = activity; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomThemeListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomThemeListingRecyclerViewAdapter.java index e9aa20ec..e0f460a3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomThemeListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomThemeListingRecyclerViewAdapter.java @@ -30,8 +30,8 @@ public class CustomThemeListingRecyclerViewAdapter extends RecyclerView.Adapter< private static final int VIEW_TYPE_PREDEFINED_THEME_DIVIDER = 2; private static final int VIEW_TYPE_USER_THEME_DIVIDER = 3; - private BaseActivity activity; - private ArrayList<CustomTheme> predefinedCustomThemes; + private final BaseActivity activity; + private final ArrayList<CustomTheme> predefinedCustomThemes; private ArrayList<CustomTheme> userCustomThemes; public CustomThemeListingRecyclerViewAdapter(BaseActivity activity, ArrayList<CustomTheme> predefinedCustomThemes) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java index f17109d3..d6ec995b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java @@ -29,9 +29,9 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy private static final int VIEW_TYPE_COLOR = 1; private static final int VIEW_TYPE_SWITCH = 2; private static final int VIEW_TYPE_THEME_NAME = 3; - private BaseActivity activity; - private CustomThemeWrapper customThemeWrapper; - private ArrayList<CustomThemeSettingsItem> customThemeSettingsItems; + private final BaseActivity activity; + private final CustomThemeWrapper customThemeWrapper; + private final ArrayList<CustomThemeSettingsItem> customThemeSettingsItems; private String themeName; public CustomizeThemeRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java index ffaedc2a..27af320e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java @@ -24,10 +24,10 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.utils.Utils; public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<FlairBottomSheetRecyclerViewAdapter.FlairViewHolder> { - private BaseActivity activity; + private final BaseActivity activity; private ArrayList<Flair> flairs; - private int flairTextColor; - private ItemClickListener itemClickListener; + private final int flairTextColor; + private final ItemClickListener itemClickListener; public FlairBottomSheetRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, ItemClickListener itemClickListener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java index 90e88b37..b87bb9cb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java @@ -42,15 +42,15 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc private List<SubscribedUserData> mSubscribedUserData; private List<SubscribedUserData> mFavoriteSubscribedUserData; - private BaseActivity mActivity; - private Executor mExecutor; - private Retrofit mOauthRetrofit; - private RedditDataRoomDatabase mRedditDataRoomDatabase; - private String mAccessToken; - private String mAccountName; - private RequestManager glide; - private int mPrimaryTextColor; - private int mSecondaryTextColor; + private final BaseActivity mActivity; + private final Executor mExecutor; + private final Retrofit mOauthRetrofit; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + private final String mAccessToken; + private final String mAccountName; + private final RequestManager glide; + private final int mPrimaryTextColor; + private final int mSecondaryTextColor; public FollowedUsersRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit, RedditDataRoomDatabase redditDataRoomDatabase, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java index a7f17ab2..b5b9d1e5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java @@ -4581,7 +4581,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy ImageView noPreviewImageView; PostGalleryTypeImageRecyclerViewAdapter adapter; - private LinearLayoutManagerBugFixed layoutManager; + private final LinearLayoutManagerBugFixed layoutManager; Post post; Post.Preview preview; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MarkdownBottomBarRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MarkdownBottomBarRecyclerViewAdapter.java index 54f0c090..7b74c87b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MarkdownBottomBarRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MarkdownBottomBarRecyclerViewAdapter.java @@ -33,8 +33,8 @@ public class MarkdownBottomBarRecyclerViewAdapter extends RecyclerView.Adapter<R private static final int ITEM_COUNT = 10; - private CustomThemeWrapper customThemeWrapper; - private ItemClickListener itemClickListener; + private final CustomThemeWrapper customThemeWrapper; + private final ItemClickListener itemClickListener; public interface ItemClickListener { void onClick(int item); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java index f2967d8e..14deafa7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java @@ -65,21 +65,21 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl return message.getBody().equals(t1.getBody()); } }; - private BaseActivity mActivity; - private Retrofit mOauthRetrofit; - private Markwon mMarkwon; - private String mAccessToken; - private int mMessageType; + private final BaseActivity mActivity; + private final Retrofit mOauthRetrofit; + private final Markwon mMarkwon; + private final String mAccessToken; + private final int mMessageType; private NetworkState networkState; - private RetryLoadingMoreCallback mRetryLoadingMoreCallback; - private int mColorAccent; - private int mMessageBackgroundColor; - private int mUsernameColor; - private int mPrimaryTextColor; - private int mSecondaryTextColor; - private int mUnreadMessageBackgroundColor; - private int mColorPrimaryLightTheme; - private int mButtonTextColor; + private final RetryLoadingMoreCallback mRetryLoadingMoreCallback; + private final int mColorAccent; + private final int mMessageBackgroundColor; + private final int mUsernameColor; + private final int mPrimaryTextColor; + private final int mSecondaryTextColor; + private final int mUnreadMessageBackgroundColor; + private final int mColorPrimaryLightTheme; + private final int mButtonTextColor; private boolean markAllMessagesAsRead = false; public MessageRecyclerViewAdapter(BaseActivity activity, Retrofit oauthRetrofit, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java index 0122ffa5..768a78fc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java @@ -41,19 +41,19 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< private static final int VIEW_TYPE_MULTI_REDDIT_DIVIDER = 2; private static final int VIEW_TYPE_MULTI_REDDIT = 3; - private BaseActivity mActivity; - private Executor mExecutor; - private Retrofit mOauthRetrofit; - private RedditDataRoomDatabase mRedditDataRoomDatabase; - private RequestManager mGlide; - - private String mAccessToken; - private String mAccountName; + private final BaseActivity mActivity; + private final Executor mExecutor; + private final Retrofit mOauthRetrofit; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + private final RequestManager mGlide; + + private final String mAccessToken; + private final String mAccountName; private List<MultiReddit> mMultiReddits; private List<MultiReddit> mFavoriteMultiReddits; - private int mPrimaryTextColor; - private int mSecondaryTextColor; - private OnItemClickListener mOnItemClickListener; + private final int mPrimaryTextColor; + private final int mSecondaryTextColor; + private final OnItemClickListener mOnItemClickListener; public interface OnItemClickListener { void onClick(MultiReddit multiReddit); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java index 4f767703..e2617c61 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java @@ -19,10 +19,10 @@ import ml.docilealligator.infinityforreddit.activities.BaseActivity; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; public class Paging3LoadingStateAdapter extends LoadStateAdapter<Paging3LoadingStateAdapter.LoadStateViewHolder> { - private BaseActivity activity; - private CustomThemeWrapper mCustomThemeWrapper; - private int mErrorStringId; - private View.OnClickListener mRetryCallback; + private final BaseActivity activity; + private final CustomThemeWrapper mCustomThemeWrapper; + private final int mErrorStringId; + private final View.OnClickListener mRetryCallback; public Paging3LoadingStateAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, int errorStringId, View.OnClickListener retryCallback) { this.activity = activity; @@ -43,10 +43,10 @@ public class Paging3LoadingStateAdapter extends LoadStateAdapter<Paging3LoadingS } class LoadStateViewHolder extends RecyclerView.ViewHolder { - private ProgressBar mProgressBar; - private RelativeLayout mErrorView; - private TextView mErrorMsg; - private MaterialButton mRetry; + private final ProgressBar mProgressBar; + private final RelativeLayout mErrorView; + private final TextView mErrorMsg; + private final MaterialButton mRetry; LoadStateViewHolder(@NonNull View itemView, @NonNull View.OnClickListener retryCallback) { super(itemView); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 108d8c68..fb4ecb26 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -135,90 +135,90 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler private static final int VIEW_TYPE_POST_DETAIL_NO_PREVIEW_LINK = 6; private static final int VIEW_TYPE_POST_DETAIL_GALLERY = 7; private static final int VIEW_TYPE_POST_DETAIL_TEXT_TYPE = 8; - private BaseActivity mActivity; - private ViewPostDetailFragment mFragment; - private Executor mExecutor; - private Retrofit mRetrofit; - private Retrofit mOauthRetrofit; - private Retrofit mGfycatRetrofit; - private Retrofit mRedgifsRetrofit; + private final BaseActivity mActivity; + private final ViewPostDetailFragment mFragment; + private final Executor mExecutor; + private final Retrofit mRetrofit; + private final Retrofit mOauthRetrofit; + private final Retrofit mGfycatRetrofit; + private final Retrofit mRedgifsRetrofit; private final Provider<StreamableAPI> mStreamableApiProvider; - private RedditDataRoomDatabase mRedditDataRoomDatabase; - private SharedPreferences mCurrentAccountSharedPreferences; - private RequestManager mGlide; - private SaveMemoryCenterInisdeDownsampleStrategy mSaveMemoryCenterInsideDownsampleStrategy; - private EmoteCloseBracketInlineProcessor mEmoteCloseBracketInlineProcessor; - private EmotePlugin mEmotePlugin; - private ImageAndGifPlugin mImageAndGifPlugin; - private Markwon mPostDetailMarkwon; - private ImageAndGifEntry mImageAndGifEntry; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + private final SharedPreferences mCurrentAccountSharedPreferences; + private final RequestManager mGlide; + private final SaveMemoryCenterInisdeDownsampleStrategy mSaveMemoryCenterInsideDownsampleStrategy; + private final EmoteCloseBracketInlineProcessor mEmoteCloseBracketInlineProcessor; + private final EmotePlugin mEmotePlugin; + private final ImageAndGifPlugin mImageAndGifPlugin; + private final Markwon mPostDetailMarkwon; + private final ImageAndGifEntry mImageAndGifEntry; private final CustomMarkwonAdapter mMarkwonAdapter; - private String mAccessToken; - private String mAccountName; + private final String mAccessToken; + private final String mAccountName; private Post mPost; - private String mSubredditNamePrefixed; - private Locale mLocale; + private final String mSubredditNamePrefixed; + private final Locale mLocale; private boolean mNeedBlurNsfw; private boolean mDoNotBlurNsfwInNsfwSubreddits; private boolean mNeedBlurSpoiler; - private boolean mVoteButtonsOnTheRight; - private boolean mShowElapsedTime; - private String mTimeFormatPattern; - private boolean mShowAbsoluteNumberOfVotes; + private final boolean mVoteButtonsOnTheRight; + private final boolean mShowElapsedTime; + private final String mTimeFormatPattern; + private final boolean mShowAbsoluteNumberOfVotes; private boolean mAutoplay = false; - private boolean mAutoplayNsfwVideos; - private boolean mMuteAutoplayingVideos; - private double mStartAutoplayVisibleAreaOffset; - private boolean mMuteNSFWVideo; - private boolean mAutomaticallyTryRedgifs; + private final boolean mAutoplayNsfwVideos; + private final boolean mMuteAutoplayingVideos; + private final double mStartAutoplayVisibleAreaOffset; + private final boolean mMuteNSFWVideo; + private final boolean mAutomaticallyTryRedgifs; private boolean mDataSavingMode; - private boolean mDisableImagePreview; - private boolean mOnlyDisablePreviewInVideoAndGifPosts; - private boolean mHidePostType; - private boolean mHidePostFlair; - private boolean mHideUpvoteRatio; - private boolean mHideSubredditAndUserPrefix; - private boolean mHideTheNumberOfVotes; - private boolean mHideTheNumberOfComments; - private boolean mSeparatePostAndComments; - private boolean mLegacyAutoplayVideoControllerUI; - private boolean mEasierToWatchInFullScreen; - private PostDetailRecyclerViewAdapterCallback mPostDetailRecyclerViewAdapterCallback; - - private int mColorAccent; - private int mCardViewColor; - private int mSecondaryTextColor; - private int mPostTitleColor; - private int mPrimaryTextColor; - private int mPostTypeBackgroundColor; - private int mPostTypeTextColor; - private int mSubredditColor; - private int mUsernameColor; - private int mModeratorColor; - private int mAuthorFlairTextColor; - private int mSpoilerBackgroundColor; - private int mSpoilerTextColor; - private int mFlairBackgroundColor; - private int mFlairTextColor; - private int mNSFWBackgroundColor; - private int mNSFWTextColor; - private int mArchivedTintColor; - private int mLockedTintColor; - private int mCrosspostTintColor; - private int mMediaIndicatorIconTint; - private int mMediaIndicatorBackgroundColor; - private int mUpvoteRatioTintColor; - private int mNoPreviewPostTypeBackgroundColor; - private int mNoPreviewPostTypeIconTint; - private int mUpvotedColor; - private int mDownvotedColor; - private int mVoteAndReplyUnavailableVoteButtonColor; - private int mPostIconAndInfoColor; - private int mCommentColor; - - private Drawable mCommentIcon; - private float mScale; - private ExoCreator mExoCreator; + private final boolean mDisableImagePreview; + private final boolean mOnlyDisablePreviewInVideoAndGifPosts; + private final boolean mHidePostType; + private final boolean mHidePostFlair; + private final boolean mHideUpvoteRatio; + private final boolean mHideSubredditAndUserPrefix; + private final boolean mHideTheNumberOfVotes; + private final boolean mHideTheNumberOfComments; + private final boolean mSeparatePostAndComments; + private final boolean mLegacyAutoplayVideoControllerUI; + private final boolean mEasierToWatchInFullScreen; + private final PostDetailRecyclerViewAdapterCallback mPostDetailRecyclerViewAdapterCallback; + + private final int mColorAccent; + private final int mCardViewColor; + private final int mSecondaryTextColor; + private final int mPostTitleColor; + private final int mPrimaryTextColor; + private final int mPostTypeBackgroundColor; + private final int mPostTypeTextColor; + private final int mSubredditColor; + private final int mUsernameColor; + private final int mModeratorColor; + private final int mAuthorFlairTextColor; + private final int mSpoilerBackgroundColor; + private final int mSpoilerTextColor; + private final int mFlairBackgroundColor; + private final int mFlairTextColor; + private final int mNSFWBackgroundColor; + private final int mNSFWTextColor; + private final int mArchivedTintColor; + private final int mLockedTintColor; + private final int mCrosspostTintColor; + private final int mMediaIndicatorIconTint; + private final int mMediaIndicatorBackgroundColor; + private final int mUpvoteRatioTintColor; + private final int mNoPreviewPostTypeBackgroundColor; + private final int mNoPreviewPostTypeIconTint; + private final int mUpvotedColor; + private final int mDownvotedColor; + private final int mVoteAndReplyUnavailableVoteButtonColor; + private final int mPostIconAndInfoColor; + private final int mCommentColor; + + private final Drawable mCommentIcon; + private final float mScale; + private final ExoCreator mExoCreator; private boolean canStartActivity = true; private boolean canPlayVideo = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java index 3f0db0e5..d49222b3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java @@ -17,9 +17,9 @@ import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; public class PostFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private List<PostFilterUsage> postFilterUsages; - private BaseActivity activity; - private CustomThemeWrapper customThemeWrapper; - private OnItemClickListener onItemClickListener; + private final BaseActivity activity; + private final CustomThemeWrapper customThemeWrapper; + private final OnItemClickListener onItemClickListener; public interface OnItemClickListener { void onClick(PostFilterUsage postFilterUsage); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterWithUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterWithUsageRecyclerViewAdapter.java index 73194143..1e732c49 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterWithUsageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterWithUsageRecyclerViewAdapter.java @@ -25,11 +25,11 @@ public class PostFilterWithUsageRecyclerViewAdapter extends RecyclerView.Adapter private static final int VIEW_TYPE_HEADER = 1; private static final int VIEW_TYPE_POST_FILTER = 2; - private BaseActivity activity; - private CustomThemeWrapper customThemeWrapper; + private final BaseActivity activity; + private final CustomThemeWrapper customThemeWrapper; private final OnItemClickListener onItemClickListener; private List<PostFilterWithUsage> postFilterWithUsageList; - private RecyclerView.RecycledViewPool recycledViewPool; + private final RecyclerView.RecycledViewPool recycledViewPool; public interface OnItemClickListener { void onItemClick(PostFilter postFilter); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java index f5ec7c13..386e29f9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostGalleryTypeImageRecyclerViewAdapter.java @@ -31,19 +31,19 @@ import ml.docilealligator.infinityforreddit.databinding.ItemGalleryImageInPostFe import ml.docilealligator.infinityforreddit.post.Post; public class PostGalleryTypeImageRecyclerViewAdapter extends RecyclerView.Adapter<PostGalleryTypeImageRecyclerViewAdapter.ImageViewHolder> { - private RequestManager glide; - private Typeface typeface; + private final RequestManager glide; + private final Typeface typeface; private Markwon mPostDetailMarkwon; - private SaveMemoryCenterInisdeDownsampleStrategy saveMemoryCenterInisdeDownsampleStrategy; - private int mColorAccent; - private int mPrimaryTextColor; + private final SaveMemoryCenterInisdeDownsampleStrategy saveMemoryCenterInisdeDownsampleStrategy; + private final int mColorAccent; + private final int mPrimaryTextColor; private int mCardViewColor; private int mCommentColor; - private float mScale; + private final float mScale; private ArrayList<Post.Gallery> galleryImages; private boolean blurImage; private float ratio; - private boolean showCaption; + private final boolean showCaption; public PostGalleryTypeImageRecyclerViewAdapter(RequestManager glide, Typeface typeface, SaveMemoryCenterInisdeDownsampleStrategy saveMemoryCenterInisdeDownsampleStrategy, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index d5b3f0ab..520a4496 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -4792,7 +4792,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ImageView noPreviewImageView; PostGalleryTypeImageRecyclerViewAdapter adapter; - private LinearLayoutManagerBugFixed layoutManager; + private final LinearLayoutManagerBugFixed layoutManager; Post post; Post.Preview preview; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java index a7371257..ff730848 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java @@ -55,18 +55,18 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt private static final int VIEW_TYPE_MESSAGE_SENT = 0; private static final int VIEW_TYPE_MESSAGE_RECEIVED = 1; private Message mMessage; - private ViewPrivateMessagesActivity mViewPrivateMessagesActivity; - private RequestManager mGlide; - private Locale mLocale; - private String mAccountName; - private Markwon mMarkwon; - private boolean mShowElapsedTime; - private String mTimeFormatPattern; - private int mSecondaryTextColor; - private int mReceivedMessageTextColor; - private int mSentMessageTextColor; - private int mReceivedMessageBackgroundColor; - private int mSentMessageBackgroundColor; + private final ViewPrivateMessagesActivity mViewPrivateMessagesActivity; + private final RequestManager mGlide; + private final Locale mLocale; + private final String mAccountName; + private final Markwon mMarkwon; + private final boolean mShowElapsedTime; + private final String mTimeFormatPattern; + private final int mSecondaryTextColor; + private final int mReceivedMessageTextColor; + private final int mSentMessageTextColor; + private final int mReceivedMessageBackgroundColor; + private final int mSentMessageBackgroundColor; public PrivateMessagesDetailRecyclerViewAdapter(ViewPrivateMessagesActivity viewPrivateMessagesActivity, SharedPreferences sharedPreferences, Locale locale, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java index cda083f8..fe28651c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RedditGallerySubmissionRecyclerViewAdapter.java @@ -43,11 +43,11 @@ public class RedditGallerySubmissionRecyclerViewAdapter extends RecyclerView.Ada private static final int VIEW_TYPE_IMAGE = 1; private static final int VIEW_TYPE_ADD_IMAGE = 2; - private PostGalleryActivity activity; + private final PostGalleryActivity activity; private ArrayList<RedditGalleryImageInfo> redditGalleryImageInfoList; - private CustomThemeWrapper customThemeWrapper; - private ItemClickListener itemClickListener; - private RequestManager glide; + private final CustomThemeWrapper customThemeWrapper; + private final ItemClickListener itemClickListener; + private final RequestManager glide; public RedditGallerySubmissionRecyclerViewAdapter(PostGalleryActivity activity, CustomThemeWrapper customThemeWrapper, ItemClickListener itemClickListener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java index e9e62a56..a911e6e9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java @@ -21,11 +21,11 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; public class ReportReasonRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity activity; - private ArrayList<ReportReason> generalReasons; + private final BaseActivity activity; + private final ArrayList<ReportReason> generalReasons; private ArrayList<ReportReason> rules; - private int primaryTextColor; - private int colorAccent; + private final int primaryTextColor; + private final int colorAccent; public ReportReasonRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, ArrayList<ReportReason> generalReasons) { this.activity = activity; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java index 5dc4a82e..510c4a35 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java @@ -42,24 +42,22 @@ import ml.docilealligator.infinityforreddit.markdown.ImageAndGifPlugin; import ml.docilealligator.infinityforreddit.markdown.MarkdownUtils; public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecyclerViewAdapter.RuleViewHolder> { - private BaseActivity activity; - private EmoteCloseBracketInlineProcessor emoteCloseBracketInlineProcessor; - private EmotePlugin emotePlugin; - private ImageAndGifPlugin imageAndGifPlugin; - private ImageAndGifEntry imageAndGifEntry; - private Markwon markwon; + private final BaseActivity activity; + private final EmoteCloseBracketInlineProcessor emoteCloseBracketInlineProcessor; + private final EmotePlugin emotePlugin; + private final ImageAndGifPlugin imageAndGifPlugin; + private final ImageAndGifEntry imageAndGifEntry; + private final Markwon markwon; @Nullable private final SliderPanel sliderPanel; - private String subredditName; private ArrayList<Rule> rules; - private int mPrimaryTextColor; + private final int mPrimaryTextColor; public RulesRecyclerViewAdapter(@NonNull BaseActivity activity, @NonNull CustomThemeWrapper customThemeWrapper, @Nullable SliderPanel sliderPanel, String subredditName) { this.activity = activity; this.sliderPanel = sliderPanel; - this.subredditName = subredditName; mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(); int spoilerBackgroundColor = mPrimaryTextColor | 0xFF000000; MarkwonPlugin miscPlugin = new AbstractMarkwonPlugin() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java index 776c00ef..c75479ce 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java @@ -17,12 +17,12 @@ import ml.docilealligator.infinityforreddit.recentsearchquery.RecentSearchQuery; import ml.docilealligator.infinityforreddit.utils.Utils; public class SearchActivityRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity activity; + private final BaseActivity activity; private List<RecentSearchQuery> recentSearchQueries; - private int primaryTextColor; - private Drawable historyIcon; - private Drawable deleteIcon; - private ItemOnClickListener itemOnClickListener; + private final int primaryTextColor; + private final Drawable historyIcon; + private final Drawable deleteIcon; + private final ItemOnClickListener itemOnClickListener; public interface ItemOnClickListener { void onClick(String query); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java index 89833ae8..449d006b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java @@ -18,9 +18,9 @@ import ml.docilealligator.infinityforreddit.activities.BaseActivity; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; public class SelectedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity activity; - private CustomThemeWrapper customThemeWrapper; - private ArrayList<String> subreddits; + private final BaseActivity activity; + private final CustomThemeWrapper customThemeWrapper; + private final ArrayList<String> subreddits; public SelectedSubredditsRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, ArrayList<String> subreddits) { this.activity = activity; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditAutocompleteRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditAutocompleteRecyclerViewAdapter.java index ee1e1208..c1a0afe5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditAutocompleteRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditAutocompleteRecyclerViewAdapter.java @@ -24,11 +24,11 @@ import ml.docilealligator.infinityforreddit.subreddit.SubredditData; import pl.droidsonroids.gif.GifImageView; public class SubredditAutocompleteRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity activity; + private final BaseActivity activity; private List<SubredditData> subreddits; - private RequestManager glide; - private CustomThemeWrapper customThemeWrapper; - private ItemOnClickListener itemOnClickListener; + private final RequestManager glide; + private final CustomThemeWrapper customThemeWrapper; + private final ItemOnClickListener itemOnClickListener; public SubredditAutocompleteRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, ItemOnClickListener itemOnClickListener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditListingRecyclerViewAdapter.java index a6ce267a..c1d60585 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditListingRecyclerViewAdapter.java @@ -56,24 +56,24 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred return true; } }; - private RequestManager glide; - private BaseActivity activity; - private Executor executor; - private Retrofit oauthRetrofit; - private Retrofit retrofit; - private String accessToken; - private String accountName; - private RedditDataRoomDatabase redditDataRoomDatabase; - private boolean isMultiSelection; - private int colorPrimaryLightTheme; - private int primaryTextColor; - private int secondaryTextColor; - private int colorAccent; - private int buttonTextColor; - private int unsubscribed; + private final RequestManager glide; + private final BaseActivity activity; + private final Executor executor; + private final Retrofit oauthRetrofit; + private final Retrofit retrofit; + private final String accessToken; + private final String accountName; + private final RedditDataRoomDatabase redditDataRoomDatabase; + private final boolean isMultiSelection; + private final int colorPrimaryLightTheme; + private final int primaryTextColor; + private final int secondaryTextColor; + private final int colorAccent; + private final int buttonTextColor; + private final int unsubscribed; private NetworkState networkState; - private Callback callback; + private final Callback callback; public SubredditListingRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit, Retrofit retrofit, CustomThemeWrapper customThemeWrapper, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditMultiselectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditMultiselectionRecyclerViewAdapter.java index a5532c42..604e4919 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditMultiselectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditMultiselectionRecyclerViewAdapter.java @@ -29,11 +29,11 @@ import pl.droidsonroids.gif.GifImageView; public class SubredditMultiselectionRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity activity; + private final BaseActivity activity; private ArrayList<SubredditWithSelection> subscribedSubreddits; - private RequestManager glide; - private int primaryTextColor; - private int colorAccent; + private final RequestManager glide; + private final int primaryTextColor; + private final int colorAccent; public SubredditMultiselectionRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper) { this.activity = activity; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubscribedSubredditsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubscribedSubredditsRecyclerViewAdapter.java index 939807d9..40e514c5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubscribedSubredditsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubscribedSubredditsRecyclerViewAdapter.java @@ -40,23 +40,23 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte private static final int VIEW_TYPE_SUBREDDIT_DIVIDER = 2; private static final int VIEW_TYPE_SUBREDDIT = 3; - private BaseActivity mActivity; - private Executor mExecutor; - private Retrofit mOauthRetrofit; - private RedditDataRoomDatabase mRedditDataRoomDatabase; + private final BaseActivity mActivity; + private final Executor mExecutor; + private final Retrofit mOauthRetrofit; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; private List<SubscribedSubredditData> mSubscribedSubredditData; private List<SubscribedSubredditData> mFavoriteSubscribedSubredditData; - private RequestManager glide; + private final RequestManager glide; private ItemClickListener itemClickListener; - private String accessToken; - private String accountName; + private final String accessToken; + private final String accountName; private String username; private String userIconUrl; private boolean hasClearSelectionRow; - private int primaryTextColor; - private int secondaryTextColor; + private final int primaryTextColor; + private final int secondaryTextColor; public SubscribedSubredditsRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit, RedditDataRoomDatabase redditDataRoomDatabase, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/TranslationFragmentRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/TranslationFragmentRecyclerViewAdapter.java index 77232d74..4e209091 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/TranslationFragmentRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/TranslationFragmentRecyclerViewAdapter.java @@ -22,10 +22,10 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.settings.Translation; public class TranslationFragmentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity activity; - private int primaryTextColor; - private int secondaryTextColor; - private ArrayList<Translation> translationContributors; + private final BaseActivity activity; + private final int primaryTextColor; + private final int secondaryTextColor; + private final ArrayList<Translation> translationContributors; public TranslationFragmentRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper) { this.activity = activity; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/TrendingSearchRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/TrendingSearchRecyclerViewAdapter.java index 4e2ad94f..09a11199 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/TrendingSearchRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/TrendingSearchRecyclerViewAdapter.java @@ -34,15 +34,15 @@ import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView; import ml.docilealligator.infinityforreddit.post.Post; public class TrendingSearchRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity activity; + private final BaseActivity activity; private ArrayList<TrendingSearch> trendingSearches; - private CustomThemeWrapper customThemeWrapper; - private RequestManager glide; - private int imageViewWidth; - private boolean dataSavingMode; - private boolean disableImagePreview; - private float mScale; - private ItemClickListener itemClickListener; + private final CustomThemeWrapper customThemeWrapper; + private final RequestManager glide; + private final int imageViewWidth; + private final boolean dataSavingMode; + private final boolean disableImagePreview; + private final float mScale; + private final ItemClickListener itemClickListener; public TrendingSearchRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, int imageViewWidth, boolean dataSavingMode, boolean disableImagePreview, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UploadedImagesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UploadedImagesRecyclerViewAdapter.java index b3c0ec63..4ea99c1e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UploadedImagesRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UploadedImagesRecyclerViewAdapter.java @@ -17,8 +17,8 @@ import ml.docilealligator.infinityforreddit.activities.BaseActivity; public class UploadedImagesRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private BaseActivity activity; - private ArrayList<UploadedImage> uploadedImages; - private ItemClickListener itemClickListener; + private final ArrayList<UploadedImage> uploadedImages; + private final ItemClickListener itemClickListener; public UploadedImagesRecyclerViewAdapter(Activity activity, ArrayList<UploadedImage> uploadedImages, ItemClickListener itemClickListener) { if (activity instanceof BaseActivity) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java index 3f88fe19..574b1209 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java @@ -20,10 +20,10 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.utils.Utils; public class UserFlairRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity activity; - private CustomThemeWrapper customThemeWrapper; - private ArrayList<UserFlair> userFlairs; - private ItemClickListener itemClickListener; + private final BaseActivity activity; + private final CustomThemeWrapper customThemeWrapper; + private final ArrayList<UserFlair> userFlairs; + private final ItemClickListener itemClickListener; public UserFlairRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, ArrayList<UserFlair> userFlairs, ItemClickListener itemClickListener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.java index 6c12336d..4c9ef8f7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.java @@ -55,21 +55,21 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R return true; } }; - private RequestManager glide; - private BaseActivity activity; - private Executor executor; - private Retrofit oauthRetrofit; - private Retrofit retrofit; - private String accessToken; - private String accountName; - private RedditDataRoomDatabase redditDataRoomDatabase; - private boolean isMultiSelection; - - private int primaryTextColor; - private int buttonTextColor; - private int colorPrimaryLightTheme; - private int colorAccent; - private int unsubscribedColor; + private final RequestManager glide; + private final BaseActivity activity; + private final Executor executor; + private final Retrofit oauthRetrofit; + private final Retrofit retrofit; + private final String accessToken; + private final String accountName; + private final RedditDataRoomDatabase redditDataRoomDatabase; + private final boolean isMultiSelection; + + private final int primaryTextColor; + private final int buttonTextColor; + private final int colorPrimaryLightTheme; + private final int colorAccent; + private final int unsubscribedColor; private NetworkState networkState; private final Callback callback; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountManagementSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountManagementSectionRecyclerViewAdapter.java index 55bf9602..8f781b2b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountManagementSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountManagementSectionRecyclerViewAdapter.java @@ -30,13 +30,13 @@ public class AccountManagementSectionRecyclerViewAdapter extends RecyclerView.Ad private static final int VIEW_TYPE_ACCOUNT = 1; private static final int VIEW_TYPE_MENU_ITEM = 2; - private BaseActivity baseActivity; + private final BaseActivity baseActivity; private ArrayList<Account> accounts; - private RequestManager glide; - private int primaryTextColor; - private int primaryIconColor; - private boolean isLoggedIn; - private NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; + private final RequestManager glide; + private final int primaryTextColor; + private final int primaryIconColor; + private final boolean isLoggedIn; + private final NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; public AccountManagementSectionRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper, RequestManager glide, boolean isLoggedIn, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountSectionRecyclerViewAdapter.java index d2934152..da77e717 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/AccountSectionRecyclerViewAdapter.java @@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit.adapters.navigationdrawer; import android.content.Intent; import android.content.SharedPreferences; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -28,14 +27,14 @@ public class AccountSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recy private static final int ACCOUNT_SECTION_ITEMS = 5; private static final int ANONYMOUS_ACCOUNT_SECTION_ITEMS = 3; - private BaseActivity baseActivity; + private final BaseActivity baseActivity; private int inboxCount; - private int primaryTextColor; - private int secondaryTextColor; - private int primaryIconColor; + private final int primaryTextColor; + private final int secondaryTextColor; + private final int primaryIconColor; private boolean collapseAccountSection; - private boolean isLoggedIn; - private NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; + private final boolean isLoggedIn; + private final NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; public AccountSectionRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper, SharedPreferences navigationDrawerSharedPreferences, boolean isLoggedIn, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/FavoriteSubscribedSubredditsSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/FavoriteSubscribedSubredditsSectionRecyclerViewAdapter.java index 023b7944..30d9c627 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/FavoriteSubscribedSubredditsSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/FavoriteSubscribedSubredditsSectionRecyclerViewAdapter.java @@ -31,13 +31,13 @@ public class FavoriteSubscribedSubredditsSectionRecyclerViewAdapter extends Recy private static final int VIEW_TYPE_MENU_GROUP_TITLE = 1; private static final int VIEW_TYPE_FAVORITE_SUBSCRIBED_SUBREDDIT = 2; - private BaseActivity baseActivity; - private RequestManager glide; - private int primaryTextColor; - private int secondaryTextColor; + private final BaseActivity baseActivity; + private final RequestManager glide; + private final int primaryTextColor; + private final int secondaryTextColor; private boolean collapseFavoriteSubredditsSection; - private boolean hideFavoriteSubredditsSection; - private NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; + private final boolean hideFavoriteSubredditsSection; + private final NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; private ArrayList<SubscribedSubredditData> favoriteSubscribedSubreddits = new ArrayList<>(); public FavoriteSubscribedSubredditsSectionRecyclerViewAdapter(BaseActivity baseActivity, RequestManager glide, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java index 4eda8e4d..d9fdf092 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java @@ -35,19 +35,19 @@ import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import pl.droidsonroids.gif.GifImageView; public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity baseActivity; - private CustomThemeWrapper customThemeWrapper; - private Resources resources; - private RequestManager glide; - private String accountName; + private final BaseActivity baseActivity; + private final CustomThemeWrapper customThemeWrapper; + private final Resources resources; + private final RequestManager glide; + private final String accountName; private String profileImageUrl; private String bannerImageUrl; private int karma; private boolean requireAuthToAccountSection; private boolean showAvatarOnTheRightInTheNavigationDrawer; - private boolean isLoggedIn; + private final boolean isLoggedIn; private boolean isInMainPage = true; - private PageToggle pageToggle; + private final PageToggle pageToggle; private boolean hideKarma; public HeaderSectionRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java index 8e6ef6e5..6d738811 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java @@ -16,15 +16,15 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubredditData; public class NavigationDrawerRecyclerViewMergedAdapter { - private HeaderSectionRecyclerViewAdapter headerSectionRecyclerViewAdapter; - private AccountSectionRecyclerViewAdapter accountSectionRecyclerViewAdapter; - private RedditSectionRecyclerViewAdapter redditSectionRecyclerViewAdapter; - private PostSectionRecyclerViewAdapter postSectionRecyclerViewAdapter; - private PreferenceSectionRecyclerViewAdapter preferenceSectionRecyclerViewAdapter; - private FavoriteSubscribedSubredditsSectionRecyclerViewAdapter favoriteSubscribedSubredditsSectionRecyclerViewAdapter; - private SubscribedSubredditsRecyclerViewAdapter subscribedSubredditsRecyclerViewAdapter; - private AccountManagementSectionRecyclerViewAdapter accountManagementSectionRecyclerViewAdapter; - private ConcatAdapter mainPageConcatAdapter; + private final HeaderSectionRecyclerViewAdapter headerSectionRecyclerViewAdapter; + private final AccountSectionRecyclerViewAdapter accountSectionRecyclerViewAdapter; + private final RedditSectionRecyclerViewAdapter redditSectionRecyclerViewAdapter; + private final PostSectionRecyclerViewAdapter postSectionRecyclerViewAdapter; + private final PreferenceSectionRecyclerViewAdapter preferenceSectionRecyclerViewAdapter; + private final FavoriteSubscribedSubredditsSectionRecyclerViewAdapter favoriteSubscribedSubredditsSectionRecyclerViewAdapter; + private final SubscribedSubredditsRecyclerViewAdapter subscribedSubredditsRecyclerViewAdapter; + private final AccountManagementSectionRecyclerViewAdapter accountManagementSectionRecyclerViewAdapter; + private final ConcatAdapter mainPageConcatAdapter; public NavigationDrawerRecyclerViewMergedAdapter(BaseActivity baseActivity, SharedPreferences sharedPreferences, SharedPreferences nsfwAndSpoilerSharedPreferences, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostFilterUsageEmbeddedRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostFilterUsageEmbeddedRecyclerViewAdapter.java index c13e548a..2676e1f9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostFilterUsageEmbeddedRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostFilterUsageEmbeddedRecyclerViewAdapter.java @@ -17,7 +17,7 @@ import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; public class PostFilterUsageEmbeddedRecyclerViewAdapter extends RecyclerView.Adapter<PostFilterUsageEmbeddedRecyclerViewAdapter.EntryViewHolder> { - private BaseActivity baseActivity; + private final BaseActivity baseActivity; private List<PostFilterUsage> postFilterUsageList; public PostFilterUsageEmbeddedRecyclerViewAdapter(BaseActivity baseActivity) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostSectionRecyclerViewAdapter.java index 82cd08d1..e0442732 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostSectionRecyclerViewAdapter.java @@ -24,13 +24,13 @@ public class PostSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recycle private static final int VIEW_TYPE_MENU_ITEM = 2; private static final int POST_SECTION_ITEMS = 4; - private BaseActivity baseActivity; - private int primaryTextColor; - private int secondaryTextColor; - private int primaryIconColor; + private final BaseActivity baseActivity; + private final int primaryTextColor; + private final int secondaryTextColor; + private final int primaryIconColor; private boolean collapsePostSection; - private boolean isLoggedIn; - private NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; + private final boolean isLoggedIn; + private final NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; public PostSectionRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper, SharedPreferences navigationDrawerSharedPreferences, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PreferenceSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PreferenceSectionRecyclerViewAdapter.java index b6538166..20c8efa4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PreferenceSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PreferenceSectionRecyclerViewAdapter.java @@ -27,14 +27,14 @@ public class PreferenceSectionRecyclerViewAdapter extends RecyclerView.Adapter<R private static final int VIEW_TYPE_MENU_ITEM = 2; private static final int PREFERENCES_SECTION_ITEMS = 3; - private BaseActivity baseActivity; - private Resources resources; - private int primaryTextColor; - private int secondaryTextColor; - private int primaryIconColor; + private final BaseActivity baseActivity; + private final Resources resources; + private final int primaryTextColor; + private final int secondaryTextColor; + private final int primaryIconColor; private boolean isNSFWEnabled; private boolean collapsePreferencesSection; - private NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; + private final NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; public PreferenceSectionRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper, @NonNull String accountName, SharedPreferences nsfwAndSpoilerSharedPreferences, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/RedditSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/RedditSectionRecyclerViewAdapter.java index 487e9d33..46f96db1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/RedditSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/RedditSectionRecyclerViewAdapter.java @@ -24,12 +24,12 @@ public class RedditSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc private static final int VIEW_TYPE_MENU_ITEM = 2; private static final int REDDIT_SECTION_ITEMS = 1; - private BaseActivity baseActivity; - private int primaryTextColor; - private int secondaryTextColor; - private int primaryIconColor; + private final BaseActivity baseActivity; + private final int primaryTextColor; + private final int secondaryTextColor; + private final int primaryIconColor; private boolean collapseRedditSection; - private NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; + private final NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; public RedditSectionRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper, SharedPreferences navigationDrawerSharedPreferences, @@ -83,11 +83,9 @@ public class RedditSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc int stringId = 0; int drawableId = 0; - switch (position) { - case 1: - stringId = R.string.trending; - drawableId = R.drawable.ic_trending_24dp; - break; + if (position == 1) { + stringId = R.string.trending; + drawableId = R.drawable.ic_trending_24dp; } ((MenuItemViewHolder) holder).menuTextView.setText(stringId); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/SubscribedSubredditsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/SubscribedSubredditsRecyclerViewAdapter.java index 3e77b1e0..fb0d5e9f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/SubscribedSubredditsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/SubscribedSubredditsRecyclerViewAdapter.java @@ -31,14 +31,14 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte private static final int VIEW_TYPE_MENU_GROUP_TITLE = 1; private static final int VIEW_TYPE_SUBSCRIBED_SUBREDDIT = 2; - private BaseActivity baseActivity; - private RequestManager glide; - private int primaryTextColor; - private int secondaryTextColor; + private final BaseActivity baseActivity; + private final RequestManager glide; + private final int primaryTextColor; + private final int secondaryTextColor; private boolean collapseSubscribedSubredditsSection; - private boolean hideSubscribedSubredditsSection; + private final boolean hideSubscribedSubredditsSection; private ArrayList<SubscribedSubredditData> subscribedSubreddits = new ArrayList<>(); - private NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; + private final NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener; public SubscribedSubredditsRecyclerViewAdapter(BaseActivity baseActivity, RequestManager glide, CustomThemeWrapper customThemeWrapper, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/broadcastreceivers/NetworkWifiStatusReceiver.java b/app/src/main/java/ml/docilealligator/infinityforreddit/broadcastreceivers/NetworkWifiStatusReceiver.java index fc7355a5..5522eca5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/broadcastreceivers/NetworkWifiStatusReceiver.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/broadcastreceivers/NetworkWifiStatusReceiver.java @@ -5,7 +5,7 @@ import android.content.Context; import android.content.Intent; public class NetworkWifiStatusReceiver extends BroadcastReceiver { - private NetworkWifiStatusReceiverListener networkWifiStatusReceiverListener; + private final NetworkWifiStatusReceiverListener networkWifiStatusReceiverListener; public interface NetworkWifiStatusReceiverListener { void networkStatusChange(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/broadcastreceivers/WallpaperChangeReceiver.java b/app/src/main/java/ml/docilealligator/infinityforreddit/broadcastreceivers/WallpaperChangeReceiver.java index f92c79ef..2a5efc9b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/broadcastreceivers/WallpaperChangeReceiver.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/broadcastreceivers/WallpaperChangeReceiver.java @@ -13,7 +13,7 @@ import ml.docilealligator.infinityforreddit.MaterialYouWorker; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; public class WallpaperChangeReceiver extends BroadcastReceiver { - private SharedPreferences sharedPreferences; + private final SharedPreferences sharedPreferences; public WallpaperChangeReceiver(SharedPreferences sharedPreferences) { this.sharedPreferences = sharedPreferences; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSource.java index d4f312b1..81daa344 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSource.java @@ -12,7 +12,6 @@ import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; -import java.util.Locale; import ml.docilealligator.infinityforreddit.NetworkState; import ml.docilealligator.infinityforreddit.SortType; @@ -27,28 +26,26 @@ import retrofit2.Retrofit; public class CommentDataSource extends PageKeyedDataSource<String, Comment> { - private Retrofit retrofit; - private Locale locale; + private final Retrofit retrofit; @Nullable - private String accessToken; + private final String accessToken; @Nullable - private String accountName; - private String username; - private SortType sortType; - private boolean areSavedComments; + private final String accountName; + private final String username; + private final SortType sortType; + private final boolean areSavedComments; - private MutableLiveData<NetworkState> paginationNetworkStateLiveData; - private MutableLiveData<NetworkState> initialLoadStateLiveData; - private MutableLiveData<Boolean> hasPostLiveData; + private final MutableLiveData<NetworkState> paginationNetworkStateLiveData; + private final MutableLiveData<NetworkState> initialLoadStateLiveData; + private final MutableLiveData<Boolean> hasPostLiveData; private LoadParams<String> params; private LoadCallback<String, Comment> callback; - CommentDataSource(Retrofit retrofit, Locale locale, @Nullable String accessToken, @NonNull String accountName, + CommentDataSource(Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName, String username, SortType sortType, boolean areSavedComments) { this.retrofit = retrofit; - this.locale = locale; this.accessToken = accessToken; this.accountName = accountName; this.username = username; @@ -93,7 +90,7 @@ public class CommentDataSource extends PageKeyedDataSource<String, Comment> { @Override public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { if (response.isSuccessful()) { - new ParseCommentAsyncTask(response.body(), locale, new ParseCommentAsyncTask.ParseCommentAsyncTaskListener() { + new ParseCommentAsyncTask(response.body(), new ParseCommentAsyncTask.ParseCommentAsyncTaskListener() { @Override public void parseSuccessful(ArrayList<Comment> comments, String after) { if (comments.size() == 0) { @@ -152,7 +149,7 @@ public class CommentDataSource extends PageKeyedDataSource<String, Comment> { @Override public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { if (response.isSuccessful()) { - new ParseCommentAsyncTask(response.body(), locale, new ParseCommentAsyncTask.ParseCommentAsyncTaskListener() { + new ParseCommentAsyncTask(response.body(), new ParseCommentAsyncTask.ParseCommentAsyncTaskListener() { @Override public void parseSuccessful(ArrayList<Comment> comments, String after) { if (after == null || after.equals("") || after.equals("null")) { @@ -182,13 +179,11 @@ public class CommentDataSource extends PageKeyedDataSource<String, Comment> { private static class ParseCommentAsyncTask extends AsyncTask<Void, ArrayList<Comment>, ArrayList<Comment>> { private String after; - private Locale locale; private JSONArray commentsJSONArray; private boolean parseFailed; - private ParseCommentAsyncTaskListener parseCommentAsyncTaskListener; + private final ParseCommentAsyncTaskListener parseCommentAsyncTaskListener; - ParseCommentAsyncTask(String response, Locale locale, ParseCommentAsyncTaskListener parseCommentAsyncTaskListener) { - this.locale = locale; + ParseCommentAsyncTask(String response, ParseCommentAsyncTaskListener parseCommentAsyncTaskListener) { this.parseCommentAsyncTaskListener = parseCommentAsyncTaskListener; try { JSONObject data = new JSONObject(response).getJSONObject(JSONUtils.DATA_KEY); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSourceFactory.java index 5ea1a489..5af151a0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSourceFactory.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSourceFactory.java @@ -11,16 +11,16 @@ import ml.docilealligator.infinityforreddit.SortType; import retrofit2.Retrofit; class CommentDataSourceFactory extends DataSource.Factory { - private Retrofit retrofit; - private Locale locale; - private String accessToken; - private String accountName; - private String username; + private final Retrofit retrofit; + private final Locale locale; + private final String accessToken; + private final String accountName; + private final String username; private SortType sortType; - private boolean areSavedComments; + private final boolean areSavedComments; private CommentDataSource commentDataSource; - private MutableLiveData<CommentDataSource> commentDataSourceLiveData; + private final MutableLiveData<CommentDataSource> commentDataSourceLiveData; CommentDataSourceFactory(Retrofit retrofit, Locale locale, @Nullable String accessToken, @NonNull String accountName, String username, SortType sortType, @@ -38,7 +38,7 @@ class CommentDataSourceFactory extends DataSource.Factory { @NonNull @Override public DataSource create() { - commentDataSource = new CommentDataSource(retrofit, locale, accessToken, accountName, username, + commentDataSource = new CommentDataSource(retrofit, accessToken, accountName, username, sortType, areSavedComments); commentDataSourceLiveData.postValue(commentDataSource); return commentDataSource; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java index b9472bc0..17574d68 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java @@ -17,12 +17,12 @@ import ml.docilealligator.infinityforreddit.SortType; import retrofit2.Retrofit; public class CommentViewModel extends ViewModel { - private CommentDataSourceFactory commentDataSourceFactory; - private LiveData<NetworkState> paginationNetworkState; - private LiveData<NetworkState> initialLoadingState; - private LiveData<Boolean> hasCommentLiveData; - private LiveData<PagedList<Comment>> comments; - private MutableLiveData<SortType> sortTypeLiveData; + private final CommentDataSourceFactory commentDataSourceFactory; + private final LiveData<NetworkState> paginationNetworkState; + private final LiveData<NetworkState> initialLoadingState; + private final LiveData<Boolean> hasCommentLiveData; + private final LiveData<PagedList<Comment>> comments; + private final MutableLiveData<SortType> sortTypeLiveData; public CommentViewModel(Retrofit retrofit, Locale locale, @Nullable String accessToken, @NonNull String accountName, String username, SortType sortType, boolean areSavedComments) { @@ -81,13 +81,13 @@ public class CommentViewModel extends ViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private Retrofit retrofit; - private Locale locale; - private String accessToken; - private String accountName; - private String username; - private SortType sortType; - private boolean areSavedComments; + private final Retrofit retrofit; + private final Locale locale; + private final String accessToken; + private final String accountName; + private final String username; + private final SortType sortType; + private final boolean areSavedComments; public Factory(Retrofit retrofit, Locale locale, @Nullable String accessToken, @NonNull String accountName, String username, SortType sortType, boolean areSavedComments) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterDao.java b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterDao.java index 68785fb8..b7faa7f7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterDao.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterDao.java @@ -43,5 +43,5 @@ public interface CommentFilterDao { @Transaction @Query("SELECT * FROM comment_filter ORDER BY name") - public LiveData<List<CommentFilterWithUsage>> getAllCommentFilterWithUsageLiveData(); + LiveData<List<CommentFilterWithUsage>> getAllCommentFilterWithUsageLiveData(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterUsageViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterUsageViewModel.java index 89a03f41..19ae0e7f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterUsageViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterUsageViewModel.java @@ -10,7 +10,7 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class CommentFilterUsageViewModel extends ViewModel { - private LiveData<List<CommentFilterUsage>> mCommentFilterUsageListLiveData; + private final LiveData<List<CommentFilterUsage>> mCommentFilterUsageListLiveData; public CommentFilterUsageViewModel(RedditDataRoomDatabase redditDataRoomDatabase, String name) { mCommentFilterUsageListLiveData = redditDataRoomDatabase.commentFilterUsageDao().getAllCommentFilterUsageLiveData(name); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterWithUsageViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterWithUsageViewModel.java index fb8733fe..fc036aa6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterWithUsageViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/commentfilter/CommentFilterWithUsageViewModel.java @@ -10,7 +10,7 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class CommentFilterWithUsageViewModel extends ViewModel { - private LiveData<List<CommentFilterWithUsage>> mCommentFilterWithUsageListLiveData; + private final LiveData<List<CommentFilterWithUsage>> mCommentFilterWithUsageListLiveData; public CommentFilterWithUsageViewModel(RedditDataRoomDatabase redditDataRoomDatabase) { mCommentFilterWithUsageListLiveData = redditDataRoomDatabase.commentFilterDao().getAllCommentFilterWithUsageLiveData(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeRepository.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeRepository.java index c3e07f22..9cee3de9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeRepository.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeRepository.java @@ -7,10 +7,10 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class CustomThemeRepository { - private LiveData<List<CustomTheme>> mAllCustomThemes; - private LiveData<CustomTheme> mCurrentLightCustomTheme; - private LiveData<CustomTheme> mCurrentDarkCustomTheme; - private LiveData<CustomTheme> mCurrentAmoledCustomTheme; + private final LiveData<List<CustomTheme>> mAllCustomThemes; + private final LiveData<CustomTheme> mCurrentLightCustomTheme; + private final LiveData<CustomTheme> mCurrentDarkCustomTheme; + private final LiveData<CustomTheme> mCurrentAmoledCustomTheme; CustomThemeRepository(RedditDataRoomDatabase redditDataRoomDatabase) { mAllCustomThemes = redditDataRoomDatabase.customThemeDao().getAllCustomThemes(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeViewModel.java index d7abf17b..c8a6f930 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeViewModel.java @@ -10,10 +10,10 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class CustomThemeViewModel extends ViewModel { - private LiveData<List<CustomTheme>> mAllCustomThemes; - private LiveData<CustomTheme> mCurrentLightTheme; - private LiveData<CustomTheme> mCurrentDarkTheme; - private LiveData<CustomTheme> mCurrentAmoledTheme; + private final LiveData<List<CustomTheme>> mAllCustomThemes; + private final LiveData<CustomTheme> mCurrentLightTheme; + private final LiveData<CustomTheme> mCurrentDarkTheme; + private final LiveData<CustomTheme> mCurrentAmoledTheme; public CustomThemeViewModel(RedditDataRoomDatabase redditDataRoomDatabase) { CustomThemeRepository customThemeRepository = new CustomThemeRepository(redditDataRoomDatabase); @@ -40,7 +40,7 @@ public class CustomThemeViewModel extends ViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private RedditDataRoomDatabase mRedditDataRoomDatabase; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; public Factory(RedditDataRoomDatabase redditDataRoomDatabase) { mRedditDataRoomDatabase = redditDataRoomDatabase; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java index 938cd9d9..999d3d61 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java @@ -13,9 +13,9 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.utils.CustomThemeSharedPreferencesUtils; public class CustomThemeWrapper { - private SharedPreferences lightThemeSharedPreferences; - private SharedPreferences darkThemeSharedPreferences; - private SharedPreferences amoledThemeSharedPreferences; + private final SharedPreferences lightThemeSharedPreferences; + private final SharedPreferences darkThemeSharedPreferences; + private final SharedPreferences amoledThemeSharedPreferences; private int themeType; public CustomThemeWrapper(SharedPreferences lightThemeSharedPreferences, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/ColorPickerDialog.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/ColorPickerDialog.java index 6c6428fe..167f9c91 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/ColorPickerDialog.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/ColorPickerDialog.java @@ -15,14 +15,14 @@ import androidx.appcompat.app.AlertDialog; import ml.docilealligator.infinityforreddit.R; public class ColorPickerDialog extends AlertDialog { - private View colorView; - private EditText colorValueEditText; - private SeekBar seekBarA; - private SeekBar seekBarR; - private SeekBar seekBarG; - private SeekBar seekBarB; - private Button cancelButton; - private Button okButton; + private final View colorView; + private final EditText colorValueEditText; + private final SeekBar seekBarA; + private final SeekBar seekBarR; + private final SeekBar seekBarG; + private final SeekBar seekBarB; + private final Button cancelButton; + private final Button okButton; private int colorValue; private boolean changeColorValueEditText = true; private ColorPickerListener colorPickerListener; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/slidr/model/SlidrConfig.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/slidr/model/SlidrConfig.java index 39c5bdcc..80946a49 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/slidr/model/SlidrConfig.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/slidr/model/SlidrConfig.java @@ -238,7 +238,7 @@ public class SlidrConfig { */ public static class Builder{ - private SlidrConfig config; + private final SlidrConfig config; public Builder(){ config = new SlidrConfig(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/slidr/util/ViewDragHelper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/slidr/util/ViewDragHelper.java index 2f4c9206..eff5e5ed 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/slidr/util/ViewDragHelper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/slidr/util/ViewDragHelper.java @@ -12,6 +12,7 @@ import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.animation.Interpolator; +import androidx.annotation.Nullable; import androidx.core.view.MotionEventCompat; import androidx.core.view.VelocityTrackerCompat; import androidx.core.view.ViewCompat; @@ -94,11 +95,11 @@ public class ViewDragHelper { private int[] mEdgeDragsLocked; private int mPointersDown; private VelocityTracker mVelocityTracker; - private float mMaxVelocity; + private final float mMaxVelocity; private float mMinVelocity; - private int mEdgeSize; + private final int mEdgeSize; private int mTrackingEdges; - private ScrollerCompat mScroller; + private final ScrollerCompat mScroller; private final Callback mCallback; private View mCapturedView; private boolean mReleaseInProgress; @@ -951,7 +952,7 @@ public class ViewDragHelper { final float dx = x - mInitialMotionX[pointerId]; final float dy = y - mInitialMotionY[pointerId]; final View toCapture = findTopChildUnder((int) x, (int) y); - final boolean pastSlop = toCapture != null && checkTouchSlop(toCapture, dx, dy); + final boolean pastSlop = checkTouchSlop(toCapture, dx, dy); if (pastSlop) { // check the callback's // getView[Horizontal|Vertical]DragRange methods to know @@ -1371,6 +1372,7 @@ public class ViewDragHelper { * @param y Y position to test in the parent's coordinate system * @return The topmost child view under (x, y) or null if none found. */ + @Nullable public View findTopChildUnder(int x, int y) { final int childCount = mParentView.getChildCount(); for (int i = childCount - 1; i >= 0; i--) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/font/ContentFontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/font/ContentFontFamily.java index 315d849a..a9fd192d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/font/ContentFontFamily.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/font/ContentFontFamily.java @@ -21,8 +21,8 @@ public enum ContentFontFamily { AtkinsonHyperlegibleBold(R.style.ContentFontFamily_AtkinsonHyperlegibleBold, "AtkinsonHyperlegibleBold"), Custom(R.style.ContentFontFamily, "Custom"); - private int resId; - private String title; + private final int resId; + private final String title; ContentFontFamily(int resId, String title) { this.resId = resId; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/font/ContentFontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/font/ContentFontStyle.java index f38410e8..44b5be8c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/font/ContentFontStyle.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/font/ContentFontStyle.java @@ -10,8 +10,8 @@ public enum ContentFontStyle { XLarge(R.style.ContentFontStyle_XLarge, "XLarge"), XXLarge(R.style.ContentFontStyle_XXLarge, "XXLarge"); - private int resId; - private String title; + private final int resId; + private final String title; ContentFontStyle(int resId, String title) { this.resId = resId; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/font/FontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/font/FontFamily.java index f8957146..d90ec9de 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/font/FontFamily.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/font/FontFamily.java @@ -21,8 +21,8 @@ public enum FontFamily { AtkinsonHyperlegibleBold(R.style.FontFamily_AtkinsonHyperlegibleBold, "AtkinsonHyperlegibleBold"), Custom(R.style.FontFamily, "Custom"); - private int resId; - private String title; + private final int resId; + private final String title; FontFamily(int resId, String title) { this.resId = resId; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/font/FontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/font/FontStyle.java index 240447cb..1a7a0a0c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/font/FontStyle.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/font/FontStyle.java @@ -9,8 +9,8 @@ public enum FontStyle { Large(R.style.FontStyle_Large, "Large"), XLarge(R.style.FontStyle_XLarge, "XLarge"); - private int resId; - private String title; + private final int resId; + private final String title; FontStyle(int resId, String title) { this.resId = resId; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/font/TitleFontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/font/TitleFontFamily.java index 0c82227e..5ed491c6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/font/TitleFontFamily.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/font/TitleFontFamily.java @@ -21,8 +21,8 @@ public enum TitleFontFamily { AtkinsonHyperlegibleBold(R.style.TitleFontFamily_AtkinsonHyperlegibleBold, "AtkinsonHyperlegibleBold"), Custom(R.style.TitleFontFamily, "Custom"); - private int resId; - private String title; + private final int resId; + private final String title; TitleFontFamily(int resId, String title) { this.resId = resId; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/font/TitleFontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/font/TitleFontStyle.java index 867036cf..846ad9eb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/font/TitleFontStyle.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/font/TitleFontStyle.java @@ -9,8 +9,8 @@ public enum TitleFontStyle { Large(R.style.TitleFontStyle_Large, "Large"), XLarge(R.style.TitleFontStyle_XLarge, "XLarge"); - private int resId; - private String title; + private final int resId; + private final String title; TitleFontStyle(int resId, String title) { this.resId = resId; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java index 492e2efa..dce65040 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java @@ -231,7 +231,7 @@ public class HistoryPostFragment extends Fragment implements FragmentCommunicato private ItemTouchHelper touchHelper; private ArrayList<String> readPosts; private Unbinder unbinder; - private Map<String, String> subredditOrUserIcons = new HashMap<>(); + private final Map<String, String> subredditOrUserIcons = new HashMap<>(); private String accessToken; private int historyType; @@ -1394,8 +1394,8 @@ public class HistoryPostFragment extends Fragment implements FragmentCommunicato private static class StaggeredGridLayoutManagerItemOffsetDecoration extends RecyclerView.ItemDecoration { - private int mItemOffset; - private int mNColumns; + private final int mItemOffset; + private final int mNColumns; StaggeredGridLayoutManagerItemOffsetDecoration(int itemOffset, int nColumns) { mItemOffset = itemOffset; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java index 78edbbe1..22ca005f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java @@ -266,7 +266,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { private ItemTouchHelper touchHelper; private ArrayList<String> readPosts; private Unbinder unbinder; - private Map<String, String> subredditOrUserIcons = new HashMap<>(); + private final Map<String, String> subredditOrUserIcons = new HashMap<>(); private String accessToken; public PostFragment() { @@ -2246,8 +2246,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator { private static class StaggeredGridLayoutManagerItemOffsetDecoration extends RecyclerView.ItemDecoration { - private int mItemOffset; - private int mNColumns; + private final int mItemOffset; + private final int mNColumns; StaggeredGridLayoutManagerItemOffsetDecoration(int itemOffset, int nColumns) { mItemOffset = itemOffset; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java index 5f58a717..4f03500d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java @@ -885,7 +885,6 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic return; } } - } else { for (int i = currentSearchIndex - 1; i >= 0; i--) { if (visibleComments.get(i).getCommentRawText() != null && @@ -902,9 +901,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic return; } } - } - return; } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/CustomMarkwonAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/CustomMarkwonAdapter.java index c3c84ee3..1f2ce94c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/CustomMarkwonAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/CustomMarkwonAdapter.java @@ -204,7 +204,7 @@ public class CustomMarkwonAdapter extends MarkwonAdapter { public List<Node> getItems() { return nodes != null ? Collections.unmodifiableList(nodes) - : Collections.<Node>emptyList(); + : Collections.emptyList(); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmotePlugin.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmotePlugin.java index be4e1883..b0bc199c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmotePlugin.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EmotePlugin.java @@ -43,8 +43,8 @@ import ml.docilealligator.infinityforreddit.utils.Utils; public class EmotePlugin extends AbstractMarkwonPlugin { private final GlideAsyncDrawableLoader glideAsyncDrawableLoader; private boolean dataSavingMode; - private boolean disableImagePreview; - private OnEmoteClickListener onEmoteClickListener; + private final boolean disableImagePreview; + private final OnEmoteClickListener onEmoteClickListener; public interface GlideStore { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EvenBetterLinkMovementMethod.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EvenBetterLinkMovementMethod.java index d3c4909d..09382ece 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EvenBetterLinkMovementMethod.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/EvenBetterLinkMovementMethod.java @@ -418,8 +418,8 @@ public class EvenBetterLinkMovementMethod extends LinkMovementMethod { * A wrapper to support all {@link ClickableSpan}s that may or may not provide URLs. */ protected static class ClickableSpanWithText { - private ClickableSpan span; - private String text; + private final ClickableSpan span; + private final String text; protected static ClickableSpanWithText ofSpan(TextView textView, ClickableSpan span) { Spanned s = (Spanned) textView.getText(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java index 4cdd3fd6..ec982d30 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifBlockParser.java @@ -18,7 +18,7 @@ import ml.docilealligator.infinityforreddit.MediaMetadata; public class ImageAndGifBlockParser extends AbstractBlockParser { - private ImageAndGifBlock imageAndGifBlock; + private final ImageAndGifBlock imageAndGifBlock; ImageAndGifBlockParser(MediaMetadata mediaMetadata) { this.imageAndGifBlock = new ImageAndGifBlock(mediaMetadata); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java index 68611cb0..c3622e96 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifEntry.java @@ -42,17 +42,17 @@ import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; public class ImageAndGifEntry extends MarkwonAdapter.Entry<ImageAndGifBlock, ImageAndGifEntry.Holder> { - private BaseActivity baseActivity; - private RequestManager glide; - private SaveMemoryCenterInisdeDownsampleStrategy saveMemoryCenterInsideDownsampleStrategy; - private OnItemClickListener onItemClickListener; + private final BaseActivity baseActivity; + private final RequestManager glide; + private final SaveMemoryCenterInisdeDownsampleStrategy saveMemoryCenterInsideDownsampleStrategy; + private final OnItemClickListener onItemClickListener; private boolean dataSavingMode; - private boolean disableImagePreview; + private final boolean disableImagePreview; private boolean blurImage; - private int colorAccent; - private int primaryTextColor; - private int postContentColor; - private int linkColor; + private final int colorAccent; + private final int primaryTextColor; + private final int postContentColor; + private final int linkColor; public ImageAndGifEntry(BaseActivity baseActivity, RequestManager glide, OnItemClickListener onItemClickListener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifPlugin.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifPlugin.java index 754ffc14..d1db5a3d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifPlugin.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/ImageAndGifPlugin.java @@ -11,7 +11,7 @@ import ml.docilealligator.infinityforreddit.MediaMetadata; public class ImageAndGifPlugin extends AbstractMarkwonPlugin { - private ImageAndGifBlockParser.Factory factory; + private final ImageAndGifBlockParser.Factory factory; public ImageAndGifPlugin() { this.factory = new ImageAndGifBlockParser.Factory(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/message/Message.java b/app/src/main/java/ml/docilealligator/infinityforreddit/message/Message.java index a39624a8..4ef2563e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/message/Message.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/message/Message.java @@ -13,25 +13,25 @@ public class Message implements Parcelable { public static final String TYPE_SUBREDDIT = "t5"; static final String TYPE_AWARD = "t6"; - private String kind; - private String subredditName; - private String subredditNamePrefixed; - private String id; - private String fullname; - private String subject; - private String author; - private String destination; - private String parentFullName; - private String title; - private String body; - private String context; - private String distinguished; - private String formattedTime; - private boolean wasComment; + private final String kind; + private final String subredditName; + private final String subredditNamePrefixed; + private final String id; + private final String fullname; + private final String subject; + private final String author; + private final String destination; + private final String parentFullName; + private final String title; + private final String body; + private final String context; + private final String distinguished; + private final String formattedTime; + private final boolean wasComment; private boolean isNew; - private int score; - private int nComments; - private long timeUTC; + private final int score; + private final int nComments; + private final long timeUTC; private ArrayList<Message> replies; Message(String kind, String subredditName, String subredditNamePrefixed, String id, String fullname, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageDataSource.java index 37a55509..44620fd2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageDataSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageDataSource.java @@ -12,15 +12,15 @@ import ml.docilealligator.infinityforreddit.NetworkState; import retrofit2.Retrofit; class MessageDataSource extends PageKeyedDataSource<String, Message> { - private Retrofit oauthRetrofit; - private Locale locale; - private String accessToken; - private String where; - private int messageType; - - private MutableLiveData<NetworkState> paginationNetworkStateLiveData; - private MutableLiveData<NetworkState> initialLoadStateLiveData; - private MutableLiveData<Boolean> hasPostLiveData; + private final Retrofit oauthRetrofit; + private final Locale locale; + private final String accessToken; + private final String where; + private final int messageType; + + private final MutableLiveData<NetworkState> paginationNetworkStateLiveData; + private final MutableLiveData<NetworkState> initialLoadStateLiveData; + private final MutableLiveData<Boolean> hasPostLiveData; private LoadParams<String> params; private LoadCallback<String, Message> callback; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageDataSourceFactory.java index f7baf668..319c0be7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageDataSourceFactory.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageDataSourceFactory.java @@ -9,13 +9,13 @@ import java.util.Locale; import retrofit2.Retrofit; class MessageDataSourceFactory extends DataSource.Factory { - private Retrofit oauthRetrofit; - private Locale locale; - private String accessToken; + private final Retrofit oauthRetrofit; + private final Locale locale; + private final String accessToken; private String where; private MessageDataSource messageDataSource; - private MutableLiveData<MessageDataSource> messageDataSourceLiveData; + private final MutableLiveData<MessageDataSource> messageDataSourceLiveData; MessageDataSourceFactory(Retrofit oauthRetrofit, Locale locale, String accessToken, String where) { this.oauthRetrofit = oauthRetrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageViewModel.java index dfcc91cd..dbd497bf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/message/MessageViewModel.java @@ -15,12 +15,12 @@ import ml.docilealligator.infinityforreddit.NetworkState; import retrofit2.Retrofit; public class MessageViewModel extends ViewModel { - private MessageDataSourceFactory messageDataSourceFactory; - private LiveData<NetworkState> paginationNetworkState; - private LiveData<NetworkState> initialLoadingState; - private LiveData<Boolean> hasMessageLiveData; - private LiveData<PagedList<Message>> messages; - private MutableLiveData<String> whereLiveData; + private final MessageDataSourceFactory messageDataSourceFactory; + private final LiveData<NetworkState> paginationNetworkState; + private final LiveData<NetworkState> initialLoadingState; + private final LiveData<Boolean> hasMessageLiveData; + private final LiveData<PagedList<Message>> messages; + private final MutableLiveData<String> whereLiveData; public MessageViewModel(Retrofit retrofit, Locale locale, String accessToken, String where) { messageDataSourceFactory = new MessageDataSourceFactory(retrofit, locale, accessToken, where); @@ -75,10 +75,10 @@ public class MessageViewModel extends ViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private Retrofit retrofit; - private Locale locale; - private String accessToken; - private String where; + private final Retrofit retrofit; + private final Locale locale; + private final String accessToken; + private final String where; public Factory(Retrofit retrofit, Locale locale, String accessToken, String where) { this.retrofit = retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/message/ParseMessage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/message/ParseMessage.java index 5ffe40a8..892eeaca 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/message/ParseMessage.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/message/ParseMessage.java @@ -96,12 +96,12 @@ public class ParseMessage { private static class ParseMessageAsnycTask extends AsyncTask<Void, Void, Void> { - private String response; - private Locale locale; + private final String response; + private final Locale locale; private ArrayList<Message> messages; private String after; - private int messageType; - private ParseMessageAsyncTaskListener parseMessageAsyncTaskListener; + private final int messageType; + private final ParseMessageAsyncTaskListener parseMessageAsyncTaskListener; ParseMessageAsnycTask(String response, Locale locale, int messageType, ParseMessageAsyncTaskListener parseMessageAsnycTaskListener) { this.response = response; @@ -132,12 +132,12 @@ public class ParseMessage { private static class ParseSentMessageAsnycTask extends AsyncTask<Void, Void, Void> { - private String response; - private Locale locale; + private final String response; + private final Locale locale; private Message message; private String errorMessage; private boolean parseFailed = false; - private ParseSentMessageAsyncTaskListener parseSentMessageAsyncTaskListener; + private final ParseSentMessageAsyncTaskListener parseSentMessageAsyncTaskListener; ParseSentMessageAsnycTask(String response, Locale locale, ParseSentMessageAsyncTaskListener parseSentMessageAsyncTaskListener) { this.response = response; @@ -171,8 +171,8 @@ public class ParseMessage { } private static class ParseComposedMessageErrorAsncTask extends AsyncTask<Void, Void, Void> { - private String response; - private ParseComposedMessageErrorListener parseComposedMessageErrorListener; + private final String response; + private final ParseComposedMessageErrorListener parseComposedMessageErrorListener; private String errorMessage; ParseComposedMessageErrorAsncTask(String response, ParseComposedMessageErrorListener parseComposedMessageErrorListener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/FetchMultiRedditInfo.java b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/FetchMultiRedditInfo.java index b13225a5..26375b00 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/FetchMultiRedditInfo.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/FetchMultiRedditInfo.java @@ -67,8 +67,8 @@ public class FetchMultiRedditInfo { private static class ParseMultiRedditInfoAsyncTask extends AsyncTask<Void, Void, Void> { - private String response; - private FetchMultiRedditInfoListener fetchMultiRedditInfoListener; + private final String response; + private final FetchMultiRedditInfoListener fetchMultiRedditInfoListener; private MultiReddit multiReddit; private boolean parseFailed = false; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditRepository.java b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditRepository.java index 45b000f9..05710908 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditRepository.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditRepository.java @@ -7,8 +7,8 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class MultiRedditRepository { - private MultiRedditDao mMultiRedditDao; - private String mAccountName; + private final MultiRedditDao mMultiRedditDao; + private final String mAccountName; MultiRedditRepository(RedditDataRoomDatabase redditDataRoomDatabase, String accountName) { mMultiRedditDao = redditDataRoomDatabase.multiRedditDao(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditViewModel.java index 2ba3ec44..c1bc193a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiRedditViewModel.java @@ -15,10 +15,10 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class MultiRedditViewModel extends AndroidViewModel { - private MultiRedditRepository mMultiRedditRepository; - private LiveData<List<MultiReddit>> mAllMultiReddits; - private LiveData<List<MultiReddit>> mAllFavoriteMultiReddits; - private MutableLiveData<String> searchQueryLiveData; + private final MultiRedditRepository mMultiRedditRepository; + private final LiveData<List<MultiReddit>> mAllMultiReddits; + private final LiveData<List<MultiReddit>> mAllFavoriteMultiReddits; + private final MutableLiveData<String> searchQueryLiveData; public MultiRedditViewModel(Application application, RedditDataRoomDatabase redditDataRoomDatabase, String accountName) { super(application); @@ -42,9 +42,9 @@ public class MultiRedditViewModel extends AndroidViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private Application mApplication; - private RedditDataRoomDatabase mRedditDataRoomDatabase; - private String mAccountName; + private final Application mApplication; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + private final String mAccountName; public Factory(Application application, RedditDataRoomDatabase redditDataRoomDatabase, String accountName) { mApplication = application; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/ParseMultiReddit.java b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/ParseMultiReddit.java index d3d23445..a737fd10 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/ParseMultiReddit.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/ParseMultiReddit.java @@ -61,7 +61,7 @@ public class ParseMultiReddit { private JSONArray arrayResponse; private boolean parseFailed; private ArrayList<MultiReddit> multiReddits; - private ParseMultiRedditsListListener parseMultiRedditsListListener; + private final ParseMultiRedditsListListener parseMultiRedditsListListener; ParseMultiRedditsListAsyncTask(String response, ParseMultiRedditsListListener parseMultiRedditsListListener) { @@ -102,10 +102,10 @@ public class ParseMultiReddit { } private static class ParseAndSaveMultiRedditAsyncTask extends AsyncTask<Void, Void, Void> { - private String response; - private RedditDataRoomDatabase redditDataRoomDatabase; + private final String response; + private final RedditDataRoomDatabase redditDataRoomDatabase; private MultiReddit multiReddit; - private ParseMultiRedditListener parseMultiRedditListener; + private final ParseMultiRedditListener parseMultiRedditListener; ParseAndSaveMultiRedditAsyncTask(String response, RedditDataRoomDatabase redditDataRoomDatabase, ParseMultiRedditListener parseMultiRedditListener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/FetchRemovedPost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/FetchRemovedPost.java index 07ded976..719e412d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/FetchRemovedPost.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/FetchRemovedPost.java @@ -125,8 +125,8 @@ public class FetchRemovedPost { private static class ParsePostAsyncTask extends AsyncTask<Void, Void, Void> { - private String responseBody; - private FetchRemovedPostListener listener; + private final String responseBody; + private final FetchRemovedPostListener listener; Post post; public ParsePostAsyncTask(String responseBody, Post post, FetchRemovedPostListener listener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostPagingSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostPagingSource.java index e76d8eb0..37f461e0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostPagingSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostPagingSource.java @@ -29,15 +29,15 @@ import retrofit2.Retrofit; public class HistoryPostPagingSource extends ListenableFuturePagingSource<String, Post> { public static final int TYPE_READ_POSTS = 100; - private Retrofit retrofit; - private Executor executor; - private RedditDataRoomDatabase redditDataRoomDatabase; - private String accessToken; - private String accountName; - private SharedPreferences sharedPreferences; - private String username; - private int postType; - private PostFilter postFilter; + private final Retrofit retrofit; + private final Executor executor; + private final RedditDataRoomDatabase redditDataRoomDatabase; + private final String accessToken; + private final String accountName; + private final SharedPreferences sharedPreferences; + private final String username; + private final int postType; + private final PostFilter postFilter; public HistoryPostPagingSource(Retrofit retrofit, Executor executor, RedditDataRoomDatabase redditDataRoomDatabase, @Nullable String accessToken, @NonNull String accountName, SharedPreferences sharedPreferences, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostViewModel.java index 58e8ba24..f3116b45 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostViewModel.java @@ -22,18 +22,18 @@ import ml.docilealligator.infinityforreddit.postfilter.PostFilter; import retrofit2.Retrofit; public class HistoryPostViewModel extends ViewModel { - private Executor executor; - private Retrofit retrofit; - private RedditDataRoomDatabase redditDataRoomDatabase; - private String accessToken; - private String accountName; - private SharedPreferences sharedPreferences; - private int postType; - private PostFilter postFilter; + private final Executor executor; + private final Retrofit retrofit; + private final RedditDataRoomDatabase redditDataRoomDatabase; + private final String accessToken; + private final String accountName; + private final SharedPreferences sharedPreferences; + private final int postType; + private final PostFilter postFilter; - private LiveData<PagingData<Post>> posts; + private final LiveData<PagingData<Post>> posts; - private MutableLiveData<PostFilter> postFilterLiveData; + private final MutableLiveData<PostFilter> postFilterLiveData; public HistoryPostViewModel(Executor executor, Retrofit retrofit, RedditDataRoomDatabase redditDataRoomDatabase, @Nullable String accessToken, @NonNull String accountName, SharedPreferences sharedPreferences, @@ -78,14 +78,14 @@ public class HistoryPostViewModel extends ViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private Executor executor; - private Retrofit retrofit; - private RedditDataRoomDatabase redditDataRoomDatabase; - private String accessToken; - private String accountName; - private SharedPreferences sharedPreferences; - private int postType; - private PostFilter postFilter; + private final Executor executor; + private final Retrofit retrofit; + private final RedditDataRoomDatabase redditDataRoomDatabase; + private final String accessToken; + private final String accountName; + private final SharedPreferences sharedPreferences; + private final int postType; + private final PostFilter postFilter; public Factory(Executor executor, Retrofit retrofit, RedditDataRoomDatabase redditDataRoomDatabase, @Nullable String accessToken, @NonNull String accountName, SharedPreferences sharedPreferences, int postType, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java index bdf1ef27..5985de46 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java @@ -26,16 +26,16 @@ public class Post implements Parcelable { public static final int NO_PREVIEW_LINK_TYPE = 5; public static final int GALLERY_TYPE = 6; - private String id; - private String fullName; - private String subredditName; - private String subredditNamePrefixed; + private final String id; + private final String fullName; + private final String subredditName; + private final String subredditNamePrefixed; private String subredditIconUrl; private String author; private String authorNamePrefixed; private String authorIconUrl; - private String authorFlair; - private String authorFlairHTML; + private final String authorFlair; + private final String authorFlairHTML; private String title; private String selfText; private String selfTextPlain; @@ -50,9 +50,9 @@ public class Post implements Parcelable { private boolean isRedgifs; private boolean isStreamable; private boolean loadGfyOrStreamableVideoSuccess; - private String permalink; + private final String permalink; private String flair; - private long postTimeMillis; + private final long postTimeMillis; private int score; private int postType; private int voteType; @@ -61,15 +61,15 @@ public class Post implements Parcelable { private boolean hidden; private boolean spoiler; private boolean nsfw; - private boolean stickied; - private boolean archived; - private boolean locked; + private final boolean stickied; + private final boolean archived; + private final boolean locked; private boolean saved; - private boolean isCrosspost; + private final boolean isCrosspost; private boolean isRead; private String crosspostParentId; - private String distinguished; - private String suggestedSort; + private final String distinguished; + private final String suggestedSort; private ArrayList<Preview> previews = new ArrayList<>(); @Nullable private Map<String, MediaMetadata> mediaMetadataMap; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java index 3b32864a..70752e67 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java @@ -41,22 +41,22 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post> public static final String USER_WHERE_HIDDEN = "hidden"; public static final String USER_WHERE_SAVED = "saved"; - private Executor executor; - private Retrofit retrofit; - private String accessToken; - private String accountName; - private SharedPreferences sharedPreferences; - private SharedPreferences postFeedScrolledPositionSharedPreferences; + private final Executor executor; + private final Retrofit retrofit; + private final String accessToken; + private final String accountName; + private final SharedPreferences sharedPreferences; + private final SharedPreferences postFeedScrolledPositionSharedPreferences; private String subredditOrUserName; private String query; private String trendingSource; - private int postType; - private SortType sortType; - private PostFilter postFilter; - private List<String> readPostList; + private final int postType; + private final SortType sortType; + private final PostFilter postFilter; + private final List<String> readPostList; private String userWhere; private String multiRedditPath; - private LinkedHashSet<Post> postLinkedHashSet; + private final LinkedHashSet<Post> postLinkedHashSet; private String previousLastItem; PostPagingSource(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java index 17fda376..dfdaaa62 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java @@ -28,28 +28,28 @@ import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class PostViewModel extends ViewModel { - private Executor executor; - private Retrofit retrofit; - private String accessToken; - private String accountName; - private SharedPreferences sharedPreferences; - private SharedPreferences postFeedScrolledPositionSharedPreferences; + private final Executor executor; + private final Retrofit retrofit; + private final String accessToken; + private final String accountName; + private final SharedPreferences sharedPreferences; + private final SharedPreferences postFeedScrolledPositionSharedPreferences; private String name; private String query; private String trendingSource; - private int postType; + private final int postType; private SortType sortType; private PostFilter postFilter; private String userWhere; - private List<String> readPostList; - private MutableLiveData<Boolean> currentlyReadPostIdsLiveData = new MutableLiveData<>(); + private final List<String> readPostList; + private final MutableLiveData<Boolean> currentlyReadPostIdsLiveData = new MutableLiveData<>(); - private LiveData<PagingData<Post>> posts; - private LiveData<PagingData<Post>> postsWithReadPostsHidden; + private final LiveData<PagingData<Post>> posts; + private final LiveData<PagingData<Post>> postsWithReadPostsHidden; - private MutableLiveData<SortType> sortTypeLiveData; - private MutableLiveData<PostFilter> postFilterLiveData; - private SortTypeAndPostFilterLiveData sortTypeAndPostFilterLiveData; + private final MutableLiveData<SortType> sortTypeLiveData; + private final MutableLiveData<PostFilter> postFilterLiveData; + private final SortTypeAndPostFilterLiveData sortTypeAndPostFilterLiveData; public PostViewModel(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName, SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, @@ -268,19 +268,19 @@ public class PostViewModel extends ViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private Executor executor; - private Retrofit retrofit; - private String accessToken; + private final Executor executor; + private final Retrofit retrofit; + private final String accessToken; private String accountName; - private SharedPreferences sharedPreferences; + private final SharedPreferences sharedPreferences; private SharedPreferences postFeedScrolledPositionSharedPreferences; private SharedPreferences postHistorySharedPreferences; private String name; private String query; private String trendingSource; - private int postType; - private SortType sortType; - private PostFilter postFilter; + private final int postType; + private final SortType sortType; + private final PostFilter postFilter; private String userWhere; private List<String> readPostList; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterDao.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterDao.java index f482071a..89876865 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterDao.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterDao.java @@ -43,5 +43,5 @@ public interface PostFilterDao { @Transaction @Query("SELECT * FROM post_filter ORDER BY name") - public LiveData<List<PostFilterWithUsage>> getAllPostFilterWithUsageLiveData(); + LiveData<List<PostFilterWithUsage>> getAllPostFilterWithUsageLiveData(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java index f63ed46a..bc056d36 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java @@ -9,7 +9,7 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class PostFilterUsageViewModel extends ViewModel { - private LiveData<List<PostFilterUsage>> mPostFilterUsageListLiveData; + private final LiveData<List<PostFilterUsage>> mPostFilterUsageListLiveData; public PostFilterUsageViewModel(RedditDataRoomDatabase redditDataRoomDatabase, String name) { mPostFilterUsageListLiveData = redditDataRoomDatabase.postFilterUsageDao().getAllPostFilterUsageLiveData(name); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterWithUsageViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterWithUsageViewModel.java index 792eda40..60432f6f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterWithUsageViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterWithUsageViewModel.java @@ -9,7 +9,7 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class PostFilterWithUsageViewModel extends ViewModel { - private LiveData<List<PostFilterWithUsage>> mPostFilterWithUsageListLiveData; + private final LiveData<List<PostFilterWithUsage>> mPostFilterWithUsageListLiveData; public PostFilterWithUsageViewModel(RedditDataRoomDatabase redditDataRoomDatabase) { mPostFilterWithUsageListLiveData = redditDataRoomDatabase.postFilterDao().getAllPostFilterWithUsageLiveData(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQueryRepository.java b/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQueryRepository.java index 5c4e06d8..7daf64cd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQueryRepository.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQueryRepository.java @@ -7,7 +7,7 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class RecentSearchQueryRepository { - private LiveData<List<RecentSearchQuery>> mAllRecentSearchQueries; + private final LiveData<List<RecentSearchQuery>> mAllRecentSearchQueries; RecentSearchQueryRepository(RedditDataRoomDatabase redditDataRoomDatabase, String username) { mAllRecentSearchQueries = redditDataRoomDatabase.recentSearchQueryDao().getAllRecentSearchQueriesLiveData(username); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQueryViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQueryViewModel.java index aba1b343..b28fe6f2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQueryViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQueryViewModel.java @@ -10,7 +10,7 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class RecentSearchQueryViewModel extends ViewModel { - private LiveData<List<RecentSearchQuery>> mAllRecentSearchQueries; + private final LiveData<List<RecentSearchQuery>> mAllRecentSearchQueries; public RecentSearchQueryViewModel(RedditDataRoomDatabase redditDataRoomDatabase, String username) { mAllRecentSearchQueries = new RecentSearchQueryRepository(redditDataRoomDatabase, username).getAllRecentSearchQueries(); @@ -21,8 +21,8 @@ public class RecentSearchQueryViewModel extends ViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private RedditDataRoomDatabase mRedditDataRoomDatabase; - private String mUsername; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + private final String mUsername; public Factory(RedditDataRoomDatabase redditDataRoomDatabase, String username) { mRedditDataRoomDatabase = redditDataRoomDatabase; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/Acknowledgement.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/Acknowledgement.java index d11f368f..9a8a1f5a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/Acknowledgement.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/Acknowledgement.java @@ -3,9 +3,9 @@ package ml.docilealligator.infinityforreddit.settings; import android.net.Uri; public class Acknowledgement { - private String name; - private String introduction; - private Uri link; + private final String name; + private final String introduction; + private final Uri link; Acknowledgement(String name, String introduction, Uri link) { this.name = name; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/ParseSubredditData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/ParseSubredditData.java index 694d5900..1739557f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/ParseSubredditData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/ParseSubredditData.java @@ -79,7 +79,7 @@ public class ParseSubredditData { private static class ParseSubredditDataAsyncTask extends AsyncTask<Void, Void, Void> { private JSONObject jsonResponse; private boolean parseFailed; - private ParseSubredditDataListener parseSubredditDataListener; + private final ParseSubredditDataListener parseSubredditDataListener; private SubredditData subredditData; private int mNCurrentOnlineSubscribers; @@ -121,7 +121,7 @@ public class ParseSubredditData { private JSONObject jsonResponse; private boolean nsfw; private boolean parseFailed; - private ParseSubredditListingDataListener parseSubredditListingDataListener; + private final ParseSubredditListingDataListener parseSubredditListingDataListener; private ArrayList<SubredditData> subredditListingData; private String after; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditData.java index 9bdada34..6e9a40d3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditData.java @@ -11,25 +11,25 @@ public class SubredditData { @PrimaryKey @NonNull @ColumnInfo(name = "id") - private String id; + private final String id; @ColumnInfo(name = "name") - private String name; + private final String name; @ColumnInfo(name = "icon") - private String iconUrl; + private final String iconUrl; @ColumnInfo(name = "banner") - private String bannerUrl; + private final String bannerUrl; @ColumnInfo(name = "description") - private String description; + private final String description; @ColumnInfo(name = "sidebar_description") - private String sidebarDescription; + private final String sidebarDescription; @ColumnInfo(name = "subscribers_count") - private int nSubscribers; + private final int nSubscribers; @ColumnInfo(name = "created_utc") - private long createdUTC; + private final long createdUTC; @ColumnInfo(name = "suggested_comment_sort") - private String suggestedCommentSort; + private final String suggestedCommentSort; @ColumnInfo(name = "over18") - private boolean isNSFW; + private final boolean isNSFW; @Ignore private boolean isSelected; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSource.java index b41a397b..7ffa9a5c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSource.java @@ -12,15 +12,15 @@ import retrofit2.Retrofit; public class SubredditListingDataSource extends PageKeyedDataSource<String, SubredditData> { - private Retrofit retrofit; - private String query; - private SortType sortType; - private String accessToken; - private boolean nsfw; - - private MutableLiveData<NetworkState> paginationNetworkStateLiveData; - private MutableLiveData<NetworkState> initialLoadStateLiveData; - private MutableLiveData<Boolean> hasSubredditLiveData; + private final Retrofit retrofit; + private final String query; + private final SortType sortType; + private final String accessToken; + private final boolean nsfw; + + private final MutableLiveData<NetworkState> paginationNetworkStateLiveData; + private final MutableLiveData<NetworkState> initialLoadStateLiveData; + private final MutableLiveData<Boolean> hasSubredditLiveData; private LoadParams<String> params; private LoadCallback<String, SubredditData> callback; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSourceFactory.java index 0252b2a0..130a7bdf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSourceFactory.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSourceFactory.java @@ -8,14 +8,14 @@ import ml.docilealligator.infinityforreddit.SortType; import retrofit2.Retrofit; public class SubredditListingDataSourceFactory extends DataSource.Factory { - private Retrofit retrofit; - private String query; + private final Retrofit retrofit; + private final String query; private SortType sortType; - private String accessToken; - private boolean nsfw; + private final String accessToken; + private final boolean nsfw; private SubredditListingDataSource subredditListingDataSource; - private MutableLiveData<SubredditListingDataSource> subredditListingDataSourceMutableLiveData; + private final MutableLiveData<SubredditListingDataSource> subredditListingDataSourceMutableLiveData; SubredditListingDataSourceFactory(Retrofit retrofit, String query, SortType sortType, String accessToken, boolean nsfw) { this.retrofit = retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingViewModel.java index 2cf72a52..137036db 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingViewModel.java @@ -14,12 +14,12 @@ import ml.docilealligator.infinityforreddit.SortType; import retrofit2.Retrofit; public class SubredditListingViewModel extends ViewModel { - private SubredditListingDataSourceFactory subredditListingDataSourceFactory; - private LiveData<NetworkState> paginationNetworkState; - private LiveData<NetworkState> initialLoadingState; - private LiveData<Boolean> hasSubredditLiveData; - private LiveData<PagedList<SubredditData>> subreddits; - private MutableLiveData<SortType> sortTypeLiveData; + private final SubredditListingDataSourceFactory subredditListingDataSourceFactory; + private final LiveData<NetworkState> paginationNetworkState; + private final LiveData<NetworkState> initialLoadingState; + private final LiveData<Boolean> hasSubredditLiveData; + private final LiveData<PagedList<SubredditData>> subreddits; + private final MutableLiveData<SortType> sortTypeLiveData; public SubredditListingViewModel(Retrofit retrofit, String query, SortType sortType, String accessToken, boolean nsfw) { subredditListingDataSourceFactory = new SubredditListingDataSourceFactory(retrofit, query, sortType, accessToken, nsfw); @@ -74,11 +74,11 @@ public class SubredditListingViewModel extends ViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private Retrofit retrofit; - private String query; - private SortType sortType; - private String accessToken; - private boolean nsfw; + private final Retrofit retrofit; + private final String query; + private final SortType sortType; + private final String accessToken; + private final boolean nsfw; public Factory(Retrofit retrofit, String query, SortType sortType, String accessToken, boolean nsfw) { this.retrofit = retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditRepository.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditRepository.java index 649b4ee0..7c30cf02 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditRepository.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditRepository.java @@ -7,8 +7,8 @@ import androidx.lifecycle.LiveData; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class SubredditRepository { - private SubredditDao mSubredditDao; - private LiveData<SubredditData> mSubredditLiveData; + private final SubredditDao mSubredditDao; + private final LiveData<SubredditData> mSubredditLiveData; SubredditRepository(RedditDataRoomDatabase redditDataRoomDatabase, String subredditName) { mSubredditDao = redditDataRoomDatabase.subredditDao(); @@ -25,7 +25,7 @@ public class SubredditRepository { private static class InsertAsyncTask extends AsyncTask<SubredditData, Void, Void> { - private SubredditDao mAsyncTaskDao; + private final SubredditDao mAsyncTaskDao; InsertAsyncTask(SubredditDao dao) { mAsyncTaskDao = dao; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditViewModel.java index debbbf36..56048138 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditViewModel.java @@ -11,8 +11,8 @@ import androidx.lifecycle.ViewModelProvider; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class SubredditViewModel extends AndroidViewModel { - private SubredditRepository mSubredditRepository; - private LiveData<SubredditData> mSubredditLiveData; + private final SubredditRepository mSubredditRepository; + private final LiveData<SubredditData> mSubredditLiveData; public SubredditViewModel(Application application, RedditDataRoomDatabase redditDataRoomDatabase, String id) { super(application); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditWithSelection.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditWithSelection.java index 8578d8c7..29ea1803 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditWithSelection.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditWithSelection.java @@ -11,8 +11,8 @@ import java.util.List; import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubredditData; public class SubredditWithSelection implements Parcelable { - private String name; - private String iconUrl; + private final String name; + private final String iconUrl; private boolean selected; public SubredditWithSelection(String name, String iconUrl) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditData.java index a5c42381..42a7d8c4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditData.java @@ -13,11 +13,11 @@ import ml.docilealligator.infinityforreddit.account.Account; public class SubscribedSubredditData { @NonNull @ColumnInfo(name = "id") - private String id; + private final String id; @ColumnInfo(name = "name") - private String name; + private final String name; @ColumnInfo(name = "icon") - private String iconUrl; + private final String iconUrl; @NonNull @ColumnInfo(name = "username") private String username; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditRepository.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditRepository.java index 2bb9e247..76ae5b36 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditRepository.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditRepository.java @@ -9,8 +9,8 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class SubscribedSubredditRepository { - private SubscribedSubredditDao mSubscribedSubredditDao; - private String mAccountName; + private final SubscribedSubredditDao mSubscribedSubredditDao; + private final String mAccountName; SubscribedSubredditRepository(RedditDataRoomDatabase redditDataRoomDatabase, String accountName) { mAccountName = accountName; @@ -31,7 +31,7 @@ public class SubscribedSubredditRepository { private static class insertAsyncTask extends AsyncTask<SubscribedSubredditData, Void, Void> { - private SubscribedSubredditDao mAsyncTaskDao; + private final SubscribedSubredditDao mAsyncTaskDao; insertAsyncTask(SubscribedSubredditDao dao) { mAsyncTaskDao = dao; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditViewModel.java index a4d1f817..5e3416ff 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribedsubreddit/SubscribedSubredditViewModel.java @@ -15,10 +15,10 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class SubscribedSubredditViewModel extends AndroidViewModel { - private SubscribedSubredditRepository mSubscribedSubredditRepository; - private LiveData<List<SubscribedSubredditData>> mAllSubscribedSubreddits; - private LiveData<List<SubscribedSubredditData>> mAllFavoriteSubscribedSubreddits; - private MutableLiveData<String> searchQueryLiveData; + private final SubscribedSubredditRepository mSubscribedSubredditRepository; + private final LiveData<List<SubscribedSubredditData>> mAllSubscribedSubreddits; + private final LiveData<List<SubscribedSubredditData>> mAllFavoriteSubscribedSubreddits; + private final MutableLiveData<String> searchQueryLiveData; public SubscribedSubredditViewModel(Application application, RedditDataRoomDatabase redditDataRoomDatabase, String accountName) { super(application); @@ -46,9 +46,9 @@ public class SubscribedSubredditViewModel extends AndroidViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private Application mApplication; - private RedditDataRoomDatabase mRedditDataRoomDatabase; - private String mAccountName; + private final Application mApplication; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + private final String mAccountName; public Factory(Application application, RedditDataRoomDatabase redditDataRoomDatabase, String accountName) { this.mApplication = application; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserData.java index 0f9c0059..83af676e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserData.java @@ -13,9 +13,9 @@ import ml.docilealligator.infinityforreddit.account.Account; public class SubscribedUserData { @NonNull @ColumnInfo(name = "name") - private String name; + private final String name; @ColumnInfo(name = "icon") - private String iconUrl; + private final String iconUrl; @NonNull @ColumnInfo(name = "username") private String username; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserRepository.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserRepository.java index befdcdb2..a86b14a9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserRepository.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserRepository.java @@ -9,8 +9,8 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class SubscribedUserRepository { - private SubscribedUserDao mSubscribedUserDao; - private String mAccountName; + private final SubscribedUserDao mSubscribedUserDao; + private final String mAccountName; SubscribedUserRepository(RedditDataRoomDatabase redditDataRoomDatabase, String accountName) { mSubscribedUserDao = redditDataRoomDatabase.subscribedUserDao(); @@ -31,7 +31,7 @@ public class SubscribedUserRepository { private static class insertAsyncTask extends AsyncTask<SubscribedUserData, Void, Void> { - private SubscribedUserDao mAsyncTaskDao; + private final SubscribedUserDao mAsyncTaskDao; insertAsyncTask(SubscribedUserDao dao) { mAsyncTaskDao = dao; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserViewModel.java index 332ccb11..09ff8752 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subscribeduser/SubscribedUserViewModel.java @@ -15,10 +15,10 @@ import java.util.List; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class SubscribedUserViewModel extends AndroidViewModel { - private SubscribedUserRepository mSubscribedUserRepository; - private LiveData<List<SubscribedUserData>> mAllSubscribedUsers; - private LiveData<List<SubscribedUserData>> mAllFavoriteSubscribedUsers; - private MutableLiveData<String> searchQueryLiveData; + private final SubscribedUserRepository mSubscribedUserRepository; + private final LiveData<List<SubscribedUserData>> mAllSubscribedUsers; + private final LiveData<List<SubscribedUserData>> mAllFavoriteSubscribedUsers; + private final MutableLiveData<String> searchQueryLiveData; public SubscribedUserViewModel(Application application, RedditDataRoomDatabase redditDataRoomDatabase, String accountName) { super(application); @@ -46,9 +46,9 @@ public class SubscribedUserViewModel extends AndroidViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private Application mApplication; - private RedditDataRoomDatabase mRedditDataRoomDatabase; - private String mAccountName; + private final Application mApplication; + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + private final String mAccountName; public Factory(Application application, RedditDataRoomDatabase redditDataRoomDatabase, String accountName) { mApplication = application; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/ParseUserData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/ParseUserData.java index c04b8957..818d3160 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/ParseUserData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/ParseUserData.java @@ -71,9 +71,9 @@ public class ParseUserData { } private static class ParseUserDataAsyncTask extends AsyncTask<Void, Void, Void> { - private RedditDataRoomDatabase redditDataRoomDatabase; + private final RedditDataRoomDatabase redditDataRoomDatabase; private JSONObject jsonResponse; - private ParseUserDataListener parseUserDataListener; + private final ParseUserDataListener parseUserDataListener; private boolean parseFailed = false; private UserData userData; @@ -120,9 +120,9 @@ public class ParseUserData { } private static class ParseUserListingDataAsyncTask extends AsyncTask<Void, Void, Void> { - private String response; + private final String response; private JSONObject jsonResponse; - private ParseUserListingDataListener parseUserListingDataListener; + private final ParseUserListingDataListener parseUserListingDataListener; private String after; private boolean parseFailed; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserData.java index 9f0d0075..05887404 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserData.java @@ -11,35 +11,35 @@ public class UserData { @PrimaryKey @NonNull @ColumnInfo(name = "name") - private String name; + private final String name; @ColumnInfo(name = "icon") - private String iconUrl; + private final String iconUrl; @ColumnInfo(name = "banner") - private String banner; + private final String banner; @ColumnInfo(name = "link_karma") - private int linkKarma; + private final int linkKarma; @ColumnInfo(name = "comment_karma") - private int commentKarma; + private final int commentKarma; @ColumnInfo(name = "awarder_karma") - private int awarderKarma; + private final int awarderKarma; @ColumnInfo(name = "awardee_karma") - private int awardeeKarma; + private final int awardeeKarma; @ColumnInfo(name = "total_karma") - private int totalKarma; + private final int totalKarma; @ColumnInfo(name = "created_utc") - private long cakeday; + private final long cakeday; @ColumnInfo(name = "is_gold") - private boolean isGold; + private final boolean isGold; @ColumnInfo(name = "is_friend") - private boolean isFriend; + private final boolean isFriend; @ColumnInfo(name = "can_be_followed") - private boolean canBeFollowed; + private final boolean canBeFollowed; @ColumnInfo(name = "over_18") - private boolean isNSFW; + private final boolean isNSFW; @ColumnInfo(name = "description") - private String description; + private final String description; @ColumnInfo(name = "title") - private String title; + private final String title; @Ignore private boolean isSelected; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java index 05042b3b..871dfc78 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java @@ -121,11 +121,11 @@ public class UserFollowing { private static class UpdateSubscriptionAsyncTask extends AsyncTask<Void, Void, Void> { - private SubscribedUserDao subscribedUserDao; + private final SubscribedUserDao subscribedUserDao; private String username; - private String accountName; + private final String accountName; private SubscribedUserData subscribedUserData; - private boolean isSubscribing; + private final boolean isSubscribing; UpdateSubscriptionAsyncTask(SubscribedUserDao subscribedUserDao, String username, @NonNull String accountName, boolean isSubscribing) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingDataSource.java index 14849fb3..c3d922a7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingDataSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingDataSource.java @@ -12,14 +12,14 @@ import retrofit2.Retrofit; public class UserListingDataSource extends PageKeyedDataSource<String, UserData> { - private Retrofit retrofit; - private String query; - private SortType sortType; - private boolean nsfw; - - private MutableLiveData<NetworkState> paginationNetworkStateLiveData; - private MutableLiveData<NetworkState> initialLoadStateLiveData; - private MutableLiveData<Boolean> hasUserLiveData; + private final Retrofit retrofit; + private final String query; + private final SortType sortType; + private final boolean nsfw; + + private final MutableLiveData<NetworkState> paginationNetworkStateLiveData; + private final MutableLiveData<NetworkState> initialLoadStateLiveData; + private final MutableLiveData<Boolean> hasUserLiveData; private PageKeyedDataSource.LoadParams<String> params; private PageKeyedDataSource.LoadCallback<String, UserData> callback; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingDataSourceFactory.java index c764cec6..9d52d087 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingDataSourceFactory.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingDataSourceFactory.java @@ -8,13 +8,13 @@ import ml.docilealligator.infinityforreddit.SortType; import retrofit2.Retrofit; public class UserListingDataSourceFactory extends DataSource.Factory { - private Retrofit retrofit; - private String query; + private final Retrofit retrofit; + private final String query; private SortType sortType; - private boolean nsfw; + private final boolean nsfw; private UserListingDataSource userListingDataSource; - private MutableLiveData<UserListingDataSource> userListingDataSourceMutableLiveData; + private final MutableLiveData<UserListingDataSource> userListingDataSourceMutableLiveData; UserListingDataSourceFactory(Retrofit retrofit, String query, SortType sortType, boolean nsfw) { this.retrofit = retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingViewModel.java index e1e2155b..daffdf1e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserListingViewModel.java @@ -14,12 +14,12 @@ import ml.docilealligator.infinityforreddit.SortType; import retrofit2.Retrofit; public class UserListingViewModel extends ViewModel { - private UserListingDataSourceFactory userListingDataSourceFactory; - private LiveData<NetworkState> paginationNetworkState; - private LiveData<NetworkState> initialLoadingState; - private LiveData<Boolean> hasUserLiveData; - private LiveData<PagedList<UserData>> users; - private MutableLiveData<SortType> sortTypeLiveData; + private final UserListingDataSourceFactory userListingDataSourceFactory; + private final LiveData<NetworkState> paginationNetworkState; + private final LiveData<NetworkState> initialLoadingState; + private final LiveData<Boolean> hasUserLiveData; + private final LiveData<PagedList<UserData>> users; + private final MutableLiveData<SortType> sortTypeLiveData; public UserListingViewModel(Retrofit retrofit, String query, SortType sortType, boolean nsfw) { userListingDataSourceFactory = new UserListingDataSourceFactory(retrofit, query, sortType, nsfw); @@ -74,10 +74,10 @@ public class UserListingViewModel extends ViewModel { } public static class Factory extends ViewModelProvider.NewInstanceFactory { - private Retrofit retrofit; - private String query; - private SortType sortType; - private boolean nsfw; + private final Retrofit retrofit; + private final String query; + private final SortType sortType; + private final boolean nsfw; public Factory(Retrofit retrofit, String query, SortType sortType, boolean nsfw) { this.retrofit = retrofit; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserRepository.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserRepository.java index 8d8101a3..e0ea4da2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserRepository.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserRepository.java @@ -7,8 +7,8 @@ import androidx.lifecycle.LiveData; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class UserRepository { - private UserDao mUserDao; - private LiveData<UserData> mUserLiveData; + private final UserDao mUserDao; + private final LiveData<UserData> mUserLiveData; UserRepository(RedditDataRoomDatabase redditDataRoomDatabase, String userName) { mUserDao = redditDataRoomDatabase.userDao(); @@ -25,7 +25,7 @@ public class UserRepository { private static class InsertAsyncTask extends AsyncTask<UserData, Void, Void> { - private UserDao mAsyncTaskDao; + private final UserDao mAsyncTaskDao; InsertAsyncTask(UserDao dao) { mAsyncTaskDao = dao; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserViewModel.java index 0857a42a..478542ea 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserViewModel.java @@ -11,8 +11,8 @@ import androidx.lifecycle.ViewModelProvider; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class UserViewModel extends AndroidViewModel { - private UserRepository mSubredditRepository; - private LiveData<UserData> mUserLiveData; + private final UserRepository mSubredditRepository; + private final LiveData<UserData> mUserLiveData; public UserViewModel(Application application, RedditDataRoomDatabase redditDataRoomDatabase, String id) { super(application); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java index e00737cc..85215447 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java @@ -23,11 +23,11 @@ import java.lang.ref.WeakReference; public class GlideImageGetter implements Html.ImageGetter { - private WeakReference<TextView> container; + private final WeakReference<TextView> container; private boolean enlargeImage; - private HtmlImagesHandler imagesHandler; + private final HtmlImagesHandler imagesHandler; private float density = 1.0f; - private float textSize; + private final float textSize; public GlideImageGetter(TextView textView, boolean enlargeImage) { this(textView, false, null); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/BaseMeter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/BaseMeter.java index 539919b0..ba8c2974 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/BaseMeter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/BaseMeter.java @@ -37,8 +37,10 @@ import com.google.android.exoplayer2.upstream.TransferListener; @SuppressWarnings("WeakerAccess") // public final class BaseMeter<T extends BandwidthMeter> implements BandwidthMeter, TransferListener { - @NonNull protected final T bandwidthMeter; - @NonNull protected final TransferListener transferListener; + @NonNull + private final T bandwidthMeter; + @NonNull + private final TransferListener transferListener; /** * @deprecated use {@link #BaseMeter(BandwidthMeter)} instead. diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/PlayerSelector.java b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/PlayerSelector.java index e42a55a7..a4aef867 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/PlayerSelector.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/PlayerSelector.java @@ -35,21 +35,21 @@ import ml.docilealligator.infinityforreddit.videoautoplay.widget.Container; /** * @author eneim | 6/2/17. - * + * <p> * PlayerSelector is a convenient class to help selecting the players to start Media * playback. - * + * <p> * On specific event of RecyclerView, such as Child view attached/detached, scroll, the * Collection of players those are available for a playback will change. PlayerSelector is * responded to select a specific number of players from that updated Collection to start a * new playback or pause an old playback if the corresponding Player is not selected * anymore. - * + * <p> * Client should implement a custom PlayerSelecter and set it to the Container for expected * behaviour. By default, Toro comes with linear selection implementation (the Selector * that will iterate over the Collection and select the players from top to bottom until a * certain condition is fullfilled, for example the maximum of player count is reached). - * + * <p> * Custom Selector can have more complicated selecting logics, for example: among 2n + 1 * playable widgets, select n players in the middles ... */ @@ -57,95 +57,117 @@ import ml.docilealligator.infinityforreddit.videoautoplay.widget.Container; @SuppressWarnings("unused") // public interface PlayerSelector { - String TAG = "ToroLib:Selector"; - - /** - * Select a collection of {@link ToroPlayer}s to start a playback (if there is non-playing) item. - * Playing item are also selected. - * - * @param container current {@link Container} that holds the players. - * @param items a mutable collection of candidate {@link ToroPlayer}s, which are the players - * those can start a playback. Items are sorted in order obtained from - * {@link ToroPlayer#getPlayerOrder()}. - * @return the collection of {@link ToroPlayer}s to start a playback. An on-going playback can be - * selected, but it will keep playing. - */ - @NonNull Collection<ToroPlayer> select(@NonNull Container container, - @Sorted(order = ASCENDING) @NonNull List<ToroPlayer> items); - - /** - * The 'reverse' selector of this selector, which can help to select the reversed collection of - * that expected by this selector. - * For example: this selector will select the first playable {@link ToroPlayer} from top, so the - * 'reverse' selector will select the last playable {@link ToroPlayer} from top. - * - * @return The PlayerSelector that has opposite selecting logic. If there is no special one, - * return "this". - */ - @NonNull PlayerSelector reverse(); - - PlayerSelector DEFAULT = new PlayerSelector() { - @NonNull @Override public Collection<ToroPlayer> select(@NonNull Container container, // - @Sorted(order = ASCENDING) @NonNull List<ToroPlayer> items) { - int count = items.size(); - return count > 0 ? singletonList(items.get(0)) : Collections.<ToroPlayer>emptyList(); - } - - @NonNull @Override public PlayerSelector reverse() { - return DEFAULT_REVERSE; - } - }; - - PlayerSelector DEFAULT_REVERSE = new PlayerSelector() { - @NonNull @Override public Collection<ToroPlayer> select(@NonNull Container container, // - @Sorted(order = ASCENDING) @NonNull List<ToroPlayer> items) { - int count = items.size(); - return count > 0 ? singletonList(items.get(count - 1)) : Collections.<ToroPlayer>emptyList(); - } - - @NonNull @Override public PlayerSelector reverse() { - return DEFAULT; - } - }; - - @SuppressWarnings("unused") PlayerSelector BY_AREA = new PlayerSelector() { - - NavigableMap<Float, ToroPlayer> areas = new TreeMap<>(new Comparator<Float>() { - @Override public int compare(Float o1, Float o2) { - return Float.compare(o2, o1); // reverse order, from high to low. - } - }); - - @NonNull @Override public Collection<ToroPlayer> select(@NonNull final Container container, - @Sorted(order = ASCENDING) @NonNull List<ToroPlayer> items) { - areas.clear(); - int count = items.size(); - if (count > 0) { - for (int i = 0; i < count; i++) { - ToroPlayer item = items.get(i); - if (!areas.containsValue(item)) areas.put(visibleAreaOffset(item, container), item); + String TAG = "ToroLib:Selector"; + + /** + * Select a collection of {@link ToroPlayer}s to start a playback (if there is non-playing) item. + * Playing item are also selected. + * + * @param container current {@link Container} that holds the players. + * @param items a mutable collection of candidate {@link ToroPlayer}s, which are the players + * those can start a playback. Items are sorted in order obtained from + * {@link ToroPlayer#getPlayerOrder()}. + * @return the collection of {@link ToroPlayer}s to start a playback. An on-going playback can be + * selected, but it will keep playing. + */ + @NonNull + Collection<ToroPlayer> select(@NonNull Container container, + @Sorted(order = ASCENDING) @NonNull List<ToroPlayer> items); + + /** + * The 'reverse' selector of this selector, which can help to select the reversed collection of + * that expected by this selector. + * For example: this selector will select the first playable {@link ToroPlayer} from top, so the + * 'reverse' selector will select the last playable {@link ToroPlayer} from top. + * + * @return The PlayerSelector that has opposite selecting logic. If there is no special one, + * return "this". + */ + @NonNull + PlayerSelector reverse(); + + PlayerSelector DEFAULT = new PlayerSelector() { + @NonNull + @Override + public Collection<ToroPlayer> select(@NonNull Container container, // + @Sorted(order = ASCENDING) @NonNull List<ToroPlayer> items) { + int count = items.size(); + return count > 0 ? singletonList(items.get(0)) : Collections.<ToroPlayer>emptyList(); } - count = areas.size(); - } - - return count > 0 ? singletonList(areas.firstEntry().getValue()) - : Collections.<ToroPlayer>emptyList(); - } + @NonNull + @Override + public PlayerSelector reverse() { + return DEFAULT_REVERSE; + } + }; + + PlayerSelector DEFAULT_REVERSE = new PlayerSelector() { + @NonNull + @Override + public Collection<ToroPlayer> select(@NonNull Container container, // + @Sorted(order = ASCENDING) @NonNull List<ToroPlayer> items) { + int count = items.size(); + return count > 0 ? singletonList(items.get(count - 1)) : Collections.<ToroPlayer>emptyList(); + } - @NonNull @Override public PlayerSelector reverse() { - return this; - } - }; + @NonNull + @Override + public PlayerSelector reverse() { + return DEFAULT; + } + }; + + @SuppressWarnings("unused") + PlayerSelector BY_AREA = new PlayerSelector() { + + final NavigableMap<Float, ToroPlayer> areas = new TreeMap<>(new Comparator<Float>() { + @Override + public int compare(Float o1, Float o2) { + return Float.compare(o2, o1); // reverse order, from high to low. + } + }); + + @NonNull + @Override + public Collection<ToroPlayer> select(@NonNull final Container container, + @Sorted(order = ASCENDING) @NonNull List<ToroPlayer> items) { + areas.clear(); + int count = items.size(); + if (count > 0) { + for (int i = 0; i < count; i++) { + ToroPlayer item = items.get(i); + if (!areas.containsValue(item)) + areas.put(visibleAreaOffset(item, container), item); + } + + count = areas.size(); + } + + return count > 0 ? singletonList(areas.firstEntry().getValue()) + : Collections.<ToroPlayer>emptyList(); + } - @SuppressWarnings("unused") PlayerSelector NONE = new PlayerSelector() { - @NonNull @Override public Collection<ToroPlayer> select(@NonNull Container container, // - @Sorted(order = ASCENDING) @NonNull List<ToroPlayer> items) { - return emptyList(); - } + @NonNull + @Override + public PlayerSelector reverse() { + return this; + } + }; + + @SuppressWarnings("unused") + PlayerSelector NONE = new PlayerSelector() { + @NonNull + @Override + public Collection<ToroPlayer> select(@NonNull Container container, // + @Sorted(order = ASCENDING) @NonNull List<ToroPlayer> items) { + return emptyList(); + } - @NonNull @Override public PlayerSelector reverse() { - return this; - } - }; + @NonNull + @Override + public PlayerSelector reverse() { + return this; + } + }; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ToroExo.java b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ToroExo.java index 5d49f0b8..1682658e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ToroExo.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ToroExo.java @@ -107,7 +107,7 @@ public final class ToroExo { /** * Utility method to produce {@link ExoCreator} instance from a {@link Config}. */ - public final ExoCreator getCreator(Config config) { + public ExoCreator getCreator(Config config) { ExoCreator creator = this.creators.get(config); if (creator == null) { creator = new DefaultExoCreator(this, config); @@ -118,7 +118,7 @@ public final class ToroExo { } @SuppressWarnings("WeakerAccess") - public final Config getDefaultConfig() { + public Config getDefaultConfig() { if (defaultConfig == null) defaultConfig = new Config.Builder(context).build(); return defaultConfig; } @@ -126,7 +126,7 @@ public final class ToroExo { /** * Get the default {@link ExoCreator}. This ExoCreator is configured by {@link #defaultConfig}. */ - public final ExoCreator getDefaultCreator() { + public ExoCreator getDefaultCreator() { return getCreator(getDefaultConfig()); } @@ -141,7 +141,7 @@ public final class ToroExo { * @return an usable {@link SimpleExoPlayer} instance. */ @NonNull // - public final ToroExoPlayer requestPlayer(@NonNull ExoCreator creator) { + public ToroExoPlayer requestPlayer(@NonNull ExoCreator creator) { ExoPlayer player = getPool(checkNotNull(creator)).acquire(); if (player == null) player = creator.createPlayer(); return new ToroExoPlayer(player); @@ -155,7 +155,7 @@ public final class ToroExo { * @return true if player is released to relevant Pool, false otherwise. */ @SuppressWarnings({"WeakerAccess", "UnusedReturnValue"}) // - public final boolean releasePlayer(@NonNull ExoCreator creator, @NonNull ExoPlayer player) { + public boolean releasePlayer(@NonNull ExoCreator creator, @NonNull ExoPlayer player) { return getPool(checkNotNull(creator)).release(player); } @@ -163,7 +163,7 @@ public final class ToroExo { * Release and clear all current cached ExoPlayer instances. This should be called when * client Application runs out of memory ({@link Application#onTrimMemory(int)} for example). */ - public final void cleanUp() { + public void cleanUp() { // TODO [2018/03/07] Test this. Ref: https://stackoverflow.com/a/1884916/1553254 for (Iterator<Map.Entry<ExoCreator, Pools.Pool<ExoPlayer>>> it = playerPools.entrySet().iterator(); it.hasNext(); ) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ToroExoPlayer.java b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ToroExoPlayer.java index ea8bf638..39be12c3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ToroExoPlayer.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/ToroExoPlayer.java @@ -41,7 +41,7 @@ import ml.docilealligator.infinityforreddit.videoautoplay.media.VolumeInfo; @SuppressWarnings("WeakerAccess") // public class ToroExoPlayer { - private ExoPlayer player; + private final ExoPlayer player; public ToroExoPlayer(Context context, RenderersFactory renderersFactory, TrackSelector trackSelector, LoadControl loadControl, BandwidthMeter bandwidthMeter, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/widget/Container.java b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/widget/Container.java index bf5958cf..1ac271db 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/widget/Container.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/widget/Container.java @@ -45,6 +45,9 @@ import androidx.core.view.WindowInsetsCompat; import androidx.customview.view.AbsSavedState; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.appbar.CollapsingToolbarLayout; + import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collection; @@ -330,7 +333,7 @@ public class Container extends RecyclerView { Collections.sort(candidates, Common.ORDER_COMPARATOR); Collection<ToroPlayer> toPlay = playerSelector != null ? playerSelector.select(this, candidates) - : Collections.<ToroPlayer>emptyList(); + : Collections.emptyList(); for (ToroPlayer player : toPlay) { if (!player.isPlaying()) playerManager.play(player, playerDispatcher); } @@ -744,7 +747,7 @@ public class Container extends RecyclerView { ToroDataObserver() { } - final void registerAdapter(Adapter adapter) { + void registerAdapter(Adapter adapter) { if (this.adapter == adapter) return; if (this.adapter != null) { this.adapter.unregisterAdapterDataObserver(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/widget/PlaybackInfoCache.java b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/widget/PlaybackInfoCache.java index 9934779b..0c0467c2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/widget/PlaybackInfoCache.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/videoautoplay/widget/PlaybackInfoCache.java @@ -69,11 +69,11 @@ final class PlaybackInfoCache extends RecyclerView.AdapterDataObserver { this.container = container; } - final void onAttach() { + void onAttach() { hotCache = new TreeMap<>(ORDER_COMPARATOR_INT); } - final void onDetach() { + void onDetach() { if (hotCache != null) { hotCache.clear(); hotCache = null; @@ -81,7 +81,7 @@ final class PlaybackInfoCache extends RecyclerView.AdapterDataObserver { coldKeyToOrderMap.clear(); } - final void onPlayerAttached(ToroPlayer player) { + void onPlayerAttached(ToroPlayer player) { int playerOrder = player.getPlayerOrder(); // [1] Check if there is cold cache for this player Object key = getKey(playerOrder); @@ -105,7 +105,7 @@ final class PlaybackInfoCache extends RecyclerView.AdapterDataObserver { // This method will: // [1] Take current hot cache entry of the player, and put back to cold cache. // [2] Remove the hot cache entry of the player. - final void onPlayerDetached(ToroPlayer player) { + void onPlayerDetached(ToroPlayer player) { int playerOrder = player.getPlayerOrder(); if (hotCache != null && hotCache.containsKey(playerOrder)) { PlaybackInfo cache = hotCache.remove(playerOrder); @@ -114,7 +114,8 @@ final class PlaybackInfoCache extends RecyclerView.AdapterDataObserver { } } - @SuppressWarnings("unused") final void onPlayerRecycled(ToroPlayer player) { + @SuppressWarnings("unused") + void onPlayerRecycled(ToroPlayer player) { // TODO do anything here? } @@ -348,7 +349,8 @@ final class PlaybackInfoCache extends RecyclerView.AdapterDataObserver { // : container.getCacheManager().getOrderForKey(key); //} - @NonNull final PlaybackInfo getPlaybackInfo(int position) { + @NonNull + PlaybackInfo getPlaybackInfo(int position) { PlaybackInfo info = hotCache != null ? hotCache.get(position) : null; if (info == SCRAP) { // has hot cache, but was SCRAP. info = container.playerInitializer.initPlaybackInfo(position); @@ -361,7 +363,7 @@ final class PlaybackInfoCache extends RecyclerView.AdapterDataObserver { } // Call by Container#savePlaybackInfo and that method is called right before any pausing. - final void savePlaybackInfo(int position, @NonNull PlaybackInfo playbackInfo) { + void savePlaybackInfo(int position, @NonNull PlaybackInfo playbackInfo) { ToroUtil.checkNotNull(playbackInfo); if (hotCache != null) hotCache.put(position, playbackInfo); Object key = getKey(position); @@ -395,7 +397,7 @@ final class PlaybackInfoCache extends RecyclerView.AdapterDataObserver { } } - final void clearCache() { + void clearCache() { coldCache.clear(); if (hotCache != null) hotCache.clear(); } |