55
66<img src =" https://jitpack.io/v/maxieds/AndroidFilePickerLight.svg " /><img src =" https://img.shields.io/badge/NOTE%3A-Project%20is%20a%20work%20in%20progress-orange " /><img src =" https://img.shields.io/badge/API%2029%2B-Tested%20on%20Android%2010-yellowgreen " /><img src =" https://badges.frapsoft.com/os/gpl/gpl.svg?v=103 " />
77
8-
98<img src =" https://forthebadge.com/images/badges/made-with-java.svg " /><img src =" https://forthebadge.com/images/badges/powered-by-coffee.svg " /><img src =" https://forthebadge.com/images/badges/built-for-android.svg " />
109
11- <img src =" https://badges.frapsoft.com/os/v2/open-source-175x29.png?v=103 " />
10+ <img src =" https://raw.githubusercontent.com/maxieds/AndroidFileChooserLight/master/Screenshots/ReadmeEmojiBadges/HackerCatEmoji-v1.png " />< img src = " https:// badges.frapsoft.com/os/v2/open-source-175x29.png?v=103" />< img src = " https://raw.githubusercontent.com/maxieds/AndroidFileChooserLight/master/Screenshots/ReadmeEmojiBadges/tRUTH.png " />
1211
1312#### A polite request from the developer
1413
@@ -19,8 +18,6 @@ fellow Android developers alike with a quality code base.
1918It will make me just * so happy* all over if you all that appreciate this source code contribution as much as I have writing it
2019can help me reach out to my first ** 100-star** repository on GitHub.
2120
22- [ ![ HitCount] ( http://hits.dwyl.com/maxieds/AndroidFileChooserLight.svg )] ( http://hits.dwyl.com/maxieds/AndroidFileChooserLight )
23-
2421## About the library
2522
2623A file and directory chooser widget for Android that focuses on presenting an easy to configure lightweight UI.
@@ -65,7 +62,7 @@ library can be included in the client Android application:
6562 in the application * build.gradle* configuration.
6663* Update the project * AndroidManifest.xml* file to extend the documents provider,
6764 request required permissions, and setup some helpful legacy file handling options for devices
68- targeting Android platforms with SDK < 11.
65+ targeting Android platforms with SDK < Android OS 11.
6966
7067Examples of using the library to pick files and directories from client Java code is also
7168included in the detailed documentation in the next section.
@@ -134,7 +131,7 @@ Note that unlike some samples to get other Android libraries up and running, the
134131to the custom `` FileProvider `` implemented by the library. It is sufficient to just use the standardized wrappers
135132to launch a new `` FileChooserActivity `` instance and use the file picker functionality bundled within that interface.
136133
137- ## Sample client Java source code
134+ ## Sample client source code in Java
138135
139136The next examples document basic, advanced, and custom uses of the library in client code.
140137The file chooser instance is launched via a traditional `` startActivityForResult `` call
@@ -161,6 +158,13 @@ the results:
161158 showFileChooserResultsDialog(selectedFilePaths, rteErrorMsg);
162159 }
163160```
161+ The following are the unique `` Intent `` keys that are associated with the returned data (if available):
162+ ``` java
163+ public static final String FILE_PICKER_INTENT_DATA_TYPE_KEY = " FilePickerIntentKey.SelectedIntentDataType" ;
164+ public static final String FILE_PICKER_INTENT_DATA_PAYLOAD_KEY = " FilePickerIntentKey.SelectedIntentDataPayloadList" ;
165+ public static final String FILE_PICKER_EXCEPTION_MESSAGE_KEY = " FilePickerIntentKey.UnexpectedExitMessage" ;
166+ public static final String FILE_PICKER_EXCEPTION_CAUSE_KEY = " FilePickerIntentKey.ExceptionCauseDescKey" ;
167+ ```
164168
165169### Basic usage: Returning a file path selected by the user
166170
@@ -195,7 +199,51 @@ The next options are available to configure the non-display type (e.g., properti
195199file chooser that do not depend on how it looks) properties of the library.
196200These can be set using the `` AndroidFilePickerLight.Builder `` class as follows:
197201``` java
198- /* TODO */
202+ FileChooserBuilder fcBuilderConfig = new FileChooserBuilder .getDirectoryChooserInstance(FileChooserActivity . getInstance())
203+ .allowSelectFileItems()
204+ .allowSelectFolderItems()
205+ .setDisplayUIConfig(CustomThemeBuilder uiCfg) // Reserved for future use (see docs below)
206+ .setActionCode(int activityResultCode)
207+ .setNavigationFoldersList(List<DefaultNavFoldersType > navFoldersList)
208+ .showHidden(boolean enable)
209+ .setSelectMultiple(int maxFileInsts)
210+ .setSelectionMode(SelectionModeType modeType)
211+ .setPickerInitialPath(BaseFolderPathType storageAccessBase)
212+ .setActivityIdleTimeout(long timeoutMillis)
213+ .setExternalFilesProvider(ContentProvider extFileProvider); // Reserved for future use
214+ ```
215+ The relevant `` enum `` types that can be passed as arguments to these methods include the following:
216+ ``` java
217+ public enum SelectionModeType {
218+ SELECT_FILE ,
219+ SELECT_MULTIPLE_FILES ,
220+ SELECT_DIRECTORY_ONLY ,
221+ SELECT_OMNIVORE
222+ }
223+ public enum BaseFolderPathType {
224+ BASE_PATH_TYPE_FILES_DIR ,
225+ BASE_PATH_TYPE_EXTERNAL_FILES_DOWNLOADS ,
226+ BASE_PATH_TYPE_EXTERNAL_FILES_MOVIES ,
227+ BASE_PATH_TYPE_EXTERNAL_FILES_MUSIC ,
228+ BASE_PATH_TYPE_EXTERNAL_FILES_DOCUMENTS ,
229+ BASE_PATH_TYPE_EXTERNAL_FILES_DCIM ,
230+ BASE_PATH_TYPE_EXTERNAL_FILES_PICTURES ,
231+ BASE_PATH_TYPE_EXTERNAL_FILES_SCREENSHOTS ,
232+ BASE_PATH_TYPE_USER_DATA_DIR ,
233+ BASE_PATH_TYPE_MEDIA_STORE ,
234+ BASE_PATH_SECONDARY_STORAGE ,
235+ BASE_PATH_DEFAULT ,
236+ BASE_PATH_EXTERNAL_PROVIDER ;
237+ }
238+ public enum DefaultNavFoldersType {
239+ FOLDER_ROOT_STORAGE (" Root" , R . attr. namedFolderSDCardIcon, BaseFolderPathType . BASE_PATH_DEFAULT ),
240+ FOLDER_PICTURES (" Pictures" , R . attr. namedFolderPicsIcon, BaseFolderPathType . BASE_PATH_TYPE_EXTERNAL_FILES_PICTURES ),
241+ FOLDER_CAMERA (" Camera" , R . attr. namedFolderCameraIcon, BaseFolderPathType . BASE_PATH_TYPE_EXTERNAL_FILES_PICTURES ),
242+ FOLDER_SCREENSHOTS (" Screenshots" , R . attr. namedFolderScreenshotsIcon, BaseFolderPathType . BASE_PATH_TYPE_EXTERNAL_FILES_SCREENSHOTS ),
243+ FOLDER_DOWNLOADS (" Downloads" , R . attr. namedFolderDownloadsIcon, BaseFolderPathType . BASE_PATH_TYPE_EXTERNAL_FILES_DOWNLOADS ),
244+ FOLDER_USER_HOME (" Home" , R . attr. namedFolderUserHomeIcon, BaseFolderPathType . BASE_PATH_TYPE_USER_DATA_DIR ),
245+ FOLDER_MEDIA_VIDEO (" Media" , R . attr. namedFolderMediaIcon, BaseFolderPathType . BASE_PATH_TYPE_EXTERNAL_FILES_DCIM );
246+ }
199247```
200248
201249### Extending file types for filtering and sorting purposes in the picker UI
@@ -249,7 +297,6 @@ Here is an example of how to utilize these customized classes with the library's
249297``` java
250298FileChooserBuilder fcConfig = new FileChooserBuilder ();
251299fcConfig. setFilesListSortCompareFunction(FileFilter . FileItemsSortFunc );
252- // TODO
253300
254301// Some defaults for convenience:
255302fcConfig. filterByDefaultFileTypes(List<DefaultFileTypes > fileTypesList, boolean includeExcludeInList);
@@ -263,7 +310,7 @@ This part of the library, while a primary motivator for writing it and a key fea
263310is still under active development. I will add in documentation showing how to customize the file
264311picker themes (color schemes, icons, and other properties) as they become ready to use.
265312
266- #### Basic example (quickstart guide to using the file picker library)
313+ #### Basic example (quickstart guide to using the file picker library styling options )
267314
268315#### Full example (detailed usage of the current custom theme/UI display options)
269316
@@ -299,25 +346,28 @@ here is the full listing and type specs for what attributes can actually be chan
299346
300347### Misc other useful utilities and customizations bundled with the main library
301348
302- ### Displaying a visual linear bar style progress bar for slow directory loads (TODO)
349+ #### Displaying a visual linear bar style progress bar for slow directory loads
303350
304351This functionality may be useful at some point for those willing to extend this code with
305352custom external file providers, e.g., to read and recurse into directories on Dropbox or GitHub.
306353I have a simple visual Toast-like display that can be updated and/or canceled in real time to
307354let the user know that the directory is loading and that the client application is just "thinking"
308- (as opposed to freezing with a runtime error).
355+ (as opposed to freezing with an inexplicable runtime error).
309356
310- To invoke this progress bar display in realtime, consider calling the following code examples:
357+ To invoke this progress bar display in realtime, consider calling the following
358+ [ code examples] ( https://github.com/maxieds/AndroidFileChooserLight/blob/master/AndroidFilePickerLightLibrary/src/main/java/com/maxieds/androidfilepickerlightlibrary/DisplayUtils.java#L159 ) :
311359``` java
312- DisplayUtils . DisplayProgressBar(String waitingOnProcessLabel , int curPos, int totalPos);
360+ DisplayUtils . DisplayProgressBar(Activity activityInstInput, String thingsName , int curPos, int totalPos);
313361DisplayUtils . EnableProgressBarDisplay(true );
314362// ... Then whenever the long process completes, kill the progress bar update callbacks with: ...
315- DisplayUtils . EnableProgressBarDisplay(true );
363+ DisplayUtils . EnableProgressBarDisplay(false );
316364```
317365In principle, the status bar is useful when the underlying operation takes longer than, say 8-10 seconds to complete.
318366This code is modified from a status timer to keep the user informed while scanning for a long duration read of
319367NFC tags on Android (see [ the MFCToolLibrary] ( https://github.com/maxieds/MifareClassicToolLibrary ) and
320368its demo application). The core of the progress bar is
321- shown by periodically posting Toast messages with a custom layout `` View `` . Please post a new issue message
322- if anyone using this library in their own application finds this useful, or amusing too.
369+ shown by periodically posting Toast messages with a custom layout `` View `` .
370+ ** Please do post a new issue message
371+ if anyone using this library in their own application finds this useful, or amusing too
372+ (input and feedback from other humans is good, in general).**
323373
0 commit comments