Android-FilePicker icon indicating copy to clipboard operation
Android-FilePicker copied to clipboard

Pick only mp4 videos

Open jitarun opened this issue 7 years ago • 2 comments

how can i display only mp4 videos. is it possible on this version ?

jitarun avatar Jul 05 '18 12:07 jitarun

To achieve this you'll have to clone the project and import it as a module. Then make minor change to VMDocPicker.kt file (you can find it inside viewmodels directory). Locate the method QueryDocs and replace;

val selection = (MediaStore.Files.FileColumns.MEDIA_TYPE
    + "!="
    + MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE
    + " AND "
    + MediaStore.Files.FileColumns.MEDIA_TYPE
    + "!="
    + MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO)

with...

val selection = (MediaStore.Files.FileColumns.MEDIA_TYPE + "!=" + MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE)

You need to have the following logic somewhere in you project.

FilePickerBuilder.getInstance()
    .setMaxCount(1)
    .setActivityTheme(R.style.FilePickerTheme)
    .addFileSupport("MP4", new String[]{"mp4"})
    .enableDocSupport(false)
    .setActivityTitle(context.getString(R.string.select_video))
    .pickFile((Activity) context, REQUEST_CODE_VIDEO);

Note: You'll be forced to use addFileSupport whenever you want to pick docs.

karimkalunga avatar Dec 22 '20 19:12 karimkalunga