package com.gh.gamecenter.gamedetail.fuli.kaifu

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.DialogFragment
import com.gh.gamecenter.R
import com.gh.gamecenter.common.databinding.DialogAlertDefaultBinding
import com.gh.gamecenter.common.utils.setDrawableStart
import com.google.android.material.bottomsheet.BottomSheetDialogFragment

/**
 * 游戏订阅成功-已绑定微信弹窗
 */
class ServersCalendarSubscriptionSuccessDialog : DialogFragment() {

    private lateinit var viewBinding: DialogAlertDefaultBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setStyle(BottomSheetDialogFragment.STYLE_NORMAL, com.gh.gamecenter.common.R.style.DialogWindowTransparent)
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
        return DialogAlertDefaultBinding.inflate(inflater, container, false).also {
            viewBinding = it
        }.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        viewBinding.titleTv.text = getString(R.string.servers_calendar_subscription_dialog_title)
        viewBinding.contentTv.text = getString(R.string.servers_calendar_subscription_dialog_content)
        viewBinding.confirmTv.text = getString(R.string.servers_calendar_subscription_dialog_confirm)
        viewBinding.centerDivider.visibility = View.GONE
        viewBinding.cancelTv.visibility = View.GONE
        viewBinding.titleTv.setDrawableStart(R.drawable.ic_reserve_success, null, null)
        viewBinding.confirmTv.setOnClickListener {
            dismissAllowingStateLoss()
        }
    }
}