package com.remax.visualnovel.extension


import android.app.Activity
import android.content.Intent



///**
// * 退出编辑二次确认弹窗
// */
//fun Activity.showExitHintDialog(isFinish: Boolean = true, continueCallback: (() -> Unit)? = null) {
//    showDoubleBtnDialog(
//        getString(R.string.tips),
//        getString(R.string.im_auto_input_back),
//        rightBtnText = getString(R.string.continue_hint),
//        rightBtnClick = {
//            if (KeyboardUtils.isSoftInputVisible(this)) {
//                KeyboardUtils.hideSoftInput(this)
//            }
//            continueCallback?.invoke()
//            if (isFinish) {
//                finish()
//            }
//        })
//}


///**
// * 展示余额不足弹窗
// */
//fun AppCompatActivity.activityShowChargeDialog() {
//    showDoubleBtnDialog(
//        getString(R.string.tips),
//        getString(R.string.balance_insufficient_hint),
//        rightBtnText = getString(R.string.recharge),
//        rightBtnClick = {
//            ChargeActivity.open()
//        })
//}


/**
 * 设置activity返回参数
 */
inline fun Activity.setResultAndFinish(isFinish: Boolean = true, block: Intent.() -> Unit = {}) {
    setResult(Activity.RESULT_OK, Intent().apply {
        this.block()
    })
    if (isFinish) finish()
}

