diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DescriptionSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DescriptionSheet.kt new file mode 100644 index 000000000..b02afc4ea --- /dev/null +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DescriptionSheet.kt @@ -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() { + + 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) + } +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsFragment.kt index f52472916..078ee7816 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsFragment.kt @@ -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) } diff --git a/app/src/main/res/layout/fragment_details.xml b/app/src/main/res/layout/fragment_details.xml index 67953909d..be0bdc3f9 100644 --- a/app/src/main/res/layout/fragment_details.xml +++ b/app/src/main/res/layout/fragment_details.xml @@ -324,6 +324,7 @@ android:layout_height="wrap_content" android:layout_marginEnd="8dp" android:text="@string/show_all" + android:visibility="gone" app:layout_constraintBaseline_toBaselineOf="@id/textView_related_title" app:layout_constraintEnd_toEndOf="parent" /> diff --git a/app/src/main/res/layout/sheet_description.xml b/app/src/main/res/layout/sheet_description.xml new file mode 100644 index 000000000..e22ce75e9 --- /dev/null +++ b/app/src/main/res/layout/sheet_description.xml @@ -0,0 +1,34 @@ + + + + + + + + + + +