@@ -56,7 +56,11 @@ class ModalBottomSheetDialogFragment : BottomSheetDialogFragment() {
5656 MenuInflater (context)
5757 }
5858
59- override fun onCreateView (inflater : LayoutInflater , container : ViewGroup ? , savedInstanceState : Bundle ? ): View ? {
59+ override fun onCreateView (
60+ inflater : LayoutInflater ,
61+ container : ViewGroup ? ,
62+ savedInstanceState : Bundle ?
63+ ): View ? {
6064 return inflater.inflate(R .layout.modal_bottom_sheet_dialog_fragment, container, false )
6165 }
6266
@@ -65,8 +69,10 @@ class ModalBottomSheetDialogFragment : BottomSheetDialogFragment() {
6569 val arguments = arguments
6670 ? : throw IllegalStateException (" You need to create this via the builder" )
6771 val isRounded = arguments.getBoolean(KEY_ROUNDED )
68- if (isRounded){
69- setStyle(STYLE_NORMAL , R .style.RoundedBottomSheetDialogTheme )
72+ if (isRounded) {
73+ setStyle(STYLE_NORMAL , R .style.ModalBottomSheetDialogThemeRounded )
74+ } else {
75+ setStyle(STYLE_NORMAL , R .style.ModalBottomSheetDialogTheme )
7076 }
7177 }
7278
@@ -75,7 +81,7 @@ class ModalBottomSheetDialogFragment : BottomSheetDialogFragment() {
7581 super .onViewCreated(view, savedInstanceState)
7682 list = view.findViewById(R .id.list)
7783 val arguments = arguments
78- ? : throw IllegalStateException (" You need to create this via the builder" )
84+ ? : throw IllegalStateException (" You need to create this via the builder" )
7985
8086 val optionHolders = arguments.getParcelableArrayList<OptionHolder >(KEY_OPTIONS )!!
8187
@@ -150,6 +156,7 @@ class ModalBottomSheetDialogFragment : BottomSheetDialogFragment() {
150156 class Builder {
151157
152158 internal var options = ArrayList <OptionHolder >()
159+
153160 @LayoutRes
154161 internal var layoutRes = R .layout.modal_bottom_sheet_dialog_fragment_item
155162 internal var columns = 1
@@ -194,7 +201,10 @@ class ModalBottomSheetDialogFragment : BottomSheetDialogFragment() {
194201 /* *
195202 * Add a custom header to the modal, using the custom layout if provided
196203 */
197- fun header (header : String , @LayoutRes layoutRes : Int = R .layout.modal_bottom_sheet_dialog_fragment_header): Builder {
204+ fun header (
205+ header : String ,
206+ @LayoutRes layoutRes : Int = R .layout.modal_bottom_sheet_dialog_fragment_header
207+ ): Builder {
198208 this .header = header
199209 this .headerLayoutRes = layoutRes
200210 return this
@@ -203,7 +213,7 @@ class ModalBottomSheetDialogFragment : BottomSheetDialogFragment() {
203213 /*
204214 * Set rounded on top bottom sheet dialog
205215 */
206- fun rounded (isRounded : Boolean ): Builder {
216+ fun rounded (isRounded : Boolean ): Builder {
207217 this .isRounded = isRounded
208218 return this
209219 }
@@ -235,7 +245,8 @@ class ModalBottomSheetDialogFragment : BottomSheetDialogFragment() {
235245 fun onModalOptionSelected (tag : String? , option : Option )
236246 }
237247
238- internal class Adapter (private val callback : (option: Option ) -> Unit ) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
248+ internal class Adapter (private val callback : (option: Option ) -> Unit ) :
249+ RecyclerView .Adapter <RecyclerView .ViewHolder >() {
239250
240251 companion object {
241252 const val VIEW_TYPE_HEADER = 0
@@ -252,7 +263,8 @@ class ModalBottomSheetDialogFragment : BottomSheetDialogFragment() {
252263 when (viewType) {
253264
254265 VIEW_TYPE_HEADER -> {
255- val view = LayoutInflater .from(parent.context).inflate(headerLayoutRes, parent, false )
266+ val view =
267+ LayoutInflater .from(parent.context).inflate(headerLayoutRes, parent, false )
256268 return HeaderViewHolder (view)
257269 }
258270 VIEW_TYPE_ITEM -> {
0 commit comments