package com.qimai.android.widget

import android.content.Intent
import android.os.Bundle
import android.view.Gravity
import android.widget.Button
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.qimai.android.widgetlib.popup.QmTipOverlayDrawable
import com.qimai.android.widgetlib.toast.HolderContext
import com.qimai.log.QmLog
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        HolderContext.getInstance().register {
            this
        }

            QmLog.d("test1111","111111")
        findViewById<Button>(R.id.commonPop).setOnClickListener {
            //            ToastUtils.getInstance().showCenter("测试测试")

//            ToastUtils.getInstance().setMsgColor(Color.RED).showTaost("测试出的的")

//            startActivity(Intent(MainActivity@ this, CommomPopActivity::class.java))
//            val loding = Loading()
//            loding.isCancelable  =false
//            loding.show(supportFragmentManager, "loading")

//            TestWindow(this, findViewById<Button>(R.id.commonPop)).build().show()
//            CustomToastUtils.getInstance().success()

        }
        findViewById<LinearLayout>(R.id.ll).background = QmTipOverlayDrawable(
            QmTipOverlayDrawable.Builder()
                .withContext(this)
                .withArrowShow(true)
                .withArrowWeight(0.5f)
                .withGravity(Gravity.TOP)
        )
        keyboard.bindEditText(inputText)
        findViewById<TextView>(R.id.drawer).setOnClickListener {
            startActivity(Intent(MainActivity@ this, CommomPopActivity::class.java))
        }

        findViewById<Button>(R.id.tip).setOnClickListener {
            startActivity(Intent(MainActivity@ this, TipActivity::class.java))

        }

        findViewById<Button>(R.id.topbar).setOnClickListener {
            startActivity(Intent(MainActivity@ this, TopBarActivity::class.java))

        }
        findViewById<Button>(R.id.divide).setOnClickListener {
            startActivity(Intent(MainActivity@ this, GridDividerActivity::class.java))

        }
        keyboard.btnText  = "结账"
        keyboard.invalidate()

    }
}
