DroidFS/app/src/main/java/sushi/hardcore/droidfs/adapters/OpenAsDialogAdapter.kt

20 lines
832 B
Kotlin
Raw Normal View History

2020-07-17 16:35:39 +02:00
package sushi.hardcore.droidfs.adapters
import android.content.Context
import sushi.hardcore.droidfs.R
2020-09-05 11:37:47 +02:00
class OpenAsDialogAdapter(context: Context, showOpenWithExternalApp: Boolean) : IconTextDialogAdapter(context) {
2020-10-22 22:14:22 +02:00
private val openAsItems: MutableList<List<Any>> = mutableListOf(
2020-08-05 14:06:54 +02:00
listOf("image", R.string.image, R.drawable.icon_file_image),
listOf("video", R.string.video, R.drawable.icon_file_video),
listOf("audio", R.string.audio, R.drawable.icon_file_audio),
listOf("pdf", R.string.pdf_document, R.drawable.icon_file_pdf),
2020-08-05 14:06:54 +02:00
listOf("text", R.string.text, R.drawable.icon_file_text)
2020-07-17 16:35:39 +02:00
)
2020-08-05 14:06:54 +02:00
init {
2020-09-05 11:37:47 +02:00
if (showOpenWithExternalApp){
openAsItems.add(listOf("external", R.string.external_open, R.drawable.icon_open_in_new))
}
2020-08-05 14:06:54 +02:00
items = openAsItems
2020-07-17 16:35:39 +02:00
}
}