aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator/infinityforreddit
diff options
context:
space:
mode:
authorDocile-Alligator <chineseperson5@gmail.com>2022-05-14 04:39:28 +0000
committerDocile-Alligator <chineseperson5@gmail.com>2022-05-14 04:39:28 +0000
commitb75883c7586307e77eab40fd4d17db9192d4ff73 (patch)
treee39493091db6eb955386b253cf42e6c9d4f4b14b /app/src/main/java/ml/docilealligator/infinityforreddit
parent22cf0a9c20b41176e9e2216d79934028c570b0c3 (diff)
downloadinfinity-for-reddit-b75883c7586307e77eab40fd4d17db9192d4ff73.tar
infinity-for-reddit-b75883c7586307e77eab40fd4d17db9192d4ff73.tar.gz
infinity-for-reddit-b75883c7586307e77eab40fd4d17db9192d4ff73.tar.bz2
infinity-for-reddit-b75883c7586307e77eab40fd4d17db9192d4ff73.tar.lz
infinity-for-reddit-b75883c7586307e77eab40fd4d17db9192d4ff73.tar.xz
infinity-for-reddit-b75883c7586307e77eab40fd4d17db9192d4ff73.tar.zst
infinity-for-reddit-b75883c7586307e77eab40fd4d17db9192d4ff73.zip
Render spoiler in PrivateMessagesDetailRecyclerViewAdapter.
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java31
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java8
2 files changed, 20 insertions, 19 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java
index 474ec4d1..a3c883ac 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java
@@ -45,6 +45,7 @@ import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity;
import ml.docilealligator.infinityforreddit.activities.ViewPrivateMessagesActivity;
import ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.markdown.SpoilerParserPlugin;
import ml.docilealligator.infinityforreddit.markdown.SuperscriptInlineProcessor;
import ml.docilealligator.infinityforreddit.message.Message;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
@@ -76,6 +77,7 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
mGlide = Glide.with(viewPrivateMessagesActivity);
mLocale = locale;
mAccountName = accountName;
+ int commentColor = customThemeWrapper.getCommentColor();
mMarkwon = Markwon.builder(viewPrivateMessagesActivity)
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
plugin.excludeInlineProcessor(AutolinkInlineProcessor.class);
@@ -116,6 +118,7 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
}
})
.usePlugin(StrikethroughPlugin.create())
+ .usePlugin(SpoilerParserPlugin.create(commentColor, commentColor | 0xFF000000))
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
.build();
mShowElapsedTime = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY, false);
@@ -163,17 +166,6 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
} else {
((MessageViewHolder) holder).timeTextView.setText(Utils.getFormattedTime(mLocale, message.getTimeUTC(), mTimeFormatPattern));
}
-
- ((MessageViewHolder) holder).messageTextView.setOnClickListener(view -> {
- if (((MessageViewHolder) holder).timeTextView.getVisibility() != View.VISIBLE) {
- ((MessageViewHolder) holder).timeTextView.setVisibility(View.VISIBLE);
- ((MessageViewHolder) holder).copyImageView.setVisibility(View.VISIBLE);
- } else {
- ((MessageViewHolder) holder).timeTextView.setVisibility(View.GONE);
- ((MessageViewHolder) holder).copyImageView.setVisibility(View.GONE);
- }
- mViewPrivateMessagesActivity.delayTransition();
- });
}
if (holder instanceof SentMessageViewHolder) {
@@ -264,6 +256,23 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
messageTextView.setTextColor(Color.WHITE);
timeTextView.setTextColor(mSecondaryTextColor);
+ itemView.setOnClickListener(view -> {
+ if (timeTextView.getVisibility() != View.VISIBLE) {
+ timeTextView.setVisibility(View.VISIBLE);
+ copyImageView.setVisibility(View.VISIBLE);
+ } else {
+ timeTextView.setVisibility(View.GONE);
+ copyImageView.setVisibility(View.GONE);
+ }
+ mViewPrivateMessagesActivity.delayTransition();
+ });
+
+ messageTextView.setOnClickListener(view -> {
+ if (messageTextView.getSelectionStart() == -1 && messageTextView.getSelectionEnd() == -1) {
+ itemView.performClick();
+ }
+ });
+
copyImageView.setColorFilter(mSecondaryTextColor, android.graphics.PorterDuff.Mode.SRC_IN);
copyImageView.setOnClickListener(view -> {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java
index 2eb97d96..f3159f93 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java
@@ -1,14 +1,12 @@
package ml.docilealligator.infinityforreddit.adapters.navigationdrawer;
import android.content.SharedPreferences;
-import android.content.res.Resources;
import androidx.recyclerview.widget.ConcatAdapter;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
-import java.util.ArrayList;
import java.util.List;
import ml.docilealligator.infinityforreddit.account.Account;
@@ -27,11 +25,6 @@ public class NavigationDrawerRecyclerViewMergedAdapter {
private AccountManagementSectionRecyclerViewAdapter accountManagementSectionRecyclerViewAdapter;
private ConcatAdapter mainPageConcatAdapter;
- private Resources resources;
- private ArrayList<Account> accounts;
- private boolean isLoggedIn;
- private boolean isInMainPage = true;
-
public NavigationDrawerRecyclerViewMergedAdapter(BaseActivity baseActivity, SharedPreferences sharedPreferences,
SharedPreferences nsfwAndSpoilerSharedPreferences,
SharedPreferences navigationDrawerSharedPreferences,
@@ -92,7 +85,6 @@ public class NavigationDrawerRecyclerViewMergedAdapter {
mainPageConcatAdapter.removeAdapter(subscribedSubredditsRecyclerViewAdapter);
mainPageConcatAdapter.addAdapter(accountManagementSectionRecyclerViewAdapter);
- isInMainPage = false;
}
public void closeAccountSectionWithoutChangeIconResource() {