package com.base.browserwhite.ui.views

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import com.base.browserwhite.databinding.DialogDefaultBrowserBinding
import com.base.browserwhite.databinding.DialogRateStarBinding
import com.base.browserwhite.ui.views.DialogViews.showDefaultBrowserDialog
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog

object RateDialog {

    fun Context.showRateDialog() {
        val dialog = BottomSheetDialog(this)
        val binding = DialogRateStarBinding.inflate(LayoutInflater.from(this))
        dialog.setContentView(binding.root)
        dialog.setCanceledOnTouchOutside(false)

        dialog.show()

        val parentView = binding.root.parent as View
        val behavior = BottomSheetBehavior.from(parentView)
        //展开
        behavior.state = BottomSheetBehavior.STATE_EXPANDED
    }
}