package com.quyunshuo.androidbaseframemvvm.common.ui

import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.MotionEvent
import android.view.View
import androidx.viewbinding.ViewBinding
import com.quyunshuo.androidbaseframemvvm.base.mvvm.v.BaseFrameFragment
import com.quyunshuo.androidbaseframemvvm.base.mvvm.vm.BaseViewModel
import com.quyunshuo.androidbaseframemvvm.common.R
import com.quyunshuo.androidbaseframemvvm.common.keyboard.KeyUtils
import com.quyunshuo.androidbaseframemvvm.common.keyboard.KeyboardView
import com.quyunshuo.androidbaseframemvvm.common.util.ToastUtil
import com.quyunshuo.androidbaseframemvvm.common.util.XLogUtil

/**
 * Fragment基类
 *
 * @author Qu Yunshuo
 * @since 8/27/20
 */
abstract class BaseFragment<VB : ViewBinding, VM : BaseViewModel> : BaseFrameFragment<VB, VM>() {
    protected var keyboardView: KeyboardView? = null

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        keyboardView = KeyboardView(mBinding.root.context)
        keyboardView!!.setDefaultUpperCase(true)
        keyboardView!!.setBackgroundResource(R.drawable.key_keyboard_background_shape)
        keyboardView!!.setPadding(16, 24, 16, 24)
//        keyboardView!!.addAllInputView(mBinding.root)可以不加
        KeyUtils.init(activity, keyboardView!!)


        super.onViewCreated(view, savedInstanceState)


    }

    fun addAllKeyboardView(view: View?): KeyboardView {
        keyboardView!!.addAllInputView(view)
        return keyboardView!!
    }

    override fun onDestroyView() {
        keyboardView?.onDestroy()
        super.onDestroyView()
    }



}