2017-04-04 17:42:17 +02:00
|
|
|
package eu.kanade.tachiyomi.widget
|
|
|
|
|
|
|
|
import android.view.ViewGroup
|
2020-01-29 04:47:57 +01:00
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
2017-04-04 17:42:17 +02:00
|
|
|
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-03 04:22:54 +01:00
|
|
|
import eu.kanade.tachiyomi.util.view.inflate
|
2017-04-04 17:42:17 +02:00
|
|
|
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-08 01:20:08 +01:00
|
|
|
return when (viewType) {
|
2017-04-04 17:42:17 +02:00
|
|
|
LogicHandler.VIEWTYPE_DIR -> {
|
2017-05-25 12:16:58 +02:00
|
|
|
val view = parent.inflate(R.layout.common_listitem_dir)
|
2020-01-08 01:20:08 +01:00
|
|
|
DirViewHolder(view)
|
2017-04-04 17:42:17 +02:00
|
|
|
}
|
2020-01-08 01:20:08 +01:00
|
|
|
else -> super.onCreateViewHolder(parent, viewType)
|
2017-04-04 17:42:17 +02:00
|
|
|
}
|
|
|
|
}
|
2020-01-05 17:29:27 +01:00
|
|
|
}
|