storage-chooser icon indicating copy to clipboard operation
storage-chooser copied to clipboard

[BUG] Plus button not show while allowAddFolder(true) set in older Android device.

Open eyesblue opened this issue 4 years ago • 3 comments

Hi, thanks for your great project, it really simple and easy to use.

I like show a directory chooser and allow user create new directory in my app, I modify and test the example code in Xiao Mi A1(Android 9, API level28), it work well, then I create emulator for Android 4.4(API level 19 with Google APIs) and Android 4.1(API level 16 with Google APIs), it not show the plus button in the older version no matter internal or external storage, is the API not support older version?

this is my code:

StorageChooser chooser = new StorageChooser.Builder() .withActivity(StorageManageActivity.this) .withFragmentManager(getFragmentManager()) .withMemoryBar(true) .allowCustomPath(true) .allowAddFolder(true) .setType(StorageChooser.DIRECTORY_CHOOSER) // For pickup folder. .withContent(c) .build();

 chooser.show();

chooser.setOnSelectListener(new StorageChooser.OnSelectListener() { @Override public void onSelect(String path) { Toast.makeText(StorageManageActivity.this, path, Toast.LENGTH_LONG).show(); Log.e("SELECTED_PATH", path); } });


Screenshot_20200101-074138 The Screenshot of Xiao Mi A1, API level 28

Screenshot_1577835640 The Screenshot of Emulator, API level 16 and 19

Smartphone :

  • Device:
  1. Xiao Mi A1(Android 9, API level28), work fine.
  2. Android studio Emulator: 4.4(API level 19 with Google APIs), x86 image.
  3. Android studio Emulator: 4.1(API level 16 with Google APIs), x86 image.

eyesblue avatar Jan 01 '20 00:01 eyesblue

Unfortunately creating directories in external storage requires SAF permission which is not implemented, sorry for not mentioning in the README file that this is not possible.

codekidX avatar Aug 16 '20 14:08 codekidX

The real UI bug is that the plus icon is vector drawable and this need to be added in order for it to work

android { compileSdkVersion 29 defaultConfig { vectorDrawables.useSupportLibrary = true }

The SAF permissions is another, other related problem . . .

stavBodik avatar Oct 13 '20 10:10 stavBodik

@codekidX

Unfortunately creating directories in external storage requires SAF permission which is not implemented, sorry for not mentioning in the README file that this is not possible.

Any way you are right, creating new folder is allowed only in this path : context.getExternalFilesDir(null).getAbsolutePath()

/emulated/0/Android/data/

Even if we add the API 10 request for : android:requestLegacyExternalStorage="true"

stavBodik avatar Oct 13 '20 11:10 stavBodik