From 0c1dc1e86ec632fdd9f44de4267aaf32e267cefd Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Wed, 3 Jan 2024 05:05:07 -0500 Subject: Change accountName's default value to Account.ANONYMOUS_ACCOUNT instead of null. --- .../infinityforreddit/AccessTokenAuthenticator.java | 6 +++--- .../infinityforreddit/AnyAccountAccessTokenAuthenticator.java | 2 +- .../java/ml/docilealligator/infinityforreddit/FavoriteThing.java | 8 ++++---- .../java/ml/docilealligator/infinityforreddit/FetchRules.java | 2 +- .../docilealligator/infinityforreddit/FetchSubscribedThing.java | 3 ++- .../docilealligator/infinityforreddit/ParseSubscribedThing.java | 6 ++++-- .../docilealligator/infinityforreddit/PullNotificationWorker.java | 2 +- .../ml/docilealligator/infinityforreddit/SelectUserFlair.java | 2 +- .../infinityforreddit/activities/AccountPostsActivity.java | 3 ++- .../infinityforreddit/activities/AccountSavedThingActivity.java | 3 ++- .../infinityforreddit/activities/CommentActivity.java | 2 +- .../infinityforreddit/activities/EditProfileActivity.java | 2 +- .../infinityforreddit/activities/FilteredPostsActivity.java | 2 +- .../infinityforreddit/activities/HistoryActivity.java | 3 ++- .../infinityforreddit/activities/InboxActivity.java | 2 +- .../infinityforreddit/activities/MainActivity.java | 2 +- .../activities/MultiredditSelectionActivity.java | 2 +- .../infinityforreddit/activities/PostGalleryActivity.java | 2 +- .../infinityforreddit/activities/PostImageActivity.java | 2 +- .../infinityforreddit/activities/PostPollActivity.java | 2 +- .../infinityforreddit/activities/PostVideoActivity.java | 2 +- .../infinityforreddit/activities/ReportActivity.java | 2 +- .../infinityforreddit/activities/RulesActivity.java | 4 ++-- .../activities/SearchSubredditsResultActivity.java | 3 ++- .../infinityforreddit/activities/SearchUsersResultActivity.java | 3 ++- .../infinityforreddit/activities/SelectUserFlairActivity.java | 3 ++- .../infinityforreddit/activities/SubredditSelectionActivity.java | 4 ++-- .../infinityforreddit/activities/ViewPrivateMessagesActivity.java | 3 ++- .../adapters/CommentsListingRecyclerViewAdapter.java | 2 +- .../infinityforreddit/adapters/CommentsRecyclerViewAdapter.java | 6 +++--- .../adapters/FollowedUsersRecyclerViewAdapter.java | 3 ++- .../adapters/HistoryPostRecyclerViewAdapter.java | 2 +- .../adapters/MultiRedditListingRecyclerViewAdapter.java | 3 ++- .../infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java | 4 ++-- .../infinityforreddit/adapters/PostRecyclerViewAdapter.java | 2 +- .../adapters/PrivateMessagesDetailRecyclerViewAdapter.java | 2 +- .../adapters/SubredditListingRecyclerViewAdapter.java | 3 ++- .../adapters/SubscribedSubredditsRecyclerViewAdapter.java | 5 +++-- .../adapters/UserListingRecyclerViewAdapter.java | 5 +++-- .../navigationdrawer/HeaderSectionRecyclerViewAdapter.java | 2 +- .../NavigationDrawerRecyclerViewMergedAdapter.java | 5 +++-- .../navigationdrawer/PreferenceSectionRecyclerViewAdapter.java | 2 +- .../infinityforreddit/asynctasks/CheckIsFollowingUser.java | 4 +++- .../asynctasks/CheckIsSubscribedToSubreddit.java | 4 +++- 44 files changed, 78 insertions(+), 58 deletions(-) (limited to 'app') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java index 6fd2522f..6d82489c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java @@ -50,7 +50,7 @@ class AccessTokenAuthenticator implements Authenticator { if (account == null) { //Anonymous mode String accessTokenFromSharedPreference = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, ""); - if (accessToken.equals(accessTokenFromSharedPreference)) { + if (accessToken.equals(accessTokenFromSharedPreference) || accessToken.equals("null")) { String newAccessToken = getApplicationOnlyAccessToken(); if (!newAccessToken.equals("")) { return response.request().newBuilder().headers(Headers.of(APIUtils.getOAuthHeader(newAccessToken))).build(); @@ -99,7 +99,7 @@ class AccessTokenAuthenticator implements Authenticator { } else { mRedditDataRoomDatabase.accountDao().updateAccessTokenAndRefreshToken(account.getAccountName(), newAccessToken, newRefreshToken); } - if (mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, "").equals(account.getAccountName())) { + if (mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT).equals(account.getAccountName())) { mCurrentAccountSharedPreferences.edit().putString(SharedPreferencesUtils.ACCESS_TOKEN, newAccessToken).apply(); } @@ -127,7 +127,7 @@ class AccessTokenAuthenticator implements Authenticator { if (response.isSuccessful() && response.body() != null) { JSONObject jsonObject = new JSONObject(response.body()); String newAccessToken = jsonObject.getString(APIUtils.ACCESS_TOKEN_KEY); - if (mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, "").equals(Account.ANONYMOUS_ACCOUNT)) { + if (mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT).equals(Account.ANONYMOUS_ACCOUNT)) { mCurrentAccountSharedPreferences.edit().putString(SharedPreferencesUtils.ACCESS_TOKEN, newAccessToken).apply(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AnyAccountAccessTokenAuthenticator.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AnyAccountAccessTokenAuthenticator.java index 9bd31c2d..0819bd08 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AnyAccountAccessTokenAuthenticator.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AnyAccountAccessTokenAuthenticator.java @@ -90,7 +90,7 @@ public class AnyAccountAccessTokenAuthenticator implements Authenticator { mRedditDataRoomDatabase.accountDao().updateAccessTokenAndRefreshToken(account.getAccountName(), newAccessToken, newRefreshToken); } Account currentAccount = mRedditDataRoomDatabase.accountDao().getCurrentAccount(); - if (currentAccount != null && mAccount.getAccountName().equals(currentAccount.getAccountName()) && mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, "").equals(account.getAccountName())) { + if (currentAccount != null && mAccount.getAccountName().equals(currentAccount.getAccountName()) && mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT).equals(account.getAccountName())) { mCurrentAccountSharedPreferences.edit().putString(SharedPreferencesUtils.ACCESS_TOKEN, newAccessToken).apply(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FavoriteThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FavoriteThing.java index 08f859d1..c01eba2f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FavoriteThing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FavoriteThing.java @@ -23,7 +23,7 @@ import retrofit2.Retrofit; public class FavoriteThing { public static void favoriteSubreddit(Executor executor, Handler handler, Retrofit oauthRetrofit, RedditDataRoomDatabase redditDataRoomDatabase, - @Nullable String accessToken, String accountName, + @Nullable String accessToken, @NonNull String accountName, SubscribedSubredditData subscribedSubredditData, FavoriteThingListener favoriteThingListener) { if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { @@ -54,7 +54,7 @@ public class FavoriteThing { public static void unfavoriteSubreddit(Executor executor, Handler handler, Retrofit oauthRetrofit, RedditDataRoomDatabase redditDataRoomDatabase, - @Nullable String accessToken, String accountName, + @Nullable String accessToken, @NonNull String accountName, SubscribedSubredditData subscribedSubredditData, FavoriteThingListener favoriteThingListener) { if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { @@ -85,7 +85,7 @@ public class FavoriteThing { public static void favoriteUser(Executor executor, Handler handler, Retrofit oauthRetrofit, RedditDataRoomDatabase redditDataRoomDatabase, - @Nullable String accessToken, String accountName, + @Nullable String accessToken, @NonNull String accountName, SubscribedUserData subscribedUserData, FavoriteThingListener favoriteThingListener) { if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { @@ -116,7 +116,7 @@ public class FavoriteThing { public static void unfavoriteUser(Executor executor, Handler handler, Retrofit oauthRetrofit, RedditDataRoomDatabase redditDataRoomDatabase, - @Nullable String accessToken, String accountName, + @Nullable String accessToken, @NonNull String accountName, SubscribedUserData subscribedUserData, FavoriteThingListener favoriteThingListener) { if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRules.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRules.java index 808e393f..96debfbb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRules.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRules.java @@ -28,7 +28,7 @@ public class FetchRules { } public static void fetchRules(Executor executor, Handler handler, Retrofit retrofit, @Nullable String accessToken, - String accountName, String subredditName, + String subredditName, FetchRulesListener fetchRulesListener) { RedditAPI api = retrofit.create(RedditAPI.class); Call rulesCall = api.getRulesOauth(APIUtils.getOAuthHeader(accessToken), subredditName); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubscribedThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubscribedThing.java index 5c9d52ed..9a8f08f2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubscribedThing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubscribedThing.java @@ -1,6 +1,7 @@ package ml.docilealligator.infinityforreddit; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.util.ArrayList; @@ -15,7 +16,7 @@ import retrofit2.Response; import retrofit2.Retrofit; public class FetchSubscribedThing { - public static void fetchSubscribedThing(final Retrofit oauthRetrofit, String accessToken, String accountName, + public static void fetchSubscribedThing(final Retrofit oauthRetrofit, @Nullable String accessToken, @NonNull String accountName, final String lastItem, final ArrayList subscribedSubredditData, final ArrayList subscribedUserData, final ArrayList subredditData, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java index e4d12a7f..3ccf964e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java @@ -2,6 +2,8 @@ package ml.docilealligator.infinityforreddit; import android.os.AsyncTask; +import androidx.annotation.NonNull; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -15,7 +17,7 @@ import ml.docilealligator.infinityforreddit.utils.JSONUtils; import ml.docilealligator.infinityforreddit.utils.Utils; class ParseSubscribedThing { - static void parseSubscribedSubreddits(String response, String accountName, + static void parseSubscribedSubreddits(String response, @NonNull String accountName, ArrayList subscribedSubredditData, ArrayList subscribedUserData, ArrayList subredditData, @@ -46,7 +48,7 @@ class ParseSubscribedThing { private ArrayList newSubredditData; private ParseSubscribedSubredditsListener parseSubscribedSubredditsListener; - ParseSubscribedSubredditsAsyncTask(String response, String accountName, ArrayList subscribedSubredditData, + ParseSubscribedSubredditsAsyncTask(String response, @NonNull String accountName, ArrayList subscribedSubredditData, ArrayList subscribedUserData, ArrayList subredditData, ParseSubscribedSubredditsListener parseSubscribedSubredditsListener) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java index 5c54be73..984f01f8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java @@ -260,7 +260,7 @@ public class PullNotificationWorker extends Worker { } else { mRedditDataRoomDatabase.accountDao().updateAccessTokenAndRefreshToken(account.getAccountName(), newAccessToken, newRefreshToken); } - if (mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, "").equals(account.getAccountName())) { + if (mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT).equals(account.getAccountName())) { mCurrentAccountSharedPreferences.edit().putString(SharedPreferencesUtils.ACCESS_TOKEN, newAccessToken).apply(); } return newAccessToken; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SelectUserFlair.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SelectUserFlair.java index bb4b13b5..52012e28 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SelectUserFlair.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SelectUserFlair.java @@ -27,7 +27,7 @@ public class SelectUserFlair { } public static void selectUserFlair(Retrofit oauthRetrofit, String accessToken, @Nullable UserFlair userFlair, - String subredditName, String accountName, SelectUserFlairListener selectUserFlairListener) { + String subredditName, @NonNull String accountName, SelectUserFlairListener selectUserFlairListener) { Map params = new HashMap<>(); params.put(APIUtils.API_TYPE_KEY, APIUtils.API_TYPE_JSON); if (userFlair != null) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java index 1f5d229c..b1106935 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java @@ -24,6 +24,7 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; @@ -109,7 +110,7 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); if (savedInstanceState != null) { mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java index 76d8b4c6..554c1ad1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java @@ -32,6 +32,7 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; @@ -119,7 +120,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT fragmentManager = getSupportFragmentManager(); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); initializeViewPager(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java index df492641..9a00a343 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java @@ -162,7 +162,7 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA mGlide = Glide.with(this); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - if (mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null) == null) { + if (mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT).equals(Account.ANONYMOUS_ACCOUNT)) { finish(); return; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java index 786eee71..aff03608 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java @@ -127,7 +127,7 @@ public class EditProfileActivity extends BaseActivity { } mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); changeBanner.setOnClickListener(view -> { startPickImage(PICK_IMAGE_BANNER_REQUEST_CODE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java index a7656c8f..8780f4b6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java @@ -158,7 +158,7 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec setToolbarGoToTop(toolbar); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); name = getIntent().getStringExtra(EXTRA_NAME); postType = getIntent().getIntExtra(EXTRA_POST_TYPE, PostPagingSource.TYPE_FRONT_PAGE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java index 3a3a938e..221eb92b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java @@ -35,6 +35,7 @@ import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; @@ -120,7 +121,7 @@ public class HistoryActivity extends BaseActivity implements ActivityToolbarInte fragmentManager = getSupportFragmentManager(); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); initializeViewPager(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java index 9c916fe1..4fa36e39 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java @@ -158,7 +158,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf fragmentManager = getSupportFragmentManager(); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); if (savedInstanceState != null) { mNewAccountName = savedInstanceState.getString(NEW_ACCOUNT_NAME_STATE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java index 45492485..dd6dbc5e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -858,7 +858,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } @Override - public void onAccountClick(String accountName) { + public void onAccountClick(@NonNull String accountName) { SwitchAccount.switchAccount(mRedditDataRoomDatabase, mCurrentAccountSharedPreferences, mExecutor, new Handler(), accountName, newAccount -> { Intent intent = new Intent(MainActivity.this, MainActivity.class); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java index 09d36b79..d84a2646 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java @@ -118,7 +118,7 @@ public class MultiredditSelectionActivity extends BaseActivity implements Activi getSupportActionBar().setDisplayHomeAsUpEnabled(true); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); if (savedInstanceState == null) { bindView(true); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java index 1d980bae..56a19b37 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java @@ -219,7 +219,7 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee resources = getResources(); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); adapter = new RedditGallerySubmissionRecyclerViewAdapter(this, mCustomThemeWrapper, () -> { if (!isUploading) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java index a1620880..e0fd0411 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java @@ -212,7 +212,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF resources = getResources(); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); if (savedInstanceState != null) { selectedAccount = savedInstanceState.getParcelable(SELECTED_ACCOUNT_STATE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java index 3ba6983c..57edeb79 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java @@ -225,7 +225,7 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr resources = getResources(); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); Resources resources = getResources(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java index f405ad4c..716c108d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java @@ -231,7 +231,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF resources = getResources(); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); if (savedInstanceState != null) { selectedAccount = savedInstanceState.getParcelable(SELECTED_ACCOUNT_STATE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java index 1907d2d4..a0c94f20 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java @@ -119,7 +119,7 @@ public class ReportActivity extends BaseActivity { recyclerView.setAdapter(mAdapter); if (rulesReasons == null) { - FetchRules.fetchRules(mExecutor, new Handler(), mOauthRetrofit, mAccessToken, mAccountName, mSubredditName, new FetchRules.FetchRulesListener() { + FetchRules.fetchRules(mExecutor, new Handler(), mOauthRetrofit, mAccessToken, mSubredditName, new FetchRules.FetchRulesListener() { @Override public void success(ArrayList rules) { mAdapter.setRules(ReportReason.convertRulesToReasons(rules)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java index b0f59535..d5e89738 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java @@ -134,7 +134,7 @@ public class RulesActivity extends BaseActivity { mAdapter = new RulesRecyclerViewAdapter(this, mCustomThemeWrapper, sliderPanel, mSubredditName); recyclerView.setAdapter(mAdapter); - FetchRules.fetchRules(mExecutor, new Handler(), mOauthRetrofit, mAccessToken, mAccountName, + FetchRules.fetchRules(mExecutor, new Handler(), mOauthRetrofit, mAccessToken, mSubredditName, new FetchRules.FetchRulesListener() { @Override public void success(ArrayList rules) { @@ -183,7 +183,7 @@ public class RulesActivity extends BaseActivity { errorTextView.setOnClickListener(view -> { progressBar.setVisibility(View.VISIBLE); errorTextView.setVisibility(View.GONE); - FetchRules.fetchRules(mExecutor, new Handler(), mOauthRetrofit, mAccessToken, mAccountName, mSubredditName, new FetchRules.FetchRulesListener() { + FetchRules.fetchRules(mExecutor, new Handler(), mOauthRetrofit, mAccessToken, mSubredditName, new FetchRules.FetchRulesListener() { @Override public void success(ArrayList rules) { progressBar.setVisibility(View.GONE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java index 58a098ba..bb1a5b00 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java @@ -30,6 +30,7 @@ import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; @@ -106,7 +107,7 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti String query = getIntent().getExtras().getString(EXTRA_QUERY); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); if (savedInstanceState == null) { mFragment = new SubredditListingFragment(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java index 376f2975..7ee846fb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java @@ -30,6 +30,7 @@ import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; @@ -105,7 +106,7 @@ public class SearchUsersResultActivity extends BaseActivity implements ActivityT String query = getIntent().getExtras().getString(EXTRA_QUERY); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); if (savedInstanceState == null) { mFragment = new UserListingFragment(); 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 1a0930fb..05dbbf6f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java @@ -32,6 +32,7 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SelectUserFlair; import ml.docilealligator.infinityforreddit.UserFlair; +import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.adapters.UserFlairRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed; @@ -101,7 +102,7 @@ public class SelectUserFlairActivity extends BaseActivity implements ActivityToo setTitle(mSubredditName); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); if (savedInstanceState != null) { mUserFlairs = savedInstanceState.getParcelableArrayList(USER_FLAIRS_STATE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java index 297c80b7..ecfffa08 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java @@ -150,12 +150,12 @@ public class SubredditSelectionActivity extends BaseActivity implements Activity .build(); } else { mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); mAccountProfileImageUrl = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_IMAGE_URL, null); } } else { mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); mAccountProfileImageUrl = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_IMAGE_URL, null); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java index 1946aacb..61a60034 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java @@ -38,6 +38,7 @@ import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.account.Account; import ml.docilealligator.infinityforreddit.adapters.PrivateMessagesDetailRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.asynctasks.LoadUserData; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; @@ -133,7 +134,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit mProvideUserAvatarCallbacks = new ArrayList<>(); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); + mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT); if (savedInstanceState != null) { mUserAvatar = savedInstanceState.getString(USER_AVATAR_STATE); 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 64539461..e7b3b61a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java @@ -119,7 +119,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter(); mLocale = locale; 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 143a9596..90e88b37 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java @@ -10,6 +10,7 @@ import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; @@ -54,7 +55,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter streambleApiProvider, CustomThemeWrapper customThemeWrapper, Locale locale, - String accessToken, String accountName, int postType, int postLayout, boolean displaySubredditName, + @Nullable String accessToken, @NonNull String accountName, int postType, int postLayout, boolean displaySubredditName, SharedPreferences sharedPreferences, SharedPreferences currentAccountSharedPreferences, SharedPreferences nsfwAndSpoilerSharedPreferences, ExoCreator exoCreator, Callback callback) { 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 bef5f998..0122ffa5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java @@ -9,6 +9,7 @@ import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; @@ -62,7 +63,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< public MultiRedditListingRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit, RedditDataRoomDatabase redditDataRoomDatabase, CustomThemeWrapper customThemeWrapper, - String accessToken, String accountName, + @Nullable String accessToken, @NonNull String accountName, OnItemClickListener onItemClickListener) { mActivity = activity; mExecutor = executor; 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 ad158f05..311082b7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -227,8 +227,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter streamableApiProvider, RedditDataRoomDatabase redditDataRoomDatabase, RequestManager glide, - boolean separatePostAndComments, String accessToken, - String accountName, Post post, Locale locale, + boolean separatePostAndComments, @Nullable String accessToken, + @NonNull String accountName, Post post, Locale locale, SharedPreferences sharedPreferences, SharedPreferences currentAccountSharedPreferences, SharedPreferences nsfwAndSpoilerSharedPreferences, 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 f356b8fb..d5b3f0ab 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -257,7 +257,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter streamableApiProvider, CustomThemeWrapper customThemeWrapper, Locale locale, - String accessToken, String accountName, int postType, int postLayout, boolean displaySubredditName, + @Nullable String accessToken, @NonNull String accountName, int postType, int postLayout, boolean displaySubredditName, SharedPreferences sharedPreferences, SharedPreferences currentAccountSharedPreferences, SharedPreferences nsfwAndSpoilerSharedPreferences, SharedPreferences postHistorySharedPreferences, 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 c4f859d4..a7371257 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java @@ -70,7 +70,7 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt public PrivateMessagesDetailRecyclerViewAdapter(ViewPrivateMessagesActivity viewPrivateMessagesActivity, SharedPreferences sharedPreferences, Locale locale, - Message message, String accountName, + Message message, @NonNull String accountName, CustomThemeWrapper customThemeWrapper) { mMessage = message; mViewPrivateMessagesActivity = viewPrivateMessagesActivity; 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 bdd28bdc..a6ce267a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditListingRecyclerViewAdapter.java @@ -13,6 +13,7 @@ import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.paging.PagedListAdapter; import androidx.recyclerview.widget.DiffUtil; @@ -76,7 +77,7 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter { SubscribedUserData subscribedUserData = redditDataRoomDatabase.subscribedUserDao().getSubscribedUser(username, accountName.equals(Account.ANONYMOUS_ACCOUNT) ? Account.ANONYMOUS_ACCOUNT : accountName); handler.post(() -> { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsSubscribedToSubreddit.java b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsSubscribedToSubreddit.java index 830c6dbc..ef8952b8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsSubscribedToSubreddit.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsSubscribedToSubreddit.java @@ -2,6 +2,8 @@ package ml.docilealligator.infinityforreddit.asynctasks; import android.os.Handler; +import androidx.annotation.NonNull; + import java.util.concurrent.Executor; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; @@ -11,7 +13,7 @@ import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubred public class CheckIsSubscribedToSubreddit { public static void checkIsSubscribedToSubreddit(Executor executor, Handler handler, RedditDataRoomDatabase redditDataRoomDatabase, - String subredditName, String accountName, + String subredditName, @NonNull String accountName, CheckIsSubscribedToSubredditListener checkIsSubscribedToSubredditListener) { executor.execute(() -> { if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { -- cgit v1.2.3