From 2f7c6e734e4c202bc4127f8631aaf7da8aaef50c Mon Sep 17 00:00:00 2001 From: aayush262 Date: Tue, 27 Feb 2024 23:24:59 +0530 Subject: [PATCH] feat(comments): UI tweaks fix(comments): top padding fix: removed self report feat: better colors in color picker --- .../dantotsu/media/comments/CommentItem.kt | 6 +- .../media/comments/CommentsFragment.kt | 2 +- .../ani/dantotsu/settings/SettingsActivity.kt | 2 +- .../main/res/layout/activity_extensions.xml | 200 ++++++++---------- app/src/main/res/layout/fragment_comments.xml | 44 ++-- app/src/main/res/layout/item_comments.xml | 107 ++++++---- app/src/main/res/values-night/colors.xml | 1 + app/src/main/res/values/colors.xml | 1 + 8 files changed, 179 insertions(+), 184 deletions(-) diff --git a/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt b/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt index 645458cbf5d..6842e9247a6 100644 --- a/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt +++ b/app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt @@ -59,6 +59,7 @@ class CommentItem(val comment: Comment, markwon.setParsedMarkdown(viewBinding.commentText, viewBinding.commentText.setSpoilerText(spanned, markwon)) viewBinding.commentDelete.visibility = if (isUserComment || CommentsAPI.isAdmin || CommentsAPI.isMod) View.VISIBLE else View.GONE viewBinding.commentBanUser.visibility = if ((CommentsAPI.isAdmin || CommentsAPI.isMod) && !isUserComment) View.VISIBLE else View.GONE + viewBinding.commentReport.visibility = if (!isUserComment) View.VISIBLE else View.GONE viewBinding.commentEdit.visibility = if (isUserComment) View.VISIBLE else View.GONE if (comment.tag == null) { viewBinding.commentUserTagLayout.visibility = View.GONE @@ -189,10 +190,9 @@ class CommentItem(val comment: Comment, comment.profilePictureUrl?.let { viewBinding.commentUserAvatar.loadImage(it) } viewBinding.commentUserName.text = comment.username val levelColor = getAvatarColor(comment.totalVotes, backgroundColor) - viewBinding.commentUserName.setTextColor(levelColor.first) - viewBinding.commentUserLevel.text = "Lv. ${levelColor.second}" + viewBinding.commentUserLevel.text = "[${levelColor.second}]" viewBinding.commentUserLevel.setTextColor(levelColor.first) - viewBinding.commentUserTime.text = "● ${formatTimestamp(comment.timestamp)}" + viewBinding.commentUserTime.text = formatTimestamp(comment.timestamp) } override fun getLayout(): Int { diff --git a/app/src/main/java/ani/dantotsu/media/comments/CommentsFragment.kt b/app/src/main/java/ani/dantotsu/media/comments/CommentsFragment.kt index 9b5fe5f92f9..3759ed7846c 100644 --- a/app/src/main/java/ani/dantotsu/media/comments/CommentsFragment.kt +++ b/app/src/main/java/ani/dantotsu/media/comments/CommentsFragment.kt @@ -159,7 +159,7 @@ class CommentsFragment : Fragment() { } binding.commentFilter.setOnClickListener { - val alertDialog = android.app.AlertDialog.Builder(activity, R.style.MyPopup) + val alertDialog = AlertDialog.Builder(activity, R.style.MyPopup) .setTitle("Enter a chapter/episode number tag") .setView(R.layout.dialog_edittext) .setPositiveButton("OK") { dialog, _ -> diff --git a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt index b9aed382207..5a6be7ea85d 100644 --- a/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt +++ b/app/src/main/java/ani/dantotsu/settings/SettingsActivity.kt @@ -225,7 +225,7 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene val tag = "colorPicker" CustomColorDialog().title("Custom Theme") .colorPreset(originalColor) - .colors(this, SimpleColorDialog.BEIGE_COLOR_PALLET) + .colors(this, SimpleColorDialog.MATERIAL_COLOR_PALLET) .allowCustom(true) .showOutline(0x46000000) .gridNumColumn(5) diff --git a/app/src/main/res/layout/activity_extensions.xml b/app/src/main/res/layout/activity_extensions.xml index dcb67be60eb..7daa063ac0f 100644 --- a/app/src/main/res/layout/activity_extensions.xml +++ b/app/src/main/res/layout/activity_extensions.xml @@ -2,132 +2,110 @@ + android:layout_height="wrap_content" + android:orientation="horizontal"> - - - - - + app:cardBackgroundColor="@color/nav_bg_inv" + app:cardCornerRadius="16dp" + app:cardElevation="0dp"> - + - - - - - - + - + - + - + - + - + + - + + + - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_comments.xml b/app/src/main/res/layout/fragment_comments.xml index dbfdb6a7153..1194b9070bc 100644 --- a/app/src/main/res/layout/fragment_comments.xml +++ b/app/src/main/res/layout/fragment_comments.xml @@ -5,15 +5,14 @@ android:id="@+id/commentsLayout" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?android:colorBackground" - android:fitsSystemWindows="true"> + android:background="?android:colorBackground"> @@ -41,8 +40,8 @@ + android:paddingBottom="8dp"> + android:layout_marginEnd="8dp" + android:visibility="gone" + tools:visibility="visible" + tools:ignore="ContentDescription" /> + tools:visibility="visible" /> diff --git a/app/src/main/res/layout/item_comments.xml b/app/src/main/res/layout/item_comments.xml index 86cfe1740cf..f48b1dceeb2 100644 --- a/app/src/main/res/layout/item_comments.xml +++ b/app/src/main/res/layout/item_comments.xml @@ -5,70 +5,65 @@ android:id="@+id/commentsCardView" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="6dp" android:orientation="vertical"> + android:orientation="horizontal" + android:baselineAligned="false"> - - + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical"> - + android:layout_marginTop="12dp" + android:scaleType="center" + app:srcCompat="@drawable/ic_round_add_circle_24" + tools:ignore="ContentDescription,ImageContrastCheck" /> + + android:orientation="horizontal" + android:layout_gravity="center" + tools:ignore="UseCompoundDrawables"> + android:src="@drawable/ic_label_24" + android:alpha="0.9" + tools:ignore="ContentDescription" + app:tint="?attr/colorPrimary" /> + tools:ignore="HardcodedText,SmallSp"/> @@ -91,7 +86,8 @@ android:id="@+id/commentUserName" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="6dp" + android:layout_marginEnd="4dp" + android:textColor="?attr/colorPrimary" android:fontFamily="@font/poppins_semi_bold" android:text="Username" android:singleLine="true" @@ -101,6 +97,27 @@ android:paddingBottom="0dp" tools:ignore="HardcodedText,RtlSymmetry"/> + + + + @@ -234,15 +252,15 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="@font/poppins_semi_bold" - android:text="10" + android:text="100" android:textSize="12sp" android:layout_gravity="center" android:alpha="0.6" tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index c565ebf10c3..7655276b3fd 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -13,4 +13,5 @@ #b3aead #F9222222 #6347D4 + #8B2AFA \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 3c7e4f17b45..ce4aa41894d 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -33,6 +33,7 @@ #FF81D4FA #FF039BE5 #FF01579B + #5E057E #00658e