|
@@ -22,9 +22,9 @@ class SourceItem(val manga: Manga, private val displayMode: Preference<DisplayMo
|
|
|
|
|
|
override fun getLayoutRes(): Int {
|
|
override fun getLayoutRes(): Int {
|
|
return when (displayMode.get()) {
|
|
return when (displayMode.get()) {
|
|
- DisplayModeSetting.COMPACT_GRID -> R.layout.source_compact_grid_item
|
|
|
|
- DisplayModeSetting.COMFORTABLE_GRID -> R.layout.source_comfortable_grid_item
|
|
|
|
DisplayModeSetting.LIST -> R.layout.source_list_item
|
|
DisplayModeSetting.LIST -> R.layout.source_list_item
|
|
|
|
+ DisplayModeSetting.COMFORTABLE_GRID -> R.layout.source_comfortable_grid_item
|
|
|
|
+ else -> R.layout.source_compact_grid_item
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -33,37 +33,37 @@ class SourceItem(val manga: Manga, private val displayMode: Preference<DisplayMo
|
|
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
|
adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>
|
|
): SourceHolder<*> {
|
|
): SourceHolder<*> {
|
|
return when (displayMode.get()) {
|
|
return when (displayMode.get()) {
|
|
- DisplayModeSetting.COMPACT_GRID -> {
|
|
|
|
- val binding = SourceCompactGridItemBinding.bind(view)
|
|
|
|
|
|
+ DisplayModeSetting.LIST -> {
|
|
|
|
+ SourceListHolder(view, adapter)
|
|
|
|
+ }
|
|
|
|
+ DisplayModeSetting.COMFORTABLE_GRID -> {
|
|
|
|
+ val binding = SourceComfortableGridItemBinding.bind(view)
|
|
val parent = adapter.recyclerView as AutofitRecyclerView
|
|
val parent = adapter.recyclerView as AutofitRecyclerView
|
|
val coverHeight = parent.itemWidth / 3 * 4
|
|
val coverHeight = parent.itemWidth / 3 * 4
|
|
view.apply {
|
|
view.apply {
|
|
- binding.card.layoutParams = FrameLayout.LayoutParams(
|
|
|
|
|
|
+ binding.card.layoutParams = ConstraintLayout.LayoutParams(
|
|
MATCH_PARENT,
|
|
MATCH_PARENT,
|
|
coverHeight
|
|
coverHeight
|
|
)
|
|
)
|
|
- binding.gradient.layoutParams = FrameLayout.LayoutParams(
|
|
|
|
- MATCH_PARENT,
|
|
|
|
- coverHeight / 2,
|
|
|
|
- Gravity.BOTTOM
|
|
|
|
- )
|
|
|
|
}
|
|
}
|
|
- SourceCompactGridHolder(view, adapter)
|
|
|
|
|
|
+ SourceComfortableGridHolder(view, adapter)
|
|
}
|
|
}
|
|
- DisplayModeSetting.COMFORTABLE_GRID -> {
|
|
|
|
- val binding = SourceComfortableGridItemBinding.bind(view)
|
|
|
|
|
|
+ else -> {
|
|
|
|
+ val binding = SourceCompactGridItemBinding.bind(view)
|
|
val parent = adapter.recyclerView as AutofitRecyclerView
|
|
val parent = adapter.recyclerView as AutofitRecyclerView
|
|
val coverHeight = parent.itemWidth / 3 * 4
|
|
val coverHeight = parent.itemWidth / 3 * 4
|
|
view.apply {
|
|
view.apply {
|
|
- binding.card.layoutParams = ConstraintLayout.LayoutParams(
|
|
|
|
|
|
+ binding.card.layoutParams = FrameLayout.LayoutParams(
|
|
MATCH_PARENT,
|
|
MATCH_PARENT,
|
|
coverHeight
|
|
coverHeight
|
|
)
|
|
)
|
|
|
|
+ binding.gradient.layoutParams = FrameLayout.LayoutParams(
|
|
|
|
+ MATCH_PARENT,
|
|
|
|
+ coverHeight / 2,
|
|
|
|
+ Gravity.BOTTOM
|
|
|
|
+ )
|
|
}
|
|
}
|
|
- SourceComfortableGridHolder(view, adapter)
|
|
|
|
- }
|
|
|
|
- DisplayModeSetting.LIST -> {
|
|
|
|
- SourceListHolder(view, adapter)
|
|
|
|
|
|
+ SourceCompactGridHolder(view, adapter)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|