package com.zswc.lookimg.fragment

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import com.github.chrisbanes.photoview.PhotoViewAttacher
import com.quansu.lookimg.databinding.FragmentImagedetailBinding
import com.zswc.lookimg.vmodel.ImageDetailVModel
import com.ysnows.base.base.BFragment
import com.ysnows.base.inter.IUser

/**
 *Created by shihuiyun
 *on 2020/9/18
 */
class ImageDetailFragment : BFragment<ImageDetailVModel, FragmentImagedetailBinding>(){

    var url=""
    override fun __before(savedInstanceState: Bundle?) {
        super.__before(savedInstanceState)
        url = arguments?.getString("url")!!
    }


    override fun init(savedInstanceState: Bundle?) {
        super.init(savedInstanceState)
        Log.e("-shy-", "url=: $url")
        vm.url.value=url
        initImg()
    }


    private fun initImg(){

        var mAttacher= PhotoViewAttacher(binding.image)

//        mAttacher.setOnPhotoTapListener{
//            view, x, y ->
//            (context as Activity).onBackPressed()
//        }

    }



    override fun binding(inflater: LayoutInflater, container: ViewGroup?): FragmentImagedetailBinding {
       return FragmentImagedetailBinding.inflate(inflater)
    }

    override fun vmClass(): Class<ImageDetailVModel> {
        return ImageDetailVModel::class.java
    }


    override fun user(): IUser? {
        TODO("Not yet implemented")
    }
}
