aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-07-03 13:48:35 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-07-03 13:48:35 +0000
commit90f741e9e110e408a8f37290e074cb250ac664fd (patch)
treee8eb51dd4ea48b8082c89e8f36c0ea200624d27d /app/src/main/java
parent4f8b313b3c42084e66fcdc0e3aaaf870c97b5688 (diff)
downloadinfinity-for-reddit-90f741e9e110e408a8f37290e074cb250ac664fd.tar
infinity-for-reddit-90f741e9e110e408a8f37290e074cb250ac664fd.tar.gz
infinity-for-reddit-90f741e9e110e408a8f37290e074cb250ac664fd.tar.bz2
infinity-for-reddit-90f741e9e110e408a8f37290e074cb250ac664fd.tar.lz
infinity-for-reddit-90f741e9e110e408a8f37290e074cb250ac664fd.tar.xz
infinity-for-reddit-90f741e9e110e408a8f37290e074cb250ac664fd.tar.zst
infinity-for-reddit-90f741e9e110e408a8f37290e074cb250ac664fd.zip
Add more themeing options for links, private messages, etc. Restructure class files.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/InboxActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java22
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java111
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java47
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java16
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PrivateMessagesDetailRecyclerViewAdapter.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/CommentMoreBottomSheetFragment.java32
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Comment/Comment.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java)48
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Comment/CommentDataSource.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/CommentDataSource.java)28
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Comment/CommentDataSourceFactory.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/CommentDataSourceFactory.java)3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Comment/CommentViewModel.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/CommentViewModel.java)8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Comment/FetchComment.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java)10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Comment/ParseComment.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java)46
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Comment/SendComment.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/SendComment.java)8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java138
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java32
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java128
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Event/RepliedToPrivateMessageEvent.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedComment.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/InboxFragment.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Message/FetchMessage.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java)4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Message/Message.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/Message.java)12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Message/MessageDataSource.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/MessageDataSource.java)17
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Message/MessageDataSourceFactory.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/MessageDataSourceFactory.java)2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Message/MessageViewModel.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/MessageViewModel.java)3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Message/ParseMessage.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/ParseMessage.java)8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Message/ReadMessage.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/ReadMessage.java)2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Message/ReplyMessage.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/ReplyMessage.java)2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java27
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java8
39 files changed, 551 insertions, 282 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java
index c87fd263..8eeb0a07 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java
@@ -49,14 +49,14 @@ import io.noties.markwon.recycler.table.TableEntryPlugin;
import io.noties.markwon.simple.ext.SimpleExtPlugin;
import io.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute;
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
-import ml.docilealligator.infinityforreddit.CommentData;
+import ml.docilealligator.infinityforreddit.Comment.Comment;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.BottomSheetFragment.CopyTextBottomSheetFragment;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
-import ml.docilealligator.infinityforreddit.SendComment;
+import ml.docilealligator.infinityforreddit.Comment.SendComment;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.Utils;
import retrofit2.Retrofit;
@@ -330,13 +330,13 @@ public class CommentActivity extends BaseActivity {
mAccessToken,
new SendComment.SendCommentListener() {
@Override
- public void sendCommentSuccess(CommentData commentData) {
+ public void sendCommentSuccess(Comment comment) {
isSubmitting = false;
item.setEnabled(true);
item.getIcon().setAlpha(255);
Toast.makeText(CommentActivity.this, R.string.send_comment_success, Toast.LENGTH_SHORT).show();
Intent returnIntent = new Intent();
- returnIntent.putExtra(RETURN_EXTRA_COMMENT_DATA_KEY, commentData);
+ returnIntent.putExtra(RETURN_EXTRA_COMMENT_DATA_KEY, comment);
returnIntent.putExtra(EXTRA_PARENT_FULLNAME_KEY, parentFullname);
if (isReplying) {
returnIntent.putExtra(EXTRA_PARENT_POSITION_KEY, parentPosition);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/InboxActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/InboxActivity.java
index 66072a2b..fa62c47c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/InboxActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/InboxActivity.java
@@ -38,7 +38,7 @@ import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
-import ml.docilealligator.infinityforreddit.FetchMessages;
+import ml.docilealligator.infinityforreddit.Message.FetchMessage;
import ml.docilealligator.infinityforreddit.Fragment.InboxFragment;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
@@ -280,14 +280,14 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
InboxFragment fragment = new InboxFragment();
Bundle bundle = new Bundle();
bundle.putString(InboxFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
- bundle.putString(InboxFragment.EXTRA_MESSAGE_WHERE, FetchMessages.WHERE_INBOX);
+ bundle.putString(InboxFragment.EXTRA_MESSAGE_WHERE, FetchMessage.WHERE_INBOX);
fragment.setArguments(bundle);
return fragment;
} else {
InboxFragment fragment = new InboxFragment();
Bundle bundle = new Bundle();
bundle.putString(InboxFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
- bundle.putString(InboxFragment.EXTRA_MESSAGE_WHERE, FetchMessages.WHERE_MESSAGES);
+ bundle.putString(InboxFragment.EXTRA_MESSAGE_WHERE, FetchMessage.WHERE_MESSAGES);
fragment.setArguments(bundle);
return fragment;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
index 04c1ff41..824a686d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
@@ -82,7 +82,7 @@ import ml.docilealligator.infinityforreddit.ParseAndSaveAccountInfo;
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
import ml.docilealligator.infinityforreddit.PullNotificationWorker;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.ReadMessage;
+import ml.docilealligator.infinityforreddit.Message.ReadMessage;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
index 6586dd08..000e677d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java
@@ -62,7 +62,7 @@ import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
import ml.docilealligator.infinityforreddit.BottomSheetFragment.FlairBottomSheetFragment;
import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostCommentSortTypeBottomSheetFragment;
-import ml.docilealligator.infinityforreddit.CommentData;
+import ml.docilealligator.infinityforreddit.Comment.Comment;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.CustomView.CustomToroContainer;
import ml.docilealligator.infinityforreddit.DeleteThing;
@@ -72,18 +72,18 @@ import ml.docilealligator.infinityforreddit.Event.ChangeWifiStatusEvent;
import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToDetailActivity;
import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
-import ml.docilealligator.infinityforreddit.FetchComment;
+import ml.docilealligator.infinityforreddit.Comment.FetchComment;
import ml.docilealligator.infinityforreddit.FetchRemovedComment;
import ml.docilealligator.infinityforreddit.FetchRemovedPost;
import ml.docilealligator.infinityforreddit.Flair;
import ml.docilealligator.infinityforreddit.Infinity;
-import ml.docilealligator.infinityforreddit.ParseComment;
+import ml.docilealligator.infinityforreddit.Comment.ParseComment;
import ml.docilealligator.infinityforreddit.Post.FetchPost;
import ml.docilealligator.infinityforreddit.Post.HidePost;
import ml.docilealligator.infinityforreddit.Post.ParsePost;
import ml.docilealligator.infinityforreddit.Post.Post;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.ReadMessage;
+import ml.docilealligator.infinityforreddit.Message.ReadMessage;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SaveThing;
import ml.docilealligator.infinityforreddit.SortType;
@@ -126,7 +126,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
@State
boolean isSingleCommentThreadMode = false;
@State
- ArrayList<CommentData> comments;
+ ArrayList<Comment> comments;
@State
ArrayList<String> children;
@State
@@ -648,7 +648,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
ParseComment.parseComment(response.body(), new ArrayList<>(), mLocale,
mExpandChildren, new ParseComment.ParseCommentListener() {
@Override
- public void onParseCommentSuccess(ArrayList<CommentData> expandedComments, String parentId, ArrayList<String> moreChildrenFullnames) {
+ public void onParseCommentSuccess(ArrayList<Comment> expandedComments, String parentId, ArrayList<String> moreChildrenFullnames) {
ViewPostDetailActivity.this.children = moreChildrenFullnames;
hasMoreChildren = children.size() != 0;
@@ -738,7 +738,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
FetchComment.fetchComments(retrofit, mAccessToken, mPost.getId(), commentId, sortType, mExpandChildren,
mLocale, new FetchComment.FetchCommentListener() {
@Override
- public void onFetchCommentSuccess(ArrayList<CommentData> expandedComments,
+ public void onFetchCommentSuccess(ArrayList<Comment> expandedComments,
String parentId, ArrayList<String> children) {
if (checkSortState && isSortingComments) {
if (changeRefreshState) {
@@ -840,7 +840,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
FetchComment.fetchMoreComment(retrofit, mAccessToken, children, mChildrenStartingIndex,
0, mExpandChildren, mLocale, new FetchComment.FetchMoreCommentListener() {
@Override
- public void onFetchMoreCommentSuccess(ArrayList<CommentData> expandedComments, int childrenStartingIndex) {
+ public void onFetchMoreCommentSuccess(ArrayList<Comment> expandedComments, int childrenStartingIndex) {
hasMoreChildren = childrenStartingIndex < children.size();
mAdapter.addComments(expandedComments, hasMoreChildren);
mChildrenStartingIndex = childrenStartingIndex;
@@ -1091,14 +1091,14 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
.show();
}
- public void showRemovedComment(CommentData comment, int position) {
+ public void showRemovedComment(Comment comment, int position) {
Toast.makeText(ViewPostDetailActivity.this, R.string.fetching_removed_comment, Toast.LENGTH_SHORT).show();
FetchRemovedComment.fetchRemovedComment(
pushshiftRetrofit,
comment,
new FetchRemovedComment.FetchRemovedCommentListener() {
@Override
- public void fetchSuccess(CommentData comment) {
+ public void fetchSuccess(Comment comment) {
mAdapter.editComment(comment.getAuthor(), comment.getCommentMarkdown(), position);
}
@@ -1451,7 +1451,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
if (requestCode == WRITE_COMMENT_REQUEST_CODE) {
if (data != null && resultCode == RESULT_OK) {
if (data.hasExtra(RETURN_EXTRA_COMMENT_DATA_KEY)) {
- CommentData comment = data.getParcelableExtra(RETURN_EXTRA_COMMENT_DATA_KEY);
+ Comment comment = data.getParcelableExtra(RETURN_EXTRA_COMMENT_DATA_KEY);
if (comment != null && comment.getDepth() == 0) {
mAdapter.addComment(comment);
} else {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java
index b75f9e8b..e78cdc47 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPrivateMessagesActivity.java
@@ -39,11 +39,11 @@ import ml.docilealligator.infinityforreddit.AsyncTask.LoadUserDataAsyncTask;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Event.RepliedToPrivateMessageEvent;
import ml.docilealligator.infinityforreddit.Infinity;
-import ml.docilealligator.infinityforreddit.Message;
+import ml.docilealligator.infinityforreddit.Message.Message;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.ReadMessage;
+import ml.docilealligator.infinityforreddit.Message.ReadMessage;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
-import ml.docilealligator.infinityforreddit.ReplyMessage;
+import ml.docilealligator.infinityforreddit.Message.ReplyMessage;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import retrofit2.Retrofit;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
index 2b516549..aa42d49a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
@@ -73,7 +73,7 @@ import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.ReadMessage;
+import ml.docilealligator.infinityforreddit.Message.ReadMessage;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
index cbcd54be..8134ebcf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
@@ -70,7 +70,7 @@ import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.ReadMessage;
+import ml.docilealligator.infinityforreddit.Message.ReadMessage;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
index cb3bc599..f815b3c6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -69,6 +69,7 @@ import im.ene.toro.widget.Container;
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration;
+import io.noties.markwon.core.MarkwonTheme;
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
import io.noties.markwon.linkify.LinkifyPlugin;
import io.noties.markwon.recycler.MarkwonAdapter;
@@ -91,11 +92,11 @@ import ml.docilealligator.infinityforreddit.AsyncTask.LoadUserDataAsyncTask;
import ml.docilealligator.infinityforreddit.BottomSheetFragment.CommentMoreBottomSheetFragment;
import ml.docilealligator.infinityforreddit.BottomSheetFragment.CopyTextBottomSheetFragment;
import ml.docilealligator.infinityforreddit.BottomSheetFragment.ShareLinkBottomSheetFragment;
-import ml.docilealligator.infinityforreddit.CommentData;
+import ml.docilealligator.infinityforreddit.Comment.Comment;
+import ml.docilealligator.infinityforreddit.Comment.FetchComment;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView;
import ml.docilealligator.infinityforreddit.CustomView.MarkwonLinearLayoutManager;
-import ml.docilealligator.infinityforreddit.FetchComment;
import ml.docilealligator.infinityforreddit.Post.Post;
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
import ml.docilealligator.infinityforreddit.R;
@@ -138,7 +139,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private String mAccessToken;
private String mAccountName;
private Post mPost;
- private ArrayList<CommentData> mVisibleComments;
+ private ArrayList<Comment> mVisibleComments;
private String mSubredditNamePrefixed;
private Locale mLocale;
private String mSingleCommentId;
@@ -205,6 +206,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private int mButtonTextColor;
private int mPostIconAndInfoColor;
private int mCommentIconAndInfoColor;
+ private int mFullyCollapsedCommentBackgroundColor;
+ private int mAwardedCommentBackgroundColor;
private Drawable mCommentIcon;
private float mScale;
@@ -226,6 +229,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mGlide = glide;
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
int markdownColor = customThemeWrapper.getPostContentColor();
+ int linkColor = customThemeWrapper.getLinkColor();
mPostDetailMarkwon = Markwon.builder(mActivity)
.usePlugin(new AbstractMarkwonPlugin() {
@Override
@@ -254,6 +258,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mActivity.startActivity(intent);
}).urlProcessor(new UrlProcessorRelativeToAbsolute("https://www.reddit.com"));
}
+
+ @Override
+ public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
+ builder.linkColor(linkColor);
+ }
})
.usePlugin(StrikethroughPlugin.create())
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
@@ -280,6 +289,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mActivity.startActivity(intent);
}).urlProcessor(new UrlProcessorRelativeToAbsolute("https://www.reddit.com"));
}
+
+ @Override
+ public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
+ builder.linkColor(linkColor);
+ }
})
.usePlugin(StrikethroughPlugin.create())
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
@@ -373,6 +387,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mButtonTextColor = customThemeWrapper.getButtonTextColor();
mPostIconAndInfoColor = customThemeWrapper.getPostIconAndInfoColor();
mCommentIconAndInfoColor = customThemeWrapper.getCommentIconAndInfoColor();
+ mFullyCollapsedCommentBackgroundColor = customThemeWrapper.getFullyCollapsedCommentBackgroundColor();
+ mAwardedCommentBackgroundColor = customThemeWrapper.getAwardedCommentBackgroundColor();
mCommentIcon = activity.getDrawable(R.drawable.ic_comment_grey_24dp);
if (mCommentIcon != null) {
@@ -443,7 +459,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}
- CommentData comment = mVisibleComments.get(position - 2);
+ Comment comment = mVisibleComments.get(position - 2);
if (!comment.isPlaceHolder()) {
if (mFullyCollapseComment && comment.hasReply() && !comment.isExpanded() && comment.hasExpandedBefore()) {
return VIEW_TYPE_COMMENT_FULLY_COLLAPSED;
@@ -461,7 +477,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}
- CommentData comment = mVisibleComments.get(position - 1);
+ Comment comment = mVisibleComments.get(position - 1);
if (!comment.isPlaceHolder()) {
if (mFullyCollapseComment && comment.hasReply() && !comment.isExpanded() && comment.hasExpandedBefore()) {
return VIEW_TYPE_COMMENT_FULLY_COLLAPSED;
@@ -743,7 +759,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}
} else if (holder instanceof CommentViewHolder) {
- CommentData comment;
+ Comment comment;
if (mIsSingleCommentThreadMode) {
comment = mVisibleComments.get(holder.getAdapterPosition() - 2);
} else {
@@ -752,6 +768,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (mIsSingleCommentThreadMode && comment.getId().equals(mSingleCommentId)) {
((CommentViewHolder) holder).itemView.setBackgroundColor(mSingleCommentThreadBackgroundColor);
+ } else if (comment.getAwards() != null && !comment.getAwards().equals("")) {
+ ((CommentViewHolder) holder).itemView.setBackgroundColor(mAwardedCommentBackgroundColor);
}
String authorPrefixed = "u/" + comment.getAuthor();
@@ -859,12 +877,12 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
switch (comment.getVoteType()) {
- case CommentData.VOTE_TYPE_UPVOTE:
+ case Comment.VOTE_TYPE_UPVOTE:
((CommentViewHolder) holder).upvoteButton
.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
break;
- case CommentData.VOTE_TYPE_DOWNVOTE:
+ case Comment.VOTE_TYPE_DOWNVOTE:
((CommentViewHolder) holder).downvoteButton
.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
@@ -895,7 +913,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
}
} else if (holder instanceof CommentFullyCollapsedViewHolder) {
- CommentData comment;
+ Comment comment;
if (mIsSingleCommentThreadMode) {
comment = mVisibleComments.get(holder.getAdapterPosition() - 2);
} else {
@@ -904,10 +922,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
String authorWithPrefix = "u/" + comment.getAuthor();
((CommentFullyCollapsedViewHolder) holder).usernameTextView.setText(authorWithPrefix);
- if (comment.getMoreChildrenFullnames() != null) {
- ((CommentFullyCollapsedViewHolder) holder).nMoreRepliesTextView.setText(Integer.toString(1 + comment.getMoreChildrenFullnames().size()));
+ if (mShowElapsedTime) {
+ ((CommentFullyCollapsedViewHolder) holder).commentTimeTextView.setText(Utils.getElapsedTime(mActivity, comment.getCommentTimeMillis()));
} else {
- ((CommentFullyCollapsedViewHolder) holder).nMoreRepliesTextView.setText(Integer.toString(1));
+ ((CommentFullyCollapsedViewHolder) holder).commentTimeTextView.setText(Utils.getFormattedTime(mLocale, comment.getCommentTimeMillis(), mTimeFormatPattern));
}
((CommentFullyCollapsedViewHolder) holder).scoreTextView.setText(Integer.toString(comment.getScore()));
@@ -948,7 +966,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
((CommentFullyCollapsedViewHolder) holder).verticalBlock.setLayoutParams(params);
}
} else if (holder instanceof LoadMoreChildCommentsViewHolder) {
- CommentData placeholder;
+ Comment placeholder;
placeholder = mIsSingleCommentThreadMode ? mVisibleComments.get(holder.getAdapterPosition() - 2)
: mVisibleComments.get(holder.getAdapterPosition() - 1);
@@ -1002,7 +1020,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
int commentPosition = mIsSingleCommentThreadMode ? holder.getAdapterPosition() - 2 : holder.getAdapterPosition() - 1;
int parentPosition = getParentPosition(commentPosition);
if (parentPosition >= 0) {
- CommentData parentComment = mVisibleComments.get(parentPosition);
+ Comment parentComment = mVisibleComments.get(parentPosition);
mVisibleComments.get(commentPosition).setLoadingMoreChildren(true);
mVisibleComments.get(commentPosition).setLoadMoreChildrenFailed(false);
@@ -1014,7 +1032,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mExpandChildren, mLocale,
new FetchComment.FetchMoreCommentListener() {
@Override
- public void onFetchMoreCommentSuccess(ArrayList<CommentData> expandedComments,
+ public void onFetchMoreCommentSuccess(ArrayList<Comment> expandedComments,
int childrenStartingIndex) {
if (mVisibleComments.size() > parentPosition
&& parentComment.getFullName().equals(mVisibleComments.get(parentPosition).getFullName())) {
@@ -1287,7 +1305,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
return -1;
}
- private void expandChildren(ArrayList<CommentData> comments, ArrayList<CommentData> newList, int position) {
+ private void expandChildren(ArrayList<Comment> comments, ArrayList<Comment> newList, int position) {
if (comments != null && comments.size() > 0) {
newList.addAll(position, comments);
for (int i = 0; i < comments.size(); i++) {
@@ -1327,7 +1345,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}
- public void addComments(@NonNull ArrayList<CommentData> comments, boolean hasMoreComments) {
+ public void addComments(@NonNull ArrayList<Comment> comments, boolean hasMoreComments) {
if (mVisibleComments.size() == 0) {
isInitiallyLoading = false;
isInitiallyLoadingFailed = false;
@@ -1364,7 +1382,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mHasMoreComments = hasMoreComments;
}
- public void addComment(CommentData comment) {
+ public void addComment(Comment comment) {
if (mVisibleComments.size() == 0 || isInitiallyLoadingFailed) {
notifyItemRemoved(1);
}
@@ -1378,7 +1396,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}
- public void addChildComment(CommentData comment, String parentFullname, int parentPosition) {
+ public void addChildComment(Comment comment, String parentFullname, int parentPosition) {
if (!parentFullname.equals(mVisibleComments.get(parentPosition).getFullName())) {
for (int i = 0; i < mVisibleComments.size(); i++) {
if (parentFullname.equals(mVisibleComments.get(i).getFullName())) {
@@ -1391,7 +1409,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mVisibleComments.get(parentPosition).addChild(comment);
mVisibleComments.get(parentPosition).setHasReply(true);
if (!mVisibleComments.get(parentPosition).isExpanded()) {
- ArrayList<CommentData> newList = new ArrayList<>();
+ ArrayList<Comment> newList = new ArrayList<>();
expandChildren(mVisibleComments.get(parentPosition).getChildren(), newList, 0);
mVisibleComments.get(parentPosition).setExpanded(true);
mVisibleComments.addAll(parentPosition + 1, newList);
@@ -1417,7 +1435,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mIsSingleCommentThreadMode = isSingleCommentThreadMode;
}
- public ArrayList<CommentData> getVisibleComments() {
+ public ArrayList<Comment> getVisibleComments() {
return mVisibleComments;
}
@@ -2799,7 +2817,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
authorFlairTextView.setOnClickListener(view -> authorTextView.performClick());
moreButton.setOnClickListener(view -> {
- CommentData comment = getCurrentComment(this);
+ Comment comment = getCurrentComment(this);
Bundle bundle = new Bundle();
if (!mPost.isArchived() && !mPost.isLocked() && comment.getAuthor().equals(mAccountName)) {
bundle.putString(CommentMoreBottomSheetFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
@@ -2831,7 +2849,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
return;
}
- CommentData comment = getCurrentComment(this);
+ Comment comment = getCurrentComment(this);
Intent intent = new Intent(mActivity, CommentActivity.class);
intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, comment.getDepth() + 1);
@@ -2856,21 +2874,21 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
return;
}
- CommentData comment = getCurrentComment(this);
+ Comment comment = getCurrentComment(this);
int previousVoteType = comment.getVoteType();
String newVoteType;
downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- if (previousVoteType != CommentData.VOTE_TYPE_UPVOTE) {
+ if (previousVoteType != Comment.VOTE_TYPE_UPVOTE) {
//Not upvoted before
- comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_UPVOTE);
newVoteType = APIUtils.DIR_UPVOTE;
upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mUpvotedColor);
} else {
//Upvoted before
- comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE);
newVoteType = APIUtils.DIR_UNVOTE;
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mCommentIconAndInfoColor);
@@ -2885,11 +2903,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@Override
public void onVoteThingSuccess(int position) {
if (newVoteType.equals(APIUtils.DIR_UPVOTE)) {
- comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_UPVOTE);
upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mUpvotedColor);
} else {
- comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE);
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mCommentIconAndInfoColor);
}
@@ -2918,21 +2936,21 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
return;
}
- CommentData comment = getCurrentComment(this);
+ Comment comment = getCurrentComment(this);
int previousVoteType = comment.getVoteType();
String newVoteType;
upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- if (previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) {
+ if (previousVoteType != Comment.VOTE_TYPE_DOWNVOTE) {
//Not downvoted before
- comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_DOWNVOTE);
newVoteType = APIUtils.DIR_DOWNVOTE;
downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mDownvotedColor);
} else {
//Downvoted before
- comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE);
newVoteType = APIUtils.DIR_UNVOTE;
downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mCommentIconAndInfoColor);
@@ -2947,11 +2965,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@Override
public void onVoteThingSuccess(int position1) {
if (newVoteType.equals(APIUtils.DIR_DOWNVOTE)) {
- comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_DOWNVOTE);
downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mDownvotedColor);
} else {
- comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE);
downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
scoreTextView.setTextColor(mCommentIconAndInfoColor);
}
@@ -2970,7 +2988,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
});
saveButton.setOnClickListener(view -> {
- CommentData comment = getCurrentComment(this);
+ Comment comment = getCurrentComment(this);
if (comment.isSaved()) {
comment.setSaved(false);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() {
@@ -3018,13 +3036,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (expandButton.getVisibility() == View.VISIBLE) {
int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
if (commentPosition >= 0 && commentPosition < mVisibleComments.size()) {
- CommentData comment = getCurrentComment(this);
+ Comment comment = getCurrentComment(this);
if (mVisibleComments.get(commentPosition).isExpanded()) {
collapseChildren(commentPosition);
expandButton.setImageResource(R.drawable.ic_expand_more_grey_24dp);
} else {
comment.setExpanded(true);
- ArrayList<CommentData> newList = new ArrayList<>();
+ ArrayList<Comment> newList = new ArrayList<>();
expandChildren(mVisibleComments.get(commentPosition).getChildren(), newList, 0);
mVisibleComments.get(commentPosition).setExpanded(true);
mVisibleComments.addAll(commentPosition + 1, newList);
@@ -3082,8 +3100,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}
- private CommentData getCurrentComment(RecyclerView.ViewHolder holder) {
- CommentData comment;
+ private Comment getCurrentComment(RecyclerView.ViewHolder holder) {
+ Comment comment;
if (mIsSingleCommentThreadMode) {
comment = mVisibleComments.get(holder.getAdapterPosition() - 2);
} else {
@@ -3100,8 +3118,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
TextView usernameTextView;
@BindView(R.id.score_text_view_item_comment_fully_collapsed)
TextView scoreTextView;
- @BindView(R.id.more_count_text_view_item_comment_fully_collapsed)
- TextView nMoreRepliesTextView;
+ @BindView(R.id.time_text_view_item_comment_fully_collapsed)
+ TextView commentTimeTextView;
@BindView(R.id.divider_item_load_comment_fully_collapsed)
View commentDivider;
@@ -3109,6 +3127,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
super(itemView);
ButterKnife.bind(this, itemView);
+ itemView.setBackgroundColor(mFullyCollapsedCommentBackgroundColor);
+ usernameTextView.setTextColor(mUsernameColor);
+ scoreTextView.setTextColor(mCommentIconAndInfoColor);
+ commentTimeTextView.setTextColor(mSecondaryTextColor);
+
if (mShowCommentDivider) {
commentDivider.setBackgroundColor(mDividerColor);
commentDivider.setVisibility(View.VISIBLE);
@@ -3117,9 +3140,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
itemView.setOnClickListener(view -> {
int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
if (commentPosition >= 0 && commentPosition < mVisibleComments.size()) {
- CommentData comment = getCurrentComment(this);
+ Comment comment = getCurrentComment(this);
comment.setExpanded(true);
- ArrayList<CommentData> newList = new ArrayList<>();
+ ArrayList<Comment> newList = new ArrayList<>();
expandChildren(mVisibleComments.get(commentPosition).getChildren(), newList, 0);
mVisibleComments.get(commentPosition).setExpanded(true);
mVisibleComments.addAll(commentPosition + 1, newList);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java
index f58da947..eb3ef3f2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java
@@ -33,6 +33,7 @@ import butterknife.ButterKnife;
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration;
+import io.noties.markwon.core.MarkwonTheme;
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
import io.noties.markwon.linkify.LinkifyPlugin;
import io.noties.markwon.simple.ext.SimpleExtPlugin;
@@ -41,7 +42,7 @@ import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
import ml.docilealligator.infinityforreddit.BottomSheetFragment.CommentMoreBottomSheetFragment;
-import ml.docilealligator.infinityforreddit.CommentData;
+import ml.docilealligator.infinityforreddit.Comment.Comment;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.NetworkState;
import ml.docilealligator.infinityforreddit.R;
@@ -52,19 +53,19 @@ import ml.docilealligator.infinityforreddit.Utils.Utils;
import ml.docilealligator.infinityforreddit.VoteThing;
import retrofit2.Retrofit;
-public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<CommentData, RecyclerView.ViewHolder> {
+public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment, RecyclerView.ViewHolder> {
private static final int VIEW_TYPE_DATA = 0;
private static final int VIEW_TYPE_ERROR = 1;
private static final int VIEW_TYPE_LOADING = 2;
- private static final DiffUtil.ItemCallback<CommentData> DIFF_CALLBACK = new DiffUtil.ItemCallback<CommentData>() {
+ private static final DiffUtil.ItemCallback<Comment> DIFF_CALLBACK = new DiffUtil.ItemCallback<Comment>() {
@Override
- public boolean areItemsTheSame(@NonNull CommentData commentData, @NonNull CommentData t1) {
- return commentData.getId().equals(t1.getId());
+ public boolean areItemsTheSame(@NonNull Comment comment, @NonNull Comment t1) {
+ return comment.getId().equals(t1.getId());
}
@Override
- public boolean areContentsTheSame(@NonNull CommentData commentData, @NonNull CommentData t1) {
- return commentData.getCommentMarkdown().equals(t1.getCommentMarkdown());
+ public boolean areContentsTheSame(@NonNull Comment comment, @NonNull Comment t1) {
+ return comment.getCommentMarkdown().equals(t1.getCommentMarkdown());
}
};
private Context mContext;
@@ -104,6 +105,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
mMarkwon = Markwon.builder(mContext)
.usePlugin(new AbstractMarkwonPlugin() {
@Override
+ public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
+ builder.linkColor(customThemeWrapper.getLinkColor());
+ }
+
+ @Override
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
builder.linkResolver((view, link) -> {
Intent intent = new Intent(mContext, LinkResolverActivity.class);
@@ -115,6 +121,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
}
mContext.startActivity(intent);
});
+
}
})
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
@@ -165,7 +172,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof CommentViewHolder) {
- CommentData comment = getItem(holder.getAdapterPosition());
+ Comment comment = getItem(holder.getAdapterPosition());
if (comment != null) {
if (comment.getSubredditName().substring(2).equals(comment.getLinkAuthor())) {
((CommentViewHolder) holder).authorTextView.setText("u/" + comment.getLinkAuthor());
@@ -210,12 +217,12 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
comment.getScore() + comment.getVoteType()));
switch (comment.getVoteType()) {
- case CommentData.VOTE_TYPE_UPVOTE:
+ case Comment.VOTE_TYPE_UPVOTE:
((CommentViewHolder) holder).upvoteButton
.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
break;
- case CommentData.VOTE_TYPE_DOWNVOTE:
+ case Comment.VOTE_TYPE_DOWNVOTE:
((CommentViewHolder) holder).downvoteButton
.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
@@ -259,16 +266,16 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- if (previousVoteType != CommentData.VOTE_TYPE_UPVOTE) {
+ if (previousVoteType != Comment.VOTE_TYPE_UPVOTE) {
//Not upvoted before
- comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_UPVOTE);
newVoteType = APIUtils.DIR_UPVOTE;
((CommentViewHolder) holder).upvoteButton
.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
} else {
//Upvoted before
- comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE);
newVoteType = APIUtils.DIR_UNVOTE;
((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
@@ -281,11 +288,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
@Override
public void onVoteThingSuccess(int position) {
if (newVoteType.equals(APIUtils.DIR_UPVOTE)) {
- comment.setVoteType(CommentData.VOTE_TYPE_UPVOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_UPVOTE);
((CommentViewHolder) holder).upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor);
} else {
- comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE);
((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
}
@@ -312,15 +319,15 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
((CommentViewHolder) holder).upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
- if (previousVoteType != CommentData.VOTE_TYPE_DOWNVOTE) {
+ if (previousVoteType != Comment.VOTE_TYPE_DOWNVOTE) {
//Not downvoted before
- comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_DOWNVOTE);
newVoteType = APIUtils.DIR_DOWNVOTE;
((CommentViewHolder) holder).downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
} else {
//Downvoted before
- comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE);
newVoteType = APIUtils.DIR_UNVOTE;
((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
@@ -333,11 +340,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
@Override
public void onVoteThingSuccess(int position1) {
if (newVoteType.equals(APIUtils.DIR_DOWNVOTE)) {
- comment.setVoteType(CommentData.VOTE_TYPE_DOWNVOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_DOWNVOTE);
((CommentViewHolder) holder).downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor);
} else {
- comment.setVoteType(CommentData.VOTE_TYPE_NO_VOTE);
+ comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE);
((CommentViewHolder) holder).downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN);
((CommentViewHolder) holder).scoreTextView.setTextColor(mCommentIconAndInfoColor);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java
index f450700b..d35aa692 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java
@@ -32,11 +32,11 @@ import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewPrivateMessagesActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
-import ml.docilealligator.infinityforreddit.FetchMessages;
-import ml.docilealligator.infinityforreddit.Message;
+import ml.docilealligator.infinityforreddit.Message.FetchMessage;
+import ml.docilealligator.infinityforreddit.Message.Message;
import ml.docilealligator.infinityforreddit.NetworkState;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.ReadMessage;
+import ml.docilealligator.infinityforreddit.Message.ReadMessage;
import retrofit2.Retrofit;
public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, RecyclerView.ViewHolder> {
@@ -104,10 +104,10 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
)
.build();
mAccessToken = accessToken;
- if (where.equals(FetchMessages.WHERE_MESSAGES)) {
- mMessageType = FetchMessages.MESSAGE_TYPE_PRIVATE_MESSAGE;
+ if (where.equals(FetchMessage.WHERE_MESSAGES)) {
+ mMessageType = FetchMessage.MESSAGE_TYPE_PRIVATE_MESSAGE;
} else {
- mMessageType = FetchMessages.MESSAGE_TYPE_INBOX;
+ mMessageType = FetchMessage.MESSAGE_TYPE_INBOX;
}
mColorAccent = customThemeWrapper.getColorAccent();
@@ -161,13 +161,13 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
mMarkwon.setMarkdown(((DataViewHolder) holder).contentCustomMarkwonView, displayedMessage.getBody());
((DataViewHolder) holder).itemView.setOnClickListener(view -> {
- if (mMessageType == FetchMessages.MESSAGE_TYPE_INBOX
+ if (mMessageType == FetchMessage.MESSAGE_TYPE_INBOX
&& message.getContext() != null && !message.getContext().equals("")) {
Uri uri = LinkResolverActivity.getRedditUriByPath(message.getContext());
Intent intent = new Intent(mContext, LinkResolverActivity.class);
intent.setData(uri);
mContext.startActivity(intent);
- } else if (mMessageType == FetchMessages.MESSAGE_TYPE_PRIVATE_MESSAGE) {
+ } 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());
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PrivateMessagesDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PrivateMessagesDetailRecyclerViewAdapter.java
index 7cbf73a1..5bcbba8a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PrivateMessagesDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PrivateMessagesDetailRecyclerViewAdapter.java
@@ -34,7 +34,7 @@ import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewPrivateMessagesActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
-import ml.docilealligator.infinityforreddit.Message;
+import ml.docilealligator.infinityforreddit.Message.Message;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.Utils;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java
index 5d23975d..2b5e62df 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java
@@ -20,6 +20,7 @@ import butterknife.ButterKnife;
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration;
+import io.noties.markwon.core.MarkwonTheme;
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
import io.noties.markwon.linkify.LinkifyPlugin;
import io.noties.markwon.simple.ext.SimpleExtPlugin;
@@ -50,6 +51,11 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler
context.startActivity(intent);
});
}
+
+ @Override
+ public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
+ builder.linkColor(customThemeWrapper.getLinkColor());
+ }
})
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
.usePlugin(StrikethroughPlugin.create())
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/CommentMoreBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/CommentMoreBottomSheetFragment.java
index de4f5778..07701a52 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/CommentMoreBottomSheetFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/CommentMoreBottomSheetFragment.java
@@ -25,7 +25,7 @@ import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity;
import ml.docilealligator.infinityforreddit.Activity.ReportActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity;
-import ml.docilealligator.infinityforreddit.CommentData;
+import ml.docilealligator.infinityforreddit.Comment.Comment;
import ml.docilealligator.infinityforreddit.R;
@@ -67,8 +67,8 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
}
Bundle bundle = getArguments();
- CommentData commentData = bundle.getParcelable(EXTRA_COMMENT);
- if (commentData == null) {
+ Comment comment = bundle.getParcelable(EXTRA_COMMENT);
+ if (comment == null) {
dismiss();
return rootView;
}
@@ -81,8 +81,8 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
editTextView.setOnClickListener(view -> {
Intent intent = new Intent(activity, EditCommentActivity.class);
intent.putExtra(EditCommentActivity.EXTRA_ACCESS_TOKEN, accessToken);
- intent.putExtra(EditCommentActivity.EXTRA_FULLNAME, commentData.getFullName());
- intent.putExtra(EditCommentActivity.EXTRA_CONTENT, commentData.getCommentMarkdown());
+ intent.putExtra(EditCommentActivity.EXTRA_FULLNAME, comment.getFullName());
+ intent.putExtra(EditCommentActivity.EXTRA_CONTENT, comment.getCommentMarkdown());
intent.putExtra(EditCommentActivity.EXTRA_POSITION, bundle.getInt(EXTRA_POSITION));
if (activity instanceof ViewPostDetailActivity) {
activity.startActivityForResult(intent, ViewPostDetailActivity.EDIT_COMMENT_REQUEST_CODE);
@@ -96,9 +96,9 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
deleteTextView.setOnClickListener(view -> {
dismiss();
if (activity instanceof ViewPostDetailActivity) {
- ((ViewPostDetailActivity) activity).deleteComment(commentData.getFullName(), bundle.getInt(EXTRA_POSITION));
+ ((ViewPostDetailActivity) activity).deleteComment(comment.getFullName(), bundle.getInt(EXTRA_POSITION));
} else if (activity instanceof ViewUserDetailActivity) {
- ((ViewUserDetailActivity) activity).deleteComment(commentData.getFullName());
+ ((ViewUserDetailActivity) activity).deleteComment(comment.getFullName());
}
});
}
@@ -108,7 +108,7 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
try {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
- intent.putExtra(Intent.EXTRA_TEXT, commentData.getPermalink());
+ intent.putExtra(Intent.EXTRA_TEXT, comment.getPermalink());
activity.startActivity(Intent.createChooser(intent, getString(R.string.share)));
} catch (ActivityNotFoundException e) {
Toast.makeText(activity, R.string.no_activity_found_for_share, Toast.LENGTH_SHORT).show();
@@ -119,31 +119,31 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag
dismiss();
CopyTextBottomSheetFragment copyTextBottomSheetFragment = new CopyTextBottomSheetFragment();
Bundle copyBundle = new Bundle();
- copyBundle.putString(CopyTextBottomSheetFragment.EXTRA_MARKDOWN, commentData.getCommentMarkdown());
- copyBundle.putString(CopyTextBottomSheetFragment.EXTRA_RAW_TEXT, commentData.getCommentRawText());
+ copyBundle.putString(CopyTextBottomSheetFragment.EXTRA_MARKDOWN, comment.getCommentMarkdown());
+ copyBundle.putString(CopyTextBottomSheetFragment.EXTRA_RAW_TEXT, comment.getCommentRawText());
copyTextBottomSheetFragment.setArguments(copyBundle);
copyTextBottomSheetFragment.show(activity.getSupportFragmentManager(), copyTextBottomSheetFragment.getTag());
});
reportTextView.setOnClickListener(view -> {
Intent intent = new Intent(activity, ReportActivity.class);
- intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, commentData.getSubredditName());
- intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, commentData.getFullName());
+ intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, comment.getSubredditName());
+ intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, comment.getFullName());
activity.startActivity(intent);
dismiss();
});
- if ("[deleted]".equals(commentData.getAuthor()) ||
- "[deleted]".equals(commentData.getCommentRawText()) ||
- "[removed]".equals(commentData.getCommentRawText())
+ if ("[deleted]".equals(comment.getAuthor()) ||
+ "[deleted]".equals(comment.getCommentRawText()) ||
+ "[removed]".equals(comment.getCommentRawText())
) {
seeRemovedTextView.setVisibility(View.VISIBLE);
seeRemovedTextView.setOnClickListener(view -> {
dismiss();
if (activity instanceof ViewPostDetailActivity) {
- ((ViewPostDetailActivity) activity).showRemovedComment(commentData, bundle.getInt(EXTRA_POSITION));
+ ((ViewPostDetailActivity) activity).showRemovedComment(comment, bundle.getInt(EXTRA_POSITION));
}
});
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/Comment.java
index 0880e19a..5d27a3a1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/Comment.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Comment;
import android.os.Parcel;
import android.os.Parcelable;
@@ -7,19 +7,19 @@ import java.util.ArrayList;
import ml.docilealligator.infinityforreddit.Utils.APIUtils;
-public class CommentData implements Parcelable {
+public class Comment implements Parcelable {
public static final int VOTE_TYPE_NO_VOTE = 0;
public static final int VOTE_TYPE_UPVOTE = 1;
public static final int VOTE_TYPE_DOWNVOTE = -1;
- public static final Creator<CommentData> CREATOR = new Creator<CommentData>() {
+ public static final Creator<Comment> CREATOR = new Creator<Comment>() {
@Override
- public CommentData createFromParcel(Parcel in) {
- return new CommentData(in);
+ public Comment createFromParcel(Parcel in) {
+ return new Comment(in);
}
@Override
- public CommentData[] newArray(int size) {
- return new CommentData[size];
+ public Comment[] newArray(int size) {
+ return new Comment[size];
}
};
private String id;
@@ -47,20 +47,20 @@ public class CommentData implements Parcelable {
private boolean saved;
private boolean isExpanded;
private boolean hasExpandedBefore;
- private ArrayList<CommentData> children;
+ private ArrayList<Comment> children;
private ArrayList<String> moreChildrenFullnames;
private int moreChildrenStartingIndex;
private boolean isPlaceHolder;
private boolean isLoadingMoreChildren;
private boolean loadMoreChildrenFailed;
- public CommentData(String id, String fullName, String author, String authorFlair,
- String authorFlairHTML, String linkAuthor,
- long commentTimeMillis, String commentMarkdown, String commentRawText,
- String linkId, String subredditName, String parentId, int score,
- int voteType, boolean isSubmitter, String distinguished, String permalink,
- String awards, int depth, boolean collapsed, boolean hasReply,
- boolean scoreHidden, boolean saved) {
+ public Comment(String id, String fullName, String author, String authorFlair,
+ String authorFlairHTML, String linkAuthor,
+ long commentTimeMillis, String commentMarkdown, String commentRawText,
+ String linkId, String subredditName, String parentId, int score,
+ int voteType, boolean isSubmitter, String distinguished, String permalink,
+ String awards, int depth, boolean collapsed, boolean hasReply,
+ boolean scoreHidden, boolean saved) {
this.id = id;
this.fullName = fullName;
this.author = author;
@@ -90,7 +90,7 @@ public class CommentData implements Parcelable {
isPlaceHolder = false;
}
- public CommentData(String parentFullName, int depth) {
+ public Comment(String parentFullName, int depth) {
this.fullName = parentFullName;
this.depth = depth;
isPlaceHolder = true;
@@ -98,7 +98,7 @@ public class CommentData implements Parcelable {
loadMoreChildrenFailed = false;
}
- protected CommentData(Parcel in) {
+ protected Comment(Parcel in) {
id = in.readString();
fullName = in.readString();
author = in.readString();
@@ -123,8 +123,8 @@ public class CommentData implements Parcelable {
scoreHidden = in.readByte() != 0;
isExpanded = in.readByte() != 0;
hasExpandedBefore = in.readByte() != 0;
- children = in.readArrayList(CommentData.class.getClassLoader());
- moreChildrenFullnames = in.readArrayList(CommentData.class.getClassLoader());
+ children = in.readArrayList(Comment.class.getClassLoader());
+ moreChildrenFullnames = in.readArrayList(Comment.class.getClassLoader());
moreChildrenStartingIndex = in.readInt();
isPlaceHolder = in.readByte() != 0;
isLoadingMoreChildren = in.readByte() != 0;
@@ -270,15 +270,15 @@ public class CommentData implements Parcelable {
this.voteType = voteType;
}
- public ArrayList<CommentData> getChildren() {
+ public ArrayList<Comment> getChildren() {
return children;
}
- public void setChildren(ArrayList<CommentData> children) {
+ public void setChildren(ArrayList<Comment> children) {
this.children = children;
}
- public void addChildren(ArrayList<CommentData> moreChildren) {
+ public void addChildren(ArrayList<Comment> moreChildren) {
if (children == null || children.size() == 0) {
setChildren(moreChildren);
} else {
@@ -290,11 +290,11 @@ public class CommentData implements Parcelable {
}
}
- public void addChild(CommentData comment) {
+ public void addChild(Comment comment) {
addChild(comment, 0);
}
- public void addChild(CommentData comment, int position) {
+ public void addChild(Comment comment, int position) {
if (children == null) {
children = new ArrayList<>();
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/CommentDataSource.java
index 598579df..35a8ddd2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentDataSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/CommentDataSource.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Comment;
import android.os.AsyncTask;
@@ -15,7 +15,9 @@ import java.util.ArrayList;
import java.util.Locale;
import ml.docilealligator.infinityforreddit.API.RedditAPI;
+import ml.docilealligator.infinityforreddit.NetworkState;
import ml.docilealligator.infinityforreddit.Post.PostDataSource;
+import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
import ml.docilealligator.infinityforreddit.Utils.APIUtils;
import retrofit2.Call;
@@ -23,7 +25,7 @@ import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
-public class CommentDataSource extends PageKeyedDataSource<String, CommentData> {
+public class CommentDataSource extends PageKeyedDataSource<String, Comment> {
private Retrofit retrofit;
private Locale locale;
@@ -38,7 +40,7 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
private MutableLiveData<Boolean> hasPostLiveData;
private LoadParams<String> params;
- private LoadCallback<String, CommentData> callback;
+ private LoadCallback<String, Comment> callback;
CommentDataSource(Retrofit retrofit, Locale locale, @Nullable String accessToken, String username, SortType sortType,
boolean areSavedComments) {
@@ -70,7 +72,7 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
}
@Override
- public void loadInitial(@NonNull LoadInitialParams<String> params, @NonNull LoadInitialCallback<String, CommentData> callback) {
+ public void loadInitial(@NonNull LoadInitialParams<String> params, @NonNull LoadInitialCallback<String, Comment> callback) {
initialLoadStateLiveData.postValue(NetworkState.LOADING);
RedditAPI api = retrofit.create(RedditAPI.class);
@@ -108,7 +110,7 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
if (response.isSuccessful()) {
new ParseCommentAsyncTask(response.body(), locale, new ParseCommentAsyncTask.ParseCommentAsyncTaskListener() {
@Override
- public void parseSuccessful(ArrayList<CommentData> comments, String after) {
+ public void parseSuccessful(ArrayList<Comment> comments, String after) {
if (comments.size() == 0) {
hasPostLiveData.postValue(false);
} else {
@@ -141,12 +143,12 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
}
@Override
- public void loadBefore(@NonNull LoadParams<String> params, @NonNull LoadCallback<String, CommentData> callback) {
+ public void loadBefore(@NonNull LoadParams<String> params, @NonNull LoadCallback<String, Comment> callback) {
}
@Override
- public void loadAfter(@NonNull LoadParams<String> params, @NonNull LoadCallback<String, CommentData> callback) {
+ public void loadAfter(@NonNull LoadParams<String> params, @NonNull LoadCallback<String, Comment> callback) {
this.params = params;
this.callback = callback;
@@ -186,7 +188,7 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
if (response.isSuccessful()) {
new ParseCommentAsyncTask(response.body(), locale, new ParseCommentAsyncTask.ParseCommentAsyncTaskListener() {
@Override
- public void parseSuccessful(ArrayList<CommentData> comments, String after) {
+ public void parseSuccessful(ArrayList<Comment> comments, String after) {
if (after == null || after.equals("") || after.equals("null")) {
callback.onResult(comments, null);
} else {
@@ -212,7 +214,7 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
});
}
- private static class ParseCommentAsyncTask extends AsyncTask<Void, ArrayList<CommentData>, ArrayList<CommentData>> {
+ private static class ParseCommentAsyncTask extends AsyncTask<Void, ArrayList<Comment>, ArrayList<Comment>> {
private String after;
private Locale locale;
private JSONArray commentsJSONArray;
@@ -234,12 +236,12 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
}
@Override
- protected ArrayList<CommentData> doInBackground(Void... voids) {
+ protected ArrayList<Comment> doInBackground(Void... voids) {
if (parseFailed) {
return null;
}
- ArrayList<CommentData> comments = new ArrayList<>();
+ ArrayList<Comment> comments = new ArrayList<>();
for (int i = 0; i < commentsJSONArray.length(); i++) {
try {
JSONObject commentJSON = commentsJSONArray.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
@@ -251,7 +253,7 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
}
@Override
- protected void onPostExecute(ArrayList<CommentData> commentData) {
+ protected void onPostExecute(ArrayList<Comment> commentData) {
super.onPostExecute(commentData);
if (commentData != null) {
parseCommentAsyncTaskListener.parseSuccessful(commentData, after);
@@ -261,7 +263,7 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
}
interface ParseCommentAsyncTaskListener {
- void parseSuccessful(ArrayList<CommentData> comments, String after);
+ void parseSuccessful(ArrayList<Comment> comments, String after);
void parseFailed();
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/CommentDataSourceFactory.java
index 34d24b8a..bd7e5831 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentDataSourceFactory.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/CommentDataSourceFactory.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Comment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -7,6 +7,7 @@ import androidx.paging.DataSource;
import java.util.Locale;
+import ml.docilealligator.infinityforreddit.SortType;
import retrofit2.Retrofit;
class CommentDataSourceFactory extends DataSource.Factory {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/CommentViewModel.java
index 3753ba9f..99832054 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentViewModel.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/CommentViewModel.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Comment;
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
@@ -11,6 +11,8 @@ import androidx.paging.PagedList;
import java.util.Locale;
+import ml.docilealligator.infinityforreddit.NetworkState;
+import ml.docilealligator.infinityforreddit.SortType;
import retrofit2.Retrofit;
public class CommentViewModel extends ViewModel {
@@ -18,7 +20,7 @@ public class CommentViewModel extends ViewModel {
private LiveData<NetworkState> paginationNetworkState;
private LiveData<NetworkState> initialLoadingState;
private LiveData<Boolean> hasCommentLiveData;
- private LiveData<PagedList<CommentData>> comments;
+ private LiveData<PagedList<Comment>> comments;
private MutableLiveData<SortType> sortTypeLiveData;
public CommentViewModel(Retrofit retrofit, Locale locale, String accessToken, String username, SortType sortType,
@@ -48,7 +50,7 @@ public class CommentViewModel extends ViewModel {
});
}
- public LiveData<PagedList<CommentData>> getComments() {
+ public LiveData<PagedList<Comment>> getComments() {
return comments;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/FetchComment.java
index b6b16c1b..361a5746 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchComment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/FetchComment.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Comment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -41,7 +41,7 @@ public class FetchComment {
ParseComment.parseComment(response.body(), new ArrayList<>(),
locale, expandChildren, new ParseComment.ParseCommentListener() {
@Override
- public void onParseCommentSuccess(ArrayList<CommentData> expandedComments,
+ public void onParseCommentSuccess(ArrayList<Comment> expandedComments,
String parentId, ArrayList<String> moreChildrenFullnames) {
fetchCommentListener.onFetchCommentSuccess(expandedComments, parentId,
moreChildrenFullnames);
@@ -101,7 +101,7 @@ public class FetchComment {
ParseComment.parseMoreComment(response.body(), new ArrayList<>(), locale,
depth, expandChildren, new ParseComment.ParseCommentListener() {
@Override
- public void onParseCommentSuccess(ArrayList<CommentData> expandedComments,
+ public void onParseCommentSuccess(ArrayList<Comment> expandedComments,
String parentId, ArrayList<String> moreChildrenFullnames) {
fetchMoreCommentListener.onFetchMoreCommentSuccess(expandedComments,
startingIndex + 100);
@@ -125,13 +125,13 @@ public class FetchComment {
}
public interface FetchCommentListener {
- void onFetchCommentSuccess(ArrayList<CommentData> expandedComments, String parentId, ArrayList<String> children);
+ void onFetchCommentSuccess(ArrayList<Comment> expandedComments, String parentId, ArrayList<String> children);
void onFetchCommentFailed();
}
public interface FetchMoreCommentListener {
- void onFetchMoreCommentSuccess(ArrayList<CommentData> expandedComments, int childrenStartingIndex);
+ void onFetchMoreCommentSuccess(ArrayList<Comment> expandedComments, int childrenStartingIndex);
void onFetchMoreCommentFailed();
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/ParseComment.java
index 272294ba..fc318e7d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/ParseComment.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Comment;
import android.os.AsyncTask;
import android.text.Html;
@@ -15,12 +15,12 @@ import java.util.Locale;
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
import ml.docilealligator.infinityforreddit.Utils.Utils;
-import static ml.docilealligator.infinityforreddit.CommentData.VOTE_TYPE_DOWNVOTE;
-import static ml.docilealligator.infinityforreddit.CommentData.VOTE_TYPE_NO_VOTE;
-import static ml.docilealligator.infinityforreddit.CommentData.VOTE_TYPE_UPVOTE;
+import static ml.docilealligator.infinityforreddit.Comment.Comment.VOTE_TYPE_DOWNVOTE;
+import static ml.docilealligator.infinityforreddit.Comment.Comment.VOTE_TYPE_NO_VOTE;
+import static ml.docilealligator.infinityforreddit.Comment.Comment.VOTE_TYPE_UPVOTE;
public class ParseComment {
- public static void parseComment(String response, ArrayList<CommentData> commentData, Locale locale,
+ public static void parseComment(String response, ArrayList<Comment> commentData, Locale locale,
boolean expandChildren, ParseCommentListener parseCommentListener) {
try {
JSONArray childrenArray = new JSONArray(response);
@@ -35,7 +35,7 @@ public class ParseComment {
}
}
- static void parseMoreComment(String response, ArrayList<CommentData> commentData, Locale locale,
+ static void parseMoreComment(String response, ArrayList<Comment> commentData, Locale locale,
int depth, boolean expandChildren, ParseCommentListener parseCommentListener) {
try {
JSONArray childrenArray = new JSONObject(response).getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY);
@@ -51,7 +51,7 @@ public class ParseComment {
new ParseSentCommentAsyncTask(response, depth, locale, parseSentCommentListener).execute();
}
- private static void parseCommentRecursion(JSONArray comments, ArrayList<CommentData> newCommentData,
+ private static void parseCommentRecursion(JSONArray comments, ArrayList<Comment> newCommentData,
ArrayList<String> moreChildrenFullnames, int depth, Locale locale) throws JSONException {
int actualCommentLength;
@@ -76,12 +76,12 @@ public class ParseComment {
for (int i = 0; i < actualCommentLength; i++) {
JSONObject data = comments.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY);
- CommentData singleComment = parseSingleComment(data, depth, locale);
+ Comment singleComment = parseSingleComment(data, depth, locale);
if (data.get(JSONUtils.REPLIES_KEY) instanceof JSONObject) {
JSONArray childrenArray = data.getJSONObject(JSONUtils.REPLIES_KEY)
.getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY);
- ArrayList<CommentData> children = new ArrayList<>();
+ ArrayList<Comment> children = new ArrayList<>();
ArrayList<String> nextMoreChildrenFullnames = new ArrayList<>();
parseCommentRecursion(childrenArray, children, nextMoreChildrenFullnames, singleComment.getDepth(),
locale);
@@ -93,9 +93,9 @@ public class ParseComment {
}
}
- private static void expandChildren(ArrayList<CommentData> comments, ArrayList<CommentData> visibleComments,
+ private static void expandChildren(ArrayList<Comment> comments, ArrayList<Comment> visibleComments,
boolean setExpanded) {
- for (CommentData c : comments) {
+ for (Comment c : comments) {
visibleComments.add(c);
if (c.hasReply()) {
if (setExpanded) {
@@ -105,14 +105,14 @@ public class ParseComment {
}
if (c.hasMoreChildrenFullnames() && c.getMoreChildrenFullnames().size() > c.getMoreChildrenStartingIndex()) {
//Add a load more placeholder
- CommentData placeholder = new CommentData(c.getFullName(), c.getDepth() + 1);
+ Comment placeholder = new Comment(c.getFullName(), c.getDepth() + 1);
visibleComments.add(placeholder);
c.addChild(placeholder, c.getChildren().size());
}
}
}
- static CommentData parseSingleComment(JSONObject singleCommentData, int depth, Locale locale) throws JSONException {
+ static Comment parseSingleComment(JSONObject singleCommentData, int depth, Locale locale) throws JSONException {
String id = singleCommentData.getString(JSONUtils.ID_KEY);
String fullName = singleCommentData.getString(JSONUtils.NAME_KEY);
String author = singleCommentData.getString(JSONUtils.AUTHOR_KEY);
@@ -176,7 +176,7 @@ public class ParseComment {
boolean collapsed = singleCommentData.getBoolean(JSONUtils.COLLAPSED_KEY);
boolean hasReply = !(singleCommentData.get(JSONUtils.REPLIES_KEY) instanceof String);
- return new CommentData(id, fullName, author, authorFlair, authorFlairHTMLBuilder.toString(),
+ return new Comment(id, fullName, author, authorFlair, authorFlairHTMLBuilder.toString(),
linkAuthor, submitTime, commentMarkdown, commentRawText,
linkId, subredditName, parentId, score, voteType, isSubmitter, distinguished,
permalink, awardingsBuilder.toString(),depth, collapsed, hasReply, scoreHidden, saved);
@@ -212,23 +212,23 @@ public class ParseComment {
}
public interface ParseCommentListener {
- void onParseCommentSuccess(ArrayList<CommentData> expandedComments, String parentId,
+ void onParseCommentSuccess(ArrayList<Comment> expandedComments, String parentId,
ArrayList<String> moreChildrenFullnames);
void onParseCommentFailed();
}
interface ParseSentCommentListener {
- void onParseSentCommentSuccess(CommentData commentData);
+ void onParseSentCommentSuccess(Comment comment);
void onParseSentCommentFailed(@Nullable String errorMessage);
}
private static class ParseCommentAsyncTask extends AsyncTask<Void, Void, Void> {
private JSONArray commentsJSONArray;
- private ArrayList<CommentData> comments;
- private ArrayList<CommentData> newComments;
- private ArrayList<CommentData> expandedNewComments;
+ private ArrayList<Comment> comments;
+ private ArrayList<Comment> newComments;
+ private ArrayList<Comment> expandedNewComments;
private ArrayList<String> moreChildrenFullnames;
private Locale locale;
private String parentId;
@@ -237,7 +237,7 @@ public class ParseComment {
private ParseCommentListener parseCommentListener;
private boolean parseFailed;
- ParseCommentAsyncTask(JSONArray commentsJSONArray, ArrayList<CommentData> comments, Locale locale,
+ ParseCommentAsyncTask(JSONArray commentsJSONArray, ArrayList<Comment> comments, Locale locale,
@Nullable String parentId, int depth, boolean expandChildren,
ParseCommentListener parseCommentListener) {
this.commentsJSONArray = commentsJSONArray;
@@ -286,7 +286,7 @@ public class ParseComment {
private ParseSentCommentListener parseSentCommentListener;
private boolean parseFailed;
private String errorMessage;
- private CommentData commentData;
+ private Comment comment;
ParseSentCommentAsyncTask(String response, int depth, Locale locale, ParseSentCommentListener parseSentCommentListener) {
this.response = response;
@@ -300,7 +300,7 @@ public class ParseComment {
protected Void doInBackground(Void... voids) {
try {
JSONObject sentCommentData = new JSONObject(response);
- commentData = parseSingleComment(sentCommentData, depth, locale);
+ comment = parseSingleComment(sentCommentData, depth, locale);
} catch (JSONException e) {
e.printStackTrace();
errorMessage = parseSentCommentErrorMessage(response);
@@ -315,7 +315,7 @@ public class ParseComment {
if (parseFailed) {
parseSentCommentListener.onParseSentCommentFailed(errorMessage);
} else {
- parseSentCommentListener.onParseSentCommentSuccess(commentData);
+ parseSentCommentListener.onParseSentCommentSuccess(comment);
}
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SendComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/SendComment.java
index d35d07c7..1ce8fac5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SendComment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Comment/SendComment.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Comment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -35,8 +35,8 @@ public class SendComment {
if (response.isSuccessful()) {
ParseComment.parseSentComment(response.body(), parentDepth, locale, new ParseComment.ParseSentCommentListener() {
@Override
- public void onParseSentCommentSuccess(CommentData commentData) {
- sendCommentListener.sendCommentSuccess(commentData);
+ public void onParseSentCommentSuccess(Comment comment) {
+ sendCommentListener.sendCommentSuccess(comment);
}
@Override
@@ -57,7 +57,7 @@ public class SendComment {
}
public interface SendCommentListener {
- void sendCommentSuccess(CommentData commentData);
+ void sendCommentSuccess(Comment comment);
void sendCommentFailed(String errorMessage);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java
index 7fbd3359..45c12d6f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java
@@ -151,6 +151,22 @@ public class CustomTheme {
public int fabIconColor;
@ColumnInfo(name = "chip_text_color")
public int chipTextColor;
+ @ColumnInfo(name = "link_color")
+ public int linkColor;
+ @ColumnInfo(name = "received_message_text_color")
+ public int receivedMessageTextColor;
+ @ColumnInfo(name = "sent_message_text_color")
+ public int sentMessageTextColor;
+ @ColumnInfo(name = "received_message_background_color")
+ public int receivedMessageBackgroundColor;
+ @ColumnInfo(name = "sent_message_background_color")
+ public int sentMessageBackgroundColor;
+ @ColumnInfo(name = "send_message_icon_color")
+ public int sendMessageIconColor;
+ @ColumnInfo(name = "fully_collapsed_comment_background_color")
+ public int fullyCollapsedCommentBackgroundColor;
+ @ColumnInfo(name = "awarded_comment_background_color")
+ public int awardedCommentBackgroundColor;
@ColumnInfo(name = "is_light_status_bar")
public boolean isLightStatusBar;
@ColumnInfo(name = "is_light_nav_bar")
@@ -190,63 +206,71 @@ public class CustomTheme {
customTheme.commentColor = customThemeSettingsItems.get(11).colorValue;
customTheme.buttonTextColor = customThemeSettingsItems.get(12).colorValue;
customTheme.chipTextColor = customThemeSettingsItems.get(13).colorValue;
- customTheme.backgroundColor = customThemeSettingsItems.get(14).colorValue;
- customTheme.cardViewBackgroundColor = customThemeSettingsItems.get(15).colorValue;
- customTheme.commentBackgroundColor = customThemeSettingsItems.get(16).colorValue;
- customTheme.bottomAppBarBackgroundColor = customThemeSettingsItems.get(17).colorValue;
- customTheme.primaryIconColor = customThemeSettingsItems.get(18).colorValue;
- customTheme.bottomAppBarIconColor = customThemeSettingsItems.get(19).colorValue;
- customTheme.postIconAndInfoColor = customThemeSettingsItems.get(20).colorValue;
- customTheme.commentIconAndInfoColor = customThemeSettingsItems.get(21).colorValue;
- customTheme.fabIconColor = customThemeSettingsItems.get(22).colorValue;
- customTheme.toolbarPrimaryTextAndIconColor = customThemeSettingsItems.get(23).colorValue;
- customTheme.toolbarSecondaryTextColor = customThemeSettingsItems.get(24).colorValue;
- customTheme.circularProgressBarBackground = customThemeSettingsItems.get(25).colorValue;
- customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = customThemeSettingsItems.get(26).colorValue;
- customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = customThemeSettingsItems.get(27).colorValue;
- customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(28).colorValue;
- customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = customThemeSettingsItems.get(29).colorValue;
- customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = customThemeSettingsItems.get(30).colorValue;
- customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(31).colorValue;
- customTheme.upvoted = customThemeSettingsItems.get(32).colorValue;
- customTheme.downvoted = customThemeSettingsItems.get(33).colorValue;
- customTheme.postTypeBackgroundColor = customThemeSettingsItems.get(34).colorValue;
- customTheme.postTypeTextColor = customThemeSettingsItems.get(35).colorValue;
- customTheme.spoilerBackgroundColor = customThemeSettingsItems.get(36).colorValue;
- customTheme.spoilerTextColor = customThemeSettingsItems.get(37).colorValue;
- customTheme.nsfwBackgroundColor = customThemeSettingsItems.get(38).colorValue;
- customTheme.nsfwTextColor = customThemeSettingsItems.get(39).colorValue;
- customTheme.flairBackgroundColor = customThemeSettingsItems.get(40).colorValue;
- customTheme.flairTextColor = customThemeSettingsItems.get(41).colorValue;
- customTheme.awardsBackgroundColor = customThemeSettingsItems.get(42).colorValue;
- customTheme.awardsTextColor = customThemeSettingsItems.get(43).colorValue;
- customTheme.archivedTint = customThemeSettingsItems.get(44).colorValue;
- customTheme.lockedIconTint = customThemeSettingsItems.get(45).colorValue;
- customTheme.crosspostIconTint = customThemeSettingsItems.get(46).colorValue;
- customTheme.stickiedPostIconTint = customThemeSettingsItems.get(47).colorValue;
- customTheme.subscribed = customThemeSettingsItems.get(48).colorValue;
- customTheme.unsubscribed = customThemeSettingsItems.get(49).colorValue;
- customTheme.username = customThemeSettingsItems.get(50).colorValue;
- customTheme.subreddit = customThemeSettingsItems.get(51).colorValue;
- customTheme.authorFlairTextColor = customThemeSettingsItems.get(52).colorValue;
- customTheme.submitter = customThemeSettingsItems.get(53).colorValue;
- customTheme.moderator = customThemeSettingsItems.get(54).colorValue;
- customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(55).colorValue;
- customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(56).colorValue;
- customTheme.dividerColor = customThemeSettingsItems.get(57).colorValue;
- customTheme.noPreviewLinkBackgroundColor = customThemeSettingsItems.get(58).colorValue;
- customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(59).colorValue;
- customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(60).colorValue;
- customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(61).colorValue;
- customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(62).colorValue;
- customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(63).colorValue;
- customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(64).colorValue;
- customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(65).colorValue;
- customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(66).colorValue;
- customTheme.navBarColor = customThemeSettingsItems.get(67).colorValue;
- customTheme.isLightStatusBar = customThemeSettingsItems.get(68).isEnabled;
- customTheme.isLightNavBar = customThemeSettingsItems.get(69).isEnabled;
- customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(70).isEnabled;
+ customTheme.linkColor = customThemeSettingsItems.get(14).colorValue;
+ customTheme.receivedMessageTextColor = customThemeSettingsItems.get(15).colorValue;
+ customTheme.sentMessageTextColor = customThemeSettingsItems.get(16).colorValue;
+ customTheme.backgroundColor = customThemeSettingsItems.get(17).colorValue;
+ customTheme.cardViewBackgroundColor = customThemeSettingsItems.get(18).colorValue;
+ customTheme.commentBackgroundColor = customThemeSettingsItems.get(19).colorValue;
+ customTheme.fullyCollapsedCommentBackgroundColor = customThemeSettingsItems.get(20).colorValue;
+ customTheme.awardedCommentBackgroundColor = customThemeSettingsItems.get(21).colorValue;
+ customTheme.receivedMessageBackgroundColor = customThemeSettingsItems.get(22).colorValue;
+ customTheme.sentMessageBackgroundColor = customThemeSettingsItems.get(23).colorValue;
+ customTheme.bottomAppBarBackgroundColor = customThemeSettingsItems.get(24).colorValue;
+ customTheme.primaryIconColor = customThemeSettingsItems.get(25).colorValue;
+ customTheme.bottomAppBarIconColor = customThemeSettingsItems.get(26).colorValue;
+ customTheme.postIconAndInfoColor = customThemeSettingsItems.get(27).colorValue;
+ customTheme.commentIconAndInfoColor = customThemeSettingsItems.get(28).colorValue;
+ customTheme.fabIconColor = customThemeSettingsItems.get(29).colorValue;
+ customTheme.sendMessageIconColor = customThemeSettingsItems.get(30).colorValue;
+ customTheme.toolbarPrimaryTextAndIconColor = customThemeSettingsItems.get(31).colorValue;
+ customTheme.toolbarSecondaryTextColor = customThemeSettingsItems.get(32).colorValue;
+ customTheme.circularProgressBarBackground = customThemeSettingsItems.get(33).colorValue;
+ customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = customThemeSettingsItems.get(34).colorValue;
+ customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = customThemeSettingsItems.get(35).colorValue;
+ customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(36).colorValue;
+ customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = customThemeSettingsItems.get(37).colorValue;
+ customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = customThemeSettingsItems.get(38).colorValue;
+ customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(39).colorValue;
+ customTheme.upvoted = customThemeSettingsItems.get(40).colorValue;
+ customTheme.downvoted = customThemeSettingsItems.get(41).colorValue;
+ customTheme.postTypeBackgroundColor = customThemeSettingsItems.get(42).colorValue;
+ customTheme.postTypeTextColor = customThemeSettingsItems.get(43).colorValue;
+ customTheme.spoilerBackgroundColor = customThemeSettingsItems.get(44).colorValue;
+ customTheme.spoilerTextColor = customThemeSettingsItems.get(45).colorValue;
+ customTheme.nsfwBackgroundColor = customThemeSettingsItems.get(46).colorValue;
+ customTheme.nsfwTextColor = customThemeSettingsItems.get(47).colorValue;
+ customTheme.flairBackgroundColor = customThemeSettingsItems.get(48).colorValue;
+ customTheme.flairTextColor = customThemeSettingsItems.get(49).colorValue;
+ customTheme.awardsBackgroundColor = customThemeSettingsItems.get(50).colorValue;
+ customTheme.awardsTextColor = customThemeSettingsItems.get(51).colorValue;
+ customTheme.archivedTint = customThemeSettingsItems.get(52).colorValue;
+ customTheme.lockedIconTint = customThemeSettingsItems.get(53).colorValue;
+ customTheme.crosspostIconTint = customThemeSettingsItems.get(54).colorValue;
+ customTheme.stickiedPostIconTint = customThemeSettingsItems.get(55).colorValue;
+ customTheme.subscribed = customThemeSettingsItems.get(56).colorValue;
+ customTheme.unsubscribed = customThemeSettingsItems.get(57).colorValue;
+ customTheme.username = customThemeSettingsItems.get(58).colorValue;
+ customTheme.subreddit = customThemeSettingsItems.get(59).colorValue;
+ customTheme.authorFlairTextColor = customThemeSettingsItems.get(60).colorValue;
+ customTheme.submitter = customThemeSettingsItems.get(61).colorValue;
+ customTheme.moderator = customThemeSettingsItems.get(62).colorValue;
+ customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(63).colorValue;
+ customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(64).colorValue;
+ customTheme.dividerColor = customThemeSettingsItems.get(65).colorValue;
+ customTheme.noPreviewLinkBackgroundColor = customThemeSettingsItems.get(66).colorValue;
+ customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(67).colorValue;
+ customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(68).colorValue;
+ customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(69).colorValue;
+ customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(70).colorValue;
+ customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(71).colorValue;
+ customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(72).colorValue;
+ customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(73).colorValue;
+ customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(74).colorValue;
+ customTheme.navBarColor = customThemeSettingsItems.get(75).colorValue;
+ customTheme.isLightStatusBar = customThemeSettingsItems.get(76).isEnabled;
+ customTheme.isLightNavBar = customThemeSettingsItems.get(77).isEnabled;
+ customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(78).isEnabled;
return customTheme;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java
index b32fcf1a..616446a4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java
@@ -111,6 +111,18 @@ public class CustomThemeSettingsItem implements Parcelable {
context.getString(R.string.theme_item_chip_text_color_detail),
customTheme.chipTextColor));
customThemeSettingsItems.add(new CustomThemeSettingsItem(
+ context.getString(R.string.theme_item_link_color),
+ context.getString(R.string.theme_item_link_color_detail),
+ customTheme.linkColor));
+ customThemeSettingsItems.add(new CustomThemeSettingsItem(
+ context.getString(R.string.theme_item_received_message_text_color),
+ context.getString(R.string.theme_item_received_message_text_color_detail),
+ customTheme.receivedMessageTextColor));
+ customThemeSettingsItems.add(new CustomThemeSettingsItem(
+ context.getString(R.string.theme_item_sent_message_text_color),
+ context.getString(R.string.theme_item_sent_message_text_color_detail),
+ customTheme.sentMessageTextColor));
+ customThemeSettingsItems.add(new CustomThemeSettingsItem(
context.getString(R.string.theme_item_background_color),
context.getString(R.string.theme_item_background_color_detail),
customTheme.backgroundColor));
@@ -123,6 +135,22 @@ public class CustomThemeSettingsItem implements Parcelable {
context.getString(R.string.theme_item_comment_background_color_detail),
customTheme.commentBackgroundColor));
customThemeSettingsItems.add(new CustomThemeSettingsItem(
+ context.getString(R.string.theme_item_fully_collapsed_comment_background_color),
+ context.getString(R.string.theme_item_fully_collapsed_comment_background_color_detail),
+ customTheme.fullyCollapsedCommentBackgroundColor));
+ customThemeSettingsItems.add(new CustomThemeSettingsItem(
+ context.getString(R.string.theme_item_awarded_comment_background_color),
+ context.getString(R.string.theme_item_awarded_comment_background_color_detail),
+ customTheme.awardedCommentBackgroundColor));
+ customThemeSettingsItems.add(new CustomThemeSettingsItem(
+ context.getString(R.string.theme_item_received_message_background_color),
+ context.getString(R.string.theme_item_received_message_background_color_detail),
+ customTheme.receivedMessageBackgroundColor));
+ customThemeSettingsItems.add(new CustomThemeSettingsItem(
+ context.getString(R.string.theme_item_sent_message_background_color),
+ context.getString(R.string.theme_item_sent_message_background_color_detail),
+ customTheme.sentMessageBackgroundColor));
+ customThemeSettingsItems.add(new CustomThemeSettingsItem(
context.getString(R.string.theme_item_bottom_app_bar_background_color),
context.getString(R.string.theme_item_bottom_app_bar_background_color_detail),
customTheme.bottomAppBarBackgroundColor));
@@ -147,6 +175,10 @@ public class CustomThemeSettingsItem implements Parcelable {
context.getString(R.string.theme_item_fab_icon_color_detail),
customTheme.fabIconColor));
customThemeSettingsItems.add(new CustomThemeSettingsItem(
+ context.getString(R.string.theme_item_send_message_icon_color),
+ context.getString(R.string.theme_item_send_message_icon_color_detail),
+ customTheme.sendMessageIconColor));
+ customThemeSettingsItems.add(new CustomThemeSettingsItem(
context.getString(R.string.theme_item_toolbar_primary_text_and_icon_color),
context.getString(R.string.theme_item_toolbar_primary_text_and_icon_color_detail),
customTheme.toolbarPrimaryTextAndIconColor));
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java
index aef072c9..7f137eed 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java
@@ -372,6 +372,46 @@ public class CustomThemeWrapper {
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
}
+ public int getLinkColor() {
+ return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.LINK_COLOR,
+ getDefaultColor("#FF4081", "#FF4081", "#FF4081"));
+ }
+
+ public int getReceivedMessageTextColor() {
+ return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.RECEIVED_MESSAGE_TEXT_COLOR,
+ getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
+ }
+
+ public int getSentMessageTextColor() {
+ return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.SENT_MESSAGE_TEXT_COLOR,
+ getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
+ }
+
+ public int getReceivedMessageBackgroundColor() {
+ return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.RECEIVED_MESSAGE_BACKROUND_COLOR,
+ getDefaultColor("#4185F4", "#4185F4", "#4185F4"));
+ }
+
+ public int getSentMessageBackgroundColor() {
+ return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.SENT_MESSAGE_BACKGROUND_COLOR,
+ getDefaultColor("#31BF7D", "#31BF7D", "#31BF7D"));
+ }
+
+ public int getSendMessageIconColor() {
+ return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.SEND_MESSAGE_ICON_COLOR,
+ getDefaultColor("#4185F4", "#4185F4", "#4185F4"));
+ }
+
+ public int getFullyCollapsedCommentBackgroundColor() {
+ return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.FULLY_COLLAPSED_COMMENT_BACKGROUND_COLOR,
+ getDefaultColor("#4185F4", "#4185F4", "#4185F4"));
+ }
+
+ public int getAwardedCommentBackgroundColor() {
+ return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.AWARDED_COMMENT_BACKGROUND_COLOR,
+ getDefaultColor("#EEAB02", "#EEAB02", "#EEAB02"));
+ }
+
public int getNavBarColor() {
return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.NAV_BAR_COLOR,
getDefaultColor("#FFFFFF", "#121212", "#000000"));
@@ -503,6 +543,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#FFFFFF");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = true;
@@ -580,6 +628,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#121212");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -657,6 +713,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#000000");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -734,6 +798,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#000000");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#FFFFFF");
customTheme.isLightStatusBar = true;
customTheme.isLightNavBar = true;
@@ -811,6 +883,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#121212");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -888,6 +968,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#000000");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -965,6 +1053,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#FFFFFF");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = true;
@@ -1042,6 +1138,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#121212");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -1119,6 +1223,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#000000");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -1196,6 +1308,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#F1FA8C");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#393A59");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
@@ -1273,6 +1393,14 @@ public class CustomThemeWrapper {
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#000000");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
+ customTheme.linkColor = Color.parseColor("#FF4081");
+ customTheme.receivedMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.sentMessageTextColor = Color.parseColor("#FFFFFF");
+ customTheme.receivedMessageBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.sentMessageBackgroundColor = Color.parseColor("#31BF7D");
+ customTheme.sendMessageIconColor = Color.parseColor("#4185F4");
+ customTheme.fullyCollapsedCommentBackgroundColor = Color.parseColor("#4185F4");
+ customTheme.awardedCommentBackgroundColor = Color.parseColor("#EEAB02");
customTheme.navBarColor = Color.parseColor("#D48AE0");
customTheme.isLightStatusBar = true;
customTheme.isLightNavBar = true;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Event/RepliedToPrivateMessageEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/RepliedToPrivateMessageEvent.java
index 4e89b4ec..59d82f3c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Event/RepliedToPrivateMessageEvent.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/RepliedToPrivateMessageEvent.java
@@ -1,6 +1,6 @@
package ml.docilealligator.infinityforreddit.Event;
-import ml.docilealligator.infinityforreddit.Message;
+import ml.docilealligator.infinityforreddit.Message.Message;
public class RepliedToPrivateMessageEvent {
public Message newReply;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedComment.java
index d012342e..658ddc88 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedComment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedComment.java
@@ -8,6 +8,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import ml.docilealligator.infinityforreddit.API.PushshiftAPI;
+import ml.docilealligator.infinityforreddit.Comment.Comment;
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
import ml.docilealligator.infinityforreddit.Utils.Utils;
import retrofit2.Call;
@@ -17,7 +18,7 @@ import retrofit2.Retrofit;
public class FetchRemovedComment {
- public static void fetchRemovedComment(Retrofit retrofit, CommentData comment, FetchRemovedCommentListener listener) {
+ public static void fetchRemovedComment(Retrofit retrofit, Comment comment, FetchRemovedCommentListener listener) {
retrofit.create(PushshiftAPI.class).getRemovedComment(comment.getId())
.enqueue(new Callback<String>() {
@Override
@@ -37,7 +38,7 @@ public class FetchRemovedComment {
});
}
- private static CommentData parseRemovedComment(JSONObject result, CommentData comment) throws JSONException {
+ private static Comment parseRemovedComment(JSONObject result, Comment comment) throws JSONException {
String id = result.getString(JSONUtils.ID_KEY);
String author = result.getString(JSONUtils.AUTHOR_KEY);
String body = Utils.modifyMarkdown(result.optString(JSONUtils.BODY_KEY).trim());
@@ -56,7 +57,7 @@ public class FetchRemovedComment {
}
public interface FetchRemovedCommentListener {
- void fetchSuccess(CommentData comment);
+ void fetchSuccess(Comment comment);
void fetchFailed();
}
@@ -65,9 +66,9 @@ public class FetchRemovedComment {
private String responseBody;
private FetchRemovedCommentListener listener;
- CommentData comment;
+ Comment comment;
- public ParseCommentAsyncTask(String responseBody, CommentData comment, FetchRemovedCommentListener listener) {
+ public ParseCommentAsyncTask(String responseBody, Comment comment, FetchRemovedCommentListener listener) {
this.responseBody = responseBody;
this.comment = comment;
this.listener = listener;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java
index 015d56eb..6a866fef 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java
@@ -33,7 +33,7 @@ import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
import ml.docilealligator.infinityforreddit.Adapter.CommentsListingRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
-import ml.docilealligator.infinityforreddit.CommentViewModel;
+import ml.docilealligator.infinityforreddit.Comment.CommentViewModel;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/InboxFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/InboxFragment.java
index 9129bec2..56f4c2a0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/InboxFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/InboxFragment.java
@@ -33,10 +33,10 @@ import ml.docilealligator.infinityforreddit.Activity.BaseActivity;
import ml.docilealligator.infinityforreddit.Adapter.MessageRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Event.RepliedToPrivateMessageEvent;
-import ml.docilealligator.infinityforreddit.FetchMessages;
+import ml.docilealligator.infinityforreddit.Message.FetchMessage;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
-import ml.docilealligator.infinityforreddit.MessageViewModel;
+import ml.docilealligator.infinityforreddit.Message.MessageViewModel;
import ml.docilealligator.infinityforreddit.NetworkState;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
@@ -102,7 +102,7 @@ public class InboxFragment extends Fragment implements FragmentCommunicator {
mRecyclerView.setPadding(0, 0, 0, mActivity.getNavBarHeight());
}
- mWhere = arguments.getString(EXTRA_MESSAGE_WHERE, FetchMessages.WHERE_INBOX);
+ mWhere = arguments.getString(EXTRA_MESSAGE_WHERE, FetchMessage.WHERE_INBOX);
mAdapter = new MessageRecyclerViewAdapter(mActivity, mOauthRetrofit, mCustomThemeWrapper,
mAccessToken, mWhere, () -> mMessageViewModel.retryLoadingMore());
mLinearLayoutManager = new LinearLayoutManager(mActivity);
@@ -190,7 +190,7 @@ public class InboxFragment extends Fragment implements FragmentCommunicator {
@Subscribe
public void onRepliedToPrivateMessageEvent(RepliedToPrivateMessageEvent repliedToPrivateMessageEvent) {
- if (mAdapter != null && mWhere.equals(FetchMessages.WHERE_MESSAGES)) {
+ if (mAdapter != null && mWhere.equals(FetchMessage.WHERE_MESSAGES)) {
mAdapter.updateMessageReply(repliedToPrivateMessageEvent.newReply, repliedToPrivateMessageEvent.messagePosition);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java
index 9d9aa9b7..6e070c5e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java
@@ -31,6 +31,7 @@ import butterknife.ButterKnife;
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration;
+import io.noties.markwon.core.MarkwonTheme;
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
import io.noties.markwon.linkify.LinkifyPlugin;
import io.noties.markwon.recycler.MarkwonAdapter;
@@ -102,6 +103,11 @@ public class SidebarFragment extends Fragment {
}
@Override
+ public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
+ builder.linkColor(mCustomThemeWrapper.getLinkColor());
+ }
+
+ @Override
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
builder.linkResolver((view, link) -> {
Intent intent = new Intent(activity, LinkResolverActivity.class);
@@ -113,6 +119,7 @@ public class SidebarFragment extends Fragment {
}
startActivity(intent);
}).urlProcessor(new UrlProcessorRelativeToAbsolute("https://www.reddit.com"));
+
}
})
.usePlugin(StrikethroughPlugin.create())
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/FetchMessage.java
index a1a6552c..1322d7c0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/FetchMessage.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Message;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -13,7 +13,7 @@ import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
-public class FetchMessages {
+public class FetchMessage {
public static final String WHERE_INBOX = "inbox";
public static final String WHERE_UNREAD = "unread";
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Message.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/Message.java
index 9f3131e0..a53b11f2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Message.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/Message.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Message;
import android.os.Parcel;
import android.os.Parcelable;
@@ -6,11 +6,11 @@ import android.os.Parcelable;
import java.util.ArrayList;
public class Message implements Parcelable {
- static final String TYPE_COMMENT = "t1";
- static final String TYPE_ACCOUNT = "t2";
- static final String TYPE_LINK = "t3";
- static final String TYPE_MESSAGE = "t4";
- static final String TYPE_SUBREDDIT = "t5";
+ public static final String TYPE_COMMENT = "t1";
+ public static final String TYPE_ACCOUNT = "t2";
+ public static final String TYPE_LINK = "t3";
+ public static final String TYPE_MESSAGE = "t4";
+ public static final String TYPE_SUBREDDIT = "t5";
static final String TYPE_AWARD = "t6";
private String kind;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/MessageDataSource.java
index f81d1894..e3f8cc18 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageDataSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/MessageDataSource.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Message;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -8,6 +8,7 @@ import androidx.paging.PageKeyedDataSource;
import java.util.ArrayList;
import java.util.Locale;
+import ml.docilealligator.infinityforreddit.NetworkState;
import retrofit2.Retrofit;
class MessageDataSource extends PageKeyedDataSource<String, Message> {
@@ -29,10 +30,10 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> {
this.locale = locale;
this.accessToken = accessToken;
this.where = where;
- if (where.equals(FetchMessages.WHERE_MESSAGES)) {
- messageType = FetchMessages.MESSAGE_TYPE_PRIVATE_MESSAGE;
+ if (where.equals(FetchMessage.WHERE_MESSAGES)) {
+ messageType = FetchMessage.MESSAGE_TYPE_PRIVATE_MESSAGE;
} else {
- messageType = FetchMessages.MESSAGE_TYPE_INBOX;
+ messageType = FetchMessage.MESSAGE_TYPE_INBOX;
}
paginationNetworkStateLiveData = new MutableLiveData<>();
initialLoadStateLiveData = new MutableLiveData<>();
@@ -59,8 +60,8 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> {
public void loadInitial(@NonNull LoadInitialParams<String> params, @NonNull LoadInitialCallback<String, Message> callback) {
initialLoadStateLiveData.postValue(NetworkState.LOADING);
- FetchMessages.fetchInbox(oauthRetrofit, locale, accessToken, where, null, messageType,
- new FetchMessages.FetchMessagesListener() {
+ FetchMessage.fetchInbox(oauthRetrofit, locale, accessToken, where, null, messageType,
+ new FetchMessage.FetchMessagesListener() {
@Override
public void fetchSuccess(ArrayList<Message> messages, @Nullable String after) {
if (messages.size() == 0) {
@@ -96,8 +97,8 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> {
paginationNetworkStateLiveData.postValue(NetworkState.LOADING);
- FetchMessages.fetchInbox(oauthRetrofit, locale, accessToken, where, params.key, messageType,
- new FetchMessages.FetchMessagesListener() {
+ FetchMessage.fetchInbox(oauthRetrofit, locale, accessToken, where, params.key, messageType,
+ new FetchMessage.FetchMessagesListener() {
@Override
public void fetchSuccess(ArrayList<Message> messages, @Nullable String after) {
if (after == null || after.equals("") || after.equals("null")) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/MessageDataSourceFactory.java
index b1470bf7..db717ce5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageDataSourceFactory.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/MessageDataSourceFactory.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Message;
import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/MessageViewModel.java
index e02c4296..3af6b708 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageViewModel.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/MessageViewModel.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Message;
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
@@ -11,6 +11,7 @@ import androidx.paging.PagedList;
import java.util.Locale;
+import ml.docilealligator.infinityforreddit.NetworkState;
import retrofit2.Retrofit;
public class MessageViewModel extends ViewModel {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseMessage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/ParseMessage.java
index c605a5f3..6b4048e4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseMessage.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/ParseMessage.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Message;
import android.os.AsyncTask;
@@ -44,8 +44,8 @@ public class ParseMessage {
@Nullable
private static Message parseSingleMessage(JSONObject messageJSON, Locale locale, int messageType) throws JSONException {
String kind = messageJSON.getString(JSONUtils.KIND_KEY);
- if ((messageType == FetchMessages.MESSAGE_TYPE_INBOX && kind.equals("t4")) ||
- (messageType == FetchMessages.MESSAGE_TYPE_PRIVATE_MESSAGE && !kind.equals("t4"))) {
+ if ((messageType == FetchMessage.MESSAGE_TYPE_INBOX && kind.equals("t4")) ||
+ (messageType == FetchMessage.MESSAGE_TYPE_PRIVATE_MESSAGE && !kind.equals("t4"))) {
return null;
}
@@ -145,7 +145,7 @@ public class ParseMessage {
try {
JSONObject messageJSON = new JSONObject(response).getJSONObject(JSONUtils.JSON_KEY)
.getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.THINGS_KEY).getJSONObject(0);
- message = parseSingleMessage(messageJSON, locale, FetchMessages.MESSAGE_TYPE_PRIVATE_MESSAGE);
+ message = parseSingleMessage(messageJSON, locale, FetchMessage.MESSAGE_TYPE_PRIVATE_MESSAGE);
} catch (JSONException e) {
e.printStackTrace();
errorMessage = parseRepliedMessageErrorMessage(response);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ReadMessage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/ReadMessage.java
index 1b039178..bb8b4030 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ReadMessage.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/ReadMessage.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Message;
import androidx.annotation.NonNull;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ReplyMessage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/ReplyMessage.java
index 1b60d05b..ca8edcd2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ReplyMessage.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Message/ReplyMessage.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Message;
import androidx.annotation.NonNull;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java
index 52886ecb..246f9119 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java
@@ -31,6 +31,9 @@ import ml.docilealligator.infinityforreddit.Account.Account;
import ml.docilealligator.infinityforreddit.Activity.InboxActivity;
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.Message.FetchMessage;
+import ml.docilealligator.infinityforreddit.Message.Message;
+import ml.docilealligator.infinityforreddit.Message.ParseMessage;
import ml.docilealligator.infinityforreddit.Utils.APIUtils;
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
@@ -85,7 +88,7 @@ public class PullNotificationWorker extends Worker {
String responseBody = response.body();
JSONArray messageArray = new JSONObject(responseBody).getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY);
ArrayList<Message> messages = ParseMessage.parseMessages(messageArray,
- context.getResources().getConfiguration().locale, FetchMessages.MESSAGE_TYPE_NOTIFICATION);
+ context.getResources().getConfiguration().locale, FetchMessage.MESSAGE_TYPE_NOTIFICATION);
if (!messages.isEmpty()) {
NotificationManagerCompat notificationManager = NotificationUtils.getNotificationManager(context);
@@ -218,7 +221,7 @@ public class PullNotificationWorker extends Worker {
Call<String> call = mOauthWithoutAuthenticatorRetrofit.create(RedditAPI.class)
.getMessages(APIUtils.getOAuthHeader(account.getAccessToken()),
- FetchMessages.WHERE_UNREAD, null);
+ FetchMessage.WHERE_UNREAD, null);
Response<String> response = call.execute();
if (response.isSuccessful()) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
index 8743c4c9..3bac4b1b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
@@ -26,7 +26,7 @@ import ml.docilealligator.infinityforreddit.User.UserDao;
import ml.docilealligator.infinityforreddit.User.UserData;
@Database(entities = {Account.class, SubredditData.class, SubscribedSubredditData.class, UserData.class,
- SubscribedUserData.class, MultiReddit.class, CustomTheme.class}, version = 8)
+ SubscribedUserData.class, MultiReddit.class, CustomTheme.class}, version = 9)
public abstract class RedditDataRoomDatabase extends RoomDatabase {
private static RedditDataRoomDatabase INSTANCE;
@@ -37,7 +37,7 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
RedditDataRoomDatabase.class, "reddit_data")
.addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5,
- MIGRATION_5_6, MIGRATION_6_7, MIGRATION_7_8)
+ MIGRATION_5_6, MIGRATION_6_7, MIGRATION_7_8, MIGRATION_8_9)
.build();
}
}
@@ -186,4 +186,27 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
+ " ADD COLUMN bottom_app_bar_icon_color INTEGER DEFAULT " + Color.parseColor("#000000") + " NOT NULL");
}
};
+
+ private static final Migration MIGRATION_8_9 = new Migration(8, 9) {
+ @Override
+ public void migrate(@NonNull SupportSQLiteDatabase database) {
+ database.execSQL("ALTER TABLE custom_themes"
+ + " ADD COLUMN link_color INTEGER DEFAULT " + Color.parseColor("#FF4081") + " NOT NULL");
+ database.execSQL("ALTER TABLE custom_themes"
+ + " ADD COLUMN received_message_text_color INTEGER DEFAULT " + Color.parseColor("#FFFFFF") + " NOT NULL");
+ database.execSQL("ALTER TABLE custom_themes"
+ + " ADD COLUMN sent_message_text_color INTEGER DEFAULT " + Color.parseColor("#FFFFFF") + " NOT NULL");
+ database.execSQL("ALTER TABLE custom_themes"
+ + " ADD COLUMN received_message_background_color INTEGER DEFAULT " + Color.parseColor("#4185F4") + " NOT NULL");
+ database.execSQL("ALTER TABLE custom_themes"
+ + " ADD COLUMN sent_message_background_color INTEGER DEFAULT " + Color.parseColor("#31BF7D") + " NOT NULL");
+ database.execSQL("ALTER TABLE custom_themes"
+ + " ADD COLUMN send_message_icon_color INTEGER DEFAULT " + Color.parseColor("#4185F4") + " NOT NULL");
+ database.execSQL("ALTER TABLE custom_themes"
+ + " ADD COLUMN fully_collapsed_comment_background_color INTEGER DEFAULT " + Color.parseColor("#4185F4") + " NOT NULL");
+ database.execSQL("ALTER TABLE custom_themes"
+ + " ADD COLUMN awarded_comment_background_color INTEGER DEFAULT " + Color.parseColor("#EEAB02") + " NOT NULL");
+
+ }
+ };
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java
index 295013f1..3ed4951b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java
@@ -79,6 +79,14 @@ public class CustomThemeSharedPreferencesUtils {
public static final String COMMENT_VERTICAL_BAR_COLOR_7 = "commentVerticalBarColor7";
public static final String FAB_ICON_COLOR = "fabIconColor";
public static final String CHIP_TEXT_COLOR = "chipTextColor";
+ public static final String LINK_COLOR = "linkColor";
+ public static final String RECEIVED_MESSAGE_TEXT_COLOR = "receivedMessageTextColor";
+ public static final String SENT_MESSAGE_TEXT_COLOR = "sentMessageTextColor";
+ public static final String RECEIVED_MESSAGE_BACKROUND_COLOR = "receivedMessageBackgroundColor";
+ public static final String SENT_MESSAGE_BACKGROUND_COLOR = "sentMessageBackgroundColor";
+ public static final String SEND_MESSAGE_ICON_COLOR = "sentMessageIconColor";
+ public static final String FULLY_COLLAPSED_COMMENT_BACKGROUND_COLOR = "fullyCollapsedCommentBackgroundColor";
+ public static final String AWARDED_COMMENT_BACKGROUND_COLOR = "awardedCommentBackgroundColor";
public static void insertThemeToSharedPreferences(CustomTheme customTheme, SharedPreferences themeSharedPreferences) {
SharedPreferences.Editor editor = themeSharedPreferences.edit();