B4A Library [Class] File Explorer with visualization

Hi,

I created this class because I was frustrated by the File Dialog in the (great) Dialogs lib. With that class, you can customize everything (since you have the source code) and add new functions like rename, delete, create folder, etc.
Currently, the class can visualize picture and text files (or not if you set the option to false) when you select them.
You can make multiple selections.

If your activity contains a TabHost, loot at post #7.

Add this permission to the manifest for Android v4+:
AddPermission(android.permission.READ_EXTERNAL_STORAGE)


Since September 1st 2014, this class is completely free.

Enjoy,
Fred
 

Attachments

  • img1.jpg
    img1.jpg
    54.1 KB · Views: 3,550
  • img2.jpg
    img2.jpg
    68 KB · Views: 3,032
  • multi.png
    multi.png
    41.6 KB · Views: 2,835
  • FileExplorer v2.1.zip
    61.2 KB · Views: 2,350
Last edited:

Amalkotey

Active Member
Licensed User
Longtime User
Thank you for publishing this class.
 

Informatix

Expert
Licensed User
Longtime User
I have an annoying problem with ICS. When you type in the EditText at the bottom of the dialog, all letter keys & number keys are redirected to another EditText, under the dialog. What a mess! I don't know how to prevent this. If someone find a way to fix it, or a workaround, please let me know.
 

Informatix

Expert
Licensed User
Longtime User
I found where's the problem. It's a bug in TabHost:
Non-toplevel TabHost (meaning: embedded in another layout) will steal the
focus from an EditText elsewhere in that layout. Upon a keypress, but
before the letter for the depressed key shows up in the EditText -- the focus
jumps back to the first tab.
It's easy to reproduce: put an EditText in a TabHost and open the file explorer. Try to type something. The focus always returns to the underlying EditText, even when you set it to not focusable (with the reflection lib) and disable the TabHost.
I can't see a solution for now. I can only say: avoid TabHosts with this class.
 

Informatix

Expert
Licensed User
Longtime User
Finally, after reading its source code, I found a way to prevent a TabHost from stealing the focus.

B4X:
Dim r as Reflector
r.Target = TabHost1
'0x00060000=FOCUS_BLOCK_DESCENDANTS
r.RunMethod2("setDescendantFocusability", 0x00060000, "java.lang.int")

Back to normal:
B4X:
'0x00040000=FOCUS_AFTER_DESCENDANTS
r.RunMethod2("setDescendantFocusability", 0x00040000, "java.lang.int")
TabHost1.RequestFocus

Happy Fred
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
New version:
- I fixed the bug in mode OnlyFolders
- I added a fourth panel at the bottom to separate the OK button from the list
- Keys are now intercepted properly (TrapKeys is not needed anymore)
- The code is globally more robust
- Suggestions are no longer displayed (thanks to Erel)

See post #1
 
Last edited:

nypaulie

Active Member
Licensed User
Longtime User
Need a location.

In the original post there is the following:
"PS: you need the Reflection lib"

When I tried to compile/run I got a missing library reference error, so how do I find where to locate and reference this lib file? Thanks for helping this noob!
 

nypaulie

Active Member
Licensed User
Longtime User
Originally Posted by nypaulie
In the original post there is the following:
"PS: you need the Reflection lib"
When I tried to compile/run I got a missing library reference error, so how do I find where to locate and reference this lib file? Thanks for helping this noob!
Downloaded the Reflection lib file, unzipped it and put both the jar and xml files into my Librairies directory (and set the path to find them) but still get the error.
 

boastrike

Member
Licensed User
Longtime User
On the IDE screen bottom right. Select the tab libs and check the reflection library to include it in your app. -boa
 

nypaulie

Active Member
Licensed User
Longtime User
On the IDE screen bottom right. Select the tab libs and check the reflection library to include it in your app. -boa
That corner of my IDE was out of view until I resized the window. Duhh... Thank you for this!
 
Top