diff --git a/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java b/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java index 3c2db29..9fa3fa1 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java +++ b/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java @@ -67,6 +67,9 @@ import es.dmoral.toasty.Toasty; import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE; import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.REPLY; +import static app.fedilab.fedilabtube.helper.CommentDecorationHelper.allDecoration; +import static app.fedilab.fedilabtube.helper.CommentDecorationHelper.hideDecoration; +import static app.fedilab.fedilabtube.helper.CommentDecorationHelper.topDecorationOnly; public class CommentListAdapter extends RecyclerView.Adapter { @@ -108,6 +111,7 @@ public class CommentListAdapter extends RecyclerView.Adapter { PopupMenu popup = new PopupMenu(context, holder.binding.moreActions); popup.getMenuInflater() diff --git a/app/src/main/java/app/fedilab/fedilabtube/helper/CommentDecorationHelper.java b/app/src/main/java/app/fedilab/fedilabtube/helper/CommentDecorationHelper.java index f308f7c..264506d 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/helper/CommentDecorationHelper.java +++ b/app/src/main/java/app/fedilab/fedilabtube/helper/CommentDecorationHelper.java @@ -14,9 +14,12 @@ package app.fedilab.fedilabtube.helper; * You should have received a copy of the GNU General Public License along with TubeLab; if not, * see . */ +import android.view.View; + import java.util.List; import app.fedilab.fedilabtube.client.data.CommentData; +import app.fedilab.fedilabtube.databinding.DrawerCommentBinding; public class CommentDecorationHelper { @@ -40,4 +43,37 @@ public class CommentDecorationHelper { return Math.min(currentIdentation, 5); } } + + public static void topDecorationOnly(DrawerCommentBinding binding) { + binding.decorationTop.setVisibility(View.VISIBLE); + binding.decorationCurvedTop.setVisibility(View.VISIBLE); + binding.decorationCurvedBottom.setVisibility(View.GONE); + binding.decorationCurvedLine.setVisibility(View.VISIBLE); + binding.decorationBottom.setVisibility(View.GONE); + } + + public static void allDecoration(DrawerCommentBinding binding) { + binding.decorationTop.setVisibility(View.VISIBLE); + binding.decorationCurvedTop.setVisibility(View.VISIBLE); + binding.decorationCurvedBottom.setVisibility(View.VISIBLE); + binding.decorationCurvedLine.setVisibility(View.VISIBLE); + binding.decorationBottom.setVisibility(View.VISIBLE); + } + + public static void hideDecoration(DrawerCommentBinding binding) { + binding.decorationTop.setVisibility(View.GONE); + binding.decorationCurvedTop.setVisibility(View.GONE); + binding.decorationCurvedBottom.setVisibility(View.GONE); + binding.decorationCurvedLine.setVisibility(View.GONE); + binding.decorationBottom.setVisibility(View.GONE); + } + + public static boolean hasReplies(String commentId, List comments) { + for (CommentData.Comment comment : comments) { + if (comment.getInReplyToCommentId() != null && commentId.compareTo(comment.getInReplyToCommentId()) == 0) { + return true; + } + } + return false; + } } diff --git a/app/src/main/res/drawable/rounded_decoration.xml b/app/src/main/res/drawable/rounded_decoration.xml deleted file mode 100644 index 26dbb27..0000000 --- a/app/src/main/res/drawable/rounded_decoration.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_decoration_bottom.xml b/app/src/main/res/drawable/rounded_decoration_bottom.xml new file mode 100644 index 0000000..2113fe3 --- /dev/null +++ b/app/src/main/res/drawable/rounded_decoration_bottom.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_decoration_2.xml b/app/src/main/res/drawable/rounded_decoration_top.xml similarity index 90% rename from app/src/main/res/drawable/rounded_decoration_2.xml rename to app/src/main/res/drawable/rounded_decoration_top.xml index 504273d..582675b 100644 --- a/app/src/main/res/drawable/rounded_decoration_2.xml +++ b/app/src/main/res/drawable/rounded_decoration_top.xml @@ -11,8 +11,8 @@ + android:bottom="1.5dp" + android:left="1.5dp"> + android:orientation="horizontal" + tools:ignore="UseCompoundDrawables"> - - - - - - - - - - - - - - - - - - - - - -