feat(comments): UI tweaks

fix(comments): top padding
fix: removed self report
feat: better colors in color picker
This commit is contained in:
aayush262 2024-02-27 23:24:59 +05:30
parent efe5f546a2
commit 2f7c6e734e
8 changed files with 188 additions and 193 deletions

View file

@ -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 {

View file

@ -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, _ ->

View file

@ -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)

View file

@ -2,132 +2,110 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/settingsContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".settings.SettingsActivity">
<LinearLayout
android:id="@+id/settingsContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/nav_bg_inv"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/extensions"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_weight="1"
android:fontFamily="@font/poppins_bold"
android:gravity="center_vertical"
android:text="@string/extensions"
android:textColor="?attr/colorPrimary"
android:textSize="16sp" />
<ImageButton
android:id="@+id/languageselect"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/sort_by"
app:srcCompat="@drawable/ic_round_translate_24"
app:tint="?attr/colorOnBackground" />
</LinearLayout>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="48dp"
app:tabContentStart="32dp"
app:tabGravity="fill"
app:tabMode="scrollable"
app:tabPaddingEnd="16dp"
app:tabPaddingStart="16dp"
app:tabTextAppearance="@style/NavBarText" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<FrameLayout
android:id="@+id/fragmentExtensionsContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_gravity="bottom"
android:layout_weight="1"
android:visibility="gone">
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/searchView"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_gravity="bottom"
android:transitionName="@string/search"
app:boxBackgroundColor="@color/bg"
app:boxBackgroundMode="outline"
app:boxCornerRadiusBottomEnd="28dp"
app:boxCornerRadiusBottomStart="28dp"
app:boxCornerRadiusTopEnd="28dp"
app:boxCornerRadiusTopStart="28dp"
app:endIconDrawable="@drawable/ic_round_search_24"
app:hintAnimationEnabled="true">
<AutoCompleteTextView
android:id="@+id/searchViewText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="bottom"
android:layout_marginBottom="12dp"
android:fontFamily="@font/poppins_bold"
android:imeOptions="actionSearch"
android:inputType="textPersonName"
android:hint="@string/search"
android:padding="8dp"
android:selectAllOnFocus="true"
android:textSize="14sp"
tools:ignore="LabelFor,TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/nav_bg_inv"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/extensions"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:fontFamily="@font/poppins_bold"
android:gravity="center"
android:text="@string/extensions"
android:textColor="?attr/colorPrimary"
android:textSize="16sp" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageButton
android:id="@+id/languageselect"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/sort_by"
app:srcCompat="@drawable/ic_round_translate_24"
app:tint="?attr/colorOnBackground" />
</LinearLayout>
<LinearLayout
android:id="@+id/extensionsHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables"></LinearLayout>
</LinearLayout>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="48dp"
app:tabContentStart="32dp"
app:tabGravity="fill"
app:tabMode="scrollable"
app:tabPaddingEnd="16dp"
app:tabPaddingStart="16dp"
app:tabTextAppearance="@style/NavBarText" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<FrameLayout
android:id="@+id/fragmentExtensionsContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_weight="1"
android:visibility="gone"></FrameLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/searchView"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_gravity="bottom"
android:transitionName="@string/search"
app:boxBackgroundColor="@color/bg"
app:boxBackgroundMode="outline"
app:boxCornerRadiusBottomEnd="28dp"
app:boxCornerRadiusBottomStart="28dp"
app:boxCornerRadiusTopEnd="28dp"
app:boxCornerRadiusTopStart="28dp"
app:endIconDrawable="@drawable/ic_round_search_24"
app:hintAnimationEnabled="true">
<AutoCompleteTextView
android:id="@+id/searchViewText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="bottom"
android:fontFamily="@font/poppins_bold"
android:imeOptions="actionSearch"
android:inputType="textPersonName"
android:hint="@string/search"
android:padding="8dp"
android:selectAllOnFocus="true"
android:textSize="14sp"
tools:ignore="LabelFor,TextContrastCheck" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>

View file

@ -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">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/commentsRefresh"
android:layout_width="match_parent"
android:layout_marginTop="58dp"
android:layout_height="wrap_content"
android:layout_marginTop="58dp"
android:clipChildren="false"
android:clipToPadding="false">
@ -41,8 +40,8 @@
<ImageView
android:id="@+id/commentFilter"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/sort_by"
@ -51,8 +50,8 @@
<ImageView
android:id="@+id/commentSort"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/sort_by"
@ -90,8 +89,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:windowSoftInputMode="adjustResize">
android:paddingBottom="8dp">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/commentUserAvatar"
@ -107,10 +105,10 @@
android:id="@+id/commentInput"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:layout_gravity="start|center_vertical"
android:autofillHints="The One Piece is real"
android:background="@drawable/card_outline"
android:fontFamily="@font/poppins_semi_bold"
@ -124,27 +122,25 @@
<ImageButton
android:id="@+id/commentLabel"
android:layout_width="42dp"
android:layout_height="42dp"
android:scaleType="center"
android:scaleX="0.6"
android:scaleY="0.6"
android:translationX="100dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:background="@drawable/ic_label_off_24"
android:visibility="gone"/>
android:layout_marginEnd="8dp"
android:visibility="gone"
tools:visibility="visible"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/commentSend"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="12dp"
android:translationX="100dp"
android:scaleType="center"
android:scaleX="0.85"
android:scaleY="0.85"
android:layout_gravity="center"
android:background="@drawable/ic_round_send_24"
android:visibility="gone"
tools:ignore="ContentDescription"
android:visibility="gone"/>
tools:visibility="visible" />
</LinearLayout>

View file

@ -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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:padding="6dp"
android:orientation="horizontal">
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/commentUserAvatar"
android:layout_marginTop="4dp"
android:layout_width="36dp"
android:layout_height="36dp"
android:scaleType="center"
android:layout_gravity="center_horizontal"
style="@style/CircularImageView"
app:srcCompat="@drawable/ic_round_add_circle_24"
tools:ignore="ContentDescription,ImageContrastCheck" />
<TextView
android:id="@+id/commentUserLevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/commentUserAvatar"
style="@style/CircularImageView"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_gravity="center_horizontal"
android:fontFamily="@font/poppins_semi_bold"
android:text="lvl 1"
android:textSize="12sp"
android:alpha="0.6"
tools:ignore="HardcodedText" />
android:layout_marginTop="12dp"
android:scaleType="center"
app:srcCompat="@drawable/ic_round_add_circle_24"
tools:ignore="ContentDescription,ImageContrastCheck" />
<LinearLayout
android:id="@+id/commentUserTagLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:layout_gravity="center"
tools:ignore="UseCompoundDrawables">
<ImageView
android:id="@+id/commentTag"
android:layout_width="16dp"
android:layout_height="wrap_content"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_label_24" />
android:src="@drawable/ic_label_24"
android:alpha="0.9"
tools:ignore="ContentDescription"
app:tint="?attr/colorPrimary" />
<TextView
android:id="@+id/commentUserTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_semi_bold"
android:paddingTop="2dp"
android:text="9999"
android:maxLines="1"
android:textSize="12sp"
android:alpha="0.6"
android:layout_marginEnd="12dp"
android:layout_gravity="center_vertical"
tools:ignore="HardcodedText" />
android:alpha="0.9"
android:fontFamily="@font/poppins_bold"
android:maxLines="1"
android:paddingTop="2dp"
android:text="1095"
android:textColor="?attr/colorPrimary"
android:textSize="12sp"
tools:ignore="HardcodedText,SmallSp"/>
</LinearLayout>
@ -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"/>
<TextView
android:id="@+id/commentUserLevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:fontFamily="@font/poppins_bold"
android:text="[1]"
android:textSize="12sp"
android:alpha="0.8"
tools:ignore="HardcodedText" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:alpha="0.6"
android:fontFamily="@font/poppins_semi_bold"
android:text="•"
android:textSize="16sp"
tools:ignore="HardcodedText,RtlSymmetry" />
<TextView
android:id="@+id/commentUserTime"
android:layout_width="wrap_content"
@ -146,6 +163,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_semi_bold"
android:maxLines="8"
android:scrollHorizontally="false"
android:ellipsize="end"
@ -224,8 +242,8 @@
android:orientation="vertical">
<ImageView
android:id="@+id/commentUpVote"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:alpha="0.4"
app:srcCompat="@drawable/ic_round_upvote_inactive_24"
tools:ignore="ContentDescription" />
@ -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" />
<ImageView
android:id="@+id/commentDownVote"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:alpha="0.4"
app:srcCompat="@drawable/ic_round_upvote_inactive_24"
android:rotation="180"
@ -252,6 +270,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-8dp"
android:layout_gravity="center_vertical"
android:orientation="horizontal">

View file

@ -13,4 +13,5 @@
<color name="chip">#b3aead</color>
<color name="grey_nav">#F9222222</color>
<color name="incognito">#6347D4</color>
<color name="tags">#8B2AFA</color>
</resources>

View file

@ -33,6 +33,7 @@
<color name="light_blue_200">#FF81D4FA</color>
<color name="light_blue_600">#FF039BE5</color>
<color name="light_blue_900">#FF01579B</color>
<color name="tags">#5E057E</color>
<!-- theme 1 -->
<color name="seed_1">#00658e</color>