|
1 | 1 | # Android-Simple-File-Explorer-Library |
2 | 2 | Simple, Responsive & Easy To Use Library For Android |
| 3 | + |
| 4 | +[](https://jitpack.io/#BalioFVFX/Android-Simple-File-Explorer-Library) |
| 5 | +# INTRODUCTION |
| 6 | +### Showing file explorer in Android has never been easier. |
| 7 | +<br /> |
| 8 | + |
| 9 | +# GETTING STARTED |
| 10 | + |
| 11 | +#### GRADLE SETUP: |
| 12 | +##### Step 1: Add it in your root build.gradle (Project) at the end of repositories |
| 13 | + |
| 14 | +<br /> |
| 15 | + |
| 16 | +``` |
| 17 | + allprojects { |
| 18 | + repositories { |
| 19 | + ... |
| 20 | + maven { url 'https://jitpack.io' } |
| 21 | + } |
| 22 | + } |
| 23 | +``` |
| 24 | +##### Step 2: Add it in your build.gradle (Module:app) |
| 25 | + |
| 26 | +<br/> |
| 27 | + |
| 28 | +``` |
| 29 | + dependencies { |
| 30 | + implementation 'com.github.BalioFVFX:Android-Simple-File-Explorer-Library:1.0.1' |
| 31 | + } |
| 32 | +``` |
| 33 | + |
| 34 | +# USAGE |
| 35 | + |
| 36 | +##### Note: Before showing the file explorer you must ask for "WRITE_EXTERNAL_STORAGE" permission. |
| 37 | + |
| 38 | +<br/> |
| 39 | +#### Showing the file explorer |
| 40 | +``` |
| 41 | +Intent intent = new Intent(CONTEXT, SimpleFileExplorerActivity. |
| 42 | +startActivityForResult(intent, REQUEST_CODE); |
| 43 | +``` |
| 44 | +#### Getting the selected file absolute path |
| 45 | +##### Note: Your activity must override the onActivityResult(); method. |
| 46 | + |
| 47 | +``` |
| 48 | + @Override |
| 49 | + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { |
| 50 | + if(data != null){ |
| 51 | + String selectedAbsolutePath = data.getStringExtra(SimpleFileExplorerActivity.ON_ACTIVITY_RESULT_KEY); |
| 52 | + Toast.makeText(CONTEXT, selectedAbsolutePath, Toast.LENGTH_SHORT).show(); |
| 53 | + } |
| 54 | + } |
| 55 | +``` |
| 56 | + |
| 57 | +<p float="left"> |
| 58 | + <img src="https://i.imgur.com/uX3iFqn.png" width="300" /> |
| 59 | + <img src="https://i.imgur.com/WlVDRIG.png" width="300" /> |
| 60 | +</p> |
| 61 | + |
| 62 | +#### Changing the default icons with your custom drawables |
| 63 | + |
| 64 | +``` |
| 65 | +SimpleFileResources.imageFileId = R.drawable.ic_my_custom_file; |
| 66 | +SimpleFileResources.imageDirectoryId = R.drawable.ic_my_custom_directory; |
| 67 | +``` |
| 68 | + |
| 69 | +##### If you want to use the default icons: |
| 70 | + |
| 71 | +``` |
| 72 | +SimpleFileResources.imageFileId = null; |
| 73 | +SimpleFileResources.imageDirectoryId = null; |
| 74 | +``` |
| 75 | + |
| 76 | +#### END |
| 77 | +##### You are free to use this library however you want. Credit is appreciated but it's not requiered. |
| 78 | +##### Feel free to suggest new features or report problems by opening new issue or contacting me by email. |
| 79 | + |
| 80 | +[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HU65XMSW3YZ5S) |
0 commit comments