aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/AndroidManifest.xml90
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/FavoriteThing.java78
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/FetchPostFilterReadPostsAndConcatenatedSubredditNames.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java17
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java39
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java27
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java14
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java106
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java40
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java20
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java27
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java15
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java17
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java27
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/AnonymousMultiredditSubreddit.java53
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/AnonymousMultiredditSubredditDao.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java54
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java21
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPost.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java20
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java20
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/services/MaterialYouService.java25
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java21
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java21
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java37
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java22
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java2
-rw-r--r--app/src/main/res/drawable/ic_keyboard_double_arrow_up_24.xml13
-rw-r--r--app/src/main/res/layout/activity_account_posts.xml2
-rw-r--r--app/src/main/res/layout/activity_anonymous_subscriptions.xml2
-rw-r--r--app/src/main/res/layout/activity_filtered_thing.xml2
-rw-r--r--app/src/main/res/layout/activity_multireddit_selection.xml2
-rw-r--r--app/src/main/res/layout/activity_search_subreddits_result.xml2
-rw-r--r--app/src/main/res/layout/activity_search_users_result.xml2
-rw-r--r--app/src/main/res/layout/activity_settings.xml2
-rw-r--r--app/src/main/res/layout/activity_subreddit_selection.xml2
-rw-r--r--app/src/main/res/layout/activity_view_imgur_media.xml4
-rw-r--r--app/src/main/res/layout/activity_view_multi_reddit_detail.xml2
-rw-r--r--app/src/main/res/layout/activity_view_reddit_gallery.xml4
-rw-r--r--app/src/main/res/menu/view_subreddit_detail_activity.xml6
-rw-r--r--app/src/main/res/values/arrays.xml2
-rw-r--r--app/src/main/res/values/attr.xml3
-rw-r--r--app/src/main/res/values/strings.xml3
70 files changed, 539 insertions, 511 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 78090f43..edad7ed5 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -266,77 +266,35 @@
<activity android:name=".activities.LinkResolverActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
-
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
+ <data android:scheme="https"/>
+ <data android:scheme="http"/>
+
+ <data android:host="www.reddit.com"/>
+ <data android:host="reddit.com"/>
+ <data android:host="v.redd.it"/>
+ <data android:host="amp.reddit.com"/>
+ <data android:host="m.reddit.com"/>
+ <data android:host="old.reddit.com"/>
+ <data android:host="new.reddit.com"/>
+ <data android:host="np.reddit.com"/>
+ <data android:host="reddit.app.link"/>
+ <data android:host="redd.it"/>
+ <data android:host="s.reddit.com"/>
+ <data android:host="click.redditmail.com"/>
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
<data
- android:host="www.reddit.com"
- android:scheme="https" />
- <data
- android:host="reddit.com"
- android:scheme="https" />
- <data
- android:host="amp.reddit.com"
- android:scheme="https" />
- <data
- android:host="m.reddit.com"
- android:scheme="https" />
- <data
- android:host="old.reddit.com"
- android:scheme="https" />
- <data
- android:host="new.reddit.com"
- android:scheme="https" />
- <data
- android:host="np.reddit.com"
- android:scheme="https" />
- <data
- android:host="reddit.app.link"
- android:scheme="https" />
- <data
- android:host="redd.it"
- android:scheme="https" />
- <data
- android:host="s.reddit.com"
- android:scheme="https" />
- <data
- android:host="click.redditmail.com"
- android:scheme="https" />
- <data
- android:host="www.reddit.com"
- android:scheme="http" />
- <data
- android:host="reddit.com"
- android:scheme="http" />
- <data
- android:host="amp.reddit.com"
- android:scheme="http" />
- <data
- android:host="m.reddit.com"
- android:scheme="http" />
- <data
- android:host="old.reddit.com"
- android:scheme="http" />
- <data
- android:host="new.reddit.com"
- android:scheme="http" />
- <data
- android:host="np.reddit.com"
- android:scheme="http" />
- <data
- android:host="reddit.app.link"
- android:scheme="http" />
- <data
- android:host="redd.it"
- android:scheme="http" />
- <data
- android:host="s.reddit.com"
- android:scheme="http" />
- <data
- android:host="click.redditmail.com"
- android:scheme="http" />
+ android:host="www.google.com"
+ android:scheme="https"
+ android:pathPattern="/amp/s/amp.reddit.com/.*" />
</intent-filter>
+
</activity>
<activity
android:name=".activities.SearchActivity"
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FavoriteThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FavoriteThing.java
index 29aace70..81ae4fa3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/FavoriteThing.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FavoriteThing.java
@@ -83,50 +83,60 @@ public class FavoriteThing {
RedditDataRoomDatabase redditDataRoomDatabase,
String accessToken, SubscribedUserData subscribedUserData,
FavoriteThingListener favoriteThingListener) {
- Map<String, String> params = new HashMap<>();
- params.put(APIUtils.SR_NAME_KEY, "u_" + subscribedUserData.getName());
- params.put(APIUtils.MAKE_FAVORITE_KEY, "true");
- oauthRetrofit.create(RedditAPI.class).favoriteThing(APIUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() {
- @Override
- public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
- if (response.isSuccessful()) {
- InsertSubscribedThings.insertSubscribedThings(executor, handler, redditDataRoomDatabase,
- subscribedUserData, favoriteThingListener::success);
- } else {
- favoriteThingListener.failed();
+ if (accessToken == null) {
+ InsertSubscribedThings.insertSubscribedThings(executor, handler, redditDataRoomDatabase,
+ subscribedUserData, favoriteThingListener::success);
+ } else {
+ Map<String, String> params = new HashMap<>();
+ params.put(APIUtils.SR_NAME_KEY, "u_" + subscribedUserData.getName());
+ params.put(APIUtils.MAKE_FAVORITE_KEY, "true");
+ oauthRetrofit.create(RedditAPI.class).favoriteThing(APIUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() {
+ @Override
+ public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
+ if (response.isSuccessful()) {
+ InsertSubscribedThings.insertSubscribedThings(executor, handler, redditDataRoomDatabase,
+ subscribedUserData, favoriteThingListener::success);
+ } else {
+ favoriteThingListener.failed();
+ }
}
- }
- @Override
- public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
- favoriteThingListener.failed();
- }
- });
+ @Override
+ public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
+ favoriteThingListener.failed();
+ }
+ });
+ }
}
public static void unfavoriteUser(Executor executor, Handler handler, Retrofit oauthRetrofit,
RedditDataRoomDatabase redditDataRoomDatabase,
String accessToken, SubscribedUserData subscribedUserData,
FavoriteThingListener favoriteThingListener) {
- Map<String, String> params = new HashMap<>();
- params.put(APIUtils.SR_NAME_KEY, "u_" + subscribedUserData.getName());
- params.put(APIUtils.MAKE_FAVORITE_KEY, "false");
- oauthRetrofit.create(RedditAPI.class).favoriteThing(APIUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() {
- @Override
- public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
- if (response.isSuccessful()) {
- InsertSubscribedThings.insertSubscribedThings(executor, handler, redditDataRoomDatabase,
- subscribedUserData, favoriteThingListener::success);
- } else {
- favoriteThingListener.failed();
+ if (accessToken == null) {
+ InsertSubscribedThings.insertSubscribedThings(executor, handler, redditDataRoomDatabase, subscribedUserData,
+ favoriteThingListener::success);
+ } else {
+ Map<String, String> params = new HashMap<>();
+ params.put(APIUtils.SR_NAME_KEY, "u_" + subscribedUserData.getName());
+ params.put(APIUtils.MAKE_FAVORITE_KEY, "false");
+ oauthRetrofit.create(RedditAPI.class).favoriteThing(APIUtils.getOAuthHeader(accessToken), params).enqueue(new Callback<String>() {
+ @Override
+ public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
+ if (response.isSuccessful()) {
+ InsertSubscribedThings.insertSubscribedThings(executor, handler, redditDataRoomDatabase,
+ subscribedUserData, favoriteThingListener::success);
+ } else {
+ favoriteThingListener.failed();
+ }
}
- }
- @Override
- public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
- favoriteThingListener.failed();
- }
- });
+ @Override
+ public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
+ favoriteThingListener.failed();
+ }
+ });
+ }
}
public interface FavoriteThingListener {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPostFilterReadPostsAndConcatenatedSubredditNames.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPostFilterReadPostsAndConcatenatedSubredditNames.java
index 328a2e52..468a1ce2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPostFilterReadPostsAndConcatenatedSubredditNames.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPostFilterReadPostsAndConcatenatedSubredditNames.java
@@ -12,7 +12,7 @@ import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubred
public class FetchPostFilterReadPostsAndConcatenatedSubredditNames {
public interface FetchPostFilterAndReadPostsListener {
- void success(PostFilter postFilter, ArrayList<ReadPost> readPostList);
+ void success(PostFilter postFilter, ArrayList<String> readPostList);
}
public interface FetchPostFilterAndConcatenatecSubredditNamesListener {
@@ -26,8 +26,12 @@ public class FetchPostFilterReadPostsAndConcatenatedSubredditNames {
List<PostFilter> postFilters = redditDataRoomDatabase.postFilterDao().getValidPostFilters(postFilterUsage, nameOfUsage);
PostFilter mergedPostFilter = PostFilter.mergePostFilter(postFilters);
if (accountName != null) {
- ArrayList<ReadPost> readPosts = (ArrayList<ReadPost>) redditDataRoomDatabase.readPostDao().getAllReadPosts(accountName);
- handler.post(() -> fetchPostFilterAndReadPostsListener.success(mergedPostFilter, readPosts));
+ List<ReadPost> readPosts = redditDataRoomDatabase.readPostDao().getAllReadPosts(accountName);
+ ArrayList<String> readPostStrings = new ArrayList<>();
+ for (ReadPost readPost : readPosts) {
+ readPostStrings.add(readPost.getId());
+ }
+ handler.post(() -> fetchPostFilterAndReadPostsListener.success(mergedPostFilter, readPostStrings));
} else {
handler.post(() -> fetchPostFilterAndReadPostsListener.success(mergedPostFilter, null));
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
index 480adf81..6d4bb146 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
@@ -14,6 +14,8 @@ import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.account.AccountDao;
import ml.docilealligator.infinityforreddit.customtheme.CustomTheme;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeDao;
+import ml.docilealligator.infinityforreddit.multireddit.AnonymousMultiredditSubreddit;
+import ml.docilealligator.infinityforreddit.multireddit.AnonymousMultiredditSubredditDao;
import ml.docilealligator.infinityforreddit.multireddit.MultiReddit;
import ml.docilealligator.infinityforreddit.multireddit.MultiRedditDao;
import ml.docilealligator.infinityforreddit.postfilter.PostFilter;
@@ -35,7 +37,7 @@ import ml.docilealligator.infinityforreddit.user.UserData;
@Database(entities = {Account.class, SubredditData.class, SubscribedSubredditData.class, UserData.class,
SubscribedUserData.class, MultiReddit.class, CustomTheme.class, RecentSearchQuery.class,
- ReadPost.class, PostFilter.class, PostFilterUsage.class}, version = 20)
+ ReadPost.class, PostFilter.class, PostFilterUsage.class, AnonymousMultiredditSubreddit.class}, version = 21)
public abstract class RedditDataRoomDatabase extends RoomDatabase {
private static RedditDataRoomDatabase INSTANCE;
@@ -49,7 +51,7 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
MIGRATION_5_6, MIGRATION_6_7, MIGRATION_7_8, MIGRATION_8_9,
MIGRATION_9_10, MIGRATION_10_11, MIGRATION_11_12, MIGRATION_12_13,
MIGRATION_13_14, MIGRATION_14_15, MIGRATION_15_16, MIGRATION_16_17,
- MIGRATION_17_18, MIGRATION_18_19, MIGRATION_19_20)
+ MIGRATION_17_18, MIGRATION_18_19, MIGRATION_19_20, MIGRATION_20_21)
.build();
}
}
@@ -79,6 +81,8 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
public abstract PostFilterUsageDao postFilterUsageDao();
+ public abstract AnonymousMultiredditSubredditDao anonymousMultiredditSubredditDao();
+
private static final Migration MIGRATION_1_2 = new Migration(1, 2) {
@Override
public void migrate(SupportSQLiteDatabase database) {
@@ -339,4 +343,13 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
database.execSQL("ALTER TABLE post_filter ADD COLUMN exclude_domains TEXT");
}
};
+
+ private static final Migration MIGRATION_20_21 = new Migration(20, 21) {
+ @Override
+ public void migrate(@NonNull SupportSQLiteDatabase database) {
+ database.execSQL("CREATE TABLE anonymous_multireddit_subreddits (path TEXT NOT NULL, username TEXT NOT NULL, subreddit_name TEXT NOT NULL, " +
+ "PRIMARY KEY(path, username, subreddit_name), FOREIGN KEY(path) REFERENCES multi_reddits(path) ON DELETE CASCADE ON UPDATE CASCADE, " +
+ "FOREIGN KEY(username) REFERENCES multi_reddits(username) ON DELETE CASCADE ON UPDATE CASCADE)");
+ }
+ };
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
index a6596edb..3db1af77 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
@@ -49,7 +49,8 @@ public class LinkResolverActivity extends AppCompatActivity {
private static final String IMGUR_ALBUM_PATTERN = "/(album|a)/\\w+/?";
private static final String IMGUR_IMAGE_PATTERN = "/\\w+/?";
private static final String RPAN_BROADCAST_PATTERN = "/rpan/r/[\\w-]+/\\w+/?\\w+/?";
- private static final String WIKI_PATTERN = "/[rR]/[\\w-]+/(wiki|w)/?\\w+";
+ private static final String WIKI_PATTERN = "/[rR]/[\\w-]+/(wiki|w)?(?:/\\w+)+";
+ private static final String GOOGLE_AMP_PATTERN = "/amp/s/amp.reddit.com/.*";
@Inject
@Named("default")
@@ -173,8 +174,10 @@ public class LinkResolverActivity extends AppCompatActivity {
deepLinkError(uri);
}
} else if (path.matches(WIKI_PATTERN)) {
+ final String wikiPage = path.substring(path.lastIndexOf("/wiki/") + 6);
Intent intent = new Intent(this, WikiActivity.class);
intent.putExtra(WikiActivity.EXTRA_SUBREDDIT_NAME, segments.get(1));
+ intent.putExtra(WikiActivity.EXTRA_WIKI_PATH, wikiPage);
startActivity(intent);
} else if (path.matches(SUBREDDIT_PATTERN)) {
Intent intent = new Intent(this, ViewSubredditDetailActivity.class);
@@ -266,6 +269,13 @@ public class LinkResolverActivity extends AppCompatActivity {
} else {
deepLinkError(uri);
}
+ } else if (authority.contains("google.com") ){
+ if ( path.matches(GOOGLE_AMP_PATTERN) ) {
+ String url = path.substring(11, path.length()); // skipping past amp straight to reddit
+ handleUri(Uri.parse("https://" + url));
+ } else {
+ deepLinkError(uri);
+ }
} else {
deepLinkError(uri);
}
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 430d7bc0..47a62003 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
@@ -523,6 +523,12 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
startActivity(intent);
break;
}
+ case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: {
+ if (sectionsPagerAdapter != null) {
+ sectionsPagerAdapter.goBackToTop();
+ }
+ break;
+ }
default:
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
@@ -569,6 +575,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
return R.drawable.ic_outline_bookmarks_24dp;
case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GILDED:
return R.drawable.ic_star_border_24dp;
+ case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
+ return R.drawable.ic_keyboard_double_arrow_up_24;
default:
return R.drawable.ic_account_circle_24dp;
}
@@ -755,7 +763,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
if (mAccessToken != null) {
intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class);
} else {
- intent = new Intent(MainActivity.this, AnonymousSubscriptionsActivity.class);
+ intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class);
}
} else if (stringId == R.string.multi_reddit) {
intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java
index 66369953..eab43461 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java
@@ -20,7 +20,9 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.RecyclerView;
+import com.ferfalk.simplesearchview.SimpleOnQueryTextListener;
import com.ferfalk.simplesearchview.SimpleSearchView;
+import com.ferfalk.simplesearchview.SimpleSearchViewListener;
import com.google.android.material.appbar.AppBarLayout;
import com.r0adkll.slidr.Slidr;
@@ -154,26 +156,11 @@ public class SearchActivity extends BaseActivity {
simpleSearchView.setHint(getText(R.string.search_only_users_hint));
}
- simpleSearchView.setOnSearchViewListener(new SimpleSearchView.SearchViewListener() {
- @Override
- public void onSearchViewShown() {
-
- }
-
+ simpleSearchView.setOnSearchViewListener(new SimpleSearchViewListener() {
@Override
public void onSearchViewClosed() {
finish();
}
-
- @Override
- public void onSearchViewShownAnimation() {
-
- }
-
- @Override
- public void onSearchViewClosedAnimation() {
-
- }
});
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
@@ -201,15 +188,15 @@ public class SearchActivity extends BaseActivity {
finish();
});
- simpleSearchView.setOnQueryTextListener(new SimpleSearchView.OnQueryTextListener() {
+ simpleSearchView.setOnQueryTextListener(new SimpleOnQueryTextListener() {
@Override
- public boolean onQueryTextSubmit(String query) {
+ public boolean onQueryTextSubmit(@NonNull String query) {
search(query);
return true;
}
@Override
- public boolean onQueryTextChange(String newText) {
+ public boolean onQueryTextChange(@NonNull String newText) {
if (!newText.isEmpty()) {
if (subredditAutocompleteCall != null) {
subredditAutocompleteCall.cancel();
@@ -244,11 +231,6 @@ public class SearchActivity extends BaseActivity {
}
return false;
}
-
- @Override
- public boolean onQueryTextCleared() {
- return false;
- }
});
if (savedInstanceState != null) {
@@ -384,11 +366,10 @@ public class SearchActivity extends BaseActivity {
protected void onStart() {
super.onStart();
simpleSearchView.showSearch(false);
- simpleSearchView.getSearchEditText().requestFocus();
+ simpleSearchView.requestFocus();
if (query != null) {
- simpleSearchView.getSearchEditText().setText(query);
- simpleSearchView.getSearchEditText().setSelection(query.length());
+ simpleSearchView.setQuery(query, false);
query = null;
}
@@ -403,13 +384,13 @@ public class SearchActivity extends BaseActivity {
super.onPause();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
- imm.hideSoftInputFromWindow(simpleSearchView.getSearchEditText().getWindowToken(), 0);
+ imm.hideSoftInputFromWindow(simpleSearchView.getWindowToken(), 0);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
- if (simpleSearchView.onActivityResult(requestCode, resultCode, data)) {
+ if (data != null && simpleSearchView.onActivityResult(requestCode, resultCode, data)) {
return;
}
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 3b6ead1a..ae115534 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java
@@ -122,11 +122,12 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
bundle.putBoolean(SubredditListingFragment.EXTRA_IS_MULTI_SELECTION, getIntent().getBooleanExtra(EXTRA_IS_MULTI_SELECTION, false));
mFragment.setArguments(bundle);
- getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_search_subreddits_result_activity, mFragment).commit();
} else {
mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
- getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_search_subreddits_result_activity, mFragment).commit();
}
+ getSupportFragmentManager().beginTransaction()
+ .replace(R.id.frame_layout_search_subreddits_result_activity, mFragment)
+ .commit();
}
@Override
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 2fbfc150..58db6bc7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java
@@ -119,11 +119,12 @@ public class SearchUsersResultActivity extends BaseActivity implements ActivityT
bundle.putString(UserListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
bundle.putBoolean(UserListingFragment.EXTRA_IS_MULTI_SELECTION, getIntent().getBooleanExtra(EXTRA_IS_MULTI_SELECTION, false));
mFragment.setArguments(bundle);
- getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_search_users_result_activity, mFragment).commit();
} else {
mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
- getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_search_users_result_activity, mFragment).commit();
}
+ getSupportFragmentManager().beginTransaction()
+ .replace(R.id.frame_layout_search_users_result_activity, mFragment)
+ .commit();
}
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
index 0d33b2a8..e5f0d1e2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
@@ -387,7 +387,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
SubscribedSubredditsListingFragment fragment = new SubscribedSubredditsListingFragment();
Bundle bundle = new Bundle();
bundle.putBoolean(SubscribedSubredditsListingFragment.EXTRA_IS_SUBREDDIT_SELECTION, false);
- bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
+ bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCOUNT_NAME, mAccountName == null ? "-" : mAccountName);
bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
fragment.setArguments(bundle);
return fragment;
@@ -395,7 +395,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
case 1: {
FollowedUsersListingFragment fragment = new FollowedUsersListingFragment();
Bundle bundle = new Bundle();
- bundle.putString(FollowedUsersListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
+ bundle.putString(FollowedUsersListingFragment.EXTRA_ACCOUNT_NAME, mAccountName == null ? "-" : mAccountName);
bundle.putString(FollowedUsersListingFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
fragment.setArguments(bundle);
return fragment;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java
index 9602da8b..e2d10e55 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java
@@ -266,12 +266,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
final SubsamplingScaleImageView view = mImageView.getSSIV();
if (view != null) {
- view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() {
- @Override
- public void onReady() {
-
- }
-
+ view.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() {
@Override
public void onImageLoaded() {
view.setMinimumDpi(80);
@@ -280,26 +275,6 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
view.setQuickScaleEnabled(true);
view.resetScaleAndCenter();
}
-
- @Override
- public void onPreviewLoadError(Exception e) {
-
- }
-
- @Override
- public void onImageLoadError(Exception e) {
-
- }
-
- @Override
- public void onTileLoadError(Exception e) {
-
- }
-
- @Override
- public void onPreviewReleased() {
-
- }
});
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java
index 8aab0011..20d3440f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java
@@ -21,8 +21,8 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;
-import com.thefuntasty.hauler.DragDirection;
-import com.thefuntasty.hauler.HaulerView;
+import app.futured.hauler.DragDirection;
+import app.futured.hauler.HaulerView;
import org.json.JSONArray;
import org.json.JSONException;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java
index b5047cc6..61a5066f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java
@@ -17,8 +17,8 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;
-import com.thefuntasty.hauler.DragDirection;
-import com.thefuntasty.hauler.HaulerView;
+import app.futured.hauler.DragDirection;
+import app.futured.hauler.HaulerView;
import java.util.ArrayList;
import java.util.concurrent.Executor;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
index 4096a96b..c6695f41 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
@@ -698,6 +698,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
startActivity(intent);
break;
}
+ case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP: {
+ if (sectionsPagerAdapter != null) {
+ sectionsPagerAdapter.goBackToTop();
+ }
+ break;
+ }
default:
PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag());
@@ -745,6 +751,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
return R.drawable.ic_outline_bookmarks_24dp;
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GILDED:
return R.drawable.ic_star_border_24dp;
+ case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP:
+ return R.drawable.ic_keyboard_double_arrow_up_24;
default:
return R.drawable.ic_account_circle_24dp;
}
@@ -1180,6 +1188,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
Toast.makeText(this, R.string.no_app, Toast.LENGTH_SHORT).show();
}
return true;
+ } else if (itemId == R.id.action_go_to_wiki_activity ) {
+ Intent wikiIntent = new Intent(this, WikiActivity.class);
+ wikiIntent.putExtra(WikiActivity.EXTRA_SUBREDDIT_NAME, subredditName);
+ wikiIntent.putExtra(WikiActivity.EXTRA_WIKI_PATH, "index");
+ startActivity(wikiIntent);
+ return true;
}
return false;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
index d11fb1c6..5d748bef 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
@@ -413,47 +413,79 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
if (userData.isCanBeFollowed()) {
subscribeUserChip.setVisibility(View.VISIBLE);
subscribeUserChip.setOnClickListener(view -> {
- if (mAccessToken == null) {
- Toast.makeText(ViewUserDetailActivity.this, R.string.login_first, Toast.LENGTH_SHORT).show();
- return;
- }
-
if (subscriptionReady) {
subscriptionReady = false;
if (resources.getString(R.string.follow).contentEquals(subscribeUserChip.getText())) {
- UserFollowing.followUser(mOauthRetrofit, mRetrofit, mAccessToken,
- username, mAccountName, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() {
- @Override
- public void onUserFollowingSuccess() {
- subscribeUserChip.setText(R.string.unfollow);
- subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor));
- showMessage(R.string.followed, false);
- subscriptionReady = true;
- }
-
- @Override
- public void onUserFollowingFail() {
- showMessage(R.string.follow_failed, false);
- subscriptionReady = true;
- }
- });
+ if (mAccessToken == null) {
+ UserFollowing.anonymousFollowUser(mExecutor, new Handler(), mRetrofit,
+ username, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() {
+ @Override
+ public void onUserFollowingSuccess() {
+ subscribeUserChip.setText(R.string.unfollow);
+ subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor));
+ showMessage(R.string.followed, false);
+ subscriptionReady = true;
+ }
+
+ @Override
+ public void onUserFollowingFail() {
+ showMessage(R.string.follow_failed, false);
+ subscriptionReady = true;
+ }
+ });
+ } else {
+ UserFollowing.followUser(mOauthRetrofit, mRetrofit, mAccessToken,
+ username, mAccountName, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() {
+ @Override
+ public void onUserFollowingSuccess() {
+ subscribeUserChip.setText(R.string.unfollow);
+ subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor));
+ showMessage(R.string.followed, false);
+ subscriptionReady = true;
+ }
+
+ @Override
+ public void onUserFollowingFail() {
+ showMessage(R.string.follow_failed, false);
+ subscriptionReady = true;
+ }
+ });
+ }
} else {
- UserFollowing.unfollowUser(mOauthRetrofit, mRetrofit, mAccessToken,
- username, mAccountName, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() {
- @Override
- public void onUserFollowingSuccess() {
- subscribeUserChip.setText(R.string.follow);
- subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor));
- showMessage(R.string.unfollowed, false);
- subscriptionReady = true;
- }
-
- @Override
- public void onUserFollowingFail() {
- showMessage(R.string.unfollow_failed, false);
- subscriptionReady = true;
- }
- });
+ if (mAccessToken == null) {
+ UserFollowing.anonymousUnfollowUser(mExecutor, new Handler(), username,
+ mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() {
+ @Override
+ public void onUserFollowingSuccess() {
+ subscribeUserChip.setText(R.string.follow);
+ subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor));
+ showMessage(R.string.unfollowed, false);
+ subscriptionReady = true;
+ }
+
+ @Override
+ public void onUserFollowingFail() {
+ //Will not be called
+ }
+ });
+ } else {
+ UserFollowing.unfollowUser(mOauthRetrofit, mRetrofit, mAccessToken,
+ username, mAccountName, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() {
+ @Override
+ public void onUserFollowingSuccess() {
+ subscribeUserChip.setText(R.string.follow);
+ subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor));
+ showMessage(R.string.unfollowed, false);
+ subscriptionReady = true;
+ }
+
+ @Override
+ public void onUserFollowingFail() {
+ showMessage(R.string.unfollow_failed, false);
+ subscriptionReady = true;
+ }
+ });
+ }
}
}
});
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 f82e85b7..3f17763b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
@@ -55,8 +55,8 @@ import com.google.android.exoplayer2.upstream.cache.SimpleCache;
import com.google.android.exoplayer2.util.Util;
import com.google.android.material.bottomappbar.BottomAppBar;
import com.google.android.material.snackbar.Snackbar;
-import com.thefuntasty.hauler.DragDirection;
-import com.thefuntasty.hauler.HaulerView;
+import app.futured.hauler.DragDirection;
+import app.futured.hauler.HaulerView;
import org.apache.commons.io.FilenameUtils;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java
index f4cc17fa..372d3c6f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java
@@ -71,6 +71,7 @@ import retrofit2.Retrofit;
public class WikiActivity extends BaseActivity {
public static final String EXTRA_SUBREDDIT_NAME = "ESN";
+ public static final String EXTRA_WIKI_PATH = "EWP";
private static final String WIKI_MARKDOWN_STATE = "WMS";
@BindView(R.id.coordinator_layout_comment_wiki_activity)
@@ -281,7 +282,7 @@ public class WikiActivity extends BaseActivity {
Glide.with(this).clear(mFetchWikiInfoImageView);
mFetchWikiInfoLinearLayout.setVisibility(View.GONE);
- retrofit.create(RedditAPI.class).getWiki(getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME)).enqueue(new Callback<String>() {
+ retrofit.create(RedditAPI.class).getWikiPage(getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME), getIntent().getStringExtra(EXTRA_WIKI_PATH)).enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
if (response.isSuccessful()) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java
index c6f7ee56..9d9b0843 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java
@@ -35,7 +35,7 @@ public class AcknowledgementRecyclerViewAdapter extends RecyclerView.Adapter<Ack
@Override
public void onBindViewHolder(@NonNull AcknowledgementViewHolder holder, int position) {
- Acknowledgement acknowledgement = acknowledgements.get(holder.getAdapterPosition());
+ Acknowledgement acknowledgement = acknowledgements.get(holder.getBindingAdapterPosition());
if (acknowledgement != null) {
holder.nameTextView.setText(acknowledgement.getName());
holder.introductionTextView.setText(acknowledgement.getIntroduction());
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java
index 5f233a53..cfe0d799 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java
@@ -91,7 +91,7 @@ public class AwardRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.
coinTextView.setTextColor(primaryTextColor);
itemView.setOnClickListener(view -> {
- itemOnClickListener.onClick(awards.get(getAdapterPosition()));
+ itemOnClickListener.onClick(awards.get(getBindingAdapterPosition()));
});
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java
index 4d738aa3..399726d0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java
@@ -44,7 +44,7 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl
@Override
public void onBindViewHolder(@NonNull FlairViewHolder holder, int position) {
- if (flairs.get(holder.getAdapterPosition()).isEditable()) {
+ if (flairs.get(holder.getBindingAdapterPosition()).isEditable()) {
holder.editFlairImageView.setVisibility(View.VISIBLE);
holder.editFlairImageView.setOnClickListener(view -> {
View dialogView = ((Activity) context).getLayoutInflater().inflate(R.layout.dialog_edit_flair, null);
@@ -59,7 +59,7 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl
.setView(dialogView)
.setPositiveButton(R.string.ok, (dialogInterface, i)
-> {
- Flair flair = flairs.get(holder.getAdapterPosition());
+ Flair flair = flairs.get(holder.getBindingAdapterPosition());
flair.setText(flairEditText.getText().toString());
itemClickListener.onClick(flair);
})
@@ -68,13 +68,13 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl
});
}
- if (flairs.get(holder.getAdapterPosition()).isEditable() && flairs.get(holder.getAdapterPosition()).getText().equals("")) {
+ if (flairs.get(holder.getBindingAdapterPosition()).isEditable() && flairs.get(holder.getBindingAdapterPosition()).getText().equals("")) {
holder.itemView.setOnClickListener(view -> holder.editFlairImageView.performClick());
} else {
- holder.itemView.setOnClickListener(view -> itemClickListener.onClick(flairs.get(holder.getAdapterPosition())));
+ holder.itemView.setOnClickListener(view -> itemClickListener.onClick(flairs.get(holder.getBindingAdapterPosition())));
}
- holder.flairTextView.setText(flairs.get(holder.getAdapterPosition()).getText());
+ holder.flairTextView.setText(flairs.get(holder.getBindingAdapterPosition()).getText());
}
@Override
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 a077569e..89bae0c9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java
@@ -106,8 +106,8 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ?
mFavoriteSubscribedUserData.size() + 2 : 0;
- if (!mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getIconUrl().equals("")) {
- glide.load(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getIconUrl())
+ if (!mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).getIconUrl().equals("")) {
+ glide.load(mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
@@ -117,16 +117,16 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.into(((UserViewHolder) viewHolder).iconGifImageView);
}
- ((UserViewHolder) viewHolder).userNameTextView.setText(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getName());
+ ((UserViewHolder) viewHolder).userNameTextView.setText(mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).getName());
- if(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).isFavorite()) {
+ if(mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).isFavorite()) {
((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp);
} else {
((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp);
}
} else if (viewHolder instanceof FavoriteUserViewHolder) {
- if (!mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getIconUrl().equals("")) {
- glide.load(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getIconUrl())
+ if (!mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).getIconUrl().equals("")) {
+ glide.load(mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.error(glide.load(R.drawable.subreddit_default_icon)
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
@@ -136,9 +136,9 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
.into(((FavoriteUserViewHolder) viewHolder).iconGifImageView);
}
- ((FavoriteUserViewHolder) viewHolder).userNameTextView.setText(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getName());
+ ((FavoriteUserViewHolder) viewHolder).userNameTextView.setText(mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).getName());
- if(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).isFavorite()) {
+ if(mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).isFavorite()) {
((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp);
} else {
((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp);
@@ -205,7 +205,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
userNameTextView.setTextColor(mPrimaryTextColor);
itemView.setOnClickListener(view -> {
- int position = getAdapterPosition() - 1;
+ int position = getBindingAdapterPosition() - 1;
if(position >= 0 && mFavoriteSubscribedUserData.size() > position) {
Intent intent = new Intent(mContext, ViewUserDetailActivity.class);
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mFavoriteSubscribedUserData.get(position).getName());
@@ -214,7 +214,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
});
favoriteImageView.setOnClickListener(view -> {
- int position = getAdapterPosition() - 1;
+ int position = getBindingAdapterPosition() - 1;
if(position >= 0 && mFavoriteSubscribedUserData.size() > position) {
if(mFavoriteSubscribedUserData.get(position).isFavorite()) {
favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp);
@@ -225,7 +225,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
new FavoriteThing.FavoriteThingListener() {
@Override
public void success() {
- int position = getAdapterPosition() - 1;
+ int position = getBindingAdapterPosition() - 1;
if(position >= 0 && mFavoriteSubscribedUserData.size() > position) {
mFavoriteSubscribedUserData.get(position).setFavorite(false);
}
@@ -235,7 +235,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
@Override
public void failed() {
Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show();
- int position = getAdapterPosition() - 1;
+ int position = getBindingAdapterPosition() - 1;
if(position >= 0 && mFavoriteSubscribedUserData.size() > position) {
mFavoriteSubscribedUserData.get(position).setFavorite(true);
}
@@ -251,7 +251,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
new FavoriteThing.FavoriteThingListener() {
@Override
public void success() {
- int position = getAdapterPosition() - 1;
+ int position = getBindingAdapterPosition() - 1;
if(position >= 0 && mFavoriteSubscribedUserData.size() > position) {
mFavoriteSubscribedUserData.get(position).setFavorite(true);
}
@@ -261,7 +261,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
@Override
public void failed() {
Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show();
- int position = getAdapterPosition() - 1;
+ int position = getBindingAdapterPosition() - 1;
if(position >= 0 && mFavoriteSubscribedUserData.size() > position) {
mFavoriteSubscribedUserData.get(position).setFavorite(false);
}
@@ -290,7 +290,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
itemView.setOnClickListener(view -> {
int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ?
mFavoriteSubscribedUserData.size() + 2 : 0;
- int position = getAdapterPosition() - offset;
+ int position = getBindingAdapterPosition() - offset;
if(position >= 0 && mSubscribedUserData.size() > position) {
Intent intent = new Intent(mContext, ViewUserDetailActivity.class);
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mSubscribedUserData.get(position).getName());
@@ -301,7 +301,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
favoriteImageView.setOnClickListener(view -> {
int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ?
mFavoriteSubscribedUserData.size() + 2 : 0;
- int position = getAdapterPosition() - offset;
+ int position = getBindingAdapterPosition() - offset;
if(position >= 0 && mSubscribedUserData.size() > position) {
if(mSubscribedUserData.get(position).isFavorite()) {
@@ -313,7 +313,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
new FavoriteThing.FavoriteThingListener() {
@Override
public void success() {
- int position = getAdapterPosition() - offset;
+ int position = getBindingAdapterPosition() - offset;
if(position >= 0 && mSubscribedUserData.size() > position) {
mSubscribedUserData.get(position).setFavorite(false);
}
@@ -323,7 +323,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
@Override
public void failed() {
Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show();
- int position = getAdapterPosition() - offset;
+ int position = getBindingAdapterPosition() - offset;
if(position >= 0 && mSubscribedUserData.size() > position) {
mSubscribedUserData.get(position).setFavorite(true);
}
@@ -339,7 +339,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
new FavoriteThing.FavoriteThingListener() {
@Override
public void success() {
- int position = getAdapterPosition() - offset;
+ int position = getBindingAdapterPosition() - offset;
if(position >= 0 && mSubscribedUserData.size() > position) {
mSubscribedUserData.get(position).setFavorite(true);
}
@@ -349,7 +349,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
@Override
public void failed() {
Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show();
- int position = getAdapterPosition() - offset;
+ int position = getBindingAdapterPosition() - offset;
if(position >= 0 && mSubscribedUserData.size() > position) {
mSubscribedUserData.get(position).setFavorite(false);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java
index 2c283669..3925d59c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java
@@ -201,7 +201,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof DataViewHolder) {
- Message message = getItem(holder.getAdapterPosition());
+ Message message = getItem(holder.getBindingAdapterPosition());
if (message != null) {
ArrayList<Message> replies = message.getReplies();
Message displayedMessage;
@@ -240,7 +240,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
} else if (mMessageType == FetchMessage.MESSAGE_TYPE_PRIVATE_MESSAGE) {
Intent intent = new Intent(mContext, ViewPrivateMessagesActivity.class);
intent.putExtra(ViewPrivateMessagesActivity.EXTRA_PRIVATE_MESSAGE, message);
- intent.putExtra(ViewPrivateMessagesActivity.EXTRA_MESSAGE_POSITION, holder.getAdapterPosition());
+ intent.putExtra(ViewPrivateMessagesActivity.EXTRA_MESSAGE_POSITION, holder.getBindingAdapterPosition());
mContext.startActivity(intent);
}
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 580e7fec..038f1744 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java
@@ -116,7 +116,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
int offset = (mFavoriteMultiReddits != null && mFavoriteMultiReddits.size() > 0) ?
mFavoriteMultiReddits.size() + 2 : 0;
- MultiReddit multiReddit = mMultiReddits.get(holder.getAdapterPosition() - offset);
+ MultiReddit multiReddit = mMultiReddits.get(holder.getBindingAdapterPosition() - offset);
name = multiReddit.getDisplayName();
iconUrl = multiReddit.getIconUrl();
if(multiReddit.isFavorite()) {
@@ -134,7 +134,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
new FavoriteMultiReddit.FavoriteMultiRedditListener() {
@Override
public void success() {
- int position = holder.getAdapterPosition() - offset;
+ int position = holder.getBindingAdapterPosition() - offset;
if(position >= 0 && mMultiReddits.size() > position) {
mMultiReddits.get(position).setFavorite(false);
}
@@ -144,7 +144,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
@Override
public void failed() {
Toast.makeText(mActivity, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show();
- int position = holder.getAdapterPosition() - offset;
+ int position = holder.getBindingAdapterPosition() - offset;
if(position >= 0 && mMultiReddits.size() > position) {
mMultiReddits.get(position).setFavorite(true);
}
@@ -160,7 +160,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
new FavoriteMultiReddit.FavoriteMultiRedditListener() {
@Override
public void success() {
- int position = holder.getAdapterPosition() - offset;
+ int position = holder.getBindingAdapterPosition() - offset;
if(position >= 0 && mMultiReddits.size() > position) {
mMultiReddits.get(position).setFavorite(true);
}
@@ -170,7 +170,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
@Override
public void failed() {
Toast.makeText(mActivity, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show();
- int position = holder.getAdapterPosition() - offset;
+ int position = holder.getBindingAdapterPosition() - offset;
if(position >= 0 && mMultiReddits.size() > position) {
mMultiReddits.get(position).setFavorite(false);
}
@@ -202,7 +202,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
}
((MultiRedditViewHolder) holder).multiRedditNameTextView.setText(name);
} else if (holder instanceof FavoriteMultiRedditViewHolder) {
- MultiReddit multiReddit = mFavoriteMultiReddits.get(holder.getAdapterPosition() - 1);
+ MultiReddit multiReddit = mFavoriteMultiReddits.get(holder.getBindingAdapterPosition() - 1);
String name = multiReddit.getDisplayName();
String iconUrl = multiReddit.getIconUrl();
if(multiReddit.isFavorite()) {
@@ -220,7 +220,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
new FavoriteMultiReddit.FavoriteMultiRedditListener() {
@Override
public void success() {
- int position = holder.getAdapterPosition() - 1;
+ int position = holder.getBindingAdapterPosition() - 1;
if(position >= 0 && mFavoriteMultiReddits.size() > position) {
mFavoriteMultiReddits.get(position).setFavorite(false);
}
@@ -230,7 +230,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
@Override
public void failed() {
Toast.makeText(mActivity, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show();
- int position = holder.getAdapterPosition() - 1;
+ int position = holder.getBindingAdapterPosition() - 1;
if(position >= 0 && mFavoriteMultiReddits.size() > position) {
mFavoriteMultiReddits.get(position).setFavorite(true);
}
@@ -246,7 +246,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
new FavoriteMultiReddit.FavoriteMultiRedditListener() {
@Override
public void success() {
- int position = holder.getAdapterPosition() - 1;
+ int position = holder.getBindingAdapterPosition() - 1;
if(position >= 0 && mFavoriteMultiReddits.size() > position) {
mFavoriteMultiReddits.get(position).setFavorite(true);
}
@@ -256,7 +256,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
@Override
public void failed() {
Toast.makeText(mActivity, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show();
- int position = holder.getAdapterPosition() - 1;
+ int position = holder.getBindingAdapterPosition() - 1;
if(position >= 0 && mFavoriteMultiReddits.size() > position) {
mFavoriteMultiReddits.get(position).setFavorite(false);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java
index 0c094f4f..3f80d65e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/Paging3LoadingStateAdapter.java
@@ -1,6 +1,5 @@
package ml.docilealligator.infinityforreddit.adapters;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -60,12 +59,9 @@ public class Paging3LoadingStateAdapter extends LoadStateAdapter<Paging3LoadingS
mRetry.setTextColor(mCustomThemeWrapper.getButtonTextColor());
mRetry.setOnClickListener(retryCallback);
mErrorView.setOnClickListener(retryCallback);
-
- Log.i("asfasdf", "asdf ");
}
public void bind(LoadState loadState) {
- Log.i("asfasdf", "asdf bind");
mProgressBar.setVisibility(loadState instanceof LoadState.Loading
? View.VISIBLE : View.GONE);
mErrorView.setVisibility(loadState instanceof LoadState.Error
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 e7a673cc..4c3ee7e3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
@@ -1727,7 +1727,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
}
if (helper == null) {
helper = new ExoPlayerViewHelper(this, mediaUri, null, mExoCreator);
- helper.addEventListener(new Playable.EventListener() {
+ helper.addEventListener(new Playable.DefaultEventListener() {
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
if (!trackGroups.isEmpty()) {
@@ -1750,16 +1750,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
}
@Override
- public void onMetadata(Metadata metadata) {
-
- }
-
- @Override
- public void onCues(List<Cue> cues) {
-
- }
-
- @Override
public void onRenderedFirstFrame() {
mGlide.clear(previewImageView);
previewImageView.setVisibility(View.GONE);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java
index d6d4c938..e8c92df3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java
@@ -86,7 +86,7 @@ public class PostFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter<Rec
usageTextView = (TextView) itemView;
usageTextView.setOnClickListener(view -> {
- onItemClickListener.onClick(postFilterUsages.get(getAdapterPosition()));
+ onItemClickListener.onClick(postFilterUsages.get(getBindingAdapterPosition()));
});
}
}
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 41f06453..6bc1ec30 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -2574,6 +2574,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
if (mActivity != null && mActivity instanceof MarkPostAsReadInterface) {
((MarkPostAsReadInterface) mActivity).markPostAsRead(post);
+ mFragment.markPostAsRead(post);
}
}
}
@@ -2757,7 +2758,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
if (helper == null) {
helper = new ExoPlayerViewHelper(this, mediaUri, null, mExoCreator);
- helper.addEventListener(new Playable.EventListener() {
+ helper.addEventListener(new Playable.DefaultEventListener() {
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
if (!trackGroups.isEmpty()) {
@@ -2783,16 +2784,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
@Override
- public void onMetadata(Metadata metadata) {
-
- }
-
- @Override
- public void onCues(List<Cue> cues) {
-
- }
-
- @Override
public void onRenderedFirstFrame() {
mGlide.clear(previewImageView);
previewImageView.setVisibility(View.GONE);
@@ -3560,6 +3551,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
if (mActivity != null && mActivity instanceof MarkPostAsReadInterface) {
((MarkPostAsReadInterface) mActivity).markPostAsRead(post);
+ mFragment.markPostAsRead(post);
}
}
}
@@ -3796,6 +3788,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
if (mActivity != null && mActivity instanceof MarkPostAsReadInterface) {
((MarkPostAsReadInterface) mActivity).markPostAsRead(post);
+ mFragment.markPostAsRead(post);
}
}
}
@@ -3984,7 +3977,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
if (helper == null) {
helper = new ExoPlayerViewHelper(this, mediaUri, null, mExoCreator);
- helper.addEventListener(new Playable.EventListener() {
+ helper.addEventListener(new Playable.DefaultEventListener() {
@Override
public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {
if (!trackGroups.isEmpty()) {
@@ -4010,16 +4003,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
@Override
- public void onMetadata(Metadata metadata) {
-
- }
-
- @Override
- public void onCues(List<Cue> cues) {
-
- }
-
- @Override
public void onRenderedFirstFrame() {
mGlide.clear(previewImageView);
previewImageView.setVisibility(View.GONE);
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 190b8ad5..8fe78d79 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java
@@ -117,10 +117,10 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
Message message;
- if (holder.getAdapterPosition() == 0) {
+ if (holder.getBindingAdapterPosition() == 0) {
message = mMessage;
} else {
- message = mMessage.getReplies().get(holder.getAdapterPosition() - 1);
+ message = mMessage.getReplies().get(holder.getBindingAdapterPosition() - 1);
}
if (message != null) {
if (holder instanceof MessageViewHolder) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java
index 5e5572ff..80e57a5a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java
@@ -42,9 +42,9 @@ public class ReportReasonRecyclerViewAdapter extends RecyclerView.Adapter<Recycl
if (holder instanceof ReasonViewHolder) {
ReportReason reportReason;
if (position >= generalReasons.size()) {
- reportReason = rules.get(holder.getAdapterPosition() - generalReasons.size());
+ reportReason = rules.get(holder.getBindingAdapterPosition() - generalReasons.size());
} else {
- reportReason = generalReasons.get(holder.getAdapterPosition());
+ reportReason = generalReasons.get(holder.getBindingAdapterPosition());
}
((ReasonViewHolder) holder).reasonTextView.setText(reportReason.getReportReason());
((ReasonViewHolder) holder).checkBox.setChecked(reportReason.isSelected());
@@ -119,10 +119,10 @@ public class ReportReasonRecyclerViewAdapter extends RecyclerView.Adapter<Recycl
}
}
- if (getAdapterPosition() >= generalReasons.size()) {
- rules.get(getAdapterPosition() - generalReasons.size()).setSelected(checkBox.isChecked());
+ if (getBindingAdapterPosition() >= generalReasons.size()) {
+ rules.get(getBindingAdapterPosition() - generalReasons.size()).setSelected(checkBox.isChecked());
} else {
- generalReasons.get(getAdapterPosition()).setSelected(checkBox.isChecked());
+ generalReasons.get(getBindingAdapterPosition()).setSelected(checkBox.isChecked());
}
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java
index 51d55400..454ecdd4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java
@@ -82,11 +82,11 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler
@Override
public void onBindViewHolder(@NonNull RuleViewHolder holder, int position) {
- holder.shortNameTextView.setText(rules.get(holder.getAdapterPosition()).getShortName());
- if (rules.get(holder.getAdapterPosition()).getDescriptionHtml() == null) {
+ holder.shortNameTextView.setText(rules.get(holder.getBindingAdapterPosition()).getShortName());
+ if (rules.get(holder.getBindingAdapterPosition()).getDescriptionHtml() == null) {
holder.descriptionMarkwonView.setVisibility(View.GONE);
} else {
- markwon.setMarkdown(holder.descriptionMarkwonView, rules.get(holder.getAdapterPosition()).getDescriptionHtml());
+ markwon.setMarkdown(holder.descriptionMarkwonView, rules.get(holder.getBindingAdapterPosition()).getDescriptionHtml());
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java
index f4da7bd7..35cf33e7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java
@@ -82,12 +82,12 @@ public class SearchActivityRecyclerViewAdapter extends RecyclerView.Adapter<Recy
itemView.setOnClickListener(view -> {
if (recentSearchQueries != null && !recentSearchQueries.isEmpty()) {
- itemOnClickListener.onClick(recentSearchQueries.get(getAdapterPosition()).getSearchQuery());
+ itemOnClickListener.onClick(recentSearchQueries.get(getBindingAdapterPosition()).getSearchQuery());
}
});
deleteImageView.setOnClickListener(view -> {
- itemOnClickListener.onDelete(recentSearchQueries.get(getAdapterPosition()));
+ itemOnClickListener.onDelete(recentSearchQueries.get(getBindingAdapterPosition()));
});
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java
index e6bbe441..ad57d3ba 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java
@@ -39,10 +39,10 @@ public class SelectedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter<
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof SubredditViewHolder) {
- ((SubredditViewHolder) holder).subredditNameTextView.setText(subreddits.get(holder.getAdapterPosition()));
+ ((SubredditViewHolder) holder).subredditNameTextView.setText(subreddits.get(holder.getBindingAdapterPosition()));
((SubredditViewHolder) holder).deleteButton.setOnClickListener(view -> {
- subreddits.remove(holder.getAdapterPosition());
- notifyItemRemoved(holder.getAdapterPosition());
+ subreddits.remove(holder.getBindingAdapterPosition());
+ notifyItemRemoved(holder.getBindingAdapterPosition());
});
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java
index 1f05380b..d260bb0d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java
@@ -43,7 +43,7 @@ public class UserFlairRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerV
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof UserFlairViewHolder) {
- UserFlair userFlair = userFlairs.get(holder.getAdapterPosition());
+ UserFlair userFlair = userFlairs.get(holder.getBindingAdapterPosition());
if (userFlair.getHtmlText() == null || userFlair.getHtmlText().equals("")) {
((UserFlairViewHolder) holder).userFlairHtmlTextView.setText(userFlair.getText());
} else {
@@ -77,11 +77,11 @@ public class UserFlairRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerV
editUserFlairImageView.setColorFilter(customThemeWrapper.getPrimaryTextColor(), android.graphics.PorterDuff.Mode.SRC_IN);
itemView.setOnClickListener(view -> {
- itemClickListener.onClick(userFlairs.get(getAdapterPosition()), false);
+ itemClickListener.onClick(userFlairs.get(getBindingAdapterPosition()), false);
});
editUserFlairImageView.setOnClickListener(view -> {
- itemClickListener.onClick(userFlairs.get(getAdapterPosition()), true);
+ itemClickListener.onClick(userFlairs.get(getBindingAdapterPosition()), true);
});
}
}
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 91b96c70..a7c67893 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/apis/RedditAPI.java
@@ -294,8 +294,12 @@ public interface RedditAPI {
@GET("/api/trending_searches_v1.json?withAds=0&raw_json=1&gilding_detail=1")
Call<String> getTrendingSearches(@HeaderMap Map<String, String> headers);
- @GET("/r/{subredditName}/wiki/index.json?raw_json=1")
- Call<String> getWiki(@Path("subredditName") String subredditName);
+ default Call<String> getWiki(@Path("subredditName") String subredditName) {
+ return getWikiPage(subredditName, "index");
+ };
+
+ @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")
ListenableFuture<Response<String>> getBestPostsListenableFuture(@Path("sortType") String sortType, @Query("after") String lastItem, @HeaderMap Map<String, String> headers);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
index 745cdc1e..9eac7f5f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
@@ -18,6 +18,7 @@ import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.util.DisplayMetrics;
+import android.util.Log;
import android.view.HapticFeedbackConstants;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -129,7 +130,6 @@ import ml.docilealligator.infinityforreddit.post.PostPagingSource;
import ml.docilealligator.infinityforreddit.post.PostViewModel;
import ml.docilealligator.infinityforreddit.postfilter.PostFilter;
import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage;
-import ml.docilealligator.infinityforreddit.readpost.ReadPost;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.utils.Utils;
import retrofit2.Retrofit;
@@ -248,7 +248,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
private boolean vibrateWhenActionTriggered;
private float swipeActionThreshold;
private ItemTouchHelper touchHelper;
- private ArrayList<ReadPost> readPosts;
+ private ArrayList<String> readPosts;
private Unbinder unbinder;
private Map<String, String> subredditOrUserIcons = new HashMap<>();
@@ -390,7 +390,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
recyclerViewPosition = savedInstanceState.getInt(RECYCLER_VIEW_POSITION_STATE);
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
- readPosts = savedInstanceState.getParcelableArrayList(READ_POST_LIST_STATE);
+ readPosts = savedInstanceState.getStringArrayList(READ_POST_LIST_STATE);
postFilter = savedInstanceState.getParcelable(POST_FILTER_STATE);
concatenatedSubredditNames = savedInstanceState.getString(CONCATENATED_SUBREDDIT_NAMES_STATE);
postFragmentId = savedInstanceState.getLong(POST_FRAGMENT_ID_STATE);
@@ -1264,7 +1264,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(IS_IN_LAZY_MODE_STATE, isInLazyMode);
- outState.putParcelableArrayList(READ_POST_LIST_STATE, readPosts);
+ outState.putStringArrayList(READ_POST_LIST_STATE, readPosts);
if (mLinearLayoutManager != null) {
outState.putInt(RECYCLER_VIEW_POSITION_STATE, mLinearLayoutManager.findFirstVisibleItemPosition());
} else if (mStaggeredGridLayoutManager != null) {
@@ -1561,6 +1561,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
}
}
+ public void markPostAsRead(Post post) {
+ readPosts.add(post.getId());
+ }
+
@Subscribe
public void onPostUpdateEvent(PostUpdateEventToPostList event) {
ItemSnapshotList<Post> posts = mAdapter.snapshot();
@@ -1575,6 +1579,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
post.setSpoiler(event.post.isSpoiler());
post.setFlair(event.post.getFlair());
post.setSaved(event.post.isSaved());
+ if (event.post.isRead()) {
+ post.markAsRead(true);
+ }
mAdapter.notifyItemChanged(event.positionInList);
}
}
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 2b79125d..e912418d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewPostDetailFragment.java
@@ -106,6 +106,7 @@ import ml.docilealligator.infinityforreddit.post.FetchRemovedPost;
import ml.docilealligator.infinityforreddit.post.HidePost;
import ml.docilealligator.infinityforreddit.post.ParsePost;
import ml.docilealligator.infinityforreddit.post.Post;
+import ml.docilealligator.infinityforreddit.readpost.InsertReadPost;
import ml.docilealligator.infinityforreddit.subreddit.FetchSubredditData;
import ml.docilealligator.infinityforreddit.subreddit.SubredditData;
import ml.docilealligator.infinityforreddit.utils.APIUtils;
@@ -170,6 +171,9 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
@Named("post_details")
SharedPreferences mPostDetailsSharedPreferences;
@Inject
+ @Named("post_history")
+ SharedPreferences mPostHistorySharedPreferences;
+ @Inject
CustomThemeWrapper mCustomThemeWrapper;
@Inject
ExoCreator mExoCreator;
@@ -219,6 +223,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
private boolean mSwipeUpToHideFab;
private boolean mExpandChildren;
private boolean mSeparatePostAndComments = false;
+ private boolean mMarkPostsAsRead;
private int mWindowWidth;
private ConcatAdapter mConcatAdapter;
private PostDetailRecyclerViewAdapter mPostAdapter;
@@ -292,6 +297,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
mLockFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false);
mSwipeUpToHideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON, false);
mExpandChildren = !mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_TOP_LEVEL_COMMENTS_FIRST, false);
+ mMarkPostsAsRead = mPostHistorySharedPreferences.getBoolean(mAccountName + SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, false);
if (savedInstanceState == null) {
mRespectSubredditRecommendedSortType = mSharedPreferences.getBoolean(SharedPreferencesUtils.RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE, false);
viewPostDetailFragmentId = System.currentTimeMillis();
@@ -1087,12 +1093,21 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
}
}
+ private void tryMarkingPostAsRead() {
+ if (mMarkPostsAsRead && mPost != null && !mPost.isRead()) {
+ mPost.markAsRead(true);
+ InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, mPost.getId());
+ EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
+ }
+ }
+
@Override
public void onResume() {
super.onResume();
if (mRecyclerView != null) {
mRecyclerView.onWindowVisibilityChanged(View.VISIBLE);
}
+ tryMarkingPostAsRead();
}
@Override
@@ -1173,6 +1188,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
@Override
public void onParsePostSuccess(Post post) {
mPost = post;
+ tryMarkingPostAsRead();
setupMenu();
@@ -1758,6 +1774,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
@Override
public void fetchSuccess(Post post) {
mPost = post;
+ tryMarkingPostAsRead();
if (mPostAdapter != null) {
mPostAdapter.updatePost(post);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java
index cee6d404..05f0ab7a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java
@@ -153,12 +153,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
final SubsamplingScaleImageView view = imageView.getSSIV();
if (view != null) {
- view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() {
- @Override
- public void onReady() {
-
- }
-
+ view.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() {
@Override
public void onImageLoaded() {
view.setMinimumDpi(80);
@@ -167,26 +162,6 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
view.setQuickScaleEnabled(true);
view.resetScaleAndCenter();
}
-
- @Override
- public void onPreviewLoadError(Exception e) {
-
- }
-
- @Override
- public void onImageLoadError(Exception e) {
-
- }
-
- @Override
- public void onTileLoadError(Exception e) {
-
- }
-
- @Override
- public void onPreviewReleased() {
-
- }
});
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/AnonymousMultiredditSubreddit.java b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/AnonymousMultiredditSubreddit.java
new file mode 100644
index 00000000..069d36f6
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/AnonymousMultiredditSubreddit.java
@@ -0,0 +1,53 @@
+package ml.docilealligator.infinityforreddit.multireddit;
+
+import androidx.annotation.NonNull;
+import androidx.room.ColumnInfo;
+import androidx.room.Entity;
+import androidx.room.ForeignKey;
+
+@Entity(tableName = "anonymous_multireddit_subreddits", primaryKeys = {"path", "username", "subreddit_name"},
+ foreignKeys = @ForeignKey(entity = MultiReddit.class, parentColumns = {"path", "username"},
+ childColumns = {"path", "username"}, onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.CASCADE))
+public class AnonymousMultiredditSubreddit {
+ @NonNull
+ @ColumnInfo(name = "path")
+ private String path;
+ @NonNull
+ @ColumnInfo(name = "username")
+ private String username = "-";
+ @NonNull
+ @ColumnInfo(name = "subreddit_name")
+ private String subredditName;
+
+ public AnonymousMultiredditSubreddit(@NonNull String path, @NonNull String subredditName) {
+ this.path = path;
+ this.subredditName = subredditName;
+ }
+
+ @NonNull
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(@NonNull String path) {
+ this.path = path;
+ }
+
+ @NonNull
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(@NonNull String username) {
+ this.username = username;
+ }
+
+ @NonNull
+ public String getSubredditName() {
+ return subredditName;
+ }
+
+ public void setSubredditName(@NonNull String subredditName) {
+ this.subredditName = subredditName;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/AnonymousMultiredditSubredditDao.java b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/AnonymousMultiredditSubredditDao.java
new file mode 100644
index 00000000..8728349c
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/AnonymousMultiredditSubredditDao.java
@@ -0,0 +1,18 @@
+package ml.docilealligator.infinityforreddit.multireddit;
+
+import androidx.lifecycle.LiveData;
+import androidx.room.Dao;
+import androidx.room.Insert;
+import androidx.room.OnConflictStrategy;
+import androidx.room.Query;
+
+import java.util.List;
+
+@Dao
+public interface AnonymousMultiredditSubredditDao {
+ @Insert(onConflict = OnConflictStrategy.REPLACE)
+ void insert(AnonymousMultiredditSubreddit anonymousMultiredditSubreddit);
+
+ @Query("SELECT * FROM anonymous_multireddit_subreddits WHERE path = :path ORDER BY subreddit_name COLLATE NOCASE ASC")
+ LiveData<List<AnonymousMultiredditSubreddit>> getAllAnonymousMultiRedditSubreddits(String path);
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java
index 8b02bab9..ff341041 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java
@@ -17,7 +17,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import ml.docilealligator.infinityforreddit.postfilter.PostFilter;
-import ml.docilealligator.infinityforreddit.readpost.ReadPost;
import ml.docilealligator.infinityforreddit.utils.JSONUtils;
import ml.docilealligator.infinityforreddit.utils.Utils;
@@ -26,54 +25,7 @@ import ml.docilealligator.infinityforreddit.utils.Utils;
*/
public class ParsePost {
- public static void parsePosts(Executor executor, Handler handler, String response, int nPosts,
- PostFilter postFilter, List<ReadPost> readPostList,
- ParsePostsListingListener parsePostsListingListener) {
- executor.execute(() -> {
- LinkedHashSet<Post> newPosts = new LinkedHashSet<>();
- try {
- JSONObject jsonResponse = new JSONObject(response);
- JSONArray allData = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY);
- String lastItem = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY);
-
- //Posts listing
- int size;
- if (nPosts < 0 || nPosts > allData.length()) {
- size = allData.length();
- } else {
- size = nPosts;
- }
-
- HashSet<ReadPost> readPostHashSet = null;
- if (readPostList != null) {
- readPostHashSet = new HashSet<>(readPostList);
- }
- for (int i = 0; i < size; i++) {
- try {
- if (allData.getJSONObject(i).getString(JSONUtils.KIND_KEY).equals("t3")) {
- JSONObject data = allData.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
- Post post = parseBasicData(data);
- if (readPostHashSet != null && readPostHashSet.contains(ReadPost.convertPost(post))) {
- post.markAsRead(false);
- }
- if (PostFilter.isPostAllowed(post, postFilter)) {
- newPosts.add(post);
- }
- }
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- handler.post(() -> parsePostsListingListener.onParsePostsListingSuccess(newPosts, lastItem));
- } catch (JSONException e) {
- e.printStackTrace();
- handler.post(parsePostsListingListener::onParsePostsListingFail);
- }
- });
- }
-
- public static LinkedHashSet<Post> parsePostsSync(String response, int nPosts, PostFilter postFilter, List<ReadPost> readPostList) {
+ public static LinkedHashSet<Post> parsePostsSync(String response, int nPosts, PostFilter postFilter, List<String> readPostList) {
LinkedHashSet<Post> newPosts = new LinkedHashSet<>();
try {
JSONObject jsonResponse = new JSONObject(response);
@@ -87,7 +39,7 @@ public class ParsePost {
size = nPosts;
}
- HashSet<ReadPost> readPostHashSet = null;
+ HashSet<String> readPostHashSet = null;
if (readPostList != null) {
readPostHashSet = new HashSet<>(readPostList);
}
@@ -96,7 +48,7 @@ public class ParsePost {
if (allData.getJSONObject(i).getString(JSONUtils.KIND_KEY).equals("t3")) {
JSONObject data = allData.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
Post post = parseBasicData(data);
- if (readPostHashSet != null && readPostHashSet.contains(ReadPost.convertPost(post))) {
+ if (readPostHashSet != null && readPostHashSet.contains(post.getId())) {
post.markAsRead(false);
}
if (PostFilter.isPostAllowed(post, postFilter)) {
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 38288785..fe19a962 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
@@ -54,7 +54,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
private int postType;
private SortType sortType;
private PostFilter postFilter;
- private List<ReadPost> readPostList;
+ private List<String> readPostList;
private String userWhere;
private String multiRedditPath;
private LinkedHashSet<Post> postLinkedHashSet;
@@ -62,7 +62,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
PostPagingSource(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences,
SharedPreferences postFeedScrolledPositionSharedPreferences, int postType,
- SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) {
+ SortType sortType, PostFilter postFilter, List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
@@ -79,7 +79,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
PostPagingSource(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
String path, int postType, SortType sortType, PostFilter postFilter,
- List<ReadPost> readPostList) {
+ List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
@@ -117,7 +117,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
PostPagingSource(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
String subredditOrUserName, int postType, SortType sortType, PostFilter postFilter,
- String where, List<ReadPost> readPostList) {
+ String where, List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
@@ -136,7 +136,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
PostPagingSource(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
String subredditOrUserName, String query, String trendingSource, int postType,
- SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) {
+ SortType sortType, PostFilter postFilter, List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
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 ca574517..66505924 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java
@@ -23,7 +23,6 @@ import java.util.concurrent.Executor;
import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.postfilter.PostFilter;
-import ml.docilealligator.infinityforreddit.readpost.ReadPost;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
import retrofit2.Retrofit;
@@ -41,7 +40,7 @@ public class PostViewModel extends ViewModel {
private SortType sortType;
private PostFilter postFilter;
private String userWhere;
- private List<ReadPost> readPostList;
+ private List<String> readPostList;
private MutableLiveData<Boolean> currentlyReadPostIdsLiveData = new MutableLiveData<>();
private LiveData<PagingData<Post>> posts;
@@ -54,7 +53,7 @@ public class PostViewModel extends ViewModel {
public PostViewModel(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
@Nullable SharedPreferences postHistorySharedPreferences, int postType,
- SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) {
+ SortType sortType, PostFilter postFilter, List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
@@ -95,7 +94,7 @@ public class PostViewModel extends ViewModel {
public PostViewModel(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
@Nullable SharedPreferences postHistorySharedPreferences, String subredditName, int postType,
- SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) {
+ SortType sortType, PostFilter postFilter, List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
@@ -139,7 +138,7 @@ public class PostViewModel extends ViewModel {
SharedPreferences postFeedScrolledPositionSharedPreferences,
@Nullable SharedPreferences postHistorySharedPreferences, String username,
int postType, SortType sortType, PostFilter postFilter, String userWhere,
- List<ReadPost> readPostList) {
+ List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
@@ -183,7 +182,7 @@ public class PostViewModel extends ViewModel {
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
@Nullable SharedPreferences postHistorySharedPreferences, String subredditName, String query,
String trendingSource, int postType, SortType sortType, PostFilter postFilter,
- List<ReadPost> readPostList) {
+ List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
@@ -290,12 +289,12 @@ public class PostViewModel extends ViewModel {
private SortType sortType;
private PostFilter postFilter;
private String userWhere;
- private List<ReadPost> readPostList;
+ private List<String> readPostList;
public Factory(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
SharedPreferences postHistorySharedPreferences, int postType, SortType sortType,
- PostFilter postFilter, List<ReadPost> readPostList) {
+ PostFilter postFilter, List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
@@ -312,7 +311,7 @@ public class PostViewModel extends ViewModel {
public Factory(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
SharedPreferences postHistorySharedPreferences, String name, int postType, SortType sortType,
- PostFilter postFilter, List<ReadPost> readPostList) {
+ PostFilter postFilter, List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
@@ -331,7 +330,7 @@ public class PostViewModel extends ViewModel {
public Factory(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
SharedPreferences postHistorySharedPreferences, String username, int postType,
- SortType sortType, PostFilter postFilter, String where, List<ReadPost> readPostList) {
+ SortType sortType, PostFilter postFilter, String where, List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
@@ -350,7 +349,7 @@ public class PostViewModel extends ViewModel {
public Factory(Executor executor, Retrofit retrofit, String accessToken, String accountName,
SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences,
SharedPreferences postHistorySharedPreferences, String name, String query, String trendingSource,
- int postType, SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) {
+ int postType, SortType sortType, PostFilter postFilter, List<String> readPostList) {
this.executor = executor;
this.retrofit = retrofit;
this.accessToken = accessToken;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPost.java
index df704f3d..2a3da252 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPost.java
@@ -10,7 +10,6 @@ import androidx.room.Entity;
import androidx.room.ForeignKey;
import ml.docilealligator.infinityforreddit.account.Account;
-import ml.docilealligator.infinityforreddit.post.Post;
@Entity(tableName = "read_posts", primaryKeys = {"username", "id"},
foreignKeys = @ForeignKey(entity = Account.class, parentColumns = "username",
@@ -23,10 +22,6 @@ public class ReadPost implements Parcelable {
@ColumnInfo(name = "id")
private String id;
- public static ReadPost convertPost(Post post) {
- return new ReadPost("temp", post.getId());
- }
-
public ReadPost(@NonNull String username, @NonNull String id) {
this.username = username;
this.id = id;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java
index e5534ef9..f0a551fe 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java
@@ -1,8 +1,6 @@
package ml.docilealligator.infinityforreddit.services;
import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ContentResolver;
@@ -22,6 +20,7 @@ import android.os.Message;
import android.os.Process;
import android.provider.MediaStore;
+import androidx.core.app.NotificationChannelCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.documentfile.provider.DocumentFile;
@@ -367,16 +366,13 @@ public class DownloadMediaService extends Service {
int mediaType = intent.getIntExtra(EXTRA_MEDIA_TYPE, EXTRA_MEDIA_TYPE_IMAGE);
builder = new NotificationCompat.Builder(this, getNotificationChannelId(mediaType));
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- NotificationChannel serviceChannel;
- serviceChannel = new NotificationChannel(
- getNotificationChannelId(mediaType),
- getNotificationChannel(mediaType),
- NotificationManager.IMPORTANCE_LOW
- );
-
- notificationManager.createNotificationChannel(serviceChannel);
- }
+ NotificationChannelCompat serviceChannel =
+ new NotificationChannelCompat.Builder(
+ getNotificationChannelId(mediaType),
+ NotificationManagerCompat.IMPORTANCE_LOW)
+ .setName(getNotificationChannel(mediaType))
+ .build();
+ notificationManager.createNotificationChannel(serviceChannel);
int randomNotificationIdOffset = new Random().nextInt(10000);
switch (intent.getIntExtra(EXTRA_MEDIA_TYPE, EXTRA_MEDIA_TYPE_IMAGE)) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java
index a398871e..2079e024 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java
@@ -1,8 +1,6 @@
package ml.docilealligator.infinityforreddit.services;
import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ContentResolver;
@@ -26,6 +24,7 @@ import android.os.Message;
import android.os.Process;
import android.provider.MediaStore;
+import androidx.core.app.NotificationChannelCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.documentfile.provider.DocumentFile;
@@ -501,16 +500,13 @@ public class DownloadRedditVideoService extends Service {
String subredditName = intent.getStringExtra(EXTRA_SUBREDDIT);
String fileNameWithoutExtension = subredditName + "-" + intent.getStringExtra(EXTRA_POST_ID);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- NotificationChannel serviceChannel;
- serviceChannel = new NotificationChannel(
- NotificationUtils.CHANNEL_ID_DOWNLOAD_REDDIT_VIDEO,
- NotificationUtils.CHANNEL_DOWNLOAD_REDDIT_VIDEO,
- NotificationManager.IMPORTANCE_LOW
- );
-
- notificationManager.createNotificationChannel(serviceChannel);
- }
+ NotificationChannelCompat serviceChannel =
+ new NotificationChannelCompat.Builder(
+ NotificationUtils.CHANNEL_ID_DOWNLOAD_REDDIT_VIDEO,
+ NotificationManagerCompat.IMPORTANCE_LOW)
+ .setName(NotificationUtils.CHANNEL_DOWNLOAD_REDDIT_VIDEO)
+ .build();
+ notificationManager.createNotificationChannel(serviceChannel);
int randomNotificationIdOffset = new Random().nextInt(10000);
startForeground(
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/MaterialYouService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/MaterialYouService.java
index 66bd4e0b..40059987 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/MaterialYouService.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/MaterialYouService.java
@@ -1,16 +1,14 @@
package ml.docilealligator.infinityforreddit.services;
import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import androidx.annotation.Nullable;
+import androidx.core.app.NotificationChannelCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
@@ -60,16 +58,17 @@ public class MaterialYouService extends Service {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
((Infinity) getApplication()).getAppComponent().inject(this);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- NotificationChannel serviceChannel = new NotificationChannel(
- NotificationUtils.CHANNEL_ID_MATERIAL_YOU,
- NotificationUtils.CHANNEL_MATERIAL_YOU,
- NotificationManager.IMPORTANCE_LOW
- );
-
- NotificationManagerCompat manager = NotificationManagerCompat.from(this);
- manager.createNotificationChannel(serviceChannel);
- }
+
+ NotificationChannelCompat serviceChannel =
+ new NotificationChannelCompat.Builder(
+ NotificationUtils.CHANNEL_ID_MATERIAL_YOU,
+ NotificationManagerCompat.IMPORTANCE_LOW)
+ .setName(NotificationUtils.CHANNEL_MATERIAL_YOU)
+ .build();
+
+ NotificationManagerCompat manager = NotificationManagerCompat.from(this);
+ manager.createNotificationChannel(serviceChannel);
+
Notification notification = new NotificationCompat.Builder(this, NotificationUtils.CHANNEL_ID_MATERIAL_YOU)
.setContentTitle(getString(R.string.material_you_notification_title))
.setContentText(getString(R.string.please_wait))
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java
index e22bc541..f1ba75f3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java
@@ -1,13 +1,10 @@
package ml.docilealligator.infinityforreddit.services;
import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
import android.app.Service;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
@@ -19,6 +16,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.core.app.NotificationChannelCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
@@ -164,16 +162,15 @@ public class SubmitPostService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) {
((Infinity) getApplication()).getAppComponent().inject(this);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- NotificationChannel serviceChannel = new NotificationChannel(
- NotificationUtils.CHANNEL_SUBMIT_POST,
- NotificationUtils.CHANNEL_SUBMIT_POST,
- NotificationManager.IMPORTANCE_LOW
- );
+ NotificationChannelCompat serviceChannel =
+ new NotificationChannelCompat.Builder(
+ NotificationUtils.CHANNEL_SUBMIT_POST,
+ NotificationManagerCompat.IMPORTANCE_LOW)
+ .setName(NotificationUtils.CHANNEL_SUBMIT_POST)
+ .build();
- NotificationManagerCompat manager = NotificationManagerCompat.from(this);
- manager.createNotificationChannel(serviceChannel);
- }
+ NotificationManagerCompat manager = NotificationManagerCompat.from(this);
+ manager.createNotificationChannel(serviceChannel);
int randomNotificationIdOffset = new Random().nextInt(10000);
int postType = intent.getIntExtra(EXTRA_POST_TYPE, EXTRA_POST_TEXT_OR_LINK);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java
index 2f2aa91e..c5a3690d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java
@@ -50,12 +50,6 @@ public class AcknowledgementFragment extends Fragment {
acknowledgements.add(new Acknowledgement("Glide",
"A fast and efficient open source media management and image loading framework for Android",
Uri.parse("https://github.com/bumptech/glide")));
- acknowledgements.add(new Acknowledgement("RxAndroid",
- "Android specific bindings for RxJava 2",
- Uri.parse("https://github.com/ReactiveX/RxAndroid")));
- acknowledgements.add(new Acknowledgement("RxJava",
- "Reactive extensions for the JVM",
- Uri.parse("https://github.com/ReactiveX/RxJava")));
acknowledgements.add(new Acknowledgement("Retrofit",
"Type-safe HTTP client for Android and Java by Square, Inc.",
Uri.parse("https://github.com/square/retrofit")));
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 242edf18..1b4f366e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java
@@ -15,7 +15,6 @@ import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubred
import ml.docilealligator.infinityforreddit.utils.APIUtils;
import retrofit2.Call;
import retrofit2.Callback;
-import retrofit2.Response;
import retrofit2.Retrofit;
public class SubredditSubscription {
@@ -31,25 +30,15 @@ public class SubredditSubscription {
RedditDataRoomDatabase redditDataRoomDatabase,
String subredditName,
SubredditSubscriptionListener subredditSubscriptionListener) {
- retrofit.create(RedditAPI.class).getSubredditData(subredditName).enqueue(new Callback<String>() {
+ FetchSubredditData.fetchSubredditData(retrofit, subredditName, new FetchSubredditData.FetchSubredditDataListener() {
@Override
- public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
- FetchSubredditData.fetchSubredditData(retrofit, subredditName, new FetchSubredditData.FetchSubredditDataListener() {
- @Override
- public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
- insertSubscription(executor, handler, redditDataRoomDatabase,
- subredditData, "-", subredditSubscriptionListener);
- }
-
- @Override
- public void onFetchSubredditDataFail(boolean isQuarantined) {
-
- }
- });
+ public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
+ insertSubscription(executor, handler, redditDataRoomDatabase,
+ subredditData, "-", subredditSubscriptionListener);
}
@Override
- public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
+ public void onFetchSubredditDataFail(boolean isQuarantined) {
subredditSubscriptionListener.onSubredditSubscriptionFail();
}
});
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 0dd5157a..1bde2aa3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java
@@ -1,13 +1,16 @@
package ml.docilealligator.infinityforreddit.user;
import android.os.AsyncTask;
+import android.os.Handler;
import androidx.annotation.NonNull;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.Executor;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.apis.RedditAPI;
import ml.docilealligator.infinityforreddit.subscribeduser.SubscribedUserDao;
import ml.docilealligator.infinityforreddit.subscribeduser.SubscribedUserData;
@@ -25,6 +28,30 @@ public class UserFollowing {
redditDataRoomDatabase.subscribedUserDao(), userFollowingListener);
}
+ public static void anonymousFollowUser(Executor executor, Handler handler, Retrofit retrofit, String username,
+ RedditDataRoomDatabase redditDataRoomDatabase,
+ UserFollowingListener userFollowingListener) {
+ FetchUserData.fetchUserData(retrofit, username, new FetchUserData.FetchUserDataListener() {
+ @Override
+ public void onFetchUserDataSuccess(UserData userData, int inboxCount) {
+ executor.execute(() -> {
+ if (!redditDataRoomDatabase.accountDao().isAnonymousAccountInserted()) {
+ redditDataRoomDatabase.accountDao().insert(Account.getAnonymousAccount());
+ }
+ redditDataRoomDatabase.subscribedUserDao().insert(new SubscribedUserData(userData.getName(), userData.getIconUrl(),
+ "-", false));
+
+ handler.post(userFollowingListener::onUserFollowingSuccess);
+ });
+ }
+
+ @Override
+ public void onFetchUserDataFailed() {
+ userFollowingListener.onUserFollowingFail();
+ }
+ });
+ }
+
public static void unfollowUser(Retrofit oauthRetrofit, Retrofit retrofit,
String accessToken, String username, String accountName,
RedditDataRoomDatabase redditDataRoomDatabase,
@@ -33,6 +60,16 @@ public class UserFollowing {
redditDataRoomDatabase.subscribedUserDao(), userFollowingListener);
}
+ public static void anonymousUnfollowUser(Executor executor, Handler handler, String username,
+ RedditDataRoomDatabase redditDataRoomDatabase,
+ UserFollowingListener userFollowingListener) {
+ executor.execute(() -> {
+ redditDataRoomDatabase.subscribedUserDao().deleteSubscribedUser(username, "-");
+
+ handler.post(userFollowingListener::onUserFollowingSuccess);
+ });
+ }
+
private static void userFollowing(Retrofit oauthRetrofit, Retrofit retrofit, String accessToken,
String username, String accountName, String action, SubscribedUserDao subscribedUserDao,
UserFollowingListener userFollowingListener) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java
index 465a31eb..5078692d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java
@@ -120,6 +120,6 @@ public class APIUtils {
}
public static RequestBody getRequestBody(String s) {
- return RequestBody.create(MediaType.parse("text/plain"), s);
+ return RequestBody.create(s, MediaType.parse("text/plain"));
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java
index 5552271f..459a0170 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java
@@ -1,10 +1,8 @@
package ml.docilealligator.infinityforreddit.utils;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
import android.content.Context;
-import android.os.Build;
+import androidx.core.app.NotificationChannelCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
@@ -40,10 +38,11 @@ public class NotificationUtils {
Context context, String title, String content,
String summary, String channelId, String channelName,
String group, int color) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT);
- notificationManager.createNotificationChannel(channel);
- }
+ NotificationChannelCompat channel =
+ new NotificationChannelCompat.Builder(channelId, NotificationManagerCompat.IMPORTANCE_DEFAULT)
+ .setName(channelName)
+ .build();
+ notificationManager.createNotificationChannel(channel);
return new NotificationCompat.Builder(context.getApplicationContext(), channelId)
.setContentTitle(title)
@@ -60,10 +59,11 @@ public class NotificationUtils {
public static NotificationCompat.Builder buildSummaryNotification(Context context, NotificationManagerCompat notificationManager,
String title, String content, String channelId,
String channelName, String group, int color) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT);
- notificationManager.createNotificationChannel(channel);
- }
+ NotificationChannelCompat channel =
+ new NotificationChannelCompat.Builder(channelId, NotificationManagerCompat.IMPORTANCE_DEFAULT)
+ .setName(channelName)
+ .build();
+ notificationManager.createNotificationChannel(channel);
return new NotificationCompat.Builder(context, channelId)
.setContentTitle(title)
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
index 27e6a0b4..1d5838e1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
@@ -249,6 +249,7 @@ public class SharedPreferencesUtils {
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_HIDDEN = 16;
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_SAVED = 17;
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GILDED = 18;
+ public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_GO_TO_TOP = 19;
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS = 0;
public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH = 1;
@@ -281,6 +282,7 @@ public class SharedPreferencesUtils {
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HIDDEN = 17;
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SAVED = 18;
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GILDED = 19;
+ public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_GO_TO_TOP = 20;
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS = 0;
public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH = 1;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java
index c7b5f728..e0bf7c25 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java
@@ -50,7 +50,7 @@ public class UploadImageUtils {
image.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] byteArray = stream.toByteArray();
- RequestBody fileBody = RequestBody.create(MediaType.parse("application/octet-stream"), byteArray);
+ RequestBody fileBody = RequestBody.create(byteArray, MediaType.parse("application/octet-stream"));
MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData("file", "post_image.jpg", fileBody);
RedditAPI uploadMediaToAWSApi = uploadMediaRetrofit.create(RedditAPI.class);
diff --git a/app/src/main/res/drawable/ic_keyboard_double_arrow_up_24.xml b/app/src/main/res/drawable/ic_keyboard_double_arrow_up_24.xml
new file mode 100644
index 00000000..fd6c2ac9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_keyboard_double_arrow_up_24.xml
@@ -0,0 +1,13 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/black"
+ android:pathData="M6,17.59l1.41,1.41l4.59,-4.58l4.59,4.58l1.41,-1.41l-6,-6z"/>
+ <path
+ android:fillColor="@android:color/black"
+ android:pathData="M6,11l1.41,1.41l4.59,-4.58l4.59,4.58l1.41,-1.41l-6,-6z"/>
+</vector>
diff --git a/app/src/main/res/layout/activity_account_posts.xml b/app/src/main/res/layout/activity_account_posts.xml
index c49cdf72..a15dbc52 100644
--- a/app/src/main/res/layout/activity_account_posts.xml
+++ b/app/src/main/res/layout/activity_account_posts.xml
@@ -33,7 +33,7 @@
</com.google.android.material.appbar.AppBarLayout>
- <FrameLayout
+ <androidx.fragment.app.FragmentContainerView
android:id="@+id/frame_layout_account_posts_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/activity_anonymous_subscriptions.xml b/app/src/main/res/layout/activity_anonymous_subscriptions.xml
index 85473583..eb030fd8 100644
--- a/app/src/main/res/layout/activity_anonymous_subscriptions.xml
+++ b/app/src/main/res/layout/activity_anonymous_subscriptions.xml
@@ -32,7 +32,7 @@
</com.google.android.material.appbar.AppBarLayout>
- <FrameLayout
+ <androidx.fragment.app.FragmentContainerView
android:id="@+id/frame_layout_anonymous_subscriptions_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/activity_filtered_thing.xml b/app/src/main/res/layout/activity_filtered_thing.xml
index 5aa0207b..bc2160ff 100644
--- a/app/src/main/res/layout/activity_filtered_thing.xml
+++ b/app/src/main/res/layout/activity_filtered_thing.xml
@@ -34,7 +34,7 @@
</com.google.android.material.appbar.AppBarLayout>
- <FrameLayout
+ <androidx.fragment.app.FragmentContainerView
android:id="@+id/frame_layout_filtered_posts_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/activity_multireddit_selection.xml b/app/src/main/res/layout/activity_multireddit_selection.xml
index 4c114742..aec94a4f 100644
--- a/app/src/main/res/layout/activity_multireddit_selection.xml
+++ b/app/src/main/res/layout/activity_multireddit_selection.xml
@@ -32,7 +32,7 @@
</com.google.android.material.appbar.AppBarLayout>
- <FrameLayout
+ <androidx.fragment.app.FragmentContainerView
android:id="@+id/frame_layout_multireddit_selection_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/activity_search_subreddits_result.xml b/app/src/main/res/layout/activity_search_subreddits_result.xml
index b3390378..5824e728 100644
--- a/app/src/main/res/layout/activity_search_subreddits_result.xml
+++ b/app/src/main/res/layout/activity_search_subreddits_result.xml
@@ -23,7 +23,7 @@
</com.google.android.material.appbar.AppBarLayout>
- <FrameLayout
+ <androidx.fragment.app.FragmentContainerView
android:id="@+id/frame_layout_search_subreddits_result_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/activity_search_users_result.xml b/app/src/main/res/layout/activity_search_users_result.xml
index b594ccb5..cdc6ee54 100644
--- a/app/src/main/res/layout/activity_search_users_result.xml
+++ b/app/src/main/res/layout/activity_search_users_result.xml
@@ -23,7 +23,7 @@
</com.google.android.material.appbar.AppBarLayout>
- <FrameLayout
+ <androidx.fragment.app.FragmentContainerView
android:id="@+id/frame_layout_search_users_result_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 99b93a7a..339d4685 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -28,7 +28,7 @@
</com.google.android.material.appbar.AppBarLayout>
- <FrameLayout
+ <androidx.fragment.app.FragmentContainerView
android:id="@+id/frame_layout_settings_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/activity_subreddit_selection.xml b/app/src/main/res/layout/activity_subreddit_selection.xml
index fddc0f8e..8d027137 100644
--- a/app/src/main/res/layout/activity_subreddit_selection.xml
+++ b/app/src/main/res/layout/activity_subreddit_selection.xml
@@ -32,7 +32,7 @@
</com.google.android.material.appbar.AppBarLayout>
- <FrameLayout
+ <androidx.fragment.app.FragmentContainerView
android:id="@+id/frame_layout_subreddit_selection_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/activity_view_imgur_media.xml b/app/src/main/res/layout/activity_view_imgur_media.xml
index 408ddff4..b9eaf6a2 100644
--- a/app/src/main/res/layout/activity_view_imgur_media.xml
+++ b/app/src/main/res/layout/activity_view_imgur_media.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.thefuntasty.hauler.HaulerView xmlns:android="http://schemas.android.com/apk/res/android"
+<app.futured.hauler.HaulerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/hauler_view_view_imgur_media_activity"
@@ -51,4 +51,4 @@
</androidx.core.widget.NestedScrollView>
-</com.thefuntasty.hauler.HaulerView> \ No newline at end of file
+</app.futured.hauler.HaulerView> \ No newline at end of file
diff --git a/app/src/main/res/layout/activity_view_multi_reddit_detail.xml b/app/src/main/res/layout/activity_view_multi_reddit_detail.xml
index f5efe407..de606f75 100644
--- a/app/src/main/res/layout/activity_view_multi_reddit_detail.xml
+++ b/app/src/main/res/layout/activity_view_multi_reddit_detail.xml
@@ -33,7 +33,7 @@
</com.google.android.material.appbar.AppBarLayout>
- <FrameLayout
+ <androidx.fragment.app.FragmentContainerView
android:id="@+id/frame_layout_view_multi_reddit_detail_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/activity_view_reddit_gallery.xml b/app/src/main/res/layout/activity_view_reddit_gallery.xml
index 6027fce2..495a2cc1 100644
--- a/app/src/main/res/layout/activity_view_reddit_gallery.xml
+++ b/app/src/main/res/layout/activity_view_reddit_gallery.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.thefuntasty.hauler.HaulerView xmlns:android="http://schemas.android.com/apk/res/android"
+<app.futured.hauler.HaulerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/hauler_view_view_reddit_gallery_activity"
@@ -20,4 +20,4 @@
</androidx.core.widget.NestedScrollView>
-</com.thefuntasty.hauler.HaulerView> \ No newline at end of file
+</app.futured.hauler.HaulerView> \ No newline at end of file
diff --git a/app/src/main/res/menu/view_subreddit_detail_activity.xml b/app/src/main/res/menu/view_subreddit_detail_activity.xml
index c1631814..cb92de44 100644
--- a/app/src/main/res/menu/view_subreddit_detail_activity.xml
+++ b/app/src/main/res/menu/view_subreddit_detail_activity.xml
@@ -58,4 +58,10 @@
android:orderInCategory="9"
android:title="@string/action_share"
app:showAsAction="never" />
+
+ <item
+ android:id="@+id/action_go_to_wiki_activity"
+ android:orderInCategory="10"
+ android:title="@string/action_go_to_wiki"
+ app:showAsAction="never" />
</menu>
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 4c721908..330abd60 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -283,6 +283,7 @@
<item>@string/hidden</item>
<item>@string/saved</item>
<item>@string/gilded</item>
+ <item>@string/go_to_top</item>
</string-array>
<string-array name="settings_other_activities_bottom_app_bar_options">
@@ -306,6 +307,7 @@
<item>@string/hidden</item>
<item>@string/saved</item>
<item>@string/gilded</item>
+ <item>@string/go_to_top</item>
</string-array>
<string-array name="settings_bottom_app_bar_fab_options">
diff --git a/app/src/main/res/values/attr.xml b/app/src/main/res/values/attr.xml
index 0cfd9358..a14ca442 100644
--- a/app/src/main/res/values/attr.xml
+++ b/app/src/main/res/values/attr.xml
@@ -49,7 +49,4 @@
<attr name="backgroundColor" format="color"/>
<attr name="cardViewBackgroundColor" format="color"/>
</declare-styleable>
-
- <attr name="backIconAlpha"/>
- <attr name="iconsAlpha"/>
</resources> \ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 68ab820b..7b44a036 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1191,4 +1191,7 @@
<string name="app_lock_timeout_12_hours">12 hours</string>
<string name="app_lock_timeout_24_hours">24 hours</string>
+ <string name="go_to_top">Go To Top</string>
+ <string name="action_go_to_wiki">Go to Wiki</string>
+
</resources>