Compare commits
145 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
8c88db932f | |
|
|
4c8da7ac45 | |
|
|
e4d4689ff3 | |
|
|
ee07f6c69d | |
|
|
60d9fa3ad8 | |
|
|
d7169ddd85 | |
|
|
02f6ecf4a8 | |
|
|
c771a2adeb | |
|
|
97896e5387 | |
|
|
341272e5ef | |
|
|
c66b3c8ea6 | |
|
|
df7e6cd34d | |
|
|
2c5635e4d1 | |
|
|
ec53246057 | |
|
|
4ab65e90fd | |
|
|
cc5d9fe06a | |
|
|
4419b486ec | |
|
|
e21ad09454 | |
|
|
867b71ba6d | |
|
|
7b4d77d252 | |
|
|
2364dfb58b | |
|
|
770d1282b4 | |
|
|
62be967de8 | |
|
|
2cdfe13357 | |
|
|
6a42d88efb | |
|
|
7870a8fc7d | |
|
|
e17121c143 | |
|
|
bc7755aee1 | |
|
|
f187c04368 | |
|
|
69f9050c3c | |
|
|
a24496b132 | |
|
|
17bab40222 | |
|
|
aba30dc710 | |
|
|
d488178c90 | |
|
|
5404a689ff | |
|
|
e4167c3aab | |
|
|
9918ed541d | |
|
|
ac6e15ce44 | |
|
|
75a0543a62 | |
|
|
77fd80b95e | |
|
|
d759a7b11f | |
|
|
370097f513 | |
|
|
e3aeabdb3d | |
|
|
a42dae4217 | |
|
|
924b0b225c | |
|
|
84af836de1 | |
|
|
d20afa13d2 | |
|
|
9f61fa98f4 | |
|
|
3171e8a01c | |
|
|
e6f4f17862 | |
|
|
41cd5d9a94 | |
|
|
3174cbbe2f | |
|
|
f2b53345c3 | |
|
|
9300ef2409 | |
|
|
3700ee4dea | |
|
|
cf2012fd3c | |
|
|
f6a1c34871 | |
|
|
ba9e7828a7 | |
|
|
df3a924226 | |
|
|
2ad444a425 | |
|
|
5e8dc9136c | |
|
|
b6909adca1 | |
|
|
fc0aed0f85 | |
|
|
d60e28d8c3 | |
|
|
be72b08379 | |
|
|
f9e0f017bf | |
|
|
ff6c4cdbf9 | |
|
|
f5f873b496 | |
|
|
4bcdd24f68 | |
|
|
4a1217af4b | |
|
|
ccab74a8ef | |
|
|
7082354e12 | |
|
|
c2a3234871 | |
|
|
16ac20ddb3 | |
|
|
5074ab5e39 | |
|
|
b8794972e9 | |
|
|
6b8a787436 | |
|
|
2dff30699c | |
|
|
947972869c | |
|
|
34f4768b54 | |
|
|
cc17fc1530 | |
|
|
c9d70351e1 | |
|
|
0e0aab38e5 | |
|
|
c8978a9880 | |
|
|
4080ad60c7 | |
|
|
c7662e24d2 | |
|
|
b48f2d9a02 | |
|
|
82fedcb24b | |
|
|
94af45be96 | |
|
|
c7d71208df | |
|
|
9cc21debcd | |
|
|
19155c77c5 | |
|
|
0a511acb59 | |
|
|
45b73f483d | |
|
|
b5ac6aba2d | |
|
|
b7baea3711 | |
|
|
9880562413 | |
|
|
0351a69858 | |
|
|
c83ad0afc3 | |
|
|
c9cb497a14 | |
|
|
ec3153a6d9 | |
|
|
bc6599e7f5 | |
|
|
00ff27d868 | |
|
|
e9211ff53f | |
|
|
ca0c6aa39a | |
|
|
5df41c2b21 | |
|
|
746409c5d1 | |
|
|
14772ff6d7 | |
|
|
846c5e209e | |
|
|
c4f5d80a74 | |
|
|
b4fb9b5754 | |
|
|
f441c1673c | |
|
|
10be732d92 | |
|
|
25676ceb9a | |
|
|
c71d216e31 | |
|
|
e8d98dc406 | |
|
|
ef45d18ae3 | |
|
|
81b6085731 | |
|
|
eb847de1b9 | |
|
|
e73f636374 | |
|
|
45f2641bb0 | |
|
|
dfef9b0e4e | |
|
|
30d1fa78b6 | |
|
|
bcf59d45c8 | |
|
|
bf35ea60fe | |
|
|
7926060945 | |
|
|
dbe476a8fe | |
|
|
245eba2e7e | |
|
|
6ffc7c278e | |
|
|
14e85727cd | |
|
|
d5a4122277 | |
|
|
eb5479f1d4 | |
|
|
aa53b9091e | |
|
|
de99cd70cf | |
|
|
7bf9d3ab10 | |
|
|
87117ead1b | |
|
|
4091c41e2c | |
|
|
d6157f2df9 | |
|
|
7053c5fa53 | |
|
|
3b2f89343b | |
|
|
7201a2130e | |
|
|
0705e697dc | |
|
|
c0ebf77355 | |
|
|
c64bbc5fef | |
|
|
14e1c586d8 |
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "docs-src/themes/hugo-material-docs"]
|
||||||
|
path = docs-src/themes/hugo-material-docs
|
||||||
|
url = https://github.com/digitalcraftsman/hugo-material-docs.git
|
||||||
33
.travis.yml
|
|
@ -1,27 +1,40 @@
|
||||||
# This allows it to run on faster containers
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
language: android
|
language: android
|
||||||
env:
|
env:
|
||||||
matrix:
|
|
||||||
- ANDROID_SDKS=android-23,sysimg-23 ANDROID_TARGET=android-23 ANDROID_ABI=armeabi-v7a
|
|
||||||
android:
|
android:
|
||||||
components:
|
components:
|
||||||
- platform-tools
|
- platform-tools
|
||||||
- build-tools-23.0.0
|
- tools
|
||||||
|
- build-tools-23.0.2
|
||||||
|
- build-tools-23.0.1
|
||||||
- android-23
|
- android-23
|
||||||
- sys-img-armeabi-v7a-android-23
|
# - sys-img-armeabi-v7a-android-23
|
||||||
- extra-android-support
|
- extra-android-support
|
||||||
- extra-google-m2repository
|
- extra-google-m2repository
|
||||||
- extra-android-m2repository
|
- extra-android-m2repository
|
||||||
|
licenses:
|
||||||
|
- 'android-sdk-license-.+'
|
||||||
|
- 'google-gdk-license-.+'
|
||||||
|
- '.*intel.+'
|
||||||
|
|
||||||
|
before_cache:
|
||||||
|
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.gradle/caches/
|
- $HOME/.gradle/caches/
|
||||||
|
- $HOME/.gradle/wrapper/
|
||||||
|
|
||||||
|
# Emulator Management: Create, Start and Wait
|
||||||
|
#before_script:
|
||||||
|
# x86 requires kvm which is not available on travis containers
|
||||||
|
# - echo no | android create avd --force -n test -t android-23 --abi armeabi-v7a
|
||||||
|
# - emulator -avd test -gpu off -no-audio -no-window &
|
||||||
|
# - android-wait-for-emulator
|
||||||
|
# - adb shell input keyevent 82 &
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- chmod +x gradlew
|
- chmod +x gradlew
|
||||||
# - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
|
|
||||||
# - emulator -avd test -no-skin -no-audio -no-window &
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./gradlew clean build check
|
- ./gradlew build check #testDebugUnitTest connectedDebugAndroidTest
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,259 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
## [3.0.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/3.0.0) (2016-07-03)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.3...3.0.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Select one file with a single click [\#92](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/92) ([rastikw](https://github.com/rastikw))
|
||||||
|
- Add ability to enter a new filename [\#83](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/83) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- Add ability to input filename [\#82](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/82)
|
||||||
|
|
||||||
|
## [2.5.3](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.3) (2016-06-09)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.2...2.5.3)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Add paths to permission and refresh methods [\#85](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/85)
|
||||||
|
- Add FastScroller sample implementation [\#89](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/89) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
- Add a getItem method to FileItemAdapter [\#88](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/88) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Crash while creating folder in dropbox sample [\#76](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/76)
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- Fast Scroll [\#87](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/87)
|
||||||
|
|
||||||
|
## [2.5.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.2) (2016-02-24)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.1...2.5.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Dropbox should show a progress bar when loading [\#74](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/74)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Dropbox sample can crash due to Inconsistent state in RecyclerView [\#75](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/75)
|
||||||
|
- Dropbox sample crash if multiple press on folder [\#73](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/73)
|
||||||
|
- probebly underscore missing [\#63](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/63)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Update README.md [\#68](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/68) ([callmepeanut](https://github.com/callmepeanut))
|
||||||
|
|
||||||
|
## [2.5.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.1) (2016-01-13)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.0...2.5.1)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Change license to MPL [\#66](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/66)
|
||||||
|
|
||||||
|
## [2.5.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.0) (2015-11-08)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.2...2.5.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Add a separator line above OK/Cancel buttons [\#60](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/60)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Hide hidden files in SD card picker by default [\#58](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/58) ([dvrajan](https://github.com/dvrajan))
|
||||||
|
|
||||||
|
## [v2.4.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.2) (2015-09-30)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.1...v2.4.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- lower minSdk [\#54](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/54)
|
||||||
|
- Spacing of filename items [\#52](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/52)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Lowered minSdk to API 9 [\#55](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/55) ([marbat87](https://github.com/marbat87))
|
||||||
|
- Add Video Thumbnail preview and set default theme to light [\#53](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/53) ([alishari](https://github.com/alishari))
|
||||||
|
|
||||||
|
## [v2.4.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.1) (2015-09-14)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.0...v2.4.1)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Update to latest build tools and support library 23.0.1 [\#51](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/51) ([alishari](https://github.com/alishari))
|
||||||
|
|
||||||
|
## [v2.4.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.0) (2015-08-25)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.3.1...v2.4.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Only allow selecting single files \(when EXTRA\_ALLOW\_MULTIPLE is set to false\) [\#48](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/48)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Make click events overridable [\#49](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/49) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
## [v2.3.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.3.1) (2015-08-20)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.3.0...v2.3.1)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- FilePicker cannot be used with non-touchscreen devices [\#44](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/44)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Make list focusable. [\#45](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/45) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
## [v2.3.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.3.0) (2015-08-18)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.3...v2.3.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Make sure to handle Android M's new permission requests [\#24](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/24)
|
||||||
|
|
||||||
|
## [v2.2.3](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.3) (2015-08-04)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.2...v2.2.3)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Enhancement: Allow adding more arguments to FilePickerFragment [\#40](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/40)
|
||||||
|
- Do not override existing arguments [\#41](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/41) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Update travis config to run on faster containers [\#42](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/42) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
## [v2.2.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.2) (2015-08-03)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.1...v2.2.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Dropbox Sync API is deprecated [\#35](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/35)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Ensure toasts don't get queued up [\#39](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/39) ([hcoosthuizen](https://github.com/hcoosthuizen))
|
||||||
|
|
||||||
|
## [v2.2.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.1) (2015-07-17)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2...v2.2.1)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Strange error [\#34](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/34)
|
||||||
|
|
||||||
|
## [v2.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2) (2015-07-13)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.1...v2.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Allow fragment to be used with default action bar [\#32](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/32)
|
||||||
|
- Allow setting of toolbar text colour [\#31](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/31)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Licence [\#29](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/29)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Specifying GPL3 or later [\#30](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/30) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
## [v2.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.1) (2015-05-30)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.5...v2.1)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Make filepicker depend only on EXTRA\_ALLOW\_CREATE\_DIR [\#25](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/25)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Build fails [\#21](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/21)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Mention that start-path is configurable [\#20](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/20) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
## [v2.0.5](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.5) (2015-05-01)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.4...v2.0.5)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Ic\_launcher conflict with app one [\#16](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/16) ([NitroG42](https://github.com/NitroG42))
|
||||||
|
|
||||||
|
## [v2.0.4](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.4) (2015-04-29)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.3...v2.0.4)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Show miniatures for images [\#10](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/10)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Rotation doesn't work [\#15](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/15)
|
||||||
|
|
||||||
|
## [v2.0.3](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.3) (2015-04-28)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.2...v2.0.3)
|
||||||
|
|
||||||
|
## [v2.0.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.2) (2015-04-28)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.0...v2.0.2)
|
||||||
|
|
||||||
|
## [v2.0.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.0) (2015-04-27)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.2.0...v2.0.0)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- crash InBackground thread [\#13](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/13)
|
||||||
|
- Crash on root folders [\#12](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/12)
|
||||||
|
|
||||||
|
## [v1.2.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.2.0) (2015-04-27)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.3...v1.2.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Verify Proguard [\#8](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/8)
|
||||||
|
- Upload the Dropbox sample [\#5](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/5)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Add a Gitter chat badge to README.org [\#11](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/11) ([gitter-badger](https://github.com/gitter-badger))
|
||||||
|
- NPE on empty dir [\#6](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/6) ([arkty](https://github.com/arkty))
|
||||||
|
|
||||||
|
## [v1.1.3](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.3) (2014-04-02)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.2...v1.1.3)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- FilePicker: Handle case if startPath does not exist [\#4](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/4)
|
||||||
|
|
||||||
|
## [v1.1.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.2) (2014-04-02)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.1...v1.1.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Upload to Maven Central [\#3](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/3)
|
||||||
|
|
||||||
|
## [v1.1.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.1) (2014-04-02)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1...v1.1.1)
|
||||||
|
|
||||||
|
## [v1.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1) (2014-04-01)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.0...v1.1)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Add only files option [\#2](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/2)
|
||||||
|
- Make create directory toggleable [\#1](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/1)
|
||||||
|
|
||||||
|
## [v1.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.0) (2014-04-01)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.99...v1.0)
|
||||||
|
|
||||||
|
## [v0.99](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.99) (2014-03-31)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.91...v0.99)
|
||||||
|
|
||||||
|
## [v0.91](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.91) (2014-03-31)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.9...v0.91)
|
||||||
|
|
||||||
|
## [v0.9](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.9) (2014-03-31)
|
||||||
|
|
||||||
|
|
||||||
|
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
||||||
674
COPYING
|
|
@ -1,674 +0,0 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
165
COPYING.LESSER
|
|
@ -1,165 +0,0 @@
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
|
|
||||||
This version of the GNU Lesser General Public License incorporates
|
|
||||||
the terms and conditions of version 3 of the GNU General Public
|
|
||||||
License, supplemented by the additional permissions listed below.
|
|
||||||
|
|
||||||
0. Additional Definitions.
|
|
||||||
|
|
||||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
||||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
||||||
General Public License.
|
|
||||||
|
|
||||||
"The Library" refers to a covered work governed by this License,
|
|
||||||
other than an Application or a Combined Work as defined below.
|
|
||||||
|
|
||||||
An "Application" is any work that makes use of an interface provided
|
|
||||||
by the Library, but which is not otherwise based on the Library.
|
|
||||||
Defining a subclass of a class defined by the Library is deemed a mode
|
|
||||||
of using an interface provided by the Library.
|
|
||||||
|
|
||||||
A "Combined Work" is a work produced by combining or linking an
|
|
||||||
Application with the Library. The particular version of the Library
|
|
||||||
with which the Combined Work was made is also called the "Linked
|
|
||||||
Version".
|
|
||||||
|
|
||||||
The "Minimal Corresponding Source" for a Combined Work means the
|
|
||||||
Corresponding Source for the Combined Work, excluding any source code
|
|
||||||
for portions of the Combined Work that, considered in isolation, are
|
|
||||||
based on the Application, and not on the Linked Version.
|
|
||||||
|
|
||||||
The "Corresponding Application Code" for a Combined Work means the
|
|
||||||
object code and/or source code for the Application, including any data
|
|
||||||
and utility programs needed for reproducing the Combined Work from the
|
|
||||||
Application, but excluding the System Libraries of the Combined Work.
|
|
||||||
|
|
||||||
1. Exception to Section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
You may convey a covered work under sections 3 and 4 of this License
|
|
||||||
without being bound by section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
2. Conveying Modified Versions.
|
|
||||||
|
|
||||||
If you modify a copy of the Library, and, in your modifications, a
|
|
||||||
facility refers to a function or data to be supplied by an Application
|
|
||||||
that uses the facility (other than as an argument passed when the
|
|
||||||
facility is invoked), then you may convey a copy of the modified
|
|
||||||
version:
|
|
||||||
|
|
||||||
a) under this License, provided that you make a good faith effort to
|
|
||||||
ensure that, in the event an Application does not supply the
|
|
||||||
function or data, the facility still operates, and performs
|
|
||||||
whatever part of its purpose remains meaningful, or
|
|
||||||
|
|
||||||
b) under the GNU GPL, with none of the additional permissions of
|
|
||||||
this License applicable to that copy.
|
|
||||||
|
|
||||||
3. Object Code Incorporating Material from Library Header Files.
|
|
||||||
|
|
||||||
The object code form of an Application may incorporate material from
|
|
||||||
a header file that is part of the Library. You may convey such object
|
|
||||||
code under terms of your choice, provided that, if the incorporated
|
|
||||||
material is not limited to numerical parameters, data structure
|
|
||||||
layouts and accessors, or small macros, inline functions and templates
|
|
||||||
(ten or fewer lines in length), you do both of the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the object code that the
|
|
||||||
Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
4. Combined Works.
|
|
||||||
|
|
||||||
You may convey a Combined Work under terms of your choice that,
|
|
||||||
taken together, effectively do not restrict modification of the
|
|
||||||
portions of the Library contained in the Combined Work and reverse
|
|
||||||
engineering for debugging such modifications, if you also do each of
|
|
||||||
the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the Combined Work that
|
|
||||||
the Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
c) For a Combined Work that displays copyright notices during
|
|
||||||
execution, include the copyright notice for the Library among
|
|
||||||
these notices, as well as a reference directing the user to the
|
|
||||||
copies of the GNU GPL and this license document.
|
|
||||||
|
|
||||||
d) Do one of the following:
|
|
||||||
|
|
||||||
0) Convey the Minimal Corresponding Source under the terms of this
|
|
||||||
License, and the Corresponding Application Code in a form
|
|
||||||
suitable for, and under terms that permit, the user to
|
|
||||||
recombine or relink the Application with a modified version of
|
|
||||||
the Linked Version to produce a modified Combined Work, in the
|
|
||||||
manner specified by section 6 of the GNU GPL for conveying
|
|
||||||
Corresponding Source.
|
|
||||||
|
|
||||||
1) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (a) uses at run time
|
|
||||||
a copy of the Library already present on the user's computer
|
|
||||||
system, and (b) will operate properly with a modified version
|
|
||||||
of the Library that is interface-compatible with the Linked
|
|
||||||
Version.
|
|
||||||
|
|
||||||
e) Provide Installation Information, but only if you would otherwise
|
|
||||||
be required to provide such information under section 6 of the
|
|
||||||
GNU GPL, and only to the extent that such information is
|
|
||||||
necessary to install and execute a modified version of the
|
|
||||||
Combined Work produced by recombining or relinking the
|
|
||||||
Application with a modified version of the Linked Version. (If
|
|
||||||
you use option 4d0, the Installation Information must accompany
|
|
||||||
the Minimal Corresponding Source and Corresponding Application
|
|
||||||
Code. If you use option 4d1, you must provide the Installation
|
|
||||||
Information in the manner specified by section 6 of the GNU GPL
|
|
||||||
for conveying Corresponding Source.)
|
|
||||||
|
|
||||||
5. Combined Libraries.
|
|
||||||
|
|
||||||
You may place library facilities that are a work based on the
|
|
||||||
Library side by side in a single library together with other library
|
|
||||||
facilities that are not Applications and are not covered by this
|
|
||||||
License, and convey such a combined library under terms of your
|
|
||||||
choice, if you do both of the following:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work based
|
|
||||||
on the Library, uncombined with any other library facilities,
|
|
||||||
conveyed under the terms of this License.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library that part of it
|
|
||||||
is a work based on the Library, and explaining where to find the
|
|
||||||
accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
6. Revised Versions of the GNU Lesser General Public License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the GNU Lesser General Public License from time to time. Such new
|
|
||||||
versions will be similar in spirit to the present version, but may
|
|
||||||
differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Library as you received it specifies that a certain numbered version
|
|
||||||
of the GNU Lesser General Public License "or any later version"
|
|
||||||
applies to it, you have the option of following the terms and
|
|
||||||
conditions either of that published version or of any later version
|
|
||||||
published by the Free Software Foundation. If the Library as you
|
|
||||||
received it does not specify a version number of the GNU Lesser
|
|
||||||
General Public License, you may choose any version of the GNU Lesser
|
|
||||||
General Public License ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Library as you received it specifies that a proxy can decide
|
|
||||||
whether future versions of the GNU Lesser General Public License shall
|
|
||||||
apply, that proxy's public statement of acceptance of any version is
|
|
||||||
permanent authorization for you to choose that version for the
|
|
||||||
Library.
|
|
||||||
382
LICENSE
|
|
@ -1,13 +1,373 @@
|
||||||
This program is free software: you can redistribute it and/or modify
|
Mozilla Public License Version 2.0
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
==================================
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
1. Definitions
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
--------------
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
1.1. "Contributor"
|
||||||
along with this program, see COPYING.LESSER and COPYING.
|
means each individual or legal entity that creates, contributes to
|
||||||
If not, see <http://www.gnu.org/licenses/>.
|
the creation of, or owns Covered Software.
|
||||||
|
|
||||||
|
1.2. "Contributor Version"
|
||||||
|
means the combination of the Contributions of others (if any) used
|
||||||
|
by a Contributor and that particular Contributor's Contribution.
|
||||||
|
|
||||||
|
1.3. "Contribution"
|
||||||
|
means Covered Software of a particular Contributor.
|
||||||
|
|
||||||
|
1.4. "Covered Software"
|
||||||
|
means Source Code Form to which the initial Contributor has attached
|
||||||
|
the notice in Exhibit A, the Executable Form of such Source Code
|
||||||
|
Form, and Modifications of such Source Code Form, in each case
|
||||||
|
including portions thereof.
|
||||||
|
|
||||||
|
1.5. "Incompatible With Secondary Licenses"
|
||||||
|
means
|
||||||
|
|
||||||
|
(a) that the initial Contributor has attached the notice described
|
||||||
|
in Exhibit B to the Covered Software; or
|
||||||
|
|
||||||
|
(b) that the Covered Software was made available under the terms of
|
||||||
|
version 1.1 or earlier of the License, but not also under the
|
||||||
|
terms of a Secondary License.
|
||||||
|
|
||||||
|
1.6. "Executable Form"
|
||||||
|
means any form of the work other than Source Code Form.
|
||||||
|
|
||||||
|
1.7. "Larger Work"
|
||||||
|
means a work that combines Covered Software with other material, in
|
||||||
|
a separate file or files, that is not Covered Software.
|
||||||
|
|
||||||
|
1.8. "License"
|
||||||
|
means this document.
|
||||||
|
|
||||||
|
1.9. "Licensable"
|
||||||
|
means having the right to grant, to the maximum extent possible,
|
||||||
|
whether at the time of the initial grant or subsequently, any and
|
||||||
|
all of the rights conveyed by this License.
|
||||||
|
|
||||||
|
1.10. "Modifications"
|
||||||
|
means any of the following:
|
||||||
|
|
||||||
|
(a) any file in Source Code Form that results from an addition to,
|
||||||
|
deletion from, or modification of the contents of Covered
|
||||||
|
Software; or
|
||||||
|
|
||||||
|
(b) any new file in Source Code Form that contains any Covered
|
||||||
|
Software.
|
||||||
|
|
||||||
|
1.11. "Patent Claims" of a Contributor
|
||||||
|
means any patent claim(s), including without limitation, method,
|
||||||
|
process, and apparatus claims, in any patent Licensable by such
|
||||||
|
Contributor that would be infringed, but for the grant of the
|
||||||
|
License, by the making, using, selling, offering for sale, having
|
||||||
|
made, import, or transfer of either its Contributions or its
|
||||||
|
Contributor Version.
|
||||||
|
|
||||||
|
1.12. "Secondary License"
|
||||||
|
means either the GNU General Public License, Version 2.0, the GNU
|
||||||
|
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||||
|
Public License, Version 3.0, or any later versions of those
|
||||||
|
licenses.
|
||||||
|
|
||||||
|
1.13. "Source Code Form"
|
||||||
|
means the form of the work preferred for making modifications.
|
||||||
|
|
||||||
|
1.14. "You" (or "Your")
|
||||||
|
means an individual or a legal entity exercising rights under this
|
||||||
|
License. For legal entities, "You" includes any entity that
|
||||||
|
controls, is controlled by, or is under common control with You. For
|
||||||
|
purposes of this definition, "control" means (a) the power, direct
|
||||||
|
or indirect, to cause the direction or management of such entity,
|
||||||
|
whether by contract or otherwise, or (b) ownership of more than
|
||||||
|
fifty percent (50%) of the outstanding shares or beneficial
|
||||||
|
ownership of such entity.
|
||||||
|
|
||||||
|
2. License Grants and Conditions
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
2.1. Grants
|
||||||
|
|
||||||
|
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||||
|
non-exclusive license:
|
||||||
|
|
||||||
|
(a) under intellectual property rights (other than patent or trademark)
|
||||||
|
Licensable by such Contributor to use, reproduce, make available,
|
||||||
|
modify, display, perform, distribute, and otherwise exploit its
|
||||||
|
Contributions, either on an unmodified basis, with Modifications, or
|
||||||
|
as part of a Larger Work; and
|
||||||
|
|
||||||
|
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||||
|
for sale, have made, import, and otherwise transfer either its
|
||||||
|
Contributions or its Contributor Version.
|
||||||
|
|
||||||
|
2.2. Effective Date
|
||||||
|
|
||||||
|
The licenses granted in Section 2.1 with respect to any Contribution
|
||||||
|
become effective for each Contribution on the date the Contributor first
|
||||||
|
distributes such Contribution.
|
||||||
|
|
||||||
|
2.3. Limitations on Grant Scope
|
||||||
|
|
||||||
|
The licenses granted in this Section 2 are the only rights granted under
|
||||||
|
this License. No additional rights or licenses will be implied from the
|
||||||
|
distribution or licensing of Covered Software under this License.
|
||||||
|
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||||
|
Contributor:
|
||||||
|
|
||||||
|
(a) for any code that a Contributor has removed from Covered Software;
|
||||||
|
or
|
||||||
|
|
||||||
|
(b) for infringements caused by: (i) Your and any other third party's
|
||||||
|
modifications of Covered Software, or (ii) the combination of its
|
||||||
|
Contributions with other software (except as part of its Contributor
|
||||||
|
Version); or
|
||||||
|
|
||||||
|
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||||
|
its Contributions.
|
||||||
|
|
||||||
|
This License does not grant any rights in the trademarks, service marks,
|
||||||
|
or logos of any Contributor (except as may be necessary to comply with
|
||||||
|
the notice requirements in Section 3.4).
|
||||||
|
|
||||||
|
2.4. Subsequent Licenses
|
||||||
|
|
||||||
|
No Contributor makes additional grants as a result of Your choice to
|
||||||
|
distribute the Covered Software under a subsequent version of this
|
||||||
|
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||||
|
permitted under the terms of Section 3.3).
|
||||||
|
|
||||||
|
2.5. Representation
|
||||||
|
|
||||||
|
Each Contributor represents that the Contributor believes its
|
||||||
|
Contributions are its original creation(s) or it has sufficient rights
|
||||||
|
to grant the rights to its Contributions conveyed by this License.
|
||||||
|
|
||||||
|
2.6. Fair Use
|
||||||
|
|
||||||
|
This License is not intended to limit any rights You have under
|
||||||
|
applicable copyright doctrines of fair use, fair dealing, or other
|
||||||
|
equivalents.
|
||||||
|
|
||||||
|
2.7. Conditions
|
||||||
|
|
||||||
|
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||||
|
in Section 2.1.
|
||||||
|
|
||||||
|
3. Responsibilities
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
3.1. Distribution of Source Form
|
||||||
|
|
||||||
|
All distribution of Covered Software in Source Code Form, including any
|
||||||
|
Modifications that You create or to which You contribute, must be under
|
||||||
|
the terms of this License. You must inform recipients that the Source
|
||||||
|
Code Form of the Covered Software is governed by the terms of this
|
||||||
|
License, and how they can obtain a copy of this License. You may not
|
||||||
|
attempt to alter or restrict the recipients' rights in the Source Code
|
||||||
|
Form.
|
||||||
|
|
||||||
|
3.2. Distribution of Executable Form
|
||||||
|
|
||||||
|
If You distribute Covered Software in Executable Form then:
|
||||||
|
|
||||||
|
(a) such Covered Software must also be made available in Source Code
|
||||||
|
Form, as described in Section 3.1, and You must inform recipients of
|
||||||
|
the Executable Form how they can obtain a copy of such Source Code
|
||||||
|
Form by reasonable means in a timely manner, at a charge no more
|
||||||
|
than the cost of distribution to the recipient; and
|
||||||
|
|
||||||
|
(b) You may distribute such Executable Form under the terms of this
|
||||||
|
License, or sublicense it under different terms, provided that the
|
||||||
|
license for the Executable Form does not attempt to limit or alter
|
||||||
|
the recipients' rights in the Source Code Form under this License.
|
||||||
|
|
||||||
|
3.3. Distribution of a Larger Work
|
||||||
|
|
||||||
|
You may create and distribute a Larger Work under terms of Your choice,
|
||||||
|
provided that You also comply with the requirements of this License for
|
||||||
|
the Covered Software. If the Larger Work is a combination of Covered
|
||||||
|
Software with a work governed by one or more Secondary Licenses, and the
|
||||||
|
Covered Software is not Incompatible With Secondary Licenses, this
|
||||||
|
License permits You to additionally distribute such Covered Software
|
||||||
|
under the terms of such Secondary License(s), so that the recipient of
|
||||||
|
the Larger Work may, at their option, further distribute the Covered
|
||||||
|
Software under the terms of either this License or such Secondary
|
||||||
|
License(s).
|
||||||
|
|
||||||
|
3.4. Notices
|
||||||
|
|
||||||
|
You may not remove or alter the substance of any license notices
|
||||||
|
(including copyright notices, patent notices, disclaimers of warranty,
|
||||||
|
or limitations of liability) contained within the Source Code Form of
|
||||||
|
the Covered Software, except that You may alter any license notices to
|
||||||
|
the extent required to remedy known factual inaccuracies.
|
||||||
|
|
||||||
|
3.5. Application of Additional Terms
|
||||||
|
|
||||||
|
You may choose to offer, and to charge a fee for, warranty, support,
|
||||||
|
indemnity or liability obligations to one or more recipients of Covered
|
||||||
|
Software. However, You may do so only on Your own behalf, and not on
|
||||||
|
behalf of any Contributor. You must make it absolutely clear that any
|
||||||
|
such warranty, support, indemnity, or liability obligation is offered by
|
||||||
|
You alone, and You hereby agree to indemnify every Contributor for any
|
||||||
|
liability incurred by such Contributor as a result of warranty, support,
|
||||||
|
indemnity or liability terms You offer. You may include additional
|
||||||
|
disclaimers of warranty and limitations of liability specific to any
|
||||||
|
jurisdiction.
|
||||||
|
|
||||||
|
4. Inability to Comply Due to Statute or Regulation
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
If it is impossible for You to comply with any of the terms of this
|
||||||
|
License with respect to some or all of the Covered Software due to
|
||||||
|
statute, judicial order, or regulation then You must: (a) comply with
|
||||||
|
the terms of this License to the maximum extent possible; and (b)
|
||||||
|
describe the limitations and the code they affect. Such description must
|
||||||
|
be placed in a text file included with all distributions of the Covered
|
||||||
|
Software under this License. Except to the extent prohibited by statute
|
||||||
|
or regulation, such description must be sufficiently detailed for a
|
||||||
|
recipient of ordinary skill to be able to understand it.
|
||||||
|
|
||||||
|
5. Termination
|
||||||
|
--------------
|
||||||
|
|
||||||
|
5.1. The rights granted under this License will terminate automatically
|
||||||
|
if You fail to comply with any of its terms. However, if You become
|
||||||
|
compliant, then the rights granted under this License from a particular
|
||||||
|
Contributor are reinstated (a) provisionally, unless and until such
|
||||||
|
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||||
|
ongoing basis, if such Contributor fails to notify You of the
|
||||||
|
non-compliance by some reasonable means prior to 60 days after You have
|
||||||
|
come back into compliance. Moreover, Your grants from a particular
|
||||||
|
Contributor are reinstated on an ongoing basis if such Contributor
|
||||||
|
notifies You of the non-compliance by some reasonable means, this is the
|
||||||
|
first time You have received notice of non-compliance with this License
|
||||||
|
from such Contributor, and You become compliant prior to 30 days after
|
||||||
|
Your receipt of the notice.
|
||||||
|
|
||||||
|
5.2. If You initiate litigation against any entity by asserting a patent
|
||||||
|
infringement claim (excluding declaratory judgment actions,
|
||||||
|
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||||
|
directly or indirectly infringes any patent, then the rights granted to
|
||||||
|
You by any and all Contributors for the Covered Software under Section
|
||||||
|
2.1 of this License shall terminate.
|
||||||
|
|
||||||
|
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||||
|
end user license agreements (excluding distributors and resellers) which
|
||||||
|
have been validly granted by You or Your distributors under this License
|
||||||
|
prior to termination shall survive termination.
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 6. Disclaimer of Warranty *
|
||||||
|
* ------------------------- *
|
||||||
|
* *
|
||||||
|
* Covered Software is provided under this License on an "as is" *
|
||||||
|
* basis, without warranty of any kind, either expressed, implied, or *
|
||||||
|
* statutory, including, without limitation, warranties that the *
|
||||||
|
* Covered Software is free of defects, merchantable, fit for a *
|
||||||
|
* particular purpose or non-infringing. The entire risk as to the *
|
||||||
|
* quality and performance of the Covered Software is with You. *
|
||||||
|
* Should any Covered Software prove defective in any respect, You *
|
||||||
|
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||||
|
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||||
|
* essential part of this License. No use of any Covered Software is *
|
||||||
|
* authorized under this License except under this disclaimer. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 7. Limitation of Liability *
|
||||||
|
* -------------------------- *
|
||||||
|
* *
|
||||||
|
* Under no circumstances and under no legal theory, whether tort *
|
||||||
|
* (including negligence), contract, or otherwise, shall any *
|
||||||
|
* Contributor, or anyone who distributes Covered Software as *
|
||||||
|
* permitted above, be liable to You for any direct, indirect, *
|
||||||
|
* special, incidental, or consequential damages of any character *
|
||||||
|
* including, without limitation, damages for lost profits, loss of *
|
||||||
|
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||||
|
* and all other commercial damages or losses, even if such party *
|
||||||
|
* shall have been informed of the possibility of such damages. This *
|
||||||
|
* limitation of liability shall not apply to liability for death or *
|
||||||
|
* personal injury resulting from such party's negligence to the *
|
||||||
|
* extent applicable law prohibits such limitation. Some *
|
||||||
|
* jurisdictions do not allow the exclusion or limitation of *
|
||||||
|
* incidental or consequential damages, so this exclusion and *
|
||||||
|
* limitation may not apply to You. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
8. Litigation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Any litigation relating to this License may be brought only in the
|
||||||
|
courts of a jurisdiction where the defendant maintains its principal
|
||||||
|
place of business and such litigation shall be governed by laws of that
|
||||||
|
jurisdiction, without reference to its conflict-of-law provisions.
|
||||||
|
Nothing in this Section shall prevent a party's ability to bring
|
||||||
|
cross-claims or counter-claims.
|
||||||
|
|
||||||
|
9. Miscellaneous
|
||||||
|
----------------
|
||||||
|
|
||||||
|
This License represents the complete agreement concerning the subject
|
||||||
|
matter hereof. If any provision of this License is held to be
|
||||||
|
unenforceable, such provision shall be reformed only to the extent
|
||||||
|
necessary to make it enforceable. Any law or regulation which provides
|
||||||
|
that the language of a contract shall be construed against the drafter
|
||||||
|
shall not be used to construe this License against a Contributor.
|
||||||
|
|
||||||
|
10. Versions of the License
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
10.1. New Versions
|
||||||
|
|
||||||
|
Mozilla Foundation is the license steward. Except as provided in Section
|
||||||
|
10.3, no one other than the license steward has the right to modify or
|
||||||
|
publish new versions of this License. Each version will be given a
|
||||||
|
distinguishing version number.
|
||||||
|
|
||||||
|
10.2. Effect of New Versions
|
||||||
|
|
||||||
|
You may distribute the Covered Software under the terms of the version
|
||||||
|
of the License under which You originally received the Covered Software,
|
||||||
|
or under the terms of any subsequent version published by the license
|
||||||
|
steward.
|
||||||
|
|
||||||
|
10.3. Modified Versions
|
||||||
|
|
||||||
|
If you create software not governed by this License, and you want to
|
||||||
|
create a new license for such software, you may create and use a
|
||||||
|
modified version of this License if you rename the license and remove
|
||||||
|
any references to the name of the license steward (except to note that
|
||||||
|
such modified license differs from this License).
|
||||||
|
|
||||||
|
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||||
|
Licenses
|
||||||
|
|
||||||
|
If You choose to distribute Source Code Form that is Incompatible With
|
||||||
|
Secondary Licenses under the terms of this version of the License, the
|
||||||
|
notice described in Exhibit B of this License must be attached.
|
||||||
|
|
||||||
|
Exhibit A - Source Code Form License Notice
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
If it is not possible or desirable to put the notice in a particular
|
||||||
|
file, then You may include the notice in a location (such as a LICENSE
|
||||||
|
file in a relevant directory) where a recipient would be likely to look
|
||||||
|
for such a notice.
|
||||||
|
|
||||||
|
You may add additional accurate notices of copyright ownership.
|
||||||
|
|
||||||
|
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
defined by the Mozilla Public License, v. 2.0.
|
||||||
|
|
|
||||||
20
README.md
|
|
@ -5,6 +5,7 @@
|
||||||
<a href="https://travis-ci.org/spacecowboy/NoNonsense-FilePicker">
|
<a href="https://travis-ci.org/spacecowboy/NoNonsense-FilePicker">
|
||||||
<img src="https://travis-ci.org/spacecowboy/NoNonsense-FilePicker.svg?branch=master">
|
<img src="https://travis-ci.org/spacecowboy/NoNonsense-FilePicker.svg?branch=master">
|
||||||
</a>
|
</a>
|
||||||
|
<a href='https://dependencyci.com/github/spacecowboy/NoNonsense-FilePicker'><img src='https://dependencyci.com/github/spacecowboy/NoNonsense-FilePicker/badge' alt='Dependency Status'/></a>
|
||||||
<a href='https://bintray.com/spacecowboy/maven/com.nononsenseapps%3Afilepicker/_latestVersion'><img src='https://api.bintray.com/packages/spacecowboy/maven/com.nononsenseapps%3Afilepicker/images/download.svg'></a>
|
<a href='https://bintray.com/spacecowboy/maven/com.nononsenseapps%3Afilepicker/_latestVersion'><img src='https://api.bintray.com/packages/spacecowboy/maven/com.nononsenseapps%3Afilepicker/images/download.svg'></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
@ -28,7 +29,7 @@ width="50%"
|
||||||
</img>
|
</img>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
- Extendable for sources other than SD-card (Dropbox, Drive, etc)
|
- Extendable for sources other than SD-card (Dropbox, FTP, Drive, etc)
|
||||||
- Can select multiple items
|
- Can select multiple items
|
||||||
- Select directories or files, or both
|
- Select directories or files, or both
|
||||||
- Create new directories in the picker
|
- Create new directories in the picker
|
||||||
|
|
@ -50,8 +51,8 @@ your own.
|
||||||
The library includes an implementation that allows the user to pick
|
The library includes an implementation that allows the user to pick
|
||||||
files from the SD-card. But the picker could easily be extended to get
|
files from the SD-card. But the picker could easily be extended to get
|
||||||
its file listings from another source, such as Dropbox, FTP, SSH and
|
its file listings from another source, such as Dropbox, FTP, SSH and
|
||||||
so on. The sample app includes an implementation which browses your
|
so on. The sample app includes implementations which browses your
|
||||||
Dropbox.
|
Dropbox and a Linux mirror FTP-server.
|
||||||
|
|
||||||
By inheriting from an Activity, the picker is able to be rendered as
|
By inheriting from an Activity, the picker is able to be rendered as
|
||||||
full screen on small screens and as a dialog on large screens. It does
|
full screen on small screens and as a dialog on large screens. It does
|
||||||
|
|
@ -68,7 +69,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.nononsenseapps:filepicker:2.3.0'
|
compile 'com.nononsenseapps:filepicker:3.0.0'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -112,6 +113,9 @@ you like..
|
||||||
<item name="colorPrimaryDark">@color/primary_dark</item>
|
<item name="colorPrimaryDark">@color/primary_dark</item>
|
||||||
<item name="colorAccent">@color/accent</item>
|
<item name="colorAccent">@color/accent</item>
|
||||||
|
|
||||||
|
<!-- Setting a divider is entirely optional -->
|
||||||
|
<item name="nnf_list_item_divider">?android:attr/listDivider</item>
|
||||||
|
|
||||||
<!-- Need to set this also to style create folder dialog -->
|
<!-- Need to set this also to style create folder dialog -->
|
||||||
<item name="alertDialogTheme">@style/FilePickerAlertDialogTheme</item>
|
<item name="alertDialogTheme">@style/FilePickerAlertDialogTheme</item>
|
||||||
|
|
||||||
|
|
@ -192,10 +196,10 @@ you can skip the second method.
|
||||||
|
|
||||||
## Want to customize further?
|
## Want to customize further?
|
||||||
|
|
||||||
See some examples in the [Wiki](https://github.com/spacecowboy/NoNonsense-FilePicker/wiki)
|
See some examples in the [Wiki](http://spacecowboy.github.io/NoNonsense-FilePicker/)
|
||||||
|
|
||||||
See the sample project for examples on dark and light themes, and an
|
See the sample project for examples on dark and light themes, and
|
||||||
implementation using Dropbox.
|
implementations using Dropbox and FTP.
|
||||||
|
|
||||||
## Not using Gradle yet?
|
## Not using Gradle yet?
|
||||||
|
|
||||||
|
|
@ -205,4 +209,4 @@ my brief explanation:
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
See [release notes](https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/release-notes.md)
|
See [CHANGELOG](https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/CHANGELOG.md)
|
||||||
|
|
|
||||||
10
build.gradle
|
|
@ -1,13 +1,15 @@
|
||||||
|
/*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:1.2.3'
|
|
||||||
classpath 'com.novoda:bintray-release:0.2.10'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
public
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
.PHONY: help build server server-with-drafts clean all hugo
|
||||||
|
|
||||||
|
examples_src := $(wildcard content/example/*.md)
|
||||||
|
examples := $(patsubst content/example/%.md,../docs/example/%/index.html,$(examples_src))
|
||||||
|
|
||||||
|
help: ## Print this help text
|
||||||
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
||||||
|
server: ## Build and run a local web server
|
||||||
|
hugo server -d ../docs
|
||||||
|
|
||||||
|
server-with-drafts: ## Run hugo server and include drafts
|
||||||
|
hugo server -D -d ../docs
|
||||||
|
|
||||||
|
clean: ## Clean /docs
|
||||||
|
rm -rf ../docs
|
||||||
|
|
||||||
|
hugo: $(examples) ## Build the site and place output in ../docs
|
||||||
|
all: $(examples)
|
||||||
|
|
||||||
|
print: $(examples)
|
||||||
|
echo $?
|
||||||
|
|
||||||
|
../docs/index.html: content/index.md
|
||||||
|
hugo -d ../docs
|
||||||
|
|
||||||
|
../docs/%/index.html: content/%/index.md
|
||||||
|
hugo -d ../docs
|
||||||
|
|
||||||
|
../docs/example/%/index.html: content/example/%.md
|
||||||
|
hugo -d ../docs
|
||||||
|
|
||||||
|
# Catch all is static content
|
||||||
|
../docs/%: static/%
|
||||||
|
hugo -d ../docs
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
+++
|
||||||
|
[menu.main]
|
||||||
|
parent = "Examples"
|
||||||
|
url = "example/"
|
||||||
|
identifier = ""
|
||||||
|
weight = 99
|
||||||
|
+++
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
baseurl = "http://spacecowboy.github.io/NoNonsense-FilePicker/"
|
||||||
|
languageCode = "en-us"
|
||||||
|
title = "NoNonsense FilePicker"
|
||||||
|
theme = "hugo-material-docs"
|
||||||
|
metadataformat = "toml"
|
||||||
|
canonifyurls = true
|
||||||
|
PygmentsCodeFences = true
|
||||||
|
PygmentsStyle = "friendly"
|
||||||
|
PygmentsOptions = ""
|
||||||
|
#pygmentsuseclasses = true # Will use css file in /static/
|
||||||
|
# Enable Google Analytics by entering your tracking id
|
||||||
|
#googleAnalytics = ""
|
||||||
|
|
||||||
|
[params]
|
||||||
|
# General information
|
||||||
|
author = "SpaceCowboy"
|
||||||
|
description = "An extensible and flexible file-picker for Android."
|
||||||
|
copyright = "Released under the Mozilla Public License 2.0"
|
||||||
|
|
||||||
|
# Repository
|
||||||
|
provider = "GitHub"
|
||||||
|
repo_url = "https://github.com/spacecowboy/NoNonsense-FilePicker"
|
||||||
|
|
||||||
|
version = ""
|
||||||
|
logo = ""
|
||||||
|
favicon = ""
|
||||||
|
|
||||||
|
permalink = "#"
|
||||||
|
|
||||||
|
# Custom assets
|
||||||
|
custom_css = []
|
||||||
|
custom_js = []
|
||||||
|
|
||||||
|
# Syntax highlighting theme
|
||||||
|
highlight_css = ""
|
||||||
|
|
||||||
|
[params.palette]
|
||||||
|
primary = "red"
|
||||||
|
accent = "light green"
|
||||||
|
|
||||||
|
[params.font]
|
||||||
|
text = "Roboto"
|
||||||
|
code = "Roboto Mono"
|
||||||
|
|
||||||
|
|
||||||
|
[social]
|
||||||
|
twitter = ""
|
||||||
|
github = "spacecowboy"
|
||||||
|
|
||||||
|
|
||||||
|
[[menu.main]]
|
||||||
|
name = "Readme"
|
||||||
|
url = "readme/"
|
||||||
|
weight = 0
|
||||||
|
|
||||||
|
[[menu.main]]
|
||||||
|
name = "Changelog"
|
||||||
|
url = "changelog/"
|
||||||
|
weight = 10
|
||||||
|
|
||||||
|
[[menu.main]]
|
||||||
|
name = "License"
|
||||||
|
url = "license/"
|
||||||
|
weight = 20
|
||||||
|
|
||||||
|
[[menu.main]]
|
||||||
|
name = "Examples"
|
||||||
|
weight = 30
|
||||||
|
|
||||||
|
[blackfriday]
|
||||||
|
smartypants = true
|
||||||
|
fractions = true
|
||||||
|
smartDashes = true
|
||||||
|
latexDashes = true
|
||||||
|
plainIDAnchors = true
|
||||||
|
|
@ -0,0 +1,263 @@
|
||||||
|
+++
|
||||||
|
date = "2016-07-16T17:06:45+02:00"
|
||||||
|
title = "ChangeLog"
|
||||||
|
|
||||||
|
+++
|
||||||
|
|
||||||
|
## [3.0.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/3.0.0) (2016-07-03)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.3...3.0.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Select one file with a single click [\#92](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/92) ([rastikw](https://github.com/rastikw))
|
||||||
|
- Add ability to enter a new filename [\#83](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/83) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- Add ability to input filename [\#82](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/82)
|
||||||
|
|
||||||
|
## [2.5.3](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.3) (2016-06-09)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.2...2.5.3)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Add paths to permission and refresh methods [\#85](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/85)
|
||||||
|
- Add FastScroller sample implementation [\#89](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/89) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
- Add a getItem method to FileItemAdapter [\#88](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/88) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Crash while creating folder in dropbox sample [\#76](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/76)
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- Fast Scroll [\#87](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/87)
|
||||||
|
|
||||||
|
## [2.5.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.2) (2016-02-24)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.1...2.5.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Dropbox should show a progress bar when loading [\#74](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/74)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Dropbox sample can crash due to Inconsistent state in RecyclerView [\#75](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/75)
|
||||||
|
- Dropbox sample crash if multiple press on folder [\#73](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/73)
|
||||||
|
- probebly underscore missing [\#63](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/63)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Update README.md [\#68](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/68) ([callmepeanut](https://github.com/callmepeanut))
|
||||||
|
|
||||||
|
## [2.5.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.1) (2016-01-13)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.0...2.5.1)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Change license to MPL [\#66](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/66)
|
||||||
|
|
||||||
|
## [2.5.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.0) (2015-11-08)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.2...2.5.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Add a separator line above OK/Cancel buttons [\#60](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/60)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Hide hidden files in SD card picker by default [\#58](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/58) ([dvrajan](https://github.com/dvrajan))
|
||||||
|
|
||||||
|
## [v2.4.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.2) (2015-09-30)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.1...v2.4.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- lower minSdk [\#54](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/54)
|
||||||
|
- Spacing of filename items [\#52](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/52)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Lowered minSdk to API 9 [\#55](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/55) ([marbat87](https://github.com/marbat87))
|
||||||
|
- Add Video Thumbnail preview and set default theme to light [\#53](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/53) ([alishari](https://github.com/alishari))
|
||||||
|
|
||||||
|
## [v2.4.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.1) (2015-09-14)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.0...v2.4.1)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Update to latest build tools and support library 23.0.1 [\#51](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/51) ([alishari](https://github.com/alishari))
|
||||||
|
|
||||||
|
## [v2.4.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.0) (2015-08-25)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.3.1...v2.4.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Only allow selecting single files \(when EXTRA\_ALLOW\_MULTIPLE is set to false\) [\#48](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/48)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Make click events overridable [\#49](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/49) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
## [v2.3.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.3.1) (2015-08-20)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.3.0...v2.3.1)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- FilePicker cannot be used with non-touchscreen devices [\#44](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/44)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Make list focusable. [\#45](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/45) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
## [v2.3.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.3.0) (2015-08-18)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.3...v2.3.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Make sure to handle Android M's new permission requests [\#24](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/24)
|
||||||
|
|
||||||
|
## [v2.2.3](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.3) (2015-08-04)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.2...v2.2.3)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Enhancement: Allow adding more arguments to FilePickerFragment [\#40](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/40)
|
||||||
|
- Do not override existing arguments [\#41](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/41) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Update travis config to run on faster containers [\#42](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/42) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
## [v2.2.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.2) (2015-08-03)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.1...v2.2.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Dropbox Sync API is deprecated [\#35](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/35)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Ensure toasts don't get queued up [\#39](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/39) ([hcoosthuizen](https://github.com/hcoosthuizen))
|
||||||
|
|
||||||
|
## [v2.2.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.1) (2015-07-17)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2...v2.2.1)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Strange error [\#34](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/34)
|
||||||
|
|
||||||
|
## [v2.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2) (2015-07-13)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.1...v2.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Allow fragment to be used with default action bar [\#32](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/32)
|
||||||
|
- Allow setting of toolbar text colour [\#31](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/31)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Licence [\#29](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/29)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Specifying GPL3 or later [\#30](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/30) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
## [v2.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.1) (2015-05-30)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.5...v2.1)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Make filepicker depend only on EXTRA\_ALLOW\_CREATE\_DIR [\#25](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/25)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Build fails [\#21](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/21)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Mention that start-path is configurable [\#20](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/20) ([spacecowboy](https://github.com/spacecowboy))
|
||||||
|
|
||||||
|
## [v2.0.5](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.5) (2015-05-01)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.4...v2.0.5)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Ic\_launcher conflict with app one [\#16](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/16) ([NitroG42](https://github.com/NitroG42))
|
||||||
|
|
||||||
|
## [v2.0.4](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.4) (2015-04-29)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.3...v2.0.4)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Show miniatures for images [\#10](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/10)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Rotation doesn't work [\#15](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/15)
|
||||||
|
|
||||||
|
## [v2.0.3](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.3) (2015-04-28)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.2...v2.0.3)
|
||||||
|
|
||||||
|
## [v2.0.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.2) (2015-04-28)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.0...v2.0.2)
|
||||||
|
|
||||||
|
## [v2.0.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.0) (2015-04-27)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.2.0...v2.0.0)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- crash InBackground thread [\#13](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/13)
|
||||||
|
- Crash on root folders [\#12](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/12)
|
||||||
|
|
||||||
|
## [v1.2.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.2.0) (2015-04-27)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.3...v1.2.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Verify Proguard [\#8](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/8)
|
||||||
|
- Upload the Dropbox sample [\#5](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/5)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Add a Gitter chat badge to README.org [\#11](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/11) ([gitter-badger](https://github.com/gitter-badger))
|
||||||
|
- NPE on empty dir [\#6](https://github.com/spacecowboy/NoNonsense-FilePicker/pull/6) ([arkty](https://github.com/arkty))
|
||||||
|
|
||||||
|
## [v1.1.3](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.3) (2014-04-02)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.2...v1.1.3)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- FilePicker: Handle case if startPath does not exist [\#4](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/4)
|
||||||
|
|
||||||
|
## [v1.1.2](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.2) (2014-04-02)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.1...v1.1.2)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Upload to Maven Central [\#3](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/3)
|
||||||
|
|
||||||
|
## [v1.1.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.1) (2014-04-02)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1...v1.1.1)
|
||||||
|
|
||||||
|
## [v1.1](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1) (2014-04-01)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.0...v1.1)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Add only files option [\#2](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/2)
|
||||||
|
- Make create directory toggleable [\#1](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/1)
|
||||||
|
|
||||||
|
## [v1.0](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.0) (2014-04-01)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.99...v1.0)
|
||||||
|
|
||||||
|
## [v0.99](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.99) (2014-03-31)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.91...v0.99)
|
||||||
|
|
||||||
|
## [v0.91](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.91) (2014-03-31)
|
||||||
|
[Full Changelog](https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.9...v0.91)
|
||||||
|
|
||||||
|
## [v0.9](https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.9) (2014-03-31)
|
||||||
|
|
||||||
|
|
||||||
|
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
||||||
|
|
@ -0,0 +1,177 @@
|
||||||
|
+++
|
||||||
|
date = "2016-07-16T17:21:28+02:00"
|
||||||
|
title = "Custom item layout"
|
||||||
|
|
||||||
|
[menu]
|
||||||
|
[menu.main]
|
||||||
|
identifier = "custom_item_layout"
|
||||||
|
url = "example/custom_item_layout/"
|
||||||
|
parent = "Examples"
|
||||||
|
weight = 20
|
||||||
|
|
||||||
|
+++
|
||||||
|
|
||||||
|
Say you want to browse some files which have really long names. By default, filenames will be cut if they exceed one line in width like `ThisIsAReallyLongFi...`. What if we really wanted it show like in this image?
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The behavior of the text is defined in the listitem layouts:
|
||||||
|
[nnf_filepicker_listitem_checkable](https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/res/layout/nnf_filepicker_listitem_checkable.xml)
|
||||||
|
and
|
||||||
|
[nnf_filepicker_listitem_dir](https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/res/layout/nnf_filepicker_listitem_dir.xml).
|
||||||
|
|
||||||
|
There are two kinds of layouts, one with a checkbox to allow selection, and one without a checkbox. The second one is also used for the special header item `..` though you could of course have a special layout for that if you wanted.
|
||||||
|
|
||||||
|
### Layouts
|
||||||
|
|
||||||
|
Let's create some new layouts which will support longer filenames as follows:
|
||||||
|
|
||||||
|
**longer_listitem_checkable.xml**
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
|
android:minHeight="?android:listPreferredItemHeight"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
||||||
|
<!--suppress AndroidDomInspection -->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_icon"
|
||||||
|
android:layout_width="?android:listPreferredItemHeight"
|
||||||
|
android:layout_height="?android:listPreferredItemHeight"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/nnf_ic_file_folder"
|
||||||
|
android:tint="?attr/colorAccent"
|
||||||
|
android:visibility="visible"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@android:id/text1"
|
||||||
|
style="?android:textAppearanceLarge"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="?android:listPreferredItemHeight"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:maxLines="4"
|
||||||
|
android:padding="8dp"/>
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/checkbox"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
tools:ignore="RtlSymmetry" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
```
|
||||||
|
|
||||||
|
**longer_listitem_dir.xml**
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
|
android:minHeight="?android:listPreferredItemHeight"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
|
||||||
|
<!--suppress AndroidDomInspection -->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_icon"
|
||||||
|
android:layout_width="?android:listPreferredItemHeight"
|
||||||
|
android:layout_height="?android:listPreferredItemHeight"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/nnf_ic_file_folder"
|
||||||
|
android:tint="?attr/colorAccent"
|
||||||
|
android:visibility="visible"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@android:id/text1"
|
||||||
|
style="?android:textAppearanceLarge"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="?android:listPreferredItemHeight"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:maxLines="4"
|
||||||
|
android:padding="8dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that I defined the TextViews to have a maximum of 4 lines (actual number is up to you), and a minimum height of `android:listPreferredItemHeight` (this I recommend, otherwise it looks wonky and off-center). And just be clear, the *ids* of these fields must be `@+id/item_icon`, `@android:id/text1`, and `@+id/checkbox`, or the code WILL crash on you.
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
To use the new layouts, you need to override the `onCreateViewHolder` method in
|
||||||
|
[AbstractFilePickerFragment](https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerFragment.java).
|
||||||
|
|
||||||
|
Since this example will be browsing the SD-card, I will extend from the built-in FilePickerFragment.
|
||||||
|
|
||||||
|
```java
|
||||||
|
public class CustomLayoutFilePickerFragment extends FilePickerFragment {
|
||||||
|
/**
|
||||||
|
* @param parent Containing view
|
||||||
|
* @param viewType which the ViewHolder will contain. Will be one of:
|
||||||
|
* [VIEWTYPE_HEADER, VIEWTYPE_CHECKABLE, VIEWTYPE_DIR]. It is OK, and even expected, to use the same
|
||||||
|
* layout for VIEWTYPE_HEADER and VIEWTYPE_DIR.
|
||||||
|
* @return a view holder for a file or directory (the difference is presence of checkbox).
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
View v;
|
||||||
|
switch (viewType) {
|
||||||
|
case LogicHandler.VIEWTYPE_HEADER:
|
||||||
|
v = LayoutInflater.from(getActivity()).inflate(R.layout.longer_listitem_dir,
|
||||||
|
parent, false);
|
||||||
|
return new HeaderViewHolder(v);
|
||||||
|
case LogicHandler.VIEWTYPE_CHECKABLE:
|
||||||
|
v = LayoutInflater.from(getActivity()).inflate(R.layout.longer_listitem_checkable,
|
||||||
|
parent, false);
|
||||||
|
return new CheckableViewHolder(v);
|
||||||
|
case LogicHandler.VIEWTYPE_DIR:
|
||||||
|
default:
|
||||||
|
v = LayoutInflater.from(getActivity()).inflate(R.layout.longer_listitem_dir,
|
||||||
|
parent, false);
|
||||||
|
return new DirViewHolder(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And as always, to use your custom fragment you need a custom activity which loads it for you:
|
||||||
|
|
||||||
|
```java
|
||||||
|
public class CustomLayoutPickerActivity extends AbstractFilePickerActivity {
|
||||||
|
|
||||||
|
public CustomLayoutPickerActivity() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AbstractFilePickerFragment<File> getFragment(
|
||||||
|
final String startPath, final int mode, final boolean allowMultiple,
|
||||||
|
final boolean allowCreateDir) {
|
||||||
|
// Load our custom fragment here
|
||||||
|
AbstractFilePickerFragment<File> fragment = new CustomLayoutFilePickerFragment();
|
||||||
|
// startPath is allowed to be null. In that case, default folder should be SD-card and not "/"
|
||||||
|
fragment.setArgs(startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
|
||||||
|
mode, allowMultiple, allowCreateDir);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
+++
|
||||||
|
date = "2016-07-16T17:32:07+02:00"
|
||||||
|
title = "Filter based on file extension"
|
||||||
|
|
||||||
|
[menu]
|
||||||
|
[menu.main]
|
||||||
|
identifier = "filter_file_extension"
|
||||||
|
url = "example/filter_file_extension/"
|
||||||
|
parent = "Examples"
|
||||||
|
weight = 10
|
||||||
|
|
||||||
|
+++
|
||||||
|
|
||||||
|
|
||||||
|
By default, the SD-card picker will display all files in alphabetical order. But let's say that your app can only handle a specific type of file, like `.txt`-files. Here's a minimal example which will only display such files.
|
||||||
|
|
||||||
|
First, a convenience method to get the extension of files:
|
||||||
|
|
||||||
|
```java
|
||||||
|
// File extension to filter on, including the initial dot.
|
||||||
|
private static final String EXTENSION = ".txt";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
* @return The file extension. If file has no extension, it returns null.
|
||||||
|
*/
|
||||||
|
private String getExtension(@NonNull File file) {
|
||||||
|
String path = file.getPath();
|
||||||
|
int i = path.lastIndexOf(".");
|
||||||
|
if (i < 0) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return path.substring(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The decision to display files or not is done with the `isItemVisible` method. Just add a check for the file-extension:
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Override
|
||||||
|
protected boolean isItemVisible(final File file) {
|
||||||
|
// simplified behavior (see below full code)
|
||||||
|
// return isDir(file) || (mode == MODE_FILE || mode == MODE_FILE_AND_DIR);
|
||||||
|
if (!isDir(file) && (mode == MODE_FILE || mode == MODE_FILE_AND_DIR)) {
|
||||||
|
String ext = getExtension(file);
|
||||||
|
return ext != null && EXTENSION.equalsIgnoreCase(ext);
|
||||||
|
}
|
||||||
|
return isDir(file);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Before and After
|
||||||
|
<img src="/screenshots/filter_before.png" width="30%" alt="Before"/>
|
||||||
|
<img src="/screenshots/filter_after.png" width="30%" alt="After"/>
|
||||||
|
|
||||||
|
### Full Fragment code
|
||||||
|
|
||||||
|
```java
|
||||||
|
import com.nononsenseapps.filepicker.FilePickerFragment;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class FilteredFilePickerFragment extends FilePickerFragment {
|
||||||
|
|
||||||
|
// File extension to filter on
|
||||||
|
private static final String EXTENSION = ".txt";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
* @return The file extension. If file has no extension, it returns null.
|
||||||
|
*/
|
||||||
|
private String getExtension(@NonNull File file) {
|
||||||
|
String path = file.getPath();
|
||||||
|
int i = path.lastIndexOf(".");
|
||||||
|
if (i < 0) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return path.substring(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isItemVisible(final File file) {
|
||||||
|
boolean ret = super.isItemVisible(file);
|
||||||
|
if (ret && !isDir(file) && (mode == MODE_FILE || mode == MODE_FILE_AND_DIR)) {
|
||||||
|
String ext = getExtension(file);
|
||||||
|
return ext != null && EXTENSION.equalsIgnoreCase(ext);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
+++
|
||||||
|
date = "2016-07-16T17:33:43+02:00"
|
||||||
|
title = "Override the back button"
|
||||||
|
|
||||||
|
[menu]
|
||||||
|
[menu.main]
|
||||||
|
identifier = "override_back_button"
|
||||||
|
url = "example/override_back_button/"
|
||||||
|
parent = "Examples"
|
||||||
|
weight = 70
|
||||||
|
|
||||||
|
+++
|
||||||
|
|
||||||
|
In case you want the back button to navigate the hierarchy instead of
|
||||||
|
instantly exiting the activity, this is one approach you might take.
|
||||||
|
|
||||||
|
## Create an activity which overrides the back button and loads a custom fragment
|
||||||
|
|
||||||
|
```java
|
||||||
|
package com.nononsenseapps.filepicker.examples.backbutton;
|
||||||
|
|
||||||
|
import android.os.Environment;
|
||||||
|
|
||||||
|
import com.nononsenseapps.filepicker.AbstractFilePickerFragment;
|
||||||
|
import com.nononsenseapps.filepicker.FilePickerActivity;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class BackHandlingFilePickerActivity extends FilePickerActivity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Need access to the fragment
|
||||||
|
*/
|
||||||
|
BackHandlingFilePickerFragment currentFragment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a copy of the new fragment and set the variable above.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected AbstractFilePickerFragment<File> getFragment(
|
||||||
|
final String startPath, final int mode, final boolean allowMultiple,
|
||||||
|
final boolean allowDirCreate, final boolean allowExistingFile,
|
||||||
|
final boolean singleClick) {
|
||||||
|
|
||||||
|
// startPath is allowed to be null.
|
||||||
|
// In that case, default folder should be SD-card and not "/"
|
||||||
|
String path = (startPath != null ? startPath
|
||||||
|
: Environment.getExternalStorageDirectory().getPath());
|
||||||
|
|
||||||
|
currentFragment = new BackHandlingFilePickerFragment();
|
||||||
|
currentFragment.setArgs(path, mode, allowMultiple, allowDirCreate,
|
||||||
|
allowExistingFile, singleClick);
|
||||||
|
return currentFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override the back-button.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
// If at top most level, normal behaviour
|
||||||
|
if (currentFragment.isBackTop()) {
|
||||||
|
super.onBackPressed();
|
||||||
|
} else {
|
||||||
|
// Else go up
|
||||||
|
currentFragment.goUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## In your custom fragment, implement the goUp and isBackTop methods
|
||||||
|
|
||||||
|
```java
|
||||||
|
package com.nononsenseapps.filepicker.examples.backbutton;
|
||||||
|
|
||||||
|
import com.nononsenseapps.filepicker.FilePickerFragment;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class BackHandlingFilePickerFragment extends FilePickerFragment {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For consistency, the top level the back button checks against should be the start path.
|
||||||
|
* But it will fall back on /.
|
||||||
|
*/
|
||||||
|
public File getBackTop() {
|
||||||
|
return getPath(getArguments().getString(KEY_START_PATH, "/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the current path is the startpath or /
|
||||||
|
*/
|
||||||
|
public boolean isBackTop() {
|
||||||
|
return 0 == compareFiles(mCurrentPath, getBackTop()) ||
|
||||||
|
0 == compareFiles(mCurrentPath, new File("/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Go up on level, same as pressing on "..".
|
||||||
|
*/
|
||||||
|
public void goUp() {
|
||||||
|
mCurrentPath = getParent(mCurrentPath);
|
||||||
|
mCheckedItems.clear();
|
||||||
|
mCheckedVisibleViewHolders.clear();
|
||||||
|
refresh(mCurrentPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example manifest
|
||||||
|
|
||||||
|
Make sure `android-theme` points to the correct theme.
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.nononsenseapps.filepicker.examples">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<!-- Only needed to create sub directories. -->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/FilePickerTheme">
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".backbutton.BackHandlingFilePickerActivity"
|
||||||
|
android:label="Override back button"
|
||||||
|
android:theme="@style/FilePickerTheme">
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
+++
|
||||||
|
date = "2016-07-16T17:35:01+02:00"
|
||||||
|
title = "Override selection behavior"
|
||||||
|
|
||||||
|
[menu]
|
||||||
|
[menu.main]
|
||||||
|
identifier = "override_selection_behavior"
|
||||||
|
url = "example/override_selection_behavior/"
|
||||||
|
parent = "Examples"
|
||||||
|
weight = 99
|
||||||
|
|
||||||
|
+++
|
||||||
|
|
||||||
|
New in [2.4.0](https://github.com/spacecowboy/NoNonsense-FilePicker/releases/tag/v2.4.0) are overridable methods to handle UI-interactions. The following methods are now available for augmentation:
|
||||||
|
|
||||||
|
- onClickOK, handles ok button.
|
||||||
|
- onClickCancel, handles cancel button.
|
||||||
|
- onClickHeader, handles clicks on "..".
|
||||||
|
- onClickDir, handles clicks on non-selectable items (usually directories).
|
||||||
|
- onLongClickDir, handles long clicks on non-selectable items.
|
||||||
|
- onClickCheckable, handles clicks on selectable items.
|
||||||
|
- onLongClickCheckable, handles long clicks on selectable items.
|
||||||
|
- onClickCheckBox, handles clicks on the checkbox of selectable items.
|
||||||
|
|
||||||
|
Please see the existing implementations before you override any of them.
|
||||||
|
|
||||||
|
## Simple example, make clicks instantly select items
|
||||||
|
|
||||||
|
As asked in [#48](https://github.com/spacecowboy/NoNonsense-FilePicker/issues/48), what if the picker is configured for selecting a single file and you want a click on that to instantly return the result. The default implementation will mark the item as selected, and then the user is required to press the OK button. This small change will make the operation a single click action, returning instantly once the user selects something.
|
||||||
|
|
||||||
|
```java
|
||||||
|
public class SingleFilePickerFragment extends FilePickerFragment {
|
||||||
|
@Override
|
||||||
|
public void onClickCheckable(View v, CheckableViewHolder vh) {
|
||||||
|
if (!allowMultiple) {
|
||||||
|
// Clear is necessary, in case user clicked some checkbox directly
|
||||||
|
mCheckedItems.clear();
|
||||||
|
mCheckedItems.add(vh.file);
|
||||||
|
onClickOk(null);
|
||||||
|
} else {
|
||||||
|
super.onClickCheckable(v, vh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Now the astute reader might wonder, if my filepicker is only going to be used for selecting single files, why not just do:
|
||||||
|
|
||||||
|
```java
|
||||||
|
public void onClickCheckable(View v, CheckableViewHolder vh) {
|
||||||
|
super.onClickCheckable(v, vh);
|
||||||
|
onClickOk(null);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The reason is that the default implementation will animate the checkbox being selected on press. If you are closing the picker directly once the user selects something, you are basically animating something which isn't going to be seen and thus you are wasting (not that much) resources. Better to not animate at all in that case.
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
+++
|
||||||
|
date = "2016-07-16T17:10:46+02:00"
|
||||||
|
title = "Change the sort order"
|
||||||
|
|
||||||
|
[menu]
|
||||||
|
[menu.main]
|
||||||
|
parent = "Examples"
|
||||||
|
identifier = "sortorder"
|
||||||
|
url = "example/sortorder/"
|
||||||
|
weight = 0
|
||||||
|
+++
|
||||||
|
|
||||||
|
By default, the SD-card picker will display all files in alphabetical order. But what if you want a different sort-order?
|
||||||
|
|
||||||
|
You can override the sorting by overriding the `compareFiles`-method:
|
||||||
|
|
||||||
|
```java
|
||||||
|
@Override
|
||||||
|
protected int compareFiles(File lhs, File rhs) {
|
||||||
|
if (lhs.isDirectory() && !rhs.isDirectory()) {
|
||||||
|
return -1;
|
||||||
|
} else if (rhs.isDirectory() && !lhs.isDirectory()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// This was the previous behaviour for all file-file comparisons. Now it's
|
||||||
|
// only done if the files have the same extension, or no extension.
|
||||||
|
else if (getExtension(lhs) != null && getExtension(lhs).equalsIgnoreCase(getExtension(rhs)) ||
|
||||||
|
getExtension(lhs) == null && getExtension(rhs) == null) {
|
||||||
|
return lhs.getName().compareToIgnoreCase(rhs.getName());
|
||||||
|
}
|
||||||
|
// Otherwise, we sort on extension placing files with no extension last.
|
||||||
|
else if (getExtension(lhs) != null && getExtension(rhs) != null) {
|
||||||
|
// Both have extension, just compare extensions
|
||||||
|
return getExtension(lhs).compareToIgnoreCase(getExtension(rhs));
|
||||||
|
} else if (getExtension(lhs) != null) {
|
||||||
|
// Left has extension, place it first
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
// Right has extension, place it first
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Before and After
|
||||||
|
<img src="/screenshots/sorting_before.png" width="30%" alt="Before"/>
|
||||||
|
<img src="/screenshots/sorting_after.png" width="30%" alt="After"/>
|
||||||
|
|
||||||
|
### Full Fragment code
|
||||||
|
|
||||||
|
```java
|
||||||
|
import com.nononsenseapps.filepicker.FilePickerFragment;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class SortedFilePickerFragment extends FilePickerFragment {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
* @return The file extension. If file has no extension, it returns null.
|
||||||
|
*/
|
||||||
|
private String getExtension(@NonNull File file) {
|
||||||
|
String path = file.getPath();
|
||||||
|
int i = path.lastIndexOf(".");
|
||||||
|
if (i < 0) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return path.substring(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two files to determine their relative sort order. This follows the usual
|
||||||
|
* comparison interface. Override to determine your own custom sort order.
|
||||||
|
*
|
||||||
|
* @param lhs File on the "left-hand side"
|
||||||
|
* @param rhs File on the "right-hand side"
|
||||||
|
* @return -1 if if lhs should be placed before rhs, 0 if they are equal,
|
||||||
|
* and 1 if rhs should be placed before lhs
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected int compareFiles(File lhs, File rhs) {
|
||||||
|
if (lhs.isDirectory() && !rhs.isDirectory()) {
|
||||||
|
return -1;
|
||||||
|
} else if (rhs.isDirectory() && !lhs.isDirectory()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// This was the previous behaviour for all file-file comparisons. Now it's
|
||||||
|
// only done if the files have the same extension, or no extension.
|
||||||
|
else if (getExtension(lhs) != null && getExtension(lhs).equalsIgnoreCase(getExtension(rhs)) ||
|
||||||
|
getExtension(lhs) == null && getExtension(rhs) == null) {
|
||||||
|
return lhs.getName().compareToIgnoreCase(rhs.getName());
|
||||||
|
}
|
||||||
|
// Otherwise, we sort on extension placing files with no extension last.
|
||||||
|
else if (getExtension(lhs) != null && getExtension(rhs) != null) {
|
||||||
|
// Both have extension, just compare extensions
|
||||||
|
return getExtension(lhs).compareToIgnoreCase(getExtension(rhs));
|
||||||
|
} else if (getExtension(lhs) != null) {
|
||||||
|
// Left has extension, place it first
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
// Right has extension, place it first
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
+++
|
||||||
|
date = "2016-07-16T17:36:40+02:00"
|
||||||
|
title = "Standalone fragment"
|
||||||
|
|
||||||
|
[menu]
|
||||||
|
[menu.main]
|
||||||
|
identifier = "standalone_fragment"
|
||||||
|
url = "example/standalone_fragment/"
|
||||||
|
parent = "Examples"
|
||||||
|
weight = 99
|
||||||
|
|
||||||
|
+++
|
||||||
|
|
||||||
|
|
||||||
|
To use the fragment together with an existing toolbar/action bar, a few things should be overridden.
|
||||||
|
|
||||||
|
Here's a minimal example where the toolbar is intercepted from being set as the main toolbar. The menu creation is also intercepted and populates the toolbar directly.
|
||||||
|
|
||||||
|
```java
|
||||||
|
public class StandaloneFilePickerFragment extends FilePickerFragment {
|
||||||
|
|
||||||
|
protected Toolbar mToolbar;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setupToolbar(Toolbar toolbar) {
|
||||||
|
// Prevent it from being set as main toolbar by NOT calling super.setupToolbar().
|
||||||
|
mToolbar = toolbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
// Populate the toolbar with the menu items instead of the action bar.
|
||||||
|
mToolbar.inflateMenu(R.menu.picker_actions);
|
||||||
|
|
||||||
|
// Set a menu listener on the toolbar with calls the regular onOptionsItemSelected method.
|
||||||
|
mToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
return onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// This is usually handled in onCreateOptions so do it here instead.
|
||||||
|
MenuItem item = mToolbar.getMenu().findItem(com.nononsenseapps.filepicker.R.id.nnf_action_createdir);
|
||||||
|
item.setVisible(allowCreateDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,220 @@
|
||||||
|
+++
|
||||||
|
date = "2016-07-16T16:42:44+02:00"
|
||||||
|
title = "Readme"
|
||||||
|
type = "index"
|
||||||
|
aliases = ["/readme/"]
|
||||||
|
+++
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img src="/screenshots/Nexus6-picker-dark.png" width="25%"/>
|
||||||
|
|
||||||
|
<img src="/screenshots/Nexus10-picker-light.png" width="60%"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
- Extendable for sources other than SD-card (Dropbox, FTP, Drive, etc)
|
||||||
|
- Can select multiple items
|
||||||
|
- Select directories or files, or both
|
||||||
|
- Create new directories in the picker
|
||||||
|
- Material theme with AppCompat
|
||||||
|
|
||||||
|
## Yet another file picker library?
|
||||||
|
|
||||||
|
I needed a file picker that had two primary properties:
|
||||||
|
|
||||||
|
1. Easy to extend: I needed a file picker that would work for normal
|
||||||
|
files on the SD-card, and also for using the Dropbox API.
|
||||||
|
2. Able to create a directory in the picker.
|
||||||
|
|
||||||
|
This project has both of those qualities. As a bonus, it also scales
|
||||||
|
nicely to work on any phone or tablet. The core is placed in abstract
|
||||||
|
classes, so it is fairly easy to extend the picker to create
|
||||||
|
your own.
|
||||||
|
|
||||||
|
The library includes an implementation that allows the user to pick
|
||||||
|
files from the SD-card. But the picker could easily be extended to get
|
||||||
|
its file listings from another source, such as Dropbox, FTP, SSH and
|
||||||
|
so on. The sample app includes implementations which browses your
|
||||||
|
Dropbox and a Linux mirror FTP-server.
|
||||||
|
|
||||||
|
By inheriting from an Activity, the picker is able to be rendered as
|
||||||
|
full screen on small screens and as a dialog on large screens. It does
|
||||||
|
this through the theme system, so it is very important for the
|
||||||
|
activity to use a correctly configured theme.
|
||||||
|
|
||||||
|
## How to include in your project (with Gradle)
|
||||||
|
|
||||||
|
Just add the dependency to your *build.gradle*:
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile 'com.nononsenseapps:filepicker:3.0.0'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## How to use the included SD-card picker:
|
||||||
|
|
||||||
|
### Include permission in your manifest
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
```
|
||||||
|
|
||||||
|
### Include the file picker activity
|
||||||
|
|
||||||
|
The intent filter is optional depending on your use case. Note that
|
||||||
|
the theme set in the manifest is important.
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<activity
|
||||||
|
android:name="com.nononsenseapps.filepicker.FilePickerActivity"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/FilePickerTheme">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.GET_CONTENT" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configure the theme
|
||||||
|
|
||||||
|
You must **set the theme** on the activity, but you can configure it to
|
||||||
|
match your existing application theme. You can also name it whatever
|
||||||
|
you like..
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- You can also inherit from NNF_BaseTheme.Light -->
|
||||||
|
<style name="FilePickerTheme" parent="NNF_BaseTheme">
|
||||||
|
<!-- Set these to match your theme -->
|
||||||
|
<item name="colorPrimary">@color/primary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/primary_dark</item>
|
||||||
|
<item name="colorAccent">@color/accent</item>
|
||||||
|
|
||||||
|
<!-- Need to set this also to style create folder dialog -->
|
||||||
|
<item name="alertDialogTheme">@style/FilePickerAlertDialogTheme</item>
|
||||||
|
|
||||||
|
<!-- If you want to set a specific toolbar theme, do it here -->
|
||||||
|
<!-- <item name="nnf_toolbarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="FilePickerAlertDialogTheme" parent="Theme.AppCompat.Dialog.Alert">
|
||||||
|
<item name="colorPrimary">@color/primary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/primary_dark</item>
|
||||||
|
<item name="colorAccent">@color/accent</item>
|
||||||
|
</style>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Starting the picker in your app
|
||||||
|
|
||||||
|
```java
|
||||||
|
// This always works
|
||||||
|
Intent i = new Intent(context, FilePickerActivity.class);
|
||||||
|
// This works if you defined the intent filter
|
||||||
|
// Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
|
|
||||||
|
// Set these depending on your use case. These are the defaults.
|
||||||
|
i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
|
||||||
|
i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
|
||||||
|
i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE);
|
||||||
|
|
||||||
|
// Configure initial directory by specifying a String.
|
||||||
|
// You could specify a String like "/storage/emulated/0/", but that can
|
||||||
|
// dangerous. Always use Android's API calls to get paths to the SD-card or
|
||||||
|
// internal memory.
|
||||||
|
i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath());
|
||||||
|
|
||||||
|
startActivityForResult(i, FILE_CODE);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Handling the result
|
||||||
|
|
||||||
|
If you have a minimum requirement of Jelly Bean (API 16) and above,
|
||||||
|
you can skip the second method.
|
||||||
|
|
||||||
|
```java
|
||||||
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (requestCode == FILE_CODE && resultCode == Activity.RESULT_OK) {
|
||||||
|
if (data.getBooleanExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)) {
|
||||||
|
// For JellyBean and above
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
|
ClipData clip = data.getClipData();
|
||||||
|
|
||||||
|
if (clip != null) {
|
||||||
|
for (int i = 0; i < clip.getItemCount(); i++) {
|
||||||
|
Uri uri = clip.getItemAt(i).getUri();
|
||||||
|
// Do something with the URI
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// For Ice Cream Sandwich
|
||||||
|
} else {
|
||||||
|
ArrayList<String> paths = data.getStringArrayListExtra
|
||||||
|
(FilePickerActivity.EXTRA_PATHS);
|
||||||
|
|
||||||
|
if (paths != null) {
|
||||||
|
for (String path: paths) {
|
||||||
|
Uri uri = Uri.parse(path);
|
||||||
|
// Do something with the URI
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Uri uri = data.getData();
|
||||||
|
// Do something with the URI
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Customizing the picker
|
||||||
|
|
||||||
|
Extend `AbstractFilePickerActivity` and implement `getFragment`. It
|
||||||
|
should return an instance of `AbstractFilePickerFragment`. This
|
||||||
|
basically means that the activity is just the same boilerplate with as
|
||||||
|
single line changed (see the sample app's Dropbox example for an
|
||||||
|
activity which actually has to do some extra work):
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Making a custom SD-card picker
|
||||||
|
public class MyPickerActivity extends AbstractFilePickerActivity<File> {
|
||||||
|
|
||||||
|
public MyPickerActivity() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AbstractFilePickerFragment<File> getFragment(
|
||||||
|
final String startPath, final int mode, final boolean allowMultiple,
|
||||||
|
final boolean allowCreateDir) {
|
||||||
|
// Only the fragment in this line needs to be changed
|
||||||
|
AbstractFilePickerFragment<File> fragment = new MyPickerFragment();
|
||||||
|
fragment.setArgs(startPath, mode, allowMultiple, allowCreateDir);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Extend AbstractFilePickerFragment
|
||||||
|
|
||||||
|
Which requires you to implement
|
||||||
|
|
||||||
|
- onNewFolder
|
||||||
|
- isDir
|
||||||
|
- getParent
|
||||||
|
- getPath
|
||||||
|
- getFullPath
|
||||||
|
- getName
|
||||||
|
- getRoot
|
||||||
|
- toUri
|
||||||
|
- getLoader
|
||||||
|
|
||||||
|
If you only want to make a custom SD-card picker, you can instead extend `FilePickerFragment`, and only override the relevant method you want to change.
|
||||||
|
|
||||||
|
See the sample app and the examples for some concrete code.
|
||||||
|
|
@ -0,0 +1,382 @@
|
||||||
|
+++
|
||||||
|
date = "2016-07-16T16:35:07+02:00"
|
||||||
|
title = "License"
|
||||||
|
|
||||||
|
+++
|
||||||
|
Copyright (c) 2016 Jonas Kalderstam <jonas@cowboyprogrammer.org>
|
||||||
|
|
||||||
|
```text
|
||||||
|
Mozilla Public License Version 2.0
|
||||||
|
==================================
|
||||||
|
|
||||||
|
1. Definitions
|
||||||
|
--------------
|
||||||
|
|
||||||
|
1.1. "Contributor"
|
||||||
|
means each individual or legal entity that creates, contributes to
|
||||||
|
the creation of, or owns Covered Software.
|
||||||
|
|
||||||
|
1.2. "Contributor Version"
|
||||||
|
means the combination of the Contributions of others (if any) used
|
||||||
|
by a Contributor and that particular Contributor's Contribution.
|
||||||
|
|
||||||
|
1.3. "Contribution"
|
||||||
|
means Covered Software of a particular Contributor.
|
||||||
|
|
||||||
|
1.4. "Covered Software"
|
||||||
|
means Source Code Form to which the initial Contributor has attached
|
||||||
|
the notice in Exhibit A, the Executable Form of such Source Code
|
||||||
|
Form, and Modifications of such Source Code Form, in each case
|
||||||
|
including portions thereof.
|
||||||
|
|
||||||
|
1.5. "Incompatible With Secondary Licenses"
|
||||||
|
means
|
||||||
|
|
||||||
|
(a) that the initial Contributor has attached the notice described
|
||||||
|
in Exhibit B to the Covered Software; or
|
||||||
|
|
||||||
|
(b) that the Covered Software was made available under the terms of
|
||||||
|
version 1.1 or earlier of the License, but not also under the
|
||||||
|
terms of a Secondary License.
|
||||||
|
|
||||||
|
1.6. "Executable Form"
|
||||||
|
means any form of the work other than Source Code Form.
|
||||||
|
|
||||||
|
1.7. "Larger Work"
|
||||||
|
means a work that combines Covered Software with other material, in
|
||||||
|
a separate file or files, that is not Covered Software.
|
||||||
|
|
||||||
|
1.8. "License"
|
||||||
|
means this document.
|
||||||
|
|
||||||
|
1.9. "Licensable"
|
||||||
|
means having the right to grant, to the maximum extent possible,
|
||||||
|
whether at the time of the initial grant or subsequently, any and
|
||||||
|
all of the rights conveyed by this License.
|
||||||
|
|
||||||
|
1.10. "Modifications"
|
||||||
|
means any of the following:
|
||||||
|
|
||||||
|
(a) any file in Source Code Form that results from an addition to,
|
||||||
|
deletion from, or modification of the contents of Covered
|
||||||
|
Software; or
|
||||||
|
|
||||||
|
(b) any new file in Source Code Form that contains any Covered
|
||||||
|
Software.
|
||||||
|
|
||||||
|
1.11. "Patent Claims" of a Contributor
|
||||||
|
means any patent claim(s), including without limitation, method,
|
||||||
|
process, and apparatus claims, in any patent Licensable by such
|
||||||
|
Contributor that would be infringed, but for the grant of the
|
||||||
|
License, by the making, using, selling, offering for sale, having
|
||||||
|
made, import, or transfer of either its Contributions or its
|
||||||
|
Contributor Version.
|
||||||
|
|
||||||
|
1.12. "Secondary License"
|
||||||
|
means either the GNU General Public License, Version 2.0, the GNU
|
||||||
|
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||||
|
Public License, Version 3.0, or any later versions of those
|
||||||
|
licenses.
|
||||||
|
|
||||||
|
1.13. "Source Code Form"
|
||||||
|
means the form of the work preferred for making modifications.
|
||||||
|
|
||||||
|
1.14. "You" (or "Your")
|
||||||
|
means an individual or a legal entity exercising rights under this
|
||||||
|
License. For legal entities, "You" includes any entity that
|
||||||
|
controls, is controlled by, or is under common control with You. For
|
||||||
|
purposes of this definition, "control" means (a) the power, direct
|
||||||
|
or indirect, to cause the direction or management of such entity,
|
||||||
|
whether by contract or otherwise, or (b) ownership of more than
|
||||||
|
fifty percent (50%) of the outstanding shares or beneficial
|
||||||
|
ownership of such entity.
|
||||||
|
|
||||||
|
2. License Grants and Conditions
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
2.1. Grants
|
||||||
|
|
||||||
|
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||||
|
non-exclusive license:
|
||||||
|
|
||||||
|
(a) under intellectual property rights (other than patent or trademark)
|
||||||
|
Licensable by such Contributor to use, reproduce, make available,
|
||||||
|
modify, display, perform, distribute, and otherwise exploit its
|
||||||
|
Contributions, either on an unmodified basis, with Modifications, or
|
||||||
|
as part of a Larger Work; and
|
||||||
|
|
||||||
|
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||||
|
for sale, have made, import, and otherwise transfer either its
|
||||||
|
Contributions or its Contributor Version.
|
||||||
|
|
||||||
|
2.2. Effective Date
|
||||||
|
|
||||||
|
The licenses granted in Section 2.1 with respect to any Contribution
|
||||||
|
become effective for each Contribution on the date the Contributor first
|
||||||
|
distributes such Contribution.
|
||||||
|
|
||||||
|
2.3. Limitations on Grant Scope
|
||||||
|
|
||||||
|
The licenses granted in this Section 2 are the only rights granted under
|
||||||
|
this License. No additional rights or licenses will be implied from the
|
||||||
|
distribution or licensing of Covered Software under this License.
|
||||||
|
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||||
|
Contributor:
|
||||||
|
|
||||||
|
(a) for any code that a Contributor has removed from Covered Software;
|
||||||
|
or
|
||||||
|
|
||||||
|
(b) for infringements caused by: (i) Your and any other third party's
|
||||||
|
modifications of Covered Software, or (ii) the combination of its
|
||||||
|
Contributions with other software (except as part of its Contributor
|
||||||
|
Version); or
|
||||||
|
|
||||||
|
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||||
|
its Contributions.
|
||||||
|
|
||||||
|
This License does not grant any rights in the trademarks, service marks,
|
||||||
|
or logos of any Contributor (except as may be necessary to comply with
|
||||||
|
the notice requirements in Section 3.4).
|
||||||
|
|
||||||
|
2.4. Subsequent Licenses
|
||||||
|
|
||||||
|
No Contributor makes additional grants as a result of Your choice to
|
||||||
|
distribute the Covered Software under a subsequent version of this
|
||||||
|
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||||
|
permitted under the terms of Section 3.3).
|
||||||
|
|
||||||
|
2.5. Representation
|
||||||
|
|
||||||
|
Each Contributor represents that the Contributor believes its
|
||||||
|
Contributions are its original creation(s) or it has sufficient rights
|
||||||
|
to grant the rights to its Contributions conveyed by this License.
|
||||||
|
|
||||||
|
2.6. Fair Use
|
||||||
|
|
||||||
|
This License is not intended to limit any rights You have under
|
||||||
|
applicable copyright doctrines of fair use, fair dealing, or other
|
||||||
|
equivalents.
|
||||||
|
|
||||||
|
2.7. Conditions
|
||||||
|
|
||||||
|
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||||
|
in Section 2.1.
|
||||||
|
|
||||||
|
3. Responsibilities
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
3.1. Distribution of Source Form
|
||||||
|
|
||||||
|
All distribution of Covered Software in Source Code Form, including any
|
||||||
|
Modifications that You create or to which You contribute, must be under
|
||||||
|
the terms of this License. You must inform recipients that the Source
|
||||||
|
Code Form of the Covered Software is governed by the terms of this
|
||||||
|
License, and how they can obtain a copy of this License. You may not
|
||||||
|
attempt to alter or restrict the recipients' rights in the Source Code
|
||||||
|
Form.
|
||||||
|
|
||||||
|
3.2. Distribution of Executable Form
|
||||||
|
|
||||||
|
If You distribute Covered Software in Executable Form then:
|
||||||
|
|
||||||
|
(a) such Covered Software must also be made available in Source Code
|
||||||
|
Form, as described in Section 3.1, and You must inform recipients of
|
||||||
|
the Executable Form how they can obtain a copy of such Source Code
|
||||||
|
Form by reasonable means in a timely manner, at a charge no more
|
||||||
|
than the cost of distribution to the recipient; and
|
||||||
|
|
||||||
|
(b) You may distribute such Executable Form under the terms of this
|
||||||
|
License, or sublicense it under different terms, provided that the
|
||||||
|
license for the Executable Form does not attempt to limit or alter
|
||||||
|
the recipients' rights in the Source Code Form under this License.
|
||||||
|
|
||||||
|
3.3. Distribution of a Larger Work
|
||||||
|
|
||||||
|
You may create and distribute a Larger Work under terms of Your choice,
|
||||||
|
provided that You also comply with the requirements of this License for
|
||||||
|
the Covered Software. If the Larger Work is a combination of Covered
|
||||||
|
Software with a work governed by one or more Secondary Licenses, and the
|
||||||
|
Covered Software is not Incompatible With Secondary Licenses, this
|
||||||
|
License permits You to additionally distribute such Covered Software
|
||||||
|
under the terms of such Secondary License(s), so that the recipient of
|
||||||
|
the Larger Work may, at their option, further distribute the Covered
|
||||||
|
Software under the terms of either this License or such Secondary
|
||||||
|
License(s).
|
||||||
|
|
||||||
|
3.4. Notices
|
||||||
|
|
||||||
|
You may not remove or alter the substance of any license notices
|
||||||
|
(including copyright notices, patent notices, disclaimers of warranty,
|
||||||
|
or limitations of liability) contained within the Source Code Form of
|
||||||
|
the Covered Software, except that You may alter any license notices to
|
||||||
|
the extent required to remedy known factual inaccuracies.
|
||||||
|
|
||||||
|
3.5. Application of Additional Terms
|
||||||
|
|
||||||
|
You may choose to offer, and to charge a fee for, warranty, support,
|
||||||
|
indemnity or liability obligations to one or more recipients of Covered
|
||||||
|
Software. However, You may do so only on Your own behalf, and not on
|
||||||
|
behalf of any Contributor. You must make it absolutely clear that any
|
||||||
|
such warranty, support, indemnity, or liability obligation is offered by
|
||||||
|
You alone, and You hereby agree to indemnify every Contributor for any
|
||||||
|
liability incurred by such Contributor as a result of warranty, support,
|
||||||
|
indemnity or liability terms You offer. You may include additional
|
||||||
|
disclaimers of warranty and limitations of liability specific to any
|
||||||
|
jurisdiction.
|
||||||
|
|
||||||
|
4. Inability to Comply Due to Statute or Regulation
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
If it is impossible for You to comply with any of the terms of this
|
||||||
|
License with respect to some or all of the Covered Software due to
|
||||||
|
statute, judicial order, or regulation then You must: (a) comply with
|
||||||
|
the terms of this License to the maximum extent possible; and (b)
|
||||||
|
describe the limitations and the code they affect. Such description must
|
||||||
|
be placed in a text file included with all distributions of the Covered
|
||||||
|
Software under this License. Except to the extent prohibited by statute
|
||||||
|
or regulation, such description must be sufficiently detailed for a
|
||||||
|
recipient of ordinary skill to be able to understand it.
|
||||||
|
|
||||||
|
5. Termination
|
||||||
|
--------------
|
||||||
|
|
||||||
|
5.1. The rights granted under this License will terminate automatically
|
||||||
|
if You fail to comply with any of its terms. However, if You become
|
||||||
|
compliant, then the rights granted under this License from a particular
|
||||||
|
Contributor are reinstated (a) provisionally, unless and until such
|
||||||
|
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||||
|
ongoing basis, if such Contributor fails to notify You of the
|
||||||
|
non-compliance by some reasonable means prior to 60 days after You have
|
||||||
|
come back into compliance. Moreover, Your grants from a particular
|
||||||
|
Contributor are reinstated on an ongoing basis if such Contributor
|
||||||
|
notifies You of the non-compliance by some reasonable means, this is the
|
||||||
|
first time You have received notice of non-compliance with this License
|
||||||
|
from such Contributor, and You become compliant prior to 30 days after
|
||||||
|
Your receipt of the notice.
|
||||||
|
|
||||||
|
5.2. If You initiate litigation against any entity by asserting a patent
|
||||||
|
infringement claim (excluding declaratory judgment actions,
|
||||||
|
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||||
|
directly or indirectly infringes any patent, then the rights granted to
|
||||||
|
You by any and all Contributors for the Covered Software under Section
|
||||||
|
2.1 of this License shall terminate.
|
||||||
|
|
||||||
|
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||||
|
end user license agreements (excluding distributors and resellers) which
|
||||||
|
have been validly granted by You or Your distributors under this License
|
||||||
|
prior to termination shall survive termination.
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 6. Disclaimer of Warranty *
|
||||||
|
* ------------------------- *
|
||||||
|
* *
|
||||||
|
* Covered Software is provided under this License on an "as is" *
|
||||||
|
* basis, without warranty of any kind, either expressed, implied, or *
|
||||||
|
* statutory, including, without limitation, warranties that the *
|
||||||
|
* Covered Software is free of defects, merchantable, fit for a *
|
||||||
|
* particular purpose or non-infringing. The entire risk as to the *
|
||||||
|
* quality and performance of the Covered Software is with You. *
|
||||||
|
* Should any Covered Software prove defective in any respect, You *
|
||||||
|
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||||
|
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||||
|
* essential part of this License. No use of any Covered Software is *
|
||||||
|
* authorized under this License except under this disclaimer. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 7. Limitation of Liability *
|
||||||
|
* -------------------------- *
|
||||||
|
* *
|
||||||
|
* Under no circumstances and under no legal theory, whether tort *
|
||||||
|
* (including negligence), contract, or otherwise, shall any *
|
||||||
|
* Contributor, or anyone who distributes Covered Software as *
|
||||||
|
* permitted above, be liable to You for any direct, indirect, *
|
||||||
|
* special, incidental, or consequential damages of any character *
|
||||||
|
* including, without limitation, damages for lost profits, loss of *
|
||||||
|
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||||
|
* and all other commercial damages or losses, even if such party *
|
||||||
|
* shall have been informed of the possibility of such damages. This *
|
||||||
|
* limitation of liability shall not apply to liability for death or *
|
||||||
|
* personal injury resulting from such party's negligence to the *
|
||||||
|
* extent applicable law prohibits such limitation. Some *
|
||||||
|
* jurisdictions do not allow the exclusion or limitation of *
|
||||||
|
* incidental or consequential damages, so this exclusion and *
|
||||||
|
* limitation may not apply to You. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
8. Litigation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Any litigation relating to this License may be brought only in the
|
||||||
|
courts of a jurisdiction where the defendant maintains its principal
|
||||||
|
place of business and such litigation shall be governed by laws of that
|
||||||
|
jurisdiction, without reference to its conflict-of-law provisions.
|
||||||
|
Nothing in this Section shall prevent a party's ability to bring
|
||||||
|
cross-claims or counter-claims.
|
||||||
|
|
||||||
|
9. Miscellaneous
|
||||||
|
----------------
|
||||||
|
|
||||||
|
This License represents the complete agreement concerning the subject
|
||||||
|
matter hereof. If any provision of this License is held to be
|
||||||
|
unenforceable, such provision shall be reformed only to the extent
|
||||||
|
necessary to make it enforceable. Any law or regulation which provides
|
||||||
|
that the language of a contract shall be construed against the drafter
|
||||||
|
shall not be used to construe this License against a Contributor.
|
||||||
|
|
||||||
|
10. Versions of the License
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
10.1. New Versions
|
||||||
|
|
||||||
|
Mozilla Foundation is the license steward. Except as provided in Section
|
||||||
|
10.3, no one other than the license steward has the right to modify or
|
||||||
|
publish new versions of this License. Each version will be given a
|
||||||
|
distinguishing version number.
|
||||||
|
|
||||||
|
10.2. Effect of New Versions
|
||||||
|
|
||||||
|
You may distribute the Covered Software under the terms of the version
|
||||||
|
of the License under which You originally received the Covered Software,
|
||||||
|
or under the terms of any subsequent version published by the license
|
||||||
|
steward.
|
||||||
|
|
||||||
|
10.3. Modified Versions
|
||||||
|
|
||||||
|
If you create software not governed by this License, and you want to
|
||||||
|
create a new license for such software, you may create and use a
|
||||||
|
modified version of this License if you rename the license and remove
|
||||||
|
any references to the name of the license steward (except to note that
|
||||||
|
such modified license differs from this License).
|
||||||
|
|
||||||
|
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||||
|
Licenses
|
||||||
|
|
||||||
|
If You choose to distribute Source Code Form that is Incompatible With
|
||||||
|
Secondary Licenses under the terms of this version of the License, the
|
||||||
|
notice described in Exhibit B of this License must be attached.
|
||||||
|
|
||||||
|
Exhibit A - Source Code Form License Notice
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
If it is not possible or desirable to put the notice in a particular
|
||||||
|
file, then You may include the notice in a location (such as a LICENSE
|
||||||
|
file in a relevant directory) where a recipient would be likely to look
|
||||||
|
for such a notice.
|
||||||
|
|
||||||
|
You may add additional accurate notices of copyright ownership.
|
||||||
|
|
||||||
|
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
defined by the Mozilla Public License, v. 2.0.
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
.codehilite .hll { background-color: #ffffcc }
|
||||||
|
.codehilite .c { color: #60a0b0; font-style: italic } /* Comment */
|
||||||
|
.codehilite .err { border: 1px solid #FF0000 } /* Error */
|
||||||
|
.codehilite .k { color: #007020; font-weight: bold } /* Keyword */
|
||||||
|
.codehilite .o { color: #666666 } /* Operator */
|
||||||
|
.codehilite .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */
|
||||||
|
.codehilite .cp { color: #007020 } /* Comment.Preproc */
|
||||||
|
.codehilite .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */
|
||||||
|
.codehilite .cs { color: #60a0b0; background-color: #fff0f0 } /* Comment.Special */
|
||||||
|
.codehilite .gd { color: #A00000 } /* Generic.Deleted */
|
||||||
|
.codehilite .ge { font-style: italic } /* Generic.Emph */
|
||||||
|
.codehilite .gr { color: #FF0000 } /* Generic.Error */
|
||||||
|
.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
||||||
|
.codehilite .gi { color: #00A000 } /* Generic.Inserted */
|
||||||
|
.codehilite .go { color: #808080 } /* Generic.Output */
|
||||||
|
.codehilite .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
|
||||||
|
.codehilite .gs { font-weight: bold } /* Generic.Strong */
|
||||||
|
.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
||||||
|
.codehilite .gt { color: #0040D0 } /* Generic.Traceback */
|
||||||
|
.codehilite .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
|
||||||
|
.codehilite .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
|
||||||
|
.codehilite .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
|
||||||
|
.codehilite .kp { color: #007020 } /* Keyword.Pseudo */
|
||||||
|
.codehilite .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
|
||||||
|
.codehilite .kt { color: #902000 } /* Keyword.Type */
|
||||||
|
.codehilite .m { color: #40a070 } /* Literal.Number */
|
||||||
|
.codehilite .s { color: #4070a0 } /* Literal.String */
|
||||||
|
.codehilite .na { color: #4070a0 } /* Name.Attribute */
|
||||||
|
.codehilite .nb { color: #007020 } /* Name.Builtin */
|
||||||
|
.codehilite .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
|
||||||
|
.codehilite .no { color: #60add5 } /* Name.Constant */
|
||||||
|
.codehilite .nd { color: #555555; font-weight: bold } /* Name.Decorator */
|
||||||
|
.codehilite .ni { color: #d55537; font-weight: bold } /* Name.Entity */
|
||||||
|
.codehilite .ne { color: #007020 } /* Name.Exception */
|
||||||
|
.codehilite .nf { color: #06287e } /* Name.Function */
|
||||||
|
.codehilite .nl { color: #002070; font-weight: bold } /* Name.Label */
|
||||||
|
.codehilite .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
|
||||||
|
.codehilite .nt { color: #062873; font-weight: bold } /* Name.Tag */
|
||||||
|
.codehilite .nv { color: #bb60d5 } /* Name.Variable */
|
||||||
|
.codehilite .ow { color: #007020; font-weight: bold } /* Operator.Word */
|
||||||
|
.codehilite .w { color: #bbbbbb } /* Text.Whitespace */
|
||||||
|
.codehilite .mf { color: #40a070 } /* Literal.Number.Float */
|
||||||
|
.codehilite .mh { color: #40a070 } /* Literal.Number.Hex */
|
||||||
|
.codehilite .mi { color: #40a070 } /* Literal.Number.Integer */
|
||||||
|
.codehilite .mo { color: #40a070 } /* Literal.Number.Oct */
|
||||||
|
.codehilite .sb { color: #4070a0 } /* Literal.String.Backtick */
|
||||||
|
.codehilite .sc { color: #4070a0 } /* Literal.String.Char */
|
||||||
|
.codehilite .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
|
||||||
|
.codehilite .s2 { color: #4070a0 } /* Literal.String.Double */
|
||||||
|
.codehilite .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
|
||||||
|
.codehilite .sh { color: #4070a0 } /* Literal.String.Heredoc */
|
||||||
|
.codehilite .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
|
||||||
|
.codehilite .sx { color: #c65d09 } /* Literal.String.Other */
|
||||||
|
.codehilite .sr { color: #235388 } /* Literal.String.Regex */
|
||||||
|
.codehilite .s1 { color: #4070a0 } /* Literal.String.Single */
|
||||||
|
.codehilite .ss { color: #517918 } /* Literal.String.Symbol */
|
||||||
|
.codehilite .bp { color: #007020 } /* Name.Builtin.Pseudo */
|
||||||
|
.codehilite .vc { color: #bb60d5 } /* Name.Variable.Class */
|
||||||
|
.codehilite .vg { color: #bb60d5 } /* Name.Variable.Global */
|
||||||
|
.codehilite .vi { color: #bb60d5 } /* Name.Variable.Instance */
|
||||||
|
.codehilite .il { color: #40a070 } /* Literal.Number.Integer.Long */
|
||||||
|
After Width: | Height: | Size: 370 KiB |
|
After Width: | Height: | Size: 370 KiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1134976b4fcaec84c5862460a85eaf207d8566f8
|
||||||
|
|
@ -0,0 +1,831 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<html class="no-js">
|
||||||
|
|
||||||
|
<head lang="en-us">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||||
|
<title>ChangeLog - NoNonsense FilePicker</title>
|
||||||
|
<meta name="generator" content="Hugo 0.16" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="description" content="An extensible and flexible file-picker for Android.">
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
<meta name="author" content="SpaceCowboy">
|
||||||
|
|
||||||
|
|
||||||
|
<meta property="og:url" content="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
<meta property="og:title" content="NoNonsense FilePicker">
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-title" content="NoNonsense FilePicker">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
<link rel="icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Icon';
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?52m981');
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?#iefix52m981')
|
||||||
|
format('embedded-opentype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.woff?52m981')
|
||||||
|
format('woff'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.ttf?52m981')
|
||||||
|
format('truetype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.svg?52m981#icon')
|
||||||
|
format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/application.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/temporary.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/palettes.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/highlight/highlight.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700|Roboto%2bMono">
|
||||||
|
<style>
|
||||||
|
body, input {
|
||||||
|
font-family: 'Roboto', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
pre, code {
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/modernizr.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="palette-primary-red palette-accent-light green">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="backdrop">
|
||||||
|
<div class="backdrop-paper"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-drawer">
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-search">
|
||||||
|
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<nav aria-label="Header">
|
||||||
|
<div class="bar default">
|
||||||
|
<div class="button button-menu" role="button" aria-label="Menu">
|
||||||
|
<label class="toggle-button icon icon-menu" for="toggle-drawer">
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
ChangeLog
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||||||
|
<a href="https://github.com/spacecowboy" title="@spacecowboy on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bar search">
|
||||||
|
<div class="button button-close" role="button" aria-label="Close">
|
||||||
|
<label class="toggle-button icon icon-back" for="toggle-search"></label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="field">
|
||||||
|
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-reset" role="button" aria-label="Search">
|
||||||
|
<button class="toggle-button icon icon-close" id="reset-search"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="drawer">
|
||||||
|
<nav aria-label="Navigation">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker" class="project">
|
||||||
|
<div class="banner">
|
||||||
|
|
||||||
|
<div class="name">
|
||||||
|
<strong>NoNonsense FilePicker </strong>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
spacecowboy/NoNonsense-FilePicker
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<ul class="repo">
|
||||||
|
<li class="repo-download">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||||||
|
<i class="icon icon-download"></i> Download
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="repo-stars">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||||||
|
<i class="icon icon-star"></i> Stars
|
||||||
|
<span class="count">–</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="toc">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Readme" href="http://spacecowboy.github.io/NoNonsense-FilePicker/readme/">
|
||||||
|
|
||||||
|
Readme
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="current" title="Changelog" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<ul id="scrollspy">
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="License" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
License
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="section">Examples</span>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Change the sort order" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
Change the sort order
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Filter based on file extension" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
Filter based on file extension
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Custom item layout" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
Custom item layout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override the back button" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
Override the back button
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override selection behavior" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
Override selection behavior
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Standalone fragment" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
Standalone fragment
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<span class="section">The author</span>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/spacecowboy" target="_blank" title="@spacecowboy on GitHub">
|
||||||
|
@spacecowboy on GitHub
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article class="article">
|
||||||
|
<div class="wrapper">
|
||||||
|
<h1>ChangeLog </h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h2 id="3-0-0-https-github-com-spacecowboy-nononsense-filepicker-tree-3-0-0-2016-07-03"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/3.0.0">3.0.0</a> (2016-07-03)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.3...3.0.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Select one file with a single click <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/92">#92</a> (<a href="https://github.com/rastikw">rastikw</a>)</li>
|
||||||
|
<li>Add ability to enter a new filename <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/83">#83</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Closed issues:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Add ability to input filename <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/82">#82</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="2-5-3-https-github-com-spacecowboy-nononsense-filepicker-tree-2-5-3-2016-06-09"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.3">2.5.3</a> (2016-06-09)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.2...2.5.3">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Add paths to permission and refresh methods <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/85">#85</a></li>
|
||||||
|
<li>Add FastScroller sample implementation <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/89">#89</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
<li>Add a getItem method to FileItemAdapter <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/88">#88</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Crash while creating folder in dropbox sample <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/76">#76</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Closed issues:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Fast Scroll <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/87">#87</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="2-5-2-https-github-com-spacecowboy-nononsense-filepicker-tree-2-5-2-2016-02-24"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.2">2.5.2</a> (2016-02-24)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.1...2.5.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Dropbox should show a progress bar when loading <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/74">#74</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Dropbox sample can crash due to Inconsistent state in RecyclerView <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/75">#75</a></li>
|
||||||
|
<li>Dropbox sample crash if multiple press on folder <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/73">#73</a></li>
|
||||||
|
<li>probebly underscore missing <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/63">#63</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Update README.md <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/68">#68</a> (<a href="https://github.com/callmepeanut">callmepeanut</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="2-5-1-https-github-com-spacecowboy-nononsense-filepicker-tree-2-5-1-2016-01-13"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.1">2.5.1</a> (2016-01-13)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.0...2.5.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Change license to MPL <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/66">#66</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="2-5-0-https-github-com-spacecowboy-nononsense-filepicker-tree-2-5-0-2015-11-08"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.0">2.5.0</a> (2015-11-08)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.2...2.5.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Add a separator line above OK/Cancel buttons <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/60">#60</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Hide hidden files in SD card picker by default <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/58">#58</a> (<a href="https://github.com/dvrajan">dvrajan</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-4-2-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-4-2-2015-09-30"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.2">v2.4.2</a> (2015-09-30)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.1...v2.4.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>lower minSdk <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/54">#54</a></li>
|
||||||
|
<li>Spacing of filename items <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/52">#52</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Lowered minSdk to API 9 <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/55">#55</a> (<a href="https://github.com/marbat87">marbat87</a>)</li>
|
||||||
|
<li>Add Video Thumbnail preview and set default theme to light <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/53">#53</a> (<a href="https://github.com/alishari">alishari</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-4-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-4-1-2015-09-14"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.1">v2.4.1</a> (2015-09-14)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.0...v2.4.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Update to latest build tools and support library 23.0.1 <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/51">#51</a> (<a href="https://github.com/alishari">alishari</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-4-0-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-4-0-2015-08-25"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.0">v2.4.0</a> (2015-08-25)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.3.1...v2.4.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Only allow selecting single files (when EXTRA_ALLOW_MULTIPLE is set to false) <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/48">#48</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Make click events overridable <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/49">#49</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-3-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-3-1-2015-08-20"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.3.1">v2.3.1</a> (2015-08-20)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.3.0...v2.3.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>FilePicker cannot be used with non-touchscreen devices <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/44">#44</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Make list focusable. <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/45">#45</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-3-0-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-3-0-2015-08-18"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.3.0">v2.3.0</a> (2015-08-18)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.3...v2.3.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Make sure to handle Android M’s new permission requests <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/24">#24</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-2-3-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-2-3-2015-08-04"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.3">v2.2.3</a> (2015-08-04)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.2...v2.2.3">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Enhancement: Allow adding more arguments to FilePickerFragment <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/40">#40</a></li>
|
||||||
|
<li>Do not override existing arguments <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/41">#41</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Update travis config to run on faster containers <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/42">#42</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-2-2-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-2-2-2015-08-03"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.2">v2.2.2</a> (2015-08-03)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.1...v2.2.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Dropbox Sync API is deprecated <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/35">#35</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Ensure toasts don’t get queued up <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/39">#39</a> (<a href="https://github.com/hcoosthuizen">hcoosthuizen</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-2-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-2-1-2015-07-17"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.1">v2.2.1</a> (2015-07-17)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2...v2.2.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Strange error <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/34">#34</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-2-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-2-2015-07-13"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2">v2.2</a> (2015-07-13)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.1...v2.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Allow fragment to be used with default action bar <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/32">#32</a></li>
|
||||||
|
<li>Allow setting of toolbar text colour <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/31">#31</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Licence <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/29">#29</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Specifying GPL3 or later <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/30">#30</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-1-2015-05-30"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.1">v2.1</a> (2015-05-30)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.5...v2.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Make filepicker depend only on EXTRA_ALLOW_CREATE_DIR <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/25">#25</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Build fails <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/21">#21</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Mention that start-path is configurable <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/20">#20</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-0-5-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-0-5-2015-05-01"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.5">v2.0.5</a> (2015-05-01)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.4...v2.0.5">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Ic_launcher conflict with app one <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/16">#16</a> (<a href="https://github.com/NitroG42">NitroG42</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-0-4-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-0-4-2015-04-29"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.4">v2.0.4</a> (2015-04-29)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.3...v2.0.4">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Show miniatures for images <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/10">#10</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Rotation doesn’t work <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/15">#15</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-0-3-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-0-3-2015-04-28"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.3">v2.0.3</a> (2015-04-28)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.2...v2.0.3">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v2-0-2-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-0-2-2015-04-28"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.2">v2.0.2</a> (2015-04-28)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.0...v2.0.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v2-0-0-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-0-0-2015-04-27"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.0">v2.0.0</a> (2015-04-27)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.2.0...v2.0.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>crash InBackground thread <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/13">#13</a></li>
|
||||||
|
<li>Crash on root folders <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/12">#12</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v1-2-0-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-2-0-2015-04-27"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.2.0">v1.2.0</a> (2015-04-27)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.3...v1.2.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Verify Proguard <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/8">#8</a></li>
|
||||||
|
<li>Upload the Dropbox sample <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/5">#5</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Add a Gitter chat badge to README.org <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/11">#11</a> (<a href="https://github.com/gitter-badger">gitter-badger</a>)</li>
|
||||||
|
<li>NPE on empty dir <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/6">#6</a> (<a href="https://github.com/arkty">arkty</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v1-1-3-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-1-3-2014-04-02"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.3">v1.1.3</a> (2014-04-02)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.2...v1.1.3">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>FilePicker: Handle case if startPath does not exist <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/4">#4</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v1-1-2-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-1-2-2014-04-02"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.2">v1.1.2</a> (2014-04-02)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.1...v1.1.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Upload to Maven Central <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/3">#3</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v1-1-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-1-1-2014-04-02"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.1">v1.1.1</a> (2014-04-02)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1...v1.1.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v1-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-1-2014-04-01"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1">v1.1</a> (2014-04-01)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.0...v1.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Add only files option <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/2">#2</a></li>
|
||||||
|
<li>Make create directory toggleable <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/1">#1</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v1-0-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-0-2014-04-01"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.0">v1.0</a> (2014-04-01)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.99...v1.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v0-99-https-github-com-spacecowboy-nononsense-filepicker-tree-v0-99-2014-03-31"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.99">v0.99</a> (2014-03-31)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.91...v0.99">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v0-91-https-github-com-spacecowboy-nononsense-filepicker-tree-v0-91-2014-03-31"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.91">v0.91</a> (2014-03-31)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.9...v0.91">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v0-9-https-github-com-spacecowboy-nononsense-filepicker-tree-v0-9-2014-03-31"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.9">v0.9</a> (2014-03-31)</h2>
|
||||||
|
|
||||||
|
<p>* <em>This Change Log was automatically generated by <a href="https://github.com/skywinder/Github-Changelog-Generator">github_changelog_generator</a></em></p>
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="copyright" role="note">
|
||||||
|
|
||||||
|
© 2016 Released under the Mozilla Public License 2.0 –
|
||||||
|
|
||||||
|
Documentation built with
|
||||||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||||||
|
using the
|
||||||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="pagination" aria-label="Footer">
|
||||||
|
<div class="previous">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/" title="Change the sort order">
|
||||||
|
<span class="direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="button button-previous" role="button" aria-label="Previous">
|
||||||
|
<i class="icon icon-back"></i>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Change the sort order
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="next">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/" title="Readme">
|
||||||
|
<span class="direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Readme
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-next" role="button" aria-label="Next">
|
||||||
|
<i class="icon icon-forward"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="results" role="status" aria-live="polite">
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="meta"></div>
|
||||||
|
<div class="list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var base_url = 'http:\/\/spacecowboy.github.io\/NoNonsense-FilePicker\/';
|
||||||
|
var repo_id = 'spacecowboy\/NoNonsense-FilePicker';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Add headers to scrollspy */
|
||||||
|
var headers = document.getElementsByTagName("h2");
|
||||||
|
var scrollspy = document.getElementById('scrollspy');
|
||||||
|
|
||||||
|
if(scrollspy) {
|
||||||
|
if(headers.length > 0) {
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var li = document.createElement("li");
|
||||||
|
li.setAttribute("class", "anchor");
|
||||||
|
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", headers[i].innerHTML);
|
||||||
|
a.innerHTML = headers[i].innerHTML;
|
||||||
|
|
||||||
|
li.appendChild(a)
|
||||||
|
scrollspy.appendChild(li);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add permanent link next to the headers */
|
||||||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||||||
|
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("class", "headerlink");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", "Permanent link")
|
||||||
|
a.innerHTML = "#";
|
||||||
|
headers[i].appendChild(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="//gohugo.io/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,386 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||||
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
|
<channel>
|
||||||
|
<title>Changelogs on NoNonsense FilePicker</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/</link>
|
||||||
|
<description>Recent content in Changelogs on NoNonsense FilePicker</description>
|
||||||
|
<generator>Hugo -- gohugo.io</generator>
|
||||||
|
<language>en-us</language>
|
||||||
|
<lastBuildDate>Sat, 16 Jul 2016 17:06:45 +0200</lastBuildDate>
|
||||||
|
<atom:link href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/index.xml" rel="self" type="application/rss+xml" />
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<title>ChangeLog</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/</link>
|
||||||
|
<pubDate>Sat, 16 Jul 2016 17:06:45 +0200</pubDate>
|
||||||
|
|
||||||
|
<guid>http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/</guid>
|
||||||
|
<description>
|
||||||
|
|
||||||
|
<h2 id="3-0-0-https-github-com-spacecowboy-nononsense-filepicker-tree-3-0-0-2016-07-03"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/3.0.0">3.0.0</a> (2016-07-03)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.3...3.0.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Select one file with a single click <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/92">#92</a> (<a href="https://github.com/rastikw">rastikw</a>)</li>
|
||||||
|
<li>Add ability to enter a new filename <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/83">#83</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Closed issues:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Add ability to input filename <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/82">#82</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="2-5-3-https-github-com-spacecowboy-nononsense-filepicker-tree-2-5-3-2016-06-09"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.3">2.5.3</a> (2016-06-09)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.2...2.5.3">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Add paths to permission and refresh methods <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/85">#85</a></li>
|
||||||
|
<li>Add FastScroller sample implementation <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/89">#89</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
<li>Add a getItem method to FileItemAdapter <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/88">#88</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Crash while creating folder in dropbox sample <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/76">#76</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Closed issues:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Fast Scroll <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/87">#87</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="2-5-2-https-github-com-spacecowboy-nononsense-filepicker-tree-2-5-2-2016-02-24"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.2">2.5.2</a> (2016-02-24)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.1...2.5.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Dropbox should show a progress bar when loading <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/74">#74</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Dropbox sample can crash due to Inconsistent state in RecyclerView <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/75">#75</a></li>
|
||||||
|
<li>Dropbox sample crash if multiple press on folder <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/73">#73</a></li>
|
||||||
|
<li>probebly underscore missing <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/63">#63</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Update README.md <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/68">#68</a> (<a href="https://github.com/callmepeanut">callmepeanut</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="2-5-1-https-github-com-spacecowboy-nononsense-filepicker-tree-2-5-1-2016-01-13"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.1">2.5.1</a> (2016-01-13)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/2.5.0...2.5.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Change license to MPL <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/66">#66</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="2-5-0-https-github-com-spacecowboy-nononsense-filepicker-tree-2-5-0-2015-11-08"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/2.5.0">2.5.0</a> (2015-11-08)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.2...2.5.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Add a separator line above OK/Cancel buttons <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/60">#60</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Hide hidden files in SD card picker by default <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/58">#58</a> (<a href="https://github.com/dvrajan">dvrajan</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-4-2-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-4-2-2015-09-30"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.2">v2.4.2</a> (2015-09-30)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.1...v2.4.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>lower minSdk <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/54">#54</a></li>
|
||||||
|
<li>Spacing of filename items <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/52">#52</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Lowered minSdk to API 9 <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/55">#55</a> (<a href="https://github.com/marbat87">marbat87</a>)</li>
|
||||||
|
<li>Add Video Thumbnail preview and set default theme to light <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/53">#53</a> (<a href="https://github.com/alishari">alishari</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-4-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-4-1-2015-09-14"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.1">v2.4.1</a> (2015-09-14)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.4.0...v2.4.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Update to latest build tools and support library 23.0.1 <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/51">#51</a> (<a href="https://github.com/alishari">alishari</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-4-0-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-4-0-2015-08-25"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.4.0">v2.4.0</a> (2015-08-25)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.3.1...v2.4.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Only allow selecting single files (when EXTRA_ALLOW_MULTIPLE is set to false) <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/48">#48</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Make click events overridable <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/49">#49</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-3-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-3-1-2015-08-20"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.3.1">v2.3.1</a> (2015-08-20)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.3.0...v2.3.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>FilePicker cannot be used with non-touchscreen devices <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/44">#44</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Make list focusable. <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/45">#45</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-3-0-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-3-0-2015-08-18"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.3.0">v2.3.0</a> (2015-08-18)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.3...v2.3.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Make sure to handle Android M&rsquo;s new permission requests <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/24">#24</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-2-3-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-2-3-2015-08-04"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.3">v2.2.3</a> (2015-08-04)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.2...v2.2.3">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Enhancement: Allow adding more arguments to FilePickerFragment <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/40">#40</a></li>
|
||||||
|
<li>Do not override existing arguments <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/41">#41</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Update travis config to run on faster containers <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/42">#42</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-2-2-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-2-2-2015-08-03"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.2">v2.2.2</a> (2015-08-03)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2.1...v2.2.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Dropbox Sync API is deprecated <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/35">#35</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Ensure toasts don&rsquo;t get queued up <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/39">#39</a> (<a href="https://github.com/hcoosthuizen">hcoosthuizen</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-2-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-2-1-2015-07-17"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2.1">v2.2.1</a> (2015-07-17)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.2...v2.2.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Strange error <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/34">#34</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-2-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-2-2015-07-13"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.2">v2.2</a> (2015-07-13)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.1...v2.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Allow fragment to be used with default action bar <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/32">#32</a></li>
|
||||||
|
<li>Allow setting of toolbar text colour <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/31">#31</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Licence <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/29">#29</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Specifying GPL3 or later <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/30">#30</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-1-2015-05-30"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.1">v2.1</a> (2015-05-30)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.5...v2.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Make filepicker depend only on EXTRA_ALLOW_CREATE_DIR <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/25">#25</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Build fails <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/21">#21</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Mention that start-path is configurable <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/20">#20</a> (<a href="https://github.com/spacecowboy">spacecowboy</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-0-5-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-0-5-2015-05-01"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.5">v2.0.5</a> (2015-05-01)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.4...v2.0.5">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Ic_launcher conflict with app one <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/16">#16</a> (<a href="https://github.com/NitroG42">NitroG42</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-0-4-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-0-4-2015-04-29"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.4">v2.0.4</a> (2015-04-29)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.3...v2.0.4">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Show miniatures for images <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/10">#10</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Rotation doesn&rsquo;t work <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/15">#15</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v2-0-3-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-0-3-2015-04-28"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.3">v2.0.3</a> (2015-04-28)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.2...v2.0.3">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v2-0-2-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-0-2-2015-04-28"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.2">v2.0.2</a> (2015-04-28)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v2.0.0...v2.0.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v2-0-0-https-github-com-spacecowboy-nononsense-filepicker-tree-v2-0-0-2015-04-27"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v2.0.0">v2.0.0</a> (2015-04-27)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.2.0...v2.0.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>crash InBackground thread <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/13">#13</a></li>
|
||||||
|
<li>Crash on root folders <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/12">#12</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v1-2-0-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-2-0-2015-04-27"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.2.0">v1.2.0</a> (2015-04-27)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.3...v1.2.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Verify Proguard <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/8">#8</a></li>
|
||||||
|
<li>Upload the Dropbox sample <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/5">#5</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong>Merged pull requests:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Add a Gitter chat badge to README.org <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/11">#11</a> (<a href="https://github.com/gitter-badger">gitter-badger</a>)</li>
|
||||||
|
<li>NPE on empty dir <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/pull/6">#6</a> (<a href="https://github.com/arkty">arkty</a>)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v1-1-3-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-1-3-2014-04-02"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.3">v1.1.3</a> (2014-04-02)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.2...v1.1.3">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Fixed bugs:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>FilePicker: Handle case if startPath does not exist <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/4">#4</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v1-1-2-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-1-2-2014-04-02"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.2">v1.1.2</a> (2014-04-02)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1.1...v1.1.2">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Upload to Maven Central <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/3">#3</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v1-1-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-1-1-2014-04-02"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1.1">v1.1.1</a> (2014-04-02)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.1...v1.1.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v1-1-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-1-2014-04-01"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.1">v1.1</a> (2014-04-01)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v1.0...v1.1">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<p><strong>Implemented enhancements:</strong></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Add only files option <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/2">#2</a></li>
|
||||||
|
<li>Make create directory toggleable <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/1">#1</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="v1-0-https-github-com-spacecowboy-nononsense-filepicker-tree-v1-0-2014-04-01"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v1.0">v1.0</a> (2014-04-01)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.99...v1.0">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v0-99-https-github-com-spacecowboy-nononsense-filepicker-tree-v0-99-2014-03-31"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.99">v0.99</a> (2014-03-31)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.91...v0.99">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v0-91-https-github-com-spacecowboy-nononsense-filepicker-tree-v0-91-2014-03-31"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.91">v0.91</a> (2014-03-31)</h2>
|
||||||
|
|
||||||
|
<p><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/compare/v0.9...v0.91">Full Changelog</a></p>
|
||||||
|
|
||||||
|
<h2 id="v0-9-https-github-com-spacecowboy-nononsense-filepicker-tree-v0-9-2014-03-31"><a href="https://github.com/spacecowboy/NoNonsense-FilePicker/tree/v0.9">v0.9</a> (2014-03-31)</h2>
|
||||||
|
|
||||||
|
<p>* <em>This Change Log was automatically generated by <a href="https://github.com/skywinder/Github-Changelog-Generator">github_changelog_generator</a></em></p>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
|
|
@ -0,0 +1,625 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<html class="no-js">
|
||||||
|
|
||||||
|
<head lang="en-us">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||||
|
<title>Custom item layout - NoNonsense FilePicker</title>
|
||||||
|
<meta name="generator" content="Hugo 0.16" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="description" content="An extensible and flexible file-picker for Android.">
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
<meta name="author" content="SpaceCowboy">
|
||||||
|
|
||||||
|
|
||||||
|
<meta property="og:url" content="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
<meta property="og:title" content="NoNonsense FilePicker">
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-title" content="NoNonsense FilePicker">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
<link rel="icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Icon';
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?52m981');
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?#iefix52m981')
|
||||||
|
format('embedded-opentype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.woff?52m981')
|
||||||
|
format('woff'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.ttf?52m981')
|
||||||
|
format('truetype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.svg?52m981#icon')
|
||||||
|
format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/application.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/temporary.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/palettes.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/highlight/highlight.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700|Roboto%2bMono">
|
||||||
|
<style>
|
||||||
|
body, input {
|
||||||
|
font-family: 'Roboto', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
pre, code {
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/modernizr.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="palette-primary-red palette-accent-light green">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="backdrop">
|
||||||
|
<div class="backdrop-paper"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-drawer">
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-search">
|
||||||
|
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<nav aria-label="Header">
|
||||||
|
<div class="bar default">
|
||||||
|
<div class="button button-menu" role="button" aria-label="Menu">
|
||||||
|
<label class="toggle-button icon icon-menu" for="toggle-drawer">
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Custom item layout
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||||||
|
<a href="https://github.com/spacecowboy" title="@spacecowboy on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bar search">
|
||||||
|
<div class="button button-close" role="button" aria-label="Close">
|
||||||
|
<label class="toggle-button icon icon-back" for="toggle-search"></label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="field">
|
||||||
|
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-reset" role="button" aria-label="Search">
|
||||||
|
<button class="toggle-button icon icon-close" id="reset-search"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="drawer">
|
||||||
|
<nav aria-label="Navigation">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker" class="project">
|
||||||
|
<div class="banner">
|
||||||
|
|
||||||
|
<div class="name">
|
||||||
|
<strong>NoNonsense FilePicker </strong>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
spacecowboy/NoNonsense-FilePicker
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<ul class="repo">
|
||||||
|
<li class="repo-download">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||||||
|
<i class="icon icon-download"></i> Download
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="repo-stars">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||||||
|
<i class="icon icon-star"></i> Stars
|
||||||
|
<span class="count">–</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="toc">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Readme" href="http://spacecowboy.github.io/NoNonsense-FilePicker/readme/">
|
||||||
|
|
||||||
|
Readme
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Changelog" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="License" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
License
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="section">Examples</span>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Change the sort order" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
Change the sort order
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Filter based on file extension" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
Filter based on file extension
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="current" title="Custom item layout" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
Custom item layout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<ul id="scrollspy">
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override the back button" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
Override the back button
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override selection behavior" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
Override selection behavior
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Standalone fragment" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
Standalone fragment
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<span class="section">The author</span>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/spacecowboy" target="_blank" title="@spacecowboy on GitHub">
|
||||||
|
@spacecowboy on GitHub
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article class="article">
|
||||||
|
<div class="wrapper">
|
||||||
|
<h1>Custom item layout </h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Say you want to browse some files which have really long names. By default, filenames will be cut if they exceed one line in width like <code>ThisIsAReallyLongFi...</code>. What if we really wanted it show like in this image?</p>
|
||||||
|
|
||||||
|
<p><img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/itemlayout_longfilename.png" alt="Example of a long filename" /></p>
|
||||||
|
|
||||||
|
<p>The behavior of the text is defined in the listitem layouts:
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/res/layout/nnf_filepicker_listitem_checkable.xml">nnf_filepicker_listitem_checkable</a>
|
||||||
|
and
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/res/layout/nnf_filepicker_listitem_dir.xml">nnf_filepicker_listitem_dir</a>.</p>
|
||||||
|
|
||||||
|
<p>There are two kinds of layouts, one with a checkbox to allow selection, and one without a checkbox. The second one is also used for the special header item <code>..</code> though you could of course have a special layout for that if you wanted.</p>
|
||||||
|
|
||||||
|
<h3 id="layouts">Layouts</h3>
|
||||||
|
|
||||||
|
<p>Let’s create some new layouts which will support longer filenames as follows:</p>
|
||||||
|
|
||||||
|
<p><strong>longer_listitem_checkable.xml</strong></p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020"><?xml version="1.0" encoding="utf-8"?></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><LinearLayout</span> <span style="color: #4070a0">xmlns:android="http://schemas.android.com/apk/res/android"</span>
|
||||||
|
<span style="color: #4070a0">xmlns:tools="http://schemas.android.com/tools"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width="match_parent"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height="wrap_content"</span>
|
||||||
|
<span style="color: #4070a0">android:background="?android:selectableItemBackground"</span>
|
||||||
|
<span style="color: #4070a0">android:minHeight="?android:listPreferredItemHeight"</span>
|
||||||
|
<span style="color: #4070a0">android:orientation="horizontal"</span><span style="color: #062873; font-weight: bold">></span>
|
||||||
|
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic"><!--suppress AndroidDomInspection --></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><ImageView</span>
|
||||||
|
<span style="color: #4070a0">android:id="@+id/item_icon"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width="?android:listPreferredItemHeight"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height="?android:listPreferredItemHeight"</span>
|
||||||
|
<span style="color: #4070a0">android:adjustViewBounds="true"</span>
|
||||||
|
<span style="color: #4070a0">android:scaleType="fitCenter"</span>
|
||||||
|
<span style="color: #4070a0">android:src="@drawable/nnf_ic_file_folder"</span>
|
||||||
|
<span style="color: #4070a0">android:tint="?attr/colorAccent"</span>
|
||||||
|
<span style="color: #4070a0">android:visibility="visible"</span>
|
||||||
|
<span style="color: #4070a0">tools:ignore="ContentDescription"</span> <span style="color: #062873; font-weight: bold">/></span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold"><TextView</span>
|
||||||
|
<span style="color: #4070a0">android:id="@android:id/text1"</span>
|
||||||
|
<span style="color: #4070a0">style="?android:textAppearanceLarge"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width="0dp"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height="wrap_content"</span>
|
||||||
|
<span style="color: #4070a0">android:minHeight="?android:listPreferredItemHeight"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_weight="1"</span>
|
||||||
|
<span style="color: #4070a0">android:ellipsize="end"</span>
|
||||||
|
<span style="color: #4070a0">android:gravity="center_vertical"</span>
|
||||||
|
<span style="color: #4070a0">android:maxLines="4"</span>
|
||||||
|
<span style="color: #4070a0">android:padding="8dp"</span><span style="color: #062873; font-weight: bold">/></span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold"><CheckBox</span>
|
||||||
|
<span style="color: #4070a0">android:id="@+id/checkbox"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width="wrap_content"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height="match_parent"</span>
|
||||||
|
<span style="color: #4070a0">android:paddingEnd="8dp"</span>
|
||||||
|
<span style="color: #4070a0">android:paddingRight="8dp"</span>
|
||||||
|
<span style="color: #4070a0">tools:ignore="RtlSymmetry"</span> <span style="color: #062873; font-weight: bold">/></span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold"></LinearLayout></span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p><strong>longer_listitem_dir.xml</strong></p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020"><?xml version="1.0" encoding="utf-8"?></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><LinearLayout</span> <span style="color: #4070a0">xmlns:android="http://schemas.android.com/apk/res/android"</span>
|
||||||
|
<span style="color: #4070a0">xmlns:tools="http://schemas.android.com/tools"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width="match_parent"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height="wrap_content"</span>
|
||||||
|
<span style="color: #4070a0">android:background="?android:selectableItemBackground"</span>
|
||||||
|
<span style="color: #4070a0">android:minHeight="?android:listPreferredItemHeight"</span>
|
||||||
|
<span style="color: #4070a0">android:orientation="horizontal"</span>
|
||||||
|
<span style="color: #062873; font-weight: bold">></span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic"><!--suppress AndroidDomInspection --></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><ImageView</span>
|
||||||
|
<span style="color: #4070a0">android:id="@+id/item_icon"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width="?android:listPreferredItemHeight"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height="?android:listPreferredItemHeight"</span>
|
||||||
|
<span style="color: #4070a0">android:adjustViewBounds="true"</span>
|
||||||
|
<span style="color: #4070a0">android:scaleType="center"</span>
|
||||||
|
<span style="color: #4070a0">android:src="@drawable/nnf_ic_file_folder"</span>
|
||||||
|
<span style="color: #4070a0">android:tint="?attr/colorAccent"</span>
|
||||||
|
<span style="color: #4070a0">android:visibility="visible"</span>
|
||||||
|
<span style="color: #4070a0">tools:ignore="ContentDescription"</span> <span style="color: #062873; font-weight: bold">/></span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold"><TextView</span>
|
||||||
|
<span style="color: #4070a0">android:id="@android:id/text1"</span>
|
||||||
|
<span style="color: #4070a0">style="?android:textAppearanceLarge"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width="0dp"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height="wrap_content"</span>
|
||||||
|
<span style="color: #4070a0">android:minHeight="?android:listPreferredItemHeight"</span>
|
||||||
|
<span style="color: #4070a0">android:layout_weight="1"</span>
|
||||||
|
<span style="color: #4070a0">android:ellipsize="end"</span>
|
||||||
|
<span style="color: #4070a0">android:gravity="center_vertical"</span>
|
||||||
|
<span style="color: #4070a0">android:maxLines="4"</span>
|
||||||
|
<span style="color: #4070a0">android:padding="8dp"</span><span style="color: #062873; font-weight: bold">/></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"></LinearLayout></span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Note that I defined the TextViews to have a maximum of 4 lines (actual number is up to you), and a minimum height of <code>android:listPreferredItemHeight</code> (this I recommend, otherwise it looks wonky and off-center). And just be clear, the <em>ids</em> of these fields must be <code>@+id/item_icon</code>, <code>@android:id/text1</code>, and <code>@+id/checkbox</code>, or the code WILL crash on you.</p>
|
||||||
|
|
||||||
|
<h3 id="code">Code</h3>
|
||||||
|
|
||||||
|
<p>To use the new layouts, you need to override the <code>onCreateViewHolder</code> method in
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerFragment.java">AbstractFilePickerFragment</a>.</p>
|
||||||
|
|
||||||
|
<p>Since this example will be browsing the SD-card, I will extend from the built-in FilePickerFragment.</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">CustomLayoutFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param parent Containing view</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param viewType which the ViewHolder will contain. Will be one of:</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * [VIEWTYPE_HEADER, VIEWTYPE_CHECKABLE, VIEWTYPE_DIR]. It is OK, and even expected, to use the same</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * layout for VIEWTYPE_HEADER and VIEWTYPE_DIR.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return a view holder for a file or directory (the difference is presence of checkbox).</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> RecyclerView<span style="color: #666666">.</span><span style="color: #4070a0">ViewHolder</span> <span style="color: #06287e">onCreateViewHolder</span><span style="color: #666666">(</span>ViewGroup parent<span style="color: #666666">,</span> <span style="color: #902000">int</span> viewType<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
View v<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">switch</span> <span style="color: #666666">(</span>viewType<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">case</span> LogicHandler<span style="color: #666666">.</span><span style="color: #4070a0">VIEWTYPE_HEADER</span><span style="color: #666666">:</span>
|
||||||
|
v <span style="color: #666666">=</span> LayoutInflater<span style="color: #666666">.</span><span style="color: #4070a0">from</span><span style="color: #666666">(</span>getActivity<span style="color: #666666">()).</span><span style="color: #4070a0">inflate</span><span style="color: #666666">(</span>R<span style="color: #666666">.</span><span style="color: #4070a0">layout</span><span style="color: #666666">.</span><span style="color: #4070a0">longer_listitem_dir</span><span style="color: #666666">,</span>
|
||||||
|
parent<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">false</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">new</span> HeaderViewHolder<span style="color: #666666">(</span>v<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">case</span> LogicHandler<span style="color: #666666">.</span><span style="color: #4070a0">VIEWTYPE_CHECKABLE</span><span style="color: #666666">:</span>
|
||||||
|
v <span style="color: #666666">=</span> LayoutInflater<span style="color: #666666">.</span><span style="color: #4070a0">from</span><span style="color: #666666">(</span>getActivity<span style="color: #666666">()).</span><span style="color: #4070a0">inflate</span><span style="color: #666666">(</span>R<span style="color: #666666">.</span><span style="color: #4070a0">layout</span><span style="color: #666666">.</span><span style="color: #4070a0">longer_listitem_checkable</span><span style="color: #666666">,</span>
|
||||||
|
parent<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">false</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">new</span> CheckableViewHolder<span style="color: #666666">(</span>v<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">case</span> LogicHandler<span style="color: #666666">.</span><span style="color: #4070a0">VIEWTYPE_DIR</span><span style="color: #666666">:</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">default</span><span style="color: #666666">:</span>
|
||||||
|
v <span style="color: #666666">=</span> LayoutInflater<span style="color: #666666">.</span><span style="color: #4070a0">from</span><span style="color: #666666">(</span>getActivity<span style="color: #666666">()).</span><span style="color: #4070a0">inflate</span><span style="color: #666666">(</span>R<span style="color: #666666">.</span><span style="color: #4070a0">layout</span><span style="color: #666666">.</span><span style="color: #4070a0">longer_listitem_dir</span><span style="color: #666666">,</span>
|
||||||
|
parent<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">false</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">new</span> DirViewHolder<span style="color: #666666">(</span>v<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>And as always, to use your custom fragment you need a custom activity which loads it for you:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">CustomLayoutPickerActivity</span> <span style="color: #007020; font-weight: bold">extends</span> AbstractFilePickerActivity <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #06287e">CustomLayoutPickerActivity</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> AbstractFilePickerFragment<span style="color: #666666"><</span>File<span style="color: #666666">></span> <span style="color: #06287e">getFragment</span><span style="color: #666666">(</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> String startPath<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">int</span> mode<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowMultiple<span style="color: #666666">,</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowCreateDir<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Load our custom fragment here</span>
|
||||||
|
AbstractFilePickerFragment<span style="color: #666666"><</span>File<span style="color: #666666">></span> fragment <span style="color: #666666">=</span> <span style="color: #007020; font-weight: bold">new</span> CustomLayoutFilePickerFragment<span style="color: #666666">();</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// startPath is allowed to be null. In that case, default folder should be SD-card and not "/"</span>
|
||||||
|
fragment<span style="color: #666666">.</span><span style="color: #4070a0">setArgs</span><span style="color: #666666">(</span>startPath <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">?</span> startPath <span style="color: #666666">:</span> Environment<span style="color: #666666">.</span><span style="color: #4070a0">getExternalStorageDirectory</span><span style="color: #666666">().</span><span style="color: #4070a0">getPath</span><span style="color: #666666">(),</span>
|
||||||
|
mode<span style="color: #666666">,</span> allowMultiple<span style="color: #666666">,</span> allowCreateDir<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> fragment<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="copyright" role="note">
|
||||||
|
|
||||||
|
© 2016 Released under the Mozilla Public License 2.0 –
|
||||||
|
|
||||||
|
Documentation built with
|
||||||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||||||
|
using the
|
||||||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="pagination" aria-label="Footer">
|
||||||
|
<div class="previous">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/" title="Filter based on file extension">
|
||||||
|
<span class="direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="button button-previous" role="button" aria-label="Previous">
|
||||||
|
<i class="icon icon-back"></i>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Filter based on file extension
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="next">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/" title="Change the sort order">
|
||||||
|
<span class="direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Change the sort order
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-next" role="button" aria-label="Next">
|
||||||
|
<i class="icon icon-forward"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="results" role="status" aria-live="polite">
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="meta"></div>
|
||||||
|
<div class="list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var base_url = 'http:\/\/spacecowboy.github.io\/NoNonsense-FilePicker\/';
|
||||||
|
var repo_id = 'spacecowboy\/NoNonsense-FilePicker';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Add headers to scrollspy */
|
||||||
|
var headers = document.getElementsByTagName("h2");
|
||||||
|
var scrollspy = document.getElementById('scrollspy');
|
||||||
|
|
||||||
|
if(scrollspy) {
|
||||||
|
if(headers.length > 0) {
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var li = document.createElement("li");
|
||||||
|
li.setAttribute("class", "anchor");
|
||||||
|
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", headers[i].innerHTML);
|
||||||
|
a.innerHTML = headers[i].innerHTML;
|
||||||
|
|
||||||
|
li.appendChild(a)
|
||||||
|
scrollspy.appendChild(li);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add permanent link next to the headers */
|
||||||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||||||
|
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("class", "headerlink");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", "Permanent link")
|
||||||
|
a.innerHTML = "#";
|
||||||
|
headers[i].appendChild(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="//gohugo.io/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,545 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<html class="no-js">
|
||||||
|
|
||||||
|
<head lang="en-us">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||||
|
<title>Filter based on file extension - NoNonsense FilePicker</title>
|
||||||
|
<meta name="generator" content="Hugo 0.16" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="description" content="An extensible and flexible file-picker for Android.">
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
<meta name="author" content="SpaceCowboy">
|
||||||
|
|
||||||
|
|
||||||
|
<meta property="og:url" content="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
<meta property="og:title" content="NoNonsense FilePicker">
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-title" content="NoNonsense FilePicker">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
<link rel="icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Icon';
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?52m981');
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?#iefix52m981')
|
||||||
|
format('embedded-opentype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.woff?52m981')
|
||||||
|
format('woff'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.ttf?52m981')
|
||||||
|
format('truetype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.svg?52m981#icon')
|
||||||
|
format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/application.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/temporary.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/palettes.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/highlight/highlight.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700|Roboto%2bMono">
|
||||||
|
<style>
|
||||||
|
body, input {
|
||||||
|
font-family: 'Roboto', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
pre, code {
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/modernizr.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="palette-primary-red palette-accent-light green">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="backdrop">
|
||||||
|
<div class="backdrop-paper"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-drawer">
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-search">
|
||||||
|
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<nav aria-label="Header">
|
||||||
|
<div class="bar default">
|
||||||
|
<div class="button button-menu" role="button" aria-label="Menu">
|
||||||
|
<label class="toggle-button icon icon-menu" for="toggle-drawer">
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Filter based on file extension
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||||||
|
<a href="https://github.com/spacecowboy" title="@spacecowboy on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bar search">
|
||||||
|
<div class="button button-close" role="button" aria-label="Close">
|
||||||
|
<label class="toggle-button icon icon-back" for="toggle-search"></label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="field">
|
||||||
|
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-reset" role="button" aria-label="Search">
|
||||||
|
<button class="toggle-button icon icon-close" id="reset-search"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="drawer">
|
||||||
|
<nav aria-label="Navigation">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker" class="project">
|
||||||
|
<div class="banner">
|
||||||
|
|
||||||
|
<div class="name">
|
||||||
|
<strong>NoNonsense FilePicker </strong>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
spacecowboy/NoNonsense-FilePicker
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<ul class="repo">
|
||||||
|
<li class="repo-download">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||||||
|
<i class="icon icon-download"></i> Download
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="repo-stars">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||||||
|
<i class="icon icon-star"></i> Stars
|
||||||
|
<span class="count">–</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="toc">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Readme" href="http://spacecowboy.github.io/NoNonsense-FilePicker/readme/">
|
||||||
|
|
||||||
|
Readme
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Changelog" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="License" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
License
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="section">Examples</span>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Change the sort order" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
Change the sort order
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="current" title="Filter based on file extension" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
Filter based on file extension
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<ul id="scrollspy">
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Custom item layout" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
Custom item layout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override the back button" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
Override the back button
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override selection behavior" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
Override selection behavior
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Standalone fragment" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
Standalone fragment
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<span class="section">The author</span>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/spacecowboy" target="_blank" title="@spacecowboy on GitHub">
|
||||||
|
@spacecowboy on GitHub
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article class="article">
|
||||||
|
<div class="wrapper">
|
||||||
|
<h1>Filter based on file extension </h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>By default, the SD-card picker will display all files in alphabetical order. But let’s say that your app can only handle a specific type of file, like <code>.txt</code>-files. Here’s a minimal example which will only display such files.</p>
|
||||||
|
|
||||||
|
<p>First, a convenience method to get the extension of files:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span> <span style="color: #60a0b0; font-style: italic">// File extension to filter on, including the initial dot.</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">private</span> <span style="color: #007020; font-weight: bold">static</span> <span style="color: #007020; font-weight: bold">final</span> String EXTENSION <span style="color: #666666">=</span> <span style="color: #4070a0">".txt"</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> *</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param file</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return The file extension. If file has no extension, it returns null.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">private</span> String <span style="color: #06287e">getExtension</span><span style="color: #666666">(</span><span style="color: #555555; font-weight: bold">@NonNull</span> File file<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
String path <span style="color: #666666">=</span> file<span style="color: #666666">.</span><span style="color: #4070a0">getPath</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #902000">int</span> i <span style="color: #666666">=</span> path<span style="color: #666666">.</span><span style="color: #4070a0">lastIndexOf</span><span style="color: #666666">(</span><span style="color: #4070a0">"."</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>i <span style="color: #666666"><</span> <span style="color: #40a070">0</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> path<span style="color: #666666">.</span><span style="color: #4070a0">substring</span><span style="color: #666666">(</span>i<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>The decision to display files or not is done with the <code>isItemVisible</code> method. Just add a check for the file-extension:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span> <span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">boolean</span> <span style="color: #06287e">isItemVisible</span><span style="color: #666666">(</span><span style="color: #007020; font-weight: bold">final</span> File file<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// simplified behavior (see below full code)</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// return isDir(file) || (mode == MODE_FILE || mode == MODE_FILE_AND_DIR);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(!</span>isDir<span style="color: #666666">(</span>file<span style="color: #666666">)</span> <span style="color: #666666">&&</span> <span style="color: #666666">(</span>mode <span style="color: #666666">==</span> MODE_FILE <span style="color: #666666">||</span> mode <span style="color: #666666">==</span> MODE_FILE_AND_DIR<span style="color: #666666">))</span> <span style="color: #666666">{</span>
|
||||||
|
String ext <span style="color: #666666">=</span> getExtension<span style="color: #666666">(</span>file<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> ext <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&&</span> EXTENSION<span style="color: #666666">.</span><span style="color: #4070a0">equalsIgnoreCase</span><span style="color: #666666">(</span>ext<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> isDir<span style="color: #666666">(</span>file<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h3 id="before-and-after">Before and After</h3>
|
||||||
|
|
||||||
|
<p><img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/filter_before.png" width="30%" alt="Before"/>
|
||||||
|
<img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/filter_after.png" width="30%" alt="After"/></p>
|
||||||
|
|
||||||
|
<h3 id="full-fragment-code">Full Fragment code</h3>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.FilePickerFragment</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">java.io.File</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">FilteredFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// File extension to filter on</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">private</span> <span style="color: #007020; font-weight: bold">static</span> <span style="color: #007020; font-weight: bold">final</span> String EXTENSION <span style="color: #666666">=</span> <span style="color: #4070a0">".txt"</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> *</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param file</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return The file extension. If file has no extension, it returns null.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">private</span> String <span style="color: #06287e">getExtension</span><span style="color: #666666">(</span><span style="color: #555555; font-weight: bold">@NonNull</span> File file<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
String path <span style="color: #666666">=</span> file<span style="color: #666666">.</span><span style="color: #4070a0">getPath</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #902000">int</span> i <span style="color: #666666">=</span> path<span style="color: #666666">.</span><span style="color: #4070a0">lastIndexOf</span><span style="color: #666666">(</span><span style="color: #4070a0">"."</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>i <span style="color: #666666"><</span> <span style="color: #40a070">0</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> path<span style="color: #666666">.</span><span style="color: #4070a0">substring</span><span style="color: #666666">(</span>i<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">boolean</span> <span style="color: #06287e">isItemVisible</span><span style="color: #666666">(</span><span style="color: #007020; font-weight: bold">final</span> File file<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #902000">boolean</span> ret <span style="color: #666666">=</span> <span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">.</span><span style="color: #4070a0">isItemVisible</span><span style="color: #666666">(</span>file<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>ret <span style="color: #666666">&&</span> <span style="color: #666666">!</span>isDir<span style="color: #666666">(</span>file<span style="color: #666666">)</span> <span style="color: #666666">&&</span> <span style="color: #666666">(</span>mode <span style="color: #666666">==</span> MODE_FILE <span style="color: #666666">||</span> mode <span style="color: #666666">==</span> MODE_FILE_AND_DIR<span style="color: #666666">))</span> <span style="color: #666666">{</span>
|
||||||
|
String ext <span style="color: #666666">=</span> getExtension<span style="color: #666666">(</span>file<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> ext <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&&</span> EXTENSION<span style="color: #666666">.</span><span style="color: #4070a0">equalsIgnoreCase</span><span style="color: #666666">(</span>ext<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> ret<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="copyright" role="note">
|
||||||
|
|
||||||
|
© 2016 Released under the Mozilla Public License 2.0 –
|
||||||
|
|
||||||
|
Documentation built with
|
||||||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||||||
|
using the
|
||||||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="pagination" aria-label="Footer">
|
||||||
|
<div class="previous">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/" title="Override the back button">
|
||||||
|
<span class="direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="button button-previous" role="button" aria-label="Previous">
|
||||||
|
<i class="icon icon-back"></i>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Override the back button
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="next">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/" title="Custom item layout">
|
||||||
|
<span class="direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Custom item layout
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-next" role="button" aria-label="Next">
|
||||||
|
<i class="icon icon-forward"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="results" role="status" aria-live="polite">
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="meta"></div>
|
||||||
|
<div class="list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var base_url = 'http:\/\/spacecowboy.github.io\/NoNonsense-FilePicker\/';
|
||||||
|
var repo_id = 'spacecowboy\/NoNonsense-FilePicker';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Add headers to scrollspy */
|
||||||
|
var headers = document.getElementsByTagName("h2");
|
||||||
|
var scrollspy = document.getElementById('scrollspy');
|
||||||
|
|
||||||
|
if(scrollspy) {
|
||||||
|
if(headers.length > 0) {
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var li = document.createElement("li");
|
||||||
|
li.setAttribute("class", "anchor");
|
||||||
|
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", headers[i].innerHTML);
|
||||||
|
a.innerHTML = headers[i].innerHTML;
|
||||||
|
|
||||||
|
li.appendChild(a)
|
||||||
|
scrollspy.appendChild(li);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add permanent link next to the headers */
|
||||||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||||||
|
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("class", "headerlink");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", "Permanent link")
|
||||||
|
a.innerHTML = "#";
|
||||||
|
headers[i].appendChild(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="//gohugo.io/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,462 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<html class="no-js">
|
||||||
|
|
||||||
|
<head lang="en-us">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||||
|
<title>Examples - NoNonsense FilePicker</title>
|
||||||
|
<meta name="generator" content="Hugo 0.16" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="description" content="An extensible and flexible file-picker for Android.">
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/">
|
||||||
|
|
||||||
|
<meta name="author" content="SpaceCowboy">
|
||||||
|
|
||||||
|
|
||||||
|
<meta property="og:url" content="http://spacecowboy.github.io/NoNonsense-FilePicker/example/">
|
||||||
|
<meta property="og:title" content="NoNonsense FilePicker">
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-title" content="NoNonsense FilePicker">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
<link rel="icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Icon';
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?52m981');
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?#iefix52m981')
|
||||||
|
format('embedded-opentype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.woff?52m981')
|
||||||
|
format('woff'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.ttf?52m981')
|
||||||
|
format('truetype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.svg?52m981#icon')
|
||||||
|
format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/application.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/temporary.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/palettes.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/highlight/highlight.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700|Roboto%2bMono">
|
||||||
|
<style>
|
||||||
|
body, input {
|
||||||
|
font-family: 'Roboto', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
pre, code {
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/modernizr.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<link href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/index.xml" rel="alternate" type="application/rss+xml" title="NoNonsense FilePicker" />
|
||||||
|
<link href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/index.xml" rel="feed" type="application/rss+xml" title="NoNonsense FilePicker" />
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="palette-primary-red palette-accent-light green">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="backdrop">
|
||||||
|
<div class="backdrop-paper"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-drawer">
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-search">
|
||||||
|
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<nav aria-label="Header">
|
||||||
|
<div class="bar default">
|
||||||
|
<div class="button button-menu" role="button" aria-label="Menu">
|
||||||
|
<label class="toggle-button icon icon-menu" for="toggle-drawer">
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Example
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||||||
|
<a href="https://github.com/spacecowboy" title="@spacecowboy on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bar search">
|
||||||
|
<div class="button button-close" role="button" aria-label="Close">
|
||||||
|
<label class="toggle-button icon icon-back" for="toggle-search"></label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="field">
|
||||||
|
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-reset" role="button" aria-label="Search">
|
||||||
|
<button class="toggle-button icon icon-close" id="reset-search"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="drawer">
|
||||||
|
<nav aria-label="Navigation">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker" class="project">
|
||||||
|
<div class="banner">
|
||||||
|
|
||||||
|
<div class="name">
|
||||||
|
<strong>NoNonsense FilePicker </strong>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<ul class="repo">
|
||||||
|
<li class="repo-download">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||||||
|
<i class="icon icon-download"></i> Download
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="repo-stars">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||||||
|
<i class="icon icon-star"></i> Stars
|
||||||
|
<span class="count">–</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="toc">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Readme" href="http://spacecowboy.github.io/NoNonsense-FilePicker/readme/">
|
||||||
|
|
||||||
|
Readme
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Changelog" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="License" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
License
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="section">Examples</span>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Change the sort order" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
Change the sort order
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Filter based on file extension" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
Filter based on file extension
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Custom item layout" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
Custom item layout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override the back button" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
Override the back button
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override selection behavior" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
Override selection behavior
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Standalone fragment" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
Standalone fragment
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<span class="section">The author</span>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/spacecowboy" target="_blank" title="@spacecowboy on GitHub">
|
||||||
|
@spacecowboy on GitHub
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article class="article">
|
||||||
|
<div class="wrapper">
|
||||||
|
<h1>Pages in Example</h1>
|
||||||
|
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/" title="Standalone fragment">
|
||||||
|
<h2>Standalone fragment</h2>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
To use the fragment together with an existing toolbar/action bar, a few things should be overridden. Here’s a minimal example where the toolbar is intercepted from being set as the main toolbar. The menu creation is also intercepted and populates the toolbar directly. public class StandaloneFilePickerFragment extends FilePickerFragment { protected Toolbar mToolbar; @Override protected void setupToolbar(Toolbar toolbar) { // Prevent it from being set as main toolbar by NOT calling super.setupToolbar().
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/" title="Override selection behavior">
|
||||||
|
<h2>Override selection behavior</h2>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
New in 2.4.0 are overridable methods to handle UI-interactions. The following methods are now available for augmentation: onClickOK, handles ok button. onClickCancel, handles cancel button. onClickHeader, handles clicks on “..”. onClickDir, handles clicks on non-selectable items (usually directories). onLongClickDir, handles long clicks on non-selectable items. onClickCheckable, handles clicks on selectable items. onLongClickCheckable, handles long clicks on selectable items. onClickCheckBox, handles clicks on the checkbox of selectable items. Please see the existing implementations before you override any of them.
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/" title="Override the back button">
|
||||||
|
<h2>Override the back button</h2>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
In case you want the back button to navigate the hierarchy instead of instantly exiting the activity, this is one approach you might take. Create an activity which overrides the back button and loads a custom fragment package com.nononsenseapps.filepicker.examples.backbutton; import android.os.Environment; import com.nononsenseapps.filepicker.AbstractFilePickerFragment; import com.nononsenseapps.filepicker.FilePickerActivity; import java.io.File; public class BackHandlingFilePickerActivity extends FilePickerActivity { /** * Need access to the fragment */ BackHandlingFilePickerFragment currentFragment; /** * Return a copy of the new fragment and set the variable above.
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/" title="Filter based on file extension">
|
||||||
|
<h2>Filter based on file extension</h2>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
By default, the SD-card picker will display all files in alphabetical order. But let’s say that your app can only handle a specific type of file, like .txt-files. Here’s a minimal example which will only display such files. First, a convenience method to get the extension of files: // File extension to filter on, including the initial dot. private static final String EXTENSION = ".txt"; /** * * @param file * @return The file extension.
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/" title="Custom item layout">
|
||||||
|
<h2>Custom item layout</h2>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
Say you want to browse some files which have really long names. By default, filenames will be cut if they exceed one line in width like ThisIsAReallyLongFi…. What if we really wanted it show like in this image? The behavior of the text is defined in the listitem layouts: nnf_filepicker_listitem_checkable and nnf_filepicker_listitem_dir. There are two kinds of layouts, one with a checkbox to allow selection, and one without a checkbox. The second one is also used for the special header item ..
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/" title="Change the sort order">
|
||||||
|
<h2>Change the sort order</h2>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
By default, the SD-card picker will display all files in alphabetical order. But what if you want a different sort-order? You can override the sorting by overriding the compareFiles-method: @Override protected int compareFiles(File lhs, File rhs) { if (lhs.isDirectory() && !rhs.isDirectory()) { return -1; } else if (rhs.isDirectory() && !lhs.isDirectory()) { return 1; } // This was the previous behaviour for all file-file comparisons. Now it's // only done if the files have the same extension, or no extension.
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="copyright" role="note">
|
||||||
|
|
||||||
|
© 2016 Released under the Mozilla Public License 2.0 –
|
||||||
|
|
||||||
|
Documentation built with
|
||||||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||||||
|
using the
|
||||||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="results" role="status" aria-live="polite">
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="meta"></div>
|
||||||
|
<div class="list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var base_url = '';
|
||||||
|
var repo_id = '';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Add headers to scrollspy */
|
||||||
|
var headers = document.getElementsByTagName("h2");
|
||||||
|
var scrollspy = document.getElementById('scrollspy');
|
||||||
|
|
||||||
|
if(scrollspy) {
|
||||||
|
if(headers.length > 0) {
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var li = document.createElement("li");
|
||||||
|
li.setAttribute("class", "anchor");
|
||||||
|
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", headers[i].innerHTML);
|
||||||
|
a.innerHTML = headers[i].innerHTML;
|
||||||
|
|
||||||
|
li.appendChild(a)
|
||||||
|
scrollspy.appendChild(li);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add permanent link next to the headers */
|
||||||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||||||
|
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("class", "headerlink");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", "Permanent link")
|
||||||
|
a.innerHTML = "#";
|
||||||
|
headers[i].appendChild(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="//gohugo.io/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,594 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||||
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
|
<channel>
|
||||||
|
<title>Examples on NoNonsense FilePicker</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/example/</link>
|
||||||
|
<description>Recent content in Examples on NoNonsense FilePicker</description>
|
||||||
|
<generator>Hugo -- gohugo.io</generator>
|
||||||
|
<language>en-us</language>
|
||||||
|
<lastBuildDate>Sat, 16 Jul 2016 17:36:40 +0200</lastBuildDate>
|
||||||
|
<atom:link href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/index.xml" rel="self" type="application/rss+xml" />
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<title>Standalone fragment</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/</link>
|
||||||
|
<pubDate>Sat, 16 Jul 2016 17:36:40 +0200</pubDate>
|
||||||
|
|
||||||
|
<guid>http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/</guid>
|
||||||
|
<description><p>To use the fragment together with an existing toolbar/action bar, a few things should be overridden.</p>
|
||||||
|
|
||||||
|
<p>Here&rsquo;s a minimal example where the toolbar is intercepted from being set as the main toolbar. The menu creation is also intercepted and populates the toolbar directly.</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">StandaloneFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> Toolbar mToolbar<span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">void</span> <span style="color: #06287e">setupToolbar</span><span style="color: #666666">(</span>Toolbar toolbar<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Prevent it from being set as main toolbar by NOT calling super.setupToolbar().</span>
|
||||||
|
mToolbar <span style="color: #666666">=</span> toolbar<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">void</span> <span style="color: #06287e">onCreateOptionsMenu</span><span style="color: #666666">(</span>Menu menu<span style="color: #666666">,</span> MenuInflater inflater<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Populate the toolbar with the menu items instead of the action bar.</span>
|
||||||
|
mToolbar<span style="color: #666666">.</span><span style="color: #4070a0">inflateMenu</span><span style="color: #666666">(</span>R<span style="color: #666666">.</span><span style="color: #4070a0">menu</span><span style="color: #666666">.</span><span style="color: #4070a0">picker_actions</span><span style="color: #666666">);</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Set a menu listener on the toolbar with calls the regular onOptionsItemSelected method.</span>
|
||||||
|
mToolbar<span style="color: #666666">.</span><span style="color: #4070a0">setOnMenuItemClickListener</span><span style="color: #666666">(</span><span style="color: #007020; font-weight: bold">new</span> Toolbar<span style="color: #666666">.</span><span style="color: #4070a0">OnMenuItemClickListener</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">boolean</span> <span style="color: #06287e">onMenuItemClick</span><span style="color: #666666">(</span>MenuItem item<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> onOptionsItemSelected<span style="color: #666666">(</span>item<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">});</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// This is usually handled in onCreateOptions so do it here instead.</span>
|
||||||
|
MenuItem item <span style="color: #666666">=</span> mToolbar<span style="color: #666666">.</span><span style="color: #4070a0">getMenu</span><span style="color: #666666">().</span><span style="color: #4070a0">findItem</span><span style="color: #666666">(</span>com<span style="color: #666666">.</span><span style="color: #4070a0">nononsenseapps</span><span style="color: #666666">.</span><span style="color: #4070a0">filepicker</span><span style="color: #666666">.</span><span style="color: #4070a0">R</span><span style="color: #666666">.</span><span style="color: #4070a0">id</span><span style="color: #666666">.</span><span style="color: #4070a0">nnf_action_createdir</span><span style="color: #666666">);</span>
|
||||||
|
item<span style="color: #666666">.</span><span style="color: #4070a0">setVisible</span><span style="color: #666666">(</span>allowCreateDir<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<title>Override selection behavior</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/</link>
|
||||||
|
<pubDate>Sat, 16 Jul 2016 17:35:01 +0200</pubDate>
|
||||||
|
|
||||||
|
<guid>http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/</guid>
|
||||||
|
<description>
|
||||||
|
|
||||||
|
<p>New in <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/releases/tag/v2.4.0">2.4.0</a> are overridable methods to handle UI-interactions. The following methods are now available for augmentation:</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>onClickOK, handles ok button.</li>
|
||||||
|
<li>onClickCancel, handles cancel button.</li>
|
||||||
|
<li>onClickHeader, handles clicks on &ldquo;..&rdquo;.</li>
|
||||||
|
<li>onClickDir, handles clicks on non-selectable items (usually directories).</li>
|
||||||
|
<li>onLongClickDir, handles long clicks on non-selectable items.</li>
|
||||||
|
<li>onClickCheckable, handles clicks on selectable items.</li>
|
||||||
|
<li>onLongClickCheckable, handles long clicks on selectable items.</li>
|
||||||
|
<li>onClickCheckBox, handles clicks on the checkbox of selectable items.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>Please see the existing implementations before you override any of them.</p>
|
||||||
|
|
||||||
|
<h2 id="simple-example-make-clicks-instantly-select-items">Simple example, make clicks instantly select items</h2>
|
||||||
|
|
||||||
|
<p>As asked in <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/48">#48</a>, what if the picker is configured for selecting a single file and you want a click on that to instantly return the result. The default implementation will mark the item as selected, and then the user is required to press the OK button. This small change will make the operation a single click action, returning instantly once the user selects something.</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">SingleFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">void</span> <span style="color: #06287e">onClickCheckable</span><span style="color: #666666">(</span>View v<span style="color: #666666">,</span> CheckableViewHolder vh<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(!</span>allowMultiple<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Clear is necessary, in case user clicked some checkbox directly</span>
|
||||||
|
mCheckedItems<span style="color: #666666">.</span><span style="color: #4070a0">clear</span><span style="color: #666666">();</span>
|
||||||
|
mCheckedItems<span style="color: #666666">.</span><span style="color: #4070a0">add</span><span style="color: #666666">(</span>vh<span style="color: #666666">.</span><span style="color: #4070a0">file</span><span style="color: #666666">);</span>
|
||||||
|
onClickOk<span style="color: #666666">(</span><span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">.</span><span style="color: #4070a0">onClickCheckable</span><span style="color: #666666">(</span>v<span style="color: #666666">,</span> vh<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Now the astute reader might wonder, if my filepicker is only going to be used for selecting single files, why not just do:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">void</span> <span style="color: #06287e">onClickCheckable</span><span style="color: #666666">(</span>View v<span style="color: #666666">,</span> CheckableViewHolder vh<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">.</span><span style="color: #4070a0">onClickCheckable</span><span style="color: #666666">(</span>v<span style="color: #666666">,</span> vh<span style="color: #666666">);</span>
|
||||||
|
onClickOk<span style="color: #666666">(</span><span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>The reason is that the default implementation will animate the checkbox being selected on press. If you are closing the picker directly once the user selects something, you are basically animating something which isn&rsquo;t going to be seen and thus you are wasting (not that much) resources. Better to not animate at all in that case.</p>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<title>Override the back button</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/</link>
|
||||||
|
<pubDate>Sat, 16 Jul 2016 17:33:43 +0200</pubDate>
|
||||||
|
|
||||||
|
<guid>http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/</guid>
|
||||||
|
<description>
|
||||||
|
|
||||||
|
<p>In case you want the back button to navigate the hierarchy instead of
|
||||||
|
instantly exiting the activity, this is one approach you might take.</p>
|
||||||
|
|
||||||
|
<h2 id="create-an-activity-which-overrides-the-back-button-and-loads-a-custom-fragment">Create an activity which overrides the back button and loads a custom fragment</h2>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><code><span></span><span style="color: #007020; font-weight: bold">package</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.examples.backbutton</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">android.os.Environment</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.AbstractFilePickerFragment</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.FilePickerActivity</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">java.io.File</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">BackHandlingFilePickerActivity</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerActivity <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * Need access to the fragment</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
BackHandlingFilePickerFragment currentFragment<span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * Return a copy of the new fragment and set the variable above.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> AbstractFilePickerFragment<span style="color: #666666">&lt;</span>File<span style="color: #666666">&gt;</span> <span style="color: #06287e">getFragment</span><span style="color: #666666">(</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> String startPath<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">int</span> mode<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowMultiple<span style="color: #666666">,</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowDirCreate<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowExistingFile<span style="color: #666666">,</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> singleClick<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// startPath is allowed to be null.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// In that case, default folder should be SD-card and not &quot;/&quot;</span>
|
||||||
|
String path <span style="color: #666666">=</span> <span style="color: #666666">(</span>startPath <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">?</span> startPath
|
||||||
|
<span style="color: #666666">:</span> Environment<span style="color: #666666">.</span><span style="color: #4070a0">getExternalStorageDirectory</span><span style="color: #666666">().</span><span style="color: #4070a0">getPath</span><span style="color: #666666">());</span>
|
||||||
|
|
||||||
|
currentFragment <span style="color: #666666">=</span> <span style="color: #007020; font-weight: bold">new</span> BackHandlingFilePickerFragment<span style="color: #666666">();</span>
|
||||||
|
currentFragment<span style="color: #666666">.</span><span style="color: #4070a0">setArgs</span><span style="color: #666666">(</span>path<span style="color: #666666">,</span> mode<span style="color: #666666">,</span> allowMultiple<span style="color: #666666">,</span> allowDirCreate<span style="color: #666666">,</span>
|
||||||
|
allowExistingFile<span style="color: #666666">,</span> singleClick<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> currentFragment<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * Override the back-button.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">void</span> <span style="color: #06287e">onBackPressed</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// If at top most level, normal behaviour</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>currentFragment<span style="color: #666666">.</span><span style="color: #4070a0">isBackTop</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">.</span><span style="color: #4070a0">onBackPressed</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Else go up</span>
|
||||||
|
currentFragment<span style="color: #666666">.</span><span style="color: #4070a0">goUp</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</code></pre></div>
|
||||||
|
|
||||||
|
<h2 id="in-your-custom-fragment-implement-the-goup-and-isbacktop-methods">In your custom fragment, implement the goUp and isBackTop methods</h2>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><code><span></span><span style="color: #007020; font-weight: bold">package</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.examples.backbutton</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.FilePickerFragment</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">java.io.File</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">BackHandlingFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * For consistency, the top level the back button checks against should be the start path.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * But it will fall back on /.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> File <span style="color: #06287e">getBackTop</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> getPath<span style="color: #666666">(</span>getArguments<span style="color: #666666">().</span><span style="color: #4070a0">getString</span><span style="color: #666666">(</span>KEY_START_PATH<span style="color: #666666">,</span> <span style="color: #4070a0">&quot;/&quot;</span><span style="color: #666666">));</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return true if the current path is the startpath or /</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">boolean</span> <span style="color: #06287e">isBackTop</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #40a070">0</span> <span style="color: #666666">==</span> compareFiles<span style="color: #666666">(</span>mCurrentPath<span style="color: #666666">,</span> getBackTop<span style="color: #666666">())</span> <span style="color: #666666">||</span>
|
||||||
|
<span style="color: #40a070">0</span> <span style="color: #666666">==</span> compareFiles<span style="color: #666666">(</span>mCurrentPath<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">new</span> File<span style="color: #666666">(</span><span style="color: #4070a0">&quot;/&quot;</span><span style="color: #666666">));</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * Go up on level, same as pressing on &quot;..&quot;.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">void</span> <span style="color: #06287e">goUp</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
mCurrentPath <span style="color: #666666">=</span> getParent<span style="color: #666666">(</span>mCurrentPath<span style="color: #666666">);</span>
|
||||||
|
mCheckedItems<span style="color: #666666">.</span><span style="color: #4070a0">clear</span><span style="color: #666666">();</span>
|
||||||
|
mCheckedVisibleViewHolders<span style="color: #666666">.</span><span style="color: #4070a0">clear</span><span style="color: #666666">();</span>
|
||||||
|
refresh<span style="color: #666666">(</span>mCurrentPath<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</code></pre></div>
|
||||||
|
|
||||||
|
<h2 id="example-manifest">Example manifest</h2>
|
||||||
|
|
||||||
|
<p>Make sure <code>android-theme</code> points to the correct theme.</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><code><span></span><span style="color: #062873; font-weight: bold">&lt;manifest</span> <span style="color: #4070a0">xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;</span>
|
||||||
|
<span style="color: #4070a0">package=&quot;com.nononsenseapps.filepicker.examples&quot;</span><span style="color: #062873; font-weight: bold">&gt;</span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;uses-permission</span> <span style="color: #4070a0">android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot;</span> <span style="color: #062873; font-weight: bold">/&gt;</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">&lt;!-- Only needed to create sub directories. --&gt;</span>
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;uses-permission</span> <span style="color: #4070a0">android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot;</span> <span style="color: #062873; font-weight: bold">/&gt;</span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;application</span>
|
||||||
|
<span style="color: #4070a0">android:allowBackup=&quot;true&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:icon=&quot;@mipmap/ic_launcher&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:label=&quot;@string/app_name&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:supportsRtl=&quot;true&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:theme=&quot;@style/FilePickerTheme&quot;</span><span style="color: #062873; font-weight: bold">&gt;</span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;activity</span>
|
||||||
|
<span style="color: #4070a0">android:name=&quot;.backbutton.BackHandlingFilePickerActivity&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:label=&quot;Override back button&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:theme=&quot;@style/FilePickerTheme&quot;</span><span style="color: #062873; font-weight: bold">&gt;</span>
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;/activity&gt;</span>
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;/application&gt;</span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;/manifest&gt;</span>
|
||||||
|
</code></pre></div>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<title>Filter based on file extension</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/</link>
|
||||||
|
<pubDate>Sat, 16 Jul 2016 17:32:07 +0200</pubDate>
|
||||||
|
|
||||||
|
<guid>http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/</guid>
|
||||||
|
<description>
|
||||||
|
|
||||||
|
<p>By default, the SD-card picker will display all files in alphabetical order. But let&rsquo;s say that your app can only handle a specific type of file, like <code>.txt</code>-files. Here&rsquo;s a minimal example which will only display such files.</p>
|
||||||
|
|
||||||
|
<p>First, a convenience method to get the extension of files:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span> <span style="color: #60a0b0; font-style: italic">// File extension to filter on, including the initial dot.</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">private</span> <span style="color: #007020; font-weight: bold">static</span> <span style="color: #007020; font-weight: bold">final</span> String EXTENSION <span style="color: #666666">=</span> <span style="color: #4070a0">&quot;.txt&quot;</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> *</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param file</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return The file extension. If file has no extension, it returns null.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">private</span> String <span style="color: #06287e">getExtension</span><span style="color: #666666">(</span><span style="color: #555555; font-weight: bold">@NonNull</span> File file<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
String path <span style="color: #666666">=</span> file<span style="color: #666666">.</span><span style="color: #4070a0">getPath</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #902000">int</span> i <span style="color: #666666">=</span> path<span style="color: #666666">.</span><span style="color: #4070a0">lastIndexOf</span><span style="color: #666666">(</span><span style="color: #4070a0">&quot;.&quot;</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>i <span style="color: #666666">&lt;</span> <span style="color: #40a070">0</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> path<span style="color: #666666">.</span><span style="color: #4070a0">substring</span><span style="color: #666666">(</span>i<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>The decision to display files or not is done with the <code>isItemVisible</code> method. Just add a check for the file-extension:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span> <span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">boolean</span> <span style="color: #06287e">isItemVisible</span><span style="color: #666666">(</span><span style="color: #007020; font-weight: bold">final</span> File file<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// simplified behavior (see below full code)</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// return isDir(file) || (mode == MODE_FILE || mode == MODE_FILE_AND_DIR);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(!</span>isDir<span style="color: #666666">(</span>file<span style="color: #666666">)</span> <span style="color: #666666">&amp;&amp;</span> <span style="color: #666666">(</span>mode <span style="color: #666666">==</span> MODE_FILE <span style="color: #666666">||</span> mode <span style="color: #666666">==</span> MODE_FILE_AND_DIR<span style="color: #666666">))</span> <span style="color: #666666">{</span>
|
||||||
|
String ext <span style="color: #666666">=</span> getExtension<span style="color: #666666">(</span>file<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> ext <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&amp;&amp;</span> EXTENSION<span style="color: #666666">.</span><span style="color: #4070a0">equalsIgnoreCase</span><span style="color: #666666">(</span>ext<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> isDir<span style="color: #666666">(</span>file<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h3 id="before-and-after">Before and After</h3>
|
||||||
|
|
||||||
|
<p><img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/filter_before.png" width="30%" alt="Before"/>
|
||||||
|
<img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/filter_after.png" width="30%" alt="After"/></p>
|
||||||
|
|
||||||
|
<h3 id="full-fragment-code">Full Fragment code</h3>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.FilePickerFragment</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">java.io.File</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">FilteredFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// File extension to filter on</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">private</span> <span style="color: #007020; font-weight: bold">static</span> <span style="color: #007020; font-weight: bold">final</span> String EXTENSION <span style="color: #666666">=</span> <span style="color: #4070a0">&quot;.txt&quot;</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> *</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param file</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return The file extension. If file has no extension, it returns null.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">private</span> String <span style="color: #06287e">getExtension</span><span style="color: #666666">(</span><span style="color: #555555; font-weight: bold">@NonNull</span> File file<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
String path <span style="color: #666666">=</span> file<span style="color: #666666">.</span><span style="color: #4070a0">getPath</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #902000">int</span> i <span style="color: #666666">=</span> path<span style="color: #666666">.</span><span style="color: #4070a0">lastIndexOf</span><span style="color: #666666">(</span><span style="color: #4070a0">&quot;.&quot;</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>i <span style="color: #666666">&lt;</span> <span style="color: #40a070">0</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> path<span style="color: #666666">.</span><span style="color: #4070a0">substring</span><span style="color: #666666">(</span>i<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">boolean</span> <span style="color: #06287e">isItemVisible</span><span style="color: #666666">(</span><span style="color: #007020; font-weight: bold">final</span> File file<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #902000">boolean</span> ret <span style="color: #666666">=</span> <span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">.</span><span style="color: #4070a0">isItemVisible</span><span style="color: #666666">(</span>file<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>ret <span style="color: #666666">&amp;&amp;</span> <span style="color: #666666">!</span>isDir<span style="color: #666666">(</span>file<span style="color: #666666">)</span> <span style="color: #666666">&amp;&amp;</span> <span style="color: #666666">(</span>mode <span style="color: #666666">==</span> MODE_FILE <span style="color: #666666">||</span> mode <span style="color: #666666">==</span> MODE_FILE_AND_DIR<span style="color: #666666">))</span> <span style="color: #666666">{</span>
|
||||||
|
String ext <span style="color: #666666">=</span> getExtension<span style="color: #666666">(</span>file<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> ext <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&amp;&amp;</span> EXTENSION<span style="color: #666666">.</span><span style="color: #4070a0">equalsIgnoreCase</span><span style="color: #666666">(</span>ext<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> ret<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<title>Custom item layout</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/</link>
|
||||||
|
<pubDate>Sat, 16 Jul 2016 17:21:28 +0200</pubDate>
|
||||||
|
|
||||||
|
<guid>http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/</guid>
|
||||||
|
<description>
|
||||||
|
|
||||||
|
<p>Say you want to browse some files which have really long names. By default, filenames will be cut if they exceed one line in width like <code>ThisIsAReallyLongFi...</code>. What if we really wanted it show like in this image?</p>
|
||||||
|
|
||||||
|
<p><img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/itemlayout_longfilename.png" alt="Example of a long filename" /></p>
|
||||||
|
|
||||||
|
<p>The behavior of the text is defined in the listitem layouts:
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/res/layout/nnf_filepicker_listitem_checkable.xml">nnf_filepicker_listitem_checkable</a>
|
||||||
|
and
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/res/layout/nnf_filepicker_listitem_dir.xml">nnf_filepicker_listitem_dir</a>.</p>
|
||||||
|
|
||||||
|
<p>There are two kinds of layouts, one with a checkbox to allow selection, and one without a checkbox. The second one is also used for the special header item <code>..</code> though you could of course have a special layout for that if you wanted.</p>
|
||||||
|
|
||||||
|
<h3 id="layouts">Layouts</h3>
|
||||||
|
|
||||||
|
<p>Let&rsquo;s create some new layouts which will support longer filenames as follows:</p>
|
||||||
|
|
||||||
|
<p><strong>longer_listitem_checkable.xml</strong></p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;LinearLayout</span> <span style="color: #4070a0">xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;</span>
|
||||||
|
<span style="color: #4070a0">xmlns:tools=&quot;http://schemas.android.com/tools&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width=&quot;match_parent&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height=&quot;wrap_content&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:background=&quot;?android:selectableItemBackground&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:minHeight=&quot;?android:listPreferredItemHeight&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:orientation=&quot;horizontal&quot;</span><span style="color: #062873; font-weight: bold">&gt;</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">&lt;!--suppress AndroidDomInspection --&gt;</span>
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;ImageView</span>
|
||||||
|
<span style="color: #4070a0">android:id=&quot;@+id/item_icon&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width=&quot;?android:listPreferredItemHeight&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height=&quot;?android:listPreferredItemHeight&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:adjustViewBounds=&quot;true&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:scaleType=&quot;fitCenter&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:src=&quot;@drawable/nnf_ic_file_folder&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:tint=&quot;?attr/colorAccent&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:visibility=&quot;visible&quot;</span>
|
||||||
|
<span style="color: #4070a0">tools:ignore=&quot;ContentDescription&quot;</span> <span style="color: #062873; font-weight: bold">/&gt;</span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;TextView</span>
|
||||||
|
<span style="color: #4070a0">android:id=&quot;@android:id/text1&quot;</span>
|
||||||
|
<span style="color: #4070a0">style=&quot;?android:textAppearanceLarge&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width=&quot;0dp&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height=&quot;wrap_content&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:minHeight=&quot;?android:listPreferredItemHeight&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_weight=&quot;1&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:ellipsize=&quot;end&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:gravity=&quot;center_vertical&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:maxLines=&quot;4&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:padding=&quot;8dp&quot;</span><span style="color: #062873; font-weight: bold">/&gt;</span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;CheckBox</span>
|
||||||
|
<span style="color: #4070a0">android:id=&quot;@+id/checkbox&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width=&quot;wrap_content&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height=&quot;match_parent&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:paddingEnd=&quot;8dp&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:paddingRight=&quot;8dp&quot;</span>
|
||||||
|
<span style="color: #4070a0">tools:ignore=&quot;RtlSymmetry&quot;</span> <span style="color: #062873; font-weight: bold">/&gt;</span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;/LinearLayout&gt;</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p><strong>longer_listitem_dir.xml</strong></p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;LinearLayout</span> <span style="color: #4070a0">xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;</span>
|
||||||
|
<span style="color: #4070a0">xmlns:tools=&quot;http://schemas.android.com/tools&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width=&quot;match_parent&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height=&quot;wrap_content&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:background=&quot;?android:selectableItemBackground&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:minHeight=&quot;?android:listPreferredItemHeight&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:orientation=&quot;horizontal&quot;</span>
|
||||||
|
<span style="color: #062873; font-weight: bold">&gt;</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">&lt;!--suppress AndroidDomInspection --&gt;</span>
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;ImageView</span>
|
||||||
|
<span style="color: #4070a0">android:id=&quot;@+id/item_icon&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width=&quot;?android:listPreferredItemHeight&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height=&quot;?android:listPreferredItemHeight&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:adjustViewBounds=&quot;true&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:scaleType=&quot;center&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:src=&quot;@drawable/nnf_ic_file_folder&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:tint=&quot;?attr/colorAccent&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:visibility=&quot;visible&quot;</span>
|
||||||
|
<span style="color: #4070a0">tools:ignore=&quot;ContentDescription&quot;</span> <span style="color: #062873; font-weight: bold">/&gt;</span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;TextView</span>
|
||||||
|
<span style="color: #4070a0">android:id=&quot;@android:id/text1&quot;</span>
|
||||||
|
<span style="color: #4070a0">style=&quot;?android:textAppearanceLarge&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_width=&quot;0dp&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_height=&quot;wrap_content&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:minHeight=&quot;?android:listPreferredItemHeight&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:layout_weight=&quot;1&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:ellipsize=&quot;end&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:gravity=&quot;center_vertical&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:maxLines=&quot;4&quot;</span>
|
||||||
|
<span style="color: #4070a0">android:padding=&quot;8dp&quot;</span><span style="color: #062873; font-weight: bold">/&gt;</span>
|
||||||
|
<span style="color: #062873; font-weight: bold">&lt;/LinearLayout&gt;</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Note that I defined the TextViews to have a maximum of 4 lines (actual number is up to you), and a minimum height of <code>android:listPreferredItemHeight</code> (this I recommend, otherwise it looks wonky and off-center). And just be clear, the <em>ids</em> of these fields must be <code>@+id/item_icon</code>, <code>@android:id/text1</code>, and <code>@+id/checkbox</code>, or the code WILL crash on you.</p>
|
||||||
|
|
||||||
|
<h3 id="code">Code</h3>
|
||||||
|
|
||||||
|
<p>To use the new layouts, you need to override the <code>onCreateViewHolder</code> method in
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/blob/master/library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerFragment.java">AbstractFilePickerFragment</a>.</p>
|
||||||
|
|
||||||
|
<p>Since this example will be browsing the SD-card, I will extend from the built-in FilePickerFragment.</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">CustomLayoutFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param parent Containing view</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param viewType which the ViewHolder will contain. Will be one of:</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * [VIEWTYPE_HEADER, VIEWTYPE_CHECKABLE, VIEWTYPE_DIR]. It is OK, and even expected, to use the same</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * layout for VIEWTYPE_HEADER and VIEWTYPE_DIR.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return a view holder for a file or directory (the difference is presence of checkbox).</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> RecyclerView<span style="color: #666666">.</span><span style="color: #4070a0">ViewHolder</span> <span style="color: #06287e">onCreateViewHolder</span><span style="color: #666666">(</span>ViewGroup parent<span style="color: #666666">,</span> <span style="color: #902000">int</span> viewType<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
View v<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">switch</span> <span style="color: #666666">(</span>viewType<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">case</span> LogicHandler<span style="color: #666666">.</span><span style="color: #4070a0">VIEWTYPE_HEADER</span><span style="color: #666666">:</span>
|
||||||
|
v <span style="color: #666666">=</span> LayoutInflater<span style="color: #666666">.</span><span style="color: #4070a0">from</span><span style="color: #666666">(</span>getActivity<span style="color: #666666">()).</span><span style="color: #4070a0">inflate</span><span style="color: #666666">(</span>R<span style="color: #666666">.</span><span style="color: #4070a0">layout</span><span style="color: #666666">.</span><span style="color: #4070a0">longer_listitem_dir</span><span style="color: #666666">,</span>
|
||||||
|
parent<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">false</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">new</span> HeaderViewHolder<span style="color: #666666">(</span>v<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">case</span> LogicHandler<span style="color: #666666">.</span><span style="color: #4070a0">VIEWTYPE_CHECKABLE</span><span style="color: #666666">:</span>
|
||||||
|
v <span style="color: #666666">=</span> LayoutInflater<span style="color: #666666">.</span><span style="color: #4070a0">from</span><span style="color: #666666">(</span>getActivity<span style="color: #666666">()).</span><span style="color: #4070a0">inflate</span><span style="color: #666666">(</span>R<span style="color: #666666">.</span><span style="color: #4070a0">layout</span><span style="color: #666666">.</span><span style="color: #4070a0">longer_listitem_checkable</span><span style="color: #666666">,</span>
|
||||||
|
parent<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">false</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">new</span> CheckableViewHolder<span style="color: #666666">(</span>v<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">case</span> LogicHandler<span style="color: #666666">.</span><span style="color: #4070a0">VIEWTYPE_DIR</span><span style="color: #666666">:</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">default</span><span style="color: #666666">:</span>
|
||||||
|
v <span style="color: #666666">=</span> LayoutInflater<span style="color: #666666">.</span><span style="color: #4070a0">from</span><span style="color: #666666">(</span>getActivity<span style="color: #666666">()).</span><span style="color: #4070a0">inflate</span><span style="color: #666666">(</span>R<span style="color: #666666">.</span><span style="color: #4070a0">layout</span><span style="color: #666666">.</span><span style="color: #4070a0">longer_listitem_dir</span><span style="color: #666666">,</span>
|
||||||
|
parent<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">false</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">new</span> DirViewHolder<span style="color: #666666">(</span>v<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>And as always, to use your custom fragment you need a custom activity which loads it for you:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">CustomLayoutPickerActivity</span> <span style="color: #007020; font-weight: bold">extends</span> AbstractFilePickerActivity <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #06287e">CustomLayoutPickerActivity</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> AbstractFilePickerFragment<span style="color: #666666">&lt;</span>File<span style="color: #666666">&gt;</span> <span style="color: #06287e">getFragment</span><span style="color: #666666">(</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> String startPath<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">int</span> mode<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowMultiple<span style="color: #666666">,</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowCreateDir<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Load our custom fragment here</span>
|
||||||
|
AbstractFilePickerFragment<span style="color: #666666">&lt;</span>File<span style="color: #666666">&gt;</span> fragment <span style="color: #666666">=</span> <span style="color: #007020; font-weight: bold">new</span> CustomLayoutFilePickerFragment<span style="color: #666666">();</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// startPath is allowed to be null. In that case, default folder should be SD-card and not &quot;/&quot;</span>
|
||||||
|
fragment<span style="color: #666666">.</span><span style="color: #4070a0">setArgs</span><span style="color: #666666">(</span>startPath <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">?</span> startPath <span style="color: #666666">:</span> Environment<span style="color: #666666">.</span><span style="color: #4070a0">getExternalStorageDirectory</span><span style="color: #666666">().</span><span style="color: #4070a0">getPath</span><span style="color: #666666">(),</span>
|
||||||
|
mode<span style="color: #666666">,</span> allowMultiple<span style="color: #666666">,</span> allowCreateDir<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> fragment<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<title>Change the sort order</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/</link>
|
||||||
|
<pubDate>Sat, 16 Jul 2016 17:10:46 +0200</pubDate>
|
||||||
|
|
||||||
|
<guid>http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/</guid>
|
||||||
|
<description>
|
||||||
|
|
||||||
|
<p>By default, the SD-card picker will display all files in alphabetical order. But what if you want a different sort-order?</p>
|
||||||
|
|
||||||
|
<p>You can override the sorting by overriding the <code>compareFiles</code>-method:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span> <span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">int</span> <span style="color: #06287e">compareFiles</span><span style="color: #666666">(</span>File lhs<span style="color: #666666">,</span> File rhs<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>lhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">()</span> <span style="color: #666666">&amp;&amp;</span> <span style="color: #666666">!</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #666666">-</span><span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">()</span> <span style="color: #666666">&amp;&amp;</span> <span style="color: #666666">!</span>lhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// This was the previous behaviour for all file-file comparisons. Now it&#39;s</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// only done if the files have the same extension, or no extension.</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&amp;&amp;</span> getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">).</span><span style="color: #4070a0">equalsIgnoreCase</span><span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">))</span> <span style="color: #666666">||</span>
|
||||||
|
getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">==</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&amp;&amp;</span> getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">)</span> <span style="color: #666666">==</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> lhs<span style="color: #666666">.</span><span style="color: #4070a0">getName</span><span style="color: #666666">().</span><span style="color: #4070a0">compareToIgnoreCase</span><span style="color: #666666">(</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">getName</span><span style="color: #666666">());</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Otherwise, we sort on extension placing files with no extension last.</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&amp;&amp;</span> getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Both have extension, just compare extensions</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">).</span><span style="color: #4070a0">compareToIgnoreCase</span><span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">));</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Left has extension, place it first</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #666666">-</span><span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Right has extension, place it first</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h3 id="before-and-after">Before and After</h3>
|
||||||
|
|
||||||
|
<p><img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/sorting_before.png" width="30%" alt="Before"/>
|
||||||
|
<img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/sorting_after.png" width="30%" alt="After"/></p>
|
||||||
|
|
||||||
|
<h3 id="full-fragment-code">Full Fragment code</h3>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.FilePickerFragment</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">java.io.File</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">SortedFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> *</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param file</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return The file extension. If file has no extension, it returns null.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">private</span> String <span style="color: #06287e">getExtension</span><span style="color: #666666">(</span><span style="color: #555555; font-weight: bold">@NonNull</span> File file<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
String path <span style="color: #666666">=</span> file<span style="color: #666666">.</span><span style="color: #4070a0">getPath</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #902000">int</span> i <span style="color: #666666">=</span> path<span style="color: #666666">.</span><span style="color: #4070a0">lastIndexOf</span><span style="color: #666666">(</span><span style="color: #4070a0">&quot;.&quot;</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>i <span style="color: #666666">&lt;</span> <span style="color: #40a070">0</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> path<span style="color: #666666">.</span><span style="color: #4070a0">substring</span><span style="color: #666666">(</span>i<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * Compare two files to determine their relative sort order. This follows the usual</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * comparison interface. Override to determine your own custom sort order.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> *</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param lhs File on the &quot;left-hand side&quot;</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param rhs File on the &quot;right-hand side&quot;</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return -1 if if lhs should be placed before rhs, 0 if they are equal,</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * and 1 if rhs should be placed before lhs</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">int</span> <span style="color: #06287e">compareFiles</span><span style="color: #666666">(</span>File lhs<span style="color: #666666">,</span> File rhs<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>lhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">()</span> <span style="color: #666666">&amp;&amp;</span> <span style="color: #666666">!</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #666666">-</span><span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">()</span> <span style="color: #666666">&amp;&amp;</span> <span style="color: #666666">!</span>lhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// This was the previous behaviour for all file-file comparisons. Now it&#39;s</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// only done if the files have the same extension, or no extension.</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&amp;&amp;</span> getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">).</span><span style="color: #4070a0">equalsIgnoreCase</span><span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">))</span> <span style="color: #666666">||</span>
|
||||||
|
getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">==</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&amp;&amp;</span> getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">)</span> <span style="color: #666666">==</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> lhs<span style="color: #666666">.</span><span style="color: #4070a0">getName</span><span style="color: #666666">().</span><span style="color: #4070a0">compareToIgnoreCase</span><span style="color: #666666">(</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">getName</span><span style="color: #666666">());</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Otherwise, we sort on extension placing files with no extension last.</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&amp;&amp;</span> getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Both have extension, just compare extensions</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">).</span><span style="color: #4070a0">compareToIgnoreCase</span><span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">));</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Left has extension, place it first</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #666666">-</span><span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Right has extension, place it first</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
|
|
@ -0,0 +1,588 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<html class="no-js">
|
||||||
|
|
||||||
|
<head lang="en-us">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||||
|
<title>Override the back button - NoNonsense FilePicker</title>
|
||||||
|
<meta name="generator" content="Hugo 0.16" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="description" content="An extensible and flexible file-picker for Android.">
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
<meta name="author" content="SpaceCowboy">
|
||||||
|
|
||||||
|
|
||||||
|
<meta property="og:url" content="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
<meta property="og:title" content="NoNonsense FilePicker">
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-title" content="NoNonsense FilePicker">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
<link rel="icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Icon';
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?52m981');
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?#iefix52m981')
|
||||||
|
format('embedded-opentype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.woff?52m981')
|
||||||
|
format('woff'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.ttf?52m981')
|
||||||
|
format('truetype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.svg?52m981#icon')
|
||||||
|
format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/application.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/temporary.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/palettes.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/highlight/highlight.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700|Roboto%2bMono">
|
||||||
|
<style>
|
||||||
|
body, input {
|
||||||
|
font-family: 'Roboto', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
pre, code {
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/modernizr.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="palette-primary-red palette-accent-light green">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="backdrop">
|
||||||
|
<div class="backdrop-paper"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-drawer">
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-search">
|
||||||
|
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<nav aria-label="Header">
|
||||||
|
<div class="bar default">
|
||||||
|
<div class="button button-menu" role="button" aria-label="Menu">
|
||||||
|
<label class="toggle-button icon icon-menu" for="toggle-drawer">
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Override the back button
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||||||
|
<a href="https://github.com/spacecowboy" title="@spacecowboy on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bar search">
|
||||||
|
<div class="button button-close" role="button" aria-label="Close">
|
||||||
|
<label class="toggle-button icon icon-back" for="toggle-search"></label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="field">
|
||||||
|
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-reset" role="button" aria-label="Search">
|
||||||
|
<button class="toggle-button icon icon-close" id="reset-search"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="drawer">
|
||||||
|
<nav aria-label="Navigation">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker" class="project">
|
||||||
|
<div class="banner">
|
||||||
|
|
||||||
|
<div class="name">
|
||||||
|
<strong>NoNonsense FilePicker </strong>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
spacecowboy/NoNonsense-FilePicker
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<ul class="repo">
|
||||||
|
<li class="repo-download">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||||||
|
<i class="icon icon-download"></i> Download
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="repo-stars">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||||||
|
<i class="icon icon-star"></i> Stars
|
||||||
|
<span class="count">–</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="toc">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Readme" href="http://spacecowboy.github.io/NoNonsense-FilePicker/readme/">
|
||||||
|
|
||||||
|
Readme
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Changelog" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="License" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
License
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="section">Examples</span>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Change the sort order" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
Change the sort order
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Filter based on file extension" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
Filter based on file extension
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Custom item layout" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
Custom item layout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="current" title="Override the back button" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
Override the back button
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<ul id="scrollspy">
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override selection behavior" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
Override selection behavior
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Standalone fragment" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
Standalone fragment
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<span class="section">The author</span>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/spacecowboy" target="_blank" title="@spacecowboy on GitHub">
|
||||||
|
@spacecowboy on GitHub
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article class="article">
|
||||||
|
<div class="wrapper">
|
||||||
|
<h1>Override the back button </h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>In case you want the back button to navigate the hierarchy instead of
|
||||||
|
instantly exiting the activity, this is one approach you might take.</p>
|
||||||
|
|
||||||
|
<h2 id="create-an-activity-which-overrides-the-back-button-and-loads-a-custom-fragment">Create an activity which overrides the back button and loads a custom fragment</h2>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><code><span></span><span style="color: #007020; font-weight: bold">package</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.examples.backbutton</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">android.os.Environment</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.AbstractFilePickerFragment</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.FilePickerActivity</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">java.io.File</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">BackHandlingFilePickerActivity</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerActivity <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * Need access to the fragment</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
BackHandlingFilePickerFragment currentFragment<span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * Return a copy of the new fragment and set the variable above.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> AbstractFilePickerFragment<span style="color: #666666"><</span>File<span style="color: #666666">></span> <span style="color: #06287e">getFragment</span><span style="color: #666666">(</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> String startPath<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">int</span> mode<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowMultiple<span style="color: #666666">,</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowDirCreate<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowExistingFile<span style="color: #666666">,</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> singleClick<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// startPath is allowed to be null.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// In that case, default folder should be SD-card and not "/"</span>
|
||||||
|
String path <span style="color: #666666">=</span> <span style="color: #666666">(</span>startPath <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">?</span> startPath
|
||||||
|
<span style="color: #666666">:</span> Environment<span style="color: #666666">.</span><span style="color: #4070a0">getExternalStorageDirectory</span><span style="color: #666666">().</span><span style="color: #4070a0">getPath</span><span style="color: #666666">());</span>
|
||||||
|
|
||||||
|
currentFragment <span style="color: #666666">=</span> <span style="color: #007020; font-weight: bold">new</span> BackHandlingFilePickerFragment<span style="color: #666666">();</span>
|
||||||
|
currentFragment<span style="color: #666666">.</span><span style="color: #4070a0">setArgs</span><span style="color: #666666">(</span>path<span style="color: #666666">,</span> mode<span style="color: #666666">,</span> allowMultiple<span style="color: #666666">,</span> allowDirCreate<span style="color: #666666">,</span>
|
||||||
|
allowExistingFile<span style="color: #666666">,</span> singleClick<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> currentFragment<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * Override the back-button.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">void</span> <span style="color: #06287e">onBackPressed</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// If at top most level, normal behaviour</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>currentFragment<span style="color: #666666">.</span><span style="color: #4070a0">isBackTop</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">.</span><span style="color: #4070a0">onBackPressed</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Else go up</span>
|
||||||
|
currentFragment<span style="color: #666666">.</span><span style="color: #4070a0">goUp</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</code></pre></div>
|
||||||
|
|
||||||
|
<h2 id="in-your-custom-fragment-implement-the-goup-and-isbacktop-methods">In your custom fragment, implement the goUp and isBackTop methods</h2>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><code><span></span><span style="color: #007020; font-weight: bold">package</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.examples.backbutton</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.FilePickerFragment</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">java.io.File</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">BackHandlingFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * For consistency, the top level the back button checks against should be the start path.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * But it will fall back on /.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> File <span style="color: #06287e">getBackTop</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> getPath<span style="color: #666666">(</span>getArguments<span style="color: #666666">().</span><span style="color: #4070a0">getString</span><span style="color: #666666">(</span>KEY_START_PATH<span style="color: #666666">,</span> <span style="color: #4070a0">"/"</span><span style="color: #666666">));</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return true if the current path is the startpath or /</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">boolean</span> <span style="color: #06287e">isBackTop</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #40a070">0</span> <span style="color: #666666">==</span> compareFiles<span style="color: #666666">(</span>mCurrentPath<span style="color: #666666">,</span> getBackTop<span style="color: #666666">())</span> <span style="color: #666666">||</span>
|
||||||
|
<span style="color: #40a070">0</span> <span style="color: #666666">==</span> compareFiles<span style="color: #666666">(</span>mCurrentPath<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">new</span> File<span style="color: #666666">(</span><span style="color: #4070a0">"/"</span><span style="color: #666666">));</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * Go up on level, same as pressing on "..".</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">void</span> <span style="color: #06287e">goUp</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
mCurrentPath <span style="color: #666666">=</span> getParent<span style="color: #666666">(</span>mCurrentPath<span style="color: #666666">);</span>
|
||||||
|
mCheckedItems<span style="color: #666666">.</span><span style="color: #4070a0">clear</span><span style="color: #666666">();</span>
|
||||||
|
mCheckedVisibleViewHolders<span style="color: #666666">.</span><span style="color: #4070a0">clear</span><span style="color: #666666">();</span>
|
||||||
|
refresh<span style="color: #666666">(</span>mCurrentPath<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</code></pre></div>
|
||||||
|
|
||||||
|
<h2 id="example-manifest">Example manifest</h2>
|
||||||
|
|
||||||
|
<p>Make sure <code>android-theme</code> points to the correct theme.</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><code><span></span><span style="color: #062873; font-weight: bold"><manifest</span> <span style="color: #4070a0">xmlns:android="http://schemas.android.com/apk/res/android"</span>
|
||||||
|
<span style="color: #4070a0">package="com.nononsenseapps.filepicker.examples"</span><span style="color: #062873; font-weight: bold">></span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold"><uses-permission</span> <span style="color: #4070a0">android:name="android.permission.READ_EXTERNAL_STORAGE"</span> <span style="color: #062873; font-weight: bold">/></span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"><!-- Only needed to create sub directories. --></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><uses-permission</span> <span style="color: #4070a0">android:name="android.permission.WRITE_EXTERNAL_STORAGE"</span> <span style="color: #062873; font-weight: bold">/></span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold"><application</span>
|
||||||
|
<span style="color: #4070a0">android:allowBackup="true"</span>
|
||||||
|
<span style="color: #4070a0">android:icon="@mipmap/ic_launcher"</span>
|
||||||
|
<span style="color: #4070a0">android:label="@string/app_name"</span>
|
||||||
|
<span style="color: #4070a0">android:supportsRtl="true"</span>
|
||||||
|
<span style="color: #4070a0">android:theme="@style/FilePickerTheme"</span><span style="color: #062873; font-weight: bold">></span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold"><activity</span>
|
||||||
|
<span style="color: #4070a0">android:name=".backbutton.BackHandlingFilePickerActivity"</span>
|
||||||
|
<span style="color: #4070a0">android:label="Override back button"</span>
|
||||||
|
<span style="color: #4070a0">android:theme="@style/FilePickerTheme"</span><span style="color: #062873; font-weight: bold">></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"></activity></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"></application></span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold"></manifest></span>
|
||||||
|
</code></pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="copyright" role="note">
|
||||||
|
|
||||||
|
© 2016 Released under the Mozilla Public License 2.0 –
|
||||||
|
|
||||||
|
Documentation built with
|
||||||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||||||
|
using the
|
||||||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="pagination" aria-label="Footer">
|
||||||
|
<div class="previous">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/" title="Override selection behavior">
|
||||||
|
<span class="direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="button button-previous" role="button" aria-label="Previous">
|
||||||
|
<i class="icon icon-back"></i>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Override selection behavior
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="next">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/" title="Filter based on file extension">
|
||||||
|
<span class="direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Filter based on file extension
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-next" role="button" aria-label="Next">
|
||||||
|
<i class="icon icon-forward"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="results" role="status" aria-live="polite">
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="meta"></div>
|
||||||
|
<div class="list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var base_url = 'http:\/\/spacecowboy.github.io\/NoNonsense-FilePicker\/';
|
||||||
|
var repo_id = 'spacecowboy\/NoNonsense-FilePicker';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Add headers to scrollspy */
|
||||||
|
var headers = document.getElementsByTagName("h2");
|
||||||
|
var scrollspy = document.getElementById('scrollspy');
|
||||||
|
|
||||||
|
if(scrollspy) {
|
||||||
|
if(headers.length > 0) {
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var li = document.createElement("li");
|
||||||
|
li.setAttribute("class", "anchor");
|
||||||
|
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", headers[i].innerHTML);
|
||||||
|
a.innerHTML = headers[i].innerHTML;
|
||||||
|
|
||||||
|
li.appendChild(a)
|
||||||
|
scrollspy.appendChild(li);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add permanent link next to the headers */
|
||||||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||||||
|
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("class", "headerlink");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", "Permanent link")
|
||||||
|
a.innerHTML = "#";
|
||||||
|
headers[i].appendChild(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="//gohugo.io/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,510 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<html class="no-js">
|
||||||
|
|
||||||
|
<head lang="en-us">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||||
|
<title>Override selection behavior - NoNonsense FilePicker</title>
|
||||||
|
<meta name="generator" content="Hugo 0.16" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="description" content="An extensible and flexible file-picker for Android.">
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
<meta name="author" content="SpaceCowboy">
|
||||||
|
|
||||||
|
|
||||||
|
<meta property="og:url" content="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
<meta property="og:title" content="NoNonsense FilePicker">
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-title" content="NoNonsense FilePicker">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
<link rel="icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Icon';
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?52m981');
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?#iefix52m981')
|
||||||
|
format('embedded-opentype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.woff?52m981')
|
||||||
|
format('woff'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.ttf?52m981')
|
||||||
|
format('truetype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.svg?52m981#icon')
|
||||||
|
format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/application.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/temporary.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/palettes.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/highlight/highlight.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700|Roboto%2bMono">
|
||||||
|
<style>
|
||||||
|
body, input {
|
||||||
|
font-family: 'Roboto', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
pre, code {
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/modernizr.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="palette-primary-red palette-accent-light green">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="backdrop">
|
||||||
|
<div class="backdrop-paper"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-drawer">
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-search">
|
||||||
|
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<nav aria-label="Header">
|
||||||
|
<div class="bar default">
|
||||||
|
<div class="button button-menu" role="button" aria-label="Menu">
|
||||||
|
<label class="toggle-button icon icon-menu" for="toggle-drawer">
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Override selection behavior
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||||||
|
<a href="https://github.com/spacecowboy" title="@spacecowboy on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bar search">
|
||||||
|
<div class="button button-close" role="button" aria-label="Close">
|
||||||
|
<label class="toggle-button icon icon-back" for="toggle-search"></label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="field">
|
||||||
|
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-reset" role="button" aria-label="Search">
|
||||||
|
<button class="toggle-button icon icon-close" id="reset-search"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="drawer">
|
||||||
|
<nav aria-label="Navigation">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker" class="project">
|
||||||
|
<div class="banner">
|
||||||
|
|
||||||
|
<div class="name">
|
||||||
|
<strong>NoNonsense FilePicker </strong>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
spacecowboy/NoNonsense-FilePicker
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<ul class="repo">
|
||||||
|
<li class="repo-download">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||||||
|
<i class="icon icon-download"></i> Download
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="repo-stars">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||||||
|
<i class="icon icon-star"></i> Stars
|
||||||
|
<span class="count">–</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="toc">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Readme" href="http://spacecowboy.github.io/NoNonsense-FilePicker/readme/">
|
||||||
|
|
||||||
|
Readme
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Changelog" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="License" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
License
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="section">Examples</span>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Change the sort order" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
Change the sort order
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Filter based on file extension" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
Filter based on file extension
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Custom item layout" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
Custom item layout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override the back button" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
Override the back button
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="current" title="Override selection behavior" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
Override selection behavior
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<ul id="scrollspy">
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Standalone fragment" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
Standalone fragment
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<span class="section">The author</span>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/spacecowboy" target="_blank" title="@spacecowboy on GitHub">
|
||||||
|
@spacecowboy on GitHub
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article class="article">
|
||||||
|
<div class="wrapper">
|
||||||
|
<h1>Override selection behavior </h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>New in <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/releases/tag/v2.4.0">2.4.0</a> are overridable methods to handle UI-interactions. The following methods are now available for augmentation:</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>onClickOK, handles ok button.</li>
|
||||||
|
<li>onClickCancel, handles cancel button.</li>
|
||||||
|
<li>onClickHeader, handles clicks on “..”.</li>
|
||||||
|
<li>onClickDir, handles clicks on non-selectable items (usually directories).</li>
|
||||||
|
<li>onLongClickDir, handles long clicks on non-selectable items.</li>
|
||||||
|
<li>onClickCheckable, handles clicks on selectable items.</li>
|
||||||
|
<li>onLongClickCheckable, handles long clicks on selectable items.</li>
|
||||||
|
<li>onClickCheckBox, handles clicks on the checkbox of selectable items.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>Please see the existing implementations before you override any of them.</p>
|
||||||
|
|
||||||
|
<h2 id="simple-example-make-clicks-instantly-select-items">Simple example, make clicks instantly select items</h2>
|
||||||
|
|
||||||
|
<p>As asked in <a href="https://github.com/spacecowboy/NoNonsense-FilePicker/issues/48">#48</a>, what if the picker is configured for selecting a single file and you want a click on that to instantly return the result. The default implementation will mark the item as selected, and then the user is required to press the OK button. This small change will make the operation a single click action, returning instantly once the user selects something.</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">SingleFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">void</span> <span style="color: #06287e">onClickCheckable</span><span style="color: #666666">(</span>View v<span style="color: #666666">,</span> CheckableViewHolder vh<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(!</span>allowMultiple<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Clear is necessary, in case user clicked some checkbox directly</span>
|
||||||
|
mCheckedItems<span style="color: #666666">.</span><span style="color: #4070a0">clear</span><span style="color: #666666">();</span>
|
||||||
|
mCheckedItems<span style="color: #666666">.</span><span style="color: #4070a0">add</span><span style="color: #666666">(</span>vh<span style="color: #666666">.</span><span style="color: #4070a0">file</span><span style="color: #666666">);</span>
|
||||||
|
onClickOk<span style="color: #666666">(</span><span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">.</span><span style="color: #4070a0">onClickCheckable</span><span style="color: #666666">(</span>v<span style="color: #666666">,</span> vh<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>Now the astute reader might wonder, if my filepicker is only going to be used for selecting single files, why not just do:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">void</span> <span style="color: #06287e">onClickCheckable</span><span style="color: #666666">(</span>View v<span style="color: #666666">,</span> CheckableViewHolder vh<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">.</span><span style="color: #4070a0">onClickCheckable</span><span style="color: #666666">(</span>v<span style="color: #666666">,</span> vh<span style="color: #666666">);</span>
|
||||||
|
onClickOk<span style="color: #666666">(</span><span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<p>The reason is that the default implementation will animate the checkbox being selected on press. If you are closing the picker directly once the user selects something, you are basically animating something which isn’t going to be seen and thus you are wasting (not that much) resources. Better to not animate at all in that case.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="copyright" role="note">
|
||||||
|
|
||||||
|
© 2016 Released under the Mozilla Public License 2.0 –
|
||||||
|
|
||||||
|
Documentation built with
|
||||||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||||||
|
using the
|
||||||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="pagination" aria-label="Footer">
|
||||||
|
<div class="previous">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/" title="Standalone fragment">
|
||||||
|
<span class="direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="button button-previous" role="button" aria-label="Previous">
|
||||||
|
<i class="icon icon-back"></i>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Standalone fragment
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="next">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/" title="Override the back button">
|
||||||
|
<span class="direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Override the back button
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-next" role="button" aria-label="Next">
|
||||||
|
<i class="icon icon-forward"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="results" role="status" aria-live="polite">
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="meta"></div>
|
||||||
|
<div class="list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var base_url = 'http:\/\/spacecowboy.github.io\/NoNonsense-FilePicker\/';
|
||||||
|
var repo_id = 'spacecowboy\/NoNonsense-FilePicker';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Add headers to scrollspy */
|
||||||
|
var headers = document.getElementsByTagName("h2");
|
||||||
|
var scrollspy = document.getElementById('scrollspy');
|
||||||
|
|
||||||
|
if(scrollspy) {
|
||||||
|
if(headers.length > 0) {
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var li = document.createElement("li");
|
||||||
|
li.setAttribute("class", "anchor");
|
||||||
|
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", headers[i].innerHTML);
|
||||||
|
a.innerHTML = headers[i].innerHTML;
|
||||||
|
|
||||||
|
li.appendChild(a)
|
||||||
|
scrollspy.appendChild(li);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add permanent link next to the headers */
|
||||||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||||||
|
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("class", "headerlink");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", "Permanent link")
|
||||||
|
a.innerHTML = "#";
|
||||||
|
headers[i].appendChild(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="//gohugo.io/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,562 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<html class="no-js">
|
||||||
|
|
||||||
|
<head lang="en-us">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||||
|
<title>Change the sort order - NoNonsense FilePicker</title>
|
||||||
|
<meta name="generator" content="Hugo 0.16" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="description" content="An extensible and flexible file-picker for Android.">
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
<meta name="author" content="SpaceCowboy">
|
||||||
|
|
||||||
|
|
||||||
|
<meta property="og:url" content="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
<meta property="og:title" content="NoNonsense FilePicker">
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-title" content="NoNonsense FilePicker">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
<link rel="icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Icon';
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?52m981');
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?#iefix52m981')
|
||||||
|
format('embedded-opentype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.woff?52m981')
|
||||||
|
format('woff'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.ttf?52m981')
|
||||||
|
format('truetype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.svg?52m981#icon')
|
||||||
|
format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/application.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/temporary.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/palettes.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/highlight/highlight.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700|Roboto%2bMono">
|
||||||
|
<style>
|
||||||
|
body, input {
|
||||||
|
font-family: 'Roboto', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
pre, code {
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/modernizr.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="palette-primary-red palette-accent-light green">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="backdrop">
|
||||||
|
<div class="backdrop-paper"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-drawer">
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-search">
|
||||||
|
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<nav aria-label="Header">
|
||||||
|
<div class="bar default">
|
||||||
|
<div class="button button-menu" role="button" aria-label="Menu">
|
||||||
|
<label class="toggle-button icon icon-menu" for="toggle-drawer">
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Change the sort order
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||||||
|
<a href="https://github.com/spacecowboy" title="@spacecowboy on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bar search">
|
||||||
|
<div class="button button-close" role="button" aria-label="Close">
|
||||||
|
<label class="toggle-button icon icon-back" for="toggle-search"></label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="field">
|
||||||
|
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-reset" role="button" aria-label="Search">
|
||||||
|
<button class="toggle-button icon icon-close" id="reset-search"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="drawer">
|
||||||
|
<nav aria-label="Navigation">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker" class="project">
|
||||||
|
<div class="banner">
|
||||||
|
|
||||||
|
<div class="name">
|
||||||
|
<strong>NoNonsense FilePicker </strong>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
spacecowboy/NoNonsense-FilePicker
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<ul class="repo">
|
||||||
|
<li class="repo-download">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||||||
|
<i class="icon icon-download"></i> Download
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="repo-stars">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||||||
|
<i class="icon icon-star"></i> Stars
|
||||||
|
<span class="count">–</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="toc">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Readme" href="http://spacecowboy.github.io/NoNonsense-FilePicker/readme/">
|
||||||
|
|
||||||
|
Readme
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Changelog" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="License" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
License
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="section">Examples</span>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="current" title="Change the sort order" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
Change the sort order
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<ul id="scrollspy">
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Filter based on file extension" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
Filter based on file extension
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Custom item layout" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
Custom item layout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override the back button" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
Override the back button
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override selection behavior" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
Override selection behavior
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Standalone fragment" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
Standalone fragment
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<span class="section">The author</span>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/spacecowboy" target="_blank" title="@spacecowboy on GitHub">
|
||||||
|
@spacecowboy on GitHub
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article class="article">
|
||||||
|
<div class="wrapper">
|
||||||
|
<h1>Change the sort order </h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>By default, the SD-card picker will display all files in alphabetical order. But what if you want a different sort-order?</p>
|
||||||
|
|
||||||
|
<p>You can override the sorting by overriding the <code>compareFiles</code>-method:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span> <span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">int</span> <span style="color: #06287e">compareFiles</span><span style="color: #666666">(</span>File lhs<span style="color: #666666">,</span> File rhs<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>lhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">()</span> <span style="color: #666666">&&</span> <span style="color: #666666">!</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #666666">-</span><span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">()</span> <span style="color: #666666">&&</span> <span style="color: #666666">!</span>lhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// This was the previous behaviour for all file-file comparisons. Now it's</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// only done if the files have the same extension, or no extension.</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&&</span> getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">).</span><span style="color: #4070a0">equalsIgnoreCase</span><span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">))</span> <span style="color: #666666">||</span>
|
||||||
|
getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">==</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&&</span> getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">)</span> <span style="color: #666666">==</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> lhs<span style="color: #666666">.</span><span style="color: #4070a0">getName</span><span style="color: #666666">().</span><span style="color: #4070a0">compareToIgnoreCase</span><span style="color: #666666">(</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">getName</span><span style="color: #666666">());</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Otherwise, we sort on extension placing files with no extension last.</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&&</span> getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Both have extension, just compare extensions</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">).</span><span style="color: #4070a0">compareToIgnoreCase</span><span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">));</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Left has extension, place it first</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #666666">-</span><span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Right has extension, place it first</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h3 id="before-and-after">Before and After</h3>
|
||||||
|
|
||||||
|
<p><img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/sorting_before.png" width="30%" alt="Before"/>
|
||||||
|
<img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/sorting_after.png" width="30%" alt="After"/></p>
|
||||||
|
|
||||||
|
<h3 id="full-fragment-code">Full Fragment code</h3>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">com.nononsenseapps.filepicker.FilePickerFragment</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">java.io.File</span><span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">SortedFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> *</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param file</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return The file extension. If file has no extension, it returns null.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">private</span> String <span style="color: #06287e">getExtension</span><span style="color: #666666">(</span><span style="color: #555555; font-weight: bold">@NonNull</span> File file<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
String path <span style="color: #666666">=</span> file<span style="color: #666666">.</span><span style="color: #4070a0">getPath</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #902000">int</span> i <span style="color: #666666">=</span> path<span style="color: #666666">.</span><span style="color: #4070a0">lastIndexOf</span><span style="color: #666666">(</span><span style="color: #4070a0">"."</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>i <span style="color: #666666"><</span> <span style="color: #40a070">0</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> path<span style="color: #666666">.</span><span style="color: #4070a0">substring</span><span style="color: #666666">(</span>i<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">/**</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * Compare two files to determine their relative sort order. This follows the usual</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * comparison interface. Override to determine your own custom sort order.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> *</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param lhs File on the "left-hand side"</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @param rhs File on the "right-hand side"</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * @return -1 if if lhs should be placed before rhs, 0 if they are equal,</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> * and 1 if rhs should be placed before lhs</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"> */</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">int</span> <span style="color: #06287e">compareFiles</span><span style="color: #666666">(</span>File lhs<span style="color: #666666">,</span> File rhs<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>lhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">()</span> <span style="color: #666666">&&</span> <span style="color: #666666">!</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #666666">-</span><span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">()</span> <span style="color: #666666">&&</span> <span style="color: #666666">!</span>lhs<span style="color: #666666">.</span><span style="color: #4070a0">isDirectory</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// This was the previous behaviour for all file-file comparisons. Now it's</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// only done if the files have the same extension, or no extension.</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&&</span> getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">).</span><span style="color: #4070a0">equalsIgnoreCase</span><span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">))</span> <span style="color: #666666">||</span>
|
||||||
|
getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">==</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&&</span> getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">)</span> <span style="color: #666666">==</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> lhs<span style="color: #666666">.</span><span style="color: #4070a0">getName</span><span style="color: #666666">().</span><span style="color: #4070a0">compareToIgnoreCase</span><span style="color: #666666">(</span>rhs<span style="color: #666666">.</span><span style="color: #4070a0">getName</span><span style="color: #666666">());</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Otherwise, we sort on extension placing files with no extension last.</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span> <span style="color: #666666">&&</span> getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Both have extension, just compare extensions</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">).</span><span style="color: #4070a0">compareToIgnoreCase</span><span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>rhs<span style="color: #666666">));</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>getExtension<span style="color: #666666">(</span>lhs<span style="color: #666666">)</span> <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Left has extension, place it first</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #666666">-</span><span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Right has extension, place it first</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #40a070">1</span><span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="copyright" role="note">
|
||||||
|
|
||||||
|
© 2016 Released under the Mozilla Public License 2.0 –
|
||||||
|
|
||||||
|
Documentation built with
|
||||||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||||||
|
using the
|
||||||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="pagination" aria-label="Footer">
|
||||||
|
<div class="previous">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/" title="Custom item layout">
|
||||||
|
<span class="direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="button button-previous" role="button" aria-label="Previous">
|
||||||
|
<i class="icon icon-back"></i>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Custom item layout
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="next">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/" title="ChangeLog">
|
||||||
|
<span class="direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
ChangeLog
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-next" role="button" aria-label="Next">
|
||||||
|
<i class="icon icon-forward"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="results" role="status" aria-live="polite">
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="meta"></div>
|
||||||
|
<div class="list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var base_url = 'http:\/\/spacecowboy.github.io\/NoNonsense-FilePicker\/';
|
||||||
|
var repo_id = 'spacecowboy\/NoNonsense-FilePicker';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Add headers to scrollspy */
|
||||||
|
var headers = document.getElementsByTagName("h2");
|
||||||
|
var scrollspy = document.getElementById('scrollspy');
|
||||||
|
|
||||||
|
if(scrollspy) {
|
||||||
|
if(headers.length > 0) {
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var li = document.createElement("li");
|
||||||
|
li.setAttribute("class", "anchor");
|
||||||
|
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", headers[i].innerHTML);
|
||||||
|
a.innerHTML = headers[i].innerHTML;
|
||||||
|
|
||||||
|
li.appendChild(a)
|
||||||
|
scrollspy.appendChild(li);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add permanent link next to the headers */
|
||||||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||||||
|
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("class", "headerlink");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", "Permanent link")
|
||||||
|
a.innerHTML = "#";
|
||||||
|
headers[i].appendChild(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="//gohugo.io/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,483 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<html class="no-js">
|
||||||
|
|
||||||
|
<head lang="en-us">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||||
|
<title>Standalone fragment - NoNonsense FilePicker</title>
|
||||||
|
<meta name="generator" content="Hugo 0.16" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="description" content="An extensible and flexible file-picker for Android.">
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
<meta name="author" content="SpaceCowboy">
|
||||||
|
|
||||||
|
|
||||||
|
<meta property="og:url" content="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
<meta property="og:title" content="NoNonsense FilePicker">
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-title" content="NoNonsense FilePicker">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
<link rel="icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Icon';
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?52m981');
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?#iefix52m981')
|
||||||
|
format('embedded-opentype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.woff?52m981')
|
||||||
|
format('woff'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.ttf?52m981')
|
||||||
|
format('truetype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.svg?52m981#icon')
|
||||||
|
format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/application.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/temporary.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/palettes.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/highlight/highlight.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700|Roboto%2bMono">
|
||||||
|
<style>
|
||||||
|
body, input {
|
||||||
|
font-family: 'Roboto', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
pre, code {
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/modernizr.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="palette-primary-red palette-accent-light green">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="backdrop">
|
||||||
|
<div class="backdrop-paper"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-drawer">
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-search">
|
||||||
|
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<nav aria-label="Header">
|
||||||
|
<div class="bar default">
|
||||||
|
<div class="button button-menu" role="button" aria-label="Menu">
|
||||||
|
<label class="toggle-button icon icon-menu" for="toggle-drawer">
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Standalone fragment
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||||||
|
<a href="https://github.com/spacecowboy" title="@spacecowboy on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bar search">
|
||||||
|
<div class="button button-close" role="button" aria-label="Close">
|
||||||
|
<label class="toggle-button icon icon-back" for="toggle-search"></label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="field">
|
||||||
|
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-reset" role="button" aria-label="Search">
|
||||||
|
<button class="toggle-button icon icon-close" id="reset-search"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="drawer">
|
||||||
|
<nav aria-label="Navigation">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker" class="project">
|
||||||
|
<div class="banner">
|
||||||
|
|
||||||
|
<div class="name">
|
||||||
|
<strong>NoNonsense FilePicker </strong>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
spacecowboy/NoNonsense-FilePicker
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<ul class="repo">
|
||||||
|
<li class="repo-download">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||||||
|
<i class="icon icon-download"></i> Download
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="repo-stars">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||||||
|
<i class="icon icon-star"></i> Stars
|
||||||
|
<span class="count">–</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="toc">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Readme" href="http://spacecowboy.github.io/NoNonsense-FilePicker/readme/">
|
||||||
|
|
||||||
|
Readme
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Changelog" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="License" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
License
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="section">Examples</span>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Change the sort order" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
Change the sort order
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Filter based on file extension" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
Filter based on file extension
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Custom item layout" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
Custom item layout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override the back button" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
Override the back button
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override selection behavior" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
Override selection behavior
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="current" title="Standalone fragment" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
Standalone fragment
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<ul id="scrollspy">
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<span class="section">The author</span>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/spacecowboy" target="_blank" title="@spacecowboy on GitHub">
|
||||||
|
@spacecowboy on GitHub
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article class="article">
|
||||||
|
<div class="wrapper">
|
||||||
|
<h1>Standalone fragment </h1>
|
||||||
|
|
||||||
|
<p>To use the fragment together with an existing toolbar/action bar, a few things should be overridden.</p>
|
||||||
|
|
||||||
|
<p>Here’s a minimal example where the toolbar is intercepted from being set as the main toolbar. The menu creation is also intercepted and populates the toolbar directly.</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">StandaloneFilePickerFragment</span> <span style="color: #007020; font-weight: bold">extends</span> FilePickerFragment <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> Toolbar mToolbar<span style="color: #666666">;</span>
|
||||||
|
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">void</span> <span style="color: #06287e">setupToolbar</span><span style="color: #666666">(</span>Toolbar toolbar<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Prevent it from being set as main toolbar by NOT calling super.setupToolbar().</span>
|
||||||
|
mToolbar <span style="color: #666666">=</span> toolbar<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">void</span> <span style="color: #06287e">onCreateOptionsMenu</span><span style="color: #666666">(</span>Menu menu<span style="color: #666666">,</span> MenuInflater inflater<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Populate the toolbar with the menu items instead of the action bar.</span>
|
||||||
|
mToolbar<span style="color: #666666">.</span><span style="color: #4070a0">inflateMenu</span><span style="color: #666666">(</span>R<span style="color: #666666">.</span><span style="color: #4070a0">menu</span><span style="color: #666666">.</span><span style="color: #4070a0">picker_actions</span><span style="color: #666666">);</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Set a menu listener on the toolbar with calls the regular onOptionsItemSelected method.</span>
|
||||||
|
mToolbar<span style="color: #666666">.</span><span style="color: #4070a0">setOnMenuItemClickListener</span><span style="color: #666666">(</span><span style="color: #007020; font-weight: bold">new</span> Toolbar<span style="color: #666666">.</span><span style="color: #4070a0">OnMenuItemClickListener</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #902000">boolean</span> <span style="color: #06287e">onMenuItemClick</span><span style="color: #666666">(</span>MenuItem item<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> onOptionsItemSelected<span style="color: #666666">(</span>item<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">});</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// This is usually handled in onCreateOptions so do it here instead.</span>
|
||||||
|
MenuItem item <span style="color: #666666">=</span> mToolbar<span style="color: #666666">.</span><span style="color: #4070a0">getMenu</span><span style="color: #666666">().</span><span style="color: #4070a0">findItem</span><span style="color: #666666">(</span>com<span style="color: #666666">.</span><span style="color: #4070a0">nononsenseapps</span><span style="color: #666666">.</span><span style="color: #4070a0">filepicker</span><span style="color: #666666">.</span><span style="color: #4070a0">R</span><span style="color: #666666">.</span><span style="color: #4070a0">id</span><span style="color: #666666">.</span><span style="color: #4070a0">nnf_action_createdir</span><span style="color: #666666">);</span>
|
||||||
|
item<span style="color: #666666">.</span><span style="color: #4070a0">setVisible</span><span style="color: #666666">(</span>allowCreateDir<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="copyright" role="note">
|
||||||
|
|
||||||
|
© 2016 Released under the Mozilla Public License 2.0 –
|
||||||
|
|
||||||
|
Documentation built with
|
||||||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||||||
|
using the
|
||||||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="pagination" aria-label="Footer">
|
||||||
|
<div class="previous">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="next">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/" title="Override selection behavior">
|
||||||
|
<span class="direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Override selection behavior
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-next" role="button" aria-label="Next">
|
||||||
|
<i class="icon icon-forward"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="results" role="status" aria-live="polite">
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="meta"></div>
|
||||||
|
<div class="list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var base_url = 'http:\/\/spacecowboy.github.io\/NoNonsense-FilePicker\/';
|
||||||
|
var repo_id = 'spacecowboy\/NoNonsense-FilePicker';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Add headers to scrollspy */
|
||||||
|
var headers = document.getElementsByTagName("h2");
|
||||||
|
var scrollspy = document.getElementById('scrollspy');
|
||||||
|
|
||||||
|
if(scrollspy) {
|
||||||
|
if(headers.length > 0) {
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var li = document.createElement("li");
|
||||||
|
li.setAttribute("class", "anchor");
|
||||||
|
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", headers[i].innerHTML);
|
||||||
|
a.innerHTML = headers[i].innerHTML;
|
||||||
|
|
||||||
|
li.appendChild(a)
|
||||||
|
scrollspy.appendChild(li);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add permanent link next to the headers */
|
||||||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||||||
|
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("class", "headerlink");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", "Permanent link")
|
||||||
|
a.innerHTML = "#";
|
||||||
|
headers[i].appendChild(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="//gohugo.io/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<metadata>Generated by IcoMoon</metadata>
|
||||||
|
<defs>
|
||||||
|
<font id="icon" horiz-adv-x="1024">
|
||||||
|
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
||||||
|
<missing-glyph horiz-adv-x="1024" />
|
||||||
|
<glyph unicode=" " horiz-adv-x="512" d="" />
|
||||||
|
<glyph unicode="" glyph-name="search" d="M661.333 341.334h-33.92l-11.733 11.733c41.813 48.427 66.987 111.36 66.987 180.267 0 153.173-124.16 277.333-277.333 277.333s-277.333-124.16-277.333-277.333 124.16-277.333 277.333-277.333c68.907 0 131.84 25.173 180.267 66.773l11.733-11.733v-33.707l213.333-212.907 63.573 63.573-212.907 213.333zM405.333 341.334c-106.027 0-192 85.973-192 192s85.973 192 192 192 192-85.973 192-192-85.973-192-192-192z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-back" d="M853.333 469.334h-519.253l238.293 238.293-60.373 60.373-341.333-341.333 341.333-341.333 60.373 60.373-238.293 238.293h519.253v85.333z" />
|
||||||
|
<glyph unicode="" glyph-name="chevron-right" d="M426.667 682.667l-60.373-60.373 195.627-195.627-195.627-195.627 60.373-60.373 256 256z" />
|
||||||
|
<glyph unicode="" glyph-name="close" d="M810.667 664.96l-60.373 60.373-238.293-238.293-238.293 238.293-60.373-60.373 238.293-238.293-238.293-238.293 60.373-60.373 238.293 238.293 238.293-238.293 60.373 60.373-238.293 238.293z" />
|
||||||
|
<glyph unicode="" glyph-name="menu" d="M128 170.667h768v85.333h-768v-85.333zM128 384h768v85.333h-768v-85.333zM128 682.667v-85.333h768v85.333h-768z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-forward" d="M512 768l-60.373-60.373 238.293-238.293h-519.253v-85.333h519.253l-238.293-238.293 60.373-60.373 341.333 341.333z" />
|
||||||
|
<glyph unicode="" glyph-name="twitter" d="M1024 744.249c-37.676-16.708-78.164-28.002-120.66-33.080 43.372 26 76.686 67.17 92.372 116.23-40.596-24.078-85.556-41.56-133.41-50.98-38.32 40.83-92.922 66.34-153.346 66.34-116.022 0-210.088-94.058-210.088-210.078 0-16.466 1.858-32.5 5.44-47.878-174.6 8.764-329.402 92.4-433.018 219.506-18.084-31.028-28.446-67.116-28.446-105.618 0-72.888 37.088-137.192 93.46-174.866-34.438 1.092-66.832 10.542-95.154 26.278-0.020-0.876-0.020-1.756-0.020-2.642 0-101.788 72.418-186.696 168.522-206-17.626-4.8-36.188-7.372-55.348-7.372-13.538 0-26.698 1.32-39.528 3.772 26.736-83.46 104.32-144.206 196.252-145.896-71.9-56.35-162.486-89.934-260.916-89.934-16.958 0-33.68 0.994-50.116 2.94 92.972-59.61 203.402-94.394 322.042-94.394 386.422 0 597.736 320.124 597.736 597.744 0 9.108-0.206 18.168-0.61 27.18 41.056 29.62 76.672 66.62 104.836 108.748z" />
|
||||||
|
<glyph unicode="" glyph-name="github" d="M512.008 926.025c-282.738 0-512.008-229.218-512.008-511.998 0-226.214 146.704-418.132 350.136-485.836 25.586-4.738 34.992 11.11 34.992 24.632 0 12.204-0.48 52.542-0.696 95.324-142.448-30.976-172.504 60.41-172.504 60.41-23.282 59.176-56.848 74.916-56.848 74.916-46.452 31.778 3.51 31.124 3.51 31.124 51.4-3.61 78.476-52.766 78.476-52.766 45.672-78.27 119.776-55.64 149.004-42.558 4.588 33.086 17.852 55.68 32.506 68.464-113.73 12.942-233.276 56.85-233.276 253.032 0 55.898 20.004 101.574 52.76 137.428-5.316 12.9-22.854 64.972 4.952 135.5 0 0 43.006 13.752 140.84-52.49 40.836 11.348 84.636 17.036 128.154 17.234 43.502-0.198 87.336-5.886 128.256-17.234 97.734 66.244 140.656 52.49 140.656 52.49 27.872-70.528 10.35-122.6 5.036-135.5 32.82-35.856 52.694-81.532 52.694-137.428 0-196.654-119.778-239.95-233.79-252.624 18.364-15.89 34.724-47.046 34.724-94.812 0-68.508-0.596-123.644-0.596-140.508 0-13.628 9.222-29.594 35.172-24.566 203.322 67.776 349.842 259.626 349.842 485.768 0 282.78-229.234 511.998-511.992 511.998z" />
|
||||||
|
<glyph unicode="" glyph-name="download" d="M810.667 554.667h-170.667v256h-256v-256h-170.667l298.667-298.667 298.667 298.667zM213.333 170.667v-85.333h597.333v85.333h-597.333z" />
|
||||||
|
<glyph unicode="" glyph-name="star" d="M512 201.814l263.68-159.147-69.973 299.947 232.96 201.813-306.773 26.027-119.893 282.88-119.893-282.88-306.773-26.027 232.96-201.813-69.973-299.947z" />
|
||||||
|
<glyph unicode="" glyph-name="warning" d="M554 340.667v172h-84v-172h84zM554 170.667v86h-84v-86h84zM42 42.667l470 810 470-810h-940z" />
|
||||||
|
<glyph unicode="" glyph-name="hint" d="M614 682.667h240v-426h-300l-16 84h-240v-298h-84v726h384z" />
|
||||||
|
</font></defs></svg>
|
||||||
|
After Width: | Height: | Size: 4.3 KiB |
|
|
@ -0,0 +1,61 @@
|
||||||
|
.codehilite .hll { background-color: #ffffcc }
|
||||||
|
.codehilite .c { color: #60a0b0; font-style: italic } /* Comment */
|
||||||
|
.codehilite .err { border: 1px solid #FF0000 } /* Error */
|
||||||
|
.codehilite .k { color: #007020; font-weight: bold } /* Keyword */
|
||||||
|
.codehilite .o { color: #666666 } /* Operator */
|
||||||
|
.codehilite .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */
|
||||||
|
.codehilite .cp { color: #007020 } /* Comment.Preproc */
|
||||||
|
.codehilite .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */
|
||||||
|
.codehilite .cs { color: #60a0b0; background-color: #fff0f0 } /* Comment.Special */
|
||||||
|
.codehilite .gd { color: #A00000 } /* Generic.Deleted */
|
||||||
|
.codehilite .ge { font-style: italic } /* Generic.Emph */
|
||||||
|
.codehilite .gr { color: #FF0000 } /* Generic.Error */
|
||||||
|
.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
||||||
|
.codehilite .gi { color: #00A000 } /* Generic.Inserted */
|
||||||
|
.codehilite .go { color: #808080 } /* Generic.Output */
|
||||||
|
.codehilite .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
|
||||||
|
.codehilite .gs { font-weight: bold } /* Generic.Strong */
|
||||||
|
.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
||||||
|
.codehilite .gt { color: #0040D0 } /* Generic.Traceback */
|
||||||
|
.codehilite .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
|
||||||
|
.codehilite .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
|
||||||
|
.codehilite .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
|
||||||
|
.codehilite .kp { color: #007020 } /* Keyword.Pseudo */
|
||||||
|
.codehilite .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
|
||||||
|
.codehilite .kt { color: #902000 } /* Keyword.Type */
|
||||||
|
.codehilite .m { color: #40a070 } /* Literal.Number */
|
||||||
|
.codehilite .s { color: #4070a0 } /* Literal.String */
|
||||||
|
.codehilite .na { color: #4070a0 } /* Name.Attribute */
|
||||||
|
.codehilite .nb { color: #007020 } /* Name.Builtin */
|
||||||
|
.codehilite .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
|
||||||
|
.codehilite .no { color: #60add5 } /* Name.Constant */
|
||||||
|
.codehilite .nd { color: #555555; font-weight: bold } /* Name.Decorator */
|
||||||
|
.codehilite .ni { color: #d55537; font-weight: bold } /* Name.Entity */
|
||||||
|
.codehilite .ne { color: #007020 } /* Name.Exception */
|
||||||
|
.codehilite .nf { color: #06287e } /* Name.Function */
|
||||||
|
.codehilite .nl { color: #002070; font-weight: bold } /* Name.Label */
|
||||||
|
.codehilite .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
|
||||||
|
.codehilite .nt { color: #062873; font-weight: bold } /* Name.Tag */
|
||||||
|
.codehilite .nv { color: #bb60d5 } /* Name.Variable */
|
||||||
|
.codehilite .ow { color: #007020; font-weight: bold } /* Operator.Word */
|
||||||
|
.codehilite .w { color: #bbbbbb } /* Text.Whitespace */
|
||||||
|
.codehilite .mf { color: #40a070 } /* Literal.Number.Float */
|
||||||
|
.codehilite .mh { color: #40a070 } /* Literal.Number.Hex */
|
||||||
|
.codehilite .mi { color: #40a070 } /* Literal.Number.Integer */
|
||||||
|
.codehilite .mo { color: #40a070 } /* Literal.Number.Oct */
|
||||||
|
.codehilite .sb { color: #4070a0 } /* Literal.String.Backtick */
|
||||||
|
.codehilite .sc { color: #4070a0 } /* Literal.String.Char */
|
||||||
|
.codehilite .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
|
||||||
|
.codehilite .s2 { color: #4070a0 } /* Literal.String.Double */
|
||||||
|
.codehilite .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
|
||||||
|
.codehilite .sh { color: #4070a0 } /* Literal.String.Heredoc */
|
||||||
|
.codehilite .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
|
||||||
|
.codehilite .sx { color: #c65d09 } /* Literal.String.Other */
|
||||||
|
.codehilite .sr { color: #235388 } /* Literal.String.Regex */
|
||||||
|
.codehilite .s1 { color: #4070a0 } /* Literal.String.Single */
|
||||||
|
.codehilite .ss { color: #517918 } /* Literal.String.Symbol */
|
||||||
|
.codehilite .bp { color: #007020 } /* Name.Builtin.Pseudo */
|
||||||
|
.codehilite .vc { color: #bb60d5 } /* Name.Variable.Class */
|
||||||
|
.codehilite .vg { color: #bb60d5 } /* Name.Variable.Global */
|
||||||
|
.codehilite .vi { color: #bb60d5 } /* Name.Variable.Instance */
|
||||||
|
.codehilite .il { color: #40a070 } /* Literal.Number.Integer.Long */
|
||||||
|
After Width: | Height: | Size: 254 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
|
@ -0,0 +1,658 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<html class="no-js">
|
||||||
|
|
||||||
|
<head lang="en-us">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||||
|
<title>NoNonsense FilePicker</title>
|
||||||
|
<meta name="generator" content="Hugo 0.16" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="description" content="An extensible and flexible file-picker for Android.">
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/">
|
||||||
|
|
||||||
|
<meta name="author" content="SpaceCowboy">
|
||||||
|
|
||||||
|
|
||||||
|
<meta property="og:url" content="http://spacecowboy.github.io/NoNonsense-FilePicker/">
|
||||||
|
<meta property="og:title" content="NoNonsense FilePicker">
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-title" content="NoNonsense FilePicker">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
<link rel="icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Icon';
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?52m981');
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?#iefix52m981')
|
||||||
|
format('embedded-opentype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.woff?52m981')
|
||||||
|
format('woff'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.ttf?52m981')
|
||||||
|
format('truetype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.svg?52m981#icon')
|
||||||
|
format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/application.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/temporary.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/palettes.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/highlight/highlight.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700|Roboto%2bMono">
|
||||||
|
<style>
|
||||||
|
body, input {
|
||||||
|
font-family: 'Roboto', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
pre, code {
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/modernizr.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<link href="http://spacecowboy.github.io/NoNonsense-FilePicker/index.xml" rel="alternate" type="application/rss+xml" title="NoNonsense FilePicker" />
|
||||||
|
<link href="http://spacecowboy.github.io/NoNonsense-FilePicker/index.xml" rel="feed" type="application/rss+xml" title="NoNonsense FilePicker" />
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="palette-primary-red palette-accent-light green">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="backdrop">
|
||||||
|
<div class="backdrop-paper"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-drawer">
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-search">
|
||||||
|
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<nav aria-label="Header">
|
||||||
|
<div class="bar default">
|
||||||
|
<div class="button button-menu" role="button" aria-label="Menu">
|
||||||
|
<label class="toggle-button icon icon-menu" for="toggle-drawer">
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
NoNonsense FilePicker
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||||||
|
<a href="https://github.com/spacecowboy" title="@spacecowboy on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bar search">
|
||||||
|
<div class="button button-close" role="button" aria-label="Close">
|
||||||
|
<label class="toggle-button icon icon-back" for="toggle-search"></label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="field">
|
||||||
|
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-reset" role="button" aria-label="Search">
|
||||||
|
<button class="toggle-button icon icon-close" id="reset-search"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="drawer">
|
||||||
|
<nav aria-label="Navigation">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker" class="project">
|
||||||
|
<div class="banner">
|
||||||
|
|
||||||
|
<div class="name">
|
||||||
|
<strong>NoNonsense FilePicker </strong>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
spacecowboy/NoNonsense-FilePicker
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<ul class="repo">
|
||||||
|
<li class="repo-download">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||||||
|
<i class="icon icon-download"></i> Download
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="repo-stars">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||||||
|
<i class="icon icon-star"></i> Stars
|
||||||
|
<span class="count">–</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="toc">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Readme" href="http://spacecowboy.github.io/NoNonsense-FilePicker/readme/">
|
||||||
|
|
||||||
|
Readme
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Changelog" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="License" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
License
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="section">Examples</span>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Change the sort order" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
Change the sort order
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Filter based on file extension" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
Filter based on file extension
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Custom item layout" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
Custom item layout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override the back button" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
Override the back button
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override selection behavior" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
Override selection behavior
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Standalone fragment" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
Standalone fragment
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<span class="section">The author</span>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/spacecowboy" target="_blank" title="@spacecowboy on GitHub">
|
||||||
|
@spacecowboy on GitHub
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article class="article">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<h1>Readme </h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/Nexus6-picker-dark.png" width="25%"/>
|
||||||
|
|
||||||
|
<img src="http://spacecowboy.github.io/NoNonsense-FilePicker/screenshots/Nexus10-picker-light.png" width="60%"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Extendable for sources other than SD-card (Dropbox, FTP, Drive, etc)</li>
|
||||||
|
<li>Can select multiple items</li>
|
||||||
|
<li>Select directories or files, or both</li>
|
||||||
|
<li>Create new directories in the picker</li>
|
||||||
|
<li>Material theme with AppCompat</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="yet-another-file-picker-library">Yet another file picker library?</h2>
|
||||||
|
|
||||||
|
<p>I needed a file picker that had two primary properties:</p>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li>Easy to extend: I needed a file picker that would work for normal
|
||||||
|
files on the SD-card, and also for using the Dropbox API.</li>
|
||||||
|
<li>Able to create a directory in the picker.</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<p>This project has both of those qualities. As a bonus, it also scales
|
||||||
|
nicely to work on any phone or tablet. The core is placed in abstract
|
||||||
|
classes, so it is fairly easy to extend the picker to create
|
||||||
|
your own.</p>
|
||||||
|
|
||||||
|
<p>The library includes an implementation that allows the user to pick
|
||||||
|
files from the SD-card. But the picker could easily be extended to get
|
||||||
|
its file listings from another source, such as Dropbox, FTP, SSH and
|
||||||
|
so on. The sample app includes implementations which browses your
|
||||||
|
Dropbox and a Linux mirror FTP-server.</p>
|
||||||
|
|
||||||
|
<p>By inheriting from an Activity, the picker is able to be rendered as
|
||||||
|
full screen on small screens and as a dialog on large screens. It does
|
||||||
|
this through the theme system, so it is very important for the
|
||||||
|
activity to use a correctly configured theme.</p>
|
||||||
|
|
||||||
|
<h2 id="how-to-include-in-your-project-with-gradle">How to include in your project (with Gradle)</h2>
|
||||||
|
|
||||||
|
<p>Just add the dependency to your <em>build.gradle</em>:</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span>repositories <span style="color: #666666">{</span>
|
||||||
|
jcenter<span style="color: #666666">()</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
dependencies <span style="color: #666666">{</span>
|
||||||
|
compile <span style="color: #4070a0">'com.nononsenseapps:filepicker:3.0.0'</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h2 id="how-to-use-the-included-sd-card-picker">How to use the included SD-card picker:</h2>
|
||||||
|
|
||||||
|
<h3 id="include-permission-in-your-manifest">Include permission in your manifest</h3>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #062873; font-weight: bold"><uses-permission</span> <span style="color: #4070a0">android:name="android.permission.WRITE_EXTERNAL_STORAGE"</span> <span style="color: #062873; font-weight: bold">/></span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h3 id="include-the-file-picker-activity">Include the file picker activity</h3>
|
||||||
|
|
||||||
|
<p>The intent filter is optional depending on your use case. Note that
|
||||||
|
the theme set in the manifest is important.</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span> <span style="color: #062873; font-weight: bold"><activity</span>
|
||||||
|
<span style="color: #4070a0">android:name="com.nononsenseapps.filepicker.FilePickerActivity"</span>
|
||||||
|
<span style="color: #4070a0">android:label="@string/app_name"</span>
|
||||||
|
<span style="color: #4070a0">android:theme="@style/FilePickerTheme"</span><span style="color: #062873; font-weight: bold">></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><intent-filter></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><action</span> <span style="color: #4070a0">android:name="android.intent.action.GET_CONTENT"</span> <span style="color: #062873; font-weight: bold">/></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><category</span> <span style="color: #4070a0">android:name="android.intent.category.DEFAULT"</span> <span style="color: #062873; font-weight: bold">/></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"></intent-filter></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"></activity></span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h3 id="configure-the-theme">Configure the theme</h3>
|
||||||
|
|
||||||
|
<p>You must <strong>set the theme</strong> on the activity, but you can configure it to
|
||||||
|
match your existing application theme. You can also name it whatever
|
||||||
|
you like..</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span> <span style="color: #60a0b0; font-style: italic"><!-- You can also inherit from NNF_BaseTheme.Light --></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><style</span> <span style="color: #4070a0">name="FilePickerTheme"</span> <span style="color: #4070a0">parent="NNF_BaseTheme"</span><span style="color: #062873; font-weight: bold">></span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"><!-- Set these to match your theme --></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><item</span> <span style="color: #4070a0">name="colorPrimary"</span><span style="color: #062873; font-weight: bold">></span>@color/primary<span style="color: #062873; font-weight: bold"></item></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><item</span> <span style="color: #4070a0">name="colorPrimaryDark"</span><span style="color: #062873; font-weight: bold">></span>@color/primary_dark<span style="color: #062873; font-weight: bold"></item></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><item</span> <span style="color: #4070a0">name="colorAccent"</span><span style="color: #062873; font-weight: bold">></span>@color/accent<span style="color: #062873; font-weight: bold"></item></span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic"><!-- Need to set this also to style create folder dialog --></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><item</span> <span style="color: #4070a0">name="alertDialogTheme"</span><span style="color: #062873; font-weight: bold">></span>@style/FilePickerAlertDialogTheme<span style="color: #062873; font-weight: bold"></item></span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic"><!-- If you want to set a specific toolbar theme, do it here --></span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic"><!-- <item name="nnf_toolbarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> --></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"></style></span>
|
||||||
|
|
||||||
|
<span style="color: #062873; font-weight: bold"><style</span> <span style="color: #4070a0">name="FilePickerAlertDialogTheme"</span> <span style="color: #4070a0">parent="Theme.AppCompat.Dialog.Alert"</span><span style="color: #062873; font-weight: bold">></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><item</span> <span style="color: #4070a0">name="colorPrimary"</span><span style="color: #062873; font-weight: bold">></span>@color/primary<span style="color: #062873; font-weight: bold"></item></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><item</span> <span style="color: #4070a0">name="colorPrimaryDark"</span><span style="color: #062873; font-weight: bold">></span>@color/primary_dark<span style="color: #062873; font-weight: bold"></item></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"><item</span> <span style="color: #4070a0">name="colorAccent"</span><span style="color: #062873; font-weight: bold">></span>@color/accent<span style="color: #062873; font-weight: bold"></item></span>
|
||||||
|
<span style="color: #062873; font-weight: bold"></style></span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h3 id="starting-the-picker-in-your-app">Starting the picker in your app</h3>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span> <span style="color: #60a0b0; font-style: italic">// This always works</span>
|
||||||
|
Intent i <span style="color: #666666">=</span> <span style="color: #007020; font-weight: bold">new</span> Intent<span style="color: #666666">(</span>context<span style="color: #666666">,</span> FilePickerActivity<span style="color: #666666">.</span><span style="color: #4070a0">class</span><span style="color: #666666">);</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// This works if you defined the intent filter</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Intent i = new Intent(Intent.ACTION_GET_CONTENT);</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Set these depending on your use case. These are the defaults.</span>
|
||||||
|
i<span style="color: #666666">.</span><span style="color: #4070a0">putExtra</span><span style="color: #666666">(</span>FilePickerActivity<span style="color: #666666">.</span><span style="color: #4070a0">EXTRA_ALLOW_MULTIPLE</span><span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">false</span><span style="color: #666666">);</span>
|
||||||
|
i<span style="color: #666666">.</span><span style="color: #4070a0">putExtra</span><span style="color: #666666">(</span>FilePickerActivity<span style="color: #666666">.</span><span style="color: #4070a0">EXTRA_ALLOW_CREATE_DIR</span><span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">false</span><span style="color: #666666">);</span>
|
||||||
|
i<span style="color: #666666">.</span><span style="color: #4070a0">putExtra</span><span style="color: #666666">(</span>FilePickerActivity<span style="color: #666666">.</span><span style="color: #4070a0">EXTRA_MODE</span><span style="color: #666666">,</span> FilePickerActivity<span style="color: #666666">.</span><span style="color: #4070a0">MODE_FILE</span><span style="color: #666666">);</span>
|
||||||
|
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Configure initial directory by specifying a String.</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// You could specify a String like "/storage/emulated/0/", but that can</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// dangerous. Always use Android's API calls to get paths to the SD-card or</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// internal memory.</span>
|
||||||
|
i<span style="color: #666666">.</span><span style="color: #4070a0">putExtra</span><span style="color: #666666">(</span>FilePickerActivity<span style="color: #666666">.</span><span style="color: #4070a0">EXTRA_START_PATH</span><span style="color: #666666">,</span> Environment<span style="color: #666666">.</span><span style="color: #4070a0">getExternalStorageDirectory</span><span style="color: #666666">().</span><span style="color: #4070a0">getPath</span><span style="color: #666666">());</span>
|
||||||
|
|
||||||
|
startActivityForResult<span style="color: #666666">(</span>i<span style="color: #666666">,</span> FILE_CODE<span style="color: #666666">);</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h3 id="handling-the-result">Handling the result</h3>
|
||||||
|
|
||||||
|
<p>If you have a minimum requirement of Jelly Bean (API 16) and above,
|
||||||
|
you can skip the second method.</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span> <span style="color: #555555; font-weight: bold">@TargetApi</span><span style="color: #666666">(</span>Build<span style="color: #666666">.</span><span style="color: #4070a0">VERSION_CODES</span><span style="color: #666666">.</span><span style="color: #4070a0">JELLY_BEAN</span><span style="color: #666666">)</span>
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> <span style="color: #902000">void</span> <span style="color: #06287e">onActivityResult</span><span style="color: #666666">(</span><span style="color: #902000">int</span> requestCode<span style="color: #666666">,</span> <span style="color: #902000">int</span> resultCode<span style="color: #666666">,</span> Intent data<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>requestCode <span style="color: #666666">==</span> FILE_CODE <span style="color: #666666">&&</span> resultCode <span style="color: #666666">==</span> Activity<span style="color: #666666">.</span><span style="color: #4070a0">RESULT_OK</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>data<span style="color: #666666">.</span><span style="color: #4070a0">getBooleanExtra</span><span style="color: #666666">(</span>FilePickerActivity<span style="color: #666666">.</span><span style="color: #4070a0">EXTRA_ALLOW_MULTIPLE</span><span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">false</span><span style="color: #666666">))</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// For JellyBean and above</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>Build<span style="color: #666666">.</span><span style="color: #4070a0">VERSION</span><span style="color: #666666">.</span><span style="color: #4070a0">SDK_INT</span> <span style="color: #666666">>=</span> Build<span style="color: #666666">.</span><span style="color: #4070a0">VERSION_CODES</span><span style="color: #666666">.</span><span style="color: #4070a0">JELLY_BEAN</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
ClipData clip <span style="color: #666666">=</span> data<span style="color: #666666">.</span><span style="color: #4070a0">getClipData</span><span style="color: #666666">();</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>clip <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">for</span> <span style="color: #666666">(</span><span style="color: #902000">int</span> i <span style="color: #666666">=</span> <span style="color: #40a070">0</span><span style="color: #666666">;</span> i <span style="color: #666666"><</span> clip<span style="color: #666666">.</span><span style="color: #4070a0">getItemCount</span><span style="color: #666666">();</span> i<span style="color: #666666">++)</span> <span style="color: #666666">{</span>
|
||||||
|
Uri uri <span style="color: #666666">=</span> clip<span style="color: #666666">.</span><span style="color: #4070a0">getItemAt</span><span style="color: #666666">(</span>i<span style="color: #666666">).</span><span style="color: #4070a0">getUri</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Do something with the URI</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// For Ice Cream Sandwich</span>
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
ArrayList<span style="color: #666666"><</span>String<span style="color: #666666">></span> paths <span style="color: #666666">=</span> data<span style="color: #666666">.</span><span style="color: #4070a0">getStringArrayListExtra</span>
|
||||||
|
<span style="color: #666666">(</span>FilePickerActivity<span style="color: #666666">.</span><span style="color: #4070a0">EXTRA_PATHS</span><span style="color: #666666">);</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">if</span> <span style="color: #666666">(</span>paths <span style="color: #666666">!=</span> <span style="color: #007020; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">for</span> <span style="color: #666666">(</span>String path<span style="color: #666666">:</span> paths<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
Uri uri <span style="color: #666666">=</span> Uri<span style="color: #666666">.</span><span style="color: #4070a0">parse</span><span style="color: #666666">(</span>path<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Do something with the URI</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #666666">}</span> <span style="color: #007020; font-weight: bold">else</span> <span style="color: #666666">{</span>
|
||||||
|
Uri uri <span style="color: #666666">=</span> data<span style="color: #666666">.</span><span style="color: #4070a0">getData</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Do something with the URI</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h2 id="customizing-the-picker">Customizing the picker</h2>
|
||||||
|
|
||||||
|
<p>Extend <code>AbstractFilePickerActivity</code> and implement <code>getFragment</code>. It
|
||||||
|
should return an instance of <code>AbstractFilePickerFragment</code>. This
|
||||||
|
basically means that the activity is just the same boilerplate with as
|
||||||
|
single line changed (see the sample app’s Dropbox example for an
|
||||||
|
activity which actually has to do some extra work):</p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span><span style="color: #60a0b0; font-style: italic">// Making a custom SD-card picker</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #007020; font-weight: bold">class</span> <span style="color: #0e84b5; font-weight: bold">MyPickerActivity</span> <span style="color: #007020; font-weight: bold">extends</span> AbstractFilePickerActivity<span style="color: #666666"><</span>File<span style="color: #666666">></span> <span style="color: #666666">{</span>
|
||||||
|
|
||||||
|
<span style="color: #007020; font-weight: bold">public</span> <span style="color: #06287e">MyPickerActivity</span><span style="color: #666666">()</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">super</span><span style="color: #666666">();</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
|
||||||
|
<span style="color: #555555; font-weight: bold">@Override</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">protected</span> AbstractFilePickerFragment<span style="color: #666666"><</span>File<span style="color: #666666">></span> <span style="color: #06287e">getFragment</span><span style="color: #666666">(</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> String startPath<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">int</span> mode<span style="color: #666666">,</span> <span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowMultiple<span style="color: #666666">,</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">final</span> <span style="color: #902000">boolean</span> allowCreateDir<span style="color: #666666">)</span> <span style="color: #666666">{</span>
|
||||||
|
<span style="color: #60a0b0; font-style: italic">// Only the fragment in this line needs to be changed</span>
|
||||||
|
AbstractFilePickerFragment<span style="color: #666666"><</span>File<span style="color: #666666">></span> fragment <span style="color: #666666">=</span> <span style="color: #007020; font-weight: bold">new</span> MyPickerFragment<span style="color: #666666">();</span>
|
||||||
|
fragment<span style="color: #666666">.</span><span style="color: #4070a0">setArgs</span><span style="color: #666666">(</span>startPath<span style="color: #666666">,</span> mode<span style="color: #666666">,</span> allowMultiple<span style="color: #666666">,</span> allowCreateDir<span style="color: #666666">);</span>
|
||||||
|
<span style="color: #007020; font-weight: bold">return</span> fragment<span style="color: #666666">;</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
<span style="color: #666666">}</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
<h3 id="extend-abstractfilepickerfragment">Extend AbstractFilePickerFragment</h3>
|
||||||
|
|
||||||
|
<p>Which requires you to implement</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>onNewFolder</li>
|
||||||
|
<li>isDir</li>
|
||||||
|
<li>getParent</li>
|
||||||
|
<li>getPath</li>
|
||||||
|
<li>getFullPath</li>
|
||||||
|
<li>getName</li>
|
||||||
|
<li>getRoot</li>
|
||||||
|
<li>toUri</li>
|
||||||
|
<li>getLoader</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>If you only want to make a custom SD-card picker, you can instead extend <code>FilePickerFragment</code>, and only override the relevant method you want to change.</p>
|
||||||
|
|
||||||
|
<p>See the sample app and the examples for some concrete code.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="copyright" role="note">
|
||||||
|
|
||||||
|
© 2016 Released under the Mozilla Public License 2.0 –
|
||||||
|
|
||||||
|
Documentation built with
|
||||||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||||||
|
using the
|
||||||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="pagination" aria-label="Footer">
|
||||||
|
<div class="previous">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="next">
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/" title="Readme">
|
||||||
|
<span class="direction">
|
||||||
|
Next
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Readme
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-next" role="button" aria-label="Next">
|
||||||
|
<i class="icon icon-forward"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="results" role="status" aria-live="polite">
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="meta"></div>
|
||||||
|
<div class="list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var base_url = 'http:\/\/spacecowboy.github.io\/NoNonsense-FilePicker\/';
|
||||||
|
var repo_id = 'spacecowboy\/NoNonsense-FilePicker';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Add headers to scrollspy */
|
||||||
|
var headers = document.getElementsByTagName("h2");
|
||||||
|
var scrollspy = document.getElementById('scrollspy');
|
||||||
|
|
||||||
|
if(scrollspy) {
|
||||||
|
if(headers.length > 0) {
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var li = document.createElement("li");
|
||||||
|
li.setAttribute("class", "anchor");
|
||||||
|
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", headers[i].innerHTML);
|
||||||
|
a.innerHTML = headers[i].innerHTML;
|
||||||
|
|
||||||
|
li.appendChild(a)
|
||||||
|
scrollspy.appendChild(li);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add permanent link next to the headers */
|
||||||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||||||
|
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("class", "headerlink");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", "Permanent link")
|
||||||
|
a.innerHTML = "#";
|
||||||
|
headers[i].appendChild(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="//gohugo.io/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,826 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<html class="no-js">
|
||||||
|
|
||||||
|
<head lang="en-us">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=10" />
|
||||||
|
<title>License - NoNonsense FilePicker</title>
|
||||||
|
<meta name="generator" content="Hugo 0.16" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="description" content="An extensible and flexible file-picker for Android.">
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
<meta name="author" content="SpaceCowboy">
|
||||||
|
|
||||||
|
|
||||||
|
<meta property="og:url" content="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
<meta property="og:title" content="NoNonsense FilePicker">
|
||||||
|
|
||||||
|
<meta name="apple-mobile-web-app-title" content="NoNonsense FilePicker">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
<link rel="icon" type="image/x-icon" href="http://spacecowboy.github.io/NoNonsense-FilePicker/images/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Icon';
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?52m981');
|
||||||
|
src: url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.eot?#iefix52m981')
|
||||||
|
format('embedded-opentype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.woff?52m981')
|
||||||
|
format('woff'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.ttf?52m981')
|
||||||
|
format('truetype'),
|
||||||
|
url('http://spacecowboy.github.io/NoNonsense-FilePicker/fonts/icon.svg?52m981#icon')
|
||||||
|
format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/application.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/temporary.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/palettes.css">
|
||||||
|
<link rel="stylesheet" href="http://spacecowboy.github.io/NoNonsense-FilePicker/stylesheets/highlight/highlight.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700|Roboto%2bMono">
|
||||||
|
<style>
|
||||||
|
body, input {
|
||||||
|
font-family: 'Roboto', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
pre, code {
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', 'Courier', monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/modernizr.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="palette-primary-red palette-accent-light green">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="backdrop">
|
||||||
|
<div class="backdrop-paper"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-drawer">
|
||||||
|
<input class="toggle" type="checkbox" id="toggle-search">
|
||||||
|
<label class="toggle-button overlay" for="toggle-drawer"></label>
|
||||||
|
|
||||||
|
<header class="header">
|
||||||
|
<nav aria-label="Header">
|
||||||
|
<div class="bar default">
|
||||||
|
<div class="button button-menu" role="button" aria-label="Menu">
|
||||||
|
<label class="toggle-button icon icon-menu" for="toggle-drawer">
|
||||||
|
<span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
License
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="button button-github" role="button" aria-label="GitHub">
|
||||||
|
<a href="https://github.com/spacecowboy" title="@spacecowboy on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bar search">
|
||||||
|
<div class="button button-close" role="button" aria-label="Close">
|
||||||
|
<label class="toggle-button icon icon-back" for="toggle-search"></label>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="field">
|
||||||
|
<input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="button button-reset" role="button" aria-label="Search">
|
||||||
|
<button class="toggle-button icon icon-close" id="reset-search"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
|
<div class="drawer">
|
||||||
|
<nav aria-label="Navigation">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker" class="project">
|
||||||
|
<div class="banner">
|
||||||
|
|
||||||
|
<div class="name">
|
||||||
|
<strong>NoNonsense FilePicker </strong>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
spacecowboy/NoNonsense-FilePicker
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<ul class="repo">
|
||||||
|
<li class="repo-download">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/archive/master.zip" target="_blank" title="Download" data-action="download">
|
||||||
|
<i class="icon icon-download"></i> Download
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="repo-stars">
|
||||||
|
<a href="https://github.com/spacecowboy/NoNonsense-FilePicker/stargazers" target="_blank" title="Stargazers" data-action="star">
|
||||||
|
<i class="icon icon-star"></i> Stars
|
||||||
|
<span class="count">–</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="toc">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Readme" href="http://spacecowboy.github.io/NoNonsense-FilePicker/readme/">
|
||||||
|
|
||||||
|
Readme
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Changelog" href="http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/">
|
||||||
|
|
||||||
|
Changelog
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="current" title="License" href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/">
|
||||||
|
|
||||||
|
License
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<ul id="scrollspy">
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<span class="section">Examples</span>
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Change the sort order" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/">
|
||||||
|
|
||||||
|
Change the sort order
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Filter based on file extension" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/">
|
||||||
|
|
||||||
|
Filter based on file extension
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Custom item layout" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/">
|
||||||
|
|
||||||
|
Custom item layout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override the back button" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/">
|
||||||
|
|
||||||
|
Override the back button
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Override selection behavior" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/">
|
||||||
|
|
||||||
|
Override selection behavior
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a title="Standalone fragment" href="http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/">
|
||||||
|
|
||||||
|
Standalone fragment
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<span class="section">The author</span>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/spacecowboy" target="_blank" title="@spacecowboy on GitHub">
|
||||||
|
@spacecowboy on GitHub
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<article class="article">
|
||||||
|
<div class="wrapper">
|
||||||
|
<h1>License </h1>
|
||||||
|
|
||||||
|
<p>Copyright © 2016 Jonas Kalderstam <a href="mailto:jonas@cowboyprogrammer.org">jonas@cowboyprogrammer.org</a></p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span>Mozilla Public License Version 2.0
|
||||||
|
==================================
|
||||||
|
|
||||||
|
1. Definitions
|
||||||
|
--------------
|
||||||
|
|
||||||
|
1.1. "Contributor"
|
||||||
|
means each individual or legal entity that creates, contributes to
|
||||||
|
the creation of, or owns Covered Software.
|
||||||
|
|
||||||
|
1.2. "Contributor Version"
|
||||||
|
means the combination of the Contributions of others (if any) used
|
||||||
|
by a Contributor and that particular Contributor's Contribution.
|
||||||
|
|
||||||
|
1.3. "Contribution"
|
||||||
|
means Covered Software of a particular Contributor.
|
||||||
|
|
||||||
|
1.4. "Covered Software"
|
||||||
|
means Source Code Form to which the initial Contributor has attached
|
||||||
|
the notice in Exhibit A, the Executable Form of such Source Code
|
||||||
|
Form, and Modifications of such Source Code Form, in each case
|
||||||
|
including portions thereof.
|
||||||
|
|
||||||
|
1.5. "Incompatible With Secondary Licenses"
|
||||||
|
means
|
||||||
|
|
||||||
|
(a) that the initial Contributor has attached the notice described
|
||||||
|
in Exhibit B to the Covered Software; or
|
||||||
|
|
||||||
|
(b) that the Covered Software was made available under the terms of
|
||||||
|
version 1.1 or earlier of the License, but not also under the
|
||||||
|
terms of a Secondary License.
|
||||||
|
|
||||||
|
1.6. "Executable Form"
|
||||||
|
means any form of the work other than Source Code Form.
|
||||||
|
|
||||||
|
1.7. "Larger Work"
|
||||||
|
means a work that combines Covered Software with other material, in
|
||||||
|
a separate file or files, that is not Covered Software.
|
||||||
|
|
||||||
|
1.8. "License"
|
||||||
|
means this document.
|
||||||
|
|
||||||
|
1.9. "Licensable"
|
||||||
|
means having the right to grant, to the maximum extent possible,
|
||||||
|
whether at the time of the initial grant or subsequently, any and
|
||||||
|
all of the rights conveyed by this License.
|
||||||
|
|
||||||
|
1.10. "Modifications"
|
||||||
|
means any of the following:
|
||||||
|
|
||||||
|
(a) any file in Source Code Form that results from an addition to,
|
||||||
|
deletion from, or modification of the contents of Covered
|
||||||
|
Software; or
|
||||||
|
|
||||||
|
(b) any new file in Source Code Form that contains any Covered
|
||||||
|
Software.
|
||||||
|
|
||||||
|
1.11. "Patent Claims" of a Contributor
|
||||||
|
means any patent claim(s), including without limitation, method,
|
||||||
|
process, and apparatus claims, in any patent Licensable by such
|
||||||
|
Contributor that would be infringed, but for the grant of the
|
||||||
|
License, by the making, using, selling, offering for sale, having
|
||||||
|
made, import, or transfer of either its Contributions or its
|
||||||
|
Contributor Version.
|
||||||
|
|
||||||
|
1.12. "Secondary License"
|
||||||
|
means either the GNU General Public License, Version 2.0, the GNU
|
||||||
|
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||||
|
Public License, Version 3.0, or any later versions of those
|
||||||
|
licenses.
|
||||||
|
|
||||||
|
1.13. "Source Code Form"
|
||||||
|
means the form of the work preferred for making modifications.
|
||||||
|
|
||||||
|
1.14. "You" (or "Your")
|
||||||
|
means an individual or a legal entity exercising rights under this
|
||||||
|
License. For legal entities, "You" includes any entity that
|
||||||
|
controls, is controlled by, or is under common control with You. For
|
||||||
|
purposes of this definition, "control" means (a) the power, direct
|
||||||
|
or indirect, to cause the direction or management of such entity,
|
||||||
|
whether by contract or otherwise, or (b) ownership of more than
|
||||||
|
fifty percent (50%) of the outstanding shares or beneficial
|
||||||
|
ownership of such entity.
|
||||||
|
|
||||||
|
2. License Grants and Conditions
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
2.1. Grants
|
||||||
|
|
||||||
|
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||||
|
non-exclusive license:
|
||||||
|
|
||||||
|
(a) under intellectual property rights (other than patent or trademark)
|
||||||
|
Licensable by such Contributor to use, reproduce, make available,
|
||||||
|
modify, display, perform, distribute, and otherwise exploit its
|
||||||
|
Contributions, either on an unmodified basis, with Modifications, or
|
||||||
|
as part of a Larger Work; and
|
||||||
|
|
||||||
|
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||||
|
for sale, have made, import, and otherwise transfer either its
|
||||||
|
Contributions or its Contributor Version.
|
||||||
|
|
||||||
|
2.2. Effective Date
|
||||||
|
|
||||||
|
The licenses granted in Section 2.1 with respect to any Contribution
|
||||||
|
become effective for each Contribution on the date the Contributor first
|
||||||
|
distributes such Contribution.
|
||||||
|
|
||||||
|
2.3. Limitations on Grant Scope
|
||||||
|
|
||||||
|
The licenses granted in this Section 2 are the only rights granted under
|
||||||
|
this License. No additional rights or licenses will be implied from the
|
||||||
|
distribution or licensing of Covered Software under this License.
|
||||||
|
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||||
|
Contributor:
|
||||||
|
|
||||||
|
(a) for any code that a Contributor has removed from Covered Software;
|
||||||
|
or
|
||||||
|
|
||||||
|
(b) for infringements caused by: (i) Your and any other third party's
|
||||||
|
modifications of Covered Software, or (ii) the combination of its
|
||||||
|
Contributions with other software (except as part of its Contributor
|
||||||
|
Version); or
|
||||||
|
|
||||||
|
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||||
|
its Contributions.
|
||||||
|
|
||||||
|
This License does not grant any rights in the trademarks, service marks,
|
||||||
|
or logos of any Contributor (except as may be necessary to comply with
|
||||||
|
the notice requirements in Section 3.4).
|
||||||
|
|
||||||
|
2.4. Subsequent Licenses
|
||||||
|
|
||||||
|
No Contributor makes additional grants as a result of Your choice to
|
||||||
|
distribute the Covered Software under a subsequent version of this
|
||||||
|
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||||
|
permitted under the terms of Section 3.3).
|
||||||
|
|
||||||
|
2.5. Representation
|
||||||
|
|
||||||
|
Each Contributor represents that the Contributor believes its
|
||||||
|
Contributions are its original creation(s) or it has sufficient rights
|
||||||
|
to grant the rights to its Contributions conveyed by this License.
|
||||||
|
|
||||||
|
2.6. Fair Use
|
||||||
|
|
||||||
|
This License is not intended to limit any rights You have under
|
||||||
|
applicable copyright doctrines of fair use, fair dealing, or other
|
||||||
|
equivalents.
|
||||||
|
|
||||||
|
2.7. Conditions
|
||||||
|
|
||||||
|
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||||
|
in Section 2.1.
|
||||||
|
|
||||||
|
3. Responsibilities
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
3.1. Distribution of Source Form
|
||||||
|
|
||||||
|
All distribution of Covered Software in Source Code Form, including any
|
||||||
|
Modifications that You create or to which You contribute, must be under
|
||||||
|
the terms of this License. You must inform recipients that the Source
|
||||||
|
Code Form of the Covered Software is governed by the terms of this
|
||||||
|
License, and how they can obtain a copy of this License. You may not
|
||||||
|
attempt to alter or restrict the recipients' rights in the Source Code
|
||||||
|
Form.
|
||||||
|
|
||||||
|
3.2. Distribution of Executable Form
|
||||||
|
|
||||||
|
If You distribute Covered Software in Executable Form then:
|
||||||
|
|
||||||
|
(a) such Covered Software must also be made available in Source Code
|
||||||
|
Form, as described in Section 3.1, and You must inform recipients of
|
||||||
|
the Executable Form how they can obtain a copy of such Source Code
|
||||||
|
Form by reasonable means in a timely manner, at a charge no more
|
||||||
|
than the cost of distribution to the recipient; and
|
||||||
|
|
||||||
|
(b) You may distribute such Executable Form under the terms of this
|
||||||
|
License, or sublicense it under different terms, provided that the
|
||||||
|
license for the Executable Form does not attempt to limit or alter
|
||||||
|
the recipients' rights in the Source Code Form under this License.
|
||||||
|
|
||||||
|
3.3. Distribution of a Larger Work
|
||||||
|
|
||||||
|
You may create and distribute a Larger Work under terms of Your choice,
|
||||||
|
provided that You also comply with the requirements of this License for
|
||||||
|
the Covered Software. If the Larger Work is a combination of Covered
|
||||||
|
Software with a work governed by one or more Secondary Licenses, and the
|
||||||
|
Covered Software is not Incompatible With Secondary Licenses, this
|
||||||
|
License permits You to additionally distribute such Covered Software
|
||||||
|
under the terms of such Secondary License(s), so that the recipient of
|
||||||
|
the Larger Work may, at their option, further distribute the Covered
|
||||||
|
Software under the terms of either this License or such Secondary
|
||||||
|
License(s).
|
||||||
|
|
||||||
|
3.4. Notices
|
||||||
|
|
||||||
|
You may not remove or alter the substance of any license notices
|
||||||
|
(including copyright notices, patent notices, disclaimers of warranty,
|
||||||
|
or limitations of liability) contained within the Source Code Form of
|
||||||
|
the Covered Software, except that You may alter any license notices to
|
||||||
|
the extent required to remedy known factual inaccuracies.
|
||||||
|
|
||||||
|
3.5. Application of Additional Terms
|
||||||
|
|
||||||
|
You may choose to offer, and to charge a fee for, warranty, support,
|
||||||
|
indemnity or liability obligations to one or more recipients of Covered
|
||||||
|
Software. However, You may do so only on Your own behalf, and not on
|
||||||
|
behalf of any Contributor. You must make it absolutely clear that any
|
||||||
|
such warranty, support, indemnity, or liability obligation is offered by
|
||||||
|
You alone, and You hereby agree to indemnify every Contributor for any
|
||||||
|
liability incurred by such Contributor as a result of warranty, support,
|
||||||
|
indemnity or liability terms You offer. You may include additional
|
||||||
|
disclaimers of warranty and limitations of liability specific to any
|
||||||
|
jurisdiction.
|
||||||
|
|
||||||
|
4. Inability to Comply Due to Statute or Regulation
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
If it is impossible for You to comply with any of the terms of this
|
||||||
|
License with respect to some or all of the Covered Software due to
|
||||||
|
statute, judicial order, or regulation then You must: (a) comply with
|
||||||
|
the terms of this License to the maximum extent possible; and (b)
|
||||||
|
describe the limitations and the code they affect. Such description must
|
||||||
|
be placed in a text file included with all distributions of the Covered
|
||||||
|
Software under this License. Except to the extent prohibited by statute
|
||||||
|
or regulation, such description must be sufficiently detailed for a
|
||||||
|
recipient of ordinary skill to be able to understand it.
|
||||||
|
|
||||||
|
5. Termination
|
||||||
|
--------------
|
||||||
|
|
||||||
|
5.1. The rights granted under this License will terminate automatically
|
||||||
|
if You fail to comply with any of its terms. However, if You become
|
||||||
|
compliant, then the rights granted under this License from a particular
|
||||||
|
Contributor are reinstated (a) provisionally, unless and until such
|
||||||
|
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||||
|
ongoing basis, if such Contributor fails to notify You of the
|
||||||
|
non-compliance by some reasonable means prior to 60 days after You have
|
||||||
|
come back into compliance. Moreover, Your grants from a particular
|
||||||
|
Contributor are reinstated on an ongoing basis if such Contributor
|
||||||
|
notifies You of the non-compliance by some reasonable means, this is the
|
||||||
|
first time You have received notice of non-compliance with this License
|
||||||
|
from such Contributor, and You become compliant prior to 30 days after
|
||||||
|
Your receipt of the notice.
|
||||||
|
|
||||||
|
5.2. If You initiate litigation against any entity by asserting a patent
|
||||||
|
infringement claim (excluding declaratory judgment actions,
|
||||||
|
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||||
|
directly or indirectly infringes any patent, then the rights granted to
|
||||||
|
You by any and all Contributors for the Covered Software under Section
|
||||||
|
2.1 of this License shall terminate.
|
||||||
|
|
||||||
|
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||||
|
end user license agreements (excluding distributors and resellers) which
|
||||||
|
have been validly granted by You or Your distributors under this License
|
||||||
|
prior to termination shall survive termination.
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 6. Disclaimer of Warranty *
|
||||||
|
* ------------------------- *
|
||||||
|
* *
|
||||||
|
* Covered Software is provided under this License on an "as is" *
|
||||||
|
* basis, without warranty of any kind, either expressed, implied, or *
|
||||||
|
* statutory, including, without limitation, warranties that the *
|
||||||
|
* Covered Software is free of defects, merchantable, fit for a *
|
||||||
|
* particular purpose or non-infringing. The entire risk as to the *
|
||||||
|
* quality and performance of the Covered Software is with You. *
|
||||||
|
* Should any Covered Software prove defective in any respect, You *
|
||||||
|
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||||
|
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||||
|
* essential part of this License. No use of any Covered Software is *
|
||||||
|
* authorized under this License except under this disclaimer. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 7. Limitation of Liability *
|
||||||
|
* -------------------------- *
|
||||||
|
* *
|
||||||
|
* Under no circumstances and under no legal theory, whether tort *
|
||||||
|
* (including negligence), contract, or otherwise, shall any *
|
||||||
|
* Contributor, or anyone who distributes Covered Software as *
|
||||||
|
* permitted above, be liable to You for any direct, indirect, *
|
||||||
|
* special, incidental, or consequential damages of any character *
|
||||||
|
* including, without limitation, damages for lost profits, loss of *
|
||||||
|
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||||
|
* and all other commercial damages or losses, even if such party *
|
||||||
|
* shall have been informed of the possibility of such damages. This *
|
||||||
|
* limitation of liability shall not apply to liability for death or *
|
||||||
|
* personal injury resulting from such party's negligence to the *
|
||||||
|
* extent applicable law prohibits such limitation. Some *
|
||||||
|
* jurisdictions do not allow the exclusion or limitation of *
|
||||||
|
* incidental or consequential damages, so this exclusion and *
|
||||||
|
* limitation may not apply to You. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
8. Litigation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Any litigation relating to this License may be brought only in the
|
||||||
|
courts of a jurisdiction where the defendant maintains its principal
|
||||||
|
place of business and such litigation shall be governed by laws of that
|
||||||
|
jurisdiction, without reference to its conflict-of-law provisions.
|
||||||
|
Nothing in this Section shall prevent a party's ability to bring
|
||||||
|
cross-claims or counter-claims.
|
||||||
|
|
||||||
|
9. Miscellaneous
|
||||||
|
----------------
|
||||||
|
|
||||||
|
This License represents the complete agreement concerning the subject
|
||||||
|
matter hereof. If any provision of this License is held to be
|
||||||
|
unenforceable, such provision shall be reformed only to the extent
|
||||||
|
necessary to make it enforceable. Any law or regulation which provides
|
||||||
|
that the language of a contract shall be construed against the drafter
|
||||||
|
shall not be used to construe this License against a Contributor.
|
||||||
|
|
||||||
|
10. Versions of the License
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
10.1. New Versions
|
||||||
|
|
||||||
|
Mozilla Foundation is the license steward. Except as provided in Section
|
||||||
|
10.3, no one other than the license steward has the right to modify or
|
||||||
|
publish new versions of this License. Each version will be given a
|
||||||
|
distinguishing version number.
|
||||||
|
|
||||||
|
10.2. Effect of New Versions
|
||||||
|
|
||||||
|
You may distribute the Covered Software under the terms of the version
|
||||||
|
of the License under which You originally received the Covered Software,
|
||||||
|
or under the terms of any subsequent version published by the license
|
||||||
|
steward.
|
||||||
|
|
||||||
|
10.3. Modified Versions
|
||||||
|
|
||||||
|
If you create software not governed by this License, and you want to
|
||||||
|
create a new license for such software, you may create and use a
|
||||||
|
modified version of this License if you rename the license and remove
|
||||||
|
any references to the name of the license steward (except to note that
|
||||||
|
such modified license differs from this License).
|
||||||
|
|
||||||
|
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||||
|
Licenses
|
||||||
|
|
||||||
|
If You choose to distribute Source Code Form that is Incompatible With
|
||||||
|
Secondary Licenses under the terms of this version of the License, the
|
||||||
|
notice described in Exhibit B of this License must be attached.
|
||||||
|
|
||||||
|
Exhibit A - Source Code Form License Notice
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
If it is not possible or desirable to put the notice in a particular
|
||||||
|
file, then You may include the notice in a location (such as a LICENSE
|
||||||
|
file in a relevant directory) where a recipient would be likely to look
|
||||||
|
for such a notice.
|
||||||
|
|
||||||
|
You may add additional accurate notices of copyright ownership.
|
||||||
|
|
||||||
|
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
defined by the Mozilla Public License, v. 2.0.
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="copyright" role="note">
|
||||||
|
|
||||||
|
© 2016 Released under the Mozilla Public License 2.0 –
|
||||||
|
|
||||||
|
Documentation built with
|
||||||
|
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
|
||||||
|
using the
|
||||||
|
<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="pagination" aria-label="Footer">
|
||||||
|
<div class="previous">
|
||||||
|
|
||||||
|
<a href="http://spacecowboy.github.io/NoNonsense-FilePicker/" title="Readme">
|
||||||
|
<span class="direction">
|
||||||
|
Previous
|
||||||
|
</span>
|
||||||
|
<div class="page">
|
||||||
|
<div class="button button-previous" role="button" aria-label="Previous">
|
||||||
|
<i class="icon icon-back"></i>
|
||||||
|
</div>
|
||||||
|
<div class="stretch">
|
||||||
|
<div class="title">
|
||||||
|
Readme
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="next">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="results" role="status" aria-live="polite">
|
||||||
|
<div class="scrollable">
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="meta"></div>
|
||||||
|
<div class="list"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var base_url = 'http:\/\/spacecowboy.github.io\/NoNonsense-FilePicker\/';
|
||||||
|
var repo_id = 'spacecowboy\/NoNonsense-FilePicker';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="http://spacecowboy.github.io/NoNonsense-FilePicker/javascripts/application.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Add headers to scrollspy */
|
||||||
|
var headers = document.getElementsByTagName("h2");
|
||||||
|
var scrollspy = document.getElementById('scrollspy');
|
||||||
|
|
||||||
|
if(scrollspy) {
|
||||||
|
if(headers.length > 0) {
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var li = document.createElement("li");
|
||||||
|
li.setAttribute("class", "anchor");
|
||||||
|
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", headers[i].innerHTML);
|
||||||
|
a.innerHTML = headers[i].innerHTML;
|
||||||
|
|
||||||
|
li.appendChild(a)
|
||||||
|
scrollspy.appendChild(li);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scrollspy.parentElement.removeChild(scrollspy)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add permanent link next to the headers */
|
||||||
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
||||||
|
|
||||||
|
for(var i = 0; i < headers.length; i++) {
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.setAttribute("class", "headerlink");
|
||||||
|
a.setAttribute("href", "#" + headers[i].id);
|
||||||
|
a.setAttribute("title", "Permanent link")
|
||||||
|
a.innerHTML = "#";
|
||||||
|
headers[i].appendChild(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script src="//gohugo.io/js/highlight.pack.js"></script>
|
||||||
|
<script>hljs.initHighlightingOnLoad();</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,397 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||||
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
|
<channel>
|
||||||
|
<title>Licenses on NoNonsense FilePicker</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/license/</link>
|
||||||
|
<description>Recent content in Licenses on NoNonsense FilePicker</description>
|
||||||
|
<generator>Hugo -- gohugo.io</generator>
|
||||||
|
<language>en-us</language>
|
||||||
|
<lastBuildDate>Sat, 16 Jul 2016 16:35:07 +0200</lastBuildDate>
|
||||||
|
<atom:link href="http://spacecowboy.github.io/NoNonsense-FilePicker/license/index.xml" rel="self" type="application/rss+xml" />
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<title>License</title>
|
||||||
|
<link>http://spacecowboy.github.io/NoNonsense-FilePicker/license/</link>
|
||||||
|
<pubDate>Sat, 16 Jul 2016 16:35:07 +0200</pubDate>
|
||||||
|
|
||||||
|
<guid>http://spacecowboy.github.io/NoNonsense-FilePicker/license/</guid>
|
||||||
|
<description><p>Copyright &copy; 2016 Jonas Kalderstam <a href="mailto:jonas@cowboyprogrammer.org">jonas@cowboyprogrammer.org</a></p>
|
||||||
|
<div class="highlight" style="background: #f0f0f0"><pre style="line-height: 125%"><span></span>Mozilla Public License Version 2.0
|
||||||
|
==================================
|
||||||
|
|
||||||
|
1. Definitions
|
||||||
|
--------------
|
||||||
|
|
||||||
|
1.1. &quot;Contributor&quot;
|
||||||
|
means each individual or legal entity that creates, contributes to
|
||||||
|
the creation of, or owns Covered Software.
|
||||||
|
|
||||||
|
1.2. &quot;Contributor Version&quot;
|
||||||
|
means the combination of the Contributions of others (if any) used
|
||||||
|
by a Contributor and that particular Contributor&#39;s Contribution.
|
||||||
|
|
||||||
|
1.3. &quot;Contribution&quot;
|
||||||
|
means Covered Software of a particular Contributor.
|
||||||
|
|
||||||
|
1.4. &quot;Covered Software&quot;
|
||||||
|
means Source Code Form to which the initial Contributor has attached
|
||||||
|
the notice in Exhibit A, the Executable Form of such Source Code
|
||||||
|
Form, and Modifications of such Source Code Form, in each case
|
||||||
|
including portions thereof.
|
||||||
|
|
||||||
|
1.5. &quot;Incompatible With Secondary Licenses&quot;
|
||||||
|
means
|
||||||
|
|
||||||
|
(a) that the initial Contributor has attached the notice described
|
||||||
|
in Exhibit B to the Covered Software; or
|
||||||
|
|
||||||
|
(b) that the Covered Software was made available under the terms of
|
||||||
|
version 1.1 or earlier of the License, but not also under the
|
||||||
|
terms of a Secondary License.
|
||||||
|
|
||||||
|
1.6. &quot;Executable Form&quot;
|
||||||
|
means any form of the work other than Source Code Form.
|
||||||
|
|
||||||
|
1.7. &quot;Larger Work&quot;
|
||||||
|
means a work that combines Covered Software with other material, in
|
||||||
|
a separate file or files, that is not Covered Software.
|
||||||
|
|
||||||
|
1.8. &quot;License&quot;
|
||||||
|
means this document.
|
||||||
|
|
||||||
|
1.9. &quot;Licensable&quot;
|
||||||
|
means having the right to grant, to the maximum extent possible,
|
||||||
|
whether at the time of the initial grant or subsequently, any and
|
||||||
|
all of the rights conveyed by this License.
|
||||||
|
|
||||||
|
1.10. &quot;Modifications&quot;
|
||||||
|
means any of the following:
|
||||||
|
|
||||||
|
(a) any file in Source Code Form that results from an addition to,
|
||||||
|
deletion from, or modification of the contents of Covered
|
||||||
|
Software; or
|
||||||
|
|
||||||
|
(b) any new file in Source Code Form that contains any Covered
|
||||||
|
Software.
|
||||||
|
|
||||||
|
1.11. &quot;Patent Claims&quot; of a Contributor
|
||||||
|
means any patent claim(s), including without limitation, method,
|
||||||
|
process, and apparatus claims, in any patent Licensable by such
|
||||||
|
Contributor that would be infringed, but for the grant of the
|
||||||
|
License, by the making, using, selling, offering for sale, having
|
||||||
|
made, import, or transfer of either its Contributions or its
|
||||||
|
Contributor Version.
|
||||||
|
|
||||||
|
1.12. &quot;Secondary License&quot;
|
||||||
|
means either the GNU General Public License, Version 2.0, the GNU
|
||||||
|
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||||
|
Public License, Version 3.0, or any later versions of those
|
||||||
|
licenses.
|
||||||
|
|
||||||
|
1.13. &quot;Source Code Form&quot;
|
||||||
|
means the form of the work preferred for making modifications.
|
||||||
|
|
||||||
|
1.14. &quot;You&quot; (or &quot;Your&quot;)
|
||||||
|
means an individual or a legal entity exercising rights under this
|
||||||
|
License. For legal entities, &quot;You&quot; includes any entity that
|
||||||
|
controls, is controlled by, or is under common control with You. For
|
||||||
|
purposes of this definition, &quot;control&quot; means (a) the power, direct
|
||||||
|
or indirect, to cause the direction or management of such entity,
|
||||||
|
whether by contract or otherwise, or (b) ownership of more than
|
||||||
|
fifty percent (50%) of the outstanding shares or beneficial
|
||||||
|
ownership of such entity.
|
||||||
|
|
||||||
|
2. License Grants and Conditions
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
2.1. Grants
|
||||||
|
|
||||||
|
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||||
|
non-exclusive license:
|
||||||
|
|
||||||
|
(a) under intellectual property rights (other than patent or trademark)
|
||||||
|
Licensable by such Contributor to use, reproduce, make available,
|
||||||
|
modify, display, perform, distribute, and otherwise exploit its
|
||||||
|
Contributions, either on an unmodified basis, with Modifications, or
|
||||||
|
as part of a Larger Work; and
|
||||||
|
|
||||||
|
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||||
|
for sale, have made, import, and otherwise transfer either its
|
||||||
|
Contributions or its Contributor Version.
|
||||||
|
|
||||||
|
2.2. Effective Date
|
||||||
|
|
||||||
|
The licenses granted in Section 2.1 with respect to any Contribution
|
||||||
|
become effective for each Contribution on the date the Contributor first
|
||||||
|
distributes such Contribution.
|
||||||
|
|
||||||
|
2.3. Limitations on Grant Scope
|
||||||
|
|
||||||
|
The licenses granted in this Section 2 are the only rights granted under
|
||||||
|
this License. No additional rights or licenses will be implied from the
|
||||||
|
distribution or licensing of Covered Software under this License.
|
||||||
|
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||||
|
Contributor:
|
||||||
|
|
||||||
|
(a) for any code that a Contributor has removed from Covered Software;
|
||||||
|
or
|
||||||
|
|
||||||
|
(b) for infringements caused by: (i) Your and any other third party&#39;s
|
||||||
|
modifications of Covered Software, or (ii) the combination of its
|
||||||
|
Contributions with other software (except as part of its Contributor
|
||||||
|
Version); or
|
||||||
|
|
||||||
|
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||||
|
its Contributions.
|
||||||
|
|
||||||
|
This License does not grant any rights in the trademarks, service marks,
|
||||||
|
or logos of any Contributor (except as may be necessary to comply with
|
||||||
|
the notice requirements in Section 3.4).
|
||||||
|
|
||||||
|
2.4. Subsequent Licenses
|
||||||
|
|
||||||
|
No Contributor makes additional grants as a result of Your choice to
|
||||||
|
distribute the Covered Software under a subsequent version of this
|
||||||
|
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||||
|
permitted under the terms of Section 3.3).
|
||||||
|
|
||||||
|
2.5. Representation
|
||||||
|
|
||||||
|
Each Contributor represents that the Contributor believes its
|
||||||
|
Contributions are its original creation(s) or it has sufficient rights
|
||||||
|
to grant the rights to its Contributions conveyed by this License.
|
||||||
|
|
||||||
|
2.6. Fair Use
|
||||||
|
|
||||||
|
This License is not intended to limit any rights You have under
|
||||||
|
applicable copyright doctrines of fair use, fair dealing, or other
|
||||||
|
equivalents.
|
||||||
|
|
||||||
|
2.7. Conditions
|
||||||
|
|
||||||
|
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||||
|
in Section 2.1.
|
||||||
|
|
||||||
|
3. Responsibilities
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
3.1. Distribution of Source Form
|
||||||
|
|
||||||
|
All distribution of Covered Software in Source Code Form, including any
|
||||||
|
Modifications that You create or to which You contribute, must be under
|
||||||
|
the terms of this License. You must inform recipients that the Source
|
||||||
|
Code Form of the Covered Software is governed by the terms of this
|
||||||
|
License, and how they can obtain a copy of this License. You may not
|
||||||
|
attempt to alter or restrict the recipients&#39; rights in the Source Code
|
||||||
|
Form.
|
||||||
|
|
||||||
|
3.2. Distribution of Executable Form
|
||||||
|
|
||||||
|
If You distribute Covered Software in Executable Form then:
|
||||||
|
|
||||||
|
(a) such Covered Software must also be made available in Source Code
|
||||||
|
Form, as described in Section 3.1, and You must inform recipients of
|
||||||
|
the Executable Form how they can obtain a copy of such Source Code
|
||||||
|
Form by reasonable means in a timely manner, at a charge no more
|
||||||
|
than the cost of distribution to the recipient; and
|
||||||
|
|
||||||
|
(b) You may distribute such Executable Form under the terms of this
|
||||||
|
License, or sublicense it under different terms, provided that the
|
||||||
|
license for the Executable Form does not attempt to limit or alter
|
||||||
|
the recipients&#39; rights in the Source Code Form under this License.
|
||||||
|
|
||||||
|
3.3. Distribution of a Larger Work
|
||||||
|
|
||||||
|
You may create and distribute a Larger Work under terms of Your choice,
|
||||||
|
provided that You also comply with the requirements of this License for
|
||||||
|
the Covered Software. If the Larger Work is a combination of Covered
|
||||||
|
Software with a work governed by one or more Secondary Licenses, and the
|
||||||
|
Covered Software is not Incompatible With Secondary Licenses, this
|
||||||
|
License permits You to additionally distribute such Covered Software
|
||||||
|
under the terms of such Secondary License(s), so that the recipient of
|
||||||
|
the Larger Work may, at their option, further distribute the Covered
|
||||||
|
Software under the terms of either this License or such Secondary
|
||||||
|
License(s).
|
||||||
|
|
||||||
|
3.4. Notices
|
||||||
|
|
||||||
|
You may not remove or alter the substance of any license notices
|
||||||
|
(including copyright notices, patent notices, disclaimers of warranty,
|
||||||
|
or limitations of liability) contained within the Source Code Form of
|
||||||
|
the Covered Software, except that You may alter any license notices to
|
||||||
|
the extent required to remedy known factual inaccuracies.
|
||||||
|
|
||||||
|
3.5. Application of Additional Terms
|
||||||
|
|
||||||
|
You may choose to offer, and to charge a fee for, warranty, support,
|
||||||
|
indemnity or liability obligations to one or more recipients of Covered
|
||||||
|
Software. However, You may do so only on Your own behalf, and not on
|
||||||
|
behalf of any Contributor. You must make it absolutely clear that any
|
||||||
|
such warranty, support, indemnity, or liability obligation is offered by
|
||||||
|
You alone, and You hereby agree to indemnify every Contributor for any
|
||||||
|
liability incurred by such Contributor as a result of warranty, support,
|
||||||
|
indemnity or liability terms You offer. You may include additional
|
||||||
|
disclaimers of warranty and limitations of liability specific to any
|
||||||
|
jurisdiction.
|
||||||
|
|
||||||
|
4. Inability to Comply Due to Statute or Regulation
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
If it is impossible for You to comply with any of the terms of this
|
||||||
|
License with respect to some or all of the Covered Software due to
|
||||||
|
statute, judicial order, or regulation then You must: (a) comply with
|
||||||
|
the terms of this License to the maximum extent possible; and (b)
|
||||||
|
describe the limitations and the code they affect. Such description must
|
||||||
|
be placed in a text file included with all distributions of the Covered
|
||||||
|
Software under this License. Except to the extent prohibited by statute
|
||||||
|
or regulation, such description must be sufficiently detailed for a
|
||||||
|
recipient of ordinary skill to be able to understand it.
|
||||||
|
|
||||||
|
5. Termination
|
||||||
|
--------------
|
||||||
|
|
||||||
|
5.1. The rights granted under this License will terminate automatically
|
||||||
|
if You fail to comply with any of its terms. However, if You become
|
||||||
|
compliant, then the rights granted under this License from a particular
|
||||||
|
Contributor are reinstated (a) provisionally, unless and until such
|
||||||
|
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||||
|
ongoing basis, if such Contributor fails to notify You of the
|
||||||
|
non-compliance by some reasonable means prior to 60 days after You have
|
||||||
|
come back into compliance. Moreover, Your grants from a particular
|
||||||
|
Contributor are reinstated on an ongoing basis if such Contributor
|
||||||
|
notifies You of the non-compliance by some reasonable means, this is the
|
||||||
|
first time You have received notice of non-compliance with this License
|
||||||
|
from such Contributor, and You become compliant prior to 30 days after
|
||||||
|
Your receipt of the notice.
|
||||||
|
|
||||||
|
5.2. If You initiate litigation against any entity by asserting a patent
|
||||||
|
infringement claim (excluding declaratory judgment actions,
|
||||||
|
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||||
|
directly or indirectly infringes any patent, then the rights granted to
|
||||||
|
You by any and all Contributors for the Covered Software under Section
|
||||||
|
2.1 of this License shall terminate.
|
||||||
|
|
||||||
|
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||||
|
end user license agreements (excluding distributors and resellers) which
|
||||||
|
have been validly granted by You or Your distributors under this License
|
||||||
|
prior to termination shall survive termination.
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 6. Disclaimer of Warranty *
|
||||||
|
* ------------------------- *
|
||||||
|
* *
|
||||||
|
* Covered Software is provided under this License on an &quot;as is&quot; *
|
||||||
|
* basis, without warranty of any kind, either expressed, implied, or *
|
||||||
|
* statutory, including, without limitation, warranties that the *
|
||||||
|
* Covered Software is free of defects, merchantable, fit for a *
|
||||||
|
* particular purpose or non-infringing. The entire risk as to the *
|
||||||
|
* quality and performance of the Covered Software is with You. *
|
||||||
|
* Should any Covered Software prove defective in any respect, You *
|
||||||
|
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||||
|
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||||
|
* essential part of this License. No use of any Covered Software is *
|
||||||
|
* authorized under this License except under this disclaimer. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
************************************************************************
|
||||||
|
* *
|
||||||
|
* 7. Limitation of Liability *
|
||||||
|
* -------------------------- *
|
||||||
|
* *
|
||||||
|
* Under no circumstances and under no legal theory, whether tort *
|
||||||
|
* (including negligence), contract, or otherwise, shall any *
|
||||||
|
* Contributor, or anyone who distributes Covered Software as *
|
||||||
|
* permitted above, be liable to You for any direct, indirect, *
|
||||||
|
* special, incidental, or consequential damages of any character *
|
||||||
|
* including, without limitation, damages for lost profits, loss of *
|
||||||
|
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||||
|
* and all other commercial damages or losses, even if such party *
|
||||||
|
* shall have been informed of the possibility of such damages. This *
|
||||||
|
* limitation of liability shall not apply to liability for death or *
|
||||||
|
* personal injury resulting from such party&#39;s negligence to the *
|
||||||
|
* extent applicable law prohibits such limitation. Some *
|
||||||
|
* jurisdictions do not allow the exclusion or limitation of *
|
||||||
|
* incidental or consequential damages, so this exclusion and *
|
||||||
|
* limitation may not apply to You. *
|
||||||
|
* *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
8. Litigation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Any litigation relating to this License may be brought only in the
|
||||||
|
courts of a jurisdiction where the defendant maintains its principal
|
||||||
|
place of business and such litigation shall be governed by laws of that
|
||||||
|
jurisdiction, without reference to its conflict-of-law provisions.
|
||||||
|
Nothing in this Section shall prevent a party&#39;s ability to bring
|
||||||
|
cross-claims or counter-claims.
|
||||||
|
|
||||||
|
9. Miscellaneous
|
||||||
|
----------------
|
||||||
|
|
||||||
|
This License represents the complete agreement concerning the subject
|
||||||
|
matter hereof. If any provision of this License is held to be
|
||||||
|
unenforceable, such provision shall be reformed only to the extent
|
||||||
|
necessary to make it enforceable. Any law or regulation which provides
|
||||||
|
that the language of a contract shall be construed against the drafter
|
||||||
|
shall not be used to construe this License against a Contributor.
|
||||||
|
|
||||||
|
10. Versions of the License
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
10.1. New Versions
|
||||||
|
|
||||||
|
Mozilla Foundation is the license steward. Except as provided in Section
|
||||||
|
10.3, no one other than the license steward has the right to modify or
|
||||||
|
publish new versions of this License. Each version will be given a
|
||||||
|
distinguishing version number.
|
||||||
|
|
||||||
|
10.2. Effect of New Versions
|
||||||
|
|
||||||
|
You may distribute the Covered Software under the terms of the version
|
||||||
|
of the License under which You originally received the Covered Software,
|
||||||
|
or under the terms of any subsequent version published by the license
|
||||||
|
steward.
|
||||||
|
|
||||||
|
10.3. Modified Versions
|
||||||
|
|
||||||
|
If you create software not governed by this License, and you want to
|
||||||
|
create a new license for such software, you may create and use a
|
||||||
|
modified version of this License if you rename the license and remove
|
||||||
|
any references to the name of the license steward (except to note that
|
||||||
|
such modified license differs from this License).
|
||||||
|
|
||||||
|
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||||
|
Licenses
|
||||||
|
|
||||||
|
If You choose to distribute Source Code Form that is Incompatible With
|
||||||
|
Secondary Licenses under the terms of this version of the License, the
|
||||||
|
notice described in Exhibit B of this License must be attached.
|
||||||
|
|
||||||
|
Exhibit A - Source Code Form License Notice
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
If it is not possible or desirable to put the notice in a particular
|
||||||
|
file, then You may include the notice in a location (such as a LICENSE
|
||||||
|
file in a relevant directory) where a recipient would be likely to look
|
||||||
|
for such a notice.
|
||||||
|
|
||||||
|
You may add additional accurate notices of copyright ownership.
|
||||||
|
|
||||||
|
Exhibit B - &quot;Incompatible With Secondary Licenses&quot; Notice
|
||||||
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
This Source Code Form is &quot;Incompatible With Secondary Licenses&quot;, as
|
||||||
|
defined by the Mozilla Public License, v. 2.0.
|
||||||
|
</pre></div>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<!DOCTYPE html><html><head><link rel="canonical" href="http://spacecowboy.github.io/NoNonsense-FilePicker/"/><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta http-equiv="refresh" content="0;url=http://spacecowboy.github.io/NoNonsense-FilePicker/" /></head></html>
|
||||||
|
After Width: | Height: | Size: 370 KiB |
|
After Width: | Height: | Size: 370 KiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
After Width: | Height: | Size: 119 KiB |
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>http://spacecowboy.github.io/NoNonsense-FilePicker/</loc>
|
||||||
|
<lastmod>2016-07-16T17:36:40+02:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>http://spacecowboy.github.io/NoNonsense-FilePicker/example/standalone_fragment/</loc>
|
||||||
|
<lastmod>2016-07-16T17:36:40+02:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_selection_behavior/</loc>
|
||||||
|
<lastmod>2016-07-16T17:35:01+02:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>http://spacecowboy.github.io/NoNonsense-FilePicker/example/override_back_button/</loc>
|
||||||
|
<lastmod>2016-07-16T17:33:43+02:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>http://spacecowboy.github.io/NoNonsense-FilePicker/example/filter_file_extension/</loc>
|
||||||
|
<lastmod>2016-07-16T17:32:07+02:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>http://spacecowboy.github.io/NoNonsense-FilePicker/example/custom_item_layout/</loc>
|
||||||
|
<lastmod>2016-07-16T17:21:28+02:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>http://spacecowboy.github.io/NoNonsense-FilePicker/example/sortorder/</loc>
|
||||||
|
<lastmod>2016-07-16T17:10:46+02:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>http://spacecowboy.github.io/NoNonsense-FilePicker/changelog/</loc>
|
||||||
|
<lastmod>2016-07-16T17:06:45+02:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>http://spacecowboy.github.io/NoNonsense-FilePicker/</loc>
|
||||||
|
<lastmod>2016-07-16T16:42:44+02:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>http://spacecowboy.github.io/NoNonsense-FilePicker/license/</loc>
|
||||||
|
<lastmod>2016-07-16T16:35:07+02:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
</urlset>
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
* overwrite the current primary color of the
|
||||||
|
* theme that is used as fallback in codeblocks
|
||||||
|
*/
|
||||||
|
.article pre code {
|
||||||
|
color: rgba(0, 0, 0, 0.8) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
HIGHLIGHT.JS THEME
|
||||||
|
|
||||||
|
tweaked version of the Github theme
|
||||||
|
*/
|
||||||
|
|
||||||
|
.hljs {
|
||||||
|
display:block;
|
||||||
|
overflow-x:auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-comment,
|
||||||
|
.hljs-quote {
|
||||||
|
color:#998;
|
||||||
|
font-style:italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-keyword,
|
||||||
|
.hljs-selector-tag,
|
||||||
|
.hljs-subst {
|
||||||
|
color:#333;
|
||||||
|
font-weight:700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-number,
|
||||||
|
.hljs-literal,
|
||||||
|
.hljs-variable,
|
||||||
|
.hljs-template-variable,
|
||||||
|
.hljs-tag .hljs-attr {
|
||||||
|
color:teal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-string,
|
||||||
|
.hljs-doctag {
|
||||||
|
color:#d14;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-title,
|
||||||
|
.hljs-section,
|
||||||
|
.hljs-selector-id {
|
||||||
|
color:#900;
|
||||||
|
font-weight:700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-subst {
|
||||||
|
font-weight:400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-type,
|
||||||
|
.hljs-class .hljs-title {
|
||||||
|
color:#458;
|
||||||
|
font-weight:700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-tag,
|
||||||
|
.hljs-name,
|
||||||
|
.hljs-attribute {
|
||||||
|
color:navy;
|
||||||
|
font-weight:400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-regexp,
|
||||||
|
.hljs-link {
|
||||||
|
color:#009926;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-symbol,
|
||||||
|
.hljs-bullet {
|
||||||
|
color:#990073;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-built_in,
|
||||||
|
.hljs-builtin-name {
|
||||||
|
color:#0086b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-meta {
|
||||||
|
color:#999;
|
||||||
|
font-weight:700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-deletion {
|
||||||
|
background:#fdd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-addition {
|
||||||
|
background:#dfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-emphasis {
|
||||||
|
font-style:italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-strong {
|
||||||
|
font-weight:700;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* This file only exists (temporarily) until the
|
||||||
|
custom styling can be replaced with the
|
||||||
|
implementation of the upstream project.
|
||||||
|
*/
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
padding: 0 20px;
|
||||||
|
margin: 0 0 20px;
|
||||||
|
font-size: inherit;
|
||||||
|
border-left: 5px solid #eee;
|
||||||
|
}
|
||||||
|
|
@ -1,39 +1,7 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 Jonas Kalderstam
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
#
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
# it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
# Project-wide Gradle settings.
|
# Project-wide Gradle settings.
|
||||||
|
|
||||||
VERSION_NAME=2.3.0
|
|
||||||
VERSION_CODE=21
|
|
||||||
GROUP=com.nononsenseapps
|
|
||||||
|
|
||||||
PROJECT_NAME=com.nononsenseapps:filepicker
|
|
||||||
POM_ARTIFACT_ID=filepicker
|
|
||||||
POM_DESCRIPTION=An extendable Android file/directory-picker you can include in your app
|
|
||||||
POM_URL=https://github.com/spacecowboy/NoNonsense-FilePicker
|
|
||||||
POM_SCM_URL=https://github.com/spacecowboy/NoNonsense-FilePicker
|
|
||||||
POM_SCM_CONNECTION=scm:git@github.com:spacecowboy/NoNonsense-FilePicker.git
|
|
||||||
POM_SCM_DEV_CONNECTION=scm:git@github.com:spacecowboy/NoNonsense-FilePicker.git
|
|
||||||
POM_LICENCE_NAME=LGPL-3.0
|
|
||||||
POM_LICENCE_URL=https://www.gnu.org/licenses/lgpl.txt
|
|
||||||
POM_LICENCE_DIST=repo
|
|
||||||
POM_DEVELOPER_ID=neckbeard
|
|
||||||
POM_DEVELOPER_NAME=Jonas Kalderstam
|
|
||||||
POM_DEVELOPER_EMAIL=jonas@kalderstam.se
|
|
||||||
|
|
||||||
POM_URL_ISSUES=https://github.com/spacecowboy/NoNonsense-FilePicker/issues
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#Thu Apr 23 00:07:46 CEST 2015
|
#Mon Aug 22 14:26:52 CEST 2016
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,9 @@
|
||||||
## New way
|
# Generate changelog
|
||||||
|
github_changelog_generator -u spacecowboy -p NoNonsense-FilePicker --no-issues-wo-labels --future-release 2.5.1
|
||||||
|
|
||||||
|
# Commit new changelog
|
||||||
|
|
||||||
|
# Make tag
|
||||||
|
|
||||||
|
# Upload to jcenter
|
||||||
./gradlew clean build bintrayUpload -PdryRun=false
|
./gradlew clean build bintrayUpload -PdryRun=false
|
||||||
|
|
||||||
## Old way...
|
|
||||||
First upload artifacts
|
|
||||||
|
|
||||||
./gradlew uploadArchives
|
|
||||||
|
|
||||||
|
|
||||||
Sync runs every 2 hours, so wait a bit...
|
|
||||||
|
|
||||||
Second close repository
|
|
||||||
|
|
||||||
./gradlew closeRepository
|
|
||||||
|
|
||||||
Third promote repository
|
|
||||||
|
|
||||||
./gradlew promoteRepository
|
|
||||||
|
|
|
||||||
|
|
@ -1,54 +1,20 @@
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Jonas Kalderstam
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
*
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// must be applied after your artifact generating plugin (eg. java /
|
|
||||||
// com.android.library)
|
|
||||||
apply plugin: 'bintray-release'
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 23
|
compileSdkVersion compileSdk
|
||||||
buildToolsVersion "23.0.0"
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 14
|
minSdkVersion 16
|
||||||
targetSdkVersion 23
|
|
||||||
versionCode Integer.parseInt(project.VERSION_CODE)
|
|
||||||
versionName project.VERSION_NAME
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
|
||||||
compile 'com.android.support:appcompat-v7:23.0.0'
|
implementation "com.android.support:support-v4:$supportLibraryVersion"
|
||||||
compile 'com.android.support:support-v4:23.0.0'
|
implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
|
||||||
compile 'com.android.support:recyclerview-v7:23.0.0'
|
|
||||||
|
|
||||||
testCompile 'junit:junit:4.12'
|
|
||||||
}
|
|
||||||
|
|
||||||
publish {
|
|
||||||
groupId = GROUP
|
|
||||||
artifactId = POM_ARTIFACT_ID
|
|
||||||
publishVersion = VERSION_NAME
|
|
||||||
description = POM_DESCRIPTION
|
|
||||||
website = POM_URL
|
|
||||||
licences = ['LGPL-3.0']
|
|
||||||
uploadName = PROJECT_NAME
|
|
||||||
bintrayUser = project.hasProperty("BINTRAY_USER")? BINTRAY_USER: "Dummy"
|
|
||||||
bintrayKey = project.hasProperty("BINTRAY_KEY") ? BINTRAY_KEY: "Dummy"
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,7 @@
|
||||||
<!--
|
<!--
|
||||||
Copyright (c) 2015 Jonas Kalderstam
|
~ This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
~ License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
This program is free software: you can redistribute it and/or modify
|
~ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<manifest package="com.nononsenseapps.filepicker">
|
<manifest package="com.nononsenseapps.filepicker">
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Jonas Kalderstam
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
*
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.nononsenseapps.filepicker;
|
package com.nononsenseapps.filepicker;
|
||||||
|
|
@ -25,6 +14,8 @@ import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
|
|
@ -45,10 +36,10 @@ import java.util.List;
|
||||||
* If you want to be able to select multiple items, include EXTRA_ALLOW_MULTIPLE
|
* If you want to be able to select multiple items, include EXTRA_ALLOW_MULTIPLE
|
||||||
* (default false).
|
* (default false).
|
||||||
* <p/>
|
* <p/>
|
||||||
* Two non-standard extra arguments are supported as well: EXTRA_ONLY_DIRS
|
* Some non-standard extra arguments are supported as well:
|
||||||
* (defaults to false)
|
* EXTRA_ONLY_DIRS - (default false) allows only directories to be selected.
|
||||||
* allows only directories to be selected.
|
* EXTRA_START_PATH - (default null) which should specify the starting path.
|
||||||
* And EXTRA_START_PATH (default null), which should specify the starting path.
|
* EXTRA_ALLOW_EXISTING_FILE - (default true) if existing files are selectable in 'new file'-mode
|
||||||
* <p/>
|
* <p/>
|
||||||
* The result of the user's action is returned in onActivityResult intent,
|
* The result of the user's action is returned in onActivityResult intent,
|
||||||
* access it using getUri.
|
* access it using getUri.
|
||||||
|
|
@ -66,19 +57,26 @@ public abstract class AbstractFilePickerActivity<T> extends AppCompatActivity
|
||||||
public static final String EXTRA_MODE = "nononsense.intent.MODE";
|
public static final String EXTRA_MODE = "nononsense.intent.MODE";
|
||||||
public static final String EXTRA_ALLOW_CREATE_DIR =
|
public static final String EXTRA_ALLOW_CREATE_DIR =
|
||||||
"nononsense.intent" + ".ALLOW_CREATE_DIR";
|
"nononsense.intent" + ".ALLOW_CREATE_DIR";
|
||||||
|
public static final String EXTRA_SINGLE_CLICK =
|
||||||
|
"nononsense.intent" + ".SINGLE_CLICK";
|
||||||
// For compatibility
|
// For compatibility
|
||||||
public static final String EXTRA_ALLOW_MULTIPLE =
|
public static final String EXTRA_ALLOW_MULTIPLE =
|
||||||
"android.intent.extra" + ".ALLOW_MULTIPLE";
|
"android.intent.extra" + ".ALLOW_MULTIPLE";
|
||||||
|
public static final String EXTRA_ALLOW_EXISTING_FILE =
|
||||||
|
"android.intent.extra" + ".ALLOW_EXISTING_FILE";
|
||||||
public static final String EXTRA_PATHS = "nononsense.intent.PATHS";
|
public static final String EXTRA_PATHS = "nononsense.intent.PATHS";
|
||||||
public static final int MODE_FILE = AbstractFilePickerFragment.MODE_FILE;
|
public static final int MODE_FILE = AbstractFilePickerFragment.MODE_FILE;
|
||||||
public static final int MODE_FILE_AND_DIR =
|
public static final int MODE_FILE_AND_DIR =
|
||||||
AbstractFilePickerFragment.MODE_FILE_AND_DIR;
|
AbstractFilePickerFragment.MODE_FILE_AND_DIR;
|
||||||
|
public static final int MODE_NEW_FILE = AbstractFilePickerFragment.MODE_NEW_FILE;
|
||||||
public static final int MODE_DIR = AbstractFilePickerFragment.MODE_DIR;
|
public static final int MODE_DIR = AbstractFilePickerFragment.MODE_DIR;
|
||||||
protected static final String TAG = "filepicker_fragment";
|
protected static final String TAG = "filepicker_fragment";
|
||||||
protected String startPath = null;
|
protected String startPath = null;
|
||||||
protected int mode = AbstractFilePickerFragment.MODE_FILE;
|
protected int mode = AbstractFilePickerFragment.MODE_FILE;
|
||||||
protected boolean allowCreateDir = false;
|
protected boolean allowCreateDir = false;
|
||||||
protected boolean allowMultiple = false;
|
protected boolean allowMultiple = false;
|
||||||
|
private boolean allowExistingFile = true;
|
||||||
|
protected boolean singleClick = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
@ -95,6 +93,10 @@ public abstract class AbstractFilePickerActivity<T> extends AppCompatActivity
|
||||||
allowCreateDir);
|
allowCreateDir);
|
||||||
allowMultiple =
|
allowMultiple =
|
||||||
intent.getBooleanExtra(EXTRA_ALLOW_MULTIPLE, allowMultiple);
|
intent.getBooleanExtra(EXTRA_ALLOW_MULTIPLE, allowMultiple);
|
||||||
|
allowExistingFile =
|
||||||
|
intent.getBooleanExtra(EXTRA_ALLOW_EXISTING_FILE, allowExistingFile);
|
||||||
|
singleClick =
|
||||||
|
intent.getBooleanExtra(EXTRA_SINGLE_CLICK, singleClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
FragmentManager fm = getSupportFragmentManager();
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
|
|
@ -103,7 +105,8 @@ public abstract class AbstractFilePickerActivity<T> extends AppCompatActivity
|
||||||
|
|
||||||
if (fragment == null) {
|
if (fragment == null) {
|
||||||
fragment =
|
fragment =
|
||||||
getFragment(startPath, mode, allowMultiple, allowCreateDir);
|
getFragment(startPath, mode, allowMultiple, allowCreateDir, allowExistingFile,
|
||||||
|
singleClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
|
|
@ -116,8 +119,9 @@ public abstract class AbstractFilePickerActivity<T> extends AppCompatActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract AbstractFilePickerFragment<T> getFragment(
|
protected abstract AbstractFilePickerFragment<T> getFragment(
|
||||||
final String startPath, final int mode, final boolean allowMultiple,
|
@Nullable final String startPath, final int mode, final boolean allowMultiple,
|
||||||
final boolean allowCreateDir);
|
final boolean allowCreateDir, final boolean allowExistingFile,
|
||||||
|
final boolean singleClick);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle b) {
|
public void onSaveInstanceState(Bundle b) {
|
||||||
|
|
@ -125,7 +129,7 @@ public abstract class AbstractFilePickerActivity<T> extends AppCompatActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFilePicked(final Uri file) {
|
public void onFilePicked(@NonNull final Uri file) {
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
i.setData(file);
|
i.setData(file);
|
||||||
setResult(Activity.RESULT_OK, i);
|
setResult(Activity.RESULT_OK, i);
|
||||||
|
|
@ -134,7 +138,7 @@ public abstract class AbstractFilePickerActivity<T> extends AppCompatActivity
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||||
@Override
|
@Override
|
||||||
public void onFilesPicked(final List<Uri> files) {
|
public void onFilesPicked(@NonNull final List<Uri> files) {
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
i.putExtra(EXTRA_ALLOW_MULTIPLE, true);
|
i.putExtra(EXTRA_ALLOW_MULTIPLE, true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,31 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Jonas Kalderstam
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
*
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.nononsenseapps.filepicker;
|
package com.nononsenseapps.filepicker;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.annotation.StyleRes;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.util.SortedList;
|
import android.support.v7.util.SortedList;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
|
@ -36,6 +33,7 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
@ -43,6 +41,8 @@ import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.nononsenseapps.filepicker.Utils.appendPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A fragment representing a list of Files.
|
* A fragment representing a list of Files.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
|
@ -51,7 +51,7 @@ import java.util.List;
|
||||||
* OnFilePickedListener}
|
* OnFilePickedListener}
|
||||||
* interface.
|
* interface.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractFilePickerFragment<T> extends Fragment
|
public abstract class AbstractFilePickerFragment<T> extends DialogFragment
|
||||||
implements LoaderManager.LoaderCallbacks<SortedList<T>>,
|
implements LoaderManager.LoaderCallbacks<SortedList<T>>,
|
||||||
NewItemFragment.OnNewFolderListener, LogicHandler<T> {
|
NewItemFragment.OnNewFolderListener, LogicHandler<T> {
|
||||||
|
|
||||||
|
|
@ -60,6 +60,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
public static final int MODE_FILE = 0;
|
public static final int MODE_FILE = 0;
|
||||||
public static final int MODE_DIR = 1;
|
public static final int MODE_DIR = 1;
|
||||||
public static final int MODE_FILE_AND_DIR = 2;
|
public static final int MODE_FILE_AND_DIR = 2;
|
||||||
|
public static final int MODE_NEW_FILE = 3;
|
||||||
// Where to display on open.
|
// Where to display on open.
|
||||||
public static final String KEY_START_PATH = "KEY_START_PATH";
|
public static final String KEY_START_PATH = "KEY_START_PATH";
|
||||||
// See MODE_XXX constants above for possible values
|
// See MODE_XXX constants above for possible values
|
||||||
|
|
@ -68,19 +69,32 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
public static final String KEY_ALLOW_DIR_CREATE = "KEY_ALLOW_DIR_CREATE";
|
public static final String KEY_ALLOW_DIR_CREATE = "KEY_ALLOW_DIR_CREATE";
|
||||||
// Allow multiple items to be selected.
|
// Allow multiple items to be selected.
|
||||||
public static final String KEY_ALLOW_MULTIPLE = "KEY_ALLOW_MULTIPLE";
|
public static final String KEY_ALLOW_MULTIPLE = "KEY_ALLOW_MULTIPLE";
|
||||||
|
// Allow an existing file to be selected under MODE_NEW_FILE
|
||||||
|
public static final String KEY_ALLOW_EXISTING_FILE = "KEY_ALLOW_EXISTING_FILE";
|
||||||
|
// If file can be selected by clicking only and checkboxes are not visible
|
||||||
|
public static final String KEY_SINGLE_CLICK = "KEY_SINGLE_CLICK";
|
||||||
// Used for saving state.
|
// Used for saving state.
|
||||||
protected static final String KEY_CURRENT_PATH = "KEY_CURRENT PATH";
|
protected static final String KEY_CURRENT_PATH = "KEY_CURRENT_PATH";
|
||||||
protected final HashSet<T> mCheckedItems;
|
protected final HashSet<T> mCheckedItems;
|
||||||
protected final HashSet<CheckableViewHolder> mCheckedVisibleViewHolders;
|
protected final HashSet<CheckableViewHolder> mCheckedVisibleViewHolders;
|
||||||
protected int mode = MODE_FILE;
|
protected int mode = MODE_FILE;
|
||||||
protected T mCurrentPath = null;
|
protected T mCurrentPath = null;
|
||||||
protected boolean allowCreateDir = false;
|
protected boolean allowCreateDir = false;
|
||||||
protected boolean allowMultiple = false;
|
protected boolean allowMultiple = false;
|
||||||
|
protected boolean allowExistingFile = true;
|
||||||
|
protected boolean singleClick = false;
|
||||||
protected OnFilePickedListener mListener;
|
protected OnFilePickedListener mListener;
|
||||||
protected FileItemAdapter<T> mAdapter = null;
|
protected FileItemAdapter<T> mAdapter = null;
|
||||||
protected TextView mCurrentDirView;
|
protected TextView mCurrentDirView;
|
||||||
|
protected EditText mEditTextFileName;
|
||||||
|
protected RecyclerView recyclerView;
|
||||||
|
protected LinearLayoutManager layoutManager;
|
||||||
protected SortedList<T> mFiles = null;
|
protected SortedList<T> mFiles = null;
|
||||||
protected Toast mToast = null;
|
protected Toast mToast = null;
|
||||||
|
// Keep track if we are currently loading a directory, in case it takes a long time
|
||||||
|
protected boolean isLoading = false;
|
||||||
|
protected View mNewFileButtonContainer = null;
|
||||||
|
protected View mRegularButtonContainer = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mandatory empty constructor for the fragment manager to instantiate the
|
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||||
|
|
@ -103,102 +117,74 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
return new FileItemAdapter<>(this);
|
return new FileItemAdapter<>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set before making the fragment visible. This method will re-use the existing
|
|
||||||
* arguments bundle in the fragment if it exists so extra arguments will not
|
|
||||||
* be overwritten. This allows you to set any extra arguments in the fragment
|
|
||||||
* constructor if you wish.
|
|
||||||
*
|
|
||||||
* The key/value-pairs listed below will be overwritten however.
|
|
||||||
*
|
|
||||||
* @param startPath path to directory the picker will show upon start
|
|
||||||
* @param mode what is allowed to be selected (dirs, files, both)
|
|
||||||
* @param allowMultiple selecting a single item or several?
|
|
||||||
* @param allowDirCreate can new directories be created?
|
|
||||||
*/
|
|
||||||
public void setArgs(final String startPath, final int mode,
|
|
||||||
final boolean allowMultiple, final boolean allowDirCreate) {
|
|
||||||
// There might have been arguments set elsewhere, if so do not overwrite them.
|
|
||||||
Bundle b = getArguments();
|
|
||||||
if (b == null) {
|
|
||||||
b = new Bundle();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startPath != null) {
|
|
||||||
b.putString(KEY_START_PATH, startPath);
|
|
||||||
}
|
|
||||||
b.putBoolean(KEY_ALLOW_DIR_CREATE, allowDirCreate);
|
|
||||||
b.putBoolean(KEY_ALLOW_MULTIPLE, allowMultiple);
|
|
||||||
b.putInt(KEY_MODE, mode);
|
|
||||||
setArguments(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.nnf_fragment_filepicker, container, false);
|
getContext().getTheme().applyStyle(getStyleId(), true);
|
||||||
|
final View view = inflater.inflate(R.layout.nnf_fragment_filepicker, container, false);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.nnf_picker_toolbar);
|
Toolbar toolbar = (Toolbar) view.findViewById(R.id.nnf_picker_toolbar);
|
||||||
if (toolbar != null) {
|
if (toolbar != null) {
|
||||||
setupToolbar(toolbar);
|
setupToolbar(toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
RecyclerView mRecyclerView = (RecyclerView) view.findViewById(android.R.id.list);
|
recyclerView = (RecyclerView) view.findViewById(android.R.id.list);
|
||||||
// improve performance if you know that changes in content
|
// improve performance if you know that changes in content
|
||||||
// do not change the size of the RecyclerView
|
// do not change the size of the RecyclerView
|
||||||
mRecyclerView.setHasFixedSize(true);
|
recyclerView.setHasFixedSize(true);
|
||||||
// use a linear layout manager
|
// use a linear layout manager
|
||||||
LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
|
layoutManager = new LinearLayoutManager(getActivity());
|
||||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
recyclerView.setLayoutManager(layoutManager);
|
||||||
|
// Set Item Decoration if exists
|
||||||
|
configureItemDecoration(inflater, recyclerView);
|
||||||
// Set adapter
|
// Set adapter
|
||||||
mAdapter = new FileItemAdapter<>(this);
|
mAdapter = new FileItemAdapter<>(this);
|
||||||
mRecyclerView.setAdapter(mAdapter);
|
recyclerView.setAdapter(mAdapter);
|
||||||
|
|
||||||
view.findViewById(R.id.nnf_button_cancel)
|
view.findViewById(R.id.nnf_button_cancel)
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View v) {
|
public void onClick(final View v) {
|
||||||
if (mListener != null) {
|
onClickCancel(v);
|
||||||
mListener.onCancelled();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
view.findViewById(R.id.nnf_button_ok)
|
view.findViewById(R.id.nnf_button_ok).setOnClickListener(new View.OnClickListener() {
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
|
public void onClick(final View v) {
|
||||||
|
onClickOk(v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
view.findViewById(R.id.nnf_button_ok_newfile).setOnClickListener(
|
||||||
|
new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View v) {
|
public void onClick(View v) {
|
||||||
if (mListener == null) {
|
onClickOk(v);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some invalid cases first
|
|
||||||
if ((allowMultiple || mode == MODE_FILE) && mCheckedItems.isEmpty()) {
|
|
||||||
if (mToast == null) {
|
|
||||||
mToast = Toast.makeText(getActivity(), R.string.nnf_select_something_first,
|
|
||||||
Toast.LENGTH_SHORT);
|
|
||||||
}
|
|
||||||
mToast.show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allowMultiple) {
|
|
||||||
mListener.onFilesPicked(toUri(mCheckedItems));
|
|
||||||
} else if (mode == MODE_FILE) {
|
|
||||||
mListener.onFilePicked(toUri(getFirstCheckedItem()));
|
|
||||||
} else if (mode == MODE_DIR) {
|
|
||||||
mListener.onFilePicked(toUri(mCurrentPath));
|
|
||||||
} else {
|
|
||||||
// single FILE OR DIR
|
|
||||||
if (mCheckedItems.isEmpty()) {
|
|
||||||
mListener.onFilePicked(toUri(mCurrentPath));
|
|
||||||
} else {
|
|
||||||
mListener.onFilePicked(toUri(getFirstCheckedItem()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mNewFileButtonContainer = view.findViewById(R.id.nnf_newfile_button_container);
|
||||||
|
mRegularButtonContainer = view.findViewById(R.id.nnf_button_container);
|
||||||
|
|
||||||
|
mEditTextFileName = (EditText) view.findViewById(R.id.nnf_text_filename);
|
||||||
|
mEditTextFileName.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
// deSelect anything selected since the user just modified the name
|
||||||
|
clearSelections();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mCurrentDirView = (TextView) view.findViewById(R.id.nnf_current_dir);
|
mCurrentDirView = (TextView) view.findViewById(R.id.nnf_current_dir);
|
||||||
// Restore state
|
// Restore state
|
||||||
if (mCurrentPath != null && mCurrentDirView != null) {
|
if (mCurrentPath != null && mCurrentDirView != null) {
|
||||||
|
|
@ -208,6 +194,99 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a divider drawable has been defined in the current theme. If it has, will apply
|
||||||
|
* an item decoration with the divider. If no divider has been specified, then does nothing.
|
||||||
|
*/
|
||||||
|
protected void configureItemDecoration(@NonNull LayoutInflater inflater,
|
||||||
|
@NonNull RecyclerView recyclerView) {
|
||||||
|
final TypedArray attributes =
|
||||||
|
getActivity().obtainStyledAttributes(new int[]{R.attr.nnf_list_item_divider});
|
||||||
|
Drawable divider = attributes.getDrawable(0);
|
||||||
|
attributes.recycle();
|
||||||
|
|
||||||
|
if (divider != null) {
|
||||||
|
recyclerView.addItemDecoration(new DividerItemDecoration(divider));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the cancel-button is pressed.
|
||||||
|
*
|
||||||
|
* @param view which was clicked. Not used in default implementation.
|
||||||
|
*/
|
||||||
|
public void onClickCancel(@NonNull View view) {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onCancelled();
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the ok-button is pressed.
|
||||||
|
*
|
||||||
|
* @param view which was clicked. Not used in default implementation.
|
||||||
|
*/
|
||||||
|
public void onClickOk(@NonNull View view) {
|
||||||
|
if (mListener == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some invalid cases first
|
||||||
|
/*if (MODE_NEW_FILE == mode && !isValidFileName(getNewFileName())) {
|
||||||
|
mToast = Toast.makeText(getActivity(), R.string.nnf_need_valid_filename,
|
||||||
|
Toast.LENGTH_SHORT);
|
||||||
|
mToast.show();
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
if ((allowMultiple || mode == MODE_FILE) &&
|
||||||
|
(mCheckedItems.isEmpty() || getFirstCheckedItem() == null)) {
|
||||||
|
if (mToast == null) {
|
||||||
|
mToast = Toast.makeText(getActivity(), R.string.nnf_select_something_first,
|
||||||
|
Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
|
mToast.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// New file allows only a single file
|
||||||
|
if (mode == MODE_NEW_FILE) {
|
||||||
|
final String filename = getNewFileName();
|
||||||
|
final Uri result;
|
||||||
|
if (filename.startsWith("/")) {
|
||||||
|
// Return absolute paths directly
|
||||||
|
result = toUri(getPath(filename));
|
||||||
|
} else {
|
||||||
|
// Append to current directory
|
||||||
|
result = toUri(getPath(appendPath(getFullPath(mCurrentPath), filename)));
|
||||||
|
}
|
||||||
|
mListener.onFilePicked(result);
|
||||||
|
} else if (allowMultiple) {
|
||||||
|
mListener.onFilesPicked(toUri(mCheckedItems));
|
||||||
|
} else if (mode == MODE_FILE) {
|
||||||
|
//noinspection ConstantConditions
|
||||||
|
mListener.onFilePicked(toUri(getFirstCheckedItem()));
|
||||||
|
} else if (mode == MODE_DIR) {
|
||||||
|
mListener.onFilePicked(toUri(mCurrentPath));
|
||||||
|
} else {
|
||||||
|
// single FILE OR DIR
|
||||||
|
if (mCheckedItems.isEmpty()) {
|
||||||
|
mListener.onFilePicked(toUri(mCurrentPath));
|
||||||
|
} else {
|
||||||
|
mListener.onFilePicked(toUri(getFirstCheckedItem()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return filename as entered/picked by the user for the new file
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
protected String getNewFileName() {
|
||||||
|
return mEditTextFileName.getText().toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the toolbar anyway you like here. Default is to set it as the activity's
|
* Configure the toolbar anyway you like here. Default is to set it as the activity's
|
||||||
* main action bar. Override if you already provide an action bar.
|
* main action bar. Override if you already provide an action bar.
|
||||||
|
|
@ -215,11 +294,13 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
*
|
*
|
||||||
* @param toolbar from layout with id "picker_toolbar"
|
* @param toolbar from layout with id "picker_toolbar"
|
||||||
*/
|
*/
|
||||||
protected void setupToolbar(Toolbar toolbar) {
|
protected void setupToolbar(@NonNull Toolbar toolbar) {
|
||||||
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
|
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getFirstCheckedItem() {
|
public
|
||||||
|
@Nullable
|
||||||
|
T getFirstCheckedItem() {
|
||||||
//noinspection LoopStatementThatDoesntLoop
|
//noinspection LoopStatementThatDoesntLoop
|
||||||
for (T file : mCheckedItems) {
|
for (T file : mCheckedItems) {
|
||||||
return file;
|
return file;
|
||||||
|
|
@ -227,7 +308,9 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<Uri> toUri(Iterable<T> files) {
|
protected
|
||||||
|
@NonNull
|
||||||
|
List<Uri> toUri(@NonNull Iterable<T> files) {
|
||||||
ArrayList<Uri> uris = new ArrayList<>();
|
ArrayList<Uri> uris = new ArrayList<>();
|
||||||
for (T file : files) {
|
for (T file : files) {
|
||||||
uris.add(toUri(file));
|
uris.add(toUri(file));
|
||||||
|
|
@ -235,14 +318,14 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
return uris;
|
return uris;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCheckable(final T data) {
|
public boolean isCheckable(@NonNull final T data) {
|
||||||
final boolean checkable;
|
final boolean checkable;
|
||||||
if (isDir(data)) {
|
if (isDir(data)) {
|
||||||
checkable = ((mode == MODE_DIR && allowMultiple) ||
|
checkable = ((mode == MODE_DIR && allowMultiple) ||
|
||||||
(mode == MODE_FILE_AND_DIR && allowMultiple));
|
(mode == MODE_FILE_AND_DIR && allowMultiple));
|
||||||
} else {
|
} else {
|
||||||
// File
|
// File
|
||||||
checkable = (mode != MODE_DIR);
|
checkable = (mode == MODE_FILE || mode == MODE_FILE_AND_DIR || allowExistingFile);
|
||||||
}
|
}
|
||||||
return checkable;
|
return checkable;
|
||||||
}
|
}
|
||||||
|
|
@ -258,10 +341,15 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
mListener = null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -276,11 +364,12 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
* and before {@link #onViewStateRestored(Bundle)}.
|
* and before {@link #onViewStateRestored(Bundle)}.
|
||||||
*
|
*
|
||||||
* @param savedInstanceState If the fragment is being re-created from
|
* @param savedInstanceState If the fragment is being re-created from
|
||||||
* a previous saved state, this is the state.
|
* a previous saved state, this is the state.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
// Only if we have no state
|
// Only if we have no state
|
||||||
if (mCurrentPath == null) {
|
if (mCurrentPath == null) {
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
|
|
@ -289,27 +378,62 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
.getBoolean(KEY_ALLOW_DIR_CREATE, allowCreateDir);
|
.getBoolean(KEY_ALLOW_DIR_CREATE, allowCreateDir);
|
||||||
allowMultiple = savedInstanceState
|
allowMultiple = savedInstanceState
|
||||||
.getBoolean(KEY_ALLOW_MULTIPLE, allowMultiple);
|
.getBoolean(KEY_ALLOW_MULTIPLE, allowMultiple);
|
||||||
mCurrentPath =
|
allowExistingFile = savedInstanceState
|
||||||
getPath(savedInstanceState.getString(KEY_CURRENT_PATH));
|
.getBoolean(KEY_ALLOW_EXISTING_FILE, allowExistingFile);
|
||||||
|
singleClick = savedInstanceState
|
||||||
|
.getBoolean(KEY_SINGLE_CLICK, singleClick);
|
||||||
|
|
||||||
|
String path = savedInstanceState.getString(KEY_CURRENT_PATH);
|
||||||
|
if (path != null) {
|
||||||
|
mCurrentPath = getPath(path.trim());
|
||||||
|
}
|
||||||
} else if (getArguments() != null) {
|
} else if (getArguments() != null) {
|
||||||
mode = getArguments().getInt(KEY_MODE, mode);
|
mode = getArguments().getInt(KEY_MODE, mode);
|
||||||
allowCreateDir = getArguments()
|
allowCreateDir = getArguments()
|
||||||
.getBoolean(KEY_ALLOW_DIR_CREATE, allowCreateDir);
|
.getBoolean(KEY_ALLOW_DIR_CREATE, allowCreateDir);
|
||||||
allowMultiple = getArguments()
|
allowMultiple = getArguments()
|
||||||
.getBoolean(KEY_ALLOW_MULTIPLE, allowMultiple);
|
.getBoolean(KEY_ALLOW_MULTIPLE, allowMultiple);
|
||||||
|
allowExistingFile = getArguments()
|
||||||
|
.getBoolean(KEY_ALLOW_EXISTING_FILE, allowExistingFile);
|
||||||
|
singleClick = getArguments()
|
||||||
|
.getBoolean(KEY_SINGLE_CLICK, singleClick);
|
||||||
if (getArguments().containsKey(KEY_START_PATH)) {
|
if (getArguments().containsKey(KEY_START_PATH)) {
|
||||||
mCurrentPath =
|
String path = getArguments().getString(KEY_START_PATH);
|
||||||
getPath(getArguments().getString(KEY_START_PATH));
|
if (path != null) {
|
||||||
|
T file = getPath(path.trim());
|
||||||
|
if (isDir(file)) {
|
||||||
|
mCurrentPath = file;
|
||||||
|
} else {
|
||||||
|
mCurrentPath = getParent(file);
|
||||||
|
mEditTextFileName.setText(getName(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If still null
|
|
||||||
if (mCurrentPath == null) {
|
|
||||||
mCurrentPath = getRoot();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh();
|
setModeView(getView());
|
||||||
|
|
||||||
|
// If still null
|
||||||
|
if (mCurrentPath == null) {
|
||||||
|
mCurrentPath = getRoot();
|
||||||
|
}
|
||||||
|
refresh(mCurrentPath);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides/Shows appropriate views depending on mode
|
||||||
|
*/
|
||||||
|
protected void setModeView(@NonNull View view) {
|
||||||
|
boolean nf = mode == MODE_NEW_FILE;
|
||||||
|
mNewFileButtonContainer.setVisibility(nf ? View.VISIBLE : View.GONE);
|
||||||
|
mRegularButtonContainer.setVisibility(nf ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
|
if (!nf && singleClick) {
|
||||||
|
view.findViewById(R.id.nnf_button_ok).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -340,28 +464,28 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
super.onSaveInstanceState(b);
|
super.onSaveInstanceState(b);
|
||||||
b.putString(KEY_CURRENT_PATH, mCurrentPath.toString());
|
b.putString(KEY_CURRENT_PATH, mCurrentPath.toString());
|
||||||
b.putBoolean(KEY_ALLOW_MULTIPLE, allowMultiple);
|
b.putBoolean(KEY_ALLOW_MULTIPLE, allowMultiple);
|
||||||
|
b.putBoolean(KEY_ALLOW_EXISTING_FILE, allowExistingFile);
|
||||||
b.putBoolean(KEY_ALLOW_DIR_CREATE, allowCreateDir);
|
b.putBoolean(KEY_ALLOW_DIR_CREATE, allowCreateDir);
|
||||||
|
b.putBoolean(KEY_SINGLE_CLICK, singleClick);
|
||||||
b.putInt(KEY_MODE, mode);
|
b.putInt(KEY_MODE, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDetach() {
|
|
||||||
super.onDetach();
|
|
||||||
mListener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes the list. Call this when current path changes. This method also checks
|
* Refreshes the list. Call this when current path changes. This method also checks
|
||||||
* if permissions are granted and requests them if necessary. See hasPermission()
|
* if permissions are granted and requests them if necessary. See hasPermission()
|
||||||
* and handlePermission(). By default, these methods do nothing. Override them if
|
* and handlePermission(). By default, these methods do nothing. Override them if
|
||||||
* you need to request permissions at runtime.
|
* you need to request permissions at runtime.
|
||||||
|
*
|
||||||
|
* @param nextPath path to list files for
|
||||||
*/
|
*/
|
||||||
protected void refresh() {
|
protected void refresh(@NonNull T nextPath) {
|
||||||
if (hasPermission()) {
|
if (hasPermission(nextPath)) {
|
||||||
|
mCurrentPath = nextPath;
|
||||||
|
isLoading = true;
|
||||||
getLoaderManager()
|
getLoaderManager()
|
||||||
.restartLoader(0, null, AbstractFilePickerFragment.this);
|
.restartLoader(0, null, AbstractFilePickerFragment.this);
|
||||||
} else {
|
} else {
|
||||||
handlePermission();
|
handlePermission(nextPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,8 +493,10 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
* If permission has not been granted yet, this method should request it.
|
* If permission has not been granted yet, this method should request it.
|
||||||
* <p/>
|
* <p/>
|
||||||
* Override only if you need to request a permission.
|
* Override only if you need to request a permission.
|
||||||
|
*
|
||||||
|
* @param path The path for which permission should be requested
|
||||||
*/
|
*/
|
||||||
protected void handlePermission() {
|
protected void handlePermission(@NonNull T path) {
|
||||||
// Nothing to do by default
|
// Nothing to do by default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -378,9 +504,10 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
* If your implementation needs to request a specific permission to function, check if it
|
* If your implementation needs to request a specific permission to function, check if it
|
||||||
* has been granted here. You should probably also override handlePermission() to request it.
|
* has been granted here. You should probably also override handlePermission() to request it.
|
||||||
*
|
*
|
||||||
|
* @param path the path for which permissions should be checked
|
||||||
* @return true if permission has been granted, false otherwise.
|
* @return true if permission has been granted, false otherwise.
|
||||||
*/
|
*/
|
||||||
protected boolean hasPermission() {
|
protected boolean hasPermission(@NonNull T path) {
|
||||||
// Nothing to request by default
|
// Nothing to request by default
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -406,6 +533,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
@Override
|
@Override
|
||||||
public void onLoadFinished(final Loader<SortedList<T>> loader,
|
public void onLoadFinished(final Loader<SortedList<T>> loader,
|
||||||
final SortedList<T> data) {
|
final SortedList<T> data) {
|
||||||
|
isLoading = false;
|
||||||
mCheckedItems.clear();
|
mCheckedItems.clear();
|
||||||
mCheckedVisibleViewHolders.clear();
|
mCheckedVisibleViewHolders.clear();
|
||||||
mFiles = data;
|
mFiles = data;
|
||||||
|
|
@ -424,17 +552,18 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onLoaderReset(final Loader<SortedList<T>> loader) {
|
public void onLoaderReset(final Loader<SortedList<T>> loader) {
|
||||||
|
isLoading = false;
|
||||||
mAdapter.setList(null);
|
mAdapter.setList(null);
|
||||||
mFiles = null;
|
mFiles = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param position 0 - n, where the header has been subtracted
|
* @param position 0 - n, where the header has been subtracted
|
||||||
* @param data the actual file or directory
|
* @param data the actual file or directory
|
||||||
* @return an integer greater than 0
|
* @return an integer greater than 0
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getItemViewType(int position, T data) {
|
public int getItemViewType(int position, @NonNull T data) {
|
||||||
if (isCheckable(data)) {
|
if (isCheckable(data)) {
|
||||||
return LogicHandler.VIEWTYPE_CHECKABLE;
|
return LogicHandler.VIEWTYPE_CHECKABLE;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -443,7 +572,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindHeaderViewHolder(HeaderViewHolder viewHolder) {
|
public void onBindHeaderViewHolder(@NonNull HeaderViewHolder viewHolder) {
|
||||||
viewHolder.text.setText("..");
|
viewHolder.text.setText("..");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -452,9 +581,11 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
* @param viewType which the ViewHolder will contain
|
* @param viewType which the ViewHolder will contain
|
||||||
* @return a view holder for a file or directory
|
* @return a view holder for a file or directory
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View v;
|
View v;
|
||||||
|
getContext().getTheme().applyStyle(getStyleId(), true);
|
||||||
switch (viewType) {
|
switch (viewType) {
|
||||||
case LogicHandler.VIEWTYPE_HEADER:
|
case LogicHandler.VIEWTYPE_HEADER:
|
||||||
v = LayoutInflater.from(getActivity()).inflate(R.layout.nnf_filepicker_listitem_dir,
|
v = LayoutInflater.from(getActivity()).inflate(R.layout.nnf_filepicker_listitem_dir,
|
||||||
|
|
@ -472,13 +603,16 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@StyleRes
|
||||||
|
protected abstract int getStyleId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param vh to bind data from either a file or directory
|
* @param vh to bind data from either a file or directory
|
||||||
* @param position 0 - n, where the header has been subtracted
|
* @param position 0 - n, where the header has been subtracted
|
||||||
* @param data the file or directory which this item represents
|
* @param data the file or directory which this item represents
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(DirViewHolder vh, int position, T data) {
|
public void onBindViewHolder(@NonNull DirViewHolder vh, int position, @NonNull T data) {
|
||||||
vh.file = data;
|
vh.file = data;
|
||||||
vh.icon.setVisibility(isDir(data) ? View.VISIBLE : View.GONE);
|
vh.icon.setVisibility(isDir(data) ? View.VISIBLE : View.GONE);
|
||||||
vh.text.setText(getName(data));
|
vh.text.setText(getName(data));
|
||||||
|
|
@ -507,6 +641,140 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
mCheckedItems.clear();
|
mCheckedItems.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a header item ("..") is clicked.
|
||||||
|
*
|
||||||
|
* @param view that was clicked. Not used in default implementation.
|
||||||
|
* @param viewHolder for the clicked view
|
||||||
|
*/
|
||||||
|
public void onClickHeader(@NonNull View view, @NonNull HeaderViewHolder viewHolder) {
|
||||||
|
goUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Browses to the parent directory from the current directory. For example, if the current
|
||||||
|
* directory is /foo/bar/, then goUp() will change the current directory to /foo/. It is up to
|
||||||
|
* the caller to not call this in vain, e.g. if you are already at the root.
|
||||||
|
* <p/>
|
||||||
|
* Currently selected items are cleared by this operation.
|
||||||
|
*/
|
||||||
|
public void goUp() {
|
||||||
|
goToDir(getParent(mCurrentPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a non-selectable item, typically a directory, is clicked.
|
||||||
|
*
|
||||||
|
* @param view that was clicked. Not used in default implementation.
|
||||||
|
* @param viewHolder for the clicked view
|
||||||
|
*/
|
||||||
|
public void onClickDir(@NonNull View view, @NonNull DirViewHolder viewHolder) {
|
||||||
|
if (isDir(viewHolder.file)) {
|
||||||
|
goToDir(viewHolder.file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cab be used by the list to determine whether a file should be displayed or not.
|
||||||
|
* Default behavior is to always display folders. If files can be selected,
|
||||||
|
* then files are also displayed. In case a new file is supposed to be selected,
|
||||||
|
* the {@link #allowExistingFile} determines if existing files are visible
|
||||||
|
*
|
||||||
|
* @param file either a directory or file.
|
||||||
|
* @return True if item should be visible in the picker, false otherwise
|
||||||
|
*/
|
||||||
|
protected boolean isItemVisible(final T file) {
|
||||||
|
return (isDir(file) ||
|
||||||
|
(mode == MODE_FILE || mode == MODE_FILE_AND_DIR) ||
|
||||||
|
(mode == MODE_NEW_FILE && allowExistingFile));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Browses to the designated directory. It is up to the caller verify that the argument is
|
||||||
|
* in fact a directory. If another directory is in the process of being loaded, this method
|
||||||
|
* will not start another load.
|
||||||
|
* <p/>
|
||||||
|
* Currently selected items are cleared by this operation.
|
||||||
|
*
|
||||||
|
* @param file representing the target directory.
|
||||||
|
*/
|
||||||
|
public void goToDir(@NonNull T file) {
|
||||||
|
if (!isLoading) {
|
||||||
|
mCheckedItems.clear();
|
||||||
|
mCheckedVisibleViewHolders.clear();
|
||||||
|
refresh(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Long clicking a non-selectable item does nothing by default.
|
||||||
|
*
|
||||||
|
* @param view which was long clicked. Not used in default implementation.
|
||||||
|
* @param viewHolder for the clicked view
|
||||||
|
* @return true if the callback consumed the long click, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean onLongClickDir(@NonNull View view, @NonNull DirViewHolder viewHolder) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a selectable item is clicked. This might be either a file or a directory.
|
||||||
|
*
|
||||||
|
* @param view that was clicked. Not used in default implementation.
|
||||||
|
* @param viewHolder for the clicked view
|
||||||
|
*/
|
||||||
|
public void onClickCheckable(@NonNull View view, @NonNull CheckableViewHolder viewHolder) {
|
||||||
|
if (isDir(viewHolder.file)) {
|
||||||
|
goToDir(viewHolder.file);
|
||||||
|
} else {
|
||||||
|
onLongClickCheckable(view, viewHolder);
|
||||||
|
if (singleClick) {
|
||||||
|
onClickOk(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Long clicking a selectable item should toggle its selected state. Note that if only a
|
||||||
|
* single item can be selected, then other potentially selected views on screen must be
|
||||||
|
* de-selected.
|
||||||
|
*
|
||||||
|
* @param view which was long clicked. Not used in default implementation.
|
||||||
|
* @param viewHolder for the clicked view
|
||||||
|
* @return true if the callback consumed the long click, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean onLongClickCheckable(@NonNull View view,
|
||||||
|
@NonNull CheckableViewHolder viewHolder) {
|
||||||
|
if (MODE_NEW_FILE == mode) {
|
||||||
|
mEditTextFileName.setText(getName(viewHolder.file));
|
||||||
|
}
|
||||||
|
onClickCheckBox(viewHolder);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a selectable item's checkbox is pressed. This should toggle its selected state.
|
||||||
|
* Note that if only a single item can be selected, then other potentially selected views on
|
||||||
|
* screen must be de-selected. The text box for new filename is also cleared.
|
||||||
|
*
|
||||||
|
* @param viewHolder for the item containing the checkbox.
|
||||||
|
*/
|
||||||
|
public void onClickCheckBox(@NonNull CheckableViewHolder viewHolder) {
|
||||||
|
if (mCheckedItems.contains(viewHolder.file)) {
|
||||||
|
viewHolder.checkbox.setChecked(false);
|
||||||
|
mCheckedItems.remove(viewHolder.file);
|
||||||
|
mCheckedVisibleViewHolders.remove(viewHolder);
|
||||||
|
} else {
|
||||||
|
if (!allowMultiple) {
|
||||||
|
clearSelections();
|
||||||
|
}
|
||||||
|
viewHolder.checkbox.setChecked(true);
|
||||||
|
mCheckedItems.add(viewHolder.file);
|
||||||
|
mCheckedVisibleViewHolders.add(viewHolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface must be implemented by activities that contain this
|
* This interface must be implemented by activities that contain this
|
||||||
* fragment to allow an interaction in this fragment to be communicated
|
* fragment to allow an interaction in this fragment to be communicated
|
||||||
|
|
@ -519,9 +787,9 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
* >Communicating with Other Fragments</a> for more information.
|
* >Communicating with Other Fragments</a> for more information.
|
||||||
*/
|
*/
|
||||||
public interface OnFilePickedListener {
|
public interface OnFilePickedListener {
|
||||||
void onFilePicked(Uri file);
|
void onFilePicked(@NonNull Uri file);
|
||||||
|
|
||||||
void onFilesPicked(List<Uri> files);
|
void onFilesPicked(@NonNull List<Uri> files);
|
||||||
|
|
||||||
void onCancelled();
|
void onCancelled();
|
||||||
}
|
}
|
||||||
|
|
@ -542,14 +810,12 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
mCurrentPath = getParent(mCurrentPath);
|
onClickHeader(v, this);
|
||||||
mCheckedItems.clear();
|
|
||||||
mCheckedVisibleViewHolders.clear();
|
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DirViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
public class DirViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,
|
||||||
|
View.OnLongClickListener {
|
||||||
|
|
||||||
public View icon;
|
public View icon;
|
||||||
public TextView text;
|
public TextView text;
|
||||||
|
|
@ -561,6 +827,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
v.setOnLongClickListener(this);
|
v.setOnLongClickListener(this);
|
||||||
icon = v.findViewById(R.id.item_icon);
|
icon = v.findViewById(R.id.item_icon);
|
||||||
text = (TextView) v.findViewById(android.R.id.text1);
|
text = (TextView) v.findViewById(android.R.id.text1);
|
||||||
|
text.setTextColor(ContextCompat.getColor(getActivity(), android.R.color.white));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -570,12 +837,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (isDir(file)) {
|
onClickDir(v, this);
|
||||||
mCurrentPath = file;
|
|
||||||
mCheckedItems.clear();
|
|
||||||
mCheckedVisibleViewHolders.clear();
|
|
||||||
refresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -586,7 +848,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
return false;
|
return onLongClickDir(v, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -596,11 +858,14 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
|
|
||||||
public CheckableViewHolder(View v) {
|
public CheckableViewHolder(View v) {
|
||||||
super(v);
|
super(v);
|
||||||
|
boolean nf = mode == MODE_NEW_FILE;
|
||||||
|
|
||||||
checkbox = (CheckBox) v.findViewById(R.id.checkbox);
|
checkbox = (CheckBox) v.findViewById(R.id.checkbox);
|
||||||
|
checkbox.setVisibility((nf || singleClick) ? View.GONE : View.VISIBLE);
|
||||||
checkbox.setOnClickListener(new View.OnClickListener() {
|
checkbox.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
onLongClick(v);
|
onClickCheckBox(CheckableViewHolder.this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -612,14 +877,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (isDir(file)) {
|
onClickCheckable(v, this);
|
||||||
mCurrentPath = file;
|
|
||||||
mCheckedItems.clear();
|
|
||||||
mCheckedVisibleViewHolders.clear();
|
|
||||||
refresh();
|
|
||||||
} else {
|
|
||||||
onLongClick(v);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -630,19 +888,7 @@ public abstract class AbstractFilePickerFragment<T> extends Fragment
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
if (mCheckedItems.contains(file)) {
|
return onLongClickCheckable(v, this);
|
||||||
checkbox.setChecked(false);
|
|
||||||
mCheckedItems.remove(file);
|
|
||||||
mCheckedVisibleViewHolders.remove(this);
|
|
||||||
} else {
|
|
||||||
if (!allowMultiple) {
|
|
||||||
clearSelections();
|
|
||||||
}
|
|
||||||
checkbox.setChecked(true);
|
|
||||||
mCheckedItems.add(file);
|
|
||||||
mCheckedVisibleViewHolders.add(this);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.nononsenseapps.filepicker;
|
||||||
|
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic ItemDecoration which loads a drawable as a divider.
|
||||||
|
*/
|
||||||
|
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
private Drawable mDivider;
|
||||||
|
|
||||||
|
public DividerItemDecoration(Drawable divider) {
|
||||||
|
mDivider = divider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||||
|
super.getItemOffsets(outRect, view, parent, state);
|
||||||
|
|
||||||
|
if (parent.getChildAdapterPosition(view) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
outRect.top = mDivider.getIntrinsicHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
|
||||||
|
int dividerLeft = parent.getPaddingLeft();
|
||||||
|
int dividerRight = parent.getWidth() - parent.getPaddingRight();
|
||||||
|
|
||||||
|
int childCount = parent.getChildCount();
|
||||||
|
for (int i = 0; i < childCount - 1; i++) {
|
||||||
|
View child = parent.getChildAt(i);
|
||||||
|
|
||||||
|
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||||
|
|
||||||
|
int dividerTop = child.getBottom() + params.bottomMargin;
|
||||||
|
int dividerBottom = dividerTop + mDivider.getIntrinsicHeight();
|
||||||
|
|
||||||
|
mDivider.setBounds(dividerLeft, dividerTop, dividerRight, dividerBottom);
|
||||||
|
mDivider.draw(canvas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,22 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Jonas Kalderstam
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
*
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.nononsenseapps.filepicker;
|
package com.nononsenseapps.filepicker;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v7.util.SortedList;
|
import android.support.v7.util.SortedList;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
@ -27,14 +18,14 @@ import android.view.ViewGroup;
|
||||||
*/
|
*/
|
||||||
public class FileItemAdapter<T> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class FileItemAdapter<T> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
private final LogicHandler<T> mLogic;
|
protected final LogicHandler<T> mLogic;
|
||||||
private SortedList<T> mList = null;
|
protected SortedList<T> mList = null;
|
||||||
|
|
||||||
public FileItemAdapter(LogicHandler<T> logic) {
|
public FileItemAdapter(@NonNull LogicHandler<T> logic) {
|
||||||
this.mLogic = logic;
|
this.mLogic = logic;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setList(SortedList<T> list) {
|
public void setList(@Nullable SortedList<T> list) {
|
||||||
mList = list;
|
mList = list;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
@ -74,4 +65,17 @@ public class FileItemAdapter<T> extends RecyclerView.Adapter<RecyclerView.ViewHo
|
||||||
// header + count
|
// header + count
|
||||||
return 1 + mList.size();
|
return 1 + mList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the item at the designated position in the adapter.
|
||||||
|
*
|
||||||
|
* @param position of item in adapter
|
||||||
|
* @return null if position is zero (that means it's the ".." header), the item otherwise.
|
||||||
|
*/
|
||||||
|
protected @Nullable T getItem(int position) {
|
||||||
|
if (position == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return mList.get(position - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2015 Jonas Kalderstam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.nononsenseapps.filepicker;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.os.Environment;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
@SuppressLint("Registered")
|
|
||||||
public class FilePickerActivity extends AbstractFilePickerActivity<File> {
|
|
||||||
|
|
||||||
public FilePickerActivity() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected AbstractFilePickerFragment<File> getFragment(
|
|
||||||
final String startPath, final int mode, final boolean allowMultiple,
|
|
||||||
final boolean allowCreateDir) {
|
|
||||||
AbstractFilePickerFragment<File> fragment = new FilePickerFragment();
|
|
||||||
// startPath is allowed to be null. In that case, default folder should be SD-card and not "/"
|
|
||||||
fragment.setArgs(startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
|
|
||||||
mode, allowMultiple, allowCreateDir);
|
|
||||||
return fragment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Jonas Kalderstam
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
*
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.nononsenseapps.filepicker;
|
package com.nononsenseapps.filepicker;
|
||||||
|
|
@ -30,23 +19,45 @@ import android.support.v7.widget.util.SortedListAdapterCallback;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of the picker which allows you to select a file from the internal/external
|
* An implementation of the picker which allows you to select a file from the internal/external
|
||||||
* storage (SD-card) on a device.
|
* storage (SD-card) on a device.
|
||||||
*/
|
*/
|
||||||
public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
public abstract class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
|
|
||||||
|
private static final String[] extensions = new String[]{".doc", ".docx", ".xlsx", ".xls", ".png", ".jpg",
|
||||||
|
".tif", ".tiff", ".pdf", ".jpeg", ".ppt", ".pptx"};
|
||||||
|
|
||||||
protected static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 1;
|
protected static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 1;
|
||||||
|
protected boolean showHiddenItems = false;
|
||||||
|
private File mRequestedPath = null;
|
||||||
|
|
||||||
public FilePickerFragment() {
|
/**
|
||||||
|
* This method is used to dictate whether hidden files and folders should be shown or not
|
||||||
|
*
|
||||||
|
* @param showHiddenItems whether hidden items should be shown or not
|
||||||
|
*/
|
||||||
|
public void showHiddenItems(boolean showHiddenItems) {
|
||||||
|
this.showHiddenItems = showHiddenItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if hidden items are shown or not
|
||||||
|
*
|
||||||
|
* @return true if hidden items are shown, otherwise false
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean areHiddenItemsShown() {
|
||||||
|
return showHiddenItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if app has been granted permission to write to the SD-card.
|
* @return true if app has been granted permission to write to the SD-card.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasPermission() {
|
protected boolean hasPermission(@NonNull File path) {
|
||||||
return PackageManager.PERMISSION_GRANTED ==
|
return PackageManager.PERMISSION_GRANTED ==
|
||||||
ContextCompat.checkSelfPermission(getContext(),
|
ContextCompat.checkSelfPermission(getContext(),
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||||
|
|
@ -55,13 +66,15 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
/**
|
/**
|
||||||
* Request permission to write to the SD-card.
|
* Request permission to write to the SD-card.
|
||||||
*/
|
*/
|
||||||
protected void handlePermission() {
|
@Override
|
||||||
|
protected void handlePermission(@NonNull File path) {
|
||||||
// Should we show an explanation?
|
// Should we show an explanation?
|
||||||
// if (shouldShowRequestPermissionRationale(
|
// if (shouldShowRequestPermissionRationale(
|
||||||
// Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
// Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||||
// Explain to the user why we need permission
|
// Explain to the user why we need permission
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
mRequestedPath = path;
|
||||||
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||||
PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
|
PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
|
||||||
}
|
}
|
||||||
|
|
@ -83,17 +96,21 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
// Treat this as a cancel press
|
// Treat this as a cancel press
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListener.onCancelled();
|
mListener.onCancelled();
|
||||||
|
dismiss();
|
||||||
}
|
}
|
||||||
} else { // if (requestCode == PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE) {
|
} else { // if (requestCode == PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE) {
|
||||||
if (PackageManager.PERMISSION_GRANTED == grantResults[0]) {
|
if (PackageManager.PERMISSION_GRANTED == grantResults[0]) {
|
||||||
// Do refresh
|
// Do refresh
|
||||||
refresh();
|
if (mRequestedPath != null) {
|
||||||
|
refresh(mRequestedPath);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getContext(), R.string.nnf_permission_external_write_denied,
|
Toast.makeText(getContext(), R.string.nnf_permission_external_write_denied,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
// Treat this as a cancel press
|
// Treat this as a cancel press
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListener.onCancelled();
|
mListener.onCancelled();
|
||||||
|
dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +123,7 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
* @return true if path is a directory, false if file
|
* @return true if path is a directory, false if file
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isDir(final File path) {
|
public boolean isDir(@NonNull final File path) {
|
||||||
return path.isDirectory();
|
return path.isDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,8 +131,9 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
* @param path either a file or directory
|
* @param path either a file or directory
|
||||||
* @return filename of path
|
* @return filename of path
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String getName(File path) {
|
public String getName(@NonNull File path) {
|
||||||
return path.getName();
|
return path.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,17 +144,14 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
* @param from either a file or directory
|
* @param from either a file or directory
|
||||||
* @return the parent directory
|
* @return the parent directory
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public File getParent(final File from) {
|
public File getParent(@NonNull final File from) {
|
||||||
if (from.getPath().equals(getRoot().getPath())) {
|
if (from.getPath().equals(getRoot().getPath())) {
|
||||||
// Already at root, we can't go higher
|
// Already at root, we can't go higher
|
||||||
return from;
|
return from;
|
||||||
} else if (from.getParentFile() != null) {
|
} else if (from.getParentFile() != null) {
|
||||||
if (from.isFile()) {
|
return from.getParentFile();
|
||||||
return getParent(from.getParentFile());
|
|
||||||
} else {
|
|
||||||
return from.getParentFile();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return from;
|
return from;
|
||||||
}
|
}
|
||||||
|
|
@ -148,8 +163,9 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
* @param path either a file or directory
|
* @param path either a file or directory
|
||||||
* @return File representation of the string path
|
* @return File representation of the string path
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public File getPath(final String path) {
|
public File getPath(@NonNull final String path) {
|
||||||
return new File(path);
|
return new File(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,8 +173,9 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
* @param path either a file or directory
|
* @param path either a file or directory
|
||||||
* @return the full path to the file
|
* @return the full path to the file
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String getFullPath(final File path) {
|
public String getFullPath(@NonNull final File path) {
|
||||||
return path.getPath();
|
return path.getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,6 +184,7 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
*
|
*
|
||||||
* @return the highest allowed path, which is "/" by default
|
* @return the highest allowed path, which is "/" by default
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public File getRoot() {
|
public File getRoot() {
|
||||||
return new File("/");
|
return new File("/");
|
||||||
|
|
@ -178,8 +196,9 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
* @param file either a file or directory
|
* @param file either a file or directory
|
||||||
* @return a Uri
|
* @return a Uri
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Uri toUri(final File file) {
|
public Uri toUri(@NonNull final File file) {
|
||||||
return Uri.fromFile(file);
|
return Uri.fromFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,6 +206,7 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
* Get a loader that lists the Files in the current path,
|
* Get a loader that lists the Files in the current path,
|
||||||
* and monitors changes.
|
* and monitors changes.
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Loader<SortedList<File>> getLoader() {
|
public Loader<SortedList<File>> getLoader() {
|
||||||
return new AsyncTaskLoader<SortedList<File>>(getActivity()) {
|
return new AsyncTaskLoader<SortedList<File>>(getActivity()) {
|
||||||
|
|
@ -219,7 +239,7 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
files.beginBatchedUpdates();
|
files.beginBatchedUpdates();
|
||||||
if (listFiles != null) {
|
if (listFiles != null) {
|
||||||
for (java.io.File f : listFiles) {
|
for (java.io.File f : listFiles) {
|
||||||
if (isItemVisible(f)) {
|
if (isItemVisible(f) && directoryHasNeededFiles(f)) {
|
||||||
files.add(f);
|
files.add(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -275,6 +295,23 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean directoryHasNeededFiles(@NonNull final File file) {
|
||||||
|
final File[] fileList = file.listFiles();
|
||||||
|
if (fileList == null) {
|
||||||
|
return isNeededExtension(file.toString());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isNeededExtension(@NonNull final String fileName) {
|
||||||
|
for (final String extension : extensions) {
|
||||||
|
if (fileName.endsWith(extension) || fileName.endsWith(extension.toUpperCase(Locale.getDefault()))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name is validated to be non-null, non-empty and not containing any
|
* Name is validated to be non-null, non-empty and not containing any
|
||||||
* slashes.
|
* slashes.
|
||||||
|
|
@ -282,12 +319,11 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
* @param name The name of the folder the user wishes to create.
|
* @param name The name of the folder the user wishes to create.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onNewFolder(final String name) {
|
public void onNewFolder(@NonNull final String name) {
|
||||||
File folder = new File(mCurrentPath, name);
|
File folder = new File(mCurrentPath, name);
|
||||||
|
|
||||||
if (folder.mkdir()) {
|
if (folder.mkdir()) {
|
||||||
mCurrentPath = folder;
|
refresh(folder);
|
||||||
refresh();
|
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), R.string.nnf_create_folder_error,
|
Toast.makeText(getActivity(), R.string.nnf_create_folder_error,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
|
|
@ -297,14 +333,18 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
/**
|
/**
|
||||||
* Used by the list to determine whether a file should be displayed or not.
|
* Used by the list to determine whether a file should be displayed or not.
|
||||||
* Default behavior is to always display folders. If files can be selected,
|
* Default behavior is to always display folders. If files can be selected,
|
||||||
* then files are also displayed. Override this method to enable other
|
* then files are also displayed. Set the showHiddenFiles property to show
|
||||||
|
* hidden file. Default behaviour is to hide hidden files. Override this method to enable other
|
||||||
* filtering behaviour, like only displaying files with specific extensions (.zip, .txt, etc).
|
* filtering behaviour, like only displaying files with specific extensions (.zip, .txt, etc).
|
||||||
*
|
*
|
||||||
* @param file to maybe add. Can be either a directory or file.
|
* @param file to maybe add. Can be either a directory or file.
|
||||||
* @return True if item should be added to the list, false otherwise
|
* @return True if item should be added to the list, false otherwise
|
||||||
*/
|
*/
|
||||||
protected boolean isItemVisible(final File file) {
|
protected boolean isItemVisible(final File file) {
|
||||||
return isDir(file) || (mode == MODE_FILE || mode == MODE_FILE_AND_DIR);
|
if (!showHiddenItems && file.isHidden()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.isItemVisible(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -319,7 +359,7 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
* @return -1 if if lhs should be placed before rhs, 0 if they are equal,
|
* @return -1 if if lhs should be placed before rhs, 0 if they are equal,
|
||||||
* and 1 if rhs should be placed before lhs
|
* and 1 if rhs should be placed before lhs
|
||||||
*/
|
*/
|
||||||
protected int compareFiles(File lhs, File rhs) {
|
protected int compareFiles(@NonNull File lhs, @NonNull File rhs) {
|
||||||
if (lhs.isDirectory() && !rhs.isDirectory()) {
|
if (lhs.isDirectory() && !rhs.isDirectory()) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (rhs.isDirectory() && !lhs.isDirectory()) {
|
} else if (rhs.isDirectory() && !lhs.isDirectory()) {
|
||||||
|
|
@ -328,4 +368,5 @@ public class FilePickerFragment extends AbstractFilePickerFragment<File> {
|
||||||
return lhs.getName().compareToIgnoreCase(rhs.getName());
|
return lhs.getName().compareToIgnoreCase(rhs.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Jonas Kalderstam
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
*
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.nononsenseapps.filepicker;
|
package com.nononsenseapps.filepicker;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v7.util.SortedList;
|
import android.support.v7.util.SortedList;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
|
@ -37,13 +27,14 @@ public interface LogicHandler<T> {
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
*/
|
*/
|
||||||
boolean isDir(final T path);
|
boolean isDir(@NonNull final T path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param path
|
* @param path
|
||||||
* @return filename of path
|
* @return filename of path
|
||||||
*/
|
*/
|
||||||
String getName(final T path);
|
@NonNull
|
||||||
|
String getName(@NonNull final T path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the path to a URI for the return intent
|
* Convert the path to a URI for the return intent
|
||||||
|
|
@ -51,7 +42,8 @@ public interface LogicHandler<T> {
|
||||||
* @param path
|
* @param path
|
||||||
* @return a Uri
|
* @return a Uri
|
||||||
*/
|
*/
|
||||||
Uri toUri(final T path);
|
@NonNull
|
||||||
|
Uri toUri(@NonNull final T path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the path to the parent directory. Should return the root if
|
* Return the path to the parent directory. Should return the root if
|
||||||
|
|
@ -59,30 +51,35 @@ public interface LogicHandler<T> {
|
||||||
*
|
*
|
||||||
* @param from
|
* @param from
|
||||||
*/
|
*/
|
||||||
T getParent(final T from);
|
@NonNull
|
||||||
|
T getParent(@NonNull final T from);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param path
|
* @param path
|
||||||
* @return the full path to the file
|
* @return the full path to the file
|
||||||
*/
|
*/
|
||||||
String getFullPath(final T path);
|
@NonNull
|
||||||
|
String getFullPath(@NonNull final T path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the path to the type used.
|
* Convert the path to the type used.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
*/
|
*/
|
||||||
T getPath(final String path);
|
@NonNull
|
||||||
|
T getPath(@NonNull final String path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the root path (lowest allowed).
|
* Get the root path (lowest allowed).
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
T getRoot();
|
T getRoot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a loader that lists the files in the current path,
|
* Get a loader that lists the files in the current path,
|
||||||
* and monitors changes.
|
* and monitors changes.
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
Loader<SortedList<T>> getLoader();
|
Loader<SortedList<T>> getLoader();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -90,7 +87,7 @@ public interface LogicHandler<T> {
|
||||||
*
|
*
|
||||||
* @param viewHolder
|
* @param viewHolder
|
||||||
*/
|
*/
|
||||||
void onBindHeaderViewHolder(AbstractFilePickerFragment<T>.HeaderViewHolder viewHolder);
|
void onBindHeaderViewHolder(@NonNull AbstractFilePickerFragment<T>.HeaderViewHolder viewHolder);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Header is subtracted from the position
|
* Header is subtracted from the position
|
||||||
|
|
@ -99,19 +96,21 @@ public interface LogicHandler<T> {
|
||||||
* @param viewType
|
* @param viewType
|
||||||
* @return a view holder for a file or directory
|
* @return a view holder for a file or directory
|
||||||
*/
|
*/
|
||||||
RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType);
|
@NonNull
|
||||||
|
RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param viewHolder to bind data from either a file or directory
|
* @param viewHolder to bind data from either a file or directory
|
||||||
* @param position 0 - n, where the header has been subtracted
|
* @param position 0 - n, where the header has been subtracted
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
void onBindViewHolder(AbstractFilePickerFragment<T>.DirViewHolder viewHolder, int position, T data);
|
void onBindViewHolder(@NonNull AbstractFilePickerFragment<T>.DirViewHolder viewHolder,
|
||||||
|
int position, @NonNull T data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param position 0 - n, where the header has been subtracted
|
* @param position 0 - n, where the header has been subtracted
|
||||||
* @param data
|
* @param data
|
||||||
* @return an integer greater than 0
|
* @return an integer greater than 0
|
||||||
*/
|
*/
|
||||||
int getItemViewType(int position, T data);
|
int getItemViewType(int position, @NonNull T data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,31 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Jonas Kalderstam
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
*
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.nononsenseapps.filepicker;
|
package com.nononsenseapps.filepicker;
|
||||||
|
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.text.TextUtils;
|
|
||||||
|
import static com.nononsenseapps.filepicker.Utils.isValidFileName;
|
||||||
|
|
||||||
public class NewFolderFragment extends NewItemFragment {
|
public class NewFolderFragment extends NewItemFragment {
|
||||||
|
|
||||||
private static final String TAG = "new_folder_fragment";
|
private static final String TAG = "new_folder_fragment";
|
||||||
|
|
||||||
public static void showDialog(final FragmentManager fm, final OnNewFolderListener listener) {
|
public static void showDialog(@NonNull final FragmentManager fm,
|
||||||
|
@Nullable final OnNewFolderListener listener) {
|
||||||
NewItemFragment d = new NewFolderFragment();
|
NewItemFragment d = new NewFolderFragment();
|
||||||
d.setListener(listener);
|
d.setListener(listener);
|
||||||
d.show(fm, TAG);
|
d.show(fm, TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean validateName(final String itemName) {
|
protected boolean validateName(@Nullable final String itemName) {
|
||||||
return !TextUtils.isEmpty(itemName)
|
return isValidFileName(itemName);
|
||||||
&& !itemName.contains("/")
|
|
||||||
&& !itemName.equals(".")
|
|
||||||
&& !itemName.equals("..");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Jonas Kalderstam
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
*
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.nononsenseapps.filepicker;
|
package com.nononsenseapps.filepicker;
|
||||||
|
|
@ -23,6 +12,7 @@ import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
|
@ -39,7 +29,7 @@ public abstract class NewItemFragment extends DialogFragment {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListener(final OnNewFolderListener listener) {
|
public void setListener(@Nullable final OnNewFolderListener listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,6 +57,10 @@ public abstract class NewItemFragment extends DialogFragment {
|
||||||
final AlertDialog dialog = (AlertDialog) dialog1;
|
final AlertDialog dialog = (AlertDialog) dialog1;
|
||||||
final EditText editText = (EditText) dialog.findViewById(R.id.edit_text);
|
final EditText editText = (EditText) dialog.findViewById(R.id.edit_text);
|
||||||
|
|
||||||
|
if (editText == null) {
|
||||||
|
throw new NullPointerException("Could not find an edit text in the dialog");
|
||||||
|
}
|
||||||
|
|
||||||
Button cancel = dialog.getButton(AlertDialog.BUTTON_NEGATIVE);
|
Button cancel = dialog.getButton(AlertDialog.BUTTON_NEGATIVE);
|
||||||
cancel.setOnClickListener(new View.OnClickListener() {
|
cancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
|
@ -119,12 +113,6 @@ public abstract class NewItemFragment extends DialogFragment {
|
||||||
protected abstract boolean validateName(final String itemName);
|
protected abstract boolean validateName(final String itemName);
|
||||||
|
|
||||||
public interface OnNewFolderListener {
|
public interface OnNewFolderListener {
|
||||||
/**
|
void onNewFolder(@NonNull final String name);
|
||||||
* Name is validated to be non-null, non-empty and not containing any
|
|
||||||
* slashes.
|
|
||||||
*
|
|
||||||
* @param name The name of the folder the user wishes to create.
|
|
||||||
*/
|
|
||||||
void onNewFolder(final String name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.nononsenseapps.filepicker;
|
||||||
|
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some utility methods
|
||||||
|
*/
|
||||||
|
public class Utils {
|
||||||
|
|
||||||
|
private static final String SEP = "/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name is validated to be non-null, non-empty and not containing any
|
||||||
|
* slashes.
|
||||||
|
*
|
||||||
|
* @param name The name of the folder the user wishes to create.
|
||||||
|
*/
|
||||||
|
public static boolean isValidFileName(@Nullable String name) {
|
||||||
|
return !TextUtils.isEmpty(name)
|
||||||
|
&& !name.contains("/")
|
||||||
|
&& !name.equals(".")
|
||||||
|
&& !name.equals("..");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append the second pathString to the first. The result will not end with a /.
|
||||||
|
* In case two absolute paths are given, e.g. /A/B/, and /C/D/, then the result
|
||||||
|
* will be /A/B/C/D
|
||||||
|
*
|
||||||
|
* Multiple slashes will be shortened to a single slash, so /A///B is equivalent to /A/B
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public static String appendPath(@NonNull String first,
|
||||||
|
@NonNull String second) {
|
||||||
|
String result = first + SEP + second;
|
||||||
|
|
||||||
|
while (result.contains("//")) {
|
||||||
|
result = result.replaceAll("//", "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.length() > 1 && result.endsWith(SEP)) {
|
||||||
|
return result.substring(0, result.length() - 1);
|
||||||
|
} else {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 720 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 307 B |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 467 B |
|
Before Width: | Height: | Size: 661 B |
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFFFF"
|
||||||
|
android:pathData="M20,6h-8l-2,-2L4,4c-1.11,0 -1.99,0.89 -1.99,2L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,8c0,-1.11 -0.89,-2 -2,-2zM19,14h-3v3h-2v-3h-3v-2h3L14,9h2v3h3v2z"/>
|
||||||
|
</vector>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="48dp"
|
||||||
|
android:height="48dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M10,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8c0,-1.1 -0.9,-2 -2,-2h-8l-2,-2z"/>
|
||||||
|
</vector>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z"/>
|
||||||
|
</vector>
|
||||||