simplify the filepicker adapter
This commit is contained in:
parent
64ca1de0a9
commit
b3b97d094f
3 changed files with 4 additions and 5 deletions
|
@ -37,7 +37,7 @@
|
|||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -15,11 +15,11 @@ import kotlinx.android.synthetic.main.filepicker_list_item.view.*
|
|||
|
||||
class FilepickerItemsAdapter(val context: Context, private val mItems: List<FileDirItem>, val itemClick: (FileDirItem) -> Unit) :
|
||||
RecyclerView.Adapter<FilepickerItemsAdapter.ViewHolder>() {
|
||||
var textColor = 0
|
||||
|
||||
companion object {
|
||||
lateinit var folderDrawable: Drawable
|
||||
lateinit var fileDrawable: Drawable
|
||||
var textColor = 0
|
||||
}
|
||||
|
||||
init {
|
||||
|
@ -32,7 +32,7 @@ class FilepickerItemsAdapter(val context: Context, private val mItems: List<File
|
|||
|
||||
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent?.context).inflate(R.layout.filepicker_list_item, parent, false)
|
||||
return ViewHolder(context, textColor, view, itemClick)
|
||||
return ViewHolder(context, view, itemClick)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
|
@ -41,7 +41,7 @@ class FilepickerItemsAdapter(val context: Context, private val mItems: List<File
|
|||
|
||||
override fun getItemCount() = mItems.size
|
||||
|
||||
class ViewHolder(val context: Context, val textColor: Int, view: View, val itemClick: (FileDirItem) -> (Unit)) : RecyclerView.ViewHolder(view) {
|
||||
class ViewHolder(val context: Context, view: View, val itemClick: (FileDirItem) -> (Unit)) : RecyclerView.ViewHolder(view) {
|
||||
fun bindView(fileDirItem: FileDirItem) {
|
||||
itemView.apply {
|
||||
list_item_name.text = fileDirItem.name
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.commons.samples.activities
|
|||
|
||||
import android.os.Bundle
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||
import com.simplemobiletools.commons.extensions.storeStoragePaths
|
||||
import com.simplemobiletools.commons.samples.R
|
||||
|
||||
|
|
Loading…
Reference in a new issue