package jp.juggler.subwaytooter.dialog import android.annotation.SuppressLint import android.app.Dialog import android.view.View import android.view.WindowManager import android.widget.Button import android.widget.CheckBox import android.widget.EditText import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import jp.juggler.subwaytooter.R import jp.juggler.subwaytooter.api.entity.Host import jp.juggler.subwaytooter.api.entity.TootInstance import jp.juggler.subwaytooter.util.DecodeOptions import jp.juggler.subwaytooter.util.LinkHelper import jp.juggler.subwaytooter.util.openCustomTab import jp.juggler.util.neatSpaces import jp.juggler.util.notBlank import jp.juggler.util.showToast import jp.juggler.util.vg class DlgCreateAccount( val activity: AppCompatActivity, val apiHost: Host, val onClickOk: ( dialog: Dialog, username: String, email: String, password: String, agreement: Boolean, reason: String? ) -> Unit ) : View.OnClickListener { companion object { // private val log = LogCategory("DlgCreateAccount") } @SuppressLint("InflateParams") private val viewRoot = activity.layoutInflater .inflate(R.layout.dlg_account_create, null, false) private val etUserName: EditText = viewRoot.findViewById(R.id.etUserName) private val etEmail: EditText = viewRoot.findViewById(R.id.etEmail) private val etPassword: EditText = viewRoot.findViewById(R.id.etPassword) private val cbAgreement: CheckBox = viewRoot.findViewById(R.id.cbAgreement) private val tvDescription: TextView = viewRoot.findViewById(R.id.tvDescription) private val etReason: EditText = viewRoot.findViewById(R.id.etReason) private val tvReasonCaption: TextView = viewRoot.findViewById(R.id.tvReasonCaption) private val dialog = Dialog(activity) init { viewRoot.findViewById(R.id.tvInstance).text = apiHost.pretty intArrayOf( R.id.btnRules, R.id.btnTerms, R.id.btnCancel, R.id.btnOk ).forEach { viewRoot.findViewById