Skip to content

Commit

Permalink
feat(comments): UI tweaks
Browse files Browse the repository at this point in the history
fix(comments): top padding
fix: removed self report
feat: better colors in color picker
  • Loading branch information
aayush2622 committed Feb 27, 2024
1 parent efe5f54 commit 2f7c6e7
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 184 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/ani/dantotsu/media/comments/CommentItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, _ ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
200 changes: 89 additions & 111 deletions app/src/main/res/layout/activity_extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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="match_parent"
android:orientation="vertical">
android:layout_height="wrap_content"
android:orientation="horizontal">

<LinearLayout
android:layout_width="match_parent"
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<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">
app:cardBackgroundColor="@color/nav_bg_inv"
app:cardCornerRadius="16dp"
app:cardElevation="0dp">

</androidx.cardview.widget.CardView>
</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>
<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" />

<LinearLayout
android:id="@+id/extensionsHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables"></LinearLayout>
<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>

<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" />
<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" />
<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>
<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">
<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>

<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>
44 changes: 20 additions & 24 deletions app/src/main/res/layout/fragment_comments.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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>


Expand Down
Loading

0 comments on commit 2f7c6e7

Please sign in to comment.