aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java24
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java4
3 files changed, 11 insertions, 21 deletions
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 60258204..825a3a1a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java
@@ -661,7 +661,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (comment.hasReply()) {
if (comment.isExpanded()) {
- ((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
+ ((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_black_22dp);
} else {
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_more_black_20dp);
}
@@ -1741,7 +1741,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
} else {
expandChildren(commentPosition);
mVisibleComments.get(commentPosition).setExpanded(true);
- expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
+ expandButton.setImageResource(R.drawable.ic_expand_less_black_22dp);
}
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 41ca7800..62d5277e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -42,7 +42,6 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.BlurTransformation;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
-import ml.docilealligator.infinityforreddit.Activity.CommentActivity;
import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity;
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
import ml.docilealligator.infinityforreddit.Activity.ViewGIFActivity;
@@ -469,6 +468,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
break;
case Post.TEXT_TYPE:
((DataViewHolder) holder).typeTextView.setText(R.string.text);
+ if (post.getSelfText() != null && !post.getSelfText().equals("")) {
+ ((DataViewHolder) holder).contentTextView.setVisibility(View.VISIBLE);
+ ((DataViewHolder) holder).contentTextView.setText(post.getSelfText());
+ }
break;
}
@@ -614,20 +617,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}, fullName, newVoteType, holder.getAdapterPosition());
});
- ((DataViewHolder) holder).commentButton.setOnClickListener(view -> {
- if (mAccessToken == null) {
- Toast.makeText(mContext, R.string.login_first, Toast.LENGTH_SHORT).show();
- return;
- }
-
- Intent intent = new Intent(mContext, CommentActivity.class);
- intent.putExtra(CommentActivity.EXTRA_PARENT_FULLNAME_KEY, post.getFullName());
- intent.putExtra(CommentActivity.EXTRA_COMMENT_PARENT_TEXT_KEY, post.getTitle());
- intent.putExtra(CommentActivity.EXTRA_IS_REPLYING_KEY, false);
- intent.putExtra(CommentActivity.EXTRA_PARENT_DEPTH_KEY, 0);
- mContext.startActivity(intent);
- });
-
((DataViewHolder) holder).commentsCountTextView.setText(Integer.toString(post.getnComments()));
if (post.isSaved()) {
@@ -801,6 +790,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((DataViewHolder) holder).imageView.setVisibility(View.GONE);
((DataViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
((DataViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE);
+ ((DataViewHolder) holder).contentTextView.setVisibility(View.GONE);
((DataViewHolder) holder).upvoteButton.clearColorFilter();
((DataViewHolder) holder).scoreTextView.setTextColor(ContextCompat.getColor(mContext, R.color.defaultTextColor));
((DataViewHolder) holder).downvoteButton.clearColorFilter();
@@ -860,14 +850,14 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
RelativeLayout errorRelativeLayout;
@BindView(R.id.image_view_no_preview_link_item_post)
ImageView noPreviewLinkImageView;
+ @BindView(R.id.content_text_view_item_post)
+ TextView contentTextView;
@BindView(R.id.plus_button_item_post)
ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post)
TextView scoreTextView;
@BindView(R.id.minus_button_item_post)
ImageView downvoteButton;
- @BindView(R.id.comment_button_item_post)
- ImageView commentButton;
@BindView(R.id.comments_count_item_post)
TextView commentsCountTextView;
@BindView(R.id.save_button_item_post)
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java
index 5d30578e..3e3d4e54 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils.java
@@ -2,7 +2,7 @@ package ml.docilealligator.infinityforreddit;
public class Utils {
public static String addSubredditAndUserLink(String markdown) {
- return markdown.replaceAll("(?<!\\s)/{0,1}u/\\w+/{0,1}(?<!\\s)$", "[$0]($0)")
- .replaceAll("(?<!\\s)/{0,1}r/\\w+/{0,1}(?<!\\s)$", "[$0]($0)");
+ return markdown.replaceAll("\n", " ")
+ .replaceAll("((?<=[\\s])|^)/{0,1}[ru]/\\w+/{0,1}", "[$0]($0)");
}
}