do not pass the colors in adapter viewholders
This commit is contained in:
parent
326b49e3e0
commit
219f736471
3 changed files with 5 additions and 9 deletions
|
@ -261,7 +261,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
|
||||
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent?.context).inflate(R.layout.directory_item, parent, false)
|
||||
return ViewHolder(view, backgroundColor, foregroundColor, itemClick)
|
||||
return ViewHolder(view, itemClick)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
|
@ -271,7 +271,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
|
||||
override fun getItemCount() = dirs.size
|
||||
|
||||
class ViewHolder(view: View, val backgroundColor: Int, val foregroundColor: Int, val itemClick: (Directory) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
|
||||
class ViewHolder(view: View, val itemClick: (Directory) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
|
||||
fun bindView(activity: SimpleActivity, multiSelectorCallback: ModalMultiSelectorCallback, multiSelector: MultiSelector, directory: Directory, pos: Int, isPinned: Boolean)
|
||||
: View {
|
||||
itemView.dir_name.text = directory.name
|
||||
|
|
|
@ -203,7 +203,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
|||
|
||||
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent?.context).inflate(R.layout.photo_video_item, parent, false)
|
||||
return ViewHolder(view, backgroundColor, foregroundColor, itemClick)
|
||||
return ViewHolder(view, itemClick)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
|
@ -222,7 +222,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
|||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
class ViewHolder(view: View, val backgroundColor: Int, val foregroundColor: Int, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
|
||||
class ViewHolder(view: View, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
|
||||
fun bindView(activity: SimpleActivity, multiSelectorCallback: ModalMultiSelectorCallback, multiSelector: MultiSelector, medium: Medium, pos: Int): View {
|
||||
itemView.play_outline.visibility = if (medium.isVideo) View.VISIBLE else View.GONE
|
||||
itemView.file_name.beVisibleIf(displayFilenames)
|
||||
|
|
|
@ -14,11 +14,7 @@ import com.simplemobiletools.gallery.helpers.MEDIUM
|
|||
import com.simplemobiletools.gallery.models.Medium
|
||||
|
||||
class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val media: MutableList<Medium>) : FragmentStatePagerAdapter(fm) {
|
||||
private val mFragments: SparseArray<ViewPagerFragment>
|
||||
|
||||
init {
|
||||
mFragments = SparseArray<ViewPagerFragment>()
|
||||
}
|
||||
private val mFragments: SparseArray<ViewPagerFragment> = SparseArray<ViewPagerFragment>()
|
||||
|
||||
override fun getCount() = media.size
|
||||
|
||||
|
|
Loading…
Reference in a new issue