Description bottom sheet
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package org.koitharu.kotatsu.details.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import org.koitharu.kotatsu.core.ui.sheet.BaseAdaptiveSheet
|
||||
import org.koitharu.kotatsu.core.util.ext.showDistinct
|
||||
import org.koitharu.kotatsu.core.util.ext.withArgs
|
||||
import org.koitharu.kotatsu.databinding.SheetDescriptionBinding
|
||||
|
||||
class DescriptionSheet : BaseAdaptiveSheet<SheetDescriptionBinding>() {
|
||||
|
||||
override fun onCreateViewBinding(inflater: LayoutInflater, container: ViewGroup?): SheetDescriptionBinding {
|
||||
return SheetDescriptionBinding.inflate(inflater, container, false)
|
||||
}
|
||||
|
||||
override fun onViewBindingCreated(binding: SheetDescriptionBinding, savedInstanceState: Bundle?) {
|
||||
super.onViewBindingCreated(binding, savedInstanceState)
|
||||
binding.textViewDescription.text = arguments?.getCharSequence(ARG_CONTENT)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val ARG_CONTENT = "content"
|
||||
private const val TAG = "DescriptionSheet"
|
||||
|
||||
fun show(fm: FragmentManager, content: CharSequence) = DescriptionSheet().withArgs(1) {
|
||||
putCharSequence(ARG_CONTENT, content)
|
||||
}.showDistinct(fm, TAG)
|
||||
}
|
||||
}
|
||||
@@ -191,6 +191,7 @@ class DetailsFragment :
|
||||
} else {
|
||||
requireViewBinding().textViewDescription.text = description
|
||||
}
|
||||
requireViewBinding().buttonDescriptionMore.isGone = description.isNullOrBlank()
|
||||
}
|
||||
|
||||
private fun onLocalSizeChanged(size: Long) {
|
||||
@@ -295,6 +296,10 @@ class DetailsFragment :
|
||||
)
|
||||
}
|
||||
|
||||
R.id.button_description_more -> {
|
||||
DescriptionSheet.show(parentFragmentManager, viewModel.description.value ?: return)
|
||||
}
|
||||
|
||||
R.id.button_scrobbling_more -> {
|
||||
ScrobblingSelectorSheet.show(parentFragmentManager, manga, null)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user