aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-10-04 20:29:11 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-10-04 20:29:11 +0000
commitde4eab7e9c29407488ae00037ddb1b84e5a38290 (patch)
treea533bc4ae1d015fae35fbbcd610e2367352f4a38 /app/src/main
parent8bc25e4b87a264c778099d9f514ad2d7478776fb (diff)
downloadinfinity-for-reddit-de4eab7e9c29407488ae00037ddb1b84e5a38290.tar
infinity-for-reddit-de4eab7e9c29407488ae00037ddb1b84e5a38290.tar.gz
infinity-for-reddit-de4eab7e9c29407488ae00037ddb1b84e5a38290.tar.bz2
infinity-for-reddit-de4eab7e9c29407488ae00037ddb1b84e5a38290.tar.lz
infinity-for-reddit-de4eab7e9c29407488ae00037ddb1b84e5a38290.tar.xz
infinity-for-reddit-de4eab7e9c29407488ae00037ddb1b84e5a38290.tar.zst
infinity-for-reddit-de4eab7e9c29407488ae00037ddb1b84e5a38290.zip
Load more items in a single call.
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java52
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java8
3 files changed, 33 insertions, 31 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
index 41d44d38..a85d5078 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
@@ -54,19 +54,19 @@ public interface RedditAPI {
@GET("user/{username}/about.json?raw_json=1")
Call<String> getUserData(@Path("username") String username);
- @GET("user/{username}/about.json?raw_json=1")
+ @GET("user/{username}/about.json?raw_json=1&limit=100")
Call<String> getUserDataOauth(@HeaderMap Map<String, String> headers, @Path("username") String username);
- @GET("user/{username}/comments.json?raw_json=1")
+ @GET("user/{username}/comments.json?raw_json=1&limit=100")
Call<String> getUserComments(@Path("username") String username, @Query("after") String after,
@Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime);
- @GET("user/{username}/comments.json?raw_json=1")
+ @GET("user/{username}/comments.json?raw_json=1&limit=100")
Call<String> getUserCommentsOauth(@HeaderMap Map<String, String> headers, @Path("username") String username,
@Query("after") String after, @Query("sort") SortType.Type sortType,
@Query("t") SortType.Time sortTime);
- @GET("user/{username}/{where}.json?&type=comments&raw_json=1&limit=25")
+ @GET("user/{username}/{where}.json?&type=comments&raw_json=1&limit=100")
Call<String> getUserSavedCommentsOauth(@Path("username") String username, @Path("where") String where,
@Query("after") String lastItem, @Query("sort") SortType.Type sortType,
@Query("t") SortType.Time sortTime, @HeaderMap Map<String, String> headers);
@@ -273,108 +273,108 @@ public interface RedditAPI {
@GET("/r/{subredditName}/wiki/{wikiPage}.json?raw_json=1")
Call<String> getWikiPage(@Path("subredditName") String subredditName, @Path("wikiPage") String wikiPage);
- @GET("{sortType}?raw_json=1")
+ @GET("{sortType}?raw_json=1&limit=100")
ListenableFuture<Response<String>> getBestPostsListenableFuture(@Path("sortType") SortType.Type sortType, @Query("t") SortType.Time sortTime,
@Query("after") String lastItem, @HeaderMap Map<String, String> headers);
- @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=25&always_show_media=1")
+ @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=100&always_show_media=1")
ListenableFuture<Response<String>> getSubredditBestPostsOauthListenableFuture(@Path("subredditName") String subredditName, @Path("sortType") SortType.Type sortType,
@Query("t") SortType.Time sortTime, @Query("after") String lastItem,
@HeaderMap Map<String, String> headers);
- @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=25&always_show_media=1")
+ @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=100&always_show_media=1")
ListenableFuture<Response<String>> getSubredditBestPostsListenableFuture(@Path("subredditName") String subredditName, @Path("sortType") SortType.Type sortType,
@Query("t") SortType.Time sortTime, @Query("after") String lastItem);
- @GET("user/{username}/{where}.json?&type=links&raw_json=1&limit=25")
+ @GET("user/{username}/{where}.json?&type=links&raw_json=1&limit=100")
ListenableFuture<Response<String>> getUserPostsOauthListenableFuture(@Path("username") String username, @Path("where") String where,
@Query("after") String lastItem, @Query("sort") SortType.Type sortType,
@Query("t") SortType.Time sortTime, @HeaderMap Map<String, String> headers);
- @GET("user/{username}/submitted.json?raw_json=1&limit=25")
+ @GET("user/{username}/submitted.json?raw_json=1&limit=100")
ListenableFuture<Response<String>> getUserPostsListenableFuture(@Path("username") String username, @Query("after") String lastItem,
@Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime);
- @GET("search.json?include_over_18=1&raw_json=1&type=link")
+ @GET("search.json?include_over_18=1&raw_json=1&limit=100&type=link")
ListenableFuture<Response<String>> searchPostsOauthListenableFuture(@Query("q") String query, @Query("after") String after,
@Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime,
@Query("source") String source,
@HeaderMap Map<String, String> headers);
- @GET("search.json?include_over_18=1&raw_json=1&type=link")
+ @GET("search.json?include_over_18=1&raw_json=1&limit=100&type=link")
ListenableFuture<Response<String>> searchPostsListenableFuture(@Query("q") String query, @Query("after") String after,
@Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime,
@Query("source") String source);
- @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&type=link&restrict_sr=true")
+ @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&limit=100&type=link&restrict_sr=true")
ListenableFuture<Response<String>> searchPostsInSpecificSubredditOauthListenableFuture(@Path("subredditName") String subredditName,
@Query("q") String query, @Query("sort") SortType.Type sort,
@Query("t") SortType.Time sortTime, @Query("after") String after,
@HeaderMap Map<String, String> headers);
- @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&type=link&restrict_sr=true")
+ @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&limit=100&type=link&restrict_sr=true")
ListenableFuture<Response<String>> searchPostsInSpecificSubredditListenableFuture(@Path("subredditName") String subredditName,
@Query("q") String query, @Query("sort") SortType.Type sort,
@Query("t") SortType.Time sortTime, @Query("after") String after);
- @GET("{multipath}?raw_json=1")
+ @GET("{multipath}?raw_json=1&limit=100")
ListenableFuture<Response<String>> getMultiRedditPostsListenableFuture(@Path(value = "multipath", encoded = true) String multiPath,
@Query("after") String after, @Query("t") SortType.Time sortTime);
- @GET("{multipath}.json?raw_json=1")
+ @GET("{multipath}.json?raw_json=1&limit=100")
ListenableFuture<Response<String>> getMultiRedditPostsOauthListenableFuture(@Path(value = "multipath", encoded = true) String multiPath,
@Query("after") String after, @Query("t") SortType.Time sortTime,
@HeaderMap Map<String, String> headers);
- @GET("{sortType}?raw_json=1")
+ @GET("{sortType}?raw_json=1&limit=100")
Call<String> getBestPosts(@Path("sortType") SortType.Type sortType, @Query("t") SortType.Time sortTime,
@Query("after") String lastItem, @HeaderMap Map<String, String> headers);
- @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=25&always_show_media=1")
+ @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=100&always_show_media=1")
Call<String> getSubredditBestPostsOauth(@Path("subredditName") String subredditName, @Path("sortType") SortType.Type sortType,
@Query("t") SortType.Time sortTime, @Query("after") String lastItem,
@HeaderMap Map<String, String> headers);
- @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=25&always_show_media=1")
+ @GET("r/{subredditName}/{sortType}.json?raw_json=1&limit=100&always_show_media=1")
Call<String> getSubredditBestPosts(@Path("subredditName") String subredditName, @Path("sortType") SortType.Type sortType,
@Query("t") SortType.Time sortTime, @Query("after") String lastItem);
- @GET("user/{username}/{where}.json?&type=links&raw_json=1&limit=25")
+ @GET("user/{username}/{where}.json?&type=links&raw_json=1&limit=100")
Call<String> getUserPostsOauth(@Path("username") String username, @Path("where") String where,
@Query("after") String lastItem, @Query("sort") SortType.Type sortType,
@Query("t") SortType.Time sortTime, @HeaderMap Map<String, String> headers);
- @GET("user/{username}/submitted.json?raw_json=1&limit=25")
+ @GET("user/{username}/submitted.json?raw_json=1&limit=100")
Call<String> getUserPosts(@Path("username") String username, @Query("after") String lastItem,
@Query("sort") SortType.Type sortType, @Query("t") SortType.Time sortTime);
- @GET("search.json?include_over_18=1&raw_json=1&type=link")
+ @GET("search.json?include_over_18=1&raw_json=1&limit=100&type=link")
Call<String> searchPostsOauth(@Query("q") String query, @Query("after") String after,
@Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime,
@Query("source") String source,
@HeaderMap Map<String, String> headers);
- @GET("search.json?include_over_18=1&raw_json=1&type=link")
+ @GET("search.json?include_over_18=1&raw_json=1&limit=100&type=link")
Call<String> searchPosts(@Query("q") String query, @Query("after") String after,
@Query("sort") SortType.Type sort, @Query("t") SortType.Time sortTime,
@Query("source") String source);
- @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&type=link&restrict_sr=true")
+ @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&limit=100&type=link&restrict_sr=true")
Call<String> searchPostsInSpecificSubredditOauth(@Path("subredditName") String subredditName,
@Query("q") String query, @Query("sort") SortType.Type sort,
@Query("t") SortType.Time sortTime, @Query("after") String after,
@HeaderMap Map<String, String> headers);
- @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&type=link&restrict_sr=true")
+ @GET("r/{subredditName}/search.json?include_over_18=1&raw_json=1&limit=100&type=link&restrict_sr=true")
Call<String> searchPostsInSpecificSubreddit(@Path("subredditName") String subredditName,
@Query("q") String query, @Query("sort") SortType.Type sort,
@Query("t") SortType.Time sortTime, @Query("after") String after);
- @GET("{multipath}?raw_json=1")
+ @GET("{multipath}?raw_json=1&limit=100")
Call<String> getMultiRedditPosts(@Path(value = "multipath", encoded = true) String multiPath,
@Query("after") String after, @Query("t") SortType.Time sortTime);
- @GET("{multipath}.json?raw_json=1")
+ @GET("{multipath}.json?raw_json=1&limit=100")
Call<String> getMultiRedditPostsOauth(@Path(value = "multipath", encoded = true) String multiPath,
@Query("after") String after, @Query("t") SortType.Time sortTime,
@HeaderMap Map<String, String> headers);
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 de9f246b..e6ccd0ca 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/CommentViewModel.java
@@ -40,7 +40,9 @@ public class CommentViewModel extends ViewModel {
PagedList.Config pagedListConfig =
(new PagedList.Config.Builder())
.setEnablePlaceholders(false)
- .setPageSize(25)
+ .setPageSize(100)
+ .setPrefetchDistance(10)
+ .setInitialLoadSizeHint(10)
.build();
comments = Transformations.switchMap(sortTypeLiveData, sort -> {
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 b1d32cf6..acb13de1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java
@@ -70,7 +70,7 @@ public class PostViewModel extends ViewModel {
sortTypeAndPostFilterLiveData = new SortTypeAndPostFilterLiveData(sortTypeLiveData, postFilterLiveData);
- Pager<String, Post> pager = new Pager<>(new PagingConfig(25, 4, false, 1), this::returnPagingSoruce);
+ Pager<String, Post> pager = new Pager<>(new PagingConfig(100, 4, false, 10), this::returnPagingSoruce);
posts = Transformations.switchMap(sortTypeAndPostFilterLiveData, sortAndPostFilter -> {
changeSortTypeAndPostFilter(
@@ -110,7 +110,7 @@ public class PostViewModel extends ViewModel {
sortTypeAndPostFilterLiveData = new SortTypeAndPostFilterLiveData(sortTypeLiveData, postFilterLiveData);
- Pager<String, Post> pager = new Pager<>(new PagingConfig(25, 4, false, 1), this::returnPagingSoruce);
+ Pager<String, Post> pager = new Pager<>(new PagingConfig(100, 4, false, 10), this::returnPagingSoruce);
posts = Transformations.switchMap(sortTypeAndPostFilterLiveData, sortAndPostFilter -> {
changeSortTypeAndPostFilter(
@@ -153,7 +153,7 @@ public class PostViewModel extends ViewModel {
sortTypeAndPostFilterLiveData = new SortTypeAndPostFilterLiveData(sortTypeLiveData, postFilterLiveData);
- Pager<String, Post> pager = new Pager<>(new PagingConfig(25, 4, false, 1), this::returnPagingSoruce);
+ Pager<String, Post> pager = new Pager<>(new PagingConfig(100, 4, false, 10), this::returnPagingSoruce);
posts = Transformations.switchMap(sortTypeAndPostFilterLiveData, sortAndPostFilter -> {
changeSortTypeAndPostFilter(
@@ -196,7 +196,7 @@ public class PostViewModel extends ViewModel {
sortTypeAndPostFilterLiveData = new SortTypeAndPostFilterLiveData(sortTypeLiveData, postFilterLiveData);
- Pager<String, Post> pager = new Pager<>(new PagingConfig(25, 4, false, 1), this::returnPagingSoruce);
+ Pager<String, Post> pager = new Pager<>(new PagingConfig(100, 4, false, 10), this::returnPagingSoruce);
posts = Transformations.switchMap(sortTypeAndPostFilterLiveData, sortAndPostFilter -> {
changeSortTypeAndPostFilter(