package com.zswc.lookimg.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import com.zswc.lookimg.fragment.ImageDetailFragment
import com.ysnows.base.utils.B
import java.util.*


/**
 *Created by shihuiyun
 *on 2020/9/18
 */
class ImagePagerAdapter(val fm: FragmentManager,val urls: ArrayList<String>) : FragmentStatePagerAdapter(fm){

    override fun getItem(position: Int): Fragment {
        val url = urls[position]

        val fragment = ImageDetailFragment()
         fragment.arguments = B.with()
                .putString("url", url)
                .ok()
        return fragment
    }

    override fun getCount(): Int {
        return urls.size
    }
}
