More fixes to category header

This commit is contained in:
Jay 2020-02-22 17:51:57 -08:00
parent 0337181b08
commit 55bdd3b4d6
2 changed files with 56 additions and 54 deletions

View File

@ -21,7 +21,6 @@ import eu.kanade.tachiyomi.data.library.LibraryUpdateService
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.visible
import kotlinx.android.synthetic.main.library_category_header_item.view.*
@ -104,18 +103,18 @@ class LibraryHeaderItem(private val categoryF: (Int) -> Category, val catId: Int
adapter.mode == SelectableAdapter.Mode.MULTI -> {
checkboxImage.visible()
catProgress.gone()
updateButton.invisible()
updateButton.gone()
setSelection()
}
category.id == -1 -> {
checkboxImage.gone()
catProgress.gone()
updateButton.invisible()
updateButton.gone()
}
LibraryUpdateService.categoryInQueue(category.id) -> {
checkboxImage.gone()
catProgress.visible()
updateButton.invisible()
updateButton.gone()
}
else -> {
checkboxImage.gone()
@ -127,7 +126,7 @@ class LibraryHeaderItem(private val categoryF: (Int) -> Category, val catId: Int
private fun addCategoryToUpdate() {
if (adapter.libraryListener.updateCategory(adapterPosition)) {
updateButton.invisible()
updateButton.gone()
launchUI {
adapter.notifyItemChanged(adapterPosition)
}

View File

@ -6,52 +6,47 @@
android:layout_height="wrap_content"
android:gravity="center_vertical">
<ImageView
android:id="@+id/checkbox"
android:padding="10dp"
android:visibility="gone"
tools:visibility="visible"
tools:tint="?attr/colorAccent"
android:layout_width="wrap_content"
android:contentDescription="@string/action_select_all"
android:clickable="true"
android:focusable="true"
android:layout_height="wrap_content"
android:src="@drawable/ic_check_circle_white_24dp"
android:layout_marginStart="2dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/category_title"
app:layout_constraintEnd_toStartOf="@+id/category_title"
app:layout_constraintTop_toTopOf="@+id/category_title"
/>
<TextView
android:id="@+id/category_title"
style="@style/TextAppearance.MaterialComponents.Headline6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_marginBottom="4dp"
android:layout_marginBottom="10dp"
android:ellipsize="end"
android:gravity="center|start"
android:inputType="none"
android:maxLines="1"
android:layout_marginTop="32dp"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="@id/update_button"
app:layout_constraintStart_toEndOf="@+id/checkbox"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/update_button"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_default="wrap"
tools:text="Title dfdsfsfsfsfsfsfs" />
<TextView
android:id="@+id/category_sort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginBottom="4dp"
android:clickable="true"
android:drawableEnd="@drawable/ic_sort_white_24dp"
android:drawablePadding="6dp"
android:drawableTint="@color/gray_button"
android:ellipsize="none"
android:focusable="true"
android:gravity="start|center"
android:maxLines="3"
android:padding="6dp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp"
android:textStyle="normal"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@id/space"
app:layout_constraintWidth_min="20dp"
tools:text="Drag and Drop" />
<Space
android:id="@+id/space"
android:layout_width="0dp"
@ -66,16 +61,13 @@
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_marginTop="32dp"
android:layout_marginBottom="6dp"
android:clickable="true"
android:focusable="true"
android:text="@string/ext_update"
android:textColor="?android:attr/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBaseline_toBaselineOf="@id/category_title"
app:layout_constraintEnd_toStartOf="@id/space"
app:layout_constraintStart_toEndOf="@+id/category_title"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_default="wrap"
app:rippleColor="@color/fullRippleColor" />
@ -86,25 +78,36 @@
android:layout_marginStart="10dp"
android:indeterminate="true"
app:layout_constraintBottom_toBottomOf="@+id/category_title"
app:layout_constraintEnd_toStartOf="@+id/category_sort"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/category_title"
app:layout_constraintTop_toTopOf="@+id/category_title" />
<ImageView
android:id="@+id/checkbox"
android:padding="10dp"
android:visibility="gone"
tools:visibility="visible"
<TextView
android:id="@+id/category_sort"
android:layout_width="wrap_content"
android:contentDescription="@string/action_select_all"
android:clickable="true"
android:focusable="true"
android:layout_height="wrap_content"
android:src="@drawable/ic_check_circle_white_24dp"
android:layout_marginStart="2dp"
app:layout_constraintBottom_toBottomOf="@+id/category_title"
app:layout_constraintStart_toEndOf="@+id/category_title"
app:layout_constraintTop_toTopOf="@+id/category_title"
/>
android:layout_marginEnd="10dp"
android:clickable="true"
android:drawableEnd="@drawable/ic_sort_white_24dp"
android:drawablePadding="6dp"
android:layout_marginBottom="4dp"
android:drawableTint="@color/gray_button"
android:ellipsize="none"
android:focusable="true"
android:gravity="center|end"
android:textAlignment="textEnd"
android:maxLines="3"
android:padding="6dp"
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp"
android:textStyle="normal"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@id/space"
app:layout_constraintWidth_min="80dp"
tools:text="Drag and Drop" />
</androidx.constraintlayout.widget.ConstraintLayout>