aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-01-03 10:05:07 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-01-03 10:05:07 +0000
commit0c1dc1e86ec632fdd9f44de4267aaf32e267cefd (patch)
treeb0562fb27feeedd3c1aea86be0e7ff847e361b72 /app/src
parented7dc47c5080ce1ad134d61e9f8cdfc6e7d1e6f2 (diff)
downloadinfinity-for-reddit-0c1dc1e86ec632fdd9f44de4267aaf32e267cefd.tar
infinity-for-reddit-0c1dc1e86ec632fdd9f44de4267aaf32e267cefd.tar.gz
infinity-for-reddit-0c1dc1e86ec632fdd9f44de4267aaf32e267cefd.tar.bz2
infinity-for-reddit-0c1dc1e86ec632fdd9f44de4267aaf32e267cefd.tar.lz
infinity-for-reddit-0c1dc1e86ec632fdd9f44de4267aaf32e267cefd.tar.xz
infinity-for-reddit-0c1dc1e86ec632fdd9f44de4267aaf32e267cefd.tar.zst
infinity-for-reddit-0c1dc1e86ec632fdd9f44de4267aaf32e267cefd.zip
Change accountName's default value to Account.ANONYMOUS_ACCOUNT instead of null.
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AccessTokenAuthenticator.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AnyAccountAccessTokenAuthenticator.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/FavoriteThing.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/FetchRules.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/FetchSubscribedThing.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SelectUserFlair.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CommentActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ReportActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/RulesActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectUserFlairActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditListingRecyclerViewAdapter.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubscribedSubredditsRecyclerViewAdapter.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PreferenceSectionRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsFollowingUser.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsSubscribedToSubreddit.java4
44 files changed, 78 insertions, 58 deletions
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<String> 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> subscribedSubredditData,
final ArrayList<SubscribedUserData> subscribedUserData,
final ArrayList<SubredditData> 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> subscribedSubredditData,
ArrayList<SubscribedUserData> subscribedUserData,
ArrayList<SubredditData> subredditData,
@@ -46,7 +48,7 @@ class ParseSubscribedThing {
private ArrayList<SubredditData> newSubredditData;
private ParseSubscribedSubredditsListener parseSubscribedSubredditsListener;
- ParseSubscribedSubredditsAsyncTask(String response, String accountName, ArrayList<SubscribedSubredditData> subscribedSubredditData,
+ ParseSubscribedSubredditsAsyncTask(String response, @NonNull String accountName, ArrayList<SubscribedSubredditData> subscribedSubredditData,
ArrayList<SubscribedUserData> subscribedUserData,
ArrayList<SubredditData> 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<String, String> 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<Rule> 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<Rule> 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<Rule> 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<Comment
public CommentsListingRecyclerViewAdapter(BaseActivity activity, Retrofit oauthRetrofit,
CustomThemeWrapper customThemeWrapper, Locale locale,
SharedPreferences sharedPreferences, String accessToken,
- String accountName, String username,
+ @NonNull String accountName, String username,
RetryLoadingMoreCallback retryLoadingMoreCallback) {
super(DIFF_CALLBACK);
mActivity = activity;
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 7faa3a23..27c6f4f5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java
@@ -165,7 +165,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
public CommentsRecyclerViewAdapter(BaseActivity activity, ViewPostDetailFragment fragment,
CustomThemeWrapper customThemeWrapper,
Executor executor, Retrofit oauthRetrofit,
- String accessToken, String accountName,
+ @Nullable String accessToken, @NonNull String accountName,
Post post, Locale locale, String singleCommentId,
boolean isSingleCommentThreadMode,
SharedPreferences sharedPreferences,
@@ -175,6 +175,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
mFragment = fragment;
mExecutor = executor;
mOauthRetrofit = oauthRetrofit;
+ mAccessToken = accessToken;
+ mAccountName = accountName;
mGlide = Glide.with(activity);
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
mCommentTextColor = customThemeWrapper.getCommentColor();
@@ -255,8 +257,6 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
}
});
recycledViewPool = new RecyclerView.RecycledViewPool();
- mAccessToken = accessToken;
- mAccountName = accountName;
mPost = post;
mVisibleComments = new ArrayList<>();
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<Recyc
public FollowedUsersRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit,
RedditDataRoomDatabase redditDataRoomDatabase,
CustomThemeWrapper customThemeWrapper,
- String accessToken, String accountName) {
+ @Nullable String accessToken, @NonNull String accountName) {
mActivity = activity;
mExecutor = executor;
mOauthRetrofit = oauthRetrofit;
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 5701960a..a7f17ab2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java
@@ -244,7 +244,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy
public HistoryPostRecyclerViewAdapter(BaseActivity activity, HistoryPostFragment fragment, Executor executor, Retrofit oauthRetrofit,
Retrofit gfycatRetrofit, Retrofit redgifsRetrofit, Provider<StreamableAPI> 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<Recycler
Retrofit retrofit, Retrofit oauthRetrofit, Retrofit gfycatRetrofit,
Retrofit redgifsRetrofit, Provider<StreamableAPI> 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<Post, RecyclerVie
public PostRecyclerViewAdapter(BaseActivity activity, PostFragment fragment, Executor executor, Retrofit oauthRetrofit,
Retrofit gfycatRetrofit, Retrofit redgifsRetrofit, Provider<StreamableAPI> 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<Subred
public SubredditListingRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit, Retrofit retrofit,
CustomThemeWrapper customThemeWrapper,
- String accessToken, String accountName,
+ @Nullable String accessToken, @NonNull String accountName,
RedditDataRoomDatabase redditDataRoomDatabase,
boolean isMultiSelection, Callback callback) {
super(DIFF_CALLBACK);
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 f6f3d597..939807d9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubscribedSubredditsRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubscribedSubredditsRecyclerViewAdapter.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;
@@ -60,7 +61,7 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
public SubscribedSubredditsRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit,
RedditDataRoomDatabase redditDataRoomDatabase,
CustomThemeWrapper customThemeWrapper,
- String accessToken, String accountName) {
+ @Nullable String accessToken, @NonNull String accountName) {
mActivity = activity;
mExecutor = executor;
glide = Glide.with(activity);
@@ -75,7 +76,7 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
public SubscribedSubredditsRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit,
RedditDataRoomDatabase redditDataRoomDatabase,
CustomThemeWrapper customThemeWrapper,
- String accessToken, String accountName, boolean hasClearSelectionRow,
+ @Nullable String accessToken, @NonNull String accountName, boolean hasClearSelectionRow,
ItemClickListener itemClickListener) {
this(activity, executor, oauthRetrofit, redditDataRoomDatabase, customThemeWrapper, accessToken, accountName);
this.hasClearSelectionRow = hasClearSelectionRow;
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 1ca779ac..6c12336d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.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;
@@ -74,8 +75,8 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R
private final Callback callback;
public UserListingRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit, Retrofit retrofit,
- CustomThemeWrapper customThemeWrapper, String accessToken,
- String accountName, RedditDataRoomDatabase redditDataRoomDatabase,
+ CustomThemeWrapper customThemeWrapper, @Nullable String accessToken,
+ @NonNull String accountName, RedditDataRoomDatabase redditDataRoomDatabase,
boolean isMultiSelection, Callback callback) {
super(DIFF_CALLBACK);
this.activity = activity;
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 be4b158d..4eda8e4d 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
@@ -51,7 +51,7 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
private boolean hideKarma;
public HeaderSectionRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper,
- RequestManager glide, String accountName,
+ RequestManager glide, @NonNull String accountName,
SharedPreferences sharedPreferences,
SharedPreferences navigationDrawerSharedPreferences,
SharedPreferences securitySharedPreferences,
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 3084ffc3..8e6ef6e5 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
@@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.adapters.navigationdrawer;
import android.content.SharedPreferences;
+import androidx.annotation.NonNull;
import androidx.recyclerview.widget.ConcatAdapter;
import com.bumptech.glide.Glide;
@@ -30,7 +31,7 @@ public class NavigationDrawerRecyclerViewMergedAdapter {
SharedPreferences navigationDrawerSharedPreferences,
SharedPreferences securitySharedPreferences,
CustomThemeWrapper customThemeWrapper,
- String accountName,
+ @NonNull String accountName,
ItemClickListener itemClickListener) {
RequestManager glide = Glide.with(baseActivity);
@@ -142,6 +143,6 @@ public class NavigationDrawerRecyclerViewMergedAdapter {
public interface ItemClickListener {
void onMenuClick(int stringId);
void onSubscribedSubredditClick(String subredditName);
- void onAccountClick(String accountName);
+ void onAccountClick(@NonNull String accountName);
}
}
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 b4a969a6..b6538166 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
@@ -37,7 +37,7 @@ public class PreferenceSectionRecyclerViewAdapter extends RecyclerView.Adapter<R
private NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener;
public PreferenceSectionRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper,
- String accountName, SharedPreferences nsfwAndSpoilerSharedPreferences,
+ @NonNull String accountName, SharedPreferences nsfwAndSpoilerSharedPreferences,
SharedPreferences navigationDrawerSharedPreferences,
NavigationDrawerRecyclerViewMergedAdapter.ItemClickListener itemClickListener) {
this.baseActivity = baseActivity;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsFollowingUser.java b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsFollowingUser.java
index f4e34ce3..94674bad 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsFollowingUser.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/CheckIsFollowingUser.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.subscribeduser.SubscribedUserData;
public class CheckIsFollowingUser {
public static void checkIsFollowingUser(Executor executor, Handler handler,
RedditDataRoomDatabase redditDataRoomDatabase, String username,
- String accountName, CheckIsFollowingUserListener checkIsFollowingUserListener) {
+ @NonNull String accountName, CheckIsFollowingUserListener checkIsFollowingUserListener) {
executor.execute(() -> {
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)) {