Track search dialog adjustments (#5479)

* Add clear text button to track search dialog text input

* Track search item adjustments
This commit is contained in:
Ivan Iskandar 2021-07-03 20:44:12 +07:00 committed by GitHub
parent db0c1b2634
commit 64b1c9636b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 14 deletions

View File

@ -3,10 +3,11 @@ package eu.kanade.tachiyomi.ui.manga.track
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import coil.clear
import coil.load
import coil.loadAny
import coil.transform.RoundedCornersTransformation
import eu.kanade.tachiyomi.data.track.model.TrackSearch
import eu.kanade.tachiyomi.databinding.TrackSearchItemBinding
import eu.kanade.tachiyomi.util.view.setMaxLinesAndEllipsize
import eu.kanade.tachiyomi.util.system.dpToPx
import java.util.Locale
class TrackSearchHolder(
@ -23,7 +24,9 @@ class TrackSearchHolder(
binding.trackSearchTitle.text = track.title
binding.trackSearchCover.clear()
if (track.cover_url.isNotEmpty()) {
binding.trackSearchCover.load(track.cover_url)
binding.trackSearchCover.loadAny(track.cover_url) {
transformations(RoundedCornersTransformation(6.dpToPx.toFloat()))
}
}
val hasStatus = track.publishing_status.isNotBlank()
@ -51,8 +54,11 @@ class TrackSearchHolder(
binding.trackSearchStartResult.text = track.start_date
}
binding.trackSearchSummary.setMaxLinesAndEllipsize()
binding.trackSearchSummary.text = track.summary
val hasSummary = track.summary.isNotBlank()
binding.trackSearchSummary.isVisible = hasSummary
if (hasSummary) {
binding.trackSearchSummary.text = track.summary
}
}
fun setUnchecked() {

View File

@ -36,7 +36,8 @@
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="8dp"
android:hint="@string/title">
android:hint="@string/title"
app:endIconMode="clear_text">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/title_input_edit_text"

View File

@ -15,15 +15,17 @@
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/track_search_cover"
android:layout_width="130dp"
android:layout_height="180dp"
android:layout_width="68dp"
android:layout_height="95dp"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:contentDescription="@string/description_cover"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@mipmap/ic_launcher" />
@ -32,7 +34,7 @@
android:id="@+id/track_search_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="36dp"
android:ellipsize="end"
@ -122,18 +124,27 @@
<TextView
android:id="@+id/track_search_summary"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="8dp"
android:ellipsize="end"
android:maxLines="4"
android:textAppearance="?attr/textAppearanceCaption"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/track_search_status"
app:layout_constraintTop_toBottomOf="@+id/track_search_status"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas condimentum et turpis ut sollicitudin. Donec tellus dolor, rhoncus a mattis eget, tempor quis augue. Fusce eleifend dignissim turpis a molestie. Praesent tincidunt, risus sed egestas fringilla, urna orci ultrices libero, id iaculis sem lorem placerat lacus." />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="track_search_start_result,track_search_title,track_search_type_result,track_search_status,track_search_cover,track_search_status_result,track_search_type,track_search_start" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>