mihon/app/src/main/java/eu/kanade/tachiyomi/widget/CustomLayoutPicker.kt

34 lines
1.2 KiB
Kotlin
Raw Normal View History

package eu.kanade.tachiyomi.widget
import android.view.ViewGroup
2020-01-28 22:47:57 -05:00
import androidx.recyclerview.widget.RecyclerView
import com.nononsenseapps.filepicker.AbstractFilePickerFragment
import com.nononsenseapps.filepicker.FilePickerActivity
import com.nononsenseapps.filepicker.FilePickerFragment
import com.nononsenseapps.filepicker.LogicHandler
import eu.kanade.tachiyomi.R
2020-02-02 22:22:54 -05:00
import eu.kanade.tachiyomi.util.view.inflate
import java.io.File
class CustomLayoutPickerActivity : FilePickerActivity() {
override fun getFragment(startPath: String?, mode: Int, allowMultiple: Boolean, allowCreateDir: Boolean):
AbstractFilePickerFragment<File> {
val fragment = CustomLayoutFilePickerFragment()
fragment.setArgs(startPath, mode, allowMultiple, allowCreateDir)
return fragment
}
}
class CustomLayoutFilePickerFragment : FilePickerFragment() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
2020-01-07 19:20:08 -05:00
return when (viewType) {
LogicHandler.VIEWTYPE_DIR -> {
2017-05-25 06:16:58 -04:00
val view = parent.inflate(R.layout.common_listitem_dir)
2020-01-07 19:20:08 -05:00
DirViewHolder(view)
}
2020-01-07 19:20:08 -05:00
else -> super.onCreateViewHolder(parent, viewType)
}
}
}