package com.remax.visualnovel.widget.imagepicker.views.wrapper

import android.content.Context
import android.view.View
import com.remax.visualnovel.R
import com.remax.visualnovel.databinding.LayoutEpalCropBinding
import com.remax.visualnovel.extension.setOnClick
import com.remax.visualnovel.widget.imagepicker.widget.cropimage.CropImageView
import com.remax.visualnovel.widget.imagepicker.views.base.SingleCropControllerView

/**
 * Created by HJW on 2022/10/24
 */
class SingleCropControllerView(context: Context?) : SingleCropControllerView(context) {

    private var binding: LayoutEpalCropBinding? = null
    private var cropImageView: CropImageView? = null

    override fun getLayoutId(): Int {
        return R.layout.layout_epal_crop
    }

    override fun initView(view: View?) {
        view?.run {
            binding = LayoutEpalCropBinding.bind(this.findViewById(R.id.group))
            binding?.also {
                setOnClick(it.cropBackLayout) {
                    when (this) {
                        it.cropBackLayout -> {
                            onBackPressed()
                        }
                    }

                }
            }
        }
    }

    override fun setStatusBar() {

    }

    override fun getCompleteView(): View? {
        return binding?.cropSaveLayout
    }

    override fun setCropViewParams(cropImageView: CropImageView?, params: MarginLayoutParams?) {
        this.cropImageView = cropImageView
    }
}