Skip to content

Commit

Permalink
For mozilla-mobile#3521 - Show Quick Settings Dialog Entirely in Land…
Browse files Browse the repository at this point in the history
…scape
  • Loading branch information
ekager committed Jul 16, 2019
1 parent 6aa6cf8 commit 9af77fd
Showing 1 changed file with 13 additions and 4 deletions.
Expand Up @@ -15,13 +15,15 @@ import android.view.Gravity.BOTTOM
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.net.toUri
import androidx.core.widget.NestedScrollView
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.NavHostFragment.findNavController
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -102,12 +104,19 @@ class QuickSettingsSheetDialogFragment : AppCompatDialogFragment() {
}

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val customDialog = if (promptGravity == BOTTOM) {
return BottomSheetDialog(requireContext(), this.theme)
return if (promptGravity == BOTTOM) {
val bottomSheetDialog = BottomSheetDialog(requireContext(), this.theme)
bottomSheetDialog.setOnShowListener {
val bottomSheet = bottomSheetDialog.findViewById<View>(
com.google.android.material.R.id.design_bottom_sheet
) as? FrameLayout
val behavior = BottomSheetBehavior.from(bottomSheet)
behavior.state = BottomSheetBehavior.STATE_EXPANDED
}
bottomSheetDialog
} else {
Dialog(requireContext())
Dialog(requireContext()).applyCustomizationsForTopDialog(inflateRootView())
}
return customDialog.applyCustomizationsForTopDialog(inflateRootView())
}

private fun Dialog.applyCustomizationsForTopDialog(rootView: View): Dialog {
Expand Down

0 comments on commit 9af77fd

Please sign in to comment.