mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2026-01-25 14:47:05 +00:00
displaying reviews comments without replies!
This commit is contained in:
parent
fd7b6063d6
commit
caf8bb32d4
@ -5,8 +5,6 @@ import android.os.Parcelable;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -27,7 +25,7 @@ import lombok.Setter;
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
CommentRequestModel that = (CommentRequestModel) o;
|
||||
return Objects.equals(position, that.position) && (path != null ? path.equals(that.path) : that.path == null);
|
||||
return position == that.position && (path != null ? path.equals(that.path) : that.path == null);
|
||||
}
|
||||
|
||||
@Override public int hashCode() {
|
||||
|
||||
@ -4,6 +4,7 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.fastaccess.data.dao.ReactionsModel;
|
||||
import com.fastaccess.helper.Logger;
|
||||
import com.fastaccess.helper.ParseDateFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -60,6 +61,7 @@ public class PullRequestReviewModel {
|
||||
comments.add(comment);
|
||||
}
|
||||
}
|
||||
Logger.e(comments.size());
|
||||
model.comments = comments;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -13,15 +13,13 @@ import com.fastaccess.data.dao.ReactionsModel
|
||||
import com.fastaccess.data.dao.timeline.PullRequestReviewModel
|
||||
import com.fastaccess.helper.InputHelper
|
||||
import com.fastaccess.helper.ParseDateFormat
|
||||
import com.fastaccess.helper.ViewHelper
|
||||
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.*
|
||||
import com.fastaccess.ui.widgets.recyclerview.BaseRecyclerAdapter
|
||||
import com.fastaccess.ui.widgets.recyclerview.BaseViewHolder
|
||||
import pr.type.ReactionContent
|
||||
@ -33,6 +31,8 @@ class ReviewCommentsViewHolder private constructor(view: View, adapter: BaseRecy
|
||||
val viewGroup: ViewGroup, val onToggleView: OnToggleView)
|
||||
: BaseViewHolder<PullRequestReviewModel>(view, adapter) {
|
||||
|
||||
|
||||
|
||||
init {
|
||||
itemView.setOnClickListener(null)
|
||||
itemView.setOnLongClickListener(null)
|
||||
@ -71,6 +71,7 @@ class ReviewCommentsViewHolder private constructor(view: View, adapter: BaseRecy
|
||||
@BindView(R.id.comment) lateinit var comment: FontTextView
|
||||
@BindView(R.id.reactionsText) lateinit var reactionsText: FontTextView
|
||||
@BindView(R.id.owner) lateinit var owner: FontTextView
|
||||
@BindView(R.id.pathText) lateinit var pathText: FontTextView
|
||||
|
||||
override fun onClick(v: View) {
|
||||
if (v.id == R.id.toggle || v.id == R.id.toggleHolder) {
|
||||
@ -86,6 +87,11 @@ class ReviewCommentsViewHolder private constructor(view: View, adapter: BaseRecy
|
||||
override fun bind(t: PullRequestReviewModel) {
|
||||
val commentsModel = t.node
|
||||
val author3 = commentsModel.author()
|
||||
pathText.visibility = View.VISIBLE
|
||||
pathText.text = DiffLineSpan.getSpannable(commentsModel.diffHunk(),
|
||||
ViewHelper.getPatchAdditionColor(itemView.context),
|
||||
ViewHelper.getPatchDeletionColor(itemView.context),
|
||||
ViewHelper.getPatchRefColor(itemView.context), true)
|
||||
owner.visibility = View.VISIBLE
|
||||
owner.text = if ("none".equals(commentsModel.authorAssociation().name.toLowerCase(), ignoreCase = true)) ""
|
||||
else commentsModel.authorAssociation().name.toLowerCase()
|
||||
|
||||
@ -71,7 +71,7 @@ public class DiffLineSpan extends MetricAffectingSpan implements LineBackgroundS
|
||||
int lines = split.length;
|
||||
int index = -1;
|
||||
for (int i = 0; i < lines; i++) {
|
||||
if (truncate && (lines - i) > 3) continue;
|
||||
if (truncate && (lines - i) > 2) continue;
|
||||
String token = split[i];
|
||||
if (i < (lines - 1)) {
|
||||
token = token.concat("\n");
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_marginBottom="@dimen/spacing_normal"
|
||||
android:layout_marginEnd="@dimen/layout_margin"
|
||||
android:layout_marginStart="@dimen/layout_margin"
|
||||
@ -100,7 +101,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/reviewHolder"
|
||||
android:layout_marginBottom="@dimen/spacing_normal"
|
||||
app:layoutManager="@string/linear_layout_manager"
|
||||
android:layout_marginBottom="@dimen/spacing_micro"
|
||||
android:layout_marginTop="@dimen/spacing_micro"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user