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

Hide Tab

Open sandysultan opened this issue 6 years ago • 5 comments

I'm only using it for one file extension (pdf only), how can i hide the file type tabs?

sandysultan avatar Jun 13 '18 10:06 sandysultan

Can't do it with current version. I was also thinking of removing tab if there is only one tab (makes sense for UX). Need more upvotes on this.

DroidNinja avatar Jul 04 '18 06:07 DroidNinja

You can hide the tab bar if you know you'll only ever use the one file extension.

When overriding the themes specified in the README add the following to the PickerTabLayout style

<item name="android:visibility">gone</item>

    <style name="LibAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:colorBackground">@android:color/background_light</item>
        <item name="android:windowBackground">@android:color/white</item>
    </style>

    <style name="PickerTabLayout" parent="Widget.Design.TabLayout">
        <item name="tabBackground">@color/colorPrimary</item>
        <item name="tabGravity">fill</item>
        <item name="tabMaxWidth">0dp</item>
        <item name="android:visibility">gone</item>
    </style>
    
    <style name="SmoothCheckBoxStyle">
        <item name="color_checked">@color/checkbox_color</item>
        <item name="color_unchecked">@android:color/white</item>
        <item name="color_unchecked_stroke">@color/checkbox_unchecked_color</item>
        <item name="color_tick">@android:color/white</item>
    </style>

joejensen8 avatar Jul 17 '18 19:07 joejensen8

please please you should let us have only one extension as well.. like i need only CSV format file to pick up from storage, i don't want my user to select PPT, XLS files etc....

AbdullahSaeed15 avatar Oct 27 '18 20:10 AbdullahSaeed15

The above answer hides the TabLayout for complete FilePicker. But as per my requirement, Sometimes I need only pdf files to be selected and sometimes with all extensions. Please suggest a more better way to hide tabs on condition basis.

Thanks in Advance!!

priyanka-poplify avatar Jan 31 '19 13:01 priyanka-poplify

please please you should let us have only one extension as well.. like i need only CSV format file to pick up from storage, i don't want my user to select PPT, XLS files etc....

I am a little bit late here but still for the future ones... This is how I am able to select a single or specific extension

String[] strings = new String[]{"mp3","aac"};
        FilePickerBuilder.getInstance()
                .enableDocSupport(false)
                .setMaxCount(1)
                .addFileSupport("Audio",strings)
                .setActivityTheme(R.style.PickerTheme)
                .pickFile(this); 

Just make sure that .addFileSupport() should be before .enableDocSupport(false) and then just hide the tab as @joejensen8 mentioined.

kartik1225 avatar May 17 '20 21:05 kartik1225