Compare commits

...
Author SHA1 Message Date
Tobias Kaminsky aaaf7cf36c daily dev 20170823 2017-08-23 00:41:21 +02:00
Tobias Kaminsky 3a5941524b update dev 2017-08-23 2017-08-23 00:31:32 +02:00
Tobias Kaminsky f5fed0a666 Merge remote-tracking branch 'nextcloud/master' into dev 2017-08-23 00:31:01 +02:00
Tobias Kaminsky dd3b878a55 daily dev 20170822 2017-08-22 00:47:15 +02:00
Tobias Kaminsky 3bce50d600 update dev 2017-08-22 2017-08-22 00:33:07 +02:00
Tobias Kaminsky 36b8cc9635 Merge remote-tracking branch 'nextcloud/bugfix-454' into dev 2017-08-22 00:32:45 +02:00
Tobias Kaminsky 5c7e175626 Merge remote-tracking branch 'nextcloud/folderObserver' into dev 2017-08-22 00:32:43 +02:00
AndyScherzinger 1bbbbbd730 Merge branch 'master' of https://github.com/nextcloud/android into dev
# Conflicts:
#	CHANGELOG.md
#	build.gradle
#	scripts/lint/lint-results.txt
#	src/main/AndroidManifest.xml
#	src/main/res/values/strings.xml
2017-08-21 22:58:25 +02:00
tobiaskaminsky a8d6b305fc comment out adding new downloadedf files to folder observer 2017-08-21 22:11:09 +02:00
AndyScherzinger 05a18440a7 fixes after rebase 2017-08-21 20:39:14 +02:00
Mario Danic 242d5f497a Add space 2017-08-21 20:39:14 +02:00
Mario Danic 318a08c8aa Fix a weird weird bug 2017-08-21 20:39:13 +02:00
Mario Danic cbc0480f71 Fix an issue with restoring search and UI 2017-08-21 20:39:13 +02:00
Mario Danic c7f72528fd Fix restore functionality 2017-08-21 20:39:13 +02:00
Mario Danic 3ed552040b Fix review bugs 2017-08-21 20:39:12 +02:00
Mario Danic bff8f98210 Remove an import that we dont need 2017-08-21 20:39:12 +02:00
Mario Danic be2f1f10ae Fix a few tiny bugs 2017-08-21 20:39:11 +02:00
Mario Danic c8c7c7770b Fix a NPE 2017-08-21 20:39:11 +02:00
Mario Danic 248c7315c5 Combine ifs 2017-08-21 20:39:11 +02:00
Mario Danic 849e995852 Fix issues brought up by review 2017-08-21 20:39:10 +02:00
AndyScherzinger 72c2916d41 make finding bold 2017-08-21 20:39:10 +02:00
AndyScherzinger 4e99ca44e3 use primary color for highlighting 2017-08-21 20:39:09 +02:00
Mario Danic c32321ec73 Fix a review issue in FileDisplayActivity 2017-08-21 20:39:09 +02:00
Mario Danic d266cf7c21 Fix issues found by review 2017-08-21 20:39:09 +02:00
Mario Danic 6de4f71e3c Fix codacy issues 2017-08-21 20:39:08 +02:00
Mario Danic 36e10a53e2 Restore search state 2017-08-21 20:39:08 +02:00
Mario Danic 82e37a8acc First step towards text search 2017-08-21 20:39:08 +02:00
Mario Danic 799d56a1ad Fix review bugs 2017-08-21 20:39:07 +02:00
Mario Danic 4bbc1ce1a1 Remove an import that we dont need 2017-08-21 20:39:07 +02:00
Mario Danic 027017d44e Remove search in the media preview 2017-08-21 20:39:07 +02:00
Mario Danic 2aaad2e24e Fix a few tiny bugs 2017-08-21 20:39:06 +02:00
Mario Danic 6d49a8c9a0 Fix a NPE 2017-08-21 20:39:06 +02:00
Mario Danic 8eb66d96c8 Combine ifs 2017-08-21 20:39:06 +02:00
Mario Danic 26b3c913a3 Fix issues brought up by review 2017-08-21 20:39:05 +02:00
AndyScherzinger 45b67e6c3c make finding bold 2017-08-21 20:39:05 +02:00
AndyScherzinger 5b38ac26c9 use primary color for highlighting 2017-08-21 20:39:04 +02:00
Mario Danic 1213957826 Fix a review issue in FileDisplayActivity 2017-08-21 20:39:04 +02:00
Mario Danic 3d8570d4a6 Fix issues found by review 2017-08-21 20:39:04 +02:00
Mario Danic f787ddcef1 Fix codacy issues 2017-08-21 20:39:03 +02:00
Mario Danic e3ec5d1ace Restore search state 2017-08-21 20:39:03 +02:00
Mario Danic 8680f2600a First step towards text search 2017-08-21 20:39:03 +02:00
Tobias Kaminsky e7773c2f88 update dev 2017-08-21 2017-08-21 00:31:11 +02:00
Tobias Kaminsky 007c9a87f8 update dev 2017-08-20 2017-08-20 00:33:57 +02:00
Tobias Kaminsky 5f491c04ec update dev 2017-08-19 2017-08-19 00:32:04 +02:00
Tobias Kaminsky 766b207593 daily dev 20170818 2017-08-18 00:39:47 +02:00
Tobias Kaminsky c7931ea085 update dev 2017-08-18 2017-08-18 00:31:32 +02:00
tobiaskaminsky a197828cfe Merge remote-tracking branch 'origin/dev' into dev 2017-08-17 15:19:35 +02:00
tobiaskaminsky bb4f08b450 Merge remote-tracking branch 'remotes/origin/dev-base' into dev 2017-08-17 15:19:22 +02:00
tobiaskaminsky f18685a15e move creating of file after git pull 2017-08-17 15:18:35 +02:00
Tobias Kaminsky d9d4551be2 update dev 2017-08-17 2017-08-17 11:17:40 +02:00
Tobias Kaminsky 7f62921ac4 Merge remote-tracking branch 'nextcloud/untrustedCerts' into dev 2017-08-17 11:17:26 +02:00
Tobias Kaminsky 42dd8fe664 daily dev 20170817 2017-08-17 00:39:59 +02:00
Tobias Kaminsky 32efdef91f update dev 2017-08-17 2017-08-17 00:31:07 +02:00
Tobias Kaminsky 65c46c2c9c Merge remote-tracking branch 'nextcloud/errorDuringDbUpgrade' into dev 2017-08-17 00:30:56 +02:00
Tobias Kaminsky f75c83e19b Merge remote-tracking branch 'nextcloud/codacyFixes' into dev 2017-08-17 00:30:55 +02:00
nextcloud-android-bot 6bb91220f3 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2017-08-16 20:29:03 +00:00
Andy Scherzinger 00bf6954de Merge d864cee306 into e77962d1bb 2017-08-16 20:20:04 +00:00
AndyScherzinger d864cee306 cleanup upload list adapter 2017-08-16 22:19:43 +02:00
AndyScherzinger 423d0b5729 codacy: move listener to own file to reduce file complexity 2017-08-16 22:09:14 +02:00
AndyScherzinger 57fbe0d2aa codacy: fix reassigning of variable 2017-08-16 22:09:13 +02:00
AndyScherzinger 3621443d1b codacy: replace member with local variable 2017-08-16 22:09:13 +02:00
AndyScherzinger e9825aeae1 codacy: Avoid reassigning parameters and extract util methods to proper util class 2017-08-16 22:09:12 +02:00
Tobias Kaminsky 96907d98ea update dev 2017-08-16 2017-08-16 14:36:07 +02:00
Tobias Kaminsky df5f926e9e Merge remote-tracking branch 'nextcloud/dev-base' into dev 2017-08-16 14:36:05 +02:00
Tobias Kaminsky 48530cf5ef Merge remote-tracking branch 'nextcloud/bugfix-454' into dev 2017-08-16 14:36:00 +02:00
Tobias Kaminsky 0873be8c8d Merge remote-tracking branch 'nextcloud/errorDuringDbUpgrade' into dev 2017-08-16 14:35:58 +02:00
AndyScherzinger 6513145c45 fixes after rebase 2017-08-16 13:27:45 +02:00
Mario Danic f6dccb30b6 Add space 2017-08-16 13:27:45 +02:00
Mario Danic e943d26fb5 Fix a weird weird bug 2017-08-16 13:27:44 +02:00
Mario Danic 2b3b3ea5cd Fix an issue with restoring search and UI 2017-08-16 13:27:44 +02:00
Mario Danic fc38c0eeb6 Fix restore functionality 2017-08-16 13:27:44 +02:00
Mario Danic 02e8ba38ba Fix review bugs 2017-08-16 13:27:43 +02:00
Mario Danic e0772789cf Remove an import that we dont need 2017-08-16 13:27:43 +02:00
Mario Danic 312b3fc550 Fix a few tiny bugs 2017-08-16 13:27:43 +02:00
Mario Danic 1e34440933 Fix a NPE 2017-08-16 13:27:42 +02:00
Mario Danic 3ca8b2364f Combine ifs 2017-08-16 13:27:42 +02:00
Mario Danic 773509eb77 Fix issues brought up by review 2017-08-16 13:27:41 +02:00
AndyScherzinger abb4744e03 make finding bold 2017-08-16 13:27:41 +02:00
AndyScherzinger 1c575ea4db use primary color for highlighting 2017-08-16 13:27:41 +02:00
Mario Danic 2165a78454 Fix a review issue in FileDisplayActivity 2017-08-16 13:27:40 +02:00
Mario Danic a6f09afe10 Fix issues found by review 2017-08-16 13:27:40 +02:00
Mario Danic b84cc55260 Fix codacy issues 2017-08-16 13:27:40 +02:00
Mario Danic 0310a4c0b0 Restore search state 2017-08-16 13:27:39 +02:00
Mario Danic 6ef9d64715 First step towards text search 2017-08-16 13:27:39 +02:00
Mario Danic fc548be8fd Fix review bugs 2017-08-16 13:27:38 +02:00
Mario Danic c86bcd75ba Remove an import that we dont need 2017-08-16 13:27:38 +02:00
Mario Danic 979809dc1d Remove search in the media preview 2017-08-16 13:27:38 +02:00
Mario Danic bb5e51a2e1 Fix a few tiny bugs 2017-08-16 13:27:37 +02:00
Mario Danic 9f4127c571 Fix a NPE 2017-08-16 13:27:37 +02:00
Mario Danic 356f0cb15f Combine ifs 2017-08-16 13:27:37 +02:00
Mario Danic dead50f15f Fix issues brought up by review 2017-08-16 13:27:36 +02:00
AndyScherzinger 7303d07f0a make finding bold 2017-08-16 13:27:36 +02:00
AndyScherzinger 4f69f791f4 use primary color for highlighting 2017-08-16 13:27:36 +02:00
Mario Danic d380880afd Fix a review issue in FileDisplayActivity 2017-08-16 13:27:35 +02:00
Mario Danic c8b8ce1481 Fix issues found by review 2017-08-16 13:27:35 +02:00
Mario Danic 1df336e13b Fix codacy issues 2017-08-16 13:27:34 +02:00
Mario Danic 346937eca1 Restore search state 2017-08-16 13:27:34 +02:00
Mario Danic 01eb30687b First step towards text search 2017-08-16 13:27:34 +02:00
tobiaskaminsky e7b7e73782 screenshots / description for dev version 2017-08-16 08:56:06 +02:00
Tobias Kaminsky d27b77bbe9 update dev 2017-08-16 2017-08-16 08:48:12 +02:00
tobiaskaminsky b10a205e6b add missing import 2017-08-16 08:34:52 +02:00
tobiaskaminsky b454b676a0 Merge remote-tracking branch 'nextcloud/resizedImages' into dev
# Conflicts:
#	scripts/lint/lint-results.txt
2017-08-16 08:21:07 +02:00
tobiaskaminsky 844ef7f083 Merge remote-tracking branch 'nextcloud/bugfix-454' into dev
# Conflicts:
#	src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
2017-08-16 08:20:54 +02:00
tobiaskaminsky f02ee0a6d9 Merge remote-tracking branch 'nextcloud/folderObserver' into dev 2017-08-16 08:20:36 +02:00
tobiaskaminsky d9d4f0bb5f Merge remote-tracking branch 'nextcloud/errorFeedback' into dev
# Conflicts:
#	src/main/java/com/owncloud/android/ui/activity/Preferences.java
2017-08-16 08:20:36 +02:00
tobiaskaminsky eb79a16778 Merge remote-tracking branch 'origin/dev-base' into dev-base
# Conflicts:
#	src/main/java/com/owncloud/android/authentication/AccountUtils.java
2017-08-16 08:11:57 +02:00
tobiaskaminsky 6d6fdfe9f2 Merge remote-tracking branch 'remotes/origin/master' into dev-base 2017-08-16 08:11:11 +02:00
AndyScherzinger ce5ace474b fix imports 2017-08-15 14:28:06 +02:00
AndyScherzinger 77f26979bb remove codacy warnings 2017-08-15 14:28:06 +02:00
AndyScherzinger 73e468e94a remove lint warnings 2017-08-15 14:28:05 +02:00
AndyScherzinger 35766f8ccf Login error messages oC/1897 2017-08-15 14:28:05 +02:00
AndyScherzinger 4bc82a82d0 Improve error feedback oC/1881 2017-08-15 14:28:05 +02:00
AndyScherzinger fc69586dbd remove unused paddings (lint) 2017-08-15 14:27:56 +02:00
tobiaskaminsky 847936aa10 comment out adding new downloadedf files to folder observer 2017-08-14 16:18:26 +02:00
AndyScherzinger be8488a222 Merge branch 'master' of https://github.com/nextcloud/android into resizedImages 2017-08-14 15:27:22 +02:00
AndyScherzinger a7a7004d6e fixes after rebase 2017-08-14 09:43:01 +02:00
Mario Danic 5423c3bafa Add space 2017-08-14 09:43:01 +02:00
Mario Danic e1a8528cf7 Fix a weird weird bug 2017-08-14 09:43:00 +02:00
Mario Danic c445362824 Fix an issue with restoring search and UI 2017-08-14 09:43:00 +02:00
Mario Danic 5c6644b56a Fix restore functionality 2017-08-14 09:43:00 +02:00
Mario Danic 2c9234815c Fix review bugs 2017-08-14 09:42:59 +02:00
Mario Danic 029fcb377d Remove an import that we dont need 2017-08-14 09:42:59 +02:00
Mario Danic 4c399f4b2b Fix a few tiny bugs 2017-08-14 09:42:59 +02:00
Mario Danic 938da72c99 Fix a NPE 2017-08-14 09:42:58 +02:00
Mario Danic 69bc3131d8 Combine ifs 2017-08-14 09:42:58 +02:00
Mario Danic 83e96bf06e Fix issues brought up by review 2017-08-14 09:42:58 +02:00
AndyScherzinger b9da1e6718 make finding bold 2017-08-14 09:42:57 +02:00
AndyScherzinger f4c4f0888a use primary color for highlighting 2017-08-14 09:42:57 +02:00
Mario Danic 069fa1c9c0 Fix a review issue in FileDisplayActivity 2017-08-14 09:42:57 +02:00
Mario Danic 26a1a1797d Fix issues found by review 2017-08-14 09:42:57 +02:00
Mario Danic cbf5d9b461 Fix codacy issues 2017-08-14 09:42:56 +02:00
Mario Danic 23f8c0832d Restore search state 2017-08-14 09:42:56 +02:00
Mario Danic 414e1a2f11 First step towards text search 2017-08-14 09:42:55 +02:00
Mario Danic 41307ed281 Fix review bugs 2017-08-14 09:42:55 +02:00
Mario Danic eb623a20c2 Remove an import that we dont need 2017-08-14 09:42:55 +02:00
Mario Danic 72dde9f0cf Remove search in the media preview 2017-08-14 09:42:54 +02:00
Mario Danic 5d692864b9 Fix a few tiny bugs 2017-08-14 09:42:54 +02:00
Mario Danic 69d6b94765 Fix a NPE 2017-08-14 09:42:54 +02:00
Mario Danic e4bf14ac13 Combine ifs 2017-08-14 09:42:53 +02:00
Mario Danic 27936902cd Fix issues brought up by review 2017-08-14 09:42:53 +02:00
AndyScherzinger 17498fa820 make finding bold 2017-08-14 09:42:53 +02:00
AndyScherzinger cf1823eae6 use primary color for highlighting 2017-08-14 09:42:52 +02:00
Mario Danic cde4b07a76 Fix a review issue in FileDisplayActivity 2017-08-14 09:42:52 +02:00
Mario Danic cdb2136458 Fix issues found by review 2017-08-14 09:42:52 +02:00
Mario Danic 5dd7c70231 Fix codacy issues 2017-08-14 09:42:51 +02:00
Mario Danic 69d5fa21fc Restore search state 2017-08-14 09:42:51 +02:00
Mario Danic 6de6276911 First step towards text search 2017-08-14 09:42:51 +02:00
nextcloud-android-bot 681d1dcc9d Drone: update Lint results to reflect reduced error/warning count [skip ci] 2017-08-11 15:48:58 +00:00
Tobias Kaminsky 68ecd2033d Merge 69d3df50ee into 519702c7c4 2017-08-11 15:16:27 +00:00
AndyScherzinger 69d3df50ee Merge branch 'master' of https://github.com/nextcloud/android into resizedImages
# Conflicts:
#	scripts/lint/lint-results.txt
2017-08-11 17:16:17 +02:00
nextcloud-android-bot 64c21847cb Drone: update Lint results to reflect reduced error/warning count [skip ci] 2017-08-11 08:01:21 +00:00
Tobias Kaminsky fa50afc3b3 Merge 3fd9f2c8e7 into ece3acb0c4 2017-08-11 07:47:18 +00:00
Tobias Kaminsky 3fd9f2c8e7 Merge branch 'master' into resizedImages 2017-08-11 09:47:13 +02:00
tobiasKaminsky b86f103ff5 proper exception handling 2017-08-11 09:24:04 +02:00
nextcloud-android-bot b4dfb76067 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2017-08-10 17:39:39 +00:00
Tobias Kaminsky e2f407b23f Merge 65c4b33f84 into 46ff9288e1 2017-08-10 17:27:13 +00:00
AndyScherzinger 65c4b33f84 Merge branch 'master' of https://github.com/nextcloud/android into resizedImages
# Conflicts:
#	src/main/res/values-cs-rCZ/strings.xml
#	src/main/res/values-de-rDE/strings.xml
#	src/main/res/values-de/strings.xml
#	src/main/res/values-el/strings.xml
#	src/main/res/values-en-rGB/strings.xml
#	src/main/res/values-es-rMX/strings.xml
#	src/main/res/values-es/strings.xml
#	src/main/res/values-fi-rFI/strings.xml
#	src/main/res/values-fr/strings.xml
#	src/main/res/values-is/strings.xml
#	src/main/res/values-it/strings.xml
#	src/main/res/values-nb-rNO/strings.xml
#	src/main/res/values-nl/strings.xml
#	src/main/res/values-pl/strings.xml
#	src/main/res/values-pt-rBR/strings.xml
#	src/main/res/values-ru/strings.xml
#	src/main/res/values-sq/strings.xml
#	src/main/res/values-tr/strings.xml
#	src/main/res/values-zh-rCN/strings.xml
#	src/main/res/values/strings.xml
2017-08-10 19:27:04 +02:00
tobiasKaminsky 792b81f6fe also new file name... ;-) 2017-08-10 09:16:23 +02:00
tobiasKaminsky fcf483fc32 new apk output path 2017-08-10 09:14:35 +02:00
tobiasKaminsky 2537665798 remove leftover from merge 2017-08-10 08:45:12 +02:00
tobiasKaminsky b6f0b246a5 add latest date only if build is successful 2017-08-10 08:42:59 +02:00
tobiasKaminsky 5edfbce164 inital state of dev base 2017-08-10 08:30:46 +02:00
AndyScherzinger 9c9f877027 Merge branch 'master' of https://github.com/nextcloud/android into resizedImages
# Conflicts:
#	scripts/lint/lint-results.txt
#	src/main/AndroidManifest.xml
#	src/main/java/com/owncloud/android/authentication/AccountUtils.java
#	src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
#	src/main/java/com/owncloud/android/operations/UploadFileOperation.java
#	src/main/res/values-es-rMX/strings.xml
#	src/main/res/values/strings.xml
2017-08-08 17:20:38 +02:00
tobiaskaminsky 5a8c0b24c7 use gradle wrapper for easier gradle update 2017-08-08 08:04:49 +02:00
tobiaskaminsky be26954a9c update to latest master 2017-08-07 16:09:58 +02:00
tobiaskaminsky 6a22f46226 update to latest master 2017-08-07 16:08:48 +02:00
tobiaskaminsky e76f5ab02d Merge remote-tracking branch 'remotes/origin/master' into dev-base
# Conflicts:
#	src/main/res/values/strings.xml
2017-08-07 14:06:14 +02:00
tobiaskaminsky f01e2b1f8f Merge remote-tracking branch 'remotes/origin/master' into dev-base
# Conflicts:
#	src/main/res/values/strings.xml
2017-08-07 14:05:12 +02:00
tobiaskaminsky 39907325a3 theme 2017-08-07 14:02:14 +02:00
tobiasKaminsky 2aaef4453b reverting app id to beta as fdroid needs this 2017-08-07 14:01:22 +02:00
tobiasKaminsky 370e110118 inital state of dev base 2017-08-07 14:01:16 +02:00
nextcloud-android-bot 592117c25b Drone: update Lint results to reflect reduced error/warning count [skip ci] 2017-08-04 12:13:10 +00:00
Tobias Kaminsky 065cc5b676 Merge bb87d5cd46 into 75d6de9b7c 2017-08-04 11:29:05 +00:00
tobiasKaminsky bb87d5cd46 fall back to default image if thumbnail is not available 2017-08-04 13:28:45 +02:00
tobiasKaminsky 592360693f Merge remote-tracking branch 'remotes/origin/master' into resizedImages 2017-08-04 13:05:16 +02:00
tobiasKaminsky 394bd00024 on delete: store resized image out of download one. 2017-08-04 13:03:55 +02:00
tobiasKaminsky da0ca6114c fallback to thumbnail for sharing if no resized image is available 2017-08-02 11:31:13 +02:00
tobiasKaminsky 1c924dab7d show error message if no network else "no resized image possible" 2017-08-02 10:54:32 +02:00
tobiasKaminsky a28ffbcb04 send resized image 2017-08-02 08:36:45 +02:00
tobiasKaminsky 62ff71c7d7 always use newest lint-results --> try to avoid conflict 2017-07-25 16:26:52 +02:00
tobiasKaminsky e69ca41338 reset branch after check
send mail, address as parameter
2017-07-25 07:55:51 +02:00
tobiasKaminsky f820ca6b38 if conflicting branches, execute param1 2017-07-25 07:48:54 +02:00
tobiasKaminsky 7d7831ca5b check conflicting branches 2017-07-25 07:45:56 +02:00
tobiasKaminsky a748296ff3 grep case-insensitive 2017-07-24 08:50:55 +02:00
tobiasKaminsky baaf886493 wrong "updated" string 2017-07-24 08:48:14 +02:00
tobiasKaminsky 8e661485ee show time in update file 2017-07-21 09:02:43 +02:00
tobiasKaminsky 81a668e0f8 echo to file 2017-07-20 15:30:52 +02:00
tobiasKaminsky f685b1a7ca use conflicting branches as exit code
beautify changelog
2017-07-20 15:14:39 +02:00
nextcloud-android-bot 801b576cc7 Drone: update Lint results to reflect reduced error/warning count [skip ci] 2017-07-20 08:38:11 +00:00
Tobias Kaminsky 4837d7e669 Merge e55ec3904c into 15cff7b33d 2017-07-20 08:22:29 +00:00
tobiasKaminsky e55ec3904c Merge remote-tracking branch 'remotes/origin/master' into resizedImages
# Conflicts:
#	src/main/res/values-es-rMX/strings.xml
#	src/main/res/values/strings.xml
2017-07-20 10:22:22 +02:00
tobiasKaminsky a731547dea Merge remote-tracking branch 'remotes/origin/master' into resizedImages
# Conflicts:
#	src/main/res/values-es-rMX/strings.xml
#	src/main/res/values/strings.xml
2017-07-20 10:09:46 +02:00
tobiasKaminsky 55fc0800d6 use real class instead of params to transfer infos to ThumbnailGenerationTask 2017-07-20 09:40:34 +02:00
tobiasKaminsky 4e78a1fe17 on no resized image possible: show snackbar to download full image
note: this only works if the gallery app cannot generate a preview due to unsupported image type and it will fail if the file is corrupt.
2017-07-20 09:09:25 +02:00
tobiasKaminsky aba5f8b026 split up thumbnail and resized generation part 2017-07-20 08:41:11 +02:00
tobiasKaminsky ccc3df216e fix downloading/storing of thumbnail 2017-07-14 16:12:24 +02:00
tobiasKaminsky 3314afbd81 merge 2017-07-13 15:40:59 +02:00
tobiasKaminsky 162473a025 Merge remote-tracking branch 'remotes/origin/master' into resizedImages
# Conflicts:
#	src/main/java/com/owncloud/android/ui/adapter/UploaderAdapter.java
#	src/main/java/third_parties/michaelOrtiz/TouchImageViewCustom.java
2017-07-13 15:39:55 +02:00
tobiasKaminsky 61a71d33d0 downloading is working if set in preferences 2017-07-13 15:26:10 +02:00
tobiasKaminsky 14eed9f5f1 Merge remote-tracking branch 'remotes/origin/master' into resizedImages
# Conflicts:
#	src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
#	src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java
#	src/main/res/values/strings.xml
2017-07-13 11:25:38 +02:00
tobiasKaminsky b42ceec141 Merge remote-tracking branch 'remotes/origin/master' into resizedImages
# Conflicts:
#	src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
#	src/main/java/com/owncloud/android/ui/adapter/FileListListAdapter.java
#	src/main/res/values/strings.xml
2017-07-13 11:13:42 +02:00
tobiasKaminsky 2ae68242e1 preference setting: download or preview 2017-07-13 11:04:53 +02:00
tobiasKaminsky 416db99d33 further work: image can now be download via snack 2017-07-12 17:05:06 +02:00
tobiasKaminsky 2d2e4501a0 resolved update conflicts, adapted to current system 2017-06-30 17:01:04 +02:00
tobiasKaminsky e758738f5a Merge remote-tracking branch 'remotes/origin/master' into resizedImages 2017-06-29 16:05:32 +02:00
tobiasKaminsky ca2562e54a delete lint-baseline as it is not working reliable 2017-06-26 14:47:32 +02:00
tobiasKaminsky 5f9e736a37 Merge remote-tracking branch 'remotes/origin/master' into dev-base2 2017-06-26 14:45:19 +02:00
tobiasKaminsky b3a23166ac fix line wrap 2017-05-15 10:43:39 +02:00
tobiasKaminsky 7e9a9040d3 reverting app id to beta as fdroid needs this 2017-04-28 10:33:10 +02:00
tobiasKaminsky 16b6b4c878 enable logger 2017-04-28 10:33:10 +02:00
tobiasKaminsky 0e62ecdcf0 build and use only generic release 2017-04-28 10:33:10 +02:00
tobiasKaminsky 5484adf4ab add date to commit messages 2017-04-28 10:33:09 +02:00
tobiasKaminsky 26ac31a362 improved changelog output 2017-04-28 10:33:09 +02:00
tobiasKaminsky d4099dd946 add dev-base to check 2017-04-28 10:33:08 +02:00
tobiasKaminsky 23f2bd43a1 new location of androidManifest 2017-04-28 10:33:08 +02:00
tobiasKaminsky 4cc79e1bcb inital state of dev base 2017-04-28 10:33:08 +02:00
tobiasKaminsky 46f7e0af4e setting / snackbar is working 2017-03-19 10:24:12 +01:00
tobiasKaminsky 1e653d5eaf wip snackbar 2017-03-18 07:14:36 +01:00
tobiasKaminsky 8f291127ba wip saving behaviour 2017-03-05 08:38:27 +01:00
tobiasKaminsky f862099e20 Merge remote-tracking branch 'remotes/origin/master' into resizedImages 2017-03-04 12:22:55 +01:00
tobiasKaminsky b25fe94af0 wip snackbars 2017-03-04 12:13:08 +01:00
tobiasKaminsky 18a35a2586 fix some codacy issues 2017-02-13 12:55:02 +01:00
tobiasKaminsky 2d76982d47 Merge remote-tracking branch 'remotes/origin/master' into resizedImages 2017-02-13 12:48:55 +01:00
AndyScherzinger e8a92a0031 Merge branch 'master' of https://github.com/nextcloud/android into resizedImages 2017-01-21 14:36:10 +01:00
AndyScherzinger 816f532417 Merge branch 'master' of https://github.com/nextcloud/android into resizedImages 2017-01-10 22:26:51 +01:00
AndyScherzinger 65be7efa2d Merge branch 'master' of https://github.com/nextcloud/android into resizedImages 2017-01-04 18:24:32 +01:00
tobiasKaminsky d6115cbf85 Merge remote-tracking branch 'remotes/origin/master' into resizedImages
# Conflicts:
#	src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
2016-12-29 14:37:53 +01:00
tobiasKaminsky d1d99c5e3f send resized image also on filelist 2016-12-28 07:55:48 +01:00
tobiasKaminsky b203c48c51 Merge remote-tracking branch 'remotes/origin/master' into resizedImages 2016-11-16 12:29:26 +01:00
tobiasKaminsky cbc44a6014 Merge remote-tracking branch 'remotes/origin/master' into resizedImages 2016-09-18 09:13:16 +02:00
tobiasKaminsky 69661e6951 Merge remote-tracking branch 'remotes/origin/master' into resizedImages 2016-09-17 16:25:39 +02:00
tobiasKaminsky 9a2ae6cb0b fix bug: resized image was always used indepentent of download state 2016-09-03 12:15:06 +02:00
tobiasKaminsky 9f86064b81 Merge remote-tracking branch 'origin/resizedImages' into resizedImages 2016-08-01 21:56:21 +02:00
tobiasKaminsky 73da2a1d14 added second parameter to thumbnail generation task 2016-08-01 21:43:18 +02:00
Andy Scherzinger 93bb169c6c GPLv3 2016-08-01 11:31:37 +02:00
tobiasKaminsky cf1e7013f4 minor code enhancements 2016-07-23 10:23:54 +02:00
tobiasKaminsky 8258843ae1 Merge remote-tracking branch 'remotes/origin/resizedImages' into resizedImages2 2016-07-23 10:15:50 +02:00
tobiasKaminsky 67baae4441 Merge remote-tracking branch 'remotes/origin/master' into resizedImages2 2016-07-23 10:12:39 +02:00
tobiasKaminsky a5509797bc resized images are now fetched via gallery app 2016-07-23 09:46:59 +02:00
tobiasKaminsky 3ff2d58a25 Merge remote-tracking branch 'remotes/origin/master' into storeResizedImagesOnDeletion 2016-07-21 20:25:31 +02:00
tobiasKaminsky e3d43e754d wip 2016-06-25 13:38:55 +02:00
tobiasKaminsky bcb55a0e4c Merge remote-tracking branch 'remotes/origin/master' into resizedImages 2016-06-25 13:30:23 +02:00
tobiasKaminsky a9fbec2934 revert wip 2016-05-13 18:17:49 +02:00
tobiasKaminsky 140e923982 update build gradle 2016-05-13 18:16:10 +02:00
tobiasKaminsky 680cf56746 correct indentation 2016-05-13 18:15:12 +02:00
tobiasKaminsky 7162aa65f4 revert exporting FileContentProvider 2016-05-13 18:14:32 +02:00
tobiasKaminsky a6e16a4e71 wip 2016-04-10 18:54:28 +02:00
tobiasKaminsky eac4e49ceb fixed showing thumbnails in local file list (uploader) 2016-01-03 13:36:29 +01:00
tobiasKaminsky 90382c5889 show thumbnail while waiting for resized image 2015-11-13 16:41:05 +01:00
tobiasKaminsky ce841a3c4f Merge remote-tracking branch 'remotes/upstream/master' into resizedImagesMaster 2015-11-05 22:04:57 +01:00
tobiasKaminsky d5ee0ef158 fixed #1244 2015-11-05 21:58:02 +01:00
tobiasKaminsky d06a4b155d updated for future use with later PRs 2015-11-02 22:09:29 +01:00
tobiasKaminsky 3ddb48b647 exported must be set to true 2015-11-02 10:24:01 +01:00
tobiasKaminsky 957484588e fix #1230 2015-10-31 11:03:15 +01:00
tobiasKaminsky cf22541dd5 fixed storing thumbnails by correct imageKey 2015-10-31 08:30:13 +01:00
tobiasKaminsky 61338bbb0c fixed rotating resized image 2015-10-31 08:09:49 +01:00
tobiasKaminsky 788ebbcdab reverted library 2015-07-01 20:13:02 +02:00
tobiasKaminsky ce35d6448e Merge remote-tracking branch 'upstream/develop' into resizedImages 2015-07-01 19:16:42 +02:00
tobiasKaminsky a1bc147849 resized image is loaded instead of full sized image. 2015-05-18 21:01:17 +02:00
101 changed files with 2769 additions and 1372 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
scripts/lint/lint-results.txt merge=theirs
+125 -21
View File
@@ -1,25 +1,129 @@
## 2.0.0 (2017)
## 2017-08-23 00:31
New branches:
- Master (nextcloud/master) [https://github.com/nextcloud/android] added
- Account-wide search (Nc 12+)
- Auto upload available on Android 4+
- Separation between Image & Video for Auto upload
- Ability to define custom folders for Auto upload
- Simple contacts backup & restore
- Server-side Theming support
- Shared files view
- Notifications view and Push notifications (on Google Play-powered devices)
- Favorites, Photos and Activities
- Fingerprint locking
- SVG preview
- Set edit permissions in federated shares of folders (Nc 10+)
- New sorting dialog
- User information view
- Custom external links support
- Detect server maintainance mode
- Nicer error views for images & video preview
- Included privacy policy
- Preserve modification time of uploaded files
- Various bug fixes & improvements
Updated branches:
- Master (nextcloud/master) [https://github.com/nextcloud/android] updated
Conflicting branches:
- Further Codacy fixes (nextcloud/codacyFixes) [https://github.com/nextcloud/android/pull/1357] conflicting
- Error feedback improvement (nextcloud/errorFeedback) [https://github.com/nextcloud/android/pull/1198] conflicting
- Resized images (nextcloud/resizedImages) [https://github.com/nextcloud/android/pull/69] conflicting
## 2017-08-22 00:33
New branches:
- Comment out adding all new downloaded files to folder observer (nextcloud/folderObserver) [https://github.com/nextcloud/android/pull/1155] added
Updated branches:
-Dev branch was updated successfully] updated
- Comment out adding all new downloaded files to folder observer (nextcloud/folderObserver) [https://github.com/nextcloud/android/pull/1155] updated
- Search inside of text files (nextcloud/bugfix-454) [https://github.com/nextcloud/android/pull/565] updated
Conflicting branches:
- Further Codacy fixes (nextcloud/codacyFixes) [https://github.com/nextcloud/android/pull/1357] conflicting
- Error feedback improvement (nextcloud/errorFeedback) [https://github.com/nextcloud/android/pull/1198] conflicting
- Resized images (nextcloud/resizedImages) [https://github.com/nextcloud/android/pull/69] conflicting
## 2017-08-21 00:31
New branches:
/
Updated branches:
Conflicting branches:
- Further Codacy fixes (nextcloud/codacyFixes) [https://github.com/nextcloud/android/pull/1357] conflicting
- Error feedback improvement (nextcloud/errorFeedback) [https://github.com/nextcloud/android/pull/1198] conflicting
- Comment out adding all new downloaded files to folder observer (nextcloud/folderObserver) [https://github.com/nextcloud/android/pull/1155] conflicting
- Search inside of text files (nextcloud/bugfix-454) [https://github.com/nextcloud/android/pull/565] conflicting
- Resized images (nextcloud/resizedImages) [https://github.com/nextcloud/android/pull/69] conflicting
- Master (nextcloud/master) [https://github.com/nextcloud/android] conflicting
## 2017-08-20 00:33
New branches:
/
Updated branches:
Conflicting branches:
- Further Codacy fixes (nextcloud/codacyFixes) [https://github.com/nextcloud/android/pull/1357] conflicting
- Error feedback improvement (nextcloud/errorFeedback) [https://github.com/nextcloud/android/pull/1198] conflicting
- Comment out adding all new downloaded files to folder observer (nextcloud/folderObserver) [https://github.com/nextcloud/android/pull/1155] conflicting
- Search inside of text files (nextcloud/bugfix-454) [https://github.com/nextcloud/android/pull/565] conflicting
- Resized images (nextcloud/resizedImages) [https://github.com/nextcloud/android/pull/69] conflicting
- Master (nextcloud/master) [https://github.com/nextcloud/android] conflicting
## 2017-08-19 00:32
New branches:
/
Updated branches:
Conflicting branches:
- Further Codacy fixes (nextcloud/codacyFixes) [https://github.com/nextcloud/android/pull/1357] conflicting
- Error feedback improvement (nextcloud/errorFeedback) [https://github.com/nextcloud/android/pull/1198] conflicting
- Comment out adding all new downloaded files to folder observer (nextcloud/folderObserver) [https://github.com/nextcloud/android/pull/1155] conflicting
- Search inside of text files (nextcloud/bugfix-454) [https://github.com/nextcloud/android/pull/565] conflicting
- Resized images (nextcloud/resizedImages) [https://github.com/nextcloud/android/pull/69] conflicting
- Master (nextcloud/master) [https://github.com/nextcloud/android] conflicting
## 2017-08-18 00:31
New branches:
-Dev branch was updated successfully] added
Updated branches:
-Dev branch was updated successfully] updated
Conflicting branches:
- Handle foreign broadcast (nextcloud/handleForeignBroadcast) [https://github.com/nextcloud/android/pull/1362] conflicting
- Fix rare case: ssl cert is ok for checkServer, but not for webview (nextcloud/untrustedCerts) [https://github.com/nextcloud/android/pull/1361] conflicting
- Further Codacy fixes (nextcloud/codacyFixes) [https://github.com/nextcloud/android/pull/1357] conflicting
- Error feedback improvement (nextcloud/errorFeedback) [https://github.com/nextcloud/android/pull/1198] conflicting
- Search inside of text files (nextcloud/bugfix-454) [https://github.com/nextcloud/android/pull/565] conflicting
## 2017-08-17 11:17
New branches:
- Fix rare case: ssl cert is ok for checkServer, but not for webview (nextcloud/untrustedCerts) [https://github.com/nextcloud/android/pull/1361] added
Updated branches:
- Fix rare case: ssl cert is ok for checkServer, but not for webview (nextcloud/untrustedCerts) [https://github.com/nextcloud/android/pull/1361] updated
Conflicting branches:
- Further Codacy fixes (nextcloud/codacyFixes) [https://github.com/nextcloud/android/pull/1357] conflicting
- Error feedback improvement (nextcloud/errorFeedback) [https://github.com/nextcloud/android/pull/1198] conflicting
## 2017-08-17 00:31
New branches:
- Further Codacy fixes (nextcloud/codacyFixes) [https://github.com/nextcloud/android/pull/1357] added
Updated branches:
- Further Codacy fixes (nextcloud/codacyFixes) [https://github.com/nextcloud/android/pull/1357] updated
- Check if columns exists prior adding them (nextcloud/errorDuringDbUpgrade) [https://github.com/nextcloud/android/pull/1342] updated
Conflicting branches:
- Error feedback improvement (nextcloud/errorFeedback) [https://github.com/nextcloud/android/pull/1198] conflicting
## 2017-08-16 14:36
New branches:
- Check if columns exists prior adding them (nextcloud/errorDuringDbUpgrade) [https://github.com/nextcloud/android/pull/1342] added
- Search inside of text files (nextcloud/bugfix-454) [https://github.com/nextcloud/android/pull/565] added
- Dev base (nextcloud/dev-base) [https://github.com/nextcloud/android/tree/dev-base] added
Updated branches:
- Check if columns exists prior adding them (nextcloud/errorDuringDbUpgrade) [https://github.com/nextcloud/android/pull/1342] updated
- Search inside of text files (nextcloud/bugfix-454) [https://github.com/nextcloud/android/pull/565] updated
- Dev base (nextcloud/dev-base) [https://github.com/nextcloud/android/tree/dev-base] updated
Conflicting branches:
- Error feedback improvement (nextcloud/errorFeedback) [https://github.com/nextcloud/android/pull/1198] conflicting
## 2017-08-16 08:48
New branches:
/
Updated branches:
Conflicting branches:
/
## 1.4.3 (May 22, 2017)
- Hotfix: ignore oauth header for now and use basic auth to allow new logins for Nc12
+26 -3
View File
@@ -77,6 +77,10 @@ android {
multiDexEnabled true
applicationId "com.nextcloud.android.beta"
versionCode 20170823
versionName "20170823"
// adapt structure from Eclipse to Gradle/Android Studio expectations;
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
@@ -85,15 +89,16 @@ android {
productFlavors {
// used for f-droid
generic {
applicationId 'com.nextcloud.client'
applicationId 'com.nextcloud.android.beta'
dimension "default"
}
gplay {
applicationId 'com.nextcloud.client'
applicationId 'com.nextcloud.android.beta'
dimension "default"
}
modified {
// structure is:
// domain tld
@@ -123,6 +128,10 @@ android {
exclude 'META-INF/LICENSE'
}
signingConfigs {
release
}
task checkstyle(type: Checkstyle) {
configFile = file("${rootProject.projectDir}/checkstyle.xml")
configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
@@ -178,13 +187,27 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
if (project.hasProperty('RELEASE_STORE_FILE')) {
android.signingConfigs.release.storeFile = file(RELEASE_STORE_FILE)
android.signingConfigs.release.storePassword = RELEASE_STORE_PASSWORD
android.signingConfigs.release.keyAlias = RELEASE_KEY_ALIAS
android.signingConfigs.release.keyPassword = RELEASE_KEY_PASSWORD
}
dependencies {
/// dependencies for app building
implementation name: 'touch-image-view'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.github.nextcloud:android-library:1.0.25'
implementation 'com.github.nextcloud:android-library:dev-SNAPSHOT'
implementation "com.android.support:support-v4:${supportLibraryVersion}"
implementation "com.android.support:design:${supportLibraryVersion}"
implementation 'com.jakewharton:disklrucache:2.0.2'
+9
View File
@@ -0,0 +1,9 @@
2017-08-23 00:30:49
Branches: 7
[01 / 07] Further Codacy fixes (nextcloud/codacyFixes) [https://github.com/nextcloud/android/pull/1357] CONFLICT
[02 / 07] Error feedback improvement (nextcloud/errorFeedback) [https://github.com/nextcloud/android/pull/1198] CONFLICT
[03 / 07] Comment out adding all new downloaded files to folder observer (nextcloud/folderObserver) [https://github.com/nextcloud/android/pull/1155] no update needed
[04 / 07] Search inside of text files (nextcloud/bugfix-454) [https://github.com/nextcloud/android/pull/565] no update needed
[05 / 07] Resized images (nextcloud/resizedImages) [https://github.com/nextcloud/android/pull/69] CONFLICT
[06 / 07] Master (nextcloud/master) [https://github.com/nextcloud/android] merged successfully
[07 / 07] Dev base (nextcloud/dev-base) [https://github.com/nextcloud/android/tree/dev-base] no update needed
@@ -0,0 +1,5 @@
Die Nextcloud App erlaubt Dir Zugriff auf alle Dateien in Deiner Nextcloud.
Die ist die Dev-Version der offiziellen Nextcloud App und enthält neue Features, die noch nicht ausgiebig getestet wurden. Dies kann zu Datenverlust oder Instabilität führen. Die App ist nur zum Testen der neuen Funktionen, melden von Fehlern und nicht für den alltäglichen Einsatz vorgesehen.
Die Dev-Version kann parallel zu der offiziellen Nextcloud-App installiert werden.
Binary file not shown.

After

Width:  |  Height:  |  Size: 821 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

@@ -0,0 +1 @@
Die Nextcloud App erlaubt Dir Zugriff auf alle Dateien in Deiner Nextcloud.
@@ -0,0 +1 @@
Nextcloud Dev
@@ -0,0 +1,4 @@
A safe home for all your data. Access & share your files, calendars, contacts, mail & more from any device, on your terms.
This is a dev version of the official Nextcloid app and includes brand-new, untested features which might lead to instabilities and data loss. The app is designed for users willing to test the new features and to report bugs if they occur. Do not use it for your productive work!
The dev version can be installed alongside the official Nextcloud app which is available at F-Droid, too. Once a day it is checked if the source code was updated, so there can be longer pauses between builds.
Binary file not shown.

After

Width:  |  Height:  |  Size: 821 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

@@ -0,0 +1 @@
A safe home for all your data. Access & share your files, calendars, contacts, mail & more from any device, on your terms.
@@ -0,0 +1 @@
Nextcloud Dev
+8
View File
@@ -0,0 +1,8 @@
Dev branch was updated successfully
nextcloud/bugfix-454
nextcloud/codacyFixes
nextcloud/dev-base
nextcloud/errorDuringDbUpgrade
nextcloud/folderObserver
nextcloud/master
nextcloud/untrustedCerts
+44
View File
@@ -0,0 +1,44 @@
#!/bin/bash
date=$(date +%Y%m%d)
# always use dev branch for android library
sed -i s"#'com.github.nextcloud:android-library.*#'com.github.nextcloud:android-library:dev-SNAPSHOT'#" build.gradle
# use current date for version code/name
sed -i s"#android:versionCode=.*#android:versionCode=\"$date\"#" src/main/AndroidManifest.xml
sed -i s"#versionCode .*#versionCode $date#" build.gradle
sed -i s"#android:versionName=.*\"#android:versionName=\"$date\"#" src/main/AndroidManifest.xml
sed -i s"#versionName .*#versionName \"$date\"#" build.gradle
# sed -e 's#\@string/app_name#Nextcloud dev#' -e 's#\@string/copy_link#Copy link#' -e 's#\@string/share_dialog_title#Sharing#' -e 's#\@string/manage_space_title#Manage space#' src/main/AndroidManifest.xml -i
# build signed apk
./gradlew assembleGenericRelease >> /tmp/dev.log 2>&1
if [ $? != 0 ] ; then
echo "Build error!"
exit 1
fi
# use the current date
mkdir -p ~/apks
echo $date > ~/apks/latest
mv build/outputs/apk/generic/release/android-generic-release.apk ~/apks/nextcloud-dev-$date.apk
ln -s nextcloud-dev-$date.apk latest.apk
mv latest.apk ~/apks/
# remove all but the latest 5 apks
/bin/ls -t ~/apks/*.apk | awk 'NR>6' | xargs rm -f
git add .
git commit -m "daily dev $date"
git push
git tag dev-$date
git push origin dev-$date
# remove all but the latest 5 tags
git tag|grep dev | sort -r | awk 'NR>5' | xargs -n 1 git push --delete origin
git tag|grep dev | sort -r | awk 'NR>5' | xargs -n 1 git tag -d
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
currentCommit=$(git rev-parse HEAD)
statusFile="devUpdateStatus"
# check if branch was changed
git pull -q || exit
branches=$(scripts/getBranchesForDev)
branchesCount=$(echo "$branches" | wc -l)
count=1
conflictingBranches=0
date "+%F %X" > $statusFile
touch mergedBranches
while read -r branch; do
branchName=$(echo $branch | cut -d"(" -f2 | cut -d")" -f1 | tr ":" "/")
if [ $(echo $branchName | grep -c "^origin") -eq 0 ] ; then
# remote repo
git fetch -q $(echo $branchName | cut -f1 -d"/") 1> /dev/null
fi
mergeOutput=$(git merge --no-edit $branchName)
if [ $? -ne 0 ] ; then
echo "[$(printf "%02d" $count) / $(printf "%02d" $branchesCount)] $branch CONFLICT" >> $statusFile
let conflictingBranches++
git merge --abort
fi
let count++
done <<< "$branches"
if [ $conflictingBranches -gt 0 ] ; then
grep -i conflict $statusFile | mail -s "[Nextcloud-Dev] $(date '+%F %X') Conflicting branches!" $1
fi
# reset to previous commit, delete all inbetween commits
git reset --hard $currentCommit
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
source ~/.git/githubPass
pullRequests=$(curl -u "$GITHUB_USER:$GITHUB_PASS" 2>/dev/null https://api.github.com/search/issues?q=repo:nextcloud/android+state:open+type:pr+label:%22ready%20for%20dev%22 | grep pulls | cut -d'"' -f4)
for pr in $pullRequests; do
xml=$(curl -u "$GITHUB_USER:$GITHUB_PASS" 2> /dev/null $pr)
branchName=$(echo "$xml" | grep \"label\" | head -n1 | cut -d'"' -f 4| tr ":" "/")
title=$(echo "$xml" | grep "title" | head -n1 | cut -d'"' -f 4 | tr -d "(" | tr -d ")" | tr -d "[" | tr -d "]")
htmlUrl=$(echo "$xml" |grep html_url | grep pull | cut -d'"' -f4)
echo "$title ("$branchName") ["$htmlUrl"]"
done
# manually add master and dev-base branch
echo "Master (nextcloud/master) [https://github.com/nextcloud/android]"
echo "Dev base (nextcloud/dev-base) [https://github.com/nextcloud/android/tree/dev-base]"
## add remote repos
for repoUrl in $(curl -u "$GITHUB_USER:$GITHUB_PASS" 2> /dev/null $pullRequests | grep \"git_url\" | sort | uniq | cut -f4 -d"\"" ); do
repoName=$(echo $repoUrl | cut -f4 -d"/")
git remote add $repoName $repoUrl 2>/dev/null
done
+94
View File
@@ -0,0 +1,94 @@
#!/bin/bash
statusFile="devUpdateStatus"
touch mergedBranches
# check if branch was changed
git fetch
devBranchWasUpdated=$(git status | grep "dem selben Stand" -c)
git pull -q || exit
branches=$(scripts/getBranchesForDev)
branchesCount=$(echo "$branches" | wc -l)
count=1
conflictingBranches=0
date "+%F %X" > $statusFile
echo "Branches: $branchesCount" >> $statusFile
if [ $devBranchWasUpdated -eq 0 ]; then
# branch was updated outside, so build new dev
echo "Dev branch was updated successfully" >> $statusFile
fi
while read -r branch; do
echo -n "[$(printf "%02d" $count) / $(printf "%02d" $branchesCount)] " >> $statusFile
branchName=$(echo $branch | cut -d"(" -f2 | cut -d")" -f1 | tr ":" "/")
if [ $(echo $branchName | grep -c "^origin") -eq 0 ] ; then
# remote repo
git fetch -q $(echo $branchName | cut -f1 -d"/") 1> /dev/null
fi
mergeOutput=$(git merge --no-edit $branchName)
if [ $? -ne 0 ] ; then
echo "$branch CONFLICT" >> $statusFile
let conflictingBranches++
git merge --abort
else
if [ $(echo $mergeOutput | grep "up-to-date" -c) -eq 0 ] ; then
# branch has newer state
echo "$branch merged successfully" >> $statusFile
else
echo "$branch no update needed" >> $statusFile
fi
fi
let count++
done <<< "$branches"
## Update Changelog.md
tmpFile=$(tempfile)
cp CHANGELOG.md $tmpFile
echo "## $(date '+%F %H:%M')" > CHANGELOG.md
## add new branches
echo "New branches:" >> CHANGELOG.md
if [ $(comm -13 mergedBranches <(cat devUpdateStatus | grep succ | cut -d"(" -f2 | cut -d")" -f1 | sort) | wc -l) -gt 0 ] ; then
egrep "$(comm -13 mergedBranches <(cat devUpdateStatus | grep succ | cut -d"(" -f2 | cut -d")" -f1 | sort) )" devUpdateStatus | cut -d"]" -f2 | sed s'#$#]#'g | sed s'#^#-#'g | sed s'#$# added#'g >> CHANGELOG.md
else
echo "/" >> CHANGELOG.md
fi
cat devUpdateStatus | grep succ | cut -d"(" -f2 | cut -d")" -f1 >> mergedBranches
sort -u mergedBranches -o mergedBranches_unique
mv mergedBranches_unique mergedBranches
echo >> CHANGELOG.md
## add updated branches
echo "Updated branches:" >> CHANGELOG.md
if [ $(cat devUpdateStatus | grep succ -c) -gt 0 ]; then
cat devUpdateStatus | grep succ | cut -d"]" -f2 | sed s'#$#]#'g | sed s'#^#-#'g | sed s'#$# updated#'g >> CHANGELOG.md
fi
echo >> CHANGELOG.md
## add conflicted branches
echo "Conflicting branches:" >> CHANGELOG.md
if [ $(cat devUpdateStatus | grep conflict -ci) -gt 0 ]; then
cat devUpdateStatus | grep -i conflict | cut -d"]" -f2 | sed s'#$#]#'g | sed s'#^#-#'g | sed s'#$# conflicting#'g >> CHANGELOG.md
else
echo "/" >> CHANGELOG.md
fi
echo >> CHANGELOG.md
cat $tmpFile >> CHANGELOG.md
git add .
git commit -m "update dev $(date +%F)"
git push
exit $conflictingBranches
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
echo -n "git pull:"
git pull || exit
echo
branches=$(scripts/getBranchesForDev)
branchesCount=$(echo "$branches" | wc -l)
count=1
echo "Branches: $branchesCount"
while read -u 3 -r branch; do
branchName=$(echo $branch | cut -d"(" -f2 | cut -d")" -f1 | tr ":" "/")
echo -n "[$(printf "%02d" $count) / $(printf "%02d" $branchesCount)] $branch"
if [ $(echo $branchName | grep -c "^origin") -eq 0 ] ; then
# remote repo
git fetch -q $(echo $branchName | cut -f1 -d"/") 1> /dev/null
fi
git merge --no-edit $branchName 1> /dev/null
if [ $? -ne 0 ] ; then
echo "resolve conflict in androidStudio, after resolving press RETURN"
read
git add . && git commit --no-edit 1> /dev/null
else
echo " merged"
fi
let count++
done 3<<< "$branches"
echo "git push? [y/n]"
read -r result
if [ $result = "y" ] ; then
git push
fi
+1 -1
View File
@@ -8,7 +8,7 @@
"client_info": {
"mobilesdk_app_id": "",
"android_client_info": {
"package_name": "com.nextcloud.client"
"package_name": "com.nextcloud.android.beta"
}
},
"oauth_client": [],
+12 -5
View File
@@ -20,8 +20,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.owncloud.android"
android:versionCode="20000004"
android:versionName="2.0.0RC4">
android:versionCode="20170823"
android:versionName="20170823">
<uses-sdk
android:minSdkVersion="14"
@@ -84,8 +84,9 @@
<activity android:name=".ui.activity.UserInfoActivity" />
<activity android:name=".ui.activity.NotificationsActivity"/>
<activity android:name=".ui.activity.ParticipateActivity" />
<activity android:name=".ui.activity.ActivitiesListActivity"
android:configChanges="orientation|screenSize|keyboardHidden" />
<activity
android:name=".ui.activity.ActivitiesListActivity"
android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".ui.activity.SyncedFoldersActivity"/>
<activity android:name=".ui.activity.UploadFilesActivity" />
<activity android:name=".ui.activity.ExternalSiteWebView"
@@ -187,6 +188,12 @@
android:resource="@xml/exposed_filepaths" />
</provider>
<provider
android:name=".providers.DiskLruImageCacheFileProvider"
android:authorities="org.nextcloud.imageCache.provider"
android:exported="true">
</provider>
<activity
android:name=".authentication.AuthenticatorActivity"
android:exported="true"
@@ -224,7 +231,7 @@
<activity android:name=".ui.activity.ConflictsResolveActivity"/>
<activity android:name=".ui.activity.GenericExplanationActivity"/>
<activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity"/>
<activity android:name=".ui.activity.LogHistoryActivity"/>
<activity android:name=".ui.errorhandling.ErrorShowActivity" />
@@ -34,7 +34,6 @@ import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.UserInfo;
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -42,19 +41,13 @@ import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation;
import com.owncloud.android.operations.GetCapabilitiesOperarion;
import com.owncloud.android.ui.activity.ManageAccountsActivity;
import com.owncloud.android.operations.GetCapabilitiesOperarion;
import java.util.Locale;
public class AccountUtils {
private static final String TAG = AccountUtils.class.getSimpleName();
public static final String WEBDAV_PATH_4_0_AND_LATER = "/remote.php/webdav";
public static final String DAV_PATH = "/remote.php/dav";
private static final String ODAV_PATH = "/remote.php/odav";
private static final String SAML_SSO_PATH = "/remote.php/webdav";
public static final String STATUS_PATH = "/status.php";
public static final int ACCOUNT_VERSION = 1;
public static final int ACCOUNT_VERSION_WITH_PROPER_ID = 2;
@@ -88,7 +81,7 @@ public class AccountUtils {
if (defaultAccount == null && ocAccounts.length > 0) {
// take first which is not pending for removal account as fallback
for (Account account: ocAccounts) {
for (Account account : ocAccounts) {
boolean pendingForRemoval = arbitraryDataProvider.getBooleanValue(account,
ManageAccountsActivity.PENDING_FOR_REMOVAL);
@@ -204,31 +197,6 @@ public class AccountUtils {
appPrefs.apply();
}
/**
* Returns the proper URL path to access the WebDAV interface of an ownCloud server,
* according to its version and the authorization method used.
*
* @param version Version of ownCloud server.
* @param authTokenType Authorization token type, matching some of the AUTH_TOKEN_TYPE_* constants in
* {@link AccountAuthenticator}.
* @return WebDAV path for given OC version and authorization method, null if OC version
* is unknown; versions prior to ownCloud 4 are not supported anymore
*/
public static String getWebdavPath(OwnCloudVersion version, String authTokenType) {
if (version != null) {
if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()).equals(authTokenType)) {
return ODAV_PATH;
}
if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(authTokenType)) {
return SAML_SSO_PATH;
}
return WEBDAV_PATH_4_0_AND_LATER;
}
return null;
}
/**
* Update the accounts in AccountManager to meet the current version of accounts expected by the app, if needed.
*
@@ -347,24 +315,6 @@ public class AccountUtils {
}
}
public static String trimWebdavSuffix(String url) {
while(url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
}
int pos = url.lastIndexOf(WEBDAV_PATH_4_0_AND_LATER);
if (pos >= 0) {
url = url.substring(0, pos);
} else {
pos = url.lastIndexOf(ODAV_PATH);
if (pos >= 0) {
url = url.substring(0, pos);
}
}
return url;
}
/**
* Access the version of the OC server corresponding to an account SAVED IN THE ACCOUNTMANAGER
*
@@ -59,6 +59,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
@@ -122,6 +123,7 @@ import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
import com.owncloud.android.utils.AnalyticsUtils;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.ErrorMessageAdapter;
import java.security.cert.X509Certificate;
import java.util.HashMap;
@@ -206,7 +208,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private TextView mServerStatusView;
private TextWatcher mHostUrlInputWatcher;
private int mServerStatusText = 0, mServerStatusIcon = 0;
private String mServerStatusText;
private int mServerStatusIcon = 0;
private boolean mServerIsChecked = false;
private boolean mServerIsValid = false;
@@ -225,7 +228,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private WebView mLoginWebView;
private int mAuthStatusText = 0, mAuthStatusIcon = 0;
private String mAuthStatusText;
private int mAuthStatusIcon = 0;
private String mAuthToken = "";
private AuthenticatorAsyncTask mAsyncTask;
@@ -372,7 +376,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
mLoginWebView.getSettings().setSaveFormData(false);
mLoginWebView.getSettings().setSavePassword(false);
if (baseURL != null && !baseURL.isEmpty()){
if (baseURL != null && !baseURL.isEmpty()) {
Map<String, String> headers = new HashMap<>();
headers.put(RemoteOperation.OCS_API_HEADER, RemoteOperation.OCS_API_HEADER_VALUE);
mLoginWebView.loadUrl(baseURL + WEB_LOGIN, headers);
@@ -441,12 +445,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
LoginUrlInfo loginUrlInfo = parseLoginDataUrl(prefix, dataString);
if (loginUrlInfo != null) {
mServerInfo.mBaseUrl = normalizeUrlSuffix(loginUrlInfo.serverAddress);
mServerInfo.mBaseUrl = AuthenticatorUrlUtils.normalizeUrlSuffix(loginUrlInfo.serverAddress);
webViewUser = loginUrlInfo.username;
webViewPassword = loginUrlInfo.password;
checkOcServer();
}
}
private void populateLoginFields(String dataString) throws IllegalArgumentException {
@@ -601,7 +604,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith(HTTPS_PROTOCOL);
}
} else {
mServerStatusText = savedInstanceState.getInt(KEY_SERVER_STATUS_TEXT);
mServerStatusText = savedInstanceState.getString(KEY_SERVER_STATUS_TEXT);
mServerStatusIcon = savedInstanceState.getInt(KEY_SERVER_STATUS_ICON);
mServerIsValid = savedInstanceState.getBoolean(KEY_SERVER_VALID);
@@ -651,7 +654,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
public void afterTextChanged(Editable s) {
if (mOkButton.isEnabled() &&
!mServerInfo.mBaseUrl.equals(
normalizeUrl(s.toString(), mServerInfo.mIsSslConn))) {
AuthenticatorUrlUtils.normalizeUrl(s.toString(), mServerInfo.mIsSslConn))) {
mOkButton.setEnabled(false);
}
}
@@ -666,7 +669,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
if (mAuthStatusIcon != 0) {
Log_OC.d(TAG, "onTextChanged: hiding authentication status");
mAuthStatusIcon = 0;
mAuthStatusText = 0;
mAuthStatusText = "";
showAuthStatus();
}
}
@@ -713,7 +716,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
}
} else {
isPasswordExposed = savedInstanceState.getBoolean(KEY_PASSWORD_EXPOSED, false);
mAuthStatusText = savedInstanceState.getInt(KEY_AUTH_STATUS_TEXT);
mAuthStatusText = savedInstanceState.getString(KEY_AUTH_STATUS_TEXT);
mAuthStatusIcon = savedInstanceState.getInt(KEY_AUTH_STATUS_ICON);
mAuthToken = savedInstanceState.getString(KEY_AUTH_TOKEN);
}
@@ -818,7 +821,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
if (!webViewLoginMethod) {
/// Server PRE-fragment state
outState.putInt(KEY_SERVER_STATUS_TEXT, mServerStatusText);
outState.putString(KEY_SERVER_STATUS_TEXT, mServerStatusText);
outState.putInt(KEY_SERVER_STATUS_ICON, mServerStatusIcon);
outState.putBoolean(KEY_SERVER_CHECKED, mServerIsChecked);
outState.putBoolean(KEY_SERVER_VALID, mServerIsValid);
@@ -826,7 +829,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
/// Authentication PRE-fragment state
outState.putBoolean(KEY_PASSWORD_EXPOSED, isPasswordVisible());
outState.putInt(KEY_AUTH_STATUS_ICON, mAuthStatusIcon);
outState.putInt(KEY_AUTH_STATUS_TEXT, mAuthStatusText);
outState.putString(KEY_AUTH_STATUS_TEXT, mAuthStatusText);
outState.putString(KEY_AUTH_TOKEN, mAuthToken);
}
@@ -1038,7 +1041,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
*/
private void onUrlInputFocusLost() {
if (!mServerInfo.mBaseUrl.equals(
normalizeUrl(mHostUrlInput.getText().toString(), mServerInfo.mIsSslConn))) {
AuthenticatorUrlUtils.normalizeUrl(mHostUrlInput.getText().toString(), mServerInfo.mIsSslConn))) {
// check server again only if the user changed something in the field
checkOcServer();
} else {
@@ -1064,7 +1067,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
if (uri.length() != 0) {
if (mHostUrlInput != null) {
uri = stripIndexPhpOrAppsFiles(uri, mHostUrlInput);
uri = AuthenticatorUrlUtils.stripIndexPhpOrAppsFiles(uri);
mHostUrlInput.setText(uri);
}
// Handle internationalized domain names
@@ -1075,14 +1079,15 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
}
if (mHostUrlInput != null) {
mServerStatusText = R.string.auth_testing_connection;
mServerStatusText = getResources().getString(R.string.auth_testing_connection);
mServerStatusIcon = R.drawable.progress_small;
showServerStatus();
}
Intent getServerInfoIntent = new Intent();
getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);
getServerInfoIntent.putExtra(OperationsService.EXTRA_SERVER_URL, normalizeUrlSuffix(uri));
getServerInfoIntent.putExtra(OperationsService.EXTRA_SERVER_URL,
AuthenticatorUrlUtils.normalizeUrlSuffix(uri));
if (mOperationsServiceBinder != null) {
mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent);
@@ -1091,7 +1096,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
}
} else {
mServerStatusText = 0;
mServerStatusText = "";
mServerStatusIcon = 0;
if (!webViewLoginMethod) {
showServerStatus();
@@ -1174,7 +1179,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
mServerInfo.mBaseUrl == null ||
mServerInfo.mBaseUrl.length() == 0) {
mServerStatusIcon = R.drawable.ic_alert;
mServerStatusText = R.string.auth_wtf_reenter_URL;
mServerStatusText = getResources().getString(R.string.auth_wtf_reenter_URL);
showServerStatus();
mOkButton.setEnabled(false);
return;
@@ -1233,7 +1238,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private void startOauthorization() {
// be gentle with the user
mAuthStatusIcon = R.drawable.progress_small;
mAuthStatusText = R.string.oauth_login_connection;
mAuthStatusText = getResources().getString(R.string.oauth_login_connection);
showAuthStatus();
// GET AUTHORIZATION request
@@ -1265,12 +1270,12 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private void startSamlBasedFederatedSingleSignOnAuthorization() {
/// be gentle with the user
mAuthStatusIcon = R.drawable.progress_small;
mAuthStatusText = R.string.auth_connecting_auth_server;
mAuthStatusText = getResources().getString(R.string.auth_connecting_auth_server);
showAuthStatus();
/// Show SAML-based SSO web dialog
String targetUrl = mServerInfo.mBaseUrl
+ AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);
+ AuthenticatorUrlUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);
SamlWebViewDialog dialog = SamlWebViewDialog.newInstance(targetUrl, targetUrl);
dialog.show(getSupportFragmentManager(), SAML_DIALOG_TAG);
}
@@ -1444,56 +1449,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
);
}
// TODO remove, if possible
private String normalizeUrl(String url, boolean sslWhenUnprefixed) {
if (url != null && url.length() > 0) {
url = url.trim();
if (!url.toLowerCase().startsWith(HTTP_PROTOCOL) &&
!url.toLowerCase().startsWith(HTTP_PROTOCOL)) {
if (sslWhenUnprefixed) {
url = HTTPS_PROTOCOL + url;
} else {
url = HTTP_PROTOCOL + url;
}
}
url = normalizeUrlSuffix(url);
}
return (url != null ? url : "");
}
private String normalizeUrlSuffix(String url) {
if (url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
}
url = trimUrlWebdav(url);
return url;
}
private String stripIndexPhpOrAppsFiles(String url, EditText mHostUrlInput) {
if (url.endsWith("/index.php")) {
url = url.substring(0, url.lastIndexOf("/index.php"));
mHostUrlInput.setText(url);
} else if (url.contains("/index.php/apps/")) {
url = url.substring(0, url.lastIndexOf("/index.php/apps/"));
mHostUrlInput.setText(url);
}
return url;
}
// TODO remove, if possible
private String trimUrlWebdav(String url) {
if (url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_4_0_AND_LATER)) {
url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_4_0_AND_LATER.length());
}
return url;
}
/**
* Chooses the right icon and text to show to the user for the received operation result.
*
@@ -1505,74 +1460,74 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
switch (result.getCode()) {
case OK_SSL:
mServerStatusIcon = R.drawable.ic_lock_white;
mServerStatusText = R.string.auth_secure_connection;
mServerStatusText = getResources().getString(R.string.auth_secure_connection);
break;
case OK_NO_SSL:
case OK:
if (mHostUrlInput.getText().toString().trim().toLowerCase().startsWith(HTTP_PROTOCOL)) {
mServerStatusText = R.string.auth_connection_established;
mServerStatusText = getResources().getString(R.string.auth_connection_established);
mServerStatusIcon = R.drawable.ic_ok;
} else {
mServerStatusText = R.string.auth_nossl_plain_ok_title;
mServerStatusText = getResources().getString(R.string.auth_nossl_plain_ok_title);
mServerStatusIcon = R.drawable.ic_lock_open_white;
}
break;
case NO_NETWORK_CONNECTION:
mServerStatusIcon = R.drawable.no_network;
mServerStatusText = R.string.auth_no_net_conn_title;
mServerStatusText = getResources().getString(R.string.auth_no_net_conn_title);
break;
case SSL_RECOVERABLE_PEER_UNVERIFIED:
mServerStatusText = R.string.auth_ssl_unverified_server_title;
mServerStatusText = getResources().getString(R.string.auth_ssl_unverified_server_title);
break;
case BAD_OC_VERSION:
mServerStatusText = R.string.auth_bad_oc_version_title;
mServerStatusText = getResources().getString(R.string.auth_bad_oc_version_title);
break;
case WRONG_CONNECTION:
mServerStatusText = R.string.auth_wrong_connection_title;
mServerStatusText = getResources().getString(R.string.auth_wrong_connection_title);
break;
case TIMEOUT:
mServerStatusText = R.string.auth_timeout_title;
mServerStatusText = getResources().getString(R.string.auth_timeout_title);
break;
case INCORRECT_ADDRESS:
mServerStatusText = R.string.auth_incorrect_address_title;
mServerStatusText = getResources().getString(R.string.auth_incorrect_address_title);
break;
case SSL_ERROR:
mServerStatusText = R.string.auth_ssl_general_error_title;
mServerStatusText = getResources().getString(R.string.auth_ssl_general_error_title);
break;
case UNAUTHORIZED:
mServerStatusText = R.string.auth_unauthorized;
mServerStatusText = getResources().getString(R.string.auth_unauthorized);
break;
case HOST_NOT_AVAILABLE:
mServerStatusText = R.string.auth_unknown_host_title;
mServerStatusText = getResources().getString(R.string.auth_unknown_host_title);
break;
case INSTANCE_NOT_CONFIGURED:
mServerStatusText = R.string.auth_not_configured_title;
mServerStatusText = getResources().getString(R.string.auth_not_configured_title);
break;
case FILE_NOT_FOUND:
mServerStatusText = R.string.auth_incorrect_path_title;
mServerStatusText = getResources().getString(R.string.auth_incorrect_path_title);
break;
case OAUTH2_ERROR:
mServerStatusText = R.string.auth_oauth_error;
mServerStatusText = getResources().getString(R.string.auth_oauth_error);
break;
case OAUTH2_ERROR_ACCESS_DENIED:
mServerStatusText = R.string.auth_oauth_error_access_denied;
mServerStatusText = getResources().getString(R.string.auth_oauth_error_access_denied);
break;
case UNHANDLED_HTTP_CODE:
case UNKNOWN_ERROR:
mServerStatusText = R.string.auth_unknown_error_title;
mServerStatusText = getResources().getString(R.string.auth_unknown_error_title);
break;
case OK_REDIRECT_TO_NON_SECURE_CONNECTION:
mServerStatusIcon = R.drawable.ic_lock_open_white;
mServerStatusText = R.string.auth_redirect_non_secure_connection_title;
mServerStatusText = getResources().getString(R.string.auth_redirect_non_secure_connection_title);
break;
case MAINTENANCE_MODE:
mServerStatusText = R.string.maintenance_mode;
mServerStatusText = getResources().getString(R.string.maintenance_mode);
break;
default:
mServerStatusText = 0;
mServerStatusText = "";
mServerStatusIcon = 0;
break;
}
@@ -1590,85 +1545,48 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
switch (result.getCode()) {
case OK_SSL:
mAuthStatusIcon = R.drawable.ic_lock_white;
mAuthStatusText = R.string.auth_secure_connection;
mAuthStatusText = getResources().getString(R.string.auth_secure_connection);
break;
case OK_NO_SSL:
case OK:
if (mHostUrlInput.getText().toString().trim().toLowerCase().startsWith(HTTP_PROTOCOL)) {
mAuthStatusText = R.string.auth_connection_established;
mAuthStatusText = getResources().getString(R.string.auth_connection_established);
mAuthStatusIcon = R.drawable.ic_ok;
} else {
mAuthStatusText = R.string.auth_nossl_plain_ok_title;
mAuthStatusText = getResources().getString(R.string.auth_nossl_plain_ok_title);
mAuthStatusIcon = R.drawable.ic_lock_open_white;
}
break;
case NO_NETWORK_CONNECTION:
mAuthStatusIcon = R.drawable.no_network;
mAuthStatusText = R.string.auth_no_net_conn_title;
mAuthStatusText = getResources().getString(R.string.auth_no_net_conn_title);
break;
case SSL_RECOVERABLE_PEER_UNVERIFIED:
mAuthStatusText = R.string.auth_ssl_unverified_server_title;
break;
case BAD_OC_VERSION:
mAuthStatusText = R.string.auth_bad_oc_version_title;
break;
case WRONG_CONNECTION:
mAuthStatusText = R.string.auth_wrong_connection_title;
mAuthStatusText = getResources().getString(R.string.auth_ssl_unverified_server_title);
break;
case TIMEOUT:
mAuthStatusText = R.string.auth_timeout_title;
break;
case INCORRECT_ADDRESS:
mAuthStatusText = R.string.auth_incorrect_address_title;
break;
case SSL_ERROR:
mAuthStatusText = R.string.auth_ssl_general_error_title;
break;
case UNAUTHORIZED:
mAuthStatusText = R.string.auth_unauthorized;
mAuthStatusText = getResources().getString(R.string.auth_timeout_title);
break;
case HOST_NOT_AVAILABLE:
mAuthStatusText = R.string.auth_unknown_host_title;
break;
case INSTANCE_NOT_CONFIGURED:
mAuthStatusText = R.string.auth_not_configured_title;
break;
case FILE_NOT_FOUND:
mAuthStatusText = R.string.auth_incorrect_path_title;
break;
case OAUTH2_ERROR:
mAuthStatusText = R.string.auth_oauth_error;
break;
case OAUTH2_ERROR_ACCESS_DENIED:
mAuthStatusText = R.string.auth_oauth_error_access_denied;
break;
case ACCOUNT_NOT_NEW:
mAuthStatusText = R.string.auth_account_not_new;
break;
case ACCOUNT_NOT_THE_SAME:
mAuthStatusText = R.string.auth_account_not_the_same;
mAuthStatusText = getResources().getString(R.string.auth_unknown_host_title);
break;
case UNHANDLED_HTTP_CODE:
case UNKNOWN_ERROR:
mAuthStatusText = R.string.auth_unknown_error_title;
break;
default:
mAuthStatusText = 0;
mAuthStatusIcon = 0;
mAuthStatusText = ErrorMessageAdapter.getErrorCauseMessage(result, null, getResources());
}
}
private void updateStatusIconFailUserName(int failedStatusText){
mAuthStatusIcon = R.drawable.ic_alert;
mAuthStatusText = failedStatusText;
mAuthStatusText = getResources().getString(failedStatusText);
}
private void updateServerStatusIconNoRegularAuth() {
mServerStatusIcon = R.drawable.ic_alert;
mServerStatusText = R.string.auth_can_not_auth_against_server;
mServerStatusText = getResources().getString(R.string.auth_can_not_auth_against_server);
}
/**
@@ -1773,7 +1691,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
updateServerStatusIconAndText(result);
showServerStatus();
mAuthStatusIcon = 0;
mAuthStatusText = 0;
mAuthStatusText = "";
if (!webViewLoginMethod) {
showAuthStatus();
@@ -1867,7 +1785,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
String lastPermanentLocation = authResult.getLastPermanentLocation();
if (lastPermanentLocation != null) {
mServerInfo.mBaseUrl = AccountUtils.trimWebdavSuffix(lastPermanentLocation);
mServerInfo.mBaseUrl = AuthenticatorUrlUtils.trimWebdavSuffix(lastPermanentLocation);
}
Uri uri = Uri.parse(mServerInfo.mBaseUrl);
@@ -1991,7 +1909,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
* to the last check on the ownCloud server.
*/
private void showServerStatus() {
if (mServerStatusIcon == 0 && mServerStatusText == 0) {
if (mServerStatusIcon == 0 && "".equals(mServerStatusText)) {
mServerStatusView.setVisibility(View.INVISIBLE);
} else {
mServerStatusView.setText(mServerStatusText);
@@ -2006,7 +1924,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
* to the interactions with the OAuth authorization server.
*/
private void showAuthStatus() {
if (mAuthStatusIcon == 0 && mAuthStatusText == 0) {
if (mAuthStatusIcon == 0 && "".equals(mAuthStatusText)) {
mAuthStatusView.setVisibility(View.INVISIBLE);
} else {
mAuthStatusView.setText(mAuthStatusText);
@@ -2217,7 +2135,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
@Override
public void onFailedSavingCertificate() {
dismissDialog(SAML_DIALOG_TAG);
Toast.makeText(this, R.string.ssl_validator_not_saved, Toast.LENGTH_LONG).show();
showSnackMessage(R.string.ssl_validator_not_saved);
}
@Override
@@ -2295,11 +2213,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
dialog.show(ft, CREDENTIALS_DIALOG_TAG);
if (!mIsFirstAuthAttempt) {
Toast.makeText(
getApplicationContext(),
getText(R.string.saml_authentication_wrong_pass),
Toast.LENGTH_LONG
).show();
showSnackMessage(R.string.saml_authentication_wrong_pass);
} else {
mIsFirstAuthAttempt = false;
}
@@ -2311,4 +2225,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
public void doNegativeAuthenticatioDialogClick() {
mIsFirstAuthAttempt = true;
}
private void showSnackMessage(int messageResource) {
Snackbar.make(findViewById(android.R.id.content), messageResource, Snackbar.LENGTH_LONG).show();
}
}
@@ -0,0 +1,130 @@
/*
* Nextcloud Android client application
*
* @author Andy Scherzinger
* Copyright (C) 2017 Andy Scherzinger
* Copyright (C) 2012 Bartek Przybylski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.authentication;
import com.owncloud.android.MainApp;
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
/**
* Helper class for authenticator-URL related logic.
*/
public abstract class AuthenticatorUrlUtils {
public static final String WEBDAV_PATH_4_0_AND_LATER = "/remote.php/webdav";
private static final String HTTPS_PROTOCOL = "https://";
private static final String HTTP_PROTOCOL = "http://";
private static final String ODAV_PATH = "/remote.php/odav";
private static final String SAML_SSO_PATH = "/remote.php/webdav";
/**
* Returns the proper URL path to access the WebDAV interface of an ownCloud server,
* according to its version and the authorization method used.
*
* @param version Version of ownCloud server.
* @param authTokenType Authorization token type, matching some of the AUTH_TOKEN_TYPE_* constants in
* {@link AccountAuthenticator}.
* @return WebDAV path for given OC version and authorization method, null if OC version
* is unknown; versions prior to ownCloud 4 are not supported anymore
*/
public static String getWebdavPath(OwnCloudVersion version, String authTokenType) {
if (version != null) {
if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()).equals(authTokenType)) {
return ODAV_PATH;
}
if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(authTokenType)) {
return SAML_SSO_PATH;
}
return WEBDAV_PATH_4_0_AND_LATER;
}
return null;
}
public static String normalizeUrlSuffix(String url) {
String normalizedUrl = url;
if (normalizedUrl.endsWith("/")) {
normalizedUrl = normalizedUrl.substring(0, normalizedUrl.length() - 1);
}
return trimUrlWebdav(normalizedUrl);
}
public static String normalizeUrl(String url, boolean sslWhenUnprefixed) {
String normalizedUrl = url;
if (normalizedUrl != null && normalizedUrl.length() > 0) {
normalizedUrl = normalizedUrl.trim();
if (!normalizedUrl.toLowerCase().startsWith(HTTP_PROTOCOL) &&
!normalizedUrl.toLowerCase().startsWith(HTTP_PROTOCOL)) {
if (sslWhenUnprefixed) {
normalizedUrl = HTTPS_PROTOCOL + normalizedUrl;
} else {
normalizedUrl = HTTP_PROTOCOL + normalizedUrl;
}
}
normalizedUrl = normalizeUrlSuffix(normalizedUrl);
}
return (normalizedUrl != null ? normalizedUrl : "");
}
public static String trimWebdavSuffix(String url) {
String trimmedUrl = url;
while(trimmedUrl.endsWith("/")) {
trimmedUrl = trimmedUrl.substring(0, url.length() - 1);
}
int pos = trimmedUrl.lastIndexOf(WEBDAV_PATH_4_0_AND_LATER);
if (pos >= 0) {
trimmedUrl = trimmedUrl.substring(0, pos);
} else {
pos = trimmedUrl.lastIndexOf(ODAV_PATH);
if (pos >= 0) {
trimmedUrl = trimmedUrl.substring(0, pos);
}
}
return trimmedUrl;
}
private static String trimUrlWebdav(String url) {
if (url.toLowerCase().endsWith(WEBDAV_PATH_4_0_AND_LATER)) {
return url.substring(0, url.length() - WEBDAV_PATH_4_0_AND_LATER.length());
}
return url;
}
public static String stripIndexPhpOrAppsFiles(String url) {
String strippedUrl = url;
if (strippedUrl.endsWith("/index.php")) {
strippedUrl = strippedUrl.substring(0, strippedUrl.lastIndexOf("/index.php"));
} else if (strippedUrl.contains("/index.php/apps/")) {
strippedUrl = strippedUrl.substring(0, strippedUrl.lastIndexOf("/index.php/apps/"));
}
return strippedUrl;
}
}
@@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author Tobias Kaminsky
@@ -22,19 +22,23 @@
package com.owncloud.android.datamodel;
import android.accounts.Account;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.MediaMetadataRetriever;
import android.media.ThumbnailUtils;
import android.net.Uri;
import android.os.AsyncTask;
import android.view.Display;
import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.ImageView;
import com.owncloud.android.MainApp;
@@ -47,7 +51,9 @@ import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.ui.adapter.DiskLruImageCache;
import com.owncloud.android.ui.preview.PreviewImageFragment;
import com.owncloud.android.utils.BitmapUtils;
import com.owncloud.android.utils.ConnectivityUtils;
import com.owncloud.android.utils.DisplayUtils.AvatarGenerationListener;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.MimeTypeUtil;
@@ -56,6 +62,7 @@ import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -66,16 +73,16 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
* Manager for concurrent access to thumbnails cache.
*/
public class ThumbnailsCacheManager {
private static final String TAG = ThumbnailsCacheManager.class.getSimpleName();
private static final String CACHE_FOLDER = "thumbnailCache";
private static final Object mThumbnailsDiskCacheLock = new Object();
private static DiskLruImageCache mThumbnailCache = null;
private static boolean mThumbnailCacheStarting = true;
private static final int DISK_CACHE_SIZE = 1024 * 1024 * 10; // 10MB
private static final int DISK_CACHE_SIZE = 1024 * 1024 * 200; // 200MB
private static final CompressFormat mCompressFormat = CompressFormat.JPEG;
private static final int mCompressQuality = 70;
private static OwnCloudClient mClient = null;
@@ -92,7 +99,7 @@ public class ThumbnailsCacheManager {
R.drawable.file_movie
);
public static class InitDiskCacheTask extends AsyncTask<File, Void, Void> {
@Override
@@ -104,19 +111,19 @@ public class ThumbnailsCacheManager {
try {
// Check if media is mounted or storage is built-in, if so,
// try and use external cache dir; otherwise use internal cache dir
final String cachePath =
MainApp.getAppContext().getExternalCacheDir().getPath() +
File.separator + CACHE_FOLDER;
Log_OC.d(TAG, "create dir: " + cachePath);
final File diskCacheDir = new File(cachePath);
mThumbnailCache = new DiskLruImageCache(
diskCacheDir,
DISK_CACHE_SIZE,
mCompressFormat,
mCompressQuality
);
} catch (Exception e) {
Log_OC.d(TAG, "Thumbnail cache could not be opened ", e);
File cacheDir = MainApp.getAppContext().getExternalCacheDir();
if (cacheDir != null) {
String cachePath = cacheDir.getPath() + File.separator + CACHE_FOLDER;
Log_OC.d(TAG, "create dir: " + cachePath);
File diskCacheDir = new File(cachePath);
mThumbnailCache = new DiskLruImageCache(diskCacheDir, DISK_CACHE_SIZE, mCompressFormat,
mCompressQuality);
} else {
throw new FileNotFoundException("Thumbnail cache could not be opened");
}
} catch (java.io.IOException e) {
Log_OC.d(TAG, e.getMessage());
mThumbnailCache = null;
}
}
@@ -129,36 +136,53 @@ public class ThumbnailsCacheManager {
/**
* Converts size of file icon from dp to pixel
*
* @return int
*/
private static int getThumbnailDimension(){
private static int getThumbnailDimension() {
// Converts dp to pixel
Resources r = MainApp.getAppContext().getResources();
return Math.round(r.getDimension(R.dimen.file_icon_size_grid));
}
/**
* Converts dimension of screen as point
*
* @return Point
*/
private static Point getScreenDimension() {
WindowManager wm = (WindowManager) MainApp.getAppContext().
getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point point = new Point();
display.getSize(point);
return point;
}
/**
* Add thumbnail to cache
*
* @param imageKey: thumb key
* @param bitmap: image for extracting thumbnail
* @param path: image path
* @param px: thumbnail dp
* @param pxW: thumbnail width in pixel
* @param pxH: thumbnail height in pixel
* @return Bitmap
*/
private static Bitmap addThumbnailToCache(String imageKey, Bitmap bitmap, String path, int px){
private static Bitmap addThumbnailToCache(String imageKey, Bitmap bitmap, String path, int pxW, int pxH) {
Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px);
Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, pxW, pxH);
// Rotate image, obeying exif tag
thumbnail = BitmapUtils.rotateImage(thumbnail,path);
thumbnail = BitmapUtils.rotateImage(thumbnail, path);
// Add thumbnail to cache
addBitmapToCache(imageKey, thumbnail);
return thumbnail;
}
public static void addBitmapToCache(String key, Bitmap bitmap) {
private static void addBitmapToCache(String key, Bitmap bitmap) {
synchronized (mThumbnailsDiskCacheLock) {
if (mThumbnailCache != null) {
mThumbnailCache.put(key, bitmap);
@@ -183,198 +207,118 @@ public class ThumbnailsCacheManager {
return null;
}
public static class ThumbnailGenerationTask extends AsyncTask<Object, Void, Bitmap> {
private final WeakReference<ImageView> mImageViewReference;
private static Account mAccount;
private ArrayList<ThumbnailGenerationTask> mAsyncTasks = null;
private Object mFile;
private String mImageKey = null;
private FileDataStorageManager mStorageManager;
private GetMethod getMethod;
public static class ResizedImageGenerationTask extends AsyncTask<Object, Void, Bitmap> {
private PreviewImageFragment previewImageFragment;
private FileDataStorageManager storageManager;
private Account account;
private WeakReference<ImageView> imageViewReference;
private OCFile file;
public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager, Account account)
public ResizedImageGenerationTask(PreviewImageFragment previewImageFragment, ImageView imageView,
FileDataStorageManager storageManager, Account account)
throws IllegalArgumentException {
this(imageView, storageManager, account, null);
this.previewImageFragment = previewImageFragment;
imageViewReference = new WeakReference<>(imageView);
this.storageManager = storageManager;
this.account = account;
}
public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager,
Account account, ArrayList<ThumbnailGenerationTask> asyncTasks)
throws IllegalArgumentException {
// Use a WeakReference to ensure the ImageView can be garbage collected
mImageViewReference = new WeakReference<ImageView>(imageView);
if (storageManager == null) {
throw new IllegalArgumentException("storageManager must not be NULL");
}
mStorageManager = storageManager;
mAccount = account;
mAsyncTasks = asyncTasks;
}
public GetMethod getGetMethod() {
return getMethod;
}
public ThumbnailGenerationTask(FileDataStorageManager storageManager, Account account){
if (storageManager == null) {
throw new IllegalArgumentException("storageManager must not be NULL");
}
mStorageManager = storageManager;
mAccount = account;
mImageViewReference = null;
}
public ThumbnailGenerationTask(ImageView imageView) {
// Use a WeakReference to ensure the ImageView can be garbage collected
mImageViewReference = new WeakReference<ImageView>(imageView);
}
@SuppressFBWarnings("Dm")
@Override
protected Bitmap doInBackground(Object... params) {
Bitmap thumbnail = null;
file = (OCFile) params[0];
try {
if (mAccount != null) {
OwnCloudAccount ocAccount = new OwnCloudAccount(
mAccount,
MainApp.getAppContext()
);
mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
getClientFor(ocAccount, MainApp.getAppContext());
if (account != null) {
OwnCloudAccount ocAccount = new OwnCloudAccount(account, MainApp.getAppContext());
mClient = OwnCloudClientManagerFactory.getDefaultSingleton().getClientFor(ocAccount,
MainApp.getAppContext());
}
mFile = params[0];
if (params.length == 2) {
mImageKey = (String) params[1];
thumbnail = doResizedImageInBackground();
if (MimeTypeUtil.isVideo(file) && thumbnail != null) {
thumbnail = addVideoOverlay(thumbnail);
}
if (mFile instanceof OCFile) {
thumbnail = doOCFileInBackground();
if (MimeTypeUtil.isVideo((OCFile) mFile) && thumbnail != null) {
thumbnail = addVideoOverlay(thumbnail);
}
} else if (mFile instanceof File) {
thumbnail = doFileInBackground();
String url = ((File) mFile).getAbsolutePath();
String mMimeType = FileStorageUtils.getMimeTypeFromName(url);
if (MimeTypeUtil.isVideo(mMimeType) && thumbnail != null) {
thumbnail = addVideoOverlay(thumbnail);
}
//} else { do nothing
}
} catch(OutOfMemoryError oome) {
} catch (OutOfMemoryError oome) {
System.gc();
} catch (Throwable t) {
// the app should never break due to a problem with thumbnails
Log_OC.e(TAG, "Generation of thumbnail for " + mFile + " failed", t);
Log_OC.e(TAG, "Generation of thumbnail for " + file + " failed", t);
}
return thumbnail;
}
protected void onPostExecute(Bitmap bitmap){
if (bitmap != null && mImageViewReference != null) {
final ImageView imageView = mImageViewReference.get();
final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
if (this == bitmapWorkerTask) {
String tagId = "";
if (mFile instanceof OCFile){
tagId = String.valueOf(((OCFile)mFile).getFileId());
} else if (mFile instanceof File){
tagId = String.valueOf(mFile.hashCode());
}
if (String.valueOf(imageView.getTag()).equals(tagId)) {
imageView.setImageBitmap(bitmap);
}
}
}
private Bitmap doResizedImageInBackground() {
Bitmap thumbnail;
if (mAsyncTasks != null) {
mAsyncTasks.remove(this);
}
}
/**
* Converts size of file icon from dp to pixel
* @return int
*/
private int getThumbnailDimension(){
// Converts dp to pixel
Resources r = MainApp.getAppContext().getResources();
Double d = Math.pow(2,Math.floor(Math.log(r.getDimension(R.dimen.file_icon_size_grid))/Math.log(2)));
return d.intValue();
}
private Bitmap doOCFileInBackground() {
OCFile file = (OCFile)mFile;
final String imageKey = String.valueOf(file.getRemoteId());
String imageKey = "r" + String.valueOf(file.getRemoteId());
// Check disk cache in background thread
Bitmap thumbnail = getBitmapFromDiskCache(imageKey);
thumbnail = getBitmapFromDiskCache(imageKey);
// Not found in disk cache
if (thumbnail == null || file.needsUpdateThumbnail()) {
int px = getThumbnailDimension();
Point p = getScreenDimension();
int pxW = p.x;
int pxH = p.y;
if (file.isDown()) {
Bitmap temp = BitmapUtils.decodeSampledBitmapFromFile(
file.getStoragePath(), px, px);
Bitmap bitmap = ThumbnailUtils.extractThumbnail(temp, px, px);
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(
file.getStoragePath(), pxW, pxH);
if (bitmap != null) {
// Handle PNG
if (file.getMimetype().equalsIgnoreCase("image/png")) {
bitmap = handlePNG(bitmap, px);
bitmap = handlePNG(bitmap, pxW);
}
thumbnail = addThumbnailToCache(imageKey, bitmap, file.getStoragePath(), px);
thumbnail = addThumbnailToCache(imageKey, bitmap, file.getStoragePath(), pxW, pxH);
file.setNeedsUpdateThumbnail(false);
mStorageManager.saveFile(file);
storageManager.saveFile(file);
}
} else {
// Download thumbnail from server
OwnCloudVersion serverOCVersion = AccountUtils.getServerVersion(mAccount);
OwnCloudVersion serverOCVersion = AccountUtils.getServerVersion(account);
if (mClient != null && serverOCVersion != null) {
if (serverOCVersion.supportsRemoteThumbnails()) {
getMethod = null;
GetMethod getMethod = null;
try {
// resized image via gallery app
String uri = mClient.getBaseUri() + "" +
"/index.php/apps/files/api/v1/thumbnail/" +
px + "/" + px + Uri.encode(file.getRemotePath(), "/");
Log_OC.d("Thumbnail", "URI: " + uri);
"/index.php/apps/gallery/api/preview/" +
Integer.parseInt(file.getRemoteId().substring(0, 8)) +
"/" + pxW + "/" + pxH;
Log_OC.d(TAG, "generate resizedImage: " + file.getFileName() +
" URI: " + uri);
getMethod = new GetMethod(uri);
getMethod.setRequestHeader("Cookie",
"nc_sameSiteCookielax=true;nc_sameSiteCookiestrict=true");
getMethod.setRequestHeader(RemoteOperation.OCS_API_HEADER,
RemoteOperation.OCS_API_HEADER_VALUE);
int status = mClient.executeMethod(getMethod);
if (status == HttpStatus.SC_OK) {
InputStream inputStream = getMethod.getResponseBodyAsStream();
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px);
// Handle PNG
if (file.getMimetype().equalsIgnoreCase("image/png")) {
thumbnail = handlePNG(thumbnail, px);
}
// Add thumbnail to cache
if (thumbnail != null) {
addBitmapToCache(imageKey, thumbnail);
}
thumbnail = BitmapFactory.decodeStream(inputStream);
} else {
mClient.exhaustResponse(getMethod.getResponseBodyAsStream());
}
// Handle PNG
if (file.getMimetype().equalsIgnoreCase("image/png")) {
thumbnail = handlePNG(thumbnail, pxW);
}
// Add thumbnail to cache
if (thumbnail != null) {
Log_OC.d(TAG, "add thumbnail to cache: " + file.getFileName());
addBitmapToCache(imageKey, thumbnail);
}
} catch (Exception e) {
Log_OC.d(TAG, e.getMessage(), e);
} finally {
@@ -393,8 +337,265 @@ public class ThumbnailsCacheManager {
}
protected void onPostExecute(Bitmap bitmap) {
if (imageViewReference != null) {
final ImageView imageView = imageViewReference.get();
if (bitmap != null) {
final ResizedImageGenerationTask bitmapWorkerTask = getResizedImageGenerationWorkerTask(imageView);
if (this == bitmapWorkerTask) {
String tagId = String.valueOf(file.getFileId());
if (String.valueOf(imageView.getTag()).equals(tagId)) {
imageView.setImageBitmap(bitmap);
}
}
} else {
if (ConnectivityUtils.isAppConnected(MainApp.getAppContext())) {
previewImageFragment.setErrorPreviewMessage();
} else {
previewImageFragment.setNoConnectionErrorMessage();
}
}
}
}
}
public static class ThumbnailGenerationTaskObject {
private Object file;
private String imageKey;
public ThumbnailGenerationTaskObject(Object file, String imageKey) {
this.file = file;
this.imageKey = imageKey;
}
private Object getFile() {
return file;
}
private String getImageKey() {
return imageKey;
}
}
public static class ThumbnailGenerationTask extends AsyncTask<ThumbnailGenerationTaskObject, Void, Bitmap> {
private final WeakReference<ImageView> mImageViewReference;
private static Account mAccount;
private ArrayList<ThumbnailGenerationTask> mAsyncTasks = null;
private Object mFile;
private String mImageKey = null;
private FileDataStorageManager mStorageManager;
private GetMethod getMethod;
public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager, Account account)
throws IllegalArgumentException {
this(imageView, storageManager, account, null);
}
public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager,
Account account, ArrayList<ThumbnailGenerationTask> asyncTasks)
throws IllegalArgumentException {
// Use a WeakReference to ensure the ImageView can be garbage collected
mImageViewReference = new WeakReference<>(imageView);
if (storageManager == null) {
throw new IllegalArgumentException("storageManager must not be NULL");
}
mStorageManager = storageManager;
mAccount = account;
mAsyncTasks = asyncTasks;
}
public GetMethod getGetMethod() {
return getMethod;
}
public ThumbnailGenerationTask(FileDataStorageManager storageManager, Account account) {
if (storageManager == null) {
throw new IllegalArgumentException("storageManager must not be NULL");
}
mStorageManager = storageManager;
mAccount = account;
mImageViewReference = null;
}
public ThumbnailGenerationTask(ImageView imageView) {
// Use a WeakReference to ensure the ImageView can be garbage collected
mImageViewReference = new WeakReference<>(imageView);
}
@SuppressFBWarnings("Dm")
@Override
protected Bitmap doInBackground(ThumbnailGenerationTaskObject... params) {
Bitmap thumbnail = null;
try {
if (mAccount != null) {
OwnCloudAccount ocAccount = new OwnCloudAccount(
mAccount,
MainApp.getAppContext()
);
mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
getClientFor(ocAccount, MainApp.getAppContext());
}
ThumbnailGenerationTaskObject object = params[0];
mFile = object.getFile();
mImageKey = object.getImageKey();
if (mFile instanceof OCFile) {
thumbnail = doThumbnailFromOCFileInBackground();
if (MimeTypeUtil.isVideo((OCFile) mFile) && thumbnail != null) {
thumbnail = addVideoOverlay(thumbnail);
}
} else if (mFile instanceof File) {
thumbnail = doFileInBackground();
String url = ((File) mFile).getAbsolutePath();
String mMimeType = FileStorageUtils.getMimeTypeFromName(url);
if (MimeTypeUtil.isVideo(mMimeType) && thumbnail != null) {
thumbnail = addVideoOverlay(thumbnail);
}
//} else { do nothing
}
} catch (OutOfMemoryError oome) {
System.gc();
} catch (Throwable t) {
// the app should never break due to a problem with thumbnails
Log_OC.e(TAG, "Generation of thumbnail for " + mFile + " failed", t);
}
return thumbnail;
}
protected void onPostExecute(Bitmap bitmap) {
if (bitmap != null && mImageViewReference != null) {
final ImageView imageView = mImageViewReference.get();
final ThumbnailGenerationTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
if (this == bitmapWorkerTask) {
String tagId = "";
if (mFile instanceof OCFile) {
tagId = String.valueOf(((OCFile) mFile).getFileId());
} else if (mFile instanceof File) {
tagId = String.valueOf(mFile.hashCode());
}
if (String.valueOf(imageView.getTag()).equals(tagId)) {
imageView.setImageBitmap(bitmap);
}
}
}
if (mAsyncTasks != null) {
mAsyncTasks.remove(this);
}
}
private Bitmap doThumbnailFromOCFileInBackground() {
Bitmap thumbnail;
OCFile file = (OCFile) mFile;
String imageKey = "t" + String.valueOf(file.getRemoteId());
// Check disk cache in background thread
thumbnail = getBitmapFromDiskCache(imageKey);
// Not found in disk cache
if (thumbnail == null || file.needsUpdateThumbnail()) {
int pxW;
int pxH;
pxW = pxH = getThumbnailDimension();
if (file.isDown()) {
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(
file.getStoragePath(), pxW, pxH);
if (bitmap != null) {
// Handle PNG
if (file.getMimetype().equalsIgnoreCase("image/png")) {
bitmap = handlePNG(bitmap, pxW);
}
thumbnail = addThumbnailToCache(imageKey, bitmap, file.getStoragePath(), pxW, pxH);
file.setNeedsUpdateThumbnail(false);
mStorageManager.saveFile(file);
}
} else {
// Download thumbnail from server
OwnCloudVersion serverOCVersion = AccountUtils.getServerVersion(mAccount);
if (mClient != null && serverOCVersion != null) {
if (serverOCVersion.supportsRemoteThumbnails()) {
getMethod = null;
try {
// thumbnail
String uri = mClient.getBaseUri() + "" +
"/index.php/apps/files/api/v1/thumbnail/" +
pxW + "/" + pxH + Uri.encode(file.getRemotePath(), "/");
Log_OC.d(TAG, "generate thumbnail: " + file.getFileName() +
" URI: " + uri);
getMethod = new GetMethod(uri);
getMethod.setRequestHeader("Cookie",
"nc_sameSiteCookielax=true;nc_sameSiteCookiestrict=true");
getMethod.setRequestHeader(RemoteOperation.OCS_API_HEADER,
RemoteOperation.OCS_API_HEADER_VALUE);
int status = mClient.executeMethod(getMethod);
if (status == HttpStatus.SC_OK) {
InputStream inputStream = getMethod.getResponseBodyAsStream();
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
thumbnail = ThumbnailUtils.extractThumbnail(bitmap, pxW, pxH);
} else {
mClient.exhaustResponse(getMethod.getResponseBodyAsStream());
}
// Handle PNG
if (file.getMimetype().equalsIgnoreCase("image/png")) {
thumbnail = handlePNG(thumbnail, pxW);
}
// Add thumbnail to cache
if (thumbnail != null) {
Log_OC.d(TAG, "add thumbnail to cache: " + file.getFileName());
addBitmapToCache(imageKey, thumbnail);
}
} catch (Exception e) {
Log_OC.d(TAG, e.getMessage(), e);
} finally {
if (getMethod != null) {
getMethod.releaseConnection();
}
}
} else {
Log_OC.d(TAG, "Server too old");
}
}
}
}
return thumbnail;
}
/**
* Converts size of file icon from dp to pixel
*
* @return int
*/
private int getThumbnailDimension() {
// Converts dp to pixel
Resources r = MainApp.getAppContext().getResources();
Double d = Math.pow(2, Math.floor(Math.log(r.getDimension(R.dimen.file_icon_size_grid)) / Math.log(2)));
return d.intValue();
}
private Bitmap doFileInBackground() {
File file = (File)mFile;
File file = (File) mFile;
final String imageKey;
if (mImageKey != null) {
@@ -403,19 +604,22 @@ public class ThumbnailsCacheManager {
imageKey = String.valueOf(file.hashCode());
}
// local file should always generate a thumbnail
mImageKey = "t" + mImageKey;
// Check disk cache in background thread
Bitmap thumbnail = getBitmapFromDiskCache(imageKey);
// Not found in disk cache
if (thumbnail == null) {
int pxW;
int pxH;
pxW = pxH = getThumbnailDimension();
int px = getThumbnailDimension();
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(
file.getAbsolutePath(), px, px);
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(file.getAbsolutePath(), pxW, pxH);
if (bitmap != null) {
thumbnail = addThumbnailToCache(imageKey, bitmap, file.getPath(), px);
thumbnail = addThumbnailToCache(imageKey, bitmap, file.getPath(), pxW, pxH);
}
}
return thumbnail;
@@ -512,7 +716,7 @@ public class ThumbnailsCacheManager {
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(file.getAbsolutePath(), px, px);
if (bitmap != null) {
thumbnail = addThumbnailToCache(imageKey, bitmap, file.getPath(), px);
thumbnail = addThumbnailToCache(imageKey, bitmap, file.getPath(), px, px);
}
} else if (Type.VIDEO.equals(type)) {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
@@ -539,7 +743,7 @@ public class ThumbnailsCacheManager {
int max = Math.max(width, height);
if (max > px) {
thumbnail = BitmapUtils.scaleBitmap(thumbnail, px, width, height, max);
thumbnail = addThumbnailToCache(imageKey, thumbnail, file.getPath(), px);
thumbnail = addThumbnailToCache(imageKey, thumbnail, file.getPath(), px, px);
}
}
}
@@ -582,9 +786,9 @@ public class ThumbnailsCacheManager {
mUsername = params[0];
thumbnail = doAvatarInBackground();
} catch(OutOfMemoryError oome) {
} catch (OutOfMemoryError oome) {
System.gc(); // todo, does this really make sense?
} catch(Throwable t){
} catch (Throwable t) {
// the app should never break due to a problem with avatars
Log_OC.e(TAG, "Generation of avatar for " + mUsername + " failed", t);
}
@@ -598,37 +802,17 @@ public class ThumbnailsCacheManager {
AvatarGenerationTask avatarWorkerTask = getAvatarWorkerTask(mCallContext);
if (this == avatarWorkerTask
&& listener.shouldCallGeneratedCallback(mUsername, mCallContext)) {
listener.avatarGenerated(new BitmapDrawable(bitmap), mCallContext);
}
listener.avatarGenerated(new BitmapDrawable(bitmap), mCallContext);
}
}
}
/**
* Add thumbnail to cache
* @param imageKey: thumb key
* @param bitmap: image for extracting thumbnail
* @param path: image path
* @param px: thumbnail dp
* @return Bitmap
*/
private Bitmap addThumbnailToCache(String imageKey, Bitmap bitmap, String path, int px){
Bitmap thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px);
// Rotate image, obeying exif tag
thumbnail = BitmapUtils.rotateImage(thumbnail,path);
// Add thumbnail to cache
addBitmapToCache(imageKey, thumbnail);
return thumbnail;
}
/**
* Converts size of file icon from dp to pixel
*
* @return int
*/
private int getAvatarDimension(){
private int getAvatarDimension() {
// Converts dp to pixel
Resources r = MainApp.getAppContext().getResources();
return Math.round(r.getDimension(R.dimen.file_avatar_size));
@@ -710,13 +894,13 @@ public class ThumbnailsCacheManager {
if (callContext instanceof ImageView) {
return cancelPotentialAvatarWork(file, (ImageView) callContext);
} else if (callContext instanceof MenuItem) {
return cancelPotentialAvatarWork(file, (MenuItem)callContext);
return cancelPotentialAvatarWork(file, (MenuItem) callContext);
}
return false;
}
public static boolean cancelPotentialAvatarWork(Object file, ImageView imageView) {
private static boolean cancelPotentialAvatarWork(Object file, ImageView imageView) {
final AvatarGenerationTask avatarWorkerTask = getAvatarWorkerTask(imageView);
if (avatarWorkerTask != null) {
@@ -735,7 +919,7 @@ public class ThumbnailsCacheManager {
return true;
}
public static boolean cancelPotentialAvatarWork(Object file, MenuItem menuItem) {
private static boolean cancelPotentialAvatarWork(Object file, MenuItem menuItem) {
final AvatarGenerationTask avatarWorkerTask = getAvatarWorkerTask(menuItem);
if (avatarWorkerTask != null) {
@@ -754,7 +938,7 @@ public class ThumbnailsCacheManager {
return true;
}
public static ThumbnailGenerationTask getBitmapWorkerTask(ImageView imageView) {
private static ThumbnailGenerationTask getBitmapWorkerTask(ImageView imageView) {
if (imageView != null) {
final Drawable drawable = imageView.getDrawable();
if (drawable instanceof AsyncThumbnailDrawable) {
@@ -765,7 +949,18 @@ public class ThumbnailsCacheManager {
return null;
}
public static Bitmap addVideoOverlay(Bitmap thumbnail){
private static ResizedImageGenerationTask getResizedImageGenerationWorkerTask(ImageView imageView) {
if (imageView != null) {
final Drawable drawable = imageView.getDrawable();
if (drawable instanceof AsyncResizedImageDrawable) {
final AsyncResizedImageDrawable asyncDrawable = (AsyncResizedImageDrawable) drawable;
return asyncDrawable.getBitmapWorkerTask();
}
}
return null;
}
public static Bitmap addVideoOverlay(Bitmap thumbnail) {
Bitmap playButton = BitmapFactory.decodeResource(MainApp.getAppContext().getResources(),
R.drawable.view_play);
@@ -787,15 +982,15 @@ public class ThumbnailsCacheManager {
int x3 = 0;
int y3 = 0;
double ym = ( ((Math.pow(x3,2) - Math.pow(x1,2) + Math.pow(y3,2) - Math.pow(y1,2)) *
(x2 - x1)) - (Math.pow(x2,2) - Math.pow(x1,2) + Math.pow(y2,2) -
Math.pow(y1,2)) * (x3 - x1) ) / (2 * ( ((y3 - y1) * (x2 - x1)) -
((y2 - y1) * (x3 - x1)) ));
double xm = ( (Math.pow(x2,2) - Math.pow(x1,2)) + (Math.pow(y2,2) - Math.pow(y1,2)) -
(2*ym*(y2 - y1)) ) / (2*(x2 - x1));
double ym = (((Math.pow(x3, 2) - Math.pow(x1, 2) + Math.pow(y3, 2) - Math.pow(y1, 2)) *
(x2 - x1)) - (Math.pow(x2, 2) - Math.pow(x1, 2) + Math.pow(y2, 2) -
Math.pow(y1, 2)) * (x3 - x1)) / (2 * (((y3 - y1) * (x2 - x1)) -
((y2 - y1) * (x3 - x1))));
double xm = ((Math.pow(x2, 2) - Math.pow(x1, 2)) + (Math.pow(y2, 2) - Math.pow(y1, 2)) -
(2 * ym * (y2 - y1))) / (2 * (x2 - x1));
// offset to top left
double ox = - xm;
double ox = -xm;
c.drawBitmap(thumbnail, 0, 0, null);
@@ -809,11 +1004,11 @@ public class ThumbnailsCacheManager {
return resultBitmap;
}
public static AvatarGenerationTask getAvatarWorkerTask(Object callContext) {
private static AvatarGenerationTask getAvatarWorkerTask(Object callContext) {
if (callContext instanceof ImageView) {
return getAvatarWorkerTask(((ImageView)callContext).getDrawable());
return getAvatarWorkerTask(((ImageView) callContext).getDrawable());
} else if (callContext instanceof MenuItem) {
return getAvatarWorkerTask(((MenuItem)callContext).getIcon());
return getAvatarWorkerTask(((MenuItem) callContext).getIcon());
}
return null;
@@ -838,7 +1033,20 @@ public class ThumbnailsCacheManager {
bitmapWorkerTaskReference = new WeakReference<>(bitmapWorkerTask);
}
public ThumbnailGenerationTask getBitmapWorkerTask() {
private ThumbnailGenerationTask getBitmapWorkerTask() {
return bitmapWorkerTaskReference.get();
}
}
public static class AsyncResizedImageDrawable extends BitmapDrawable {
private final WeakReference<ResizedImageGenerationTask> bitmapWorkerTaskReference;
public AsyncResizedImageDrawable(Resources res, Bitmap bitmap, ResizedImageGenerationTask bitmapWorkerTask) {
super(res, bitmap);
bitmapWorkerTaskReference = new WeakReference<>(bitmapWorkerTask);
}
private ResizedImageGenerationTask getBitmapWorkerTask() {
return bitmapWorkerTaskReference.get();
}
}
@@ -846,17 +1054,12 @@ public class ThumbnailsCacheManager {
public static class AsyncMediaThumbnailDrawable extends BitmapDrawable {
private final WeakReference<MediaThumbnailGenerationTask> bitmapWorkerTaskReference;
public AsyncMediaThumbnailDrawable(
Resources res, Bitmap bitmap, MediaThumbnailGenerationTask bitmapWorkerTask
) {
public AsyncMediaThumbnailDrawable(Resources res, Bitmap bitmap,
MediaThumbnailGenerationTask bitmapWorkerTask) {
super(res, bitmap);
bitmapWorkerTaskReference = new WeakReference<>(bitmapWorkerTask);
}
public MediaThumbnailGenerationTask getBitmapWorkerTask() {
return bitmapWorkerTaskReference.get();
}
}
public static class AsyncAvatarDrawable extends BitmapDrawable {
@@ -867,16 +1070,15 @@ public class ThumbnailsCacheManager {
) {
super(res, bitmap);
avatarWorkerTaskReference =
new WeakReference<AvatarGenerationTask>(avatarWorkerTask);
avatarWorkerTaskReference = new WeakReference<>(avatarWorkerTask);
}
public AvatarGenerationTask getAvatarWorkerTask() {
private AvatarGenerationTask getAvatarWorkerTask() {
return avatarWorkerTaskReference.get();
}
}
private static Bitmap handlePNG(Bitmap bitmap, int px){
private static Bitmap handlePNG(Bitmap bitmap, int px) {
Bitmap resultBitmap = Bitmap.createBitmap(px,
px,
Bitmap.Config.ARGB_8888);
@@ -888,4 +1090,22 @@ public class ThumbnailsCacheManager {
return resultBitmap;
}
}
public static void generateResizedImage(OCFile file) {
Point p = getScreenDimension();
int pxW = p.x;
int pxH = p.y;
String imageKey = "r" + String.valueOf(file.getRemoteId());
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(file.getStoragePath(), pxW, pxH);
if (bitmap != null) {
// Handle PNG
if (file.getMimetype().equalsIgnoreCase("image/png")) {
bitmap = handlePNG(bitmap, pxW);
}
addThumbnailToCache(imageKey, bitmap, file.getStoragePath(), pxW, pxH);
}
}
}
@@ -1,18 +1,18 @@
/**
/*
* ownCloud Android client application
*
* @author David A. Velasco
* Copyright (C) 2016 ownCloud Inc.
* <p/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* <p/>
*
* 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.
* <p/>
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -36,7 +36,8 @@ public enum UploadResult {
SERVICE_INTERRUPTED(10),
DELAYED_FOR_CHARGING(11),
MAINTENANCE_MODE(12),
LOCK_FAILED(13);
LOCK_FAILED(13),
SSL_RECOVERABLE_PEER_UNVERIFIED(14);
private final int value;
@@ -80,6 +81,8 @@ public enum UploadResult {
return MAINTENANCE_MODE;
case 13:
return LOCK_FAILED;
case 14:
return SSL_RECOVERABLE_PEER_UNVERIFIED;
}
return null;
}
@@ -95,7 +98,6 @@ public enum UploadResult {
case WRONG_CONNECTION:
case INCORRECT_ADDRESS:
case SSL_ERROR:
case SSL_RECOVERABLE_PEER_UNVERIFIED:
return NETWORK_CONNECTION;
case ACCOUNT_EXCEPTION:
case UNAUTHORIZED:
@@ -116,13 +118,15 @@ public enum UploadResult {
return DELAYED_FOR_WIFI;
case DELAYED_FOR_CHARGING:
return DELAYED_FOR_CHARGING;
case MAINTENANCE_MODE:
return MAINTENANCE_MODE;
case SSL_RECOVERABLE_PEER_UNVERIFIED:
return SSL_RECOVERABLE_PEER_UNVERIFIED;
case UNKNOWN_ERROR:
if (result.getException() instanceof java.io.FileNotFoundException) {
return FILE_ERROR;
}
return UNKNOWN;
case MAINTENANCE_MODE:
return MAINTENANCE_MODE;
case LOCK_FAILED:
return LOCK_FAILED;
default:
@@ -1059,11 +1059,10 @@ public class FileUploader extends Service
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
new ThumbnailsCacheManager.ThumbnailGenerationTask(mStorageManager, mCurrentAccount);
Object[] params = new Object[2];
params[0] = new File(mCurrentUpload.getOriginalStoragePath());
params[1] = mCurrentUpload.getFile().getRemoteId();
File file = new File(mCurrentUpload.getOriginalStoragePath());
String remoteId = mCurrentUpload.getFile().getRemoteId();
task.execute(params);
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(file, remoteId));
}
}
@@ -59,7 +59,7 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
PersistableBundleCompat bundle = params.getExtras();
Account account = AccountUtils.getOwnCloudAccountByName(context, bundle.getString(ACCOUNT, ""));
if (account != null ) {
if (account != null) {
AccountManager am = (AccountManager) context.getSystemService(ACCOUNT_SERVICE);
am.removeAccount(account, this, null);
@@ -112,10 +112,6 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
/** Current focus state */
private AudioFocus mAudioFocus = AudioFocus.NO_FOCUS;
/** 'True' when the current song is streaming from the network */
private boolean mIsStreaming = false;
/** Wifi lock kept to prevents the device from shutting off the radio when streaming a file. */
private WifiLock mWifiLock;
@@ -447,14 +443,14 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
createMediaPlayerIfNeeded();
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
String url = mFile.getStoragePath();
/* Streaming is not possible right now
if (url == null || url.length() <= 0) {
url = AccountUtils.constructFullURLForAccount(this, mAccount) + mFile.getRemotePath();
}
mIsStreaming = url.startsWith("http:") || url.startsWith("https:");
*/
mIsStreaming = false;
//mIsStreaming = false;
mPlayer.setDataSource(url);
mState = State.PREPARING;
@@ -464,9 +460,12 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
mPlayer.prepareAsync();
// prevent the Wifi from going to sleep when streaming
/*
if (mIsStreaming) {
mWifiLock.acquire();
} else if (mWifiLock.isHeld()) {
} else
*/
if (mWifiLock.isHeld()) {
mWifiLock.release();
}
@@ -118,16 +118,15 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
Log_OC.d(TAG, "Authentication method found: " + authenticationMethodToString(authMethod));
if (!authMethod.equals(AuthenticationMethod.UNKNOWN)) {
result = new RemoteOperationResult(true, result.getHttpCode(), null);
result = new RemoteOperationResult(true, result.getHttpCode(), result.getHttpPhrase(), null);
}
ArrayList<Object> data = new ArrayList<Object>();
ArrayList<Object> data = new ArrayList<>();
data.add(authMethod);
result.setData(data);
return result; // same result instance, so that other errors
// can be handled by the caller transparently
}
private String authenticationMethodToString(AuthenticationMethod value) {
switch (value){
case NONE:
@@ -23,7 +23,7 @@ package com.owncloud.android.operations;
import android.content.Context;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorUrlUtils;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@@ -109,20 +109,22 @@ public class GetServerInfoOperation extends RemoteOperation {
new DetectAuthenticationMethodOperation(mContext);
return operation.execute(client);
}
private String trimWebdavSuffix(String url) {
if (url == null) {
url = "";
String trimmedUrl = url;
if (trimmedUrl == null) {
trimmedUrl = "";
} else {
if (url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
if (trimmedUrl.endsWith("/")) {
trimmedUrl = trimmedUrl.substring(0, trimmedUrl.length() - 1);
}
if(url.toLowerCase().endsWith(AccountUtils.WEBDAV_PATH_4_0_AND_LATER)){
url = url.substring(0, url.length() - AccountUtils.WEBDAV_PATH_4_0_AND_LATER.length());
if(trimmedUrl.toLowerCase().endsWith(AuthenticatorUrlUtils.WEBDAV_PATH_4_0_AND_LATER)){
trimmedUrl = trimmedUrl.substring(0,
trimmedUrl.length() - AuthenticatorUrlUtils.WEBDAV_PATH_4_0_AND_LATER.length());
}
}
return url;
return trimmedUrl;
}
@@ -100,15 +100,15 @@ public class OAuth2GetAccessToken extends RemoteOperation {
result = new RemoteOperationResult(ResultCode.OAUTH2_ERROR);
} else {
result = new RemoteOperationResult(true, status, postMethod.getResponseHeaders());
ArrayList<Object> data = new ArrayList<Object>();
result = new RemoteOperationResult(true, postMethod);
ArrayList<Object> data = new ArrayList<>();
data.add(mResultTokenMap);
result.setData(data);
}
} else {
result = new RemoteOperationResult(false, postMethod);
client.exhaustResponse(postMethod.getResponseBodyAsStream());
result = new RemoteOperationResult(false, status, postMethod.getResponseHeaders());
}
}
@@ -22,6 +22,7 @@
package com.owncloud.android.operations;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
@@ -75,6 +76,9 @@ public class RemoveFileOperation extends SyncOperation {
mFileToRemove = getStorageManager().getFileByPath(mRemotePath);
// store resized image
ThumbnailsCacheManager.generateResizedImage(mFileToRemove);
boolean localRemovalFailed = false;
if (!mOnlyLocalCopy) {
RemoveRemoteFileOperation operation = new RemoveRemoteFileOperation(mRemotePath);
@@ -24,7 +24,6 @@ import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
import com.owncloud.android.lib.common.operations.RemoteOperation;
@@ -46,6 +45,8 @@ public class UpdateOCVersionOperation extends RemoteOperation {
private static final String TAG = UpdateOCVersionOperation.class.getSimpleName();
private static final String STATUS_PATH = "/status.php";
private Account mAccount;
private Context mContext;
private OwnCloudVersion mOwnCloudVersion;
@@ -62,24 +63,24 @@ public class UpdateOCVersionOperation extends RemoteOperation {
protected RemoteOperationResult run(OwnCloudClient client) {
AccountManager accountMngr = AccountManager.get(mContext);
String statUrl = accountMngr.getUserData(mAccount, Constants.KEY_OC_BASE_URL);
statUrl += AccountUtils.STATUS_PATH;
statUrl += STATUS_PATH;
RemoteOperationResult result = null;
GetMethod get = null;
GetMethod getMethod = null;
String webDav = client.getWebdavUri().toString();
try {
get = new GetMethod(statUrl);
int status = client.executeMethod(get);
getMethod = new GetMethod(statUrl);
int status = client.executeMethod(getMethod);
if (status != HttpStatus.SC_OK) {
client.exhaustResponse(get.getResponseBodyAsStream());
result = new RemoteOperationResult(false, status, get.getResponseHeaders());
result = new RemoteOperationResult(false, getMethod);
client.exhaustResponse(getMethod.getResponseBodyAsStream());
} else {
String response = get.getResponseBodyAsString();
String response = getMethod.getResponseBodyAsString();
if (response != null) {
JSONObject json = new JSONObject(response);
if (json != null && json.getString("version") != null) {
if (json.getString("version") != null) {
String version = json.getString("version");
mOwnCloudVersion = new OwnCloudVersion(version);
@@ -112,8 +113,8 @@ public class UpdateOCVersionOperation extends RemoteOperation {
Log_OC.e(TAG, "Check for update of ownCloud server version at " + webDav + ": " + result.getLogMessage(), e);
} finally {
if (get != null) {
get.releaseConnection();
if (getMethod != null) {
getMethod.releaseConnection();
}
}
return result;
@@ -888,7 +888,7 @@ public class UploadFileOperation extends SyncOperation {
// generate new Thumbnail
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
new ThumbnailsCacheManager.ThumbnailGenerationTask(getStorageManager(), mAccount);
task.execute(file);
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(file, file.getRemoteId()));
}
private void updateOCFile(OCFile file, RemoteFile remoteFile) {
@@ -0,0 +1,141 @@
/*
* ownCloud Android client application
*
* Copyright (C) 2016 Tobias Kaminsky
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.providers;
import android.accounts.Account;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.provider.OpenableColumns;
import com.owncloud.android.MainApp;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
import com.owncloud.android.lib.common.utils.Log_OC;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public class DiskLruImageCacheFileProvider extends ContentProvider {
public static final String AUTHORITY = "org.nextcloud.imageCache.provider";
public static final String TAG = DiskLruImageCacheFileProvider.class.getSimpleName();
@Override
public boolean onCreate() {
return true;
}
private OCFile getFile(Uri uri) {
Account account = AccountUtils.getCurrentOwnCloudAccount(MainApp.getAppContext());
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(account,
MainApp.getAppContext().getContentResolver());
return fileDataStorageManager.getFileByPath(uri.getPath());
}
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
OCFile ocFile = getFile(uri);
Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(String.valueOf("r" + ocFile.getRemoteId()));
// fallback to thumbnail
if (thumbnail == null) {
thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(String.valueOf("t" + ocFile.getRemoteId()));
}
// fallback to default image
if (thumbnail == null) {
thumbnail = ThumbnailsCacheManager.mDefaultImg;
}
// create a file to write bitmap data
File f = new File(MainApp.getAppContext().getCacheDir(), ocFile.getFileName());
try {
f.createNewFile();
//Convert bitmap to byte array
ByteArrayOutputStream bos = new ByteArrayOutputStream();
thumbnail.compress(Bitmap.CompressFormat.JPEG, 90, bos);
byte[] bitmapData = bos.toByteArray();
//write the bytes in file
FileOutputStream fos = null;
try {
fos = new FileOutputStream(f);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
fos.write(bitmapData);
fos.flush();
fos.close();
} catch (Exception e) {
Log_OC.e(TAG, "Error opening file: " + e.getMessage());
}
return ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
}
@Override
public String getType(Uri uri) {
OCFile ocFile = getFile(uri);
return ocFile.getMimetype();
}
@Override
public Cursor query(Uri uri, String[] arg1, String arg2, String[] arg3, String arg4) {
MatrixCursor cursor = null;
OCFile ocFile = getFile(uri);
File file = new File(MainApp.getAppContext().getCacheDir(), ocFile.getFileName());
if (file.exists()) {
cursor = new MatrixCursor(new String[] {
OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE });
cursor.addRow(new Object[] { uri.getLastPathSegment(),
file.length() });
}
return cursor;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
return null;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
return 0;
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
return 0;
}
}
@@ -363,7 +363,7 @@ public class FileObserverService extends Service {
&& downloadedFile.exists()) {
// no matter if the download was successful or not; the
// file could be down anyway due to a former download or upload
observer.startWatching(downloadedFile.getName());
// observer.startWatching(downloadedFile.getName());
Log_OC.d(TAG, "Resuming observance of " + downloadedFile.getAbsolutePath());
} else if (intent.getAction().equals(FileDownloader.getDownloadAddedMessage())) {
@@ -26,8 +26,8 @@ import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.graphics.PorterDuff;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.widget.SwipeRefreshLayout;
@@ -618,7 +618,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
ArrayList<Account> persistingAccounts = new ArrayList<>();
for (Account acc: accounts) {
for (Account acc : accounts) {
boolean pendingForRemoval = arbitraryDataProvider.getBooleanValue(acc,
ManageAccountsActivity.PENDING_FOR_REMOVAL);
@@ -669,7 +669,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
mNavigationView.getMenu().removeGroup(R.id.drawer_menu_accounts);
// add all accounts to list
for (Account account: accounts) {
for (Account account : accounts) {
try {
// show all accounts except the currently active one and those pending for removal
@@ -1207,7 +1207,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
ArrayList<Account> persistingAccounts = new ArrayList<>();
for (Account acc: accountsAll) {
for (Account acc : accountsAll) {
boolean pendingForRemoval = arbitraryDataProvider.getBooleanValue(acc,
ManageAccountsActivity.PENDING_FOR_REMOVAL);
@@ -26,6 +26,7 @@ import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.design.widget.Snackbar;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AppCompatActivity;
import android.text.method.ScrollingMovementMethod;
@@ -61,8 +62,7 @@ import java.util.ArrayList;
*
* Shown when the error notification summarizing the list of errors is clicked by the user.
*/
public class ErrorsWhileCopyingHandlerActivity extends AppCompatActivity
implements OnClickListener {
public class ErrorsWhileCopyingHandlerActivity extends AppCompatActivity implements OnClickListener {
private static final String TAG = ErrorsWhileCopyingHandlerActivity.class.getSimpleName();
@@ -282,9 +282,12 @@ public class ErrorsWhileCopyingHandlerActivity extends AppCompatActivity
finish();
} else {
Toast t = Toast.makeText(ErrorsWhileCopyingHandlerActivity.this,
getString(R.string.foreign_files_fail), Toast.LENGTH_LONG);
t.show();
Snackbar snackbar = Snackbar.make(
findViewById(android.R.id.content),
R.string.foreign_files_fail,
Snackbar.LENGTH_LONG
);
snackbar.show();
}
}
}
@@ -31,6 +31,7 @@ import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
@@ -79,6 +80,8 @@ public abstract class FileActivity extends DrawerActivity
public static final String EXTRA_FILE = "com.owncloud.android.ui.activity.FILE";
public static final String EXTRA_ACCOUNT = "com.owncloud.android.ui.activity.ACCOUNT";
public static final String EXTRA_SEARCH = "com.owncloud.android.ui.activity.SEARCH";
public static final String EXTRA_SEARCH_QUERY = "com.owncloud.android.ui.activity.SEARCH_QUERY";
public static final String EXTRA_FROM_NOTIFICATION =
"com.owncloud.android.ui.activity.FROM_NOTIFICATION";
@@ -315,10 +318,7 @@ public abstract class FileActivity extends DrawerActivity
requestCredentialsUpdate(this);
if (result.getCode() == ResultCode.UNAUTHORIZED) {
Toast t = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result,
operation, getResources()),
Toast.LENGTH_LONG);
t.show();
showSnackMessage(ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
}
} else if (!result.isSuccess() && ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED.equals(result.getCode())) {
@@ -336,10 +336,7 @@ public abstract class FileActivity extends DrawerActivity
updateFileFromDB();
} else if (result.getCode() != ResultCode.CANCELLED) {
Toast t = Toast.makeText(this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Toast.LENGTH_LONG);
t.show();
showSnackMessage(ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
}
} else if (operation instanceof SynchronizeFileOperation) {
@@ -350,10 +347,7 @@ public abstract class FileActivity extends DrawerActivity
updateFileFromDB();
} else {
Toast t = Toast.makeText(this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Toast.LENGTH_LONG);
t.show();
showSnackMessage(ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
}
}
}
@@ -389,8 +383,7 @@ public abstract class FileActivity extends DrawerActivity
}
OwnCloudClient client;
OwnCloudAccount ocAccount = new OwnCloudAccount(account, context);
client = (OwnCloudClientManagerFactory.getDefaultSingleton().
removeClientFor(ocAccount));
client = (OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor(ocAccount));
if (client != null) {
OwnCloudCredentials cred = client.getCredentials();
if (cred != null) {
@@ -416,7 +409,7 @@ public abstract class FileActivity extends DrawerActivity
startActivityForResult(updateAccountCredentials, REQUEST_CODE__UPDATE_CREDENTIALS);
} catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException e) {
Toast.makeText(context, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show();
showSnackMessage(getString(R.string.auth_account_does_not_exist));
}
}
@@ -595,4 +588,12 @@ public abstract class FileActivity extends DrawerActivity
// nothing to do
}
/**
* Show a temporary message in a Snackbar bound to the content view
*
* @param message Message to show.
*/
public void showSnackMessage(String message) {
Snackbar.make(findViewById(android.R.id.content),message,Snackbar.LENGTH_LONG).show();
}
}
@@ -55,9 +55,6 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.owncloud.android.MainApp;
@@ -137,7 +134,6 @@ public class FileDisplayActivity extends HookActivity
private static final String KEY_WAITING_TO_PREVIEW = "WAITING_TO_PREVIEW";
private static final String KEY_SYNC_IN_PROGRESS = "SYNC_IN_PROGRESS";
private static final String KEY_WAITING_TO_SEND = "WAITING_TO_SEND";
private static final String KEY_SEARCH_QUERY = "KEY_SEARCH_QUERY";
private static final String SORT_ORDER_DIALOG_TAG = "SORT_ORDER_DIALOG";
@@ -165,9 +161,13 @@ public class FileDisplayActivity extends HookActivity
private Collection<MenuItem> mDrawerMenuItemstoShowHideList;
private String searchQuery;
public static final String KEY_IS_SEARCH_OPEN = "IS_SEARCH_OPEN";
public static final String KEY_SEARCH_QUERY = "SEARCH_QUERY";
private SearchView searchView;
private String mSearchQuery = "";
private boolean mSearchOpen;
private SearchView mSearchView;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -187,7 +187,9 @@ public class FileDisplayActivity extends HookActivity
mWaitingToPreview = savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW);
mSyncInProgress = savedInstanceState.getBoolean(KEY_SYNC_IN_PROGRESS);
mWaitingToSend = savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND);
searchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY);
mSearchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY);
mSearchOpen = savedInstanceState.getBoolean(FileDisplayActivity.KEY_IS_SEARCH_OPEN, false);
mSearchQuery = savedInstanceState.getString(FileDisplayActivity.KEY_SEARCH_QUERY);
} else {
mWaitingToPreview = null;
mSyncInProgress = false;
@@ -385,7 +387,7 @@ public class FileDisplayActivity extends HookActivity
if (!stateWasRecovered) {
Log_OC.d(TAG, "Initializing Fragments in onAccountChanged..");
initFragmentsWithFile();
if (file.isFolder() && TextUtils.isEmpty(searchQuery)) {
if (file.isFolder() && TextUtils.isEmpty(mSearchQuery)) {
startSyncFolderOperation(file, false);
}
@@ -432,7 +434,7 @@ public class FileDisplayActivity extends HookActivity
if (getAccount() != null && getFile() != null) {
/// First fragment
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (listOfFiles != null && TextUtils.isEmpty(searchQuery)) {
if (listOfFiles != null && TextUtils.isEmpty(mSearchQuery)) {
listOfFiles.listDirectory(getCurrentDir(), MainApp.isOnlyOnDevice(), false);
} else {
Log_OC.e(TAG, "Still have a chance to lose the initializacion of list fragment >(");
@@ -476,7 +478,7 @@ public class FileDisplayActivity extends HookActivity
super.onNewIntent(intent);
if(intent.getAction()!=null && intent.getAction().equalsIgnoreCase(ACTION_DETAILS)){
setIntent(intent);
setFile(intent.getParcelableExtra(EXTRA_FILE));
setFile((OCFile)intent.getParcelableExtra(EXTRA_FILE));
}
}
@@ -506,11 +508,11 @@ public class FileDisplayActivity extends HookActivity
* @param fragment New second Fragment to set.
*/
private void setSecondFragment(Fragment fragment) {
if (searchView != null) {
searchView.post(new Runnable() {
if (mSearchView != null) {
mSearchView.post(new Runnable() {
@Override
public void run() {
searchView.setQuery("", true);
mSearchView.setQuery("", true);
}
});
}
@@ -658,80 +660,16 @@ public class FileDisplayActivity extends HookActivity
inflater.inflate(R.menu.main_menu, menu);
menu.findItem(R.id.action_create_dir).setVisible(false);
final MenuItem item = menu.findItem(R.id.action_search);
searchView = (SearchView) MenuItemCompat.getActionView(item);
// hacky as no default way is provided
int fontColor = ThemeUtils.fontColor();
EditText editText = (EditText) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
editText.setHintTextColor(fontColor);
editText.setTextColor(fontColor);
ImageView searchClose = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn);
searchClose.setColorFilter(ThemeUtils.fontColor());
mSearchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
// populate list of menu items to show/hide when drawer is opened/closed
mDrawerMenuItemstoShowHideList = new ArrayList<>(4);
mDrawerMenuItemstoShowHideList.add(menu.findItem(R.id.action_search));
mDrawerMenuItemstoShowHideList.add(menu.findItem(R.id.action_sort));
mDrawerMenuItemstoShowHideList.add(menu.findItem(R.id.action_sync_account));
mDrawerMenuItemstoShowHideList.add(menu.findItem(R.id.action_switch_view));
mDrawerMenuItemstoShowHideList.add(menu.findItem(R.id.action_search));
//focus the SearchView
if (!TextUtils.isEmpty(searchQuery)) {
searchView.post(new Runnable() {
@Override
public void run() {
searchView.setIconified(false);
searchView.setQuery(searchQuery, true);
searchView.clearFocus();
}
});
}
final View mSearchEditFrame = searchView
.findViewById(android.support.v7.appcompat.R.id.search_edit_frame);
searchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
if (TextUtils.isEmpty(searchView.getQuery().toString())) {
searchView.onActionViewCollapsed();
setDrawerIndicatorEnabled(isDrawerIndicatorAvailable()); // order matters
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mDrawerToggle.syncState();
} else {
searchView.post(new Runnable() {
@Override
public void run() {
searchView.setQuery("", true);
}
});
}
return true;
}
});
ViewTreeObserver vto = mSearchEditFrame.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
int oldVisibility = -1;
@Override
public void onGlobalLayout() {
int currentVisibility = mSearchEditFrame.getVisibility();
if (currentVisibility != oldVisibility) {
if (currentVisibility == View.VISIBLE) {
setDrawerIndicatorEnabled(false);
}
oldVisibility = currentVisibility;
}
}
});
return true;
return super.onCreateOptionsMenu(menu);
}
@@ -921,14 +859,10 @@ public class FileDisplayActivity extends HookActivity
} else {
Log_OC.d(TAG, "User clicked on 'Update' with no selection");
Toast t = Toast.makeText(this, getString(R.string.filedisplay_no_file_selected),
Toast.LENGTH_LONG);
t.show();
return;
showSnackMessage(getString(R.string.filedisplay_no_file_selected));
}
}
private void requestUploadOfContentFromApps(Intent contentIntent, int resultCode) {
ArrayList<Parcelable> streamsToUpload = new ArrayList<>();
@@ -989,7 +923,7 @@ public class FileDisplayActivity extends HookActivity
}
private boolean isSearchOpen() {
final View mSearchEditFrame = searchView.findViewById(android.support.v7.appcompat.R.id.search_edit_frame);
final View mSearchEditFrame = mSearchView.findViewById(android.support.v7.appcompat.R.id.search_edit_frame);
return (mSearchEditFrame != null && mSearchEditFrame.getVisibility() == View.VISIBLE);
}
@@ -1017,9 +951,9 @@ public class FileDisplayActivity extends HookActivity
* 4. navigate up (only if drawer and FAB aren't open)
*/
if (isSearchOpen && searchView != null) {
searchView.setQuery("", true);
searchView.onActionViewCollapsed();
if (isSearchOpen && mSearchView != null) {
mSearchView.setQuery("", true);
mSearchView.onActionViewCollapsed();
setDrawerIndicatorEnabled(isDrawerIndicatorAvailable());
} else if (isDrawerOpen && isFabOpen) {
// close drawer first
@@ -1069,9 +1003,11 @@ public class FileDisplayActivity extends HookActivity
//outState.putBoolean(FileDisplayActivity.KEY_REFRESH_SHARES_IN_PROGRESS,
// mRefreshSharesInProgress);
outState.putParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND, mWaitingToSend);
if (searchView != null) {
outState.putString(KEY_SEARCH_QUERY, searchView.getQuery().toString());
if (mSearchView != null) {
outState.putBoolean(KEY_IS_SEARCH_OPEN, !mSearchView.isIconified());
}
outState.putString(KEY_SEARCH_QUERY, mSearchQuery);
Log_OC.v(TAG, "onSaveInstanceState() end");
}
@@ -1089,8 +1025,8 @@ public class FileDisplayActivity extends HookActivity
revertBottomNavigationBarToAllFiles();
// refresh list of files
if (searchView != null && !TextUtils.isEmpty(searchQuery)) {
searchView.setQuery(searchQuery, true);
if (mSearchView != null && !TextUtils.isEmpty(mSearchQuery)) {
mSearchView.setQuery(mSearchQuery, true);
} else if (getListOfFilesFragment() != null && !getListOfFilesFragment().getIsSearchFragment()
&& startFile == null) {
refreshListOfFilesFragment(false);
@@ -1215,15 +1151,14 @@ public class FileDisplayActivity extends HookActivity
getStorageManager().getFileByPath(getCurrentDir().getRemotePath());
if (currentDir == null) {
// current folder was removed from the server
Toast.makeText(FileDisplayActivity.this,
// current folder was removed from the server
showSnackMessage(
String.format(
getString(R.string.
sync_current_folder_was_removed),
synchFolderRemotePath),
Toast.LENGTH_LONG)
.show();
synchFolderRemotePath
)
);
browseToRoot();
@@ -1362,13 +1297,12 @@ public class FileDisplayActivity extends HookActivity
}
if (renamedInUpload) {
String newName = (new File(uploadedRemotePath)).getName();
Toast msg = Toast.makeText(
context,
showSnackMessage(
String.format(
getString(R.string.filedetails_renamed_in_upload_msg),
newName),
Toast.LENGTH_LONG);
msg.show();
newName
)
);
}
if (uploadWasFine || getFile().fileExists()) {
((FileDetailFragment) details).updateFileDetails(false, true);
@@ -1667,10 +1601,7 @@ public class FileDisplayActivity extends HookActivity
*/
private void onRemoveFileOperationFinish(RemoveFileOperation operation,
RemoteOperationResult result) {
Toast msg = Toast.makeText(this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Toast.LENGTH_LONG);
msg.show();
showSnackMessage(ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
if (result.isSuccess()) {
OCFile removedFile = operation.getFile();
@@ -1708,10 +1639,7 @@ public class FileDisplayActivity extends HookActivity
refreshListOfFilesFragment(false);
} else {
try {
Toast msg = Toast.makeText(FileDisplayActivity.this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Toast.LENGTH_LONG);
msg.show();
showSnackMessage(ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
} catch (NotFoundException e) {
Log_OC.e(TAG, "Error while trying to show fail message ", e);
@@ -1731,10 +1659,7 @@ public class FileDisplayActivity extends HookActivity
refreshListOfFilesFragment(false);
} else {
try {
Toast msg = Toast.makeText(FileDisplayActivity.this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Toast.LENGTH_LONG);
msg.show();
showSnackMessage(ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
} catch (NotFoundException e) {
Log_OC.e(TAG, "Error while trying to show fail message ", e);
@@ -1785,10 +1710,7 @@ public class FileDisplayActivity extends HookActivity
}
} else {
Toast msg = Toast.makeText(this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Toast.LENGTH_LONG);
msg.show();
showSnackMessage(ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
if (result.isSslRecoverableException()) {
mLastSslUntrustedServerResult = result;
@@ -1821,10 +1743,7 @@ public class FileDisplayActivity extends HookActivity
refreshListOfFilesFragment(false);
} else {
try {
Toast msg = Toast.makeText(FileDisplayActivity.this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Toast.LENGTH_LONG);
msg.show();
showSnackMessage(ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
} catch (NotFoundException e) {
Log_OC.e(TAG, "Error while trying to show fail message ", e);
@@ -1889,7 +1808,7 @@ public class FileDisplayActivity extends HookActivity
// the execution is slightly delayed to allow the activity get the window focus if it's being started
// or if the method is called from a dialog that is being dismissed
if (TextUtils.isEmpty(searchQuery)) {
if (TextUtils.isEmpty(mSearchQuery)) {
getHandler().postDelayed(
new Runnable() {
@Override
@@ -2017,6 +1936,8 @@ public class FileDisplayActivity extends HookActivity
Bundle args = new Bundle();
args.putParcelable(EXTRA_FILE, file);
args.putParcelable(EXTRA_ACCOUNT, getAccount());
args.putBoolean(EXTRA_SEARCH, mSearchOpen);
args.putString(EXTRA_SEARCH_QUERY, mSearchQuery);
Fragment textPreviewFragment = Fragment.instantiate(getApplicationContext(),
PreviewTextFragment.class.getName(), args);
setSecondFragment(textPreviewFragment);
@@ -2138,4 +2059,9 @@ public class FileDisplayActivity extends HookActivity
EventBus.getDefault().post(new TokenPushEvent());
}
public void setSearchQuery(String query) {
mSearchQuery = query;
}
}
@@ -39,7 +39,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
@@ -419,10 +418,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
refreshListOfFilesFragment(false);
} else {
try {
Toast msg = Toast.makeText(FolderPickerActivity.this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Toast.LENGTH_LONG);
msg.show();
showSnackMessage(ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
} catch (NotFoundException e) {
Log_OC.e(TAG, "Error while trying to show fail message " , e);
@@ -461,13 +457,13 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
if (currentDir == null) {
// current folder was removed from the server
Toast.makeText( FolderPickerActivity.this,
String.format(
getString(R.string.sync_current_folder_was_removed),
getCurrentFolder().getFileName()),
Toast.LENGTH_LONG)
.show();
// current folder was removed from the server
showSnackMessage(
String.format(
getString(R.string.sync_current_folder_was_removed),
getCurrentFolder().getFileName()
)
);
browseToRoot();
} else {
@@ -26,6 +26,7 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
@@ -35,7 +36,6 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -187,16 +187,14 @@ public class LogHistoryActivity extends ToolbarActivity {
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, getString(R.string.log_send_no_mail_app), Toast.LENGTH_LONG).show();
Snackbar.make(findViewById(android.R.id.content),R.string.log_send_no_mail_app,Snackbar.LENGTH_LONG).show();
Log_OC.i(TAG, "Could not find app for sending log history.");
}
}
/**
*
* Class for loading the log data async
*
*/
private class LoadingLogTask extends AsyncTask<String, Void, String> {
private final WeakReference<TextView> textViewReference;
@@ -432,7 +432,7 @@ public class ManageAccountsActivity extends FileActivity
Account[] accounts = AccountManager.get(this).getAccountsByType(MainApp.getAccountType());
String newAccountName = "";
for (Account acc: accounts) {
for (Account acc : accounts) {
if (!account.name.equalsIgnoreCase(acc.name)) {
newAccountName = acc.name;
break;
@@ -24,13 +24,13 @@ import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.Snackbar;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -142,9 +142,11 @@ public class ManageSpaceActivity extends AppCompatActivity {
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
if (!result) {
Toast.makeText(getApplicationContext(),
getString(R.string.manage_space_clear_data),
Toast.LENGTH_LONG).show();
Snackbar.make(
findViewById(android.R.id.content),
R.string.manage_space_clear_data,
Snackbar.LENGTH_LONG
).show();
} else {
finish();
System.exit(0);
@@ -27,6 +27,7 @@ import android.content.SharedPreferences;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
@@ -37,7 +38,6 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -377,9 +377,8 @@ public class PassCodeActivity extends AppCompatActivity {
private void showErrorAndRestart(int errorMessage, int headerMessage,
int explanationVisibility) {
Arrays.fill(mPassCodeDigits, null);
CharSequence errorSeq = getString(errorMessage);
Toast.makeText(this, errorSeq, Toast.LENGTH_LONG).show();
mPassCodeHdr.setText(headerMessage); // TODO check if really needed
Snackbar.make(findViewById(android.R.id.content), getString(errorMessage), Snackbar.LENGTH_LONG).show();
mPassCodeHdr.setText(headerMessage); // TODO check if really needed
mPassCodeHdrExplanation.setVisibility(explanationVisibility); // TODO check if really needed
clearBoxes();
}
@@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author Bartek Przybylski
@@ -33,6 +33,7 @@ import android.content.res.Configuration;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
@@ -46,6 +47,7 @@ import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
import android.support.annotation.LayoutRes;
import android.support.design.widget.Snackbar;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatDelegate;
import android.view.Menu;
@@ -71,7 +73,11 @@ import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.utils.AnalyticsUtils;
import com.owncloud.android.utils.ThemeUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.concurrent.ExecutionException;
/**
* An Activity that allows the user to change the application's settings.
@@ -92,6 +98,8 @@ public class Preferences extends PreferenceActivity
private static final int ACTION_REQUEST_CODE_DAVDROID_SETUP = 10;
private static final String DAV_PATH = "/remote.php/dav";
public static final String SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI = "SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI";
/**
@@ -267,11 +275,7 @@ public class Preferences extends PreferenceActivity
return true;
} else {
if (incoming) {
Toast.makeText(
MainApp.getAppContext(),
R.string.prefs_fingerprint_notsetup,
Toast.LENGTH_LONG)
.show();
showSnackMessage(R.string.prefs_fingerprint_notsetup);
fPrint.setChecked(false);
}
SharedPreferences appPrefs =
@@ -351,11 +355,7 @@ public class Preferences extends PreferenceActivity
launchDavDroidLogin();
} catch (Throwable t) {
Log_OC.e(TAG, "Base Uri for account could not be resolved to call DAVdroid!", t);
Toast.makeText(
MainApp.getAppContext(),
R.string.prefs_calendar_contacts_address_resolve_error,
Toast.LENGTH_SHORT)
.show();
showSnackMessage(R.string.prefs_calendar_contacts_address_resolve_error);
}
return true;
}
@@ -585,6 +585,59 @@ public class Preferences extends PreferenceActivity
loadExternalSettingLinks(preferenceCategoryMore);
loadStoragePath();
// Dev category
PreferenceCategory preferenceCategoryDev = (PreferenceCategory) findPreference("dev_category");
preferenceCategoryDev.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_dev),
accentColor));
/* Link to dev apks */
Preference pDevLink = findPreference("dev_link");
if (pDevLink != null) {
pDevLink.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Integer latestVersion = -1;
Integer currentVersion = -1;
try {
currentVersion = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
LoadingVersionNumberTask loadTask = new LoadingVersionNumberTask();
loadTask.execute();
latestVersion = loadTask.get();
} catch (InterruptedException | ExecutionException | NameNotFoundException e) {
Log_OC.e(TAG, "Error detecting app version", e);
}
if (latestVersion == -1 || currentVersion == -1) {
Toast.makeText(getApplicationContext(), "No information available!", Toast.LENGTH_SHORT).show();
}
if (latestVersion > currentVersion) {
String devApkLink = (String) getText(R.string.dev_link) + latestVersion + ".apk";
Uri uriUrl = Uri.parse(devApkLink);
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(intent);
return true;
} else {
Toast.makeText(getApplicationContext(), "No new version available!", Toast.LENGTH_SHORT).show();
return true;
}
}
});
}
/* Link to dev changelog */
Preference pChangelogLink = findPreference("changelog_link");
if (pChangelogLink != null) {
pChangelogLink.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
String devChangelogLink = getString(R.string.dev_changelog);
Uri uriUrl = Uri.parse(devChangelogLink);
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(intent);
return true;
}
});
}
}
private void launchDavDroidLogin()
@@ -599,7 +652,7 @@ public class Preferences extends PreferenceActivity
if (getPackageManager().resolveActivity(davDroidLoginIntent, 0) != null) {
// arguments
if (mUri != null) {
davDroidLoginIntent.putExtra("url", mUri.toString() + AccountUtils.DAV_PATH);
davDroidLoginIntent.putExtra("url", mUri.toString() + DAV_PATH);
}
davDroidLoginIntent.putExtra("username", AccountUtils.getAccountUsername(account.name));
//loginIntent.putExtra("password", "...");
@@ -617,11 +670,7 @@ public class Preferences extends PreferenceActivity
Uri.parse("https://f-droid.org/repository/browse/?fdid=at.bitfire.davdroid"));
startActivity(downloadIntent);
Toast.makeText(
MainApp.getAppContext(),
R.string.prefs_calendar_contacts_no_store_error,
Toast.LENGTH_SHORT)
.show();
showSnackMessage(R.string.prefs_calendar_contacts_no_store_error);
}
}
}
@@ -693,7 +742,7 @@ public class Preferences extends PreferenceActivity
}
appPrefs.putBoolean(PassCodeActivity.PREFERENCE_SET_PASSCODE, true);
appPrefs.apply();
Toast.makeText(this, R.string.pass_code_stored, Toast.LENGTH_LONG).show();
showSnackMessage(R.string.pass_code_stored);
}
} else if (requestCode == ACTION_CONFIRM_PASSCODE && resultCode == RESULT_OK) {
if (data.getBooleanExtra(PassCodeActivity.KEY_CHECK_RESULT, false)) {
@@ -703,10 +752,10 @@ public class Preferences extends PreferenceActivity
appPrefs.putBoolean(PassCodeActivity.PREFERENCE_SET_PASSCODE, false);
appPrefs.apply();
Toast.makeText(this, R.string.pass_code_removed, Toast.LENGTH_LONG).show();
showSnackMessage(R.string.pass_code_removed);
}
} else if (requestCode == ACTION_REQUEST_CODE_DAVDROID_SETUP && resultCode == RESULT_OK) {
Toast.makeText(this, R.string.prefs_calendar_contacts_sync_setup_successful, Toast.LENGTH_LONG).show();
showSnackMessage(R.string.prefs_calendar_contacts_sync_setup_successful);
}
}
@@ -853,4 +902,36 @@ public class Preferences extends PreferenceActivity
public void onCancelMigration() {
// Migration was canceled so we don't do anything
}
/**
* Show a temporary message in a Snackbar bound to the content view
*
* @param messageResource Message to show.
*/
private void showSnackMessage(int messageResource) {
Snackbar.make(findViewById(android.R.id.content), messageResource, Snackbar.LENGTH_LONG).show();
}
/**
*
* Class for loading the version number
*
*/
private class LoadingVersionNumberTask extends AsyncTask<Void, Void, Integer> {
protected Integer doInBackground(Void... args) {
try {
URL url = new URL(getString(R.string.dev_latest));
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
Integer latestVersion = Integer.parseInt(in.readLine());
in.close();
return latestVersion;
} catch (IOException e) {
Log_OC.e(TAG, "Error loading version number", e);
}
return -1;
}
}
}
@@ -70,7 +70,6 @@ import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
@@ -175,7 +174,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
super.onCreate(savedInstanceState);
if (mAccountSelected) {
setAccount(savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT));
setAccount((Account) savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT));
}
// Listen for sync messages
@@ -990,10 +989,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
populateDirectoryList();
} else {
try {
Toast msg = Toast.makeText(this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Toast.LENGTH_LONG);
msg.show();
showSnackMessage(ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
} catch (NotFoundException e) {
Log_OC.e(TAG, "Error while trying to show fail message ", e);
@@ -1112,12 +1108,12 @@ public class ReceiveExternalFilesActivity extends FileActivity
if (currentDir == null) {
// current folder was removed from the server
Toast.makeText(context,
showSnackMessage(
String.format(
getString(R.string.sync_current_folder_was_removed),
getCurrentFolder().getFileName()),
Toast.LENGTH_LONG)
.show();
getCurrentFolder().getFileName()
)
);
browseToRoot();
} else {
@@ -25,10 +25,10 @@ import android.app.SearchManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
@@ -354,10 +354,11 @@ public class ShareActivity extends FileActivity implements ShareFragmentListener
}
} else {
Toast t = Toast.makeText(this,
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Toast.LENGTH_LONG);
t.show();
Snackbar.make(
findViewById(android.R.id.content),
ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
Snackbar.LENGTH_LONG
).show();
}
}
}
@@ -79,7 +79,6 @@ public class UploadFilesActivity extends FileActivity implements
private boolean mSelectAll = false;
private boolean mLocalFolderPickerMode = false;
private LocalFileListFragment mFileListFragment;
private Button mCancelBtn;
protected Button mUploadBtn;
private Spinner mBehaviourSpinner;
private Account mAccountOnCreation;
@@ -151,7 +150,7 @@ public class UploadFilesActivity extends FileActivity implements
mFileListFragment = (LocalFileListFragment) getSupportFragmentManager().findFragmentById(R.id.local_files_list);
// Set input controllers
mCancelBtn = (Button) findViewById(R.id.upload_files_btn_cancel);
Button mCancelBtn = (Button) findViewById(R.id.upload_files_btn_cancel);
mCancelBtn.setOnClickListener(this);
mUploadBtn = (AppCompatButton) findViewById(R.id.upload_files_btn_upload);
mUploadBtn.getBackground().setColorFilter(ThemeUtils.primaryAccentColor(), PorterDuff.Mode.SRC_ATOP);
@@ -40,7 +40,6 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.evernote.android.job.JobRequest;
import com.owncloud.android.R;
@@ -167,8 +166,7 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
/// TODO is this path still active?
File f = new File(file.getLocalPath());
if(!f.exists()) {
Toast.makeText(this, "Cannot open. Local file does not exist.",
Toast.LENGTH_SHORT).show();
showSnackMessage(getString(R.string.local_file_not_found_toast));
} else {
openFileWithDefault(file.getLocalPath());
}
@@ -189,9 +187,8 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
try {
startActivity(myIntent);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, "Found no app to open this file.", Toast.LENGTH_LONG).show();
showSnackMessage(getString(R.string.file_list_no_app_for_file_type));
Log_OC.i(TAG, "Could not find app for sending log history.");
}
}
@@ -121,10 +121,10 @@ public class DiskLruImageCache {
}
final InputStream in = snapshot.getInputStream( 0 );
if ( in != null ) {
final BufferedInputStream buffIn =
final BufferedInputStream buffIn =
new BufferedInputStream( in, IO_BUFFER_SIZE );
bitmap = BitmapFactory.decodeStream( buffIn );
}
bitmap = BitmapFactory.decodeStream( buffIn );
}
} catch ( IOException e ) {
Log_OC.d(TAG, e.getMessage(), e);
} finally {
@@ -23,6 +23,7 @@ import android.accounts.Account;
import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.Bitmap;
import android.support.design.widget.Snackbar;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -41,8 +42,8 @@ import com.owncloud.android.datamodel.ThumbnailsCacheManager;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.datamodel.UploadsStorageManager.UploadStatus;
import com.owncloud.android.db.OCUpload;
import com.owncloud.android.db.UploadResult;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.utils.DisplayUtils;
@@ -50,7 +51,6 @@ import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.ThemeUtils;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Observable;
@@ -79,8 +79,8 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
}
abstract class UploadGroup implements Refresh {
OCUpload[] items;
String name;
private OCUpload[] items;
private String name;
public UploadGroup(String groupName) {
this.name = groupName;
@@ -91,6 +91,14 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
return name;
}
public OCUpload[] getItems() {
return items;
}
public void setItems(OCUpload[] items) {
this.items = items;
}
public int getGroupItemCount() {
return items == null ? 0 : items.length;
}
@@ -138,8 +146,6 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
return Long.valueOf(upload2.getUploadEndTimestamp()).compareTo(upload1.getUploadEndTimestamp());
}
};
abstract public int getGroupIcon();
}
public ExpandableUploadListAdapter(FileActivity parentActivity) {
@@ -147,48 +153,33 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
mParentActivity = parentActivity;
mUploadsStorageManager = new UploadsStorageManager(mParentActivity.getContentResolver(), parentActivity.getApplicationContext());
mUploadGroups = new UploadGroup[3];
mUploadGroups[0] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_current_uploads)) {
@Override
public void refresh() {
items = mUploadsStorageManager.getCurrentAndPendingUploadsForCurrentAccount();
Arrays.sort(items, comparator);
}
@Override
public int getGroupIcon() {
return R.drawable.upload_in_progress;
setItems(mUploadsStorageManager.getCurrentAndPendingUploadsForCurrentAccount());
Arrays.sort(getItems(), comparator);
}
};
mUploadGroups[1] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_failed_uploads)) {
@Override
public void refresh() {
items = mUploadsStorageManager.getFailedButNotDelayedUploadsForCurrentAccount();
Arrays.sort(items, comparator);
setItems(mUploadsStorageManager.getFailedButNotDelayedUploadsForCurrentAccount());
Arrays.sort(getItems(), comparator);
}
@Override
public int getGroupIcon() {
return R.drawable.upload_failed;
}
};
mUploadGroups[2] = new UploadGroup(mParentActivity.getString(R.string.uploads_view_group_finished_uploads)) {
@Override
public void refresh() {
items = mUploadsStorageManager.getFinishedUploadsForCurrentAccount();
Arrays.sort(items, comparator);
setItems(mUploadsStorageManager.getFinishedUploadsForCurrentAccount());
Arrays.sort(getItems(), comparator);
}
@Override
public int getGroupIcon() {
return R.drawable.upload_finished;
}
};
loadUploadItemsFromDb();
}
@Override
public void registerDataSetObserver(DataSetObserver observer) {
super.registerDataSetObserver(observer);
@@ -369,13 +360,50 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
view.setOnClickListener(null);
// retry
if (upload.getUploadStatus() == UploadStatus.UPLOAD_FAILED) {
if (UploadResult.CREDENTIAL_ERROR.equals(upload.getLastResult())) {
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mParentActivity.getFileOperationsHelper().checkCurrentCredentials(
upload.getAccount(mParentActivity)
);
}
});
} else {
// not a credentials error
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
File file = new File(upload.getLocalPath());
if (file.exists()) {
FileUploader.UploadRequester requester = new FileUploader.UploadRequester();
requester.retry(mParentActivity, upload);
refreshView();
} else {
Snackbar.make(
v.getRootView().findViewById(android.R.id.content),
mParentActivity.getString(R.string.local_file_not_found_toast),
Snackbar.LENGTH_LONG
).show();
}
}
});
}
} else {
view.setOnClickListener(null);
}
/// Set icon or thumbnail
ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail);
fileIcon.setImageResource(R.drawable.file);
/** Cancellation needs do be checked and done before changing the drawable in fileIcon, or
/*
* Cancellation needs do be checked and done before changing the drawable in fileIcon, or
* {@link ThumbnailsCacheManager#cancelPotentialWork} will NEVER cancel any task.
**/
*/
OCFile fakeFileToCheatThumbnailsCacheManagerInterface = new OCFile(upload.getRemotePath());
fakeFileToCheatThumbnailsCacheManagerInterface.setStoragePath(upload.getLocalPath());
fakeFileToCheatThumbnailsCacheManagerInterface.setMimetype(upload.getMimeType());
@@ -416,7 +444,8 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
task
);
fileIcon.setImageDrawable(asyncDrawable);
task.execute(fakeFileToCheatThumbnailsCacheManagerInterface);
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(
fakeFileToCheatThumbnailsCacheManagerInterface, null));
}
}
@@ -452,7 +481,7 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
task
);
fileIcon.setImageDrawable(asyncDrawable);
task.execute(file);
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(file, null));
Log_OC.v(TAG, "Executing task to generate a new thumbnail");
}
}
@@ -545,11 +574,6 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
R.string.uploads_view_upload_status_service_interrupted
);
break;
case UNKNOWN:
status = mParentActivity.getString(
R.string.uploads_view_upload_status_unknown_fail
);
break;
case CANCELLED:
// should not get here ; cancelled uploads should be wiped out
status = mParentActivity.getString(
@@ -563,11 +587,17 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
case MAINTENANCE_MODE:
status = mParentActivity.getString(R.string.maintenance_mode);
break;
case LOCK_FAILED:
status = mParentActivity.getString(R.string.lock_failed);
case SSL_RECOVERABLE_PEER_UNVERIFIED:
status =
mParentActivity.getString(
R.string.uploads_view_upload_status_failed_ssl_certificate_not_trusted
);
break;
case UNKNOWN:
status = mParentActivity.getString(R.string.uploads_view_upload_status_unknown_fail);
break;
default:
status = "Naughty devs added a new fail result but no description for the user";
status = "New fail result but no description for the user";
break;
}
break;
@@ -688,44 +718,6 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
return true;
}
public class ProgressListener implements OnDatatransferProgressListener {
int mLastPercent = 0;
OCUpload mUpload = null;
WeakReference<ProgressBar> mProgressBar = null;
public ProgressListener(OCUpload upload, ProgressBar progressBar) {
mUpload = upload;
mProgressBar = new WeakReference<ProgressBar>(progressBar);
}
@Override
public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer, String
filename) {
int percent = (int) (100.0 * ((double) totalTransferredSoFar) / ((double) totalToTransfer));
if (percent != mLastPercent) {
ProgressBar pb = mProgressBar.get();
if (pb != null) {
pb.setProgress(percent);
pb.postInvalidate();
}
}
mLastPercent = percent;
}
public boolean isWrapping(ProgressBar progressBar) {
ProgressBar wrappedProgressBar = mProgressBar.get();
return (
wrappedProgressBar != null &&
wrappedProgressBar == progressBar // on purpose; don't replace with equals
);
}
public OCUpload getUpload() {
return mUpload;
}
}
public void addBinder() {
notifyDataSetChanged();
}
@@ -369,7 +369,9 @@ public class FileListListAdapter extends BaseAdapter {
if (!file.isFolder()) {
if ((MimeTypeUtil.isImage(file) || MimeTypeUtil.isVideo(file)) && file.getRemoteId() != null) {
// Thumbnail in Cache?
Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(file.getRemoteId());
Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(
"t" + String.valueOf(file.getRemoteId())
);
if (thumbnail != null && !file.needsUpdateThumbnail()) {
if (MimeTypeUtil.isVideo(file)) {
@@ -385,7 +387,6 @@ public class FileListListAdapter extends BaseAdapter {
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
new ThumbnailsCacheManager.ThumbnailGenerationTask(
fileIcon, mStorageManager, mAccount, asyncTasks);
if (thumbnail == null) {
if (MimeTypeUtil.isVideo(file)) {
thumbnail = ThumbnailsCacheManager.mDefaultVideo;
@@ -401,7 +402,8 @@ public class FileListListAdapter extends BaseAdapter {
);
fileIcon.setImageDrawable(asyncDrawable);
asyncTasks.add(task);
task.execute(file);
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(file,
file.getRemoteId()));
} catch (IllegalArgumentException e) {
Log_OC.d(TAG, "ThumbnailGenerationTask : " + e.getMessage());
}
@@ -203,7 +203,7 @@ public class LocalFileListAdapter extends BaseAdapter implements FilterableListA
if (MimeTypeUtil.isImage(file)){
// Thumbnail in Cache?
Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(
String.valueOf(file.hashCode())
"t" + String.valueOf(file.hashCode())
);
if (thumbnail != null){
fileIcon.setImageBitmap(thumbnail);
@@ -225,7 +225,7 @@ public class LocalFileListAdapter extends BaseAdapter implements FilterableListA
task
);
fileIcon.setImageDrawable(asyncDrawable);
task.execute(file);
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(file, null));
Log_OC.v(TAG, "Executing task to generate a new thumbnail");
} // else, already being generated, don't restart it
@@ -0,0 +1,73 @@
/*
* Nextcloud Android client application
*
* @author Andy Scherzinger
* Copyright (C) 2016 Andy Scherzinger
* Copyright (C) 2016 Nextcloud
* Copyright (C) 2016 ownCloud GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* 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/>.
*/
package com.owncloud.android.ui.adapter;
import android.widget.ProgressBar;
import com.owncloud.android.db.OCUpload;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
import java.lang.ref.WeakReference;
/**
* Progress listener for file transfers.
*/
public class ProgressListener implements OnDatatransferProgressListener {
private int mLastPercent = 0;
private OCUpload mUpload = null;
private WeakReference<ProgressBar> mProgressBar = null;
public ProgressListener(OCUpload upload, ProgressBar progressBar) {
mUpload = upload;
mProgressBar = new WeakReference<>(progressBar);
}
@Override
public void onTransferProgress(
long progressRate,
long totalTransferredSoFar,
long totalToTransfer,
String fileAbsoluteName) {
int percent = (int) (100.0 * ((double) totalTransferredSoFar) / ((double) totalToTransfer));
if (percent != mLastPercent) {
ProgressBar progressBar = mProgressBar.get();
if (progressBar != null) {
progressBar.setProgress(percent);
progressBar.postInvalidate();
}
}
mLastPercent = percent;
}
public boolean isWrapping(ProgressBar progressBar) {
ProgressBar wrappedProgressBar = mProgressBar.get();
return (
wrappedProgressBar != null &&
wrappedProgressBar == progressBar // on purpose; don't replace with equals
);
}
public OCUpload getUpload() {
return mUpload;
}
}
@@ -122,7 +122,7 @@ public class UploaderAdapter extends SimpleAdapter {
task
);
fileIcon.setImageDrawable(asyncDrawable);
task.execute(file);
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(file, file.getRemoteId()));
}
}
} else {
@@ -24,6 +24,7 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
@@ -31,7 +32,6 @@ import android.view.View;
import android.view.WindowManager.LayoutParams;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
@@ -116,10 +116,7 @@ public class CreateFolderDialogFragment
.getText().toString().trim();
if (newFolderName.length() <= 0) {
Toast.makeText(
getActivity(),
R.string.filename_empty,
Toast.LENGTH_LONG).show();
showSnackMessage(R.string.filename_empty);
return;
}
boolean serverWithForbiddenChars = ((ComponentsGetter)getActivity()).
@@ -132,7 +129,7 @@ public class CreateFolderDialogFragment
} else {
messageId = R.string.filename_forbidden_characters;
}
Toast.makeText(getActivity(), messageId, Toast.LENGTH_LONG).show();
showSnackMessage(messageId);
return;
}
@@ -143,5 +140,17 @@ public class CreateFolderDialogFragment
getFileOperationsHelper().createFolder(path, false);
}
}
/**
* Show a temporary message in a Snackbar bound to the content view of the parent Activity
*
* @param messageResource Message to show.
*/
private void showSnackMessage(int messageResource) {
Snackbar.make(
getActivity().findViewById(android.R.id.content),
messageResource,
Snackbar.LENGTH_LONG
).show();
}
}
@@ -30,6 +30,7 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
@@ -37,7 +38,6 @@ import android.view.View;
import android.view.WindowManager.LayoutParams;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
@@ -130,10 +130,7 @@ public class RenameFileDialogFragment
.getText().toString().trim();
if (newFileName.length() <= 0) {
Toast.makeText(
getActivity(),
R.string.filename_empty,
Toast.LENGTH_LONG).show();
showSnackMessage(R.string.filename_empty);
return;
}
@@ -147,7 +144,7 @@ public class RenameFileDialogFragment
} else {
messageId = R.string.filename_forbidden_characters;
}
Toast.makeText(getActivity(), messageId, Toast.LENGTH_LONG).show();
showSnackMessage(messageId);
return;
}
@@ -156,4 +153,17 @@ public class RenameFileDialogFragment
}
}
/**
* Show a temporary message in a Snackbar bound to the content view of the parent Activity
*
* @param messageResource Message to show.
*/
private void showSnackMessage(int messageResource) {
Snackbar.make(
getActivity().findViewById(android.R.id.content),
messageResource,
Snackbar.LENGTH_LONG
).show();
}
}
@@ -153,11 +153,13 @@ public class ShareLinkToDialog extends DialogFragment {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = newView(parent);
View view = convertView;
if (view == null) {
view = newView(parent);
}
bindView(position, convertView);
return convertView;
bindView(position, view);
return view;
}
private View newView(ViewGroup parent) {
@@ -22,6 +22,7 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
@@ -29,7 +30,6 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
@@ -115,10 +115,11 @@ public class SharePasswordDialogFragment extends DialogFragment
.getText().toString();
if (password.length() <= 0) {
Toast.makeText(
getActivity(),
Snackbar.make(
getActivity().findViewById(android.R.id.content),
R.string.share_link_empty_password,
Toast.LENGTH_LONG).show();
Snackbar.LENGTH_LONG
).show();
return;
}
@@ -329,17 +329,16 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
return true;
}
case R.id.action_send_file: {
// Obtain the file
if (!getFile().isDown()) { // Download the file
Log_OC.d(TAG, getFile().getRemotePath() + " : File must be downloaded");
((FileDisplayActivity) mContainerActivity).startDownloadForSending(getFile(),
OCFileListFragment.DOWNLOAD_SEND);
// Obtain the file
if (!getFile().isDown()) { // Download the file
Log_OC.d(TAG, getFile().getRemotePath() + " : File must be downloaded");
((FileDisplayActivity) mContainerActivity).startDownloadForSending(getFile(),
OCFileListFragment.DOWNLOAD_SEND);
} else {
mContainerActivity.getFileOperationsHelper().sendDownloadedFile(getFile());
}
return true;
}
else {
mContainerActivity.getFileOperationsHelper().sendDownloadedFile(getFile());
}
return true;
}
default:
return super.onOptionsItemSelected(item);
}
@@ -506,7 +505,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
task
);
iv.setImageDrawable(asyncDrawable);
task.execute(file);
task.execute(new ThumbnailsCacheManager.ThumbnailGenerationTaskObject(file, file.getRemoteId()));
}
}
} else {
@@ -53,7 +53,6 @@ import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
@@ -394,7 +393,7 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
/**
* registers {@link android.view.View.OnClickListener} and {@link android.view.View.OnLongClickListener}
* on the Upload mini FAB for the linked action and {@link Toast} showing the underlying action.
* on the Upload mini FAB for the linked action and {@link Snackbar} showing the underlying action.
*/
private void registerFabUploadListeners() {
getFabUpload().setOnClickListener(new View.OnClickListener() {
@@ -410,7 +409,7 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
getFabUpload().setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Toast.makeText(getActivity(), R.string.actionbar_upload, Toast.LENGTH_SHORT).show();
showSnackMessage(R.string.actionbar_upload);
return true;
}
});
@@ -418,7 +417,7 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
/**
* registers {@link android.view.View.OnClickListener} and {@link android.view.View.OnLongClickListener}
* on the 'Create Dir' mini FAB for the linked action and {@link Toast} showing the underlying action.
* on the 'Create Dir' mini FAB for the linked action and {@link Snackbar} showing the underlying action.
*/
private void registerFabMkDirListeners() {
getFabMkdir().setOnClickListener(new View.OnClickListener() {
@@ -435,7 +434,7 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
getFabMkdir().setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Toast.makeText(getActivity(), R.string.actionbar_mkdir, Toast.LENGTH_SHORT).show();
showSnackMessage(R.string.actionbar_mkdir);
return true;
}
});
@@ -443,7 +442,7 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
/**
* registers {@link android.view.View.OnClickListener} and {@link android.view.View.OnLongClickListener}
* on the Upload from App mini FAB for the linked action and {@link Toast} showing the underlying action.
* on the Upload from App mini FAB for the linked action and {@link Snackbar} showing the underlying action.
*/
private void registerFabUploadFromAppListeners() {
getFabUploadFromApp().setOnClickListener(new View.OnClickListener() {
@@ -467,9 +466,7 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
getFabUploadFromApp().setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Toast.makeText(getActivity(),
R.string.actionbar_upload_from_apps,
Toast.LENGTH_SHORT).show();
showSnackMessage(R.string.actionbar_upload_from_apps);
return true;
}
});
@@ -937,14 +934,21 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
return true;
}
case R.id.action_send_file: {
// Obtain the file
if (!singleFile.isDown()) { // Download the file
Log_OC.d(TAG, singleFile.getRemotePath() + " : File must be downloaded");
((FileDisplayActivity) mContainerActivity).startDownloadForSending(singleFile, DOWNLOAD_SEND);
if (MimeTypeUtil.isImage(singleFile) && !singleFile.isDown()) {
mContainerActivity.getFileOperationsHelper().sendCachedImage(singleFile);
return true;
} else {
mContainerActivity.getFileOperationsHelper().sendDownloadedFile(singleFile);
// Obtain the file
if (!singleFile.isDown()) { // Download the file
Log_OC.d(TAG, singleFile.getRemotePath() + " : File must be downloaded");
((FileDisplayActivity) mContainerActivity).startDownloadForSending(singleFile,
DOWNLOAD_SEND);
} else {
mContainerActivity.getFileOperationsHelper().sendDownloadedFile(singleFile);
}
return true;
}
return true;
}
case R.id.action_set_as_wallpaper: {
if (singleFile.isDown()) {
@@ -1622,4 +1626,17 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
}
}
/**
* Show a temporary message in a Snackbar bound to the content view of the parent Activity
*
* @param messageResource Message to show.
*/
private void showSnackMessage(int messageResource) {
Snackbar.make(
getActivity().findViewById(android.R.id.content),
messageResource,
Snackbar.LENGTH_LONG
).show();
}
}
@@ -72,7 +72,6 @@ public class SearchShareesFragment extends Fragment implements ShareUserListAdap
// other members
private ArrayList<OCShare> mShares;
private ShareUserListAdapter mUserGroupsAdapter = null;
private ShareFragmentListener mListener;
@@ -183,7 +182,7 @@ public class SearchShareesFragment extends Fragment implements ShareUserListAdap
private void updateListOfUserGroups() {
// Update list of users/groups
// TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
mUserGroupsAdapter = new ShareUserListAdapter(
ShareUserListAdapter mUserGroupsAdapter = new ShareUserListAdapter(
getActivity().getApplicationContext(),
R.layout.share_user_item, mShares, this
);
@@ -43,7 +43,6 @@ import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
@@ -119,11 +118,6 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
*/
private OCCapability mCapabilities;
/**
* Adapter to show private shares.
*/
private ShareUserListAdapter mUserGroupsAdapter = null;
/**
* Public share bound to the file.
*/
@@ -247,8 +241,11 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
// Show Search Fragment
mListener.showSearchUsersAndGroups();
} else {
String message = getString(R.string.share_sharee_unavailable);
Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show();
Snackbar.make(
getActivity().findViewById(android.R.id.content),
getString(R.string.share_sharee_unavailable),
Snackbar.LENGTH_LONG
).show();
}
}
});
@@ -649,7 +646,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
private void updateListOfUserGroups() {
// Update list of users/groups
// TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
mUserGroupsAdapter = new ShareUserListAdapter(
ShareUserListAdapter mUserGroupsAdapter = new ShareUserListAdapter(
getActivity(),
R.layout.share_user_item,
mPrivateShares,
@@ -44,6 +44,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.providers.DiskLruImageCacheFileProvider;
import com.owncloud.android.services.OperationsService;
import com.owncloud.android.services.observer.FileObserverService;
import com.owncloud.android.ui.activity.FileActivity;
@@ -186,10 +187,10 @@ public class FileOperationsHelper {
)
);
} catch (ActivityNotFoundException anfe) {
showNoAppForFileTypeToast(mFileActivity.getApplicationContext());
mFileActivity.showSnackMessage(mFileActivity.getString(R.string.file_list_no_app_for_file_type));
}
} else {
showNoAppForFileTypeToast(mFileActivity.getApplicationContext());
mFileActivity.showSnackMessage(mFileActivity.getString(R.string.file_list_no_app_for_file_type));
}
} else {
@@ -197,18 +198,6 @@ public class FileOperationsHelper {
}
}
/**
* Displays a toast stating that no application could be found to open the file.
*
* @param context the context to be able to show a toast.
*/
private void showNoAppForFileTypeToast(Context context) {
Toast.makeText(context,
R.string.file_list_no_app_for_file_type, Toast.LENGTH_SHORT)
.show();
}
/**
* Helper method to share a file via a public link. Starts a request to do it in {@link OperationsService}
*
@@ -238,11 +227,7 @@ public class FileOperationsHelper {
} else {
// Show a Message
Toast t = Toast.makeText(
mFileActivity, mFileActivity.getString(R.string.share_link_no_support_share_api),
Toast.LENGTH_LONG
);
t.show();
mFileActivity.showSnackMessage(mFileActivity.getString(R.string.share_link_no_support_share_api));
}
}
@@ -263,11 +248,7 @@ public class FileOperationsHelper {
}
} else {
// Show a Message
Toast t = Toast.makeText(
mFileActivity, mFileActivity.getString(R.string.share_link_no_support_share_api),
Toast.LENGTH_LONG
);
t.show();
mFileActivity.showSnackMessage(mFileActivity.getString(R.string.share_link_no_support_share_api));
}
}
@@ -356,11 +337,7 @@ public class FileOperationsHelper {
} else {
// Show a Message
Toast t = Toast.makeText(mFileActivity,
mFileActivity.getString(R.string.share_link_no_support_share_api),
Toast.LENGTH_LONG);
t.show();
mFileActivity.showSnackMessage(mFileActivity.getString(R.string.share_link_no_support_share_api));
}
}
@@ -374,7 +351,6 @@ public class FileOperationsHelper {
intent.putExtra(FileActivity.EXTRA_FILE, file);
intent.putExtra(FileActivity.EXTRA_ACCOUNT, mFileActivity.getAccount());
mFileActivity.startActivity(intent);
}
@@ -526,6 +502,21 @@ public class FileOperationsHelper {
}
}
public void sendCachedImage(OCFile file) {
if (file != null) {
Intent sendIntent = new Intent(Intent.ACTION_SEND);
// set MimeType
sendIntent.setType(file.getMimetype());
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("content://" + DiskLruImageCacheFileProvider.AUTHORITY +
file.getRemotePath()));
sendIntent.putExtra(Intent.ACTION_SEND, true); // Send Action
mFileActivity.startActivity(Intent.createChooser(sendIntent, "Send"));
} else {
Log_OC.wtf(TAG, "Trying to send a NULL OCFile");
}
}
public void setPictureAs(OCFile file) {
if (file != null) {
if (file.isDown()) {
@@ -126,7 +126,7 @@ public class FileDownloadFragment extends FileFragment implements OnClickListene
if (savedInstanceState != null) {
if (!mIgnoreFirstSavedState) {
setFile(savedInstanceState.getParcelable(FileDownloadFragment.EXTRA_FILE));
setFile((OCFile) savedInstanceState.getParcelable(FileDownloadFragment.EXTRA_FILE));
mAccount = savedInstanceState.getParcelable(FileDownloadFragment.EXTRA_ACCOUNT);
mError = savedInstanceState.getBoolean(FileDownloadFragment.EXTRA_ERROR);
}
@@ -31,6 +31,7 @@ public class ImageViewCustom extends AppCompatImageView {
private long mMovieDuration;
private long mMovieRunDuration;
private long mLastTick;
protected PreviewImageFragment previewImageFragment;
public ImageViewCustom(Context context) {
super(context);
@@ -143,4 +144,7 @@ public class ImageViewCustom extends AppCompatImageView {
}
}
public void setPreviewImageFragment(PreviewImageFragment previewImageFragment) {
this.previewImageFragment = previewImageFragment;
}
}
@@ -26,6 +26,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.view.ViewPager;
@@ -41,6 +42,7 @@ import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.VirtualFolderType;
import com.owncloud.android.db.PreferenceManager;
import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
import com.owncloud.android.files.services.FileUploader;
@@ -121,13 +123,13 @@ public class PreviewImageActivity extends FileActivity implements
}
}
});
if (savedInstanceState != null) {
mRequestWaitingForBinder = savedInstanceState.getBoolean(KEY_WAITING_FOR_BINDER);
} else {
mRequestWaitingForBinder = false;
}
}
private void initViewPager() {
@@ -149,7 +151,7 @@ public class PreviewImageActivity extends FileActivity implements
}
mPreviewImagePagerAdapter = new PreviewImagePagerAdapter(getSupportFragmentManager(),
parentFolder, getAccount(), getStorageManager(), MainApp.isOnlyOnDevice());
parentFolder, getAccount(), getStorageManager(), MainApp.isOnlyOnDevice(), getBaseContext());
}
mViewPager = (ExtendedViewPager) findViewById(R.id.fragmentPager);
@@ -325,7 +327,7 @@ public class PreviewImageActivity extends FileActivity implements
finish();
}
private void requestForDownload(OCFile file) {
public void requestForDownload(OCFile file) {
if (mDownloaderBinder == null) {
Log_OC.d(TAG, "requestForDownload called without binder to download service");
@@ -349,13 +351,16 @@ public class PreviewImageActivity extends FileActivity implements
mHasSavedPosition = true;
if (mDownloaderBinder == null) {
mRequestWaitingForBinder = true;
} else {
OCFile currentFile = mPreviewImagePagerAdapter.getFileAt(position);
getSupportActionBar().setTitle(currentFile.getFileName());
setDrawerIndicatorEnabled(false);
if (!currentFile.isDown()
&& !mPreviewImagePagerAdapter.pendingErrorAt(position)) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
String behaviour = sharedPreferences.getString("preview_behaviour", "PREVIEW_BEHAVIOUR_PREVIEW");
boolean resizedBehaviour = behaviour.equalsIgnoreCase("PREVIEW_BEHAVIOUR_PREVIEW");
if (!currentFile.isDown() && !mPreviewImagePagerAdapter.pendingErrorAt(position) && !resizedBehaviour) {
requestForDownload(currentFile);
}
@@ -456,6 +461,10 @@ public class PreviewImageActivity extends FileActivity implements
}
}
public void switchToFullScreen() {
hideSystemUI(mFullScreenAnchorView);
}
@Override
protected void onAccountSet(boolean stateWasRecovered) {
super.onAccountSet(stateWasRecovered);
@@ -473,7 +482,7 @@ public class PreviewImageActivity extends FileActivity implements
if (file.getFileId() > FileDataStorageManager.ROOT_PARENT_ID) {
file = getStorageManager().getFileById(file.getFileId());
}
if (file != null) {
/// Refresh the activity according to the Account and OCFile set
setFile(file); // reset after getting it fresh from storageManager
@@ -35,6 +35,7 @@ import android.os.Bundle;
import android.os.Process;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
import android.support.design.widget.Snackbar;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
@@ -52,8 +53,10 @@ import android.widget.TextView;
import com.caverock.androidsvg.SVG;
import com.caverock.androidsvg.SVGParseException;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
import com.owncloud.android.files.FileMenuFilter;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
@@ -87,7 +90,7 @@ public class PreviewImageFragment extends FileFragment {
private static final String ARG_FILE = "FILE";
private static final String ARG_IGNORE_FIRST = "IGNORE_FIRST";
private static final String ARG_SHOW_RESIZED_IMAGE = "SHOW_RESIZED_IMAGE";
private static final String SCREEN_NAME = "Image Preview";
private TouchImageViewCustom mImageView;
@@ -99,6 +102,8 @@ public class PreviewImageFragment extends FileFragment {
protected ImageView mMultiListIcon;
protected ProgressBar mMultiListProgress;
private Boolean mShowResizedImage = false;
public Bitmap mBitmap = null;
private static final String TAG = PreviewImageFragment.class.getSimpleName();
@@ -121,11 +126,14 @@ public class PreviewImageFragment extends FileFragment {
* {@link FragmentStatePagerAdapter}
* ; TODO better solution
*/
public static PreviewImageFragment newInstance(OCFile imageFile, boolean ignoreFirstSavedState) {
public static PreviewImageFragment newInstance(OCFile imageFile, boolean ignoreFirstSavedState,
boolean showResizedImage) {
PreviewImageFragment frag = new PreviewImageFragment();
frag.mShowResizedImage = showResizedImage;
Bundle args = new Bundle();
args.putParcelable(ARG_FILE, imageFile);
args.putBoolean(ARG_IGNORE_FIRST, ignoreFirstSavedState);
args.putBoolean(ARG_SHOW_RESIZED_IMAGE, showResizedImage);
frag.setArguments(args);
return frag;
}
@@ -157,6 +165,7 @@ public class PreviewImageFragment extends FileFragment {
// not right now
mIgnoreFirstSavedState = args.getBoolean(ARG_IGNORE_FIRST);
mShowResizedImage = args.getBoolean(ARG_SHOW_RESIZED_IMAGE);
setHasOptionsMenu(true);
}
@@ -170,6 +179,7 @@ public class PreviewImageFragment extends FileFragment {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.preview_image_fragment, container, false);
mImageView = (TouchImageViewCustom) view.findViewById(R.id.image);
mImageView.setPreviewImageFragment(this);
mImageView.setVisibility(View.GONE);
view.setOnClickListener(new OnClickListener() {
@@ -196,6 +206,14 @@ public class PreviewImageFragment extends FileFragment {
return view;
}
public void switchToFullScreen() {
((PreviewImageActivity) getActivity()).switchToFullScreen();
}
public void downloadFile() {
((PreviewImageActivity) getActivity()).requestForDownload(getFile());
}
protected void setupMultiView(View view) {
mMultiListContainer = (LinearLayout) view.findViewById(R.id.empty_list_view);
mMultiListMessage = (TextView) view.findViewById(R.id.empty_list_view_text);
@@ -221,9 +239,6 @@ public class PreviewImageFragment extends FileFragment {
if (getFile() == null) {
throw new IllegalStateException("Instanced with a NULL OCFile");
}
if (!getFile().isDown()) {
throw new IllegalStateException("There is no local file to preview");
}
}
@@ -241,10 +256,60 @@ public class PreviewImageFragment extends FileFragment {
public void onStart() {
super.onStart();
if (getFile() != null) {
mLoadBitmapTask = new LoadBitmapTask(mImageView);
//mLoadBitmapTask.execute(new String[]{getFile().getStoragePath()});
// mLoadBitmapTask.execute(getFile().getStoragePath());
mLoadBitmapTask.execute(getFile());
mImageView.setTag(getFile().getFileId());
if (mShowResizedImage) {
Bitmap resizedImage = ThumbnailsCacheManager.getBitmapFromDiskCache(
String.valueOf("r" + getFile().getRemoteId()));
if (resizedImage != null && !getFile().needsUpdateThumbnail()) {
mImageView.setImageBitmap(resizedImage);
mImageView.setVisibility(View.VISIBLE);
mBitmap = resizedImage;
} else {
// show thumbnail while loading resized image
Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(
String.valueOf("t" + getFile().getRemoteId()));
if (thumbnail != null) {
mImageView.setImageBitmap(thumbnail);
mImageView.setVisibility(View.VISIBLE);
mBitmap = thumbnail;
} else {
thumbnail = ThumbnailsCacheManager.mDefaultImg;
}
// generate new resized image
if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(getFile(), mImageView) &&
mContainerActivity.getStorageManager() != null) {
final ThumbnailsCacheManager.ResizedImageGenerationTask task =
new ThumbnailsCacheManager.ResizedImageGenerationTask(PreviewImageFragment.this,
mImageView,
mContainerActivity.getStorageManager(),
mContainerActivity.getStorageManager().getAccount());
if (resizedImage == null) {
resizedImage = thumbnail;
}
final ThumbnailsCacheManager.AsyncResizedImageDrawable asyncDrawable =
new ThumbnailsCacheManager.AsyncResizedImageDrawable(
MainApp.getAppContext().getResources(),
resizedImage,
task
);
mImageView.setImageDrawable(asyncDrawable);
task.execute(getFile());
}
}
mMultiView.setVisibility(View.GONE);
if (getResources() != null) {
mImageView.setBackgroundColor(getResources().getColor(R.color.black));
}
mImageView.setVisibility(View.VISIBLE);
} else {
mLoadBitmapTask = new LoadBitmapTask(mImageView);
mLoadBitmapTask.execute(getFile());
}
}
}
@@ -368,9 +433,15 @@ public class PreviewImageFragment extends FileFragment {
return true;
case R.id.action_send_file:
mContainerActivity.getFileOperationsHelper().sendDownloadedFile(getFile());
return true;
if (MimeTypeUtil.isImage(getFile()) && !getFile().isDown()) {
mContainerActivity.getFileOperationsHelper().sendCachedImage(getFile());
return true;
} else {
mContainerActivity.getFileOperationsHelper().sendDownloadedFile(getFile());
return true;
}
case R.id.action_download_file:
case R.id.action_sync_file:
mContainerActivity.getFileOperationsHelper().syncFile(getFile());
return true;
@@ -661,6 +732,24 @@ public class PreviewImageFragment extends FileFragment {
}
}
public void setErrorPreviewMessage() {
Snackbar.make(mMultiView, R.string.resized_image_not_possible, Snackbar.LENGTH_INDEFINITE)
.setAction(R.string.common_yes, new OnClickListener() {
@Override
public void onClick(View v) {
downloadFile();
}
}).show();
}
public void setNoConnectionErrorMessage() {
try {
Snackbar.make(getView(), R.string.auth_no_net_conn_title, Snackbar.LENGTH_LONG).show();
} catch (NullPointerException npe) {
}
}
/**
* Helper method to test if an {@link OCFile} can be passed to a {@link PreviewImageFragment}
* to be previewed.
@@ -687,19 +776,22 @@ public class PreviewImageFragment extends FileFragment {
getFile().getMimetype().equalsIgnoreCase("image/svg+xml")) && getActivity() != null
&& getActivity() instanceof PreviewImageActivity && getResources() != null) {
PreviewImageActivity previewImageActivity = (PreviewImageActivity) getActivity();
LayerDrawable layerDrawable = (LayerDrawable) mImageView.getDrawable();
Drawable layerOne;
if (previewImageActivity.getSystemUIVisible()) {
layerOne = getResources().getDrawable(R.color.white);
} else {
layerOne = getResources().getDrawable(R.drawable.backrepeat);
if (mImageView.getDrawable() instanceof LayerDrawable) {
LayerDrawable layerDrawable = (LayerDrawable) mImageView.getDrawable();
Drawable layerOne;
if (previewImageActivity.getSystemUIVisible()) {
layerOne = getResources().getDrawable(R.color.white);
} else {
layerOne = getResources().getDrawable(R.drawable.backrepeat);
}
layerDrawable.setDrawableByLayerId(layerDrawable.getId(0), layerOne);
mImageView.setImageDrawable(layerDrawable);
mImageView.invalidate();
}
layerDrawable.setDrawableByLayerId(layerDrawable.getId(0), layerOne);
mImageView.setImageDrawable(layerDrawable);
mImageView.invalidate();
}
}
@@ -20,6 +20,8 @@
package com.owncloud.android.ui.preview;
import android.accounts.Account;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
@@ -28,6 +30,7 @@ import android.view.ViewGroup;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.VirtualFolderType;
import com.owncloud.android.db.PreferenceManager;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.utils.FileStorageUtils;
@@ -50,7 +53,8 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
private Set<Integer> mObsoletePositions;
private Set<Integer> mDownloadErrors;
private FileDataStorageManager mStorageManager;
private Context mContext;
private Map<Integer, FileFragment> mCachedFragments;
/**
@@ -63,7 +67,7 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
*/
public PreviewImagePagerAdapter(FragmentManager fragmentManager, OCFile parentFolder,
Account account, FileDataStorageManager storageManager,
boolean onlyOnDevice) {
boolean onlyOnDevice, Context context) {
super(fragmentManager);
if (fragmentManager == null) {
@@ -76,6 +80,7 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
throw new IllegalArgumentException("NULL storage manager");
}
mContext = context;
mAccount = account;
mStorageManager = storageManager;
mImageFiles = mStorageManager.getFolderImages(parentFolder, onlyOnDevice);
@@ -140,20 +145,27 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
OCFile file = mImageFiles.get(i);
Fragment fragment = null;
if (file.isDown()) {
fragment = PreviewImageFragment.newInstance(file,
mObsoletePositions.contains(Integer.valueOf(i)));
} else if (mDownloadErrors.contains(Integer.valueOf(i))) {
fragment = FileDownloadFragment.newInstance(file, mAccount, true);
((FileDownloadFragment)fragment).setError(true);
mDownloadErrors.remove(Integer.valueOf(i));
fragment = PreviewImageFragment.newInstance(file, mObsoletePositions.contains(i), false);
} else {
fragment = FileDownloadFragment.newInstance(
file, mAccount, mObsoletePositions.contains(Integer.valueOf(i))
);
if (mDownloadErrors.contains(i)) {
fragment = FileDownloadFragment.newInstance(file, mAccount, true);
((FileDownloadFragment)fragment).setError(true);
mDownloadErrors.remove(i);
} else {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
boolean behaviour = sharedPreferences.getString("preview_behaviour", "PREVIEW_BEHAVIOUR_PREVIEW")
.equalsIgnoreCase("PREVIEW_BEHAVIOUR_PREVIEW");
if (behaviour) {
fragment = PreviewImageFragment.newInstance(file, mObsoletePositions.contains(i), true);
} else {
fragment = FileDownloadFragment.newInstance(file, mAccount, mObsoletePositions.contains(i));
}
}
}
mObsoletePositions.remove(Integer.valueOf(i));
mObsoletePositions.remove(i);
return fragment;
}
@@ -22,6 +22,11 @@ package com.owncloud.android.ui.preview;
import android.accounts.Account;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.SearchView;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -42,8 +47,9 @@ import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.utils.AnalyticsUtils;
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.StringUtils;
import com.owncloud.android.utils.AnalyticsUtils;
import java.io.BufferedWriter;
import java.io.FileInputStream;
@@ -55,7 +61,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public class PreviewTextFragment extends FileFragment {
public class PreviewTextFragment extends FileFragment implements SearchView.OnQueryTextListener {
private static final String EXTRA_FILE = "FILE";
private static final String EXTRA_ACCOUNT = "ACCOUNT";
private static final String TAG = PreviewTextFragment.class.getSimpleName();
@@ -66,6 +72,10 @@ public class PreviewTextFragment extends FileFragment {
private TextView mTextPreview;
private TextLoadAsyncTask mTextLoadTask;
private String mOriginalText;
private Handler mHandler;
private SearchView mSearchView;
private RelativeLayout mMultiView;
protected LinearLayout mMultiListContainer;
@@ -75,6 +85,9 @@ public class PreviewTextFragment extends FileFragment {
protected ProgressBar mMultiListProgress;
private String mSearchQuery = "";
private boolean mSearchOpen;
/**
* Creates an empty fragment for previews.
* <p/>
@@ -100,7 +113,6 @@ public class PreviewTextFragment extends FileFragment {
View ret = inflater.inflate(R.layout.text_file_preview, container, false);
mTextPreview = (TextView) ret.findViewById(R.id.text_preview);
mMultiView = (RelativeLayout) ret.findViewById(R.id.multi_view);
@@ -136,6 +148,7 @@ public class PreviewTextFragment extends FileFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
OCFile file = getFile();
@@ -149,6 +162,11 @@ public class PreviewTextFragment extends FileFragment {
mAccount = args.getParcelable(FileDisplayActivity.EXTRA_ACCOUNT);
}
if (args.containsKey(FileDisplayActivity.EXTRA_SEARCH_QUERY)) {
mSearchQuery = args.getString(FileDisplayActivity.EXTRA_SEARCH_QUERY);
}
mSearchOpen = args.getBoolean(FileDisplayActivity.EXTRA_SEARCH, false);
if (savedInstanceState == null) {
if (file == null) {
throw new IllegalStateException("Instanced with a NULL OCFile");
@@ -156,12 +174,14 @@ public class PreviewTextFragment extends FileFragment {
if (mAccount == null) {
throw new IllegalStateException("Instanced with a NULL ownCloud Account");
}
} else {
file = savedInstanceState.getParcelable(EXTRA_FILE);
mAccount = savedInstanceState.getParcelable(EXTRA_ACCOUNT);
}
mHandler = new Handler();
setFile(file);
setHasOptionsMenu(true);
}
/**
@@ -182,12 +202,55 @@ public class PreviewTextFragment extends FileFragment {
loadAndShowTextPreview();
}
private void loadAndShowTextPreview() {
mTextLoadTask = new TextLoadAsyncTask(new WeakReference<>(mTextPreview));
mTextLoadTask.execute(getFile().getStoragePath());
}
@Override
public boolean onQueryTextSubmit(String query) {
performSearch(query, 0);
return true;
}
@Override
public boolean onQueryTextChange(final String newText) {
performSearch(newText, 500);
return true;
}
private void performSearch(final String query, int delay) {
mHandler.removeCallbacksAndMessages(null);
if (mOriginalText != null) {
if (getActivity() != null && getActivity() instanceof FileDisplayActivity) {
FileDisplayActivity fileDisplayActivity = (FileDisplayActivity) getActivity();
fileDisplayActivity.setSearchQuery(query);
}
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (query != null && !query.isEmpty()) {
if (getContext() != null && getContext().getResources() != null) {
String coloredText = StringUtils.searchAndColor(mOriginalText, query,
getContext().getResources().getColor(R.color.primary));
mTextPreview.setText(Html.fromHtml(coloredText.replace("\n", "<br \\>")));
}
} else {
mTextPreview.setText(mOriginalText);
}
}
}, delay);
}
if (delay == 0 && mSearchView != null) {
mSearchView.clearFocus();
}
}
/**
* Reads the file to preview and shows its contents. Too critical to be anonymous.
*/
@@ -252,7 +315,12 @@ public class PreviewTextFragment extends FileFragment {
final TextView textView = mTextViewReference.get();
if (textView != null) {
textView.setText(new String(stringWriter.getBuffer()));
mOriginalText = stringWriter.toString();
mSearchView.setOnQueryTextListener(PreviewTextFragment.this);
textView.setText(mOriginalText);
if (mSearchOpen) {
mSearchView.setQuery(mSearchQuery, true);
}
textView.setVisibility(View.VISIBLE);
}
@@ -271,6 +339,18 @@ public class PreviewTextFragment extends FileFragment {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.file_actions_menu, menu);
MenuItem menuItem = menu.findItem(R.id.action_search);
menuItem.setVisible(true);
mSearchView = (SearchView) MenuItemCompat.getActionView(menuItem);
mSearchView.setMaxWidth(Integer.MAX_VALUE);
if (mSearchOpen) {
mSearchView.setIconified(false);
mSearchView.setQuery(mSearchQuery, false);
mSearchView.clearFocus();
}
}
/**
@@ -81,6 +81,7 @@ public class PreviewVideoActivity extends FileActivity implements OnCompletionLi
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log_OC.v(TAG, "onCreate");
setContentView(R.layout.video_layout);
@@ -1,25 +1,29 @@
/**
* ownCloud Android client application
* ownCloud Android client application
*
* @author masensio
* Copyright (C) 2014 ownCloud Inc.
* @author masensio
* Copyright (C) 2016 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* 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.
* 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/>.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.utils;
import android.content.res.Resources;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.owncloud.android.R;
import com.owncloud.android.lib.common.operations.RemoteOperation;
@@ -47,101 +51,76 @@ import java.net.SocketTimeoutException;
/**
* Class to choose proper error messages to show to the user depending on the results of operations,
* always following the same policy.
* always following the same policy
*/
public class ErrorMessageAdapter {
/**
* Return an internationalized user message corresponding to an operation result
* and the operation performed.
*
* @param result Result of a {@link RemoteOperation} performed.
* @param operation Operation performed.
* @param res Reference to app resources, for i18n.
* @return User message corresponding to 'result' and 'operation'.
*/
@NonNull
public static String getErrorCauseMessage(
RemoteOperationResult result,
RemoteOperation operation,
Resources res
) {
String message = getSpecificMessageForResultAndOperation(result, operation, res);
public static String getErrorCauseMessage(RemoteOperationResult result,
RemoteOperation operation, Resources res) {
if (message == null || message.length() <= 0) {
message = getCommonMessageForResult(result, res);
}
if (message == null || message.length() <= 0) {
message = getGenericErrorMessageForOperation(operation, res);
}
if (message == null) {
if (result.isSuccess()) {
message = res.getString(R.string.common_ok);
} else {
message = res.getString(R.string.common_error_unknown);
}
}
return message;
}
/**
* Return a user message corresponding to an operation result and specific for the operation
* performed.
*
* @param result Result of a {@link RemoteOperation} performed.
* @param operation Operation performed.
* @param res Reference to app resources, for i18n.
* @return User message corresponding to 'result' and 'operation', or NULL if there is no
* specific message for both.
*/
@Nullable
private static String getSpecificMessageForResultAndOperation(
RemoteOperationResult result,
RemoteOperation operation,
Resources res
) {
String message = null;
if (!result.isSuccess() && isCommonError(result.getCode())) {
message = getCommonErrorMessage(result, res);
} else if (operation instanceof UploadFileOperation) {
if (result.isSuccess()) {
message = String.format(
res.getString(R.string.uploader_upload_succeeded_content_single),
((UploadFileOperation) operation).getFileName());
} else {
if (result.getCode() == ResultCode.LOCAL_STORAGE_FULL
|| result.getCode() == ResultCode.LOCAL_STORAGE_NOT_COPIED) {
message = String.format(
res.getString(R.string.error__upload__local_file_not_copied),
((UploadFileOperation) operation).getFileName(),
res.getString(R.string.app_name));
/*
} else if (result.getCode() == ResultCode.QUOTA_EXCEEDED) {
message = res.getString(R.string.failed_upload_quota_exceeded_text);
*/
} else if (result.getCode() == ResultCode.FORBIDDEN) {
message = String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.uploader_upload_forbidden_permissions));
} else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
message = res.getString(R.string.filename_forbidden_charaters_from_server);
} else {
message = String.format(
res.getString(R.string.uploader_upload_failed_content_single),
((UploadFileOperation) operation).getFileName());
}
}
if (operation instanceof UploadFileOperation) {
message = getMessageForUploadFileOperation(result, (UploadFileOperation) operation, res);
} else if (operation instanceof DownloadFileOperation) {
if (result.isSuccess()) {
message = String.format(
res.getString(R.string.downloader_download_succeeded_content),
new File(((DownloadFileOperation) operation).getSavePath()).getName());
} else {
if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
message = res.getString(R.string.downloader_download_file_not_found);
} else {
message = String.format(
res.getString(R.string.downloader_download_failed_content), new File(
((DownloadFileOperation) operation).getSavePath()).getName());
}
}
message = getMessageForDownloadFileOperation(result, (DownloadFileOperation) operation, res);
} else if (operation instanceof RemoveFileOperation) {
if (result.isSuccess()) {
message = res.getString(R.string.remove_success_msg);
} else {
if (result.getCode().equals(ResultCode.FORBIDDEN)) {
// Error --> No permissions
message = String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.forbidden_permissions_delete));
} else {
message = res.getString(R.string.remove_fail_msg);
}
}
message = getMessageForRemoveFileOperation(result, res);
} else if (operation instanceof RenameFileOperation) {
if (result.getCode().equals(ResultCode.INVALID_LOCAL_FILE_NAME)) {
message = res.getString(R.string.rename_local_fail_msg);
} else if (result.getCode().equals(ResultCode.FORBIDDEN)) {
// Error --> No permissions
message = String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.forbidden_permissions_rename));
} else if (result.getCode().equals(ResultCode.INVALID_CHARACTER_IN_NAME)) {
message = res.getString(R.string.filename_forbidden_characters);
} else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
message = res.getString(R.string.filename_forbidden_charaters_from_server);
} else {
message = res.getString(R.string.rename_server_fail_msg);
}
message = getMessageForRenameFileOperation(result, res);
} else if (operation instanceof SynchronizeFileOperation) {
if (!((SynchronizeFileOperation) operation).transferWasRequested()) {
@@ -149,143 +128,252 @@ public class ErrorMessageAdapter {
}
} else if (operation instanceof CreateFolderOperation) {
if (result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME) {
message = res.getString(R.string.filename_forbidden_characters);
} else if (result.getCode().equals(ResultCode.FORBIDDEN)) {
message = String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.forbidden_permissions_create));
} else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
message = res.getString(R.string.filename_forbidden_charaters_from_server);
} else {
message = res.getString(R.string.create_dir_fail_msg);
}
message = getMessageForCreateFolderOperation(result, res);
} else if (operation instanceof CreateShareViaLinkOperation ||
operation instanceof CreateShareWithShareeOperation) {
if (result.getData() != null && result.getData().size() > 0) {
message = (String) result.getData().get(0); // share API sends its own error messages
} else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
message = res.getString(R.string.share_link_file_no_exist);
} else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
// Error --> No permissions
message = String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.share_link_forbidden_permissions));
} else { // Generic error
// Show a Message, operation finished without success
message = res.getString(R.string.share_link_file_error);
}
message = getMessageForCreateShareOperations(result, res);
} else if (operation instanceof UnshareOperation) {
if (result.getData() != null && result.getData().size() > 0) {
message = (String) result.getData().get(0); // share API sends its own error messages
} else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
message = res.getString(R.string.unshare_link_file_no_exist);
} else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
// Error --> No permissions
message = String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.unshare_link_forbidden_permissions));
} else { // Generic error
// Show a Message, operation finished without success
message = res.getString(R.string.unshare_link_file_error);
}
message = getMessageForUnshareOperation(result, res);
} else if (operation instanceof UpdateShareViaLinkOperation ||
operation instanceof UpdateSharePermissionsOperation) {
if (result.getData() != null && result.getData().size() > 0) {
message = (String) result.getData().get(0); // share API sends its own error messages
} else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
message = res.getString(R.string.update_link_file_no_exist);
} else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
// Error --> No permissions
message = String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.update_link_forbidden_permissions));
} else { // Generic error
// Show a Message, operation finished without success
message = res.getString(R.string.update_link_file_error);
}
message = getMessageForUpdateShareOperations(result, res);
} else if (operation instanceof MoveFileOperation) {
if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
message = res.getString(R.string.move_file_not_found);
} else if (result.getCode() == ResultCode.INVALID_MOVE_INTO_DESCENDANT) {
message = res.getString(R.string.move_file_invalid_into_descendent);
} else if (result.getCode() == ResultCode.INVALID_OVERWRITE) {
message = res.getString(R.string.move_file_invalid_overwrite);
} else if (result.getCode() == ResultCode.FORBIDDEN) {
message = String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.forbidden_permissions_move));
} else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
message = res.getString(R.string.filename_forbidden_charaters_from_server);
} else { // Generic error
// Show a Message, operation finished without success
message = res.getString(R.string.move_file_error);
}
message = getMessageForMoveFileOperation(result, res);
} else if (operation instanceof SynchronizeFolderOperation) {
if (!result.isSuccess()) {
String folderPathName = new File(
((SynchronizeFolderOperation) operation).getFolderPath()).getName();
if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
message = String.format(res.getString(R.string.sync_current_folder_was_removed),
folderPathName);
} else { // Generic error
// Show a Message, operation finished without success
message = String.format(res.getString(R.string.sync_folder_failed_content),
folderPathName);
}
}
message = getMessageForSynchronizeFolderOperation(result, (SynchronizeFolderOperation) operation, res);
} else if (operation instanceof CopyFileOperation) {
if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
message = res.getString(R.string.copy_file_not_found);
} else if (result.getCode() == ResultCode.INVALID_COPY_INTO_DESCENDANT) {
message = res.getString(R.string.copy_file_invalid_into_descendent);
} else if (result.getCode() == ResultCode.INVALID_OVERWRITE) {
message = res.getString(R.string.copy_file_invalid_overwrite);
} else if (result.getCode() == ResultCode.FORBIDDEN) {
message = String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.forbidden_permissions_copy));
} else { // Generic error
// Show a Message, operation finished without success
message = res.getString(R.string.copy_file_error);
}
message = getMessageForCopyFileOperation(result, res);
}
return message;
}
private static String getCommonErrorMessage(RemoteOperationResult result, Resources res) {
private static String getMessageForSynchronizeFolderOperation(
RemoteOperationResult result,
SynchronizeFolderOperation operation,
Resources res
) {
if (!result.isSuccess() && result.getCode() == ResultCode.FILE_NOT_FOUND) {
return String.format(
res.getString(R.string.sync_current_folder_was_removed),
new File(operation.getFolderPath()).getName()
);
}
return
null;
}
private static String getMessageForMoveFileOperation(RemoteOperationResult result, Resources res) {
if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
return res.getString(R.string.move_file_not_found);
} else if (result.getCode() == ResultCode.INVALID_MOVE_INTO_DESCENDANT) {
return res.getString(R.string.move_file_invalid_into_descendent);
} else if (result.getCode() == ResultCode.INVALID_OVERWRITE) {
return res.getString(R.string.move_file_invalid_overwrite);
} else if (result.getCode() == ResultCode.FORBIDDEN) {
return String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.forbidden_permissions_move));
} else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
return res.getString(R.string.filename_forbidden_charaters_from_server);
}
return null;
}
private static String getMessageForUpdateShareOperations(RemoteOperationResult result, Resources res) {
if (result.getData() != null && result.getData().size() > 0) {
return (String) result.getData().get(0); // share API sends its own error messages
} else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
return res.getString(R.string.update_link_file_no_exist);
} else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
// Error --> No permissions
return String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.update_link_forbidden_permissions));
}
return null;
}
private static String getMessageForUnshareOperation(RemoteOperationResult result, Resources res) {
if (result.getData() != null && result.getData().size() > 0) {
return (String) result.getData().get(0); // share API sends its own error messages
} else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
return res.getString(R.string.unshare_link_file_no_exist);
} else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
// Error --> No permissions
return String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.unshare_link_forbidden_permissions));
}
return null;
}
private static String getMessageForCopyFileOperation(RemoteOperationResult result, Resources res) {
if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
return res.getString(R.string.copy_file_not_found);
} else if (result.getCode() == ResultCode.INVALID_COPY_INTO_DESCENDANT) {
return res.getString(R.string.copy_file_invalid_into_descendent);
} else if (result.getCode() == ResultCode.INVALID_OVERWRITE) {
return res.getString(R.string.copy_file_invalid_overwrite);
} else if (result.getCode() == ResultCode.FORBIDDEN) {
return String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.forbidden_permissions_copy));
}
return null;
}
private static String getMessageForCreateShareOperations(RemoteOperationResult result, Resources res) {
if (result.getData() != null && result.getData().size() > 0) {
return (String) result.getData().get(0); // share API sends its own error messages
} else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
return res.getString(R.string.share_link_file_no_exist);
} else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
// Error --> No permissions
return String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.share_link_forbidden_permissions));
}
return null;
}
private static String getMessageForCreateFolderOperation(RemoteOperationResult result, Resources res) {
if (result.getCode() == ResultCode.INVALID_CHARACTER_IN_NAME) {
return res.getString(R.string.filename_forbidden_characters);
} else if (result.getCode().equals(ResultCode.FORBIDDEN)) {
return String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.forbidden_permissions_create));
} else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
return res.getString(R.string.filename_forbidden_charaters_from_server);
}
return null;
}
private static String getMessageForRenameFileOperation(RemoteOperationResult result, Resources res) {
if (result.getCode().equals(ResultCode.INVALID_LOCAL_FILE_NAME)) {
return res.getString(R.string.rename_local_fail_msg);
} else if (result.getCode().equals(ResultCode.FORBIDDEN)) {
// Error --> No permissions
return String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.forbidden_permissions_rename));
} else if (result.getCode().equals(ResultCode.INVALID_CHARACTER_IN_NAME)) {
return res.getString(R.string.filename_forbidden_characters);
} else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
return res.getString(R.string.filename_forbidden_charaters_from_server);
}
return null;
}
private static String getMessageForRemoveFileOperation(RemoteOperationResult result, Resources res) {
if (result.isSuccess()) {
return res.getString(R.string.remove_success_msg);
} else {
if (result.getCode().equals(ResultCode.FORBIDDEN)) {
// Error --> No permissions
return String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.forbidden_permissions_delete));
}
}
return null;
}
private static String getMessageForDownloadFileOperation(
RemoteOperationResult result,
DownloadFileOperation operation,
Resources res
) {
if (result.isSuccess()) {
return String.format(
res.getString(R.string.downloader_download_succeeded_content),
new File(operation.getSavePath()).getName());
} else {
if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
return res.getString(R.string.downloader_download_file_not_found);
}
}
return null;
}
private static String getMessageForUploadFileOperation(
RemoteOperationResult result,
UploadFileOperation operation,
Resources res
) {
if (result.isSuccess()) {
return String.format(
res.getString(R.string.uploader_upload_succeeded_content_single),
operation.getFileName());
} else {
if (result.getCode() == ResultCode.LOCAL_STORAGE_FULL
|| result.getCode() == ResultCode.LOCAL_STORAGE_NOT_COPIED) {
return String.format(
res.getString(R.string.error__upload__local_file_not_copied),
operation.getFileName(),
res.getString(R.string.app_name));
} else if (result.getCode() == ResultCode.FORBIDDEN) {
return String.format(res.getString(R.string.forbidden_permissions),
res.getString(R.string.uploader_upload_forbidden_permissions));
} else if (result.getCode() == ResultCode.INVALID_CHARACTER_DETECT_IN_SERVER) {
return res.getString(R.string.filename_forbidden_charaters_from_server);
}
}
return null;
}
/**
* Return a user message corresponding to an operation result with no knowledge about the operation
* performed.
*
* @param result Result of a {@link RemoteOperation} performed.
* @param res Reference to app resources, for i18n.
* @return User message corresponding to 'result'.
*/
@Nullable
private static String getCommonMessageForResult(RemoteOperationResult result, Resources res) {
String message = null;
if (!result.isSuccess()) {
if (result.getCode() == ResultCode.WRONG_CONNECTION) {
message = res.getString(R.string.network_error_socket_exception);
@@ -294,24 +382,132 @@ public class ErrorMessageAdapter {
if (result.getException() instanceof SocketTimeoutException) {
message = res.getString(R.string.network_error_socket_timeout_exception);
} else if (result.getException() instanceof ConnectTimeoutException) {
message = res.getString(R.string.network_error_connect_timeout_exception);
}
} else if (result.getCode() == ResultCode.HOST_NOT_AVAILABLE) {
message = res.getString(R.string.network_host_not_available);
} else if (result.getCode() == ResultCode.MAINTENANCE_MODE) {
message = res.getString(R.string.maintenance_mode);
} else if (result.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {
message = res.getString(
R.string.uploads_view_upload_status_failed_ssl_certificate_not_trusted
);
} else if (result.getCode() == ResultCode.BAD_OC_VERSION) {
message = res.getString(
R.string.auth_bad_oc_version_title
);
} else if (result.getCode() == ResultCode.INCORRECT_ADDRESS) {
message = res.getString(
R.string.auth_incorrect_address_title
);
} else if (result.getCode() == ResultCode.SSL_ERROR) {
message = res.getString(
R.string.auth_ssl_general_error_title
);
} else if (result.getCode() == ResultCode.UNAUTHORIZED) {
message = res.getString(
R.string.auth_unauthorized
);
} else if (result.getCode() == ResultCode.INSTANCE_NOT_CONFIGURED) {
message = res.getString(
R.string.auth_not_configured_title
);
} else if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
message = res.getString(
R.string.auth_incorrect_path_title
);
} else if (result.getCode() == ResultCode.OAUTH2_ERROR) {
message = res.getString(
R.string.auth_oauth_error
);
} else if (result.getCode() == ResultCode.OAUTH2_ERROR_ACCESS_DENIED) {
message = res.getString(
R.string.auth_oauth_error_access_denied
);
} else if (result.getCode() == ResultCode.ACCOUNT_NOT_NEW) {
message = res.getString(
R.string.auth_account_not_new
);
} else if (result.getCode() == ResultCode.ACCOUNT_NOT_THE_SAME) {
message = res.getString(
R.string.auth_account_not_the_same
);
}
else if (result.getHttpPhrase() != null && result.getHttpPhrase().length() > 0) {
// last chance: error message from server
message = result.getHttpPhrase();
}
}
return message;
}
private static boolean isCommonError(RemoteOperationResult.ResultCode code) {
return code == ResultCode.WRONG_CONNECTION ||
code == ResultCode.TIMEOUT ||
code == ResultCode.HOST_NOT_AVAILABLE ||
code == ResultCode.MAINTENANCE_MODE;
/**
* Return a user message corresponding to a generic error for a given operation.
*
* @param operation Operation performed.
* @param res Reference to app resources, for i18n.
* @return User message corresponding to a generic error of 'operation'.
*/
@Nullable
private static String getGenericErrorMessageForOperation(RemoteOperation operation, Resources res) {
String message = null;
if (operation instanceof UploadFileOperation) {
message = String.format(
res.getString(R.string.uploader_upload_failed_content_single),
((UploadFileOperation) operation).getFileName());
} else if (operation instanceof DownloadFileOperation) {
message = String.format(
res.getString(R.string.downloader_download_failed_content),
new File(((DownloadFileOperation) operation).getSavePath()).getName()
);
} else if (operation instanceof RemoveFileOperation) {
message = res.getString(R.string.remove_fail_msg);
} else if (operation instanceof RenameFileOperation) {
message = res.getString(R.string.rename_server_fail_msg);
} else if (operation instanceof CreateFolderOperation) {
message = res.getString(R.string.create_dir_fail_msg);
} else if (operation instanceof CreateShareViaLinkOperation ||
operation instanceof CreateShareWithShareeOperation
) {
message = res.getString(R.string.share_link_file_error);
} else if (operation instanceof UnshareOperation) {
message = res.getString(R.string.unshare_link_file_error);
} else if (operation instanceof UpdateShareViaLinkOperation ||
operation instanceof UpdateSharePermissionsOperation
) {
message = res.getString(R.string.update_link_file_error);
} else if (operation instanceof MoveFileOperation) {
message = res.getString(R.string.move_file_error);
} else if (operation instanceof SynchronizeFolderOperation) {
String folderPathName = new File(
((SynchronizeFolderOperation) operation).getFolderPath()
).getName();
message = String.format(res.getString(R.string.sync_folder_failed_content), folderPathName);
} else if (operation instanceof CopyFileOperation) {
message = res.getString(R.string.copy_file_error);
}
return message;
}
}
@@ -135,8 +135,8 @@ public class MimeTypeUtil {
* Returns the resource identifier of an image to use as icon associated to a type of folder.
*
* @param isSharedViaUsers flag if the folder is shared via the users system
* @param isSharedViaLink flag if the folder is publicly shared via link
* @param account account which color should be used
* @param isSharedViaLink flag if the folder is publicly shared via link
* @param account account which color should be used
* @return Identifier of an image resource.
*/
public static Drawable getFolderTypeIcon(boolean isSharedViaUsers, boolean isSharedViaLink, Account account) {
@@ -0,0 +1,56 @@
/**
* Nextcloud Android client application
*
* @author Mario Danic
* Copyright (C) 2017 Nextcloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.utils;
import android.support.annotation.ColorInt;
import android.text.TextUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Helper class for handling and manipulation of Strings.
*/
public class StringUtils {
public static String searchAndColor(String text, String searchText, @ColorInt int color) {
if (TextUtils.isEmpty(text) || TextUtils.isEmpty(searchText)) {
return text;
}
Matcher m = Pattern.compile(searchText, Pattern.CASE_INSENSITIVE | Pattern.LITERAL)
.matcher(text);
StringBuffer sb = new StringBuffer();
while (m.find()) {
String replacement = m.group().replace(
m.group(),
"<font color='" + color + "'><b>" + m.group() + "</b></font>"
);
m.appendReplacement(sb, Matcher.quoteReplacement(replacement));
}
m.appendTail(sb);
return sb.toString();
}
}
@@ -64,7 +64,7 @@ public class ThemeUtils {
try {
float adjust;
if (darkTheme()){
if (darkTheme()) {
adjust = +0.1f;
} else {
adjust = -0.1f;
@@ -121,6 +121,7 @@ public class ThemeUtils {
/**
* Tests if dark color is set
*
* @return true if dark theme -> e.g.use light font color, darker accent color
*/
public static boolean darkTheme() {
@@ -74,7 +74,7 @@ public class ActionEditText extends AppCompatEditText {
getDrawingRect(mButtonRect);
mButtonRect.top += 10;
mButtonRect.bottom -= 10;
mButtonRect.left = (int) (getWidth() - mTextBounds.width() - 18);
mButtonRect.left = getWidth() - mTextBounds.width() - 18;
mButtonRect.right = getWidth() - 10;
btn_rect = mButtonRect;
File diff suppressed because it is too large. Load diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 658 B

+34 -34
View File
@@ -109,22 +109,22 @@
</android.support.design.widget.TextInputLayout>
<ImageButton
android:id="@+id/testServerButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="@dimen/alternate_half_padding"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/arrow_right"
android:tint="@color/white"
android:background="@android:color/transparent"
android:onClick="onTestServerConnectionClick"
android:contentDescription="@string/test_server_button"
/>
<ImageButton
android:id="@+id/testServerButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="@dimen/alternate_half_padding"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/arrow_right"
android:tint="@color/white"
android:background="@android:color/transparent"
android:onClick="onTestServerConnectionClick"
android:contentDescription="@string/test_server_button"
/>
<ImageButton
<ImageButton
android:id="@+id/embeddedRefreshButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -208,10 +208,10 @@
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_account_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
android:id="@+id/input_layout_account_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<EditText
android:id="@+id/account_username"
@@ -226,10 +226,10 @@
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_account_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:id="@+id/input_layout_account_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:passwordToggleDrawable="@drawable/password_visibility_selector"
app:passwordToggleTint="@color/white">
@@ -273,17 +273,17 @@
android:paddingTop="@dimen/standard_half_padding">
<android.support.v7.widget.AppCompatButton
android:id="@+id/buttonOK"
android:theme="@style/Button.Login"
style="@style/Button.Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/standard_padding"
android:layout_gravity="center_horizontal"
android:enabled="false"
android:text="@string/setup_btn_connect"
android:contentDescription="@string/setup_btn_connect"
android:visibility="gone"/>
android:id="@+id/buttonOK"
android:theme="@style/Button.Login"
style="@style/Button.Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/standard_padding"
android:layout_gravity="center_horizontal"
android:enabled="false"
android:text="@string/setup_btn_connect"
android:contentDescription="@string/setup_btn_connect"
android:visibility="gone"/>
<LinearLayout
android:layout_width="match_parent"
@@ -60,7 +60,6 @@
android:layout_gravity="start"
android:layout_marginTop="@dimen/standard_half_margin"
android:textColor="@color/color_accent"
android:paddingLeft="@dimen/zero"
style="@style/TextAppearance.AppCompat.Body2"
/>
@@ -96,7 +95,6 @@
android:layout_gravity="start"
android:layout_marginTop="@dimen/standard_half_margin"
android:textColor="@color/color_accent"
android:paddingLeft="@dimen/zero"
style="@style/TextAppearance.AppCompat.Body2"
/>
</LinearLayout>
+1 -1
View File
@@ -171,6 +171,6 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/list_divider_background"></View>
android:background="@color/list_divider_background"/>
</LinearLayout>
+1 -1
View File
@@ -38,6 +38,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/standard_margin"
android:text="@string/common_loading" />
android:text="@string/common_loading"/>
</LinearLayout>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 38 KiB

+10
View File
@@ -21,6 +21,16 @@
<item>LOCAL_BEHAVIOUR_DELETE</item>
</string-array>
<string-array name="pref_preview_behaviour_entries" translatable="false">
<item>@string/pref_preview_behaviour_entry_download</item>
<item>@string/pref_preview_behaviour_entry_preview</item>
</string-array>
<string-array name="pref_preview_behaviour_entryValues" translatable="false">
<item>PREVIEW_BEHAVIOUR_DOWNLOAD</item>
<item>PREVIEW_BEHAVIOUR_PREVIEW</item>
</string-array>
<string-array name="upload_files_behaviour" translatable="false">
<item>@string/uploader_upload_files_behaviour_move_to_nextcloud_folder</item>
<item>@string/uploader_upload_files_behaviour_only_upload</item>
+16 -11
View File
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Beta indicator -->
<bool name="is_beta">false</bool>
<bool name="is_beta">true</bool>
<!-- App name and other strings-->
<string name="app_name">Nextcloud</string>
<string name="account_type">nextcloud</string> <!-- better if was a domain name; but changing it now would require migrate accounts when the app is updated -->
<string name="authority">org.nextcloud</string> <!-- better if was the app package with ".provider" appended ; it identifies the provider -->
<string name="users_and_groups_search_authority">com.nextcloud.android.providers.UsersAndGroupsSearchProvider</string>
<string name="users_and_groups_share_with">com.nextcloud.android.providers.UsersAndGroupsSearchProvider.action.SHARE_WITH</string>
<string name="document_provider_authority">org.nextcloud.documents</string>
<string name="file_provider_authority">org.nextcloud.files</string>
<string name="app_name">Nextcloud dev</string>
<string name="account_type">nextcloud.beta</string> <!-- better if was a domain name; but changing it now would require migrate accounts when the app is updated -->
<string name="authority">org.nextcloud.beta.provider</string> <!-- better if was the app package with ".provider" appended ; it identifies the provider -->
<string name="users_and_groups_search_authority">org.nextcloud.beta.android.providers.UsersAndGroupsSearchProvider</string>
<string name="users_and_groups_share_with">org.nextcloud.beta.android.providers.UsersAndGroupsSearchProvider.action.SHARE_WITH</string>
<string name="document_provider_authority">org.nextcloud.beta.documents</string>
<string name="file_provider_authority">org.nextcloud.beta.files</string>
<string name ="db_file">nextcloud.db</string>
<string name ="db_name">nextcloud</string>
<string name ="data_folder">nextcloud</string>
<string name ="log_name">nextcloud</string>
<string name ="default_display_name_for_root_folder">Nextcloud</string>
<string name ="default_display_name_for_root_folder">Nextcloud dev</string>
<string name ="user_agent">Mozilla/5.0 (Android) ownCloud-android/%1$s</string>
<!-- URLs and flags related -->
@@ -97,7 +97,7 @@
<bool name="imprint_enabled">false</bool>
<bool name="recommend_enabled">true</bool>
<bool name="feedback_enabled">true</bool>
<bool name="logger_enabled">false</bool>
<bool name="logger_enabled">true</bool>
<string name="url_imprint"></string>
<string name="mail_feedback">"mailto:[email protected]"</string>
<string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>
@@ -111,7 +111,7 @@
<string name="syncedFolder_light_upload_behaviour">FileUploader.LOCAL_BEHAVIOUR_FORGET</string>
<!--Destination mail for sending log files -->
<string name="mail_logger"></string>
<string name="mail_logger">[email protected]</string>
<!-- Determine is participate enabled -->
<bool name="participate_enabled">true</bool>
@@ -140,6 +140,11 @@
<!-- Push server url -->
<string name="push_server_url" translatable="false"></string>
<!-- dev settings -->
<string name="dev_link">https://download.nextcloud.com/android/dev/nextcloud-dev-</string>
<string name="dev_latest">https://download.nextcloud.com/android/dev/latest</string>
<string name="dev_changelog">https://github.com/nextcloud/android/raw/dev/CHANGELOG.md</string>
</resources>
+10 -3
View File
@@ -19,7 +19,6 @@
<string name="menu_item_sort_by_date_oldest_first">Oldest first</string>
<string name="menu_item_sort_by_size_biggest_first">Biggest first</string>
<string name="menu_item_sort_by_size_smallest_first">Smallest first</string>
<string name="drawer_item_all_files">All files</string>
<string name="drawer_item_home">Home</string>
<string name="drawer_item_favorites">Favorites</string>
@@ -110,6 +109,7 @@
<string name="file_list_empty_text_photos_filter">Your search returned no photos.</string>
<string name="file_list_empty_text_videos">Upload some videos or activate auto upload.</string>
<string name="file_list_empty_text_videos_filter">Your search returned no videos.</string>
<string name="file_item_metadata_separator" translatable="false">,</string>
<string name="upload_list_empty_headline">No uploads available</string>
<string name="upload_list_empty_text">Upload some content or activate instant uploading.</string>
<string name="upload_list_empty_text_auto_upload">Upload some content or activate auto upload.</string>
@@ -154,6 +154,8 @@
<string name="uploader_upload_failed_ticker">Upload failed</string>
<string name="uploader_upload_failed_content_single">Could not upload %1$s</string>
<string name="uploader_upload_failed_credentials_error">Upload failed, you need to log in again</string>
<string name="uploader_upload_failed_ssl_certificate_not_trusted">Server certificate is not trusted</string>
<string name="uploads_view_upload_status_failed_ssl_certificate_not_trusted">Server certificate is not trusted</string>
<string name="uploads_view_title">Uploads</string>
<string name="uploads_view_group_current_uploads">Current</string>
<string name="uploads_view_group_failed_uploads">Failed / Pending restart</string>
@@ -293,10 +295,10 @@
<string name="activity_chooser_title">Send link to &#8230;</string>
<string name="wait_for_tmp_copy_from_private_storage">Copying file from private storage</string>
<string name="oauth_check_onoff">Log in with OAuth 2.0</string>
<string name="oauth_check_onoff">Log in with OAuth 2.0</string>
<string name="oauth_login_connection">Connecting to OAuth 2.0 server&#8230;</string>
<string name="ssl_validator_header">The identity of the site could not be verified</string>
<string name="ssl_validator_header">The identity of the server could not be verified</string>
<string name="ssl_validator_reason_cert_not_trusted">- The server certificate is not trusted</string>
<string name="ssl_validator_reason_cert_expired">- The server certificate expired</string>
<string name="ssl_validator_reason_cert_not_yet_valid">- The server certificate valid dates are in the future</string>
@@ -657,6 +659,7 @@
<string name="activities_no_results_message">This stream will show events like\nadditions, changes and shares</string>
<string name="webview_error">Error occurred</string>
<string name="prefs_category_about">About</string>
<string name="prefs_category_dev">Dev</string>
<string name="actionbar_contacts">Back up contacts</string>
<string name="actionbar_contacts_restore">Restore contacts</string>
@@ -675,6 +678,8 @@
<string name="contacts_preferences_something_strange_happened">We can\'t find your last backup!</string>
<string name="contacts_preferences_backup_scheduled">Backup scheduled and will start shortly</string>
<string name="contacts_preferences_import_scheduled">Import scheduled and will start shortly</string>
<string name="pref_preview_behaviour_entry_download">full sized version</string>
<string name="pref_preview_behaviour_entry_preview">resized version</string>
<!-- Notifications -->
<string name="new_notification_received">New notification received</string>
@@ -689,9 +694,11 @@
<string name="synced_folders_configure_folders">Configure folders</string>
<string name="empty" translatable="false"/>
<string name="prefs_preview_behaviour">Click on image downloads …</string>
<string name="test_server_button">Test server connection</string>
<string name="info_separator" translatable="false">,</string>
<string name="resharing_is_not_allowed">Resharing is not allowed</string>
<string name="resized_image_not_possible">No resized image possible. Download full image?</string>
<string name="whats_new_fingerprint_title">Unlock with fingerprint</string>
<string name="whats_new_fingerprint_content">Use your fingerprint to unlock the app</string>
</resources>
+6 -6
View File
@@ -35,13 +35,13 @@
<item name="searchViewStyle">@style/ownCloud.SearchView</item>
</style>
<style name="FallbackThemingTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#424242</item>
<item name="colorPrimaryDark">#212121</item>
<item name="colorAccent">#757575</item>
</style>
<style name="FallbackThemingTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#424242</item>
<item name="colorPrimaryDark">#212121</item>
<item name="colorAccent">#757575</item>
</style>
<!-- seperate action bar style for activities without an action bar -->
<!-- seperate action bar style for activities without an action bar -->
<style name="Theme.ownCloud.Toolbar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff. Show more