aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-01-03 15:20:06 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-01-03 15:20:06 +0000
commit255e052300341f070f078bd901cc70a47ffa6564 (patch)
treebd842cbb8daa78dcfc08408f5c8abf1ccff6e2a4 /app/src/main
parentbcdc70d5bd089158b1faed9b856515031c08eae0 (diff)
downloadinfinity-for-reddit-255e052300341f070f078bd901cc70a47ffa6564.tar
infinity-for-reddit-255e052300341f070f078bd901cc70a47ffa6564.tar.gz
infinity-for-reddit-255e052300341f070f078bd901cc70a47ffa6564.tar.bz2
infinity-for-reddit-255e052300341f070f078bd901cc70a47ffa6564.tar.lz
infinity-for-reddit-255e052300341f070f078bd901cc70a47ffa6564.tar.xz
infinity-for-reddit-255e052300341f070f078bd901cc70a47ffa6564.tar.zst
infinity-for-reddit-255e052300341f070f078bd901cc70a47ffa6564.zip
@Nullable accessToken and @NonNull accountName.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteMultiredditInDatabase.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/InsertMultireddit.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSource.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSourceFactory.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/DeleteMultiReddit.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/FetchPost.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostPagingSource.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostViewModel.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java16
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java23
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java19
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java13
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/EditProfileUtils.java21
17 files changed, 75 insertions, 64 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
index d29d92a8..2b047074 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
@@ -93,7 +93,6 @@ import ml.docilealligator.infinityforreddit.FetchStreamableVideo;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.StreamableVideo;
-import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.apis.StreamableAPI;
import ml.docilealligator.infinityforreddit.apis.VReddIt;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PlaybackSpeedBottomSheetFragment;
@@ -793,7 +792,6 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
int commentsIndex = segments.lastIndexOf("comments");
String postId = segments.get(commentsIndex + 1);
FetchPost.fetchPost(mExecutor, new Handler(), retrofit, postId, null,
- mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, Account.ANONYMOUS_ACCOUNT),
new FetchPost.FetchPostListener() {
@Override
public void fetchPostSuccess(Post post) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteMultiredditInDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteMultiredditInDatabase.java
index bc871fe0..58a115da 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteMultiredditInDatabase.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteMultiredditInDatabase.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 @@ public class DeleteMultiredditInDatabase {
public static void deleteMultiredditInDatabase(Executor executor, Handler handler,
RedditDataRoomDatabase redditDataRoomDatabase,
- String accountName, String multipath,
+ @NonNull String accountName, String multipath,
DeleteMultiredditInDatabaseListener deleteMultiredditInDatabaseListener) {
executor.execute(() -> {
if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/InsertMultireddit.java b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/InsertMultireddit.java
index ff3b2712..71ceda74 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/InsertMultireddit.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/InsertMultireddit.java
@@ -2,6 +2,8 @@ package ml.docilealligator.infinityforreddit.asynctasks;
import android.os.Handler;
+import androidx.annotation.NonNull;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -16,7 +18,7 @@ import ml.docilealligator.infinityforreddit.multireddit.MultiRedditDao;
public class InsertMultireddit {
public static void insertMultireddits(Executor executor, Handler handler, RedditDataRoomDatabase redditDataRoomDatabase,
- ArrayList<MultiReddit> multiReddits, String accountName,
+ ArrayList<MultiReddit> multiReddits, @NonNull String accountName,
InsertMultiRedditListener insertMultiRedditListener) {
executor.execute(() -> {
MultiRedditDao multiRedditDao = redditDataRoomDatabase.multiRedditDao();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSource.java
index 3c648a75..d4f312b1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSource.java
@@ -44,7 +44,7 @@ public class CommentDataSource extends PageKeyedDataSource<String, Comment> {
private LoadParams<String> params;
private LoadCallback<String, Comment> callback;
- CommentDataSource(Retrofit retrofit, Locale locale, @Nullable String accessToken, @Nullable String accountName,
+ CommentDataSource(Retrofit retrofit, Locale locale, @Nullable String accessToken, @NonNull String accountName,
String username, SortType sortType,
boolean areSavedComments) {
this.retrofit = retrofit;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSourceFactory.java
index b55772b7..5ea1a489 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSourceFactory.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentDataSourceFactory.java
@@ -22,7 +22,7 @@ class CommentDataSourceFactory extends DataSource.Factory {
private CommentDataSource commentDataSource;
private MutableLiveData<CommentDataSource> commentDataSourceLiveData;
- CommentDataSourceFactory(Retrofit retrofit, Locale locale, @Nullable String accessToken, String accountName,
+ CommentDataSourceFactory(Retrofit retrofit, Locale locale, @Nullable String accessToken, @NonNull String accountName,
String username, SortType sortType,
boolean areSavedComments) {
this.retrofit = retrofit;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java
index eeabfd49..b9472bc0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java
@@ -1,6 +1,7 @@
package ml.docilealligator.infinityforreddit.comment;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Transformations;
@@ -23,7 +24,7 @@ public class CommentViewModel extends ViewModel {
private LiveData<PagedList<Comment>> comments;
private MutableLiveData<SortType> sortTypeLiveData;
- public CommentViewModel(Retrofit retrofit, Locale locale, String accessToken, String accountName,
+ public CommentViewModel(Retrofit retrofit, Locale locale, @Nullable String accessToken, @NonNull String accountName,
String username, SortType sortType, boolean areSavedComments) {
commentDataSourceFactory = new CommentDataSourceFactory(retrofit, locale, accessToken, accountName,
username, sortType, areSavedComments);
@@ -88,7 +89,7 @@ public class CommentViewModel extends ViewModel {
private SortType sortType;
private boolean areSavedComments;
- public Factory(Retrofit retrofit, Locale locale, String accessToken, String accountName, String username,
+ public Factory(Retrofit retrofit, Locale locale, @Nullable String accessToken, @NonNull String accountName, String username,
SortType sortType, boolean areSavedComments) {
this.retrofit = retrofit;
this.locale = locale;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
index 8093fb1f..5f58a717 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
@@ -1608,7 +1608,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
if (fetchPost) {
FetchPost.fetchPost(mExecutor, new Handler(), mOauthRetrofit, mPost.getId(), mAccessToken,
- mAccountName, new FetchPost.FetchPostListener() {
+ new FetchPost.FetchPostListener() {
@Override
public void fetchPostSuccess(Post post) {
if (isAdded()) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/DeleteMultiReddit.java b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/DeleteMultiReddit.java
index 9ccdbb92..29fdc836 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/DeleteMultiReddit.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/DeleteMultiReddit.java
@@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.multireddit;
import android.os.Handler;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import java.util.concurrent.Executor;
@@ -24,7 +25,7 @@ public class DeleteMultiReddit {
public static void deleteMultiReddit(Executor executor, Handler handler, Retrofit oauthRetrofit,
RedditDataRoomDatabase redditDataRoomDatabase,
- String accessToken, String accountName, String multipath,
+ @Nullable String accessToken, @NonNull String accountName, String multipath,
DeleteMultiRedditListener deleteMultiRedditListener) {
oauthRetrofit.create(RedditAPI.class).deleteMultiReddit(APIUtils.getOAuthHeader(accessToken),
multipath).enqueue(new Callback<>() {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/FetchPost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/FetchPost.java
index 0b34612c..ef25931a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/FetchPost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/FetchPost.java
@@ -16,7 +16,7 @@ import retrofit2.Retrofit;
public class FetchPost {
public static void fetchPost(Executor executor, Handler handler, Retrofit retrofit, String id,
- @Nullable String accessToken, String accountName,
+ @Nullable String accessToken,
FetchPostListener fetchPostListener) {
Call<String> postCall = retrofit.create(RedditAPI.class).getPostOauth(id, APIUtils.getOAuthHeader(accessToken));
postCall.enqueue(new Callback<>() {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostPagingSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostPagingSource.java
index 5ca25ada..e76d8eb0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostPagingSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostPagingSource.java
@@ -3,14 +3,13 @@ package ml.docilealligator.infinityforreddit.post;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.paging.ListenableFuturePagingSource;
import androidx.paging.PagingState;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-import org.jetbrains.annotations.Nullable;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@@ -41,7 +40,7 @@ public class HistoryPostPagingSource extends ListenableFuturePagingSource<String
private PostFilter postFilter;
public HistoryPostPagingSource(Retrofit retrofit, Executor executor, RedditDataRoomDatabase redditDataRoomDatabase,
- String accessToken, String accountName, SharedPreferences sharedPreferences,
+ @Nullable String accessToken, @NonNull String accountName, SharedPreferences sharedPreferences,
String username, int postType, PostFilter postFilter) {
this.retrofit = retrofit;
this.executor = executor;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostViewModel.java
index 4629ab5a..58e8ba24 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostViewModel.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/HistoryPostViewModel.java
@@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.post;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Transformations;
@@ -35,7 +36,7 @@ public class HistoryPostViewModel extends ViewModel {
private MutableLiveData<PostFilter> postFilterLiveData;
public HistoryPostViewModel(Executor executor, Retrofit retrofit, RedditDataRoomDatabase redditDataRoomDatabase,
- String accessToken, String accountName, SharedPreferences sharedPreferences,
+ @Nullable String accessToken, @NonNull String accountName, SharedPreferences sharedPreferences,
int postType, PostFilter postFilter) {
this.executor = executor;
this.retrofit = retrofit;
@@ -87,7 +88,7 @@ public class HistoryPostViewModel extends ViewModel {
private PostFilter postFilter;
public Factory(Executor executor, Retrofit retrofit, RedditDataRoomDatabase redditDataRoomDatabase,
- String accessToken, String accountName, SharedPreferences sharedPreferences, int postType,
+ @Nullable String accessToken, @NonNull String accountName, SharedPreferences sharedPreferences, int postType,
PostFilter postFilter) {
this.executor = executor;
this.retrofit = retrofit;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
index a6b14dbb..3b32864a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
@@ -3,14 +3,13 @@ package ml.docilealligator.infinityforreddit.post;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.paging.ListenableFuturePagingSource;
import androidx.paging.PagingState;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-import org.jetbrains.annotations.Nullable;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@@ -60,7 +59,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
private LinkedHashSet<Post> postLinkedHashSet;
private String previousLastItem;
- PostPagingSource(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ PostPagingSource(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences,
SharedPreferences postFeedScrolledPositionSharedPreferences, int postType,
SortType sortType, PostFilter postFilter, List<String> readPostList) {
@@ -77,7 +76,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
postLinkedHashSet = new LinkedHashSet<>();
}
- PostPagingSource(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ PostPagingSource(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
String path, int postType, SortType sortType, PostFilter postFilter,
List<String> readPostList) {
@@ -115,7 +114,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
postLinkedHashSet = new LinkedHashSet<>();
}
- PostPagingSource(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ PostPagingSource(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
String subredditOrUserName, int postType, SortType sortType, PostFilter postFilter,
String where, List<String> readPostList) {
@@ -134,7 +133,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
postLinkedHashSet = new LinkedHashSet<>();
}
- PostPagingSource(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ PostPagingSource(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
String subredditOrUserName, String query, String trendingSource, int postType,
SortType sortType, PostFilter postFilter, List<String> readPostList) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java
index 7822a8a7..17fda376 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java
@@ -51,7 +51,7 @@ public class PostViewModel extends ViewModel {
private MutableLiveData<PostFilter> postFilterLiveData;
private SortTypeAndPostFilterLiveData sortTypeAndPostFilterLiveData;
- public PostViewModel(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ public PostViewModel(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
@Nullable SharedPreferences postHistorySharedPreferences, int postType,
SortType sortType, PostFilter postFilter, List<String> readPostList) {
@@ -90,7 +90,7 @@ public class PostViewModel extends ViewModel {
&& postHistorySharedPreferences.getBoolean((accountName.equals(Account.ANONYMOUS_ACCOUNT) ? "" : accountName) + SharedPreferencesUtils.HIDE_READ_POSTS_AUTOMATICALLY_BASE, false));
}
- public PostViewModel(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ public PostViewModel(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
@Nullable SharedPreferences postHistorySharedPreferences, String subredditName, int postType,
SortType sortType, PostFilter postFilter, List<String> readPostList) {
@@ -130,7 +130,7 @@ public class PostViewModel extends ViewModel {
&& postHistorySharedPreferences.getBoolean((accountName.equals(Account.ANONYMOUS_ACCOUNT) ? "" : accountName) + SharedPreferencesUtils.HIDE_READ_POSTS_AUTOMATICALLY_BASE, false));
}
- public PostViewModel(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ public PostViewModel(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences,
SharedPreferences postFeedScrolledPositionSharedPreferences,
@Nullable SharedPreferences postHistorySharedPreferences, String username,
@@ -173,7 +173,7 @@ public class PostViewModel extends ViewModel {
&& postHistorySharedPreferences.getBoolean((accountName.equals(Account.ANONYMOUS_ACCOUNT) ? "" : accountName) + SharedPreferencesUtils.HIDE_READ_POSTS_AUTOMATICALLY_BASE, false));
}
- public PostViewModel(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ public PostViewModel(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
@Nullable SharedPreferences postHistorySharedPreferences, String subredditName, String query,
String trendingSource, int postType, SortType sortType, PostFilter postFilter,
@@ -284,7 +284,7 @@ public class PostViewModel extends ViewModel {
private String userWhere;
private List<String> readPostList;
- public Factory(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ public Factory(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
SharedPreferences postHistorySharedPreferences, int postType, SortType sortType,
PostFilter postFilter, List<String> readPostList) {
@@ -301,7 +301,7 @@ public class PostViewModel extends ViewModel {
this.readPostList = readPostList;
}
- public Factory(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ public Factory(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
SharedPreferences postHistorySharedPreferences, String name, int postType, SortType sortType,
PostFilter postFilter, List<String> readPostList) {
@@ -320,7 +320,7 @@ public class PostViewModel extends ViewModel {
}
//User posts
- public Factory(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ public Factory(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
SharedPreferences postHistorySharedPreferences, String username, int postType,
SortType sortType, PostFilter postFilter, String where, List<String> readPostList) {
@@ -339,7 +339,7 @@ public class PostViewModel extends ViewModel {
this.readPostList = readPostList;
}
- public Factory(Executor executor, Retrofit retrofit, String accessToken, String accountName,
+ public Factory(Executor executor, Retrofit retrofit, @Nullable String accessToken, @NonNull String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
SharedPreferences postHistorySharedPreferences, String name, String query, String trendingSource,
int postType, SortType sortType, PostFilter postFilter, List<String> readPostList) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java
index e93d16d2..c344079c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java
@@ -13,12 +13,24 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
+
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationChannelCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
+
import com.bumptech.glide.Glide;
+
+import org.greenrobot.eventbus.EventBus;
+
+import java.io.FileNotFoundException;
+import java.util.Random;
+import java.util.concurrent.ExecutionException;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
import jp.wasabeef.glide.transformations.CropTransformation;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
@@ -28,15 +40,8 @@ import ml.docilealligator.infinityforreddit.events.SubmitChangeBannerEvent;
import ml.docilealligator.infinityforreddit.events.SubmitSaveProfileEvent;
import ml.docilealligator.infinityforreddit.utils.EditProfileUtils;
import ml.docilealligator.infinityforreddit.utils.NotificationUtils;
-import org.greenrobot.eventbus.EventBus;
import retrofit2.Retrofit;
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.FileNotFoundException;
-import java.util.Random;
-import java.util.concurrent.ExecutionException;
-
public class EditProfileService extends Service {
public static final String EXTRA_ACCESS_TOKEN = "EAT";
public static final String EXTRA_ACCOUNT_NAME = "EAN";
@@ -172,8 +177,8 @@ public class EditProfileService extends Service {
}
}
- private void submitSaveEditProfile(String accessToken,
- String accountName,
+ private void submitSaveEditProfile(@Nullable String accessToken,
+ @NonNull String accountName,
String displayName,
String publicDesc
) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java
index b6d9ccf1..71372ade 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java
@@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.subreddit;
import android.os.Handler;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
@@ -19,10 +20,10 @@ import retrofit2.Retrofit;
public class SubredditSubscription {
public static void subscribeToSubreddit(Executor executor, Handler handler, Retrofit oauthRetrofit,
- Retrofit retrofit, String accessToken, String subredditName,
- String accountName, RedditDataRoomDatabase redditDataRoomDatabase,
+ Retrofit retrofit, @Nullable String accessToken, String subredditName,
+ @NonNull String accountName, RedditDataRoomDatabase redditDataRoomDatabase,
SubredditSubscriptionListener subredditSubscriptionListener) {
- subredditSubscription(executor, handler, oauthRetrofit, retrofit, accessToken, subredditName,
+ subredditSubscription(executor, handler, oauthRetrofit, accessToken, subredditName,
accountName, "sub", redditDataRoomDatabase, subredditSubscriptionListener);
}
@@ -45,10 +46,10 @@ public class SubredditSubscription {
}
public static void unsubscribeToSubreddit(Executor executor, Handler handler, Retrofit oauthRetrofit,
- String accessToken, String subredditName, String accountName,
+ @Nullable String accessToken, String subredditName, @NonNull String accountName,
RedditDataRoomDatabase redditDataRoomDatabase,
SubredditSubscriptionListener subredditSubscriptionListener) {
- subredditSubscription(executor, handler, oauthRetrofit, null, accessToken, subredditName,
+ subredditSubscription(executor, handler, oauthRetrofit, accessToken, subredditName,
accountName, "unsub", redditDataRoomDatabase, subredditSubscriptionListener);
}
@@ -60,8 +61,8 @@ public class SubredditSubscription {
}
private static void subredditSubscription(Executor executor, Handler handler, Retrofit oauthRetrofit,
- Retrofit retrofit, String accessToken, String subredditName,
- String accountName, String action,
+ @Nullable String accessToken, String subredditName,
+ @NonNull String accountName, String action,
RedditDataRoomDatabase redditDataRoomDatabase,
SubredditSubscriptionListener subredditSubscriptionListener) {
RedditAPI api = oauthRetrofit.create(RedditAPI.class);
@@ -112,7 +113,7 @@ public class SubredditSubscription {
private static void insertSubscription(Executor executor, Handler handler,
RedditDataRoomDatabase redditDataRoomDatabase,
- SubredditData subredditData, String accountName,
+ SubredditData subredditData, @NonNull String accountName,
SubredditSubscriptionListener subredditSubscriptionListener) {
executor.execute(() -> {
SubscribedSubredditData subscribedSubredditData = new SubscribedSubredditData(subredditData.getId(), subredditData.getName(),
@@ -129,7 +130,7 @@ public class SubredditSubscription {
private static void removeSubscription(Executor executor, Handler handler,
RedditDataRoomDatabase redditDataRoomDatabase,
- String subredditName, String accountName,
+ String subredditName, @NonNull String accountName,
SubredditSubscriptionListener subredditSubscriptionListener) {
executor.execute(() -> {
if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java
index b2748f78..05042b3b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java
@@ -4,6 +4,7 @@ import android.os.AsyncTask;
import android.os.Handler;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
@@ -21,7 +22,7 @@ import retrofit2.Retrofit;
public class UserFollowing {
public static void followUser(Retrofit oauthRetrofit, Retrofit retrofit,
- String accessToken, String username, String accountName,
+ @Nullable String accessToken, String username, @NonNull String accountName,
RedditDataRoomDatabase redditDataRoomDatabase,
UserFollowingListener userFollowingListener) {
userFollowing(oauthRetrofit, retrofit, accessToken, username, accountName, "sub",
@@ -53,7 +54,7 @@ public class UserFollowing {
}
public static void unfollowUser(Retrofit oauthRetrofit, Retrofit retrofit,
- String accessToken, String username, String accountName,
+ @Nullable String accessToken, String username, @NonNull String accountName,
RedditDataRoomDatabase redditDataRoomDatabase,
UserFollowingListener userFollowingListener) {
userFollowing(oauthRetrofit, retrofit, accessToken, username, accountName, "unsub",
@@ -70,8 +71,8 @@ public class UserFollowing {
});
}
- private static void userFollowing(Retrofit oauthRetrofit, Retrofit retrofit, String accessToken,
- String username, String accountName, String action, SubscribedUserDao subscribedUserDao,
+ private static void userFollowing(Retrofit oauthRetrofit, Retrofit retrofit, @Nullable String accessToken,
+ String username, @NonNull String accountName, String action, SubscribedUserDao subscribedUserDao,
UserFollowingListener userFollowingListener) {
RedditAPI api = oauthRetrofit.create(RedditAPI.class);
@@ -127,7 +128,7 @@ public class UserFollowing {
private boolean isSubscribing;
UpdateSubscriptionAsyncTask(SubscribedUserDao subscribedUserDao, String username,
- String accountName, boolean isSubscribing) {
+ @NonNull String accountName, boolean isSubscribing) {
this.subscribedUserDao = subscribedUserDao;
this.username = username;
this.accountName = accountName;
@@ -135,7 +136,7 @@ public class UserFollowing {
}
UpdateSubscriptionAsyncTask(SubscribedUserDao subscribedUserDao, UserData userData,
- String accountName, boolean isSubscribing) {
+ @NonNull String accountName, boolean isSubscribing) {
this.subscribedUserDao = subscribedUserDao;
this.subscribedUserData = new SubscribedUserData(userData.getName(), userData.getIconUrl(),
accountName, false);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/EditProfileUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/EditProfileUtils.java
index f66fe648..0eab01ce 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/EditProfileUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/EditProfileUtils.java
@@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.utils;
import android.graphics.Bitmap;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import com.google.gson.Gson;
@@ -26,8 +27,8 @@ import retrofit2.Retrofit;
public final class EditProfileUtils {
public static void updateProfile(Retrofit oauthRetrofit,
- String accessToken,
- String accountName,
+ @Nullable String accessToken,
+ @NonNull String accountName,
String displayName,
String publicDesc,
EditProfileUtilsListener listener) {
@@ -157,8 +158,8 @@ public final class EditProfileUtils {
}
public static void uploadAvatar(Retrofit oauthRetrofit,
- String accessToken,
- String accountName,
+ @Nullable String accessToken,
+ @NonNull String accountName,
Bitmap image,
EditProfileUtilsListener listener) {
oauthRetrofit.create(RedditAPI.class)
@@ -184,8 +185,8 @@ public final class EditProfileUtils {
}
public static void uploadBanner(Retrofit oauthRetrofit,
- String accessToken,
- String accountName,
+ @Nullable String accessToken,
+ @NonNull String accountName,
Bitmap image,
EditProfileUtilsListener listener) {
oauthRetrofit.create(RedditAPI.class)
@@ -211,8 +212,8 @@ public final class EditProfileUtils {
}
public static void deleteAvatar(Retrofit oauthRetrofit,
- String accessToken,
- String accountName,
+ @Nullable String accessToken,
+ @NonNull String accountName,
EditProfileUtilsListener listener) {
oauthRetrofit.create(RedditAPI.class)
.deleteSrIcon(APIUtils.getOAuthHeader(accessToken), "u_" + accountName)
@@ -233,8 +234,8 @@ public final class EditProfileUtils {
}
public static void deleteBanner(Retrofit oauthRetrofit,
- String accessToken,
- String accountName,
+ @Nullable String accessToken,
+ @NonNull String accountName,
EditProfileUtilsListener listener) {
oauthRetrofit.create(RedditAPI.class)
.deleteSrBanner(APIUtils.getOAuthHeader(accessToken), "u_" + accountName)