mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2026-02-01 15:56:14 +00:00
this commit fixes #1007 and readying for 4.5.0
This commit is contained in:
parent
0ffe15418a
commit
3b9d6a9320
@ -49,7 +49,7 @@ android {
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources false
|
||||
shrinkResources true
|
||||
signingConfig signingConfigs.signing
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
|
||||
@ -12,19 +12,21 @@ import com.fastaccess.R;
|
||||
|
||||
public enum ReactionTypes {
|
||||
|
||||
HEART("heart", R.id.heart),
|
||||
HOORAY("hooray", R.id.hurray),
|
||||
PLUS_ONE("+1", R.id.thumbsUp),
|
||||
MINUS_ONE("-1", R.id.thumbsDown),
|
||||
CONFUSED("confused", R.id.sad),
|
||||
LAUGH("laugh", R.id.laugh);
|
||||
HEART("heart", R.id.heart, R.id.heartReaction),
|
||||
HOORAY("hooray", R.id.hurray, R.id.hurrayReaction),
|
||||
PLUS_ONE("+1", R.id.thumbsUp, R.id.thumbsUpReaction),
|
||||
MINUS_ONE("-1", R.id.thumbsDown, R.id.thumbsDownReaction),
|
||||
CONFUSED("confused", R.id.sad, R.id.sadReaction),
|
||||
LAUGH("laugh", R.id.laugh, R.id.laughReaction);
|
||||
|
||||
private String content;
|
||||
private int vId;
|
||||
private int secondaryViewId;
|
||||
|
||||
ReactionTypes(String content, int vId) {
|
||||
ReactionTypes(String content, int vId, int secondaryViewId) {
|
||||
this.content = content;
|
||||
this.vId = vId;
|
||||
this.secondaryViewId = secondaryViewId;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
@ -37,7 +39,7 @@ public enum ReactionTypes {
|
||||
|
||||
@Nullable public static ReactionTypes get(@IdRes int vId) {
|
||||
return Stream.of(values())
|
||||
.filter(value -> value.getvId() == vId)
|
||||
.filter(value -> value.getvId() == vId || value.secondaryViewId == vId)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@ -59,10 +59,16 @@ public class IssueDetailsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
@BindView(R.id.commentOptions) View commentOptions;
|
||||
@BindView(R.id.toggleHolder) View toggleHolder;
|
||||
@BindView(R.id.emojiesList) View emojiesList;
|
||||
@BindView(R.id.reactionsText) TextView reactionsText;
|
||||
@BindView(R.id.owner) TextView owner;
|
||||
@BindView(R.id.labels) TextView labels;
|
||||
@BindView(R.id.labelsHolder) View labelsHolder;
|
||||
@BindView(R.id.reactionsList) View reactionsList;
|
||||
@BindView(R.id.thumbsUpReaction) FontTextView thumbsUpReaction;
|
||||
@BindView(R.id.thumbsDownReaction) FontTextView thumbsDownReaction;
|
||||
@BindView(R.id.laughReaction) FontTextView laughReaction;
|
||||
@BindView(R.id.hurrayReaction) FontTextView hurrayReaction;
|
||||
@BindView(R.id.sadReaction) FontTextView sadReaction;
|
||||
@BindView(R.id.heartReaction) FontTextView heartReaction;
|
||||
private OnToggleView onToggleView;
|
||||
private ReactionsCallback reactionsCallback;
|
||||
private ViewGroup viewGroup;
|
||||
@ -95,6 +101,18 @@ public class IssueDetailsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
hooray.setOnLongClickListener(this);
|
||||
heart.setOnLongClickListener(this);
|
||||
heart.setOnClickListener(this);
|
||||
laughReaction.setOnClickListener(this);
|
||||
sadReaction.setOnClickListener(this);
|
||||
thumbsDownReaction.setOnClickListener(this);
|
||||
thumbsUpReaction.setOnClickListener(this);
|
||||
hurrayReaction.setOnClickListener(this);
|
||||
heartReaction.setOnClickListener(this);
|
||||
laughReaction.setOnLongClickListener(this);
|
||||
sadReaction.setOnLongClickListener(this);
|
||||
thumbsDownReaction.setOnLongClickListener(this);
|
||||
thumbsUpReaction.setOnLongClickListener(this);
|
||||
hurrayReaction.setOnLongClickListener(this);
|
||||
heartReaction.setOnLongClickListener(this);
|
||||
}
|
||||
|
||||
public static IssueDetailsViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter,
|
||||
@ -146,21 +164,27 @@ public class IssueDetailsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
boolean isCallingApi = reactionsCallback != null && reactionsCallback.isCallingApi(number, v.getId());
|
||||
switch (v.getId()) {
|
||||
case R.id.heart:
|
||||
case R.id.heartReaction:
|
||||
reactionsModel.setHeart(!isReacted ? reactionsModel.getHeart() + 1 : reactionsModel.getHeart() - 1);
|
||||
break;
|
||||
case R.id.sad:
|
||||
case R.id.sadReaction:
|
||||
reactionsModel.setConfused(!isReacted ? reactionsModel.getConfused() + 1 : reactionsModel.getConfused() - 1);
|
||||
break;
|
||||
case R.id.thumbsDown:
|
||||
case R.id.thumbsDownReaction:
|
||||
reactionsModel.setMinusOne(!isReacted ? reactionsModel.getMinusOne() + 1 : reactionsModel.getMinusOne() - 1);
|
||||
break;
|
||||
case R.id.thumbsUp:
|
||||
case R.id.thumbsUpReaction:
|
||||
reactionsModel.setPlusOne(!isReacted ? reactionsModel.getPlusOne() + 1 : reactionsModel.getPlusOne() - 1);
|
||||
break;
|
||||
case R.id.laugh:
|
||||
case R.id.laughReaction:
|
||||
reactionsModel.setLaugh(!isReacted ? reactionsModel.getLaugh() + 1 : reactionsModel.getLaugh() - 1);
|
||||
break;
|
||||
case R.id.hurray:
|
||||
case R.id.hurrayReaction:
|
||||
reactionsModel.setHooray(!isReacted ? reactionsModel.getHooray() + 1 : reactionsModel.getHooray() - 1);
|
||||
break;
|
||||
}
|
||||
@ -228,74 +252,50 @@ public class IssueDetailsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
}
|
||||
}
|
||||
|
||||
private void appendEmojies(@NonNull ReactionsModel reaction) {
|
||||
SpannableBuilder spannableBuilder = SpannableBuilder.builder();
|
||||
reactionsText.setText("");
|
||||
thumbsUp.setText(SpannableBuilder.builder()
|
||||
private void appendEmojies(ReactionsModel reaction) {
|
||||
SpannableBuilder spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getThumbsUp()).append(" ")
|
||||
.append(String.valueOf(reaction.getPlusOne()))
|
||||
.append(" "));
|
||||
thumbsDown.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
thumbsUp.setText(spannableBuilder);
|
||||
thumbsUpReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getThumbsDown()).append(" ")
|
||||
.append(String.valueOf(reaction.getMinusOne()))
|
||||
.append(" "));
|
||||
hooray.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
thumbsDown.setText(spannableBuilder);
|
||||
thumbsDownReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getHooray()).append(" ")
|
||||
.append(String.valueOf(reaction.getHooray()))
|
||||
.append(" "));
|
||||
sad.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
hooray.setText(spannableBuilder);
|
||||
hurrayReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getSad()).append(" ")
|
||||
.append(String.valueOf(reaction.getConfused()))
|
||||
.append(" "));
|
||||
laugh.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
sad.setText(spannableBuilder);
|
||||
sadReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getLaugh()).append(" ")
|
||||
.append(String.valueOf(reaction.getLaugh()))
|
||||
.append(" "));
|
||||
heart.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
laugh.setText(spannableBuilder);
|
||||
laughReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getHeart()).append(" ")
|
||||
.append(String.valueOf(reaction.getHeart())));
|
||||
if (reaction.getPlusOne() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getThumbsUp())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getPlusOne()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getMinusOne() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getThumbsDown())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getMinusOne()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getLaugh() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getLaugh())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getLaugh()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getHooray() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getHooray())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getHooray()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getConfused() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getSad())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getConfused()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getHeart() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getHeart())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getHeart()));
|
||||
}
|
||||
if (spannableBuilder.length() > 0) {
|
||||
reactionsText.setText(spannableBuilder);
|
||||
if (!onToggleView.isCollapsed(getAdapterPosition())) {
|
||||
reactionsText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
.append(String.valueOf(reaction.getHeart()));
|
||||
heart.setText(spannableBuilder);
|
||||
heartReaction.setText(spannableBuilder);
|
||||
if (reaction.getPlusOne() > 0 || reaction.getMinusOne() > 0
|
||||
|| reaction.getLaugh() > 0 || reaction.getHooray() > 0
|
||||
|| reaction.getConfused() > 0 || reaction.getHeart() > 0) {
|
||||
reactionsList.setVisibility(View.VISIBLE);
|
||||
reactionsList.setTag(true);
|
||||
} else {
|
||||
reactionsText.setVisibility(View.GONE);
|
||||
reactionsList.setTag(false);
|
||||
reactionsList.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,9 +305,8 @@ public class IssueDetailsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
}
|
||||
toggle.setRotation(!expanded ? 0.0F : 180F);
|
||||
commentOptions.setVisibility(!expanded ? View.GONE : View.VISIBLE);
|
||||
if (!InputHelper.isEmpty(reactionsText)) {
|
||||
reactionsText.setVisibility(!expanded ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
reactionsList.setVisibility(expanded ? View.GONE : reactionsList.getTag() == null || (!((Boolean) reactionsList.getTag()))
|
||||
? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override protected void onViewIsDetaching() {
|
||||
|
||||
@ -1,285 +0,0 @@
|
||||
package com.fastaccess.ui.adapter.viewholder;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.transition.ChangeBounds;
|
||||
import android.support.transition.TransitionManager;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.data.dao.ReactionsModel;
|
||||
import com.fastaccess.data.dao.model.Issue;
|
||||
import com.fastaccess.data.dao.model.PullRequest;
|
||||
import com.fastaccess.data.dao.model.User;
|
||||
import com.fastaccess.data.dao.timeline.PullRequestTimelineModel;
|
||||
import com.fastaccess.helper.InputHelper;
|
||||
import com.fastaccess.helper.ParseDateFormat;
|
||||
import com.fastaccess.provider.scheme.LinkParserHelper;
|
||||
import com.fastaccess.provider.timeline.CommentsHelper;
|
||||
import com.fastaccess.provider.timeline.HtmlHelper;
|
||||
import com.fastaccess.provider.timeline.handler.drawable.DrawableGetter;
|
||||
import com.fastaccess.ui.adapter.callback.OnToggleView;
|
||||
import com.fastaccess.ui.adapter.callback.ReactionsCallback;
|
||||
import com.fastaccess.ui.widgets.AvatarLayout;
|
||||
import com.fastaccess.ui.widgets.FontTextView;
|
||||
import com.fastaccess.ui.widgets.SpannableBuilder;
|
||||
import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter;
|
||||
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 13 Dec 2016, 1:03 AM
|
||||
*/
|
||||
|
||||
public class PullRequestDetailsViewHolder extends BaseViewHolder<PullRequestTimelineModel> {
|
||||
|
||||
@BindView(R.id.avatarView) AvatarLayout avatar;
|
||||
@BindView(R.id.date) FontTextView date;
|
||||
@BindView(R.id.name) FontTextView name;
|
||||
@BindView(R.id.comment) FontTextView comment;
|
||||
@BindView(R.id.thumbsUp) FontTextView thumbsUp;
|
||||
@BindView(R.id.thumbsDown) FontTextView thumbsDown;
|
||||
@BindView(R.id.laugh) FontTextView laugh;
|
||||
@BindView(R.id.sad) FontTextView sad;
|
||||
@BindView(R.id.hurray) FontTextView hooray;
|
||||
@BindView(R.id.heart) FontTextView heart;
|
||||
@BindView(R.id.toggle) View toggle;
|
||||
@BindView(R.id.commentMenu) View commentMenu;
|
||||
@BindView(R.id.commentOptions) View commentOptions;
|
||||
@BindView(R.id.toggleHolder) View toggleHolder;
|
||||
@BindView(R.id.emojiesList) View emojiesList;
|
||||
@BindView(R.id.reactionsText) TextView reactionsText;
|
||||
@BindView(R.id.owner) TextView owner;
|
||||
private OnToggleView onToggleView;
|
||||
private ReactionsCallback reactionsCallback;
|
||||
private ViewGroup viewGroup;
|
||||
private String repoOwner;
|
||||
private String poster;
|
||||
|
||||
private PullRequestDetailsViewHolder(@NonNull View itemView, @NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter,
|
||||
@NonNull OnToggleView onToggleView, @NonNull ReactionsCallback reactionsCallback,
|
||||
String repoOwner, String poster) {
|
||||
super(itemView, adapter);
|
||||
this.onToggleView = onToggleView;
|
||||
this.viewGroup = viewGroup;
|
||||
this.reactionsCallback = reactionsCallback;
|
||||
this.repoOwner = repoOwner;
|
||||
this.poster = poster;
|
||||
itemView.setOnClickListener(null);
|
||||
itemView.setOnLongClickListener(null);
|
||||
commentMenu.setOnClickListener(this);
|
||||
toggle.setOnClickListener(this);
|
||||
toggleHolder.setOnClickListener(this);
|
||||
laugh.setOnClickListener(this);
|
||||
sad.setOnClickListener(this);
|
||||
thumbsDown.setOnClickListener(this);
|
||||
thumbsUp.setOnClickListener(this);
|
||||
hooray.setOnClickListener(this);
|
||||
laugh.setOnLongClickListener(this);
|
||||
sad.setOnLongClickListener(this);
|
||||
thumbsDown.setOnLongClickListener(this);
|
||||
thumbsUp.setOnLongClickListener(this);
|
||||
hooray.setOnLongClickListener(this);
|
||||
heart.setOnLongClickListener(this);
|
||||
heart.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public static PullRequestDetailsViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter,
|
||||
@NonNull OnToggleView onToggleView, @NonNull ReactionsCallback reactionsCallback,
|
||||
@NonNull String repoOwner, @NonNull String poster) {
|
||||
return new PullRequestDetailsViewHolder(getView(viewGroup, R.layout.issue_detail_header_row_item), viewGroup,
|
||||
adapter, onToggleView, reactionsCallback, repoOwner, poster);
|
||||
}
|
||||
|
||||
@Override public void bind(@NonNull PullRequestTimelineModel timelineModel) {
|
||||
if (timelineModel.getPullRequest() != null) {
|
||||
bind(timelineModel.getPullRequest());
|
||||
}
|
||||
if (onToggleView != null) onToggle(onToggleView.isCollapsed(getAdapterPosition()), false);
|
||||
}
|
||||
|
||||
@Override public void onClick(View v) {
|
||||
if (v.getId() == R.id.toggle || v.getId() == R.id.toggleHolder) {
|
||||
if (onToggleView != null) {
|
||||
int position = getAdapterPosition();
|
||||
onToggleView.onToggle(position, !onToggleView.isCollapsed(position));
|
||||
onToggle(onToggleView.isCollapsed(position), true);
|
||||
}
|
||||
} else {
|
||||
addReactionCount(v);
|
||||
super.onClick(v);
|
||||
}
|
||||
}
|
||||
|
||||
private void addReactionCount(View v) {
|
||||
if (adapter != null) {
|
||||
PullRequestTimelineModel timelineModel = (PullRequestTimelineModel) adapter.getItem(getAdapterPosition());
|
||||
if (timelineModel == null) return;
|
||||
ReactionsModel reactionsModel = null;
|
||||
PullRequest pullRequest = timelineModel.getPullRequest();
|
||||
int number = 0;
|
||||
if (pullRequest != null) {
|
||||
reactionsModel = pullRequest.getReactions();
|
||||
number = pullRequest.getNumber();
|
||||
}
|
||||
if (reactionsModel == null) reactionsModel = new ReactionsModel();
|
||||
boolean isReacted = reactionsCallback == null || reactionsCallback.isPreviouslyReacted(number, v.getId());
|
||||
boolean isCallingApi = reactionsCallback != null && reactionsCallback.isCallingApi(number, v.getId());
|
||||
switch (v.getId()) {
|
||||
case R.id.heart:
|
||||
reactionsModel.setHeart(!isReacted ? reactionsModel.getHeart() + 1 : reactionsModel.getHeart() - 1);
|
||||
break;
|
||||
case R.id.sad:
|
||||
reactionsModel.setConfused(!isReacted ? reactionsModel.getConfused() + 1 : reactionsModel.getConfused() - 1);
|
||||
break;
|
||||
case R.id.thumbsDown:
|
||||
reactionsModel.setMinusOne(!isReacted ? reactionsModel.getMinusOne() + 1 : reactionsModel.getMinusOne() - 1);
|
||||
break;
|
||||
case R.id.thumbsUp:
|
||||
reactionsModel.setPlusOne(!isReacted ? reactionsModel.getPlusOne() + 1 : reactionsModel.getPlusOne() - 1);
|
||||
break;
|
||||
case R.id.laugh:
|
||||
reactionsModel.setLaugh(!isReacted ? reactionsModel.getLaugh() + 1 : reactionsModel.getLaugh() - 1);
|
||||
break;
|
||||
case R.id.hurray:
|
||||
reactionsModel.setHooray(!isReacted ? reactionsModel.getHooray() + 1 : reactionsModel.getHooray() - 1);
|
||||
break;
|
||||
}
|
||||
if (pullRequest != null) {
|
||||
pullRequest.setReactions(reactionsModel);
|
||||
appendEmojies(reactionsModel);
|
||||
timelineModel.setPullRequest(pullRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void bind(@NonNull Issue issueModel) {
|
||||
setup(issueModel.getUser(), issueModel.getBodyHtml(), issueModel.getReactions());
|
||||
setupDate(issueModel.getCreatedAt(), issueModel.getUpdatedAt());
|
||||
}
|
||||
|
||||
private void bind(@NonNull PullRequest pullRequest) {
|
||||
setup(pullRequest.getUser(), pullRequest.getBodyHtml(), pullRequest.getReactions());
|
||||
setupDate(pullRequest.getCreatedAt(), pullRequest.getUpdatedAt());
|
||||
}
|
||||
|
||||
private void setup(User user, String description, ReactionsModel reactionsModel) {
|
||||
avatar.setUrl(user.getAvatarUrl(), user.getLogin(), user.isOrganizationType(), LinkParserHelper.isEnterprise(user.getHtmlUrl()));
|
||||
name.setText(user.getLogin());
|
||||
boolean isOwner = TextUtils.equals(repoOwner, user.getLogin());
|
||||
if (isOwner) {
|
||||
owner.setVisibility(View.VISIBLE);
|
||||
owner.setText(R.string.owner);
|
||||
} else {
|
||||
owner.setText(null);
|
||||
owner.setVisibility(View.GONE);
|
||||
}
|
||||
if (reactionsModel != null) {
|
||||
appendEmojies(reactionsModel);
|
||||
}
|
||||
if (description != null && !description.trim().isEmpty()) {
|
||||
HtmlHelper.htmlIntoTextView(comment, description, viewGroup.getWidth());
|
||||
} else {
|
||||
comment.setText(R.string.no_description_provided);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupDate(@NonNull Date createdDate, @NonNull Date updated) {
|
||||
date.setText(ParseDateFormat.getTimeAgo(createdDate));
|
||||
}
|
||||
|
||||
private void appendEmojies(@NonNull ReactionsModel reaction) {
|
||||
SpannableBuilder spannableBuilder = SpannableBuilder.builder();
|
||||
reactionsText.setText("");
|
||||
thumbsUp.setText(SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getThumbsUp()).append(" ")
|
||||
.append(String.valueOf(reaction.getPlusOne()))
|
||||
.append(" "));
|
||||
thumbsDown.setText(SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getThumbsDown()).append(" ")
|
||||
.append(String.valueOf(reaction.getMinusOne()))
|
||||
.append(" "));
|
||||
hooray.setText(SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getHooray()).append(" ")
|
||||
.append(String.valueOf(reaction.getHooray()))
|
||||
.append(" "));
|
||||
sad.setText(SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getSad()).append(" ")
|
||||
.append(String.valueOf(reaction.getConfused()))
|
||||
.append(" "));
|
||||
laugh.setText(SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getLaugh()).append(" ")
|
||||
.append(String.valueOf(reaction.getLaugh()))
|
||||
.append(" "));
|
||||
heart.setText(SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getHeart()).append(" ")
|
||||
.append(String.valueOf(reaction.getHeart())));
|
||||
if (reaction.getPlusOne() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getThumbsUp())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getPlusOne()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getMinusOne() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getThumbsDown())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getMinusOne()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getLaugh() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getLaugh())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getLaugh()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getHooray() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getHooray())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getHooray()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getConfused() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getSad())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getConfused()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getHeart() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getHeart())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getHeart()));
|
||||
}
|
||||
if (spannableBuilder.length() > 0) {
|
||||
reactionsText.setText(spannableBuilder);
|
||||
if (!onToggleView.isCollapsed(getAdapterPosition())) {
|
||||
reactionsText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
reactionsText.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void onToggle(boolean expanded, boolean animate) {
|
||||
if (animate) {
|
||||
TransitionManager.beginDelayedTransition(viewGroup, new ChangeBounds());
|
||||
}
|
||||
toggle.setRotation(!expanded ? 0.0F : 180F);
|
||||
commentOptions.setVisibility(!expanded ? View.GONE : View.VISIBLE);
|
||||
if (!InputHelper.isEmpty(reactionsText)) {
|
||||
reactionsText.setVisibility(!expanded ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void onViewIsDetaching() {
|
||||
DrawableGetter drawableGetter = (DrawableGetter) comment.getTag(R.id.drawable_callback);
|
||||
if (drawableGetter != null) {
|
||||
drawableGetter.clear(drawableGetter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,256 +0,0 @@
|
||||
package com.fastaccess.ui.adapter.viewholder;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.transition.ChangeBounds;
|
||||
import android.support.transition.TransitionManager;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.HorizontalScrollView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.fastaccess.R;
|
||||
import com.fastaccess.data.dao.ReactionsModel;
|
||||
import com.fastaccess.data.dao.timeline.PullRequestTimelineModel;
|
||||
import com.fastaccess.helper.InputHelper;
|
||||
import com.fastaccess.helper.ParseDateFormat;
|
||||
import com.fastaccess.provider.scheme.LinkParserHelper;
|
||||
import com.fastaccess.provider.timeline.CommentsHelper;
|
||||
import com.fastaccess.provider.timeline.HtmlHelper;
|
||||
import com.fastaccess.provider.timeline.handler.drawable.DrawableGetter;
|
||||
import com.fastaccess.ui.adapter.callback.OnToggleView;
|
||||
import com.fastaccess.ui.widgets.AvatarLayout;
|
||||
import com.fastaccess.ui.widgets.FontTextView;
|
||||
import com.fastaccess.ui.widgets.ForegroundImageView;
|
||||
import com.fastaccess.ui.widgets.SpannableBuilder;
|
||||
import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter;
|
||||
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import github.PullRequestTimelineQuery;
|
||||
import github.type.ReactionContent;
|
||||
|
||||
/**
|
||||
* Created by Kosh on 11 Nov 2016, 2:08 PM
|
||||
*/
|
||||
|
||||
public class PullRequestTimelineCommentsViewHolder extends BaseViewHolder<PullRequestTimelineModel> {
|
||||
|
||||
|
||||
@BindView(R.id.avatarView) AvatarLayout avatar;
|
||||
@BindView(R.id.name) FontTextView name;
|
||||
@BindView(R.id.date) FontTextView date;
|
||||
@BindView(R.id.toggle) ForegroundImageView toggle;
|
||||
@BindView(R.id.commentMenu) ForegroundImageView commentMenu;
|
||||
@BindView(R.id.toggleHolder) LinearLayout toggleHolder;
|
||||
@BindView(R.id.thumbsUp) FontTextView thumbsUp;
|
||||
@BindView(R.id.thumbsDown) FontTextView thumbsDown;
|
||||
@BindView(R.id.laugh) FontTextView laugh;
|
||||
@BindView(R.id.hurray) FontTextView hurray;
|
||||
@BindView(R.id.sad) FontTextView sad;
|
||||
@BindView(R.id.heart) FontTextView heart;
|
||||
@BindView(R.id.emojiesList) HorizontalScrollView emojiesList;
|
||||
@BindView(R.id.commentOptions) RelativeLayout commentOptions;
|
||||
@BindView(R.id.comment) FontTextView comment;
|
||||
@BindView(R.id.reactionsText) FontTextView reactionsText;
|
||||
@BindView(R.id.owner) FontTextView owner;
|
||||
private OnToggleView onToggleView;
|
||||
private ViewGroup viewGroup;
|
||||
|
||||
@Override public void onClick(View v) {
|
||||
if (v.getId() == R.id.toggle || v.getId() == R.id.toggleHolder) {
|
||||
if (onToggleView != null) {
|
||||
int position = getAdapterPosition();
|
||||
onToggleView.onToggle(position, !onToggleView.isCollapsed(position));
|
||||
onToggle(onToggleView.isCollapsed(position), true);
|
||||
}
|
||||
} else {
|
||||
addReactionCount(v);
|
||||
super.onClick(v);
|
||||
}
|
||||
}
|
||||
|
||||
private PullRequestTimelineCommentsViewHolder(@NonNull View itemView, @NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter,
|
||||
@NonNull OnToggleView onToggleView) {
|
||||
super(itemView, adapter);
|
||||
this.viewGroup = viewGroup;
|
||||
this.onToggleView = onToggleView;
|
||||
itemView.setOnClickListener(null);
|
||||
itemView.setOnLongClickListener(null);
|
||||
commentMenu.setOnClickListener(this);
|
||||
commentMenu.setOnLongClickListener(this);
|
||||
toggleHolder.setOnClickListener(this);
|
||||
toggle.setOnClickListener(this);
|
||||
laugh.setOnClickListener(this);
|
||||
sad.setOnClickListener(this);
|
||||
thumbsDown.setOnClickListener(this);
|
||||
thumbsUp.setOnClickListener(this);
|
||||
hurray.setOnClickListener(this);
|
||||
laugh.setOnLongClickListener(this);
|
||||
sad.setOnLongClickListener(this);
|
||||
thumbsDown.setOnLongClickListener(this);
|
||||
thumbsUp.setOnLongClickListener(this);
|
||||
hurray.setOnLongClickListener(this);
|
||||
heart.setOnLongClickListener(this);
|
||||
heart.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public static PullRequestTimelineCommentsViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable BaseRecyclerAdapter adapter,
|
||||
@NonNull OnToggleView onToggleView) {
|
||||
return new PullRequestTimelineCommentsViewHolder(getView(viewGroup, R.layout.comments_row_item), viewGroup, adapter, onToggleView);
|
||||
}
|
||||
|
||||
@Override public void bind(@NonNull PullRequestTimelineModel timelineModel) {
|
||||
PullRequestTimelineQuery.AsIssueComment commentsModel = timelineModel.getNode().asIssueComment();
|
||||
if (commentsModel != null) {
|
||||
PullRequestTimelineQuery.Author4 author3 = commentsModel.author();
|
||||
owner.setVisibility(View.VISIBLE);
|
||||
owner.setText("none".equalsIgnoreCase(commentsModel.authorAssociation().name().toLowerCase())
|
||||
? "" : commentsModel.authorAssociation().name().toLowerCase());
|
||||
if (author3 != null) {
|
||||
avatar.setUrl(author3.avatarUrl().toString(), author3.login(),
|
||||
false, LinkParserHelper.isEnterprise(author3.url().toString()));
|
||||
name.setText(author3.login());
|
||||
} else {
|
||||
avatar.setUrl(null, null, false, false);
|
||||
name.setText(null);
|
||||
}
|
||||
if (!InputHelper.isEmpty(commentsModel.bodyHTML())) {
|
||||
String body = commentsModel.bodyHTML().toString();
|
||||
HtmlHelper.htmlIntoTextView(comment, body, viewGroup.getWidth());
|
||||
} else {
|
||||
comment.setText("");
|
||||
}
|
||||
if (commentsModel.createdAt().equals(commentsModel.lastEditedAt())) {
|
||||
date.setText(String.format("%s %s", ParseDateFormat.getTimeAgo(commentsModel.lastEditedAt().toString()), itemView
|
||||
.getResources().getString(R.string.edited)));
|
||||
} else {
|
||||
date.setText(ParseDateFormat.getTimeAgo(commentsModel.createdAt().toString()));
|
||||
}
|
||||
appendEmojies(timelineModel.getReactions());
|
||||
emojiesList.setVisibility(View.VISIBLE);
|
||||
if (onToggleView != null) onToggle(onToggleView.isCollapsed(getAdapterPosition()), false);
|
||||
}
|
||||
}
|
||||
|
||||
private void addReactionCount(View v) {
|
||||
if (adapter != null) {
|
||||
PullRequestTimelineModel timelineModel = (PullRequestTimelineModel) adapter.getItem(getAdapterPosition());
|
||||
if (timelineModel == null) return;
|
||||
List<ReactionsModel> reactions = timelineModel.getReactions();
|
||||
if (reactions != null && !reactions.isEmpty()) {
|
||||
int reactionIndex = getReaction(v.getId(), reactions);
|
||||
if (reactionIndex != -1) {
|
||||
ReactionsModel reaction = reactions.get(reactionIndex);
|
||||
if (!reaction.isViewerHasReacted()) {
|
||||
reaction.setViewerHasReacted(true);
|
||||
reaction.setTotal_count(reaction.getTotal_count() + 1);
|
||||
} else {
|
||||
reaction.setViewerHasReacted(false);
|
||||
reaction.setTotal_count(reaction.getTotal_count() - 1);
|
||||
}
|
||||
reactions.set(reactionIndex, reaction);
|
||||
}
|
||||
appendEmojies(reactions);
|
||||
timelineModel.setReactions(reactions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getReaction(int id, @NonNull List<ReactionsModel> reactionGroup) {
|
||||
for (int i = 0; i < reactionGroup.size(); i++) {
|
||||
ReactionsModel reactionGroup1 = reactionGroup.get(i);
|
||||
if (id == R.id.heart && reactionGroup1.getContent().equalsIgnoreCase(ReactionContent.HEART.name())) {
|
||||
return i;
|
||||
} else if (id == R.id.sad && reactionGroup1.getContent().equalsIgnoreCase(ReactionContent.CONFUSED.name())) {
|
||||
return i;
|
||||
} else if (id == R.id.hurray && reactionGroup1.getContent().equalsIgnoreCase(ReactionContent.HOORAY.name())) {
|
||||
return i;
|
||||
} else if (id == R.id.laugh && reactionGroup1.getContent().equalsIgnoreCase(ReactionContent.LAUGH.name())) {
|
||||
return i;
|
||||
} else if (id == R.id.thumbsDown && reactionGroup1.getContent().equalsIgnoreCase(ReactionContent.THUMBS_DOWN.name())) {
|
||||
return i;
|
||||
} else if (id == R.id.thumbsUp && reactionGroup1.getContent().equalsIgnoreCase(ReactionContent.THUMBS_UP.name())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void appendEmojies(@NonNull List<ReactionsModel> reactions) {
|
||||
reactionsText.setText("");
|
||||
SpannableBuilder spannableBuilder = SpannableBuilder.builder();
|
||||
for (ReactionsModel reaction : reactions) {
|
||||
CharSequence charSequence = null;
|
||||
if (reaction.getContent().equalsIgnoreCase(ReactionContent.THUMBS_UP.name())) {
|
||||
charSequence = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getThumbsUp()).append(" ")
|
||||
.append(String.valueOf(reaction.getTotal_count()))
|
||||
.append(" ");
|
||||
thumbsUp.setText(charSequence);
|
||||
} else if (reaction.getContent().equalsIgnoreCase(ReactionContent.THUMBS_DOWN.name())) {
|
||||
charSequence = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getThumbsDown()).append(" ")
|
||||
.append(String.valueOf(reaction.getTotal_count()))
|
||||
.append(" ");
|
||||
thumbsDown.setText(charSequence);
|
||||
} else if (reaction.getContent().equalsIgnoreCase(ReactionContent.LAUGH.name())) {
|
||||
charSequence = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getLaugh()).append(" ")
|
||||
.append(String.valueOf(reaction.getTotal_count()))
|
||||
.append(" ");
|
||||
laugh.setText(charSequence);
|
||||
} else if (reaction.getContent().equalsIgnoreCase(ReactionContent.HOORAY.name())) {
|
||||
charSequence = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getHooray()).append(" ")
|
||||
.append(String.valueOf(reaction.getTotal_count()))
|
||||
.append(" ");
|
||||
hurray.setText(charSequence);
|
||||
} else if (reaction.getContent().equalsIgnoreCase(ReactionContent.HEART.name())) {
|
||||
charSequence = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getHeart()).append(" ")
|
||||
.append(String.valueOf(reaction.getTotal_count()))
|
||||
.append(" ");
|
||||
heart.setText(charSequence);
|
||||
} else if (reaction.getContent().equalsIgnoreCase(ReactionContent.CONFUSED.name())) {
|
||||
charSequence = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getSad()).append(" ")
|
||||
.append(String.valueOf(reaction.getTotal_count()))
|
||||
.append(" ");
|
||||
sad.setText(charSequence);
|
||||
}
|
||||
if (charSequence != null && reaction.getTotal_count() > 0) {
|
||||
spannableBuilder.append(charSequence);
|
||||
}
|
||||
}
|
||||
if (spannableBuilder.length() > 0) {
|
||||
reactionsText.setText(spannableBuilder);
|
||||
if (!onToggleView.isCollapsed(getAdapterPosition())) {
|
||||
reactionsText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
reactionsText.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void onToggle(boolean expanded, boolean animate) {
|
||||
if (animate) {
|
||||
TransitionManager.beginDelayedTransition(viewGroup, new ChangeBounds());
|
||||
}
|
||||
toggle.setRotation(!expanded ? 0.0F : 180F);
|
||||
commentOptions.setVisibility(!expanded ? View.GONE : View.VISIBLE);
|
||||
if (!InputHelper.isEmpty(reactionsText)) {
|
||||
reactionsText.setVisibility(!expanded ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void onViewIsDetaching() {
|
||||
DrawableGetter drawableGetter = (DrawableGetter) comment.getTag(R.id.drawable_callback);
|
||||
if (drawableGetter != null) {
|
||||
drawableGetter.clear(drawableGetter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,8 +49,14 @@ public class ReviewCommentsViewHolder extends BaseViewHolder<ReviewCommentModel>
|
||||
@BindView(R.id.heart) FontTextView heart;
|
||||
@BindView(R.id.commentMenu) ImageView commentMenu;
|
||||
@BindView(R.id.commentOptions) RelativeLayout commentOptions;
|
||||
@BindView(R.id.reactionsText) FontTextView reactionsText;
|
||||
@BindView(R.id.owner) FontTextView owner;
|
||||
@BindView(R.id.reactionsList) View reactionsList;
|
||||
@BindView(R.id.thumbsUpReaction) FontTextView thumbsUpReaction;
|
||||
@BindView(R.id.thumbsDownReaction) FontTextView thumbsDownReaction;
|
||||
@BindView(R.id.laughReaction) FontTextView laughReaction;
|
||||
@BindView(R.id.hurrayReaction) FontTextView hurrayReaction;
|
||||
@BindView(R.id.sadReaction) FontTextView sadReaction;
|
||||
@BindView(R.id.heartReaction) FontTextView heartReaction;
|
||||
private OnToggleView onToggleView;
|
||||
private ReactionsCallback reactionsCallback;
|
||||
private ViewGroup viewGroup;
|
||||
@ -105,6 +111,18 @@ public class ReviewCommentsViewHolder extends BaseViewHolder<ReviewCommentModel>
|
||||
hurray.setOnLongClickListener(this);
|
||||
heart.setOnLongClickListener(this);
|
||||
heart.setOnClickListener(this);
|
||||
laughReaction.setOnClickListener(this);
|
||||
sadReaction.setOnClickListener(this);
|
||||
thumbsDownReaction.setOnClickListener(this);
|
||||
thumbsUpReaction.setOnClickListener(this);
|
||||
hurrayReaction.setOnClickListener(this);
|
||||
heartReaction.setOnClickListener(this);
|
||||
laughReaction.setOnLongClickListener(this);
|
||||
sadReaction.setOnLongClickListener(this);
|
||||
thumbsDownReaction.setOnLongClickListener(this);
|
||||
thumbsUpReaction.setOnLongClickListener(this);
|
||||
hurrayReaction.setOnLongClickListener(this);
|
||||
heartReaction.setOnLongClickListener(this);
|
||||
}
|
||||
|
||||
public static ReviewCommentsViewHolder newInstance(ViewGroup viewGroup, BaseRecyclerAdapter adapter,
|
||||
@ -142,7 +160,7 @@ public class ReviewCommentsViewHolder extends BaseViewHolder<ReviewCommentModel>
|
||||
date.setText(ParseDateFormat.getTimeAgo(commentModel.getCreatedAt()));
|
||||
if (!InputHelper.isEmpty(commentModel.getBodyHtml())) {
|
||||
int width = adapter != null ? adapter.getRowWidth() : 0;
|
||||
HtmlHelper.htmlIntoTextView(comment, commentModel.getBodyHtml(), width > 0 ? width : viewGroup.getWidth());
|
||||
HtmlHelper.htmlIntoTextView(comment, commentModel.getBodyHtml(), width > 0 ? width : viewGroup.getWidth());
|
||||
} else {
|
||||
comment.setText("");
|
||||
}
|
||||
@ -161,21 +179,27 @@ public class ReviewCommentsViewHolder extends BaseViewHolder<ReviewCommentModel>
|
||||
ReactionsModel reactionsModel = comment.getReactions() != null ? comment.getReactions() : new ReactionsModel();
|
||||
switch (v.getId()) {
|
||||
case R.id.heart:
|
||||
case R.id.heartReaction:
|
||||
reactionsModel.setHeart(!isReacted ? reactionsModel.getHeart() + 1 : reactionsModel.getHeart() - 1);
|
||||
break;
|
||||
case R.id.sad:
|
||||
case R.id.sadReaction:
|
||||
reactionsModel.setConfused(!isReacted ? reactionsModel.getConfused() + 1 : reactionsModel.getConfused() - 1);
|
||||
break;
|
||||
case R.id.thumbsDown:
|
||||
case R.id.thumbsDownReaction:
|
||||
reactionsModel.setMinusOne(!isReacted ? reactionsModel.getMinusOne() + 1 : reactionsModel.getMinusOne() - 1);
|
||||
break;
|
||||
case R.id.thumbsUp:
|
||||
case R.id.thumbsUpReaction:
|
||||
reactionsModel.setPlusOne(!isReacted ? reactionsModel.getPlusOne() + 1 : reactionsModel.getPlusOne() - 1);
|
||||
break;
|
||||
case R.id.laugh:
|
||||
case R.id.laughReaction:
|
||||
reactionsModel.setLaugh(!isReacted ? reactionsModel.getLaugh() + 1 : reactionsModel.getLaugh() - 1);
|
||||
break;
|
||||
case R.id.hurray:
|
||||
case R.id.hurrayReaction:
|
||||
reactionsModel.setHooray(!isReacted ? reactionsModel.getHooray() + 1 : reactionsModel.getHooray() - 1);
|
||||
break;
|
||||
}
|
||||
@ -186,73 +210,49 @@ public class ReviewCommentsViewHolder extends BaseViewHolder<ReviewCommentModel>
|
||||
}
|
||||
|
||||
private void appendEmojies(ReactionsModel reaction) {
|
||||
SpannableBuilder spannableBuilder = SpannableBuilder.builder();
|
||||
reactionsText.setText("");
|
||||
thumbsUp.setText(SpannableBuilder.builder()
|
||||
SpannableBuilder spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getThumbsUp()).append(" ")
|
||||
.append(String.valueOf(reaction.getPlusOne()))
|
||||
.append(" "));
|
||||
thumbsDown.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
thumbsUp.setText(spannableBuilder);
|
||||
thumbsUpReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getThumbsDown()).append(" ")
|
||||
.append(String.valueOf(reaction.getMinusOne()))
|
||||
.append(" "));
|
||||
hurray.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
thumbsDown.setText(spannableBuilder);
|
||||
thumbsDownReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getHooray()).append(" ")
|
||||
.append(String.valueOf(reaction.getHooray()))
|
||||
.append(" "));
|
||||
sad.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
hurray.setText(spannableBuilder);
|
||||
hurrayReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getSad()).append(" ")
|
||||
.append(String.valueOf(reaction.getConfused()))
|
||||
.append(" "));
|
||||
laugh.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
sad.setText(spannableBuilder);
|
||||
sadReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getLaugh()).append(" ")
|
||||
.append(String.valueOf(reaction.getLaugh()))
|
||||
.append(" "));
|
||||
heart.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
laugh.setText(spannableBuilder);
|
||||
laughReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getHeart()).append(" ")
|
||||
.append(String.valueOf(reaction.getHeart())));
|
||||
if (reaction.getPlusOne() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getThumbsUp())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getPlusOne()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getMinusOne() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getThumbsDown())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getMinusOne()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getLaugh() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getLaugh())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getLaugh()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getHooray() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getHooray())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getHooray()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getConfused() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getSad())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getConfused()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getHeart() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getHeart())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getHeart()));
|
||||
}
|
||||
if (spannableBuilder.length() > 0) {
|
||||
reactionsText.setText(spannableBuilder);
|
||||
if (!onToggleView.isCollapsed(getId())) {
|
||||
reactionsText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
.append(String.valueOf(reaction.getHeart()));
|
||||
heart.setText(spannableBuilder);
|
||||
heartReaction.setText(spannableBuilder);
|
||||
if (reaction.getPlusOne() > 0 || reaction.getMinusOne() > 0
|
||||
|| reaction.getLaugh() > 0 || reaction.getHooray() > 0
|
||||
|| reaction.getConfused() > 0 || reaction.getHeart() > 0) {
|
||||
reactionsList.setVisibility(View.VISIBLE);
|
||||
reactionsList.setTag(true);
|
||||
} else {
|
||||
reactionsText.setVisibility(View.GONE);
|
||||
reactionsList.setVisibility(View.GONE);
|
||||
reactionsList.setTag(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,9 +270,9 @@ public class ReviewCommentsViewHolder extends BaseViewHolder<ReviewCommentModel>
|
||||
}
|
||||
toggle.setRotation(!expanded ? 0.0F : 180F);
|
||||
commentOptions.setVisibility(!expanded ? View.GONE : View.VISIBLE);
|
||||
if (!InputHelper.isEmpty(reactionsText)) {
|
||||
reactionsText.setVisibility(!expanded ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
reactionsList.setVisibility(expanded ? View.GONE : View.VISIBLE);
|
||||
reactionsList.setVisibility(expanded ? View.GONE : reactionsList.getTag() == null || (!((Boolean) reactionsList.getTag()))
|
||||
? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override protected void onViewIsDetaching() {
|
||||
|
||||
@ -56,9 +56,15 @@ public class TimelineCommentsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
@BindView(R.id.emojiesList) HorizontalScrollView emojiesList;
|
||||
@BindView(R.id.commentOptions) RelativeLayout commentOptions;
|
||||
@BindView(R.id.comment) FontTextView comment;
|
||||
@BindView(R.id.reactionsText) FontTextView reactionsText;
|
||||
@BindView(R.id.owner) FontTextView owner;
|
||||
@BindView(R.id.pathText) FontTextView pathText;
|
||||
@BindView(R.id.reactionsList) View reactionsList;
|
||||
@BindView(R.id.thumbsUpReaction) FontTextView thumbsUpReaction;
|
||||
@BindView(R.id.thumbsDownReaction) FontTextView thumbsDownReaction;
|
||||
@BindView(R.id.laughReaction) FontTextView laughReaction;
|
||||
@BindView(R.id.hurrayReaction) FontTextView hurrayReaction;
|
||||
@BindView(R.id.sadReaction) FontTextView sadReaction;
|
||||
@BindView(R.id.heartReaction) FontTextView heartReaction;
|
||||
private OnToggleView onToggleView;
|
||||
private boolean showEmojies;
|
||||
private ReactionsCallback reactionsCallback;
|
||||
@ -74,8 +80,8 @@ public class TimelineCommentsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
onToggle(onToggleView.isCollapsed(position), true);
|
||||
}
|
||||
} else {
|
||||
addReactionCount(v);
|
||||
super.onClick(v);
|
||||
addReactionCount(v);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,13 +115,25 @@ public class TimelineCommentsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
thumbsDown.setOnClickListener(this);
|
||||
thumbsUp.setOnClickListener(this);
|
||||
hurray.setOnClickListener(this);
|
||||
heart.setOnClickListener(this);
|
||||
laugh.setOnLongClickListener(this);
|
||||
sad.setOnLongClickListener(this);
|
||||
thumbsDown.setOnLongClickListener(this);
|
||||
thumbsUp.setOnLongClickListener(this);
|
||||
hurray.setOnLongClickListener(this);
|
||||
heart.setOnLongClickListener(this);
|
||||
heart.setOnClickListener(this);
|
||||
laughReaction.setOnClickListener(this);
|
||||
sadReaction.setOnClickListener(this);
|
||||
thumbsDownReaction.setOnClickListener(this);
|
||||
thumbsUpReaction.setOnClickListener(this);
|
||||
hurrayReaction.setOnClickListener(this);
|
||||
heartReaction.setOnClickListener(this);
|
||||
laughReaction.setOnLongClickListener(this);
|
||||
sadReaction.setOnLongClickListener(this);
|
||||
thumbsDownReaction.setOnLongClickListener(this);
|
||||
thumbsUpReaction.setOnLongClickListener(this);
|
||||
hurrayReaction.setOnLongClickListener(this);
|
||||
heartReaction.setOnLongClickListener(this);
|
||||
}
|
||||
|
||||
public static TimelineCommentsViewHolder newInstance(@NonNull ViewGroup viewGroup, @Nullable IssuesTimelineAdapter adapter,
|
||||
@ -197,21 +215,27 @@ public class TimelineCommentsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
ReactionsModel reactionsModel = comment.getReactions() != null ? comment.getReactions() : new ReactionsModel();
|
||||
switch (v.getId()) {
|
||||
case R.id.heart:
|
||||
case R.id.heartReaction:
|
||||
reactionsModel.setHeart(!isReacted ? reactionsModel.getHeart() + 1 : reactionsModel.getHeart() - 1);
|
||||
break;
|
||||
case R.id.sad:
|
||||
case R.id.sadReaction:
|
||||
reactionsModel.setConfused(!isReacted ? reactionsModel.getConfused() + 1 : reactionsModel.getConfused() - 1);
|
||||
break;
|
||||
case R.id.thumbsDown:
|
||||
case R.id.thumbsDownReaction:
|
||||
reactionsModel.setMinusOne(!isReacted ? reactionsModel.getMinusOne() + 1 : reactionsModel.getMinusOne() - 1);
|
||||
break;
|
||||
case R.id.thumbsUp:
|
||||
case R.id.thumbsUpReaction:
|
||||
reactionsModel.setPlusOne(!isReacted ? reactionsModel.getPlusOne() + 1 : reactionsModel.getPlusOne() - 1);
|
||||
break;
|
||||
case R.id.laugh:
|
||||
case R.id.laughReaction:
|
||||
reactionsModel.setLaugh(!isReacted ? reactionsModel.getLaugh() + 1 : reactionsModel.getLaugh() - 1);
|
||||
break;
|
||||
case R.id.hurray:
|
||||
case R.id.hurrayReaction:
|
||||
reactionsModel.setHooray(!isReacted ? reactionsModel.getHooray() + 1 : reactionsModel.getHooray() - 1);
|
||||
break;
|
||||
}
|
||||
@ -223,73 +247,49 @@ public class TimelineCommentsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
}
|
||||
|
||||
private void appendEmojies(ReactionsModel reaction) {
|
||||
SpannableBuilder spannableBuilder = SpannableBuilder.builder();
|
||||
reactionsText.setText("");
|
||||
thumbsUp.setText(SpannableBuilder.builder()
|
||||
SpannableBuilder spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getThumbsUp()).append(" ")
|
||||
.append(String.valueOf(reaction.getPlusOne()))
|
||||
.append(" "));
|
||||
thumbsDown.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
thumbsUp.setText(spannableBuilder);
|
||||
thumbsUpReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getThumbsDown()).append(" ")
|
||||
.append(String.valueOf(reaction.getMinusOne()))
|
||||
.append(" "));
|
||||
hurray.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
thumbsDown.setText(spannableBuilder);
|
||||
thumbsDownReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getHooray()).append(" ")
|
||||
.append(String.valueOf(reaction.getHooray()))
|
||||
.append(" "));
|
||||
sad.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
hurray.setText(spannableBuilder);
|
||||
hurrayReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getSad()).append(" ")
|
||||
.append(String.valueOf(reaction.getConfused()))
|
||||
.append(" "));
|
||||
laugh.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
sad.setText(spannableBuilder);
|
||||
sadReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getLaugh()).append(" ")
|
||||
.append(String.valueOf(reaction.getLaugh()))
|
||||
.append(" "));
|
||||
heart.setText(SpannableBuilder.builder()
|
||||
.append(" ");
|
||||
laugh.setText(spannableBuilder);
|
||||
laughReaction.setText(spannableBuilder);
|
||||
spannableBuilder = SpannableBuilder.builder()
|
||||
.append(CommentsHelper.getHeart()).append(" ")
|
||||
.append(String.valueOf(reaction.getHeart())));
|
||||
if (reaction.getPlusOne() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getThumbsUp())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getPlusOne()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getMinusOne() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getThumbsDown())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getMinusOne()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getLaugh() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getLaugh())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getLaugh()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getHooray() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getHooray())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getHooray()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getConfused() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getSad())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getConfused()))
|
||||
.append(" ");
|
||||
}
|
||||
if (reaction.getHeart() > 0) {
|
||||
spannableBuilder.append(CommentsHelper.getHeart())
|
||||
.append(" ")
|
||||
.append(String.valueOf(reaction.getHeart()));
|
||||
}
|
||||
if (spannableBuilder.length() > 0) {
|
||||
reactionsText.setText(spannableBuilder);
|
||||
if (!onToggleView.isCollapsed(getAdapterPosition())) {
|
||||
reactionsText.setVisibility(View.VISIBLE);
|
||||
}
|
||||
.append(String.valueOf(reaction.getHeart()));
|
||||
heart.setText(spannableBuilder);
|
||||
heartReaction.setText(spannableBuilder);
|
||||
if (reaction.getPlusOne() > 0 || reaction.getMinusOne() > 0
|
||||
|| reaction.getLaugh() > 0 || reaction.getHooray() > 0
|
||||
|| reaction.getConfused() > 0 || reaction.getHeart() > 0) {
|
||||
reactionsList.setVisibility(View.VISIBLE);
|
||||
reactionsList.setTag(true);
|
||||
} else {
|
||||
reactionsText.setVisibility(View.GONE);
|
||||
reactionsList.setVisibility(View.GONE);
|
||||
reactionsList.setTag(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,9 +299,9 @@ public class TimelineCommentsViewHolder extends BaseViewHolder<TimelineModel> {
|
||||
}
|
||||
toggle.setRotation(!expanded ? 0.0F : 180F);
|
||||
commentOptions.setVisibility(!expanded ? View.GONE : View.VISIBLE);
|
||||
if (!InputHelper.isEmpty(reactionsText)) {
|
||||
reactionsText.setVisibility(!expanded ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
reactionsList.setVisibility(expanded ? View.GONE : View.VISIBLE);
|
||||
reactionsList.setVisibility(expanded ? View.GONE : reactionsList.getTag() == null || (!((Boolean) reactionsList.getTag()))
|
||||
? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override protected void onViewIsDetaching() {
|
||||
|
||||
@ -127,19 +127,87 @@
|
||||
android:paddingTop="@dimen/spacing_micro"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/reactionsText"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="match_parent"
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/reactionsList"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_micro"
|
||||
android:gravity="start"
|
||||
android:paddingEnd="@dimen/spacing_xs_large"
|
||||
android:paddingStart="@dimen/spacing_xs_large"
|
||||
android:visibility="gone"
|
||||
tools:ignore="RtlSymmetry"
|
||||
tools:text="U+1F602"
|
||||
tools:visibility="visible"/>
|
||||
android:layout_gravity="center"
|
||||
android:paddingBottom="@dimen/spacing_normal"
|
||||
android:paddingTop="@dimen/spacing_normal"
|
||||
android:scrollbarStyle="insideOverlay"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/thumbsUpReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/thumbsDownReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/laughReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/hurrayReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/sadReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/heartReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@ -121,19 +121,90 @@
|
||||
android:layout_marginTop="@dimen/spacing_micro"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/reactionsText"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="match_parent"
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/reactionsList"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:layout_marginStart="@dimen/avatar_margin"
|
||||
android:layout_marginTop="@dimen/spacing_micro"
|
||||
android:gravity="start"
|
||||
android:visibility="gone"
|
||||
tools:ignore="RtlSymmetry"
|
||||
tools:text="U+1F602"
|
||||
tools:visibility="visible"/>
|
||||
android:paddingBottom="@dimen/spacing_normal"
|
||||
android:paddingTop="@dimen/spacing_normal"
|
||||
android:scrollbarStyle="insideOverlay"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/thumbsUpReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/thumbsDownReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/laughReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/hurrayReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/sadReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/heartReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.fastaccess.ui.widgets.ForegroundRelativeLayout>
|
||||
|
||||
@ -113,20 +113,90 @@
|
||||
android:textIsSelectable="true"
|
||||
tools:text="Hello World"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/reactionsText"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="match_parent"
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/reactionsList"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_xs_large"
|
||||
android:layout_marginStart="@dimen/avatar_margin"
|
||||
android:layout_marginTop="@dimen/spacing_micro"
|
||||
android:gravity="start"
|
||||
android:paddingEnd="@dimen/spacing_xs_large"
|
||||
android:visibility="gone"
|
||||
tools:ignore="RtlSymmetry"
|
||||
tools:text="U+1F602"
|
||||
tools:visibility="visible"/>
|
||||
android:paddingBottom="@dimen/spacing_normal"
|
||||
android:paddingTop="@dimen/spacing_normal"
|
||||
android:scrollbarStyle="insideOverlay"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/thumbsUpReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/thumbsDownReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/laughReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/hurrayReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/sadReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/spacing_micro"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
<com.fastaccess.ui.widgets.FontTextView
|
||||
android:id="@+id/heartReaction"
|
||||
style="@style/TextAppearance.AppCompat.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?android:selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
tools:text="100"/>
|
||||
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.fastaccess.ui.widgets.ForegroundRelativeLayout>
|
||||
Loading…
x
Reference in New Issue
Block a user