发现界面优化
This commit is contained in:
2 files changed
+18
-11
No files matched your search
@@ -65,8 +65,7 @@ class ExploreAdapter(
|
|||||||
val isExpanded = (item.bookSourceUrl == expandedId)
|
val isExpanded = (item.bookSourceUrl == expandedId)
|
||||||
|
|
||||||
if (isExpanded) {
|
if (isExpanded) {
|
||||||
ivStatus.icon = ContextCompat.getDrawable(context, R.drawable.ic_arrow_right)
|
ivStatus.isChecked = true
|
||||||
ivStatus.rotation = 90f
|
|
||||||
rotateLoading.visible()
|
rotateLoading.visible()
|
||||||
if (scrollToId == item.bookSourceUrl) {
|
if (scrollToId == item.bookSourceUrl) {
|
||||||
val pos = holder.bindingAdapterPosition
|
val pos = holder.bindingAdapterPosition
|
||||||
@@ -82,8 +81,7 @@ class ExploreAdapter(
|
|||||||
rotateLoading.gone()
|
rotateLoading.gone()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ivStatus.icon = ContextCompat.getDrawable(context, R.drawable.ic_arrow_right)
|
ivStatus.isChecked = false
|
||||||
ivStatus.rotation = 0f
|
|
||||||
recyclerFlexbox(flexbox)
|
recyclerFlexbox(flexbox)
|
||||||
flexbox.gone()
|
flexbox.gone()
|
||||||
}
|
}
|
||||||
@@ -135,7 +133,19 @@ class ExploreAdapter(
|
|||||||
override fun registerListener(holder: ItemViewHolder, binding: ItemFindBookBinding) {
|
override fun registerListener(holder: ItemViewHolder, binding: ItemFindBookBinding) {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
llTitle.setOnClickListener {
|
llTitle.setOnClickListener {
|
||||||
val item = getItem(holder.bindingAdapterPosition) ?: return@setOnClickListener
|
toggleExpandState(holder)
|
||||||
|
}
|
||||||
|
ivStatus.setOnClickListener {
|
||||||
|
toggleExpandState(holder)
|
||||||
|
}
|
||||||
|
llTitle.onLongClick {
|
||||||
|
showMenu(ivStatus, holder.bindingAdapterPosition)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun toggleExpandState(holder: ItemViewHolder) {
|
||||||
|
val item = getItem(holder.bindingAdapterPosition) ?: return
|
||||||
val oldId = expandedId
|
val oldId = expandedId
|
||||||
expandedId = if (expandedId == item.bookSourceUrl) null else item.bookSourceUrl
|
expandedId = if (expandedId == item.bookSourceUrl) null else item.bookSourceUrl
|
||||||
notifyItemChangedById(oldId)
|
notifyItemChangedById(oldId)
|
||||||
@@ -146,11 +156,6 @@ class ExploreAdapter(
|
|||||||
callBack.scrollTo(holder.bindingAdapterPosition)
|
callBack.scrollTo(holder.bindingAdapterPosition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
llTitle.onLongClick {
|
|
||||||
showMenu(ivStatus, holder.bindingAdapterPosition)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun compressExplore(): Boolean {
|
fun compressExplore(): Boolean {
|
||||||
return if (expandedId == null) {
|
return if (expandedId == null) {
|
||||||
|
|||||||
@@ -37,7 +37,8 @@
|
|||||||
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:icon="@drawable/ic_arrow_right"
|
android:checkable="true"
|
||||||
|
app:icon="@drawable/m3_split_button_chevron_avd"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
@@ -46,6 +47,7 @@
|
|||||||
android:id="@+id/rotate_loading"
|
android:id="@+id/rotate_loading"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
app:indicatorColor="?attr/colorSurface"
|
||||||
app:indicatorSize="24dp"
|
app:indicatorSize="24dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintTop_toTopOf="@id/iv_status"
|
app:layout_constraintTop_toTopOf="@id/iv_status"
|
||||||
|
|||||||
Reference in new issue
Block a user