Commit ffc85be9 authored by Jonas L.'s avatar Jonas L.

Auto expand download content and project info dialog

parent 7e90cc95
package de.determapp.android.ui.viewer.info
import android.app.Dialog
import android.os.Bundle
import android.text.TextUtils
import android.view.LayoutInflater
......@@ -10,6 +11,7 @@ import android.widget.ArrayAdapter
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import de.determapp.android.R
import de.determapp.android.content.database.AppDatabaseInstance
......@@ -36,6 +38,15 @@ class DownloadContentDialogFragment: BottomSheetDialogFragment(), ViewerInfoHand
show(fragmentManager, TAG)
}
// based on https://stackoverflow.com/a/43602359
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog = super.onCreateDialog(savedInstanceState).apply {
setOnShowListener {
BottomSheetBehavior.from(
dialog.findViewById<View>(R.id.design_bottom_sheet)
).setState(BottomSheetBehavior.STATE_EXPANDED)
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
binding = DownloadContentDialogBinding.inflate(inflater, container, false)
......
package de.determapp.android.ui.viewer.info
import android.app.Dialog
import android.content.Intent
import android.net.Uri
import android.os.Bundle
......@@ -10,6 +11,7 @@ import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Observer
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import de.determapp.android.R
import de.determapp.android.databinding.ProjectInfoDialogBinding
......@@ -25,6 +27,15 @@ class ProjectInfoDialogFragment: BottomSheetDialogFragment() {
show(fragmentManager, TAG)
}
// based on https://stackoverflow.com/a/43602359
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog = super.onCreateDialog(savedInstanceState).apply {
setOnShowListener {
BottomSheetBehavior.from(
dialog.findViewById<View>(R.id.design_bottom_sheet)
).setState(BottomSheetBehavior.STATE_EXPANDED)
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val binding = ProjectInfoDialogBinding.inflate(inflater, container, false)
val activity = activity as ViewerActivity
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment