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