Light theme feature intro bottom sheet is expanded by default.

This commit is contained in:
Anton Chekulaev 2020-09-03 11:34:49 +10:00
parent 0d4d3e4504
commit 5d6b23bae2

View File

@ -1,14 +1,18 @@
package org.thoughtcrime.securesms.loki.dialogs package org.thoughtcrime.securesms.loki.dialogs
import android.app.Dialog
import android.os.Bundle import android.os.Bundle
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.FrameLayout
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import kotlinx.android.synthetic.main.fragment_light_theme_feature_intro_bottom_sheet.* import kotlinx.android.synthetic.main.fragment_light_theme_feature_intro_bottom_sheet.*
import kotlinx.android.synthetic.main.fragment_open_group_suggestion_bottom_sheet.*
import network.loki.messenger.R import network.loki.messenger.R
class LightThemeFeatureIntroBottomSheet : BottomSheetDialogFragment() { class LightThemeFeatureIntroBottomSheet : BottomSheetDialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
@ -23,4 +27,15 @@ class LightThemeFeatureIntroBottomSheet : BottomSheetDialogFragment() {
okButton.setOnClickListener { dismiss() } okButton.setOnClickListener { dismiss() }
} }
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState)
// Make the bottom sheet be expanded by default.
dialog.setOnShowListener {
val d = dialog as BottomSheetDialog
val bottomSheet = d.findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)
BottomSheetBehavior.from(bottomSheet!!).setState(BottomSheetBehavior.STATE_EXPANDED);
}
return dialog
}
} }