Compare commits

...
Author SHA1 Message Date
tobiasKaminsky da490b9c88 add android info
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-13 08:35:55 +01:00
tobiasKaminsky 31b8bebb3b wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 10:21:05 +01:00
tobiasKaminsky 780fc7d4d7 wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:55:29 +01:00
tobiasKaminsky 21dad106e4 wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:43:05 +01:00
tobiasKaminsky 4ec4fcddbb wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:10:37 +01:00
tobiasKaminsky d885b9f580 wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:10:37 +01:00
tobiasKaminsky 2bdcc1615c wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:10:37 +01:00
tobiasKaminsky f42b1f5444 wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:10:37 +01:00
tobiasKaminsky 585cbbd8b7 wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:10:37 +01:00
tobiasKaminsky 0a2a53ad2e wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:10:37 +01:00
tobiasKaminsky 0a7b2de274 wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:10:37 +01:00
tobiasKaminsky fb8a93b9c2 wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:10:37 +01:00
tobiasKaminsky 88a6c4c94d wip
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 09:10:37 +01:00
Tobias Kaminsky 257ac81f73 Merge pull request #4900 from nextcloud/v2withActivity
Initial work on v2 with activity
2019-12-12 08:10:15 +01:00
tobiasKaminsky a2357181ab fix tests
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 07:13:29 +01:00
tobiasKaminsky 6eb4ac7c47 revert to master snapshot
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 06:50:52 +01:00
tobiasKaminsky 8b61e74057 remove unneeded accountManager
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 06:50:52 +01:00
tobiasKaminsky e5cd5ffcd6 use nextcloudClient.execute(…)
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 06:50:52 +01:00
tobiasKaminsky 066f4c25aa Initial work on v2 with activity
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-12 06:50:52 +01:00
Nextcloud bot 45f114671a [tx-robot] updated from transifex 2019-12-12 03:53:43 +00:00
Tobias Kaminsky d913950b50 daily dev 20191211
5f6dc23a5 Merge pull request #4973 from nextcloud/addFastlane
1145c3813 Merge pull request #4958 from Infomaniak/fix/see-detail-from-preview-nc
fd3ff4cbc Merge pull request #4898 from siddharths2710/master
988e79702 [tx-robot] updated from transifex
8062340f6 Merge pull request #4657 from nextcloud/bumpSDK
4b328cbe3 manually increase spotbugs and lint
1290bbe52 Merge pull request #4918 from Infomaniak/fix/calendar-not-refreshed
da104fc48 Merge pull request #4962 from Infomaniak/fix/add-activities-empty-icon
702c4f71f Merge pull request #4954 from nextcloud/dependabot/gradle/com.android.tools.build-gradle-3.5.3
f7597c147 [tx-robot] updated from transifex
c27f4cea3 [tx-robot] updated from transifex
75442575f [tx-robot] updated from transifex
4576d45ce daily dev 20191207
2019-12-11 03:38:43 +01:00
Andy Scherzinger 5f6dc23a5a Merge pull request #4973 from nextcloud/addFastlane
Add fastlane scripts
2019-12-10 09:46:49 +01:00
Tobias Kaminsky 1145c3813e Merge pull request #4958 from Infomaniak/fix/see-detail-from-preview-nc
Fixed issue relative to Properties from ImagePreview
2019-12-10 09:32:23 +01:00
Tobias Kaminsky fd3ff4cbcb Merge pull request #4898 from siddharths2710/master
Refresh issue for file movment/file restore operations
2019-12-10 09:22:57 +01:00
Nextcloud bot 988e797025 [tx-robot] updated from transifex 2019-12-10 03:17:14 +00:00
Andy Scherzinger 8062340f63 Merge pull request #4657 from nextcloud/bumpSDK
bump to latest SDK
2019-12-09 17:51:09 +01:00
tobiasKaminsky 4b328cbe3e manually increase spotbugs and lint
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-09 11:59:54 +01:00
Tobias Kaminsky 1290bbe52e Merge pull request #4918 from Infomaniak/fix/calendar-not-refreshed
Resolved issue relative to calendar refresh in link-sharing
2019-12-09 11:58:21 +01:00
Tobias Kaminsky da104fc48a Merge pull request #4962 from Infomaniak/fix/add-activities-empty-icon
Fixed bug relative to activities empty icon
2019-12-09 11:54:18 +01:00
Tobias Kaminsky 702c4f71fe Merge pull request #4954 from nextcloud/dependabot/gradle/com.android.tools.build-gradle-3.5.3
Bump gradle from 3.5.2 to 3.5.3
2019-12-09 09:00:40 +01:00
Nextcloud bot f7597c1472 [tx-robot] updated from transifex 2019-12-09 03:13:39 +00:00
Nextcloud bot c27f4cea39 [tx-robot] updated from transifex 2019-12-08 03:15:17 +00:00
Nextcloud bot 75442575f0 [tx-robot] updated from transifex 2019-12-07 03:15:41 +00:00
Tobias Kaminsky 4576d45ce3 daily dev 20191207
f9bd91b4b Merge pull request #4956 from nextcloud/fixScreenshot
d95351b04 Merge pull request #4953 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.2.2
3ed9ce2e2 Merge pull request #4920 from nextcloud/theming_server_input
b01f71972 fix #4955
01e532929 fix #4752
d8722b52d [tx-robot] updated from transifex
ed52ad56a daily dev 20191206
2019-12-07 03:40:51 +01:00
Siddharth Srinivasan aabc97de82 Renamed refresh methods and updated ETag parameter accordingly
Signed-off-by: Siddharth Srinivasan <[email protected]>

Renamed refresh methods and updated ETag parameter accordingly with sign-off
2019-12-06 21:57:14 +05:30
Siddharth Srinivasan c608f0081c Merge remote-tracking branch 'upstream/master'
Keep in line with upstream
2019-12-06 20:36:26 +05:30
Kilian Périsset 88fe5069eb Fixed bug relative to activities icon + applied DRY 2019-12-06 15:10:41 +01:00
Kilian Périsset 9b94cc2b58 Fixed the indentation for ExpirationDatePicker 2019-12-06 12:46:50 +01:00
Kilian Périsset 65b82c2ee5 Allowed onbackpressed from properties (without redisplaying file) + Removed useless intent data 2019-12-06 12:07:53 +01:00
Kilian Périsset 25d9c46f82 Fixed bug relative to details from Image Preview 2019-12-06 11:52:47 +01:00
Andy Scherzinger f9bd91b4b3 Merge pull request #4956 from nextcloud/fixScreenshot
fix #4955
2019-12-06 10:21:22 +01:00
Tobias Kaminsky d95351b040 Merge pull request #4953 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.2.2
Bump detekt-gradle-plugin from 1.2.1 to 1.2.2
2019-12-06 10:07:29 +01:00
Tobias Kaminsky 3ed9ce2e2b Merge pull request #4920 from nextcloud/theming_server_input
Fix theming: server url input
2019-12-06 10:04:23 +01:00
tobiasKaminsky b01f71972f fix #4955
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-06 08:25:50 +01:00
tobiasKaminsky 01e532929d fix #4752
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-06 08:06:42 +01:00
Nextcloud bot d8722b52de [tx-robot] updated from transifex 2019-12-06 03:15:42 +00:00
Tobias Kaminsky ed52ad56aa daily dev 20191206
645f194c8 Merge pull request #4950 from nextcloud/changelog-master-stable-3.9.2
d006ac257 Merge pull request #4923 from nextcloud/theming_sharing_box
1f861dfb5 Add changelog for 3.9.2
eb74b5230 Merge pull request #4947 from nextcloud/fixTime
1584de976 use SystemClock.elapsedRealtime() everywhere
664727b2a Merge pull request #4945 from nextcloud/dependabot/gradle/com.pinterest-ktlint-0.36.0
ead35eb3a [tx-robot] updated from transifex
17914038c daily dev 20191205
2019-12-06 03:36:59 +01:00
dependabot-preview[bot] b3e0d7721e Bump gradle from 3.5.2 to 3.5.3
Bumps gradle from 3.5.2 to 3.5.3.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-12-06 02:14:58 +00:00
dependabot-preview[bot] 4a46d01c4b Bump detekt-gradle-plugin from 1.2.1 to 1.2.2
Bumps detekt-gradle-plugin from 1.2.1 to 1.2.2.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-12-06 02:14:12 +00:00
Andy Scherzinger 21baad4fdc fix #4752 for landscape
Signed-off-by: Andy Scherzinger <[email protected]>
2019-12-05 18:30:15 +01:00
tobiasKaminsky 04d59133ca fix #4752
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-05 18:30:14 +01:00
Andy Scherzinger 645f194c88 Merge pull request #4950 from nextcloud/changelog-master-stable-3.9.2
Add changelog for 3.9.2
2019-12-05 18:17:31 +01:00
Kilian Périsset acd5d48d96 Applied the expiration date in each instance of DatePicker 2019-12-05 11:52:33 +01:00
tobiasKaminsky 866d163a73 Add fastlane scripts
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-05 11:38:16 +01:00
Andy Scherzinger d006ac257e Merge pull request #4923 from nextcloud/theming_sharing_box
fix wrong text color on edit text input on dark mode
2019-12-05 11:20:44 +01:00
tobiasKaminsky 1f861dfb58 Add changelog for 3.9.2
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-05 11:18:53 +01:00
Tobias Kaminsky eb74b5230f Merge pull request #4947 from nextcloud/fixTime
use SystemClock.elapsedRealtime() everywhere
2019-12-05 11:08:15 +01:00
tobiasKaminsky 1584de9769 use SystemClock.elapsedRealtime() everywhere
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-05 11:05:47 +01:00
Tobias Kaminsky 664727b2a6 Merge pull request #4945 from nextcloud/dependabot/gradle/com.pinterest-ktlint-0.36.0
Bump ktlint from 0.35.0 to 0.36.0
2019-12-05 08:39:58 +01:00
Nextcloud bot ead35eb3a1 [tx-robot] updated from transifex 2019-12-05 03:13:49 +00:00
Tobias Kaminsky 17914038ca daily dev 20191205
adbc1f27a Merge pull request #4940 from nextcloud/changelog-master-stable-3.9.1
e0ec1c163 Add changelog for 3.9.1
9dcb91526 [tx-robot] updated from transifex
92510cb16 Merge pull request #4938 from nextcloud/disableMissingDefaultResource
a89481461 disable MissingDefaultResource
dda56defb Merge pull request #4933 from nextcloud/appLocking
cb0067717 Merge pull request #4926 from nextcloud/deleteChecksFor16
fd48163e2 Merge pull request #4922 from nextcloud/themeFollowOS
5e687f2c1 Dark mode: light, dark, follow system
fb69c1bd5 remove all checks for <= JELLY_BEAN as we have this as our new minimum.
683faab11 [tx-robot] updated from transifex
c3eec4777 daily dev 20191204
2019-12-05 03:36:55 +01:00
dependabot-preview[bot] 86c5179c8e Bump ktlint from 0.35.0 to 0.36.0
Bumps [ktlint](https://github.com/pinterest/ktlint) from 0.35.0 to 0.36.0.
- [Release notes](https://github.com/pinterest/ktlint/releases)
- [Changelog](https://github.com/pinterest/ktlint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pinterest/ktlint/compare/0.35.0...0.36.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-12-05 02:14:52 +00:00
Andy Scherzinger adbc1f27aa Merge pull request #4940 from nextcloud/changelog-master-stable-3.9.1
Add changelog for 3.9.1
2019-12-04 20:25:17 +01:00
tobiasKaminsky e0ec1c1637 Add changelog for 3.9.1
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-04 11:26:19 +01:00
Nextcloud bot 9dcb915266 [tx-robot] updated from transifex 2019-12-04 10:24:52 +00:00
Tobias Kaminsky 92510cb168 Merge pull request #4938 from nextcloud/disableMissingDefaultResource
disable MissingDefaultResource
2019-12-04 10:58:33 +01:00
tobiasKaminsky a894814611 disable MissingDefaultResource
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-04 10:57:47 +01:00
Tobias Kaminsky dda56defb4 Merge pull request #4933 from nextcloud/appLocking
Use SystemClock.elapsedRealtime() instead of System.currentTimeMillis()
2019-12-04 08:21:04 +01:00
Andy Scherzinger cb00677172 Merge pull request #4926 from nextcloud/deleteChecksFor16
remove all checks for <= JELLY_BEAN as we have this as our new minimum.
2019-12-04 06:59:17 +01:00
Tobias Kaminsky fd48163e22 Merge pull request #4922 from nextcloud/themeFollowOS
Dark mode: light, dark, follow system
2019-12-04 06:47:36 +01:00
tobiasKaminsky 5e687f2c17 Dark mode: light, dark, follow system
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-04 06:33:34 +01:00
tobiasKaminsky fb69c1bd51 remove all checks for <= JELLY_BEAN as we have this as our new minimum.
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-04 06:15:30 +01:00
Nextcloud bot 683faab116 [tx-robot] updated from transifex 2019-12-04 03:13:38 +00:00
Tobias Kaminsky c3eec47779 daily dev 20191204
7cf3ba93c Merge pull request #4925 from nextcloud/NotNull
cd86ff16c Merge pull request #4924 from nextcloud/theming_auto_upload
2f9c5e976 replace org.jetbrains.annotations with androidx.annotations
83903ea1d fix wrong sync status in auto upload on white theming
2dbf724b3 [tx-robot] updated from transifex
2d68e2e1c daily dev 20191203
2019-12-04 03:37:14 +01:00
Tobias Kaminsky 7cf3ba93c6 Merge pull request #4925 from nextcloud/NotNull
replace org.jetbrains.annotations with androidx.annotations
2019-12-03 15:49:40 +01:00
Kilian Périsset ba58d37aff Changed indentation of Picker new instance 2019-12-03 14:15:37 +01:00
Andy Scherzinger cd86ff16c2 Merge pull request #4924 from nextcloud/theming_auto_upload
fix wrong sync status in auto upload on white theming
2019-12-03 13:54:02 +01:00
tobiasKaminsky 2f9c5e9761 replace org.jetbrains.annotations with androidx.annotations
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-03 13:31:02 +01:00
tobiasKaminsky 3cf0e6e5e4 replaced distinct by manually unique via HashMap
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-03 09:48:23 +01:00
tobiasKaminsky 92d872ceec bump to latest SDK
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-03 09:48:23 +01:00
tobiasKaminsky 83903ea1db fix wrong sync status in auto upload on white theming
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-03 08:55:17 +01:00
tobiasKaminsky e0bd44cf83 fix wrong text color on search input on dark mode
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-03 08:36:20 +01:00
Nextcloud bot 2dbf724b33 [tx-robot] updated from transifex 2019-12-03 03:14:10 +00:00
Tobias Kaminsky 2d68e2e1c5 daily dev 20191203
d27075239 Merge pull request #4865 from Infomaniak/feature/fix-restore-btn-size
34db13482 Merge pull request #4910 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.2.1
eac9c9df6 Merge pull request #4911 from nextcloud/dependabot/gradle/org.mockito-mockito-core-3.2.0
dc0181bac [tx-robot] updated from transifex
82e226f86 Bump mockito-core from 3.1.0 to 3.2.0
85e13f291 Bump detekt-gradle-plugin from 1.2.0 to 1.2.1
30f96aa98 daily dev 20191129
2019-12-03 03:38:47 +01:00
Kilian Périsset 0b86d6a1d9 Resolved issue relative to calendar refresh in link-sharing 2019-12-02 18:40:58 +01:00
Tobias Kaminsky d270752390 Merge pull request #4865 from Infomaniak/feature/fix-restore-btn-size
Added new restore icon (to replace the small one)
2019-12-02 12:30:09 +01:00
dependabot-preview[bot] 34db134829 Merge pull request #4910 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.2.1 2019-12-02 11:16:19 +00:00
Tobias Kaminsky eac9c9df67 Merge pull request #4911 from nextcloud/dependabot/gradle/org.mockito-mockito-core-3.2.0
Bump mockito-core from 3.1.0 to 3.2.0
2019-12-02 12:16:04 +01:00
Nextcloud bot dc0181bac9 [tx-robot] updated from transifex 2019-12-02 07:19:08 +00:00
tobiasKaminsky c612e2f547 Use SystemClock.elapsedRealtime() instead of System.currentTimeMillis()
Signed-off-by: tobiasKaminsky <[email protected]>
2019-12-02 07:52:17 +01:00
dependabot-preview[bot] 82e226f867 Bump mockito-core from 3.1.0 to 3.2.0
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.1.0...v3.2.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-12-02 02:14:04 +00:00
dependabot-preview[bot] 85e13f2910 Bump detekt-gradle-plugin from 1.2.0 to 1.2.1
Bumps detekt-gradle-plugin from 1.2.0 to 1.2.1.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-12-02 02:13:38 +00:00
Tobias Kaminsky 30f96aa984 daily dev 20191129
2c57e3709 Merge pull request #4784 from nextcloud/hideAutoUploadEntries
5257fb236 [tx-robot] updated from transifex
aa431815a Merge pull request #4882 from nextcloud/dependabot/gradle/com.google.android-flexbox-2.0.0
1f4e85768 Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
d17c85349 re-add button/action and improve upon code review
74bfe473c remove action button, use checkable menu item for shown/hidden state display
3e872df68 add more spotbug exclusions (for 3rd party libs)
4e0b40517 Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
7c62ad6b0 unify use of boolean, make use of lombok getter/setters, remove unneeded boolean boxing
bedc2b48e housekeeping, removing unused resources
ca6918f9f show/hide improvements when list is completed hidden + nicer empty UI + action button
23e44243d show/hide auto upload list items
540c649ef Merge pull request #4894 from nextcloud/dependabot/gradle/kotlin_version-1.3.61
f34ba2cdc Bump kotlin_version from 1.3.60 to 1.3.61
48038d564 Merge pull request #4883 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.2.0
83e0ebc46 [tx-robot] updated from transifex
21c0de3cd daily dev 20191127
2019-11-29 03:39:58 +01:00
Siddharth Srinivasan 041a6787b8 Explicitly refreshing list on resume and on file move operation
Signed-off-by: Siddharth Srinivasan <[email protected]>

Explicitly refreshing list on resume and on file move operation
2019-11-28 22:59:37 +05:30
Kilian Périsset dd574f99a0 Replaced restore icon by Material Replay 2019-11-28 17:20:05 +01:00
Tobias Kaminsky 2c57e37097 Merge pull request #4784 from nextcloud/hideAutoUploadEntries
Show/Hide auto upload list items
2019-11-28 08:19:15 +01:00
Nextcloud bot 5257fb236c [tx-robot] updated from transifex 2019-11-28 03:14:35 +00:00
Andy Scherzinger aa431815aa Merge pull request #4882 from nextcloud/dependabot/gradle/com.google.android-flexbox-2.0.0
Bump flexbox from 1.1.1 to 2.0.0
2019-11-27 23:36:39 +01:00
nextcloud-android-bot 1f4e857681 Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2019-11-27 20:55:41 +00:00
Andy Scherzinger d17c853493 re-add button/action and improve upon code review
Signed-off-by: Andy Scherzinger <[email protected]>
2019-11-27 21:43:53 +01:00
Andy Scherzinger 74bfe473c4 remove action button, use checkable menu item for shown/hidden state display
(design review)

Signed-off-by: Andy Scherzinger <[email protected]>
2019-11-27 21:35:31 +01:00
Andy Scherzinger 3e872df68c add more spotbug exclusions (for 3rd party libs)
Signed-off-by: Andy Scherzinger <[email protected]>
2019-11-27 21:35:19 +01:00
nextcloud-android-bot 4e0b40517c Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2019-11-27 21:35:18 +01:00
Andy Scherzinger 7c62ad6b06 unify use of boolean, make use of lombok getter/setters, remove unneeded boolean boxing
Signed-off-by: Andy Scherzinger <[email protected]>
2019-11-27 21:35:05 +01:00
Andy Scherzinger bedc2b48ee housekeeping, removing unused resources
Signed-off-by: Andy Scherzinger <[email protected]>
2019-11-27 21:35:05 +01:00
Andy Scherzinger ca6918f9fc show/hide improvements when list is completed hidden + nicer empty UI + action button
Signed-off-by: Andy Scherzinger <[email protected]>
2019-11-27 21:35:03 +01:00
Andy Scherzinger 23e44243da show/hide auto upload list items
Signed-off-by: Andy Scherzinger <[email protected]>
2019-11-27 21:34:40 +01:00
Andy Scherzinger 540c649efe Merge pull request #4894 from nextcloud/dependabot/gradle/kotlin_version-1.3.61
Bump kotlin_version from 1.3.60 to 1.3.61
2019-11-27 20:16:12 +01:00
dependabot-preview[bot] f34ba2cdca Bump kotlin_version from 1.3.60 to 1.3.61
Bumps `kotlin_version` from 1.3.60 to 1.3.61.

Updates `kotlin-gradle-plugin` from 1.3.60 to 1.3.61

Updates `kotlin-stdlib-jdk7` from 1.3.60 to 1.3.61
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.3.61/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.3.60...v1.3.61)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-11-27 13:03:07 +00:00
Tobias Kaminsky 48038d564e Merge pull request #4883 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.2.0
Bump detekt-gradle-plugin from 1.1.1 to 1.2.0
2019-11-27 14:01:50 +01:00
Nextcloud bot 83e0ebc463 [tx-robot] updated from transifex 2019-11-27 03:10:14 +00:00
Tobias Kaminsky 21c0de3cdd daily dev 20191127
e92daa2fc Merge pull request #4853 from nextcloud/migrate-simple-cases-of-get-current-account-to-get-user
99d9a6923 Merge pull request #4885 from nextcloud/disable_android_backup_qa
10960bf3a [tx-robot] updated from transifex
9f24b254f [tx-robot] updated from transifex
b7876c425 disable GoogleAppIndexingWarning lint check
11687c65c Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
80fb800ef Merge commit 'a7eb7148fa0ceb42981366eb2ddcf0ff921e6a55'
b91136c36 Disable android backup on the QA app
a7eb7148f Migrate simple cases of getCurrentAccount() to getUser()
6249a06a8 daily dev 20191123
2019-11-27 03:37:10 +01:00
Tobias Kaminsky e92daa2fc4 Merge pull request #4853 from nextcloud/migrate-simple-cases-of-get-current-account-to-get-user
Migrate simple cases of get current account to get user
2019-11-26 14:04:32 +01:00
Andy Scherzinger 99d9a6923e Merge pull request #4885 from nextcloud/disable_android_backup_qa
Disable android backup on the QA app
2019-11-26 08:47:53 +01:00
Nextcloud bot 10960bf3a2 [tx-robot] updated from transifex 2019-11-26 03:10:16 +00:00
Nextcloud bot 9f24b254f9 [tx-robot] updated from transifex 2019-11-25 14:33:17 +00:00
tobiasKaminsky b7876c4252 disable GoogleAppIndexingWarning lint check
Signed-off-by: tobiasKaminsky <[email protected]>
2019-11-25 15:26:08 +01:00
nextcloud-android-bot 11687c65cb Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2019-11-25 12:22:26 +00:00
drone 80fb800ef1 Merge commit 'a7eb7148fa0ceb42981366eb2ddcf0ff921e6a55' 2019-11-25 12:08:09 +00:00
Alice Gaudon b91136c362 Disable android backup on the QA app
Signed-off-by: Alice Gaudon <[email protected]>
2019-11-25 10:22:12 +01:00
Chris Narkiewicz a7eb7148fa Migrate simple cases of getCurrentAccount() to getUser()
Migrate trivially convertible uses of getCurrentAccount()
to new user model - getUser().

Signed-off-by: Chris Narkiewicz <[email protected]>
2019-11-25 08:53:50 +00:00
dependabot-preview[bot] 4f26261bf8 Bump detekt-gradle-plugin from 1.1.1 to 1.2.0
Bumps detekt-gradle-plugin from 1.1.1 to 1.2.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-11-25 02:15:52 +00:00
dependabot-preview[bot] 0691786fb8 Bump flexbox from 1.1.1 to 2.0.0
Bumps [flexbox](https://github.com/google/flexbox-layout) from 1.1.1 to 2.0.0.
- [Release notes](https://github.com/google/flexbox-layout/releases)
- [Commits](https://github.com/google/flexbox-layout/compare/1.1.1...2.0.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-11-25 02:15:12 +00:00
Tobias Kaminsky 6249a06a8d daily dev 20191123
c8eba1d5a Merge pull request #4835 from nextcloud/ezaquarii/new-user-model
609b99666 New user model
44220d73f Merge pull request #4867 from nextcloud/dependabot/gradle/androidx.exifinterface-exifinterface-1.1.0
6e5d7a89c daily dev 20191121
2019-11-23 03:36:58 +01:00
Tobias Kaminsky c8eba1d5ad Merge pull request #4835 from nextcloud/ezaquarii/new-user-model
New user model
2019-11-22 07:57:04 +01:00
Chris Narkiewicz 609b99666f New user model
New non-nullable user model abstracts away all complexities of Nextcloud
user account and provides.

- backported java.util.Optional
- extended UserAccountManager with User getters
- deprecated CurrentAccountProvider.getCurrentAccount() method
- migrated connectivity service to new user model
- migrated UploadsStorageManager to new user model
- migrated OCFileListAdapter

Signed-off-by: Chris Narkiewicz <[email protected]>
2019-11-21 19:58:57 +00:00
Tobias Kaminsky 44220d73fe Merge pull request #4867 from nextcloud/dependabot/gradle/androidx.exifinterface-exifinterface-1.1.0
Bump exifinterface from 1.0.0 to 1.1.0
2019-11-21 10:05:00 +01:00
Tobias Kaminsky 6e5d7a89c1 daily dev 20191121
b9ff6cecf Merge pull request #4843 from Unpublished/fix4842
0977c9d2e daily dev 20191120
2019-11-21 03:37:08 +01:00
dependabot-preview[bot] 16c220e7af Bump exifinterface from 1.0.0 to 1.1.0
Bumps exifinterface from 1.0.0 to 1.1.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-11-21 02:16:42 +00:00
Tobias Kaminsky b9ff6cecfc Merge pull request #4843 from Unpublished/fix4842
Use png instead of vector drawable for bitmap
2019-11-20 16:09:22 +01:00
Kilian Périsset ddb015bda8 Added new restore icon 2019-11-20 16:05:42 +01:00
Tobias Kaminsky 0977c9d2e1 daily dev 20191120
21ef00654 Merge pull request #4858 from nextcloud/changeScreenshot
0223085a8 shorten text a bit
8879179cf Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
94502f66b Merge pull request #4787 from ArisuOngaku/auto-upload-start-date-persistence
21109375c Merge pull request #4839 from nextcloud/dependabot/gradle/markwonVersion-4.2.0
f1a0ac5c2 [tx-robot] updated from transifex
a00677cd6 daily dev 20191119
2019-11-20 03:37:09 +01:00
Unpublished 26c5c5e015 Use png for checker image to use it via bitmap
Signed-off-by: Unpublished <[email protected]>
2019-11-19 20:10:19 +01:00
Andy Scherzinger 21ef006544 Merge pull request #4858 from nextcloud/changeScreenshot
Screenshots: shorten text a bit
2019-11-19 17:45:37 +01:00
tobiasKaminsky 0223085a8d shorten text a bit
Signed-off-by: tobiasKaminsky <[email protected]>
2019-11-19 14:35:31 +01:00
nextcloud-android-bot 8879179cff Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2019-11-19 12:28:44 +00:00
Tobias Kaminsky 94502f66b5 Merge pull request #4787 from ArisuOngaku/auto-upload-start-date-persistence
Make synced folder init/enable date persistent
2019-11-19 13:21:43 +01:00
Tobias Kaminsky 21109375c3 Merge pull request #4839 from nextcloud/dependabot/gradle/markwonVersion-4.2.0
Bump markwonVersion from 4.1.2 to 4.2.0
2019-11-19 07:44:51 +01:00
Nextcloud bot f1a0ac5c26 [tx-robot] updated from transifex 2019-11-19 03:10:54 +00:00
Tobias Kaminsky a00677cd63 daily dev 20191119
dbe12e6d2 Merge pull request #4789 from nextcloud/name_pattern_menus
77b6b178a Merge pull request #4841 from nextcloud/disableOldLoginMethod
b561f6883 allow to switch off old login method
b59d96ace [tx-robot] updated from transifex
9ae550731 [tx-robot] updated from transifex
bfdaba8bd [tx-robot] updated from transifex
c82c08059 daily dev 20191116
2019-11-19 03:37:08 +01:00
Tobias Kaminsky dbe12e6d20 Merge pull request #4789 from nextcloud/name_pattern_menus
Improve menu file name pattern
2019-11-18 15:26:35 +01:00
Tobias Kaminsky 77b6b178a9 Merge pull request #4841 from nextcloud/disableOldLoginMethod
allow to switch off old login method
2019-11-18 13:51:38 +01:00
tobiasKaminsky b561f68834 allow to switch off old login method
Signed-off-by: tobiasKaminsky <[email protected]>
2019-11-18 10:13:09 +01:00
Nextcloud bot b59d96ace0 [tx-robot] updated from transifex 2019-11-18 03:09:26 +00:00
dependabot-preview[bot] b6d682683c Bump markwonVersion from 4.1.2 to 4.2.0
Bumps `markwonVersion` from 4.1.2 to 4.2.0.

Updates `core` from 4.1.2 to 4.2.0
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.1.2...v4.2.0)

Updates `ext-strikethrough` from 4.1.2 to 4.2.0
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.1.2...v4.2.0)

Updates `ext-tables` from 4.1.2 to 4.2.0
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.1.2...v4.2.0)

Updates `ext-tasklist` from 4.1.2 to 4.2.0
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.1.2...v4.2.0)

Updates `html` from 4.1.2 to 4.2.0
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.1.2...v4.2.0)

Updates `syntax-highlight` from 4.1.2 to 4.2.0
- [Release notes](https://github.com/noties/Markwon/releases)
- [Changelog](https://github.com/noties/Markwon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/noties/Markwon/compare/v4.1.2...v4.2.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-11-18 02:15:46 +00:00
Nextcloud bot 9ae550731e [tx-robot] updated from transifex 2019-11-17 03:12:24 +00:00
Nextcloud bot bfdaba8bde [tx-robot] updated from transifex 2019-11-16 03:09:26 +00:00
Tobias Kaminsky c82c08059a daily dev 20191116
5273e1e7f Merge pull request #4832 from nextcloud/dependabot/gradle/kotlin_version-1.3.60
bd503a86c [tx-robot] updated from transifex
20c9ce361 Bump kotlin_version from 1.3.50 to 1.3.60
3943e1c75 [tx-robot] updated from transifex
75de7b88d daily dev 20191114
2019-11-16 03:40:11 +01:00
Alice Gaudon 65da616f81 FilesSyncHelper: use our own logging framework
Signed-off-by: Alice Gaudon <[email protected]>
2019-11-15 07:56:17 +01:00
Andy Scherzinger 5273e1e7fc Merge pull request #4832 from nextcloud/dependabot/gradle/kotlin_version-1.3.60
Bump kotlin_version from 1.3.50 to 1.3.60
2019-11-15 07:36:39 +01:00
Nextcloud bot bd503a86c7 [tx-robot] updated from transifex 2019-11-15 03:10:28 +00:00
dependabot-preview[bot] 20c9ce361a Bump kotlin_version from 1.3.50 to 1.3.60
Bumps `kotlin_version` from 1.3.50 to 1.3.60.

Updates `kotlin-gradle-plugin` from 1.3.50 to 1.3.60
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/commits)

Updates `kotlin-stdlib-jdk7` from 1.3.50 to 1.3.60
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/commits)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-11-15 02:18:56 +00:00
Nextcloud bot 3943e1c753 [tx-robot] updated from transifex 2019-11-14 03:10:34 +00:00
Tobias Kaminsky 75de7b88d4 daily dev 20191114
ed8b9cbb7 Merge pull request #4713 from nextcloud/ezaquarii/remove-set-account-from-first-run-activity
f38900d98 [tx-robot] updated from transifex
e43ef8e06 daily dev 20191113
2019-11-14 03:36:56 +01:00
Andy Scherzinger 693f408276 Improve menu file name pattern
Signed-off-by: Andy Scherzinger <[email protected]>
2019-11-13 11:47:23 +01:00
Tobias Kaminsky ed8b9cbb72 Merge pull request #4713 from nextcloud/ezaquarii/remove-set-account-from-first-run-activity
Remove out of band setAccount/onAccountSet calls
2019-11-13 10:02:29 +01:00
Nextcloud bot f38900d989 [tx-robot] updated from transifex 2019-11-13 03:10:02 +00:00
Tobias Kaminsky e43ef8e062 daily dev 20191113
f245b72de Merge pull request #4823 from nextcloud/changelog-master-stable-3.9.0
d30b574ff Add changelog for 3.9.0
df6d847f2 [tx-robot] updated from transifex
4343c3d67 Merge pull request #4814 from nextcloud/dependabot/gradle/org.jetbrains-annotations-18.0.0
86027dd09 Bump annotations from 17.0.0 to 18.0.0
4690042b0 [tx-robot] updated from transifex
ff646aa3d daily dev 20191108
2019-11-13 03:37:07 +01:00
Andy Scherzinger f245b72ded Merge pull request #4823 from nextcloud/changelog-master-stable-3.9.0
Add changelog for 3.9.0
2019-11-12 12:37:16 +01:00
tobiasKaminsky d30b574ff6 Add changelog for 3.9.0
Signed-off-by: tobiasKaminsky <[email protected]>
2019-11-12 10:53:05 +01:00
Chris Narkiewicz fb615ef279 Remove out-of-band setAccount/onAccountSet calls
Activity account is set in FilesActivity.onAccount(),
but related components are updated in BaseActivity.onStart().

1. Initialize account in BaseActivity.onCreate()
2. Update storage manager and capabilities immediately
   on account set, not waiting for onStart() lifecycle.
3. inline storage manager and capabilities update in setAccount()
4. Remove setAccount()/onAccountSet() calls that sets default
   account, as this duplicates BaseActivity.onCreate()

Signed-off-by: Chris Narkiewicz <[email protected]>
2019-11-12 06:21:05 +00:00
Nextcloud bot df6d847f29 [tx-robot] updated from transifex 2019-11-12 03:11:59 +00:00
Tobias Kaminsky 4343c3d67f Merge pull request #4814 from nextcloud/dependabot/gradle/org.jetbrains-annotations-18.0.0
Bump annotations from 17.0.0 to 18.0.0
2019-11-11 10:14:50 +01:00
dependabot-preview[bot] 86027dd091 Bump annotations from 17.0.0 to 18.0.0
Bumps [annotations](https://github.com/JetBrains/java-annotations) from 17.0.0 to 18.0.0.
- [Release notes](https://github.com/JetBrains/java-annotations/releases)
- [Commits](https://github.com/JetBrains/java-annotations/compare/17.0.0...18.0.0)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-11-11 02:14:20 +00:00
Nextcloud bot 4690042b06 [tx-robot] updated from transifex 2019-11-10 03:14:29 +00:00
Tobias Kaminsky ff646aa3d0 daily dev 20191108
403fc8756 [tx-robot] updated from transifex
142c79bc0 daily dev 20191107
2019-11-08 03:38:19 +01:00
Nextcloud bot 403fc87562 [tx-robot] updated from transifex 2019-11-07 03:08:34 +00:00
Tobias Kaminsky 142c79bc03 daily dev 20191107
890789f0a Merge pull request #4797 from nextcloud/ezaquarii/replace-shared-preferences-with-app-preferences-in-base-activity
180bdee72 Merge pull request #4801 from Infomaniak/feature/resolve-set-as-wallpaper-issue
039adc0a1 [tx-robot] updated from transifex
b59938d96 daily dev 20191106
2019-11-07 03:36:57 +01:00
Tobias Kaminsky 890789f0a7 Merge pull request #4797 from nextcloud/ezaquarii/replace-shared-preferences-with-app-preferences-in-base-activity
Replace BaseActivity.sharedPreferences with app preferences
2019-11-06 13:52:54 +01:00
Tobias Kaminsky 180bdee721 Merge pull request #4801 from Infomaniak/feature/resolve-set-as-wallpaper-issue
Fixing picture "set as wallpaper" issue in properties (duplicate)
2019-11-06 13:48:23 +01:00
Nextcloud bot 039adc0a18 [tx-robot] updated from transifex 2019-11-06 03:10:30 +00:00
Tobias Kaminsky b59938d960 daily dev 20191106
9e15f5ea3 Merge pull request #4799 from nextcloud/dependabot/gradle/com.android.tools.build-gradle-3.5.2
d208681fe Merge pull request #4796 from nextcloud/datepicker
7a8aee3e2 [tx-robot] updated from transifex
a3ae32129 Bump gradle from 3.5.1 to 3.5.2
b0563b931 Theming: Fix date picker button text colour
207f8947c [tx-robot] updated from transifex
1ec09848b [tx-robot] updated from transifex
513151491 [tx-robot] updated from transifex
38a83bb36 daily dev 20191102
2019-11-06 03:39:59 +01:00
Alice Gaudon 2e13212752 SyncedFolderProvider: pass Clock dependency via constructor instead of dagger
Signed-off-by: Alice Gaudon <[email protected]>
2019-11-06 01:59:06 +01:00
Alice Gaudon c2ea4de802 FileContentProvider: add dagger injection
Signed-off-by: Alice Gaudon <[email protected]>
2019-11-06 01:50:32 +01:00
Alice Gaudon 7f4db3fdd0 Make synced folder init/enable date persistent
Signed-off-by: Alice Gaudon <[email protected]>
2019-11-05 21:23:45 +01:00
Andy Scherzinger 9e15f5ea39 Merge pull request #4799 from nextcloud/dependabot/gradle/com.android.tools.build-gradle-3.5.2
Bump gradle from 3.5.1 to 3.5.2
2019-11-05 20:35:08 +01:00
Tobias Kaminsky d208681fed Merge pull request #4796 from nextcloud/datepicker
Theming: Fix date picker button text colour
2019-11-05 20:10:13 +01:00
Kilian Périsset 25aaf4b907 Applied ability to set as wallpaper from properties of a picture
Signed-off-by: Kilian Périsset <[email protected]>
2019-11-05 14:20:35 +01:00
Chris Narkiewicz 6b01382e7f Replace BaseActivity.sharedPreferences with app preferences
- Eliminate access to shared preferences when setting dark theme.
- Extend AppPreferences interface to allow subscription for preference changes
- Improve preferences interface documentation

Fixes #4791

Signed-off-by: Chris Narkiewicz <[email protected]>
2019-11-05 06:00:58 +00:00
Nextcloud bot 7a8aee3e22 [tx-robot] updated from transifex 2019-11-05 03:07:49 +00:00
dependabot-preview[bot] a3ae32129d Bump gradle from 3.5.1 to 3.5.2
Bumps gradle from 3.5.1 to 3.5.2.

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-11-05 02:19:42 +00:00
Daniel Bailey b0563b9310 Theming: Fix date picker button text colour
Signed-off-by: Daniel Bailey <[email protected]>
2019-11-04 14:52:54 +00:00
Nextcloud bot 207f8947cf [tx-robot] updated from transifex 2019-11-04 03:10:40 +00:00
Nextcloud bot 1ec09848b6 [tx-robot] updated from transifex 2019-11-03 03:12:13 +00:00
Nextcloud bot 5131514917 [tx-robot] updated from transifex 2019-11-02 03:06:45 +00:00
Tobias Kaminsky 38a83bb361 daily dev 20191102
62fc6fa53 Merge pull request #4782 from nextcloud/internalLinkWording
71264e19b use file/folder in "copy internal link" description
bd3ce6098 Merge pull request #4777 from nextcloud/v16
327817c04 [tx-robot] updated from transifex
a39022fbb daily dev 20191101
2019-11-02 03:38:27 +01:00
Tobias Kaminsky 62fc6fa53d Merge pull request #4782 from nextcloud/internalLinkWording
use file/folder in "copy internal link" description
2019-11-01 15:17:11 +01:00
tobiasKaminsky 71264e19b8 use file/folder in "copy internal link" description
Signed-off-by: tobiasKaminsky <[email protected]>
2019-11-01 12:32:07 +01:00
Tobias Kaminsky bd3ce60985 Merge pull request #4777 from nextcloud/v16
Make Android v16/JellyBean the new min-supported Android version
2019-11-01 09:11:36 +01:00
Nextcloud bot 327817c047 [tx-robot] updated from transifex 2019-11-01 02:59:14 +00:00
Tobias Kaminsky a39022fbbe daily dev 20191101
e3280b0bb Merge pull request #4775 from nextcloud/dependabot/gradle/com.h3xstream.findsecbugs-findsecbugs-plugin-1.10.1
575cd014d Bump findsecbugs-plugin from 1.10.0 to 1.10.1
946e5c2c1 Merge pull request #4768 from nextcloud/colorNames
78ed97ca0 [tx-robot] updated from transifex
f77b5bd4b daily dev 20191031
2019-11-01 03:38:35 +01:00
Andy Scherzinger d3d0df46f1 make Android v16/JellyBean the new min-supported Android version
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-31 23:36:06 +01:00
Andy Scherzinger e3280b0bb7 Merge pull request #4775 from nextcloud/dependabot/gradle/com.h3xstream.findsecbugs-findsecbugs-plugin-1.10.1
Bump findsecbugs-plugin from 1.10.0 to 1.10.1
2019-10-31 23:35:36 +01:00
dependabot-preview[bot] 575cd014d2 Bump findsecbugs-plugin from 1.10.0 to 1.10.1
Bumps [findsecbugs-plugin](https://github.com/find-sec-bugs/find-sec-bugs) from 1.10.0 to 1.10.1.
- [Release notes](https://github.com/find-sec-bugs/find-sec-bugs/releases)
- [Changelog](https://github.com/find-sec-bugs/find-sec-bugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/find-sec-bugs/find-sec-bugs/compare/version-1.10.0...version-1.10.1)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2019-10-31 22:06:14 +00:00
Andy Scherzinger 946e5c2c1e Merge pull request #4768 from nextcloud/colorNames
consistently use snake_case for color resources
2019-10-31 08:51:59 +01:00
Nextcloud bot 78ed97ca07 [tx-robot] updated from transifex 2019-10-31 03:00:33 +00:00
Tobias Kaminsky f77b5bd4b8 daily dev 20191031
c4e20a652 Merge pull request #4762 from nextcloud/color
af63eed65 overwrite in values-night/colors only values that differ move branding colors back to setup.xml
a9fcc7b03 daily dev 20191030
2019-10-31 03:36:52 +01:00
Andy Scherzinger fe353a7561 consistently use snake_case for color resources
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-30 16:13:29 +01:00
Tobias Kaminsky c4e20a652d Merge pull request #4762 from nextcloud/color
Dark theme: color enhancements
2019-10-30 11:08:30 +01:00
tobiasKaminsky af63eed654 overwrite in values-night/colors only values that differ
move branding colors back to setup.xml

Signed-off-by: tobiasKaminsky <[email protected]>
2019-10-30 09:32:58 +01:00
Tobias Kaminsky a9fcc7b03a daily dev 20191030
2a43da6bd Merge pull request #4746 from nextcloud/createChooser
f8d7ddd9d Merge pull request #4758 from nextcloud/fixDarkTheme
bee8770ce - fix typo in styles - fix sign up with provider in dark primary color
cc710b09c Merge pull request #3459 from nextcloud/dark_theme
c1aa005db changes due to code review
c801a2c7b Merge pull request #4744 from nextcloud/v3100_Alpha1
12fe91a6d use default open chooser with "just once", "always"
8b4481f7f [tx-robot] updated from transifex
2ea1f4e59 daily dev 20191029
2019-10-30 03:37:08 +01:00
Andy Scherzinger 2a43da6bdf Merge pull request #4746 from nextcloud/createChooser
use default open chooser with "just once", "always"
2019-10-29 16:23:00 +01:00
Andy Scherzinger f8d7ddd9de Merge pull request #4758 from nextcloud/fixDarkTheme
Fix dark theme #1
2019-10-29 14:01:49 +01:00
tobiasKaminsky bee8770ce0 - fix typo in styles
- fix sign up with provider in dark primary color

Signed-off-by: tobiasKaminsky <[email protected]>
2019-10-29 11:27:03 +01:00
Tobias Kaminsky cc710b09cb Merge pull request #3459 from nextcloud/dark_theme
Dark theme
2019-10-29 11:18:48 +01:00
Andy Scherzinger c1aa005db9 changes due to code review
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-29 11:05:44 +01:00
tobiasKaminsky 12fe91a6dd use default open chooser with "just once", "always"
Signed-off-by: tobiasKaminsky <[email protected]>
2019-10-29 07:28:51 +01:00
Andy Scherzinger 3de5e8fa52 remove possible overdraws
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 22:24:44 +01:00
Andy Scherzinger ae2dcbea33 align user info toolbar theming with main toolbar theming
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 18:11:36 +01:00
Andy Scherzinger 48e1384219 make circular checkIcon background day/night aware
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 17:48:25 +01:00
Andy Scherzinger 2021da0a8b proper contacts backup button theming
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 15:36:30 +01:00
Andy Scherzinger 48b43581cc proper button theming for notification actions
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 15:36:06 +01:00
Daniel Bailey 9a9e0e6c42 Merge branch 'dark_theme' of github.com:nextcloud/android into dark_theme
Signed-off-by: Daniel Bailey <[email protected]>
2019-10-28 13:32:14 +00:00
Daniel Bailey 853d7cd113 Dark theme updates
TextInputLayout in share password dialog is styled to match the app.
Receive files picker shows server primary colour on Upload button.

Signed-off-by: Daniel Bailey <[email protected]>
2019-10-28 13:03:19 +00:00
Daniel Bailey 4ce4027250 Update to Alert Dialogs in api 21 and upwards.
Signed-off-by: Daniel Bailey <[email protected]>
2019-10-28 12:59:34 +01:00
Andy Scherzinger b5d1de3601 bump material to 1.1.0-beta01
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:33 +01:00
Daniel Bailey 1615130093 Fix activity foreground text colour for >=API21.
Share expiration date picker now has buttons that are the primary
colour.

Theme change is now done in BaseActivity and ThemedPreferenceActivity.
This should help any activities in the back stack show the correct
theme.

Fixed style issues on firstrun and authenticator activities.

Signed-off-by: Daniel Bailey <[email protected]>
2019-10-28 12:59:32 +01:00
Andy Scherzinger a518885612 add dark/light theming for activities headline
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:32 +01:00
Andy Scherzinger f5a1a9a9cc bump to alpha10
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:31 +01:00
Andy Scherzinger 284bbf34e6 material design alpha09
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:30 +01:00
Andy Scherzinger 57db615a33 icons with light background need to be keep with dark color
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:29 +01:00
Andy Scherzinger cc2593cbdb proper icon display for night theme for activities and notifications
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:29 +01:00
Andy Scherzinger 44020dcc76 make progress bar day/night aware
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:28 +01:00
Andy Scherzinger 1e3f86cfe1 Bump material to alpha-08
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:27 +01:00
Andy Scherzinger 375fb97c06 use day/night color
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:27 +01:00
Andy Scherzinger cf839eac08 bump material lib to alpha07
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:26 +01:00
Andy Scherzinger 9a88ee24d3 remove unused radio button preference code
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:25 +01:00
Andy Scherzinger 110ce5e951 bump material lib to alpha06
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:24 +01:00
Andy Scherzinger 5554585348 make toolbar menu use the proper day/night popup theme
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:24 +01:00
Andy Scherzinger 1bdccebce8 use proper colors storage selector text
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:23 +01:00
Andy Scherzinger e14dc52fa7 use correct color after rebase
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:22 +01:00
Daniel Bailey 6bb9a70603 Various improvements to dark theme
Signed-off-by: Daniel Bailey <[email protected]>
2019-10-28 12:59:22 +01:00
Andy Scherzinger 6eb0744986 use proper color for storage location text
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:21 +01:00
Andy Scherzinger 8f8b67f57f don't tint avatars within the drawer menu
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:20 +01:00
Andy Scherzinger e32ec7a192 rebase fixing plus proper theming of legacy login fields
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:59:19 +01:00
Andy Scherzinger dc4cbb71e2 bump com.google.android.material:material to alpha5
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:52 +01:00
Daniel 689a0a216b "Activities" drawer selection background colour.
Signed-off-by: Daniel <[email protected]>
2019-10-28 12:58:51 +01:00
Andy Scherzinger b7e9d3f954 remove unused theme getter from interface
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:51 +01:00
Daniel Bailey 8d0ff8fecc Corrects "Choose" button colour in FolderPickerActivity. Removes un-used import from NotificationListAdapter.
MaterialButtons.
SearchView highlight text colour.
First run activity, outlined button colour.

Signed-off-by: Daniel Bailey <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:50 +01:00
Andy Scherzinger c6218a0e5f bump material lib to alpha03
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:08 +01:00
Daniel Bailey c7049788f7 DatePickerDialog theme and style.
Button styling.
Small improvements to layouts and correction of spelling errors.
Sets edittext highlight colour to theme colour.

Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:07 +01:00
Andy Scherzinger 30a5ec6ee1 improve codacy score
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:07 +01:00
Andy Scherzinger 562338cad1 set background color for primary action buttons on upload and participate
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:06 +01:00
Andy Scherzinger 913d8276e1 use xml drawables for shared state icon including day/night state
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:05 +01:00
Andy Scherzinger 790e3fa2f8 findbugs: accesses list or array with constant index
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:04 +01:00
Andy Scherzinger 3d60c83ba2 use right colors for drawer menu item text and icons
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:04 +01:00
Andy Scherzinger 55a32df928 use style instead of theme attribute for secondary action buttons
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:58:03 +01:00
Daniel 27b8ed4327 Dark theme v1
Fixing migration to androidx
Dark theme styling
File details fragment tab text colour
File list overflow menu background colour

Signed-off-by: Daniel Bailey <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-28 12:57:58 +01:00
Daniel Bailey bf0779a3ed Update to Alert Dialogs in api 21 and upwards.
Signed-off-by: Daniel Bailey <[email protected]>
2019-10-27 20:51:01 +00:00
Andy Scherzinger 25f58cd259 bump material to 1.1.0-beta01
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:54:13 +02:00
Daniel Bailey f5aa60bae9 Fix activity foreground text colour for >=API21.
Share expiration date picker now has buttons that are the primary
colour.

Theme change is now done in BaseActivity and ThemedPreferenceActivity.
This should help any activities in the back stack show the correct
theme.

Fixed style issues on firstrun and authenticator activities.

Signed-off-by: Daniel Bailey <[email protected]>
2019-10-07 16:43:36 +02:00
Andy Scherzinger 8aaf29a7c3 add dark/light theming for activities headline
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:35 +02:00
Andy Scherzinger 9eb6fe838e bump to alpha10
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:34 +02:00
Andy Scherzinger f6680a3375 material design alpha09
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:33 +02:00
Andy Scherzinger a2963d9fc3 icons with light background need to be keep with dark color
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:32 +02:00
Andy Scherzinger 2d0f4e83a6 proper icon display for night theme for activities and notifications
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:31 +02:00
Andy Scherzinger 01642564ed make progress bar day/night aware
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:30 +02:00
Andy Scherzinger ff9795d421 Bump material to alpha-08
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:28 +02:00
Andy Scherzinger 196e33998a use day/night color
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:27 +02:00
Andy Scherzinger 4a808ab15c bump material lib to alpha07
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:26 +02:00
Andy Scherzinger 916580cb19 remove unused radio button preference code
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:25 +02:00
Andy Scherzinger 21fb11d79b bump material lib to alpha06
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:24 +02:00
Andy Scherzinger e54db7c7c5 make toolbar menu use the proper day/night popup theme
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:23 +02:00
Andy Scherzinger 691ee27cc5 use proper colors storage selector text
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:21 +02:00
Andy Scherzinger dc0ca5cc84 use correct color after rebase
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:20 +02:00
Daniel Bailey c43633ebb9 Various improvements to dark theme
Signed-off-by: Daniel Bailey <[email protected]>
2019-10-07 16:43:19 +02:00
Andy Scherzinger 01cfd0ad33 use proper color for storage location text
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:18 +02:00
Andy Scherzinger eff6a5bed9 don't tint avatars within the drawer menu
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:16 +02:00
Andy Scherzinger f53f246f6e rebase fixing plus proper theming of legacy login fields
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:15 +02:00
Andy Scherzinger 5a4df84fc4 bump com.google.android.material:material to alpha5
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:13 +02:00
Daniel f459cd2c98 "Activities" drawer selection background colour.
Signed-off-by: Daniel <[email protected]>
2019-10-07 16:43:12 +02:00
Andy Scherzinger 55d5f2f41a remove unused theme getter from interface
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:11 +02:00
Daniel Bailey 66144bb8b6 Corrects "Choose" button colour in FolderPickerActivity. Removes un-used import from NotificationListAdapter.
MaterialButtons.
SearchView highlight text colour.
First run activity, outlined button colour.

Signed-off-by: Daniel Bailey <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:09 +02:00
Andy Scherzinger d1f1e6cff7 bump material lib to alpha03
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:08 +02:00
Daniel Bailey 9f7fa6b6b6 DatePickerDialog theme and style.
Button styling.
Small improvements to layouts and correction of spelling errors.
Sets edittext highlight colour to theme colour.

Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:07 +02:00
Andy Scherzinger b0734f5768 improve codacy score
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:06 +02:00
Andy Scherzinger 34cef89ce8 set background color for primary action buttons on upload and participate
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:04 +02:00
Andy Scherzinger c4b5d8f2e9 use xml drawables for shared state icon including day/night state
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:03 +02:00
Andy Scherzinger 1930e5dc74 findbugs: accesses list or array with constant index
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:02 +02:00
Andy Scherzinger cab2b12594 use right colors for drawer menu item text and icons
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:01 +02:00
Andy Scherzinger df15340fc2 use style instead of theme attribute for secondary action buttons
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:43:00 +02:00
Daniel 44099c0792 Dark theme v1
Fixing migration to androidx
Dark theme styling
File details fragment tab text colour
File list overflow menu background colour

Signed-off-by: Daniel Bailey <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
2019-10-07 16:42:49 +02:00
345 changed files with 6310 additions and 4656 deletions

No files matched your search

+371 -9
View File
@@ -3,7 +3,7 @@ name: generic
steps:
- name: generic
image: nextcloudci/android:android-49
image: nextcloudci/android10:android-56 # use always latest android version
environment:
GIT_USERNAME:
from_secret: GIT_USERNAME
@@ -48,11 +48,11 @@ trigger:
---
kind: pipeline
name: gplay
name: android10
steps:
- name: gplay
image: nextcloudci/android:android-49
- name: test
image: nextcloudci/android10:android-56 # use always latest android version
privileged: true
environment:
LOG_USERNAME:
@@ -66,13 +66,13 @@ steps:
ORG_GRADLE_PROJECT_coverage: ''
commands:
- scripts/checkIfRunDrone.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST || exit 0
- emulator-headless -avd android-27 -no-snapshot -gpu swiftshader_indirect -no-window -no-audio &
- /opt/android-sdk-linux/emulator/emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio &
- ./gradlew assembleGplay
- ./gradlew assembleGplayDebug
- ./wait_for_emulator.sh
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit" 10 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew installGplayDebugAndroidTest
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT" 10 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew combinedTestReport
- curl -o codecov.sh https://codecov.io/bash
- bash ./codecov.sh -t fc506ba4-33c3-43e4-a760-aada38c24fd5
@@ -108,13 +108,375 @@ trigger:
event:
- push
- pull_request
---
kind: pipeline
name: android9
steps:
- name: test
image: nextcloudci/android9:android-56
privileged: true
environment:
LOG_USERNAME:
from_secret: LOG_USERNAME
LOG_PASSWORD:
from_secret: LOG_PASSWORD
GIT_USERNAME:
from_secret: GIT_USERNAME
GIT_TOKEN:
from_secret: GIT_TOKEN
ORG_GRADLE_PROJECT_coverage: ''
commands:
- scripts/checkIfRunDrone.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST || exit 0
- /opt/android-sdk-linux/emulator/emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio &
- ./gradlew assembleGplay
- ./gradlew assembleGplayDebug
- ./wait_for_emulator.sh
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit" 9 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew installGplayDebugAndroidTest
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT" 9 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- name: notify
image: drillster/drone-email
settings:
port: 587
from: [email protected]
recipients_only: true
username:
from_secret: EMAIL_USERNAME
password:
from_secret: EMAIL_PASSWORD
recipients:
from_secret: EMAIL_RECIPIENTS
host:
from_secret: EMAIL_HOST
when:
event:
- push
status:
- failure
branch:
- master
services:
- name: server
image: nextcloudci/server:server-3
trigger:
branch:
- master
event:
- push
- pull_request
---
kind: pipeline
name: android8
steps:
- name: test
image: nextcloudci/android8:android-56
privileged: true
environment:
LOG_USERNAME:
from_secret: LOG_USERNAME
LOG_PASSWORD:
from_secret: LOG_PASSWORD
GIT_USERNAME:
from_secret: GIT_USERNAME
GIT_TOKEN:
from_secret: GIT_TOKEN
ORG_GRADLE_PROJECT_coverage: ''
commands:
- scripts/checkIfRunDrone.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST || exit 0
- /opt/android-sdk-linux/emulator/emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio &
- ./gradlew assembleGplay
- ./gradlew assembleGplayDebug
- ./wait_for_emulator.sh
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit" 8 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew installGplayDebugAndroidTest
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT" 8 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- name: notify
image: drillster/drone-email
settings:
port: 587
from: [email protected]
recipients_only: true
username:
from_secret: EMAIL_USERNAME
password:
from_secret: EMAIL_PASSWORD
recipients:
from_secret: EMAIL_RECIPIENTS
host:
from_secret: EMAIL_HOST
when:
event:
- push
status:
- failure
branch:
- master
services:
- name: server
image: nextcloudci/server:server-3
trigger:
branch:
- master
event:
- push
- pull_request
---
kind: pipeline
name: android7
steps:
- name: test
image: nextcloudci/android7:android-56
privileged: true
environment:
LOG_USERNAME:
from_secret: LOG_USERNAME
LOG_PASSWORD:
from_secret: LOG_PASSWORD
GIT_USERNAME:
from_secret: GIT_USERNAME
GIT_TOKEN:
from_secret: GIT_TOKEN
ORG_GRADLE_PROJECT_coverage: ''
commands:
- scripts/checkIfRunDrone.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST || exit 0
- /opt/android-sdk-linux/emulator/emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio &
- ./gradlew assembleGplay
- ./gradlew assembleGplayDebug
- ./wait_for_emulator.sh
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit" 7 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew installGplayDebugAndroidTest
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT" 7 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- name: notify
image: drillster/drone-email
settings:
port: 587
from: [email protected]
recipients_only: true
username:
from_secret: EMAIL_USERNAME
password:
from_secret: EMAIL_PASSWORD
recipients:
from_secret: EMAIL_RECIPIENTS
host:
from_secret: EMAIL_HOST
when:
event:
- push
status:
- failure
branch:
- master
services:
- name: server
image: nextcloudci/server:server-3
trigger:
branch:
- master
event:
- push
- pull_request
---
kind: pipeline
name: android6
steps:
- name: test
image: nextcloudci/android6:android-56
privileged: true
environment:
LOG_USERNAME:
from_secret: LOG_USERNAME
LOG_PASSWORD:
from_secret: LOG_PASSWORD
GIT_USERNAME:
from_secret: GIT_USERNAME
GIT_TOKEN:
from_secret: GIT_TOKEN
ORG_GRADLE_PROJECT_coverage: ''
commands:
- scripts/checkIfRunDrone.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST || exit 0
- /opt/android-sdk-linux/emulator/emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio &
- ./gradlew assembleGplay
- ./gradlew assembleGplayDebug
- ./wait_for_emulator.sh
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit" 6 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew installGplayDebugAndroidTest
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT" 6 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- name: notify
image: drillster/drone-email
settings:
port: 587
from: [email protected]
recipients_only: true
username:
from_secret: EMAIL_USERNAME
password:
from_secret: EMAIL_PASSWORD
recipients:
from_secret: EMAIL_RECIPIENTS
host:
from_secret: EMAIL_HOST
when:
event:
- push
status:
- failure
branch:
- master
services:
- name: server
image: nextcloudci/server:server-3
trigger:
branch:
- master
event:
- push
- pull_request
---
kind: pipeline
name: android5
steps:
- name: test
image: nextcloudci/android5:android-56
privileged: true
environment:
LOG_USERNAME:
from_secret: LOG_USERNAME
LOG_PASSWORD:
from_secret: LOG_PASSWORD
GIT_USERNAME:
from_secret: GIT_USERNAME
GIT_TOKEN:
from_secret: GIT_TOKEN
ORG_GRADLE_PROJECT_coverage: ''
commands:
- scripts/checkIfRunDrone.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST || exit 0
- /opt/android-sdk-linux/emulator/emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio &
- ./gradlew assembleGplay
- ./gradlew assembleGplayDebug
- ./wait_for_emulator.sh
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit" 5 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew installGplayDebugAndroidTest
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT" 5 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- name: notify
image: drillster/drone-email
settings:
port: 587
from: [email protected]
recipients_only: true
username:
from_secret: EMAIL_USERNAME
password:
from_secret: EMAIL_PASSWORD
recipients:
from_secret: EMAIL_RECIPIENTS
host:
from_secret: EMAIL_HOST
when:
event:
- push
status:
- failure
branch:
- master
services:
- name: server
image: nextcloudci/server:server-3
trigger:
branch:
- master
event:
- push
- pull_request
---
kind: pipeline
name: android4
steps:
- name: test
image: nextcloudci/android4:android-56
privileged: true
environment:
LOG_USERNAME:
from_secret: LOG_USERNAME
LOG_PASSWORD:
from_secret: LOG_PASSWORD
GIT_USERNAME:
from_secret: GIT_USERNAME
GIT_TOKEN:
from_secret: GIT_TOKEN
ORG_GRADLE_PROJECT_coverage: ''
commands:
- scripts/checkIfRunDrone.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST || exit 0
- /opt/android-sdk-linux/emulator/emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio &
- ./gradlew assembleGplay
- ./gradlew assembleGplayDebug
- ./wait_for_emulator.sh
- ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "Unit" 4 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- ./gradlew installGplayDebugAndroidTest
- ./gradlew createGplayDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "IT" 4 $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- name: notify
image: drillster/drone-email
settings:
port: 587
from: [email protected]
recipients_only: true
username:
from_secret: EMAIL_USERNAME
password:
from_secret: EMAIL_PASSWORD
recipients:
from_secret: EMAIL_RECIPIENTS
host:
from_secret: EMAIL_HOST
when:
event:
- push
status:
- failure
branch:
- master
services:
- name: server
image: nextcloudci/server:server-3
trigger:
branch:
- master
event:
- push
- pull_request
---
kind: pipeline
name: analysis
steps:
- name: analysis
image: nextcloudci/android:android-49
image: nextcloudci/android10:android-56 # use always latest android version
environment:
GIT_USERNAME:
from_secret: GIT_USERNAME
@@ -163,7 +525,7 @@ name: qa
steps:
- name: qa
image: nextcloudci/android:android-49
image: nextcloudci/android10:android-56 # use always latest android version
privileged: true
environment:
LOG_USERNAME:
+11
View File
@@ -36,3 +36,14 @@ build
fastlane/Fastfile
*.hprof
# fastlane specific
**/fastlane/report.xml
# deliver temporary files
**/fastlane/Preview.html
# snapshot generated screenshots
**/fastlane/screenshots
# scan temporary files
**/fastlane/test_output
+15 -1
View File
@@ -27,6 +27,11 @@
<emptyLine />
</value>
</option>
<option name="RIGHT_MARGIN" value="120" />
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
<AndroidXmlCodeStyleSettings>
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
</AndroidXmlCodeStyleSettings>
<JavaCodeStyleSettings>
<option name="IMPORT_LAYOUT_TABLE">
<value>
@@ -86,6 +91,7 @@
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
@@ -96,6 +102,7 @@
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
@@ -107,6 +114,7 @@
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -117,6 +125,7 @@
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -127,6 +136,7 @@
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
@@ -137,6 +147,7 @@
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
@@ -147,6 +158,7 @@
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
@@ -158,6 +170,7 @@
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
@@ -169,6 +182,7 @@
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
@@ -179,4 +193,4 @@
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
</component>
+26
View File
@@ -1,3 +1,29 @@
3.9.2 (December, 05, 2019)
- HOTFIX: fix login loop
- Fix crash on opening png images
- Translation updates
3.9.1 (December, 04, 2019)
- Fix crash on opening png images
- Translation updates
For a full list, please see https://github.com/nextcloud/android/milestone/43
3.9.0 (November, 12, 2019)
- preview Markdown with syntax highlighting @AndyScherzinger
- improved DavX5 integration @bitfireAT
- AutoUpload: allow files to upload into subfolder
- new media player service @ezaquarii
- Remote wipe integration
- Print from within Collabora
- enhanced SingleSignOn
- outdated server warning set to NC14
For a full list, please see https://github.com/nextcloud/android/milestone/38
## 3.8.1 (October, 11, 2019)
- upload images into subfolder, if source folder also has subfolder
+20
View File
@@ -23,6 +23,8 @@
1. Backport pull request
1. Pull requests that also need changes on library
1. Adding new files
1. File naming
1. Menu files
1. Translations
1. Releases
1. Types
@@ -236,6 +238,24 @@ Source code of app:
-->
```
## File naming
The file naming patterns are inspired and based on [Ribot's Android Project And Code Guidelines](https://github.com/ribot/android-guidelines/blob/c1d8c9c904eb31bf01fe24aadb963b74281fe79a/project_and_code_guidelines.md).
### Menu files
Similar to layout files, menu files should match the name of the component. For example, if we are defining a menu file that is going to be used in the `UserProfileActivity`, then the name of the file should be `activity_user_profile.xml`. Same pattern applies for menus used in adapter view items, dialogs, etc.
| Component | Class Name | Menu Name |
| ---------------- | ---------------------- | ----------------------------- |
| Activity | `UserProfileActivity` | `activity_user_profile.xml` |
| Fragment | `SignUpFragment` | `fragment_sign_up.xml` |
| Dialog | `ChangePasswordDialog` | `dialog_change_password.xml` |
| AdapterView item | --- | `item_person.xml` |
| Partial layout | --- | `partial_stats_bar.xml` |
A good practice is to not include the word `menu` as part of the name because these files are already located in the `menu` directory. In case a component uses several menus in different places (via popup menus) then the resource name would be extended. For example, if the user profile activity has two popup menus for configuring the users settings and one for the handling group assignments then the file names for the menus would be: `activity_user_profile_user_settings.xml` and `activity_user_profile_group_assignments.xml`.
## Translations
We manage translations via [Transifex](https://www.transifex.com/nextcloud/nextcloud/android/). So just request joining the translation team for Android on the site and start translating. All translations will then be automatically pushed to this repository, there is no need for any pull request for translations.
+27 -18
View File
@@ -7,7 +7,7 @@
import com.github.spotbugs.SpotBugsTask
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
@@ -20,13 +20,14 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath('com.dicedmelon.gradle:jacoco-android:0.1.4') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.1.1"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.2.2"
classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
}
}
@@ -58,7 +59,7 @@ configurations {
ext {
jacocoVersion = "0.8.2"
daggerVersion = "2.25.2"
markwonVersion = "4.1.2"
markwonVersion = "4.2.0"
prismVersion = "2.0.0"
androidLibraryVersion = "master-SNAPSHOT"
@@ -105,18 +106,24 @@ android {
abortOnError false
htmlReport true
htmlOutput file("$project.buildDir/reports/lint/lint.html")
disable 'MissingTranslation', 'GradleDependency', 'VectorPath', 'IconMissingDensityFolder', 'IconDensities'
disable 'MissingTranslation',
'GradleDependency',
'VectorPath',
'IconMissingDensityFolder',
'IconDensities',
'GoogleAppIndexingWarning',
'MissingDefaultResource'
}
dexOptions {
javaMaxHeapSize "4g"
}
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
minSdkVersion 16
targetSdkVersion 29
// arguments to be passed to functional tests
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -162,8 +169,8 @@ android {
versionDev {
applicationId "com.nextcloud.android.beta"
dimension "default"
versionCode 20191029
versionName "20191029"
versionCode 20191211
versionName "20191211"
}
qa {
@@ -267,18 +274,21 @@ dependencies {
gplayImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
versionDevImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
qaImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
compileOnly 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' // remove after entire switch to lib v2
implementation "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.1' // remove after entire switch to lib v2
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.material:material:1.1.0-beta01'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.1.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0"
implementation "androidx.work:work-runtime:2.2.0"
implementation "androidx.work:work-runtime-ktx:2.2.0"
implementation 'com.github.albfernandez:juniversalchardet:2.0.3' // need this version for Android <7
implementation 'com.google.code.findbugs:annotations:2.0.1'
compileOnly 'com.google.code.findbugs:annotations:2.0.1'
implementation 'commons-io:commons-io:2.6'
implementation 'com.github.tobiaskaminsky:android-job:v1.2.6.1' // 'com.github.evernote:android-job:v1.2.5'
implementation 'com.jakewharton:butterknife:10.2.0'
@@ -292,7 +302,7 @@ dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
implementation 'com.github.tobiaskaminsky:qrcodescanner:0.1.2.2' // 'com.github.blikoon:QRCodeScanner:0.1.2'
implementation 'com.google.android:flexbox:1.1.1'
implementation 'com.google.android:flexbox:2.0.0'
implementation 'org.parceler:parceler-api:1.1.12'
kapt 'org.parceler:parceler:1.1.12'
implementation('com.github.bumptech.glide:glide:3.8.0') {
@@ -301,11 +311,10 @@ dependencies {
implementation 'com.caverock:androidsvg:1.4'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'org.jetbrains:annotations:17.0.0'
implementation 'com.github.cotechde.hwsecurity:hwsecurity-fido:2.5.1'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.10.0'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.10.1'
spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.7'
implementation "com.google.dagger:dagger:$daggerVersion"
@@ -317,7 +326,7 @@ dependencies {
compileOnly "org.projectlombok:lombok:1.18.10"
annotationProcessor "org.projectlombok:lombok:1.18.10"
ktlint "com.pinterest:ktlint:0.35.0"
ktlint "com.pinterest:ktlint:0.36.0"
implementation 'org.conscrypt:conscrypt-android:2.2.1'
// dependencies for markdown rendering
@@ -333,7 +342,7 @@ dependencies {
// dependencies for local unit tests
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:3.1.0'
testImplementation 'org.mockito:mockito-core:3.2.0'
testImplementation 'androidx.test:core:1.2.0'
testImplementation 'org.powermock:powermock-core:2.0.4'
testImplementation 'org.powermock:powermock-module-junit4:2.0.4'
+252 -3
View File
@@ -1,6 +1,18 @@
# This is the minimum version number required.
fastlane_version "2.58.0"
## config
# add following to your shell rc:
# export FASTLANE_NEXTCLOUD_STORE_FILE=""
# export FASTLANE_NEXTCLOUD_STORE_PASSWORD=""
# export FASTLANE_NEXTCLOUD_KEY_ALIAS=""
# export FASTLANE_NEXTCLOUD_KEY_PASSWORD=""
# export FASTLANE_NEXTCLOUD_GITHUB_API_TOKEN=""
skip_docs
## public lanes
lane :screenshotsPhone do
build_for_screengrab()
@@ -15,12 +27,86 @@ lane :screenshotsTablet do
build_for_screengrab()
screengrab(
device_type: "sevenInch",
app_apk_path: APK_LOCATION,
tests_apk_path: TEST_APK_LOCATION
device_type: "sevenInch",
app_apk_path: APK_LOCATION,
tests_apk_path: TEST_APK_LOCATION
)
end
desc "Release phase 1: make gplay/generic for RC, then test it"
lane :releasePhase1_RC do
disableLogger()
makeReleases()
enableLogger()
end
desc "Release phase 1: make gplay/generic for FINAL, then test it"
lane :releasePhase1_Final do
makeReleases()
end
desc "Release phase 2 for RC: checks, tag, upload gplay to playstore with values from build.gradle"
lane :releasePhase2_RC do |options|
info = androidVersion
checkChangelog(info)
checkLibrary_RC()
checkIfScreenshotsExist()
checkIfAPKexists()
tag(info)
uploadToPlaystore_RC(info)
createGithubRelease(info)
fdroidMergeRequest(info)
createChangelogPullRequestRC(info)
end
desc "Release phase 2 for FINAL: checks, tag, upload gplay to playstore with values from build.gradle"
lane :releasePhase2_Final do |options|
info = androidVersion
checkChangelog(info)
checkLibrary_Final()
checkIfScreenshotsExist()
checkIfAPKexists()
tag(info)
uploadToPlaystore_Final(info)
createGithubRelease_Final(info)
fdroidMergeRequest_Final(info)
createChangelogPullRequest_Final(info)
end
desc "Makes gplay and generic releases in ../releases/"
lane :makeReleases do
sh("mkdir -p ../release")
sh("rm -rf ../release/*")
sh("rm -rf ../build")
SignedRelease(flavor:"Generic")
sh("mv ../build/outputs/apk/generic/release/*.apk ../release/")
sh("rename 'generic-release' 'nextcloud' ../release/generic-release*")
SignedRelease(flavor:"Gplay")
sh("cp ../build/outputs/apk/gplay/release/*.apk ../release/")
end
desc "Create GPlay release"
lane :createGplayRelease do |options|
SignedRelease(flavor:"Gplay")
sh("mv ../build/outputs/apk/gplay/release/*.apk ../release/")
end
desc "Create Generic release"
lane :createGenericRelease do |options|
SignedRelease(flavor:"Generic")
sh("mv ../build/outputs/apk/generic/release/*.apk ../release/")
end
desc "Create Dev release"
lane :createDevRelease do |options|
SignedRelease(flavor:"VersionDev")
sh("mv ../build/outputs/apk/versionDev/release/*.apk ../release/")
end
## private lanes
desc "Build debug and test APK for screenshots"
private_lane :build_for_screengrab do
build_android_app(
@@ -37,3 +123,166 @@ private_lane :build_for_screengrab do
)
TEST_APK_LOCATION = lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS].select{ |i| i[/androidTest/] }[0]
end
private_lane :createChangelogPullRequest_RC do |options|
sh("createChangelogPullRequestRC " + options["tag"] + " \"" + options["versionName"] + "\" " + options["versionCode"] + " \"" + options["branch"] + "\" ")
end
private_lane :createChangelogPullRequest_Final do |options|
sh("createChangelogPullRequestFinal " + options["tag"] + " \"" + options["versionName"] + "\" " + options["versionCode"] + " \"" + options["branch"] + "\" ")
end
private_lane :checkIfAPKexists do |options|
sh("if [ $(/bin/ls -1 ../release | wc -l) -ne 2 ]; then echo 'APKs do not exist ../release/; aborting!' ; exit 1 ;
fi")
end
desc "compute version"
private_lane :androidVersion do |options|
File.open("../build.gradle","r") do |f|
text = f.read
# everything between Document and Authors
major = text.match(/def versionMajor = ([0-9]*)$/)
minor = text.match(/def versionMinor = ([0-9]*)$/)
patch = text.match(/def versionPatch = ([0-9]*)$/)
build = text.match(/def versionBuild = ([0-9]*).*$/)
majorInt = major[1].to_i
minorInt = minor[1].to_i
patchInt = patch[1].to_i
buildInt = build[1].to_i
versionCode = majorInt * 10000000 + minorInt * 10000 + patchInt * 100 + buildInt
if buildInt > 89
name = major[1] + "." + minor[1] + "." + patch[1]
tag = "stable-" + major[1] + "." + minor[1] + "." + patch[1]
branch = "stable-" + major[1] + "." + minor[1]
elsif buildInt > 50
name = major[1] + "." + minor[1] + "." + patch[1] + " RC" + (buildInt - 50).to_s
tag = "rc-" + major[1] + "." + minor[1] + "." + patch[1] + "-" + format('%02d', (buildInt - 50))
branch = "stable-" + major[1] + "." + minor[1]
else
name = major[1] + "." + minor[1] + "." + patch[1] + " Alpha " + format('%02d', (buildInt + 1))
tag = "/"
branch = "stable-" + major[1] + "." + minor[1]
end
print "VersionCode: " + versionCode.to_s + "\n"
print "Name: " + name + "\n"
print "Tag: " + tag + "\n"
print "Branch: " + branch + "\n"
print "\ndisable IPv6 to upload to Gplay!!!\n"
answer = prompt(text: "is this okay?", boolean: true)
if !answer
exit
end
{ "versionCode" => versionCode.to_s, "versionName" => name, "tag" => tag, "branch" => branch }
end
end
desc "check if library is set correctly"
private_lane :checkLibrary_RC do
sh(" if [ $(egrep 'androidLibraryVersion.*master.*' ../build.gradle -c) -eq 1 ] ; then echo 'Library is set to master tag; aborting!' ; exit 1 ; fi")
end
desc "check if library is set correctly: must NOT contain master nor rc"
private_lane :checkLibrary_Final do
sh(" if [ $(grep 'androidLibraryVersion' ../build.gradle | egrep 'master|rc' -c) -eq 1 ] ; then echo 'Library is still set to rc tag; aborting!' ; exit 1 ; fi")
end
desc "check if screenshots exists and exit"
private_lane :checkIfScreenshotsExist do
sh(" if [ -e metadata/android/*/images ] ; then echo 'Screenshots in fastlane folder exist; aborting!' ; exit 1 ; fi")
end
private_lane :tag do |options|
add_git_tag(
tag: options["tag"],
sign: true
)
push_git_tags(
tag: options["tag"])
end
private_lane :disableLogger do
sh("sed -i s'#<bool name=\"logger_enabled\">false</bool>#<bool name=\"logger_enabled\">true</bool>#' ../src/main/res/values/setup.xml")
end
private_lane :enableLogger do
sh("sed -i s'#<bool name=\"logger_enabled\">true</bool>#<bool name=\"logger_enabled\">false</bool>#' ../src/main/res/values/setup.xml")
end
desc "Upload to play store"
private_lane :uploadToPlaystore_RC do |options|
upload_to_play_store(
skip_upload_images: true,
track: 'beta',
apk: "release/gplay-release-" + options["versionCode"] + ".apk"
)
end
desc "Upload to play store"
private_lane :uploadToPlaystore_Final do |options|
upload_to_play_store(
skip_upload_images: true,
apk: "release/gplay-release-" + options["versionCode"] + ".apk"
)
end
private_lane :SignedRelease do |options|
gradle(
task: 'assemble',
flavor: options[:flavor],
build_type: 'Release',
print_command: false,
properties: {
"android.injected.signing.store.file" => ENV["FASTLANE_NEXTCLOUD_STORE_FILE"],
"android.injected.signing.store.password" => ENV["FASTLANE_NEXTCLOUD_STORE_PASSWORD"],
"android.injected.signing.key.alias" => ENV["FASTLANE_NEXTCLOUD_KEY_ALIAS"],
"android.injected.signing.key.password" => ENV["FASTLANE_NEXTCLOUD_KEY_PASSWORD"],
}
)
end
private_lane :createGithubRelease_RC do |options|
set_github_release(
repository_name: "nextcloud/android",
api_token: ENV["FASTLANE_NEXTCLOUD_GITHUB_API_TOKEN"],
name: options["versionName"],
tag_name: options["tag"],
is_prerelease: true,
description: (File.read("metadata/android/en-US/changelogs/" + options["versionCode"] + ".txt") rescue "No changelog provided"),
upload_assets: [ "release/gplay-release-" + options["versionCode"] + ".apk", "release/nextcloud-" +
options["versionCode"] + ".apk" ]
)
end
private_lane :createGithubRelease_Final do |options|
set_github_release(
repository_name: "nextcloud/android",
api_token: ENV["FASTLANE_NEXTCLOUD_GITHUB_API_TOKEN"],
name: options["versionName"],
tag_name: options["tag"],
description: (File.read("metadata/android/en-US/changelogs/" + options["versionCode"] + ".txt") rescue "No changelog provided"),
upload_assets: [ "release/gplay-release-" + options["versionCode"] + ".apk", "release/nextcloud-" +
options["versionCode"] + ".apk" ]
)
end
private_lane :fdroidMergeRequest_RC do |options|
sh("fdroidMergeRequestRC " + options["tag"] + " \"" + options["versionName"] + "\" " + options["versionCode"])
end
private_lane :fdroidMergeRequest_Final do |options|
sh("fdroidMergeRequestFinal " + options["tag"] + " \"" + options["versionName"] + "\" " + options["versionCode"])
end
private_lane :checkChangelog do |options|
sh(" if [ ! -e metadata/android/en-US/changelogs/" + options["versionCode"] + ".txt ] ; then echo 'Changelog fastlane/metadata/android/en-US/changelogs/" + options["versionCode"] + ".txt does not exist' ; exit 1 ; fi")
sh(" if [ $(wc -m metadata/android/en-US/changelogs/" + options["versionCode"] + ".txt | cut -d' ' -f1) -ge 500 ] ; then echo 'Changlog more than 500 chars' ; exit 1 ; fi")
end
+1 -1
View File
@@ -1 +1 @@
423
409
+1 -1
View File
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 59 warnings</span>
<span class="mdl-layout-title">Lint Report: 73 warnings</span>
+10 -8
View File
@@ -4,16 +4,18 @@
#2: LOG_PASSWORD
#3: DRONE_BUILD_NUMBER
#4: TYPE (IT or Unit)
#5: DRONE_PULL_REQUEST
#6: GIT_USERNAME
#7: GIT_TOKEN
#5: androidVersion
#6: DRONE_PULL_REQUEST
#7: GIT_USERNAME
#8: GIT_TOKEN
URL=https://nextcloud.kaminsky.me/remote.php/webdav/android-integrationTests
ID=$3
USER=$1
PASS=$2
TYPE=$4
ANDROID_VERSION=$5
FOLDER=$ID-$ANDROID_VERSION
set -e
if [ $TYPE = "IT" ]; then
@@ -22,11 +24,11 @@ else
cd build/reports/tests/testGplayDebugUnitTest
fi
find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$ID/$(echo {} | sed s#\./##) \;
find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$ID/$(echo {} | sed s#\./##) --upload-file {} \;
find . -type d -exec curl -u $USER:$PASS -X MKCOL $URL/$FOLDER/$(echo {} | sed s#\./##) \;
find . -type f -exec curl -u $USER:$PASS -X PUT $URL/$FOLDER/$(echo {} | sed s#\./##) --upload-file {} \;
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$ID"
echo "Uploaded failing tests to https://www.kaminsky.me/nc-dev/android-integrationTests/$FOLDER"
curl -u $6:$7 -X POST https://api.github.com/repos/nextcloud/android/issues/$5/comments -d "{ \"body\" : \"$TYPE test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/$ID \" }"
curl -u $7:$8 -X POST https://api.github.com/repos/nextcloud/android/issues/$6/comments -d "{ \"body\" : \"$TYPE test failed on Android $ANDROID_VERSION: https://www.kaminsky.me/nc-dev/android-integrationTests/$FOLDER \" }"
exit 1
+7 -2
View File
@@ -17,7 +17,8 @@
<Match>
<Or>
<Class name="~.*\.Dagger.*" />
<Class name="~com.nextcloud.client.di\..*_.*" />
<Class name="~com\.nextcloud\.client\.di\..*_.*" />
<Class name="~dagger\.android\..*" />
</Or>
</Match>
<!-- Dagger generated code uses internal APIs -->
@@ -30,7 +31,7 @@
<Match>
<Or>
<Class name="~.*BindingImpl"/>
<Class name="~.*\.DataBinderMapperImpl"/>
<Class name="~.*\.DataBinderMapperImpl"/>
</Or>
</Match>
@@ -39,6 +40,10 @@
<Or>
<Package name="~io\.noties\..*" />
<Package name="~third_parties\.ezvcard_android\..*" />
<Package name="~com\.afollestad\.sectionedrecyclerview\..*" />
<Package name="~butterknife\..*" />
<Package name="~de\.cotech\..*" />
<Package name="~pl\.droidsonroids\..*" />
</Or>
</Match>
<Match>
@@ -1,19 +1,17 @@
Svobodně licencovaná Nexcloud Android aplikace, dávající vám mobilní svobodu.
Software, který můžete nasadit na vlastní server a ten organizuje ukládání a synchronizaci souborů. Díky doplňkům jde o kompletní groupwarové řešení.
Funkce:
* Snadno použitelné moderní rozhraní, přizpůsobené vzhledu, používaném na vašem serveru
* Nahrávejte soubory na svůj Nextcloud server
* Sdílejte je s ostatními
* Udržujte své oblíbené soubory a složky synchronizované
* Hledejte napříč všemi složkami na svém serveru
* Automaticky nahrávejte své fotky a videa, pořízená zařízením
* Udržujte si přehled pomocí oznámení
* Podporuje vícero účtů
* Zabezpečený přístup k vašim datům pomocí otisku prstu nebo PIN kódu
* Napojení na DAVx5 (dříve známé pod názvem DAVdroid) pro snadné nastavení synchronizace kalendáře a kontaktů
* Soubory nahrané do nexcloudu lze snadno sdílet s ostatními.
* Přístup odkudkoli přes webové a mobilní rozhraní.
* Synchronizace s počítačem umožňující offline práci.
* Vaše data jsou na vašem serveru a máte nad nimi plnou kontrolu.
* Jde o svobodný software, který snadno můžete sami hostovat a volně si ho přizplsobit. V případě potřeby je ale k dispozici komerční podpora.
* Vyhledávání napříč soubory.
* Synchronizace kontaktů a zpráv.
* Sdílení kalendářů do mobilu (DAVx5/DAVdroid)
* Neomezený počet uživatelů, autoupload fotek přímo z mobilu, oznámení,
* Klienti pro WIndows, MacOS, iOS, Android, web.
* Mnoho dalších doplňků s dalšími funkcemi.
Veškeré nalezené problémy hlaste na https://github.com/nextcloud/android/issues a diskutujte o aplikaci na https://help.nextcloud.com/c/clients/android
Díky Nextcloudu budete mít kompletní privátní řešení pro všechy vaše soubory, fotky, kalendáře a kontakty.
Noví v Nextcloud? Nextcloud je soukromý server pro synchronizaci souborů a jejich sdílení, dále pro komunikaci. Jedná se o svobodný software a můžete ho hostovat svými silami nebo za to zaplatit nějaké společnosti. Tím máte pod kontrolou své fotky, kalendář a kontakty, dokumenty a vše ostatní.
Podívejte se na Nextcloud na https://nextcloud.com
Připomínky zasílejte na https://github.com/nextcloud/android/issues, diskutovat lze na https://help.nextcloud.com/c/clients a vše ostatní najdete na https://nextcloud.com 
@@ -1 +1 @@
Produktivní platforma hostovaná u vás, kde vaše data jsou opravdu vaše
Platforma pro produktivitu hostovaná u vás, kde vaše data jsou opravdu vaše
@@ -0,0 +1,19 @@
Μια αυτόνομη πλατφόρμα που έχετε τον πλήρη έλεγχο.
Features:
* Εύκολο, μοντέρνο, συμβατό με το θέμα του διακομιστή σας
* Μεταφόρτωση αρχείων στον Nextclound διακομιστή σας
* Κοινή χρήση
* Κρατήστε τα αγαπημένα σας αρχεία και φακέλους συγχρονισμένα
* Αναζήτηση σε όλ΄ους τους φακέλους στον διακομιστή σας
* Αυτόματη μεταφόρτωση φωτογραφιών και βίντεο από την συσκευή σας
* Ενημέρωση με ειδοποιήσεις
* Υποστήριξη πολλαπλών λογαριασμών
* Ασφαλή σύνδεση στα δεδομένα σας με χρήση δακτυλικού αποτυπώματος ή κωδικού PIN
* Συνεργασία με DADVx5 (γνωστό ως DAVdroid) για εύκολη εγκατάσταση και συγχρονισμό ημερολογίου &
Παρακαλώ αναφέρετε τα σφάλματα στο https://github.com/nextcloud/android/issues και συζητήστε για την εφαρμογή στο https://help.nextcloud.com/c/clients/android
Καινούργιος στο Nextclound? To Nextclound είναι ένας διακομιστής &συγχρονισμού αρχείων κοινόχρηστων και επικοινωνίας. Ένα ελεύθερο λογισμικό, οπου μπορείτε να το υποστηρίξετε μόνοι σας ή επι πληρωμής. Με αυτό τον τρόπο έχετε τον έλεγχο των φωτογραφιών σας, του ημερολογίου σας και των δεδομένων των επαφών σας, των αρχείων σας και οτιδήποτε άλλο.
Ενημερωθείτε για το Nextclound στο https://nextcloud.com
@@ -0,0 +1 @@
Nextcloud
@@ -0,0 +1 @@
Kontrolpean mantentzen zaituen norberak ostatutako produktibitate plataforma
@@ -1 +1 @@
Nextcloud Android 앱으로 내 Nextcloud에 있는 모든 파일을 사용하십시오.
컨트롤 가능한 자체 호스팅 생산성 플랫폼
@@ -0,0 +1,58 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <[email protected]>
* Copyright (C) 2019 Chris Narkiewicz
* Copyright (C) 2019 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.account
import android.accounts.Account
import android.content.Context
import android.net.Uri
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.lib.common.OwnCloudAccount
import com.owncloud.android.lib.common.OwnCloudBasicCredentials
import java.net.URI
/**
* This object represents anonymous user, ie. user that did not log in the Nextcloud server.
* It serves as a semantically correct "empty value", allowing simplification of logic
* in various components requiring user data, such as DB queries.
*/
internal class AnonymousUser(private val accountType: String) : User {
companion object {
@JvmStatic
fun fromContext(context: Context): AnonymousUser {
val type = context.getString(R.string.account_type)
return AnonymousUser(type)
}
}
override val accountName: String = "anonymous"
override val server = Server(URI.create(""), MainApp.MINIMUM_SUPPORTED_SERVER_VERSION)
override val isAnonymous = true
override fun toPlatformAccount(): Account {
return Account(accountName, accountType)
}
override fun toOwnCloudAccount(): OwnCloudAccount {
return OwnCloudAccount(Uri.EMPTY, OwnCloudBasicCredentials("", ""))
}
}
@@ -2,19 +2,31 @@ package com.nextcloud.client.account;
import android.accounts.Account;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
* This interface provides access to currently selected user Account.
* This interface provides access to currently selected user.
*
* @see UserAccountManager
*/
@FunctionalInterface
public interface CurrentAccountProvider {
/**
* Get currently active account.
* Get currently active account.
*
* @return Currently selected {@link Account} or first valid {@link Account} registered in OS or null, if not available at all.
*/
@Deprecated
@Nullable
Account getCurrentAccount();
/**
* Get currently active user profile. If there is no actice user, anonymous user is returned.
*
* @return User profile. Profile is never null.
*/
@NonNull
default User getUser() {
return new AnonymousUser("dummy");
}
}
@@ -0,0 +1,47 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <[email protected]>
* Copyright (C) 2019 Chris Narkiewicz
* Copyright (C) 2019 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.account
import android.accounts.Account
import com.owncloud.android.lib.common.OwnCloudAccount
/**
* This class represents normal user logged into the Nextcloud server.
*/
internal class RegisteredUser(
private val account: Account,
private val ownCloudAccount: OwnCloudAccount,
override val server: Server
) : User {
override val isAnonymous = false
override val accountName: String get() {
return account.name
}
override fun toPlatformAccount(): Account {
return account
}
override fun toOwnCloudAccount(): OwnCloudAccount {
return ownCloudAccount
}
}
@@ -0,0 +1,30 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <[email protected]>
* Copyright (C) 2019 Chris Narkiewicz
* Copyright (C) 2019 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.account
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import java.net.URI
/**
* This object provides all information necessary to interact
* with backend server.
*/
data class Server(val uri: URI, val version: OwnCloudVersion)
@@ -0,0 +1,54 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <[email protected]>
* Copyright (C) 2019 Chris Narkiewicz
* Copyright (C) 2019 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.account
import android.accounts.Account
import com.owncloud.android.lib.common.OwnCloudAccount
interface User {
val accountName: String
val server: Server
val isAnonymous: Boolean
/**
* This is temporary helper method created to facilitate incremental refactoring.
* Code using legacy platform Account can be partially converted to instantiate User
* object and use account instance when required.
*
* This method calls will allow tracing code awaiting further refactoring.
*
* @return Account instance that is associated with this User object.
*/
@Deprecated("Temporary workaround")
fun toPlatformAccount(): Account
/**
* This is temporary helper method created to facilitate incremental refactoring.
* Code using legacy ownCloud account can be partially converted to instantiate User
* object and use account instance when required.
*
* This method calls will allow tracing code awaiting further refactoring.
*
* @return OwnCloudAccount instance that is associated with this User object.
*/
@Deprecated("Temporary workaround")
fun toOwnCloudAccount(): OwnCloudAccount
}
@@ -21,10 +21,13 @@ package com.nextcloud.client.account;
import android.accounts.Account;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -51,6 +54,22 @@ public interface UserAccountManager extends CurrentAccountProvider {
@NonNull
Account[] getAccounts();
/**
* Get configured nextcloud user accounts
* @return List of users or empty list, if users are not registered.
*/
@NonNull
List<User> getAllUsers();
/**
* Get user with a specific account name.
*
* @param accountName Account name of the requested user
* @return User or empty optional if user does not exist.
*/
@NonNull
Optional<User> getUser(CharSequence accountName);
/**
* Check if Nextcloud account is registered in {@link android.accounts.AccountManager}
*
@@ -78,10 +97,24 @@ public interface UserAccountManager extends CurrentAccountProvider {
* @return Version of the OC server corresponding to account, according to the data saved
* in the system AccountManager
*/
@Deprecated
@NonNull
OwnCloudVersion getServerVersion(Account account);
@Deprecated
boolean isSearchSupported(@Nullable Account account);
/**
* Check if user's account supports media streaming. This is a property of server where user has his account.
*
* @deprecated Please use {@link OwnCloudVersion#isMediaStreamingSupported()} directly,
* obtainable from {@link User#getServer()} and {@link Server#getVersion()}
*
* @param account Account used to perform {@link android.accounts.AccountManager} lookup.
*
* @return true is server supports media streaming, false otherwise
*/
@Deprecated
boolean isMediaStreamingSupported(@Nullable Account account);
void resetOwnCloudAccount();
@@ -27,6 +27,7 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
@@ -35,11 +36,16 @@ 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.AccountUtils;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.lib.resources.users.GetUserInfoRemoteOperation;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import androidx.annotation.NonNull;
@@ -80,6 +86,20 @@ public class UserAccountManagerImpl implements UserAccountManager {
return accountManager.getAccountsByType(getAccountType());
}
@Override
@NonNull
public List<User> getAllUsers() {
Account[] accounts = getAccounts();
List<User> users = new ArrayList<>(accounts.length);
for (Account account : accounts) {
User user = createUserFromAccount(account);
if (user != null) {
users.add(user);
}
}
return users;
}
@Override
public boolean exists(Account account) {
Account[] nextcloudAccounts = getAccounts();
@@ -103,6 +123,7 @@ public class UserAccountManagerImpl implements UserAccountManager {
return false;
}
@Override
@Nullable
public Account getCurrentAccount() {
Account[] ocAccounts = getAccounts();
@@ -139,6 +160,76 @@ public class UserAccountManagerImpl implements UserAccountManager {
return defaultAccount;
}
/**
* Temporary solution to convert platform account to user instance.
* It takes null and returns null on error to ease error handling
* in legacy code.
*
* @param account Account instance
* @return User instance or null, if conversion failed
*/
@Nullable
private User createUserFromAccount(@Nullable Account account) {
if (account == null) {
return null;
}
OwnCloudAccount ownCloudAccount = null;
try {
ownCloudAccount = new OwnCloudAccount(account, context);
} catch (AccountUtils.AccountNotFoundException ex) {
return null;
}
/*
* Server version
*/
String serverVersionStr = accountManager.getUserData(account, AccountUtils.Constants.KEY_OC_VERSION);
OwnCloudVersion serverVersion;
if (serverVersionStr != null) {
serverVersion = new OwnCloudVersion(serverVersionStr);
} else {
serverVersion = MainApp.MINIMUM_SUPPORTED_SERVER_VERSION;
}
/*
* Server address
*/
String serverAddressStr = accountManager.getUserData(account, AccountUtils.Constants.KEY_OC_BASE_URL);
if (serverAddressStr == null || serverAddressStr.isEmpty()) {
return AnonymousUser.fromContext(context);
}
URI serverUri = URI.create(serverAddressStr); // TODO: validate
return new RegisteredUser(
account,
ownCloudAccount,
new Server(serverUri, serverVersion)
);
}
/**
* Get user. If user cannot be retrieved due to data error, anonymous user is returned instead.
*
*
* @return User instance
*/
@NonNull
@Override
public User getUser() {
Account account = getCurrentAccount();
User user = createUserFromAccount(account);
return user != null ? user : AnonymousUser.fromContext(context);
}
@Override
@NonNull
public Optional<User> getUser(CharSequence accountName) {
Account account = getAccountByName(accountName.toString());
User user = createUserFromAccount(account);
return Optional.of(user);
}
@Override
@Nullable
public OwnCloudAccount getCurrentOwnCloudAccount() {
@@ -197,6 +288,7 @@ public class UserAccountManagerImpl implements UserAccountManager {
return result;
}
@Deprecated
@Override
@NonNull
public OwnCloudVersion getServerVersion(Account account) {
@@ -41,6 +41,7 @@ import com.nextcloud.client.logger.FileLogHandler;
import com.nextcloud.client.logger.Logger;
import com.nextcloud.client.logger.LoggerImpl;
import com.nextcloud.client.logger.LogsRepository;
import com.nextcloud.client.network.ClientFactory;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.ui.activities.data.activities.ActivitiesRepository;
@@ -106,8 +107,8 @@ class AppModule {
}
@Provides
FilesRepository filesRepository(UserAccountManager accountManager) {
return new RemoteFilesRepository(new FilesServiceApiImpl(accountManager));
FilesRepository filesRepository(UserAccountManager accountManager, ClientFactory clientFactory) {
return new RemoteFilesRepository(new FilesServiceApiImpl(accountManager, clientFactory));
}
@Provides
@@ -32,6 +32,7 @@ import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.jobs.NotificationJob;
import com.owncloud.android.providers.DiskLruImageCacheFileProvider;
import com.owncloud.android.providers.FileContentProvider;
import com.owncloud.android.providers.UsersAndGroupsSearchProvider;
import com.owncloud.android.services.AccountManagerService;
import com.owncloud.android.services.OperationsService;
@@ -148,6 +149,7 @@ abstract class ComponentsModule {
@ContributesAndroidInjector abstract BootupBroadcastReceiver bootupBroadcastReceiver();
@ContributesAndroidInjector abstract NotificationJob.NotificationReceiver notificationJobBroadcastReceiver();
@ContributesAndroidInjector abstract FileContentProvider fileContentProvider();
@ContributesAndroidInjector abstract UsersAndGroupsSearchProvider usersAndGroupsSearchProvider();
@ContributesAndroidInjector abstract DiskLruImageCacheFileProvider diskLruImageCacheFileProvider();
@@ -69,7 +69,7 @@ class ShowErrorActivity : AppCompatActivity() {
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.activity_error_show, menu)
menuInflater.inflate(R.menu.activity_show_error, menu)
return super.onCreateOptionsMenu(menu)
}
@@ -51,7 +51,7 @@ class EtmPreferencesFragment : EtmBaseFragment() {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.etm_preferences, menu)
inflater.inflate(R.menu.fragment_etm_preferences, menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
@@ -26,6 +26,7 @@ import androidx.annotation.RequiresApi
import androidx.work.ListenableWorker
import androidx.work.WorkerFactory
import androidx.work.WorkerParameters
import com.nextcloud.client.core.Clock
import com.nextcloud.client.device.DeviceInfo
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.preferences.AppPreferences
@@ -40,6 +41,7 @@ import javax.inject.Provider
class BackgroundJobFactory @Inject constructor(
private val preferences: AppPreferences,
private val contentResolver: ContentResolver,
private val clock: Clock,
private val powerManagerService: PowerManagementService,
private val backgroundJobManager: Provider<BackgroundJobManager>,
private val deviceInfo: DeviceInfo
@@ -58,13 +60,14 @@ class BackgroundJobFactory @Inject constructor(
}
return when (workerClass) {
ContentObserverWork::class -> createContentObserverJob(context, workerParameters)
ContentObserverWork::class -> createContentObserverJob(context, workerParameters, clock)
else -> null // falls back to default factory
}
}
private fun createContentObserverJob(context: Context, workerParameters: WorkerParameters): ListenableWorker? {
val folderResolver = SyncedFolderProvider(contentResolver, preferences)
private fun createContentObserverJob(context: Context, workerParameters: WorkerParameters, clock: Clock):
ListenableWorker? {
val folderResolver = SyncedFolderProvider(contentResolver, preferences, clock)
@RequiresApi(Build.VERSION_CODES.N)
if (deviceInfo.apiLevel >= Build.VERSION_CODES.N) {
return ContentObserverWork(
@@ -84,7 +84,7 @@ class LogsActivity : ToolbarActivity() {
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.logs_menu, menu)
menuInflater.inflate(R.menu.activity_logs, menu)
(menu.findItem(R.id.action_search).actionView as SearchView).apply {
setOnQueryTextListener(searchBoxListener)
@@ -26,6 +26,8 @@ import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.net.Uri;
import com.nextcloud.client.account.User;
import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.accounts.AccountUtils;
@@ -35,10 +37,33 @@ import java.io.IOException;
public interface ClientFactory {
/**
* This exception wraps all possible errors thrown by trigger-happy
* OwnCloudClient constructor, making try-catch blocks manageable.
*
* This is a temporary refactoring measure, until a better
* error handling method can be procured.
*/
@Deprecated
class CreationException extends Exception {
private static final long serialVersionUID = 0L;
CreationException(Throwable t) {
super(t);
}
}
OwnCloudClient create(User user) throws CreationException;
NextcloudClient createNextcloudClient(User user) throws CreationException;
@Deprecated
OwnCloudClient create(Account account)
throws OperationCanceledException, AuthenticatorException, IOException,
AccountUtils.AccountNotFoundException;
@Deprecated
OwnCloudClient create(Account account, Activity currentActivity)
throws OperationCanceledException, AuthenticatorException, IOException,
AccountUtils.AccountNotFoundException;
@@ -27,6 +27,8 @@ import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import com.nextcloud.client.account.User;
import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientFactory;
import com.owncloud.android.lib.common.accounts.AccountUtils;
@@ -41,6 +43,30 @@ class ClientFactoryImpl implements ClientFactory {
this.context = context;
}
@Override
public OwnCloudClient create(User user) throws CreationException {
try {
return OwnCloudClientFactory.createOwnCloudClient(user.toPlatformAccount(), context);
} catch (OperationCanceledException|
AuthenticatorException|
IOException|
AccountUtils.AccountNotFoundException e) {
throw new CreationException(e);
}
}
@Override
public NextcloudClient createNextcloudClient(User user) throws CreationException {
try {
return OwnCloudClientFactory.createNextcloudClient(user.toPlatformAccount(), context);
} catch (OperationCanceledException |
AuthenticatorException |
IOException |
AccountUtils.AccountNotFoundException e) {
throw new CreationException(e);
}
}
@Override
public OwnCloudClient create(Account account)
throws OperationCanceledException, AuthenticatorException, IOException,
@@ -20,14 +20,13 @@
package com.nextcloud.client.network;
import android.accounts.Account;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import com.evernote.android.job.JobRequest;
import com.nextcloud.client.account.Server;
import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.nextcloud.client.logger.Logger;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import org.apache.commons.httpclient.HttpClient;
@@ -44,10 +43,11 @@ class ConnectivityServiceImpl implements ConnectivityService {
private final static String TAG = ConnectivityServiceImpl.class.getName();
private ConnectivityManager connectivityManager;
private UserAccountManager accountManager;
private ClientFactory clientFactory;
private GetRequestBuilder requestBuilder;
private final ConnectivityManager connectivityManager;
private final UserAccountManager accountManager;
private final ClientFactory clientFactory;
private final GetRequestBuilder requestBuilder;
private final Logger logger;
static class GetRequestBuilder implements Function1<String, GetMethod> {
@Override
@@ -59,55 +59,55 @@ class ConnectivityServiceImpl implements ConnectivityService {
ConnectivityServiceImpl(ConnectivityManager connectivityManager,
UserAccountManager accountManager,
ClientFactory clientFactory,
GetRequestBuilder requestBuilder) {
GetRequestBuilder requestBuilder,
Logger logger) {
this.connectivityManager = connectivityManager;
this.accountManager = accountManager;
this.clientFactory = clientFactory;
this.requestBuilder = requestBuilder;
this.logger = logger;
}
@Override
public boolean isInternetWalled() {
if (isOnlineWithWifi()) {
try {
Account account = accountManager.getCurrentAccount();
OwnCloudAccount ocAccount = accountManager.getCurrentOwnCloudAccount();
if (account != null && ocAccount != null) {
OwnCloudVersion serverVersion = accountManager.getServerVersion(account);
Server server = accountManager.getUser().getServer();
String baseServerAddress = server.getUri().toString();
if (baseServerAddress.isEmpty()) {
return true;
}
String url;
if (server.getVersion().compareTo(OwnCloudVersion.nextcloud_13) > 0) {
url = baseServerAddress + "/index.php/204";
} else {
url = baseServerAddress + "/status.php";
}
String url;
if (serverVersion.compareTo(OwnCloudVersion.nextcloud_13) > 0) {
url = ocAccount.getBaseUri() + "/index.php/204";
} else {
url = ocAccount.getBaseUri() + "/status.php";
}
GetMethod get = requestBuilder.invoke(url);
HttpClient client = clientFactory.createPlainClient();
GetMethod get = requestBuilder.invoke(url);
HttpClient client = clientFactory.createPlainClient();
int status = client.executeMethod(get);
int status = client.executeMethod(get);
if (serverVersion.compareTo(OwnCloudVersion.nextcloud_13) > 0) {
return !(status == HttpStatus.SC_NO_CONTENT &&
(get.getResponseContentLength() == -1 || get.getResponseContentLength() == 0));
} else {
if (status == HttpStatus.SC_OK) {
try {
// try parsing json to verify response
// check if json contains maintenance and it should be false
String json = get.getResponseBodyAsString();
return new JSONObject(json).getBoolean("maintenance");
} catch (Exception e) {
return true;
}
} else {
if (server.getVersion().compareTo(OwnCloudVersion.nextcloud_13) > 0) {
return !(status == HttpStatus.SC_NO_CONTENT &&
(get.getResponseContentLength() == -1 || get.getResponseContentLength() == 0));
} else {
if (status == HttpStatus.SC_OK) {
try {
// try parsing json to verify response
// check if json contains maintenance and it should be false
String json = get.getResponseBodyAsString();
return new JSONObject(json).getBoolean("maintenance");
} catch (Exception e) {
return true;
}
} else {
return true;
}
}
} catch (IOException e) {
Log_OC.e(TAG, "Error checking internet connection", e);
logger.e(TAG, "Error checking internet connection", e);
}
} else {
return getActiveNetworkType() == JobRequest.NetworkType.ANY;
@@ -24,6 +24,7 @@ import android.content.Context;
import android.net.ConnectivityManager;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.logger.Logger;
import javax.inject.Singleton;
@@ -36,11 +37,13 @@ public class NetworkModule {
@Provides
ConnectivityService connectivityService(ConnectivityManager connectivityManager,
UserAccountManager accountManager,
ClientFactory clientFactory) {
ClientFactory clientFactory,
Logger logger) {
return new ConnectivityServiceImpl(connectivityManager,
accountManager,
clientFactory,
new ConnectivityServiceImpl.GetRequestBuilder());
new ConnectivityServiceImpl.GetRequestBuilder(),
logger);
}
@Provides
@@ -28,7 +28,6 @@ import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
@@ -81,7 +80,7 @@ public class FirstRunActivity extends BaseActivity implements ViewPager.OnPageCh
setSlideshowSize(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
Button loginButton = findViewById(R.id.login);
loginButton.setBackgroundColor(Color.WHITE);
loginButton.setBackgroundColor(getResources().getColor(R.color.login_btn_tint));
loginButton.setTextColor(getResources().getColor(R.color.primary));
loginButton.setOnClickListener(v -> {
@@ -95,7 +94,7 @@ public class FirstRunActivity extends BaseActivity implements ViewPager.OnPageCh
});
Button providerButton = findViewById(R.id.signup);
providerButton.setBackgroundColor(getResources().getColor(R.color.primary_dark));
providerButton.setBackgroundColor(getResources().getColor(R.color.primary));
providerButton.setTextColor(getResources().getColor(R.color.login_text_color));
providerButton.setVisibility(isProviderOrOwnInstallationVisible ? View.VISIBLE : View.GONE);
providerButton.setOnClickListener(v -> {
@@ -218,17 +217,19 @@ public class FirstRunActivity extends BaseActivity implements ViewPager.OnPageCh
return;
}
setAccount(account);
userAccountManager.setCurrentOwnCloudAccount(account.name);
onAccountSet();
Intent i = new Intent(this, FileDisplayActivity.class);
i.setAction(FileDisplayActivity.RESTART);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
finish();
}
}
public static FeatureItem[] getFirstRun() {
return new FeatureItem[]{
new FeatureItem(R.drawable.logo, R.string.first_run_1_text, R.string.empty, true, false),
@@ -23,7 +23,6 @@
*/
package com.nextcloud.client.onboarding;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
@@ -99,11 +98,7 @@ public class WhatsNewActivity extends FragmentActivity implements ViewPager.OnPa
updateNextButtonIfNeeded();
});
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mForwardFinishButton.setBackground(null);
} else {
mForwardFinishButton.setBackgroundDrawable(null);
}
mForwardFinishButton.setBackground(null);
mSkipButton = findViewById(R.id.skip);
mSkipButton.setTextColor(fontColor);
@@ -23,8 +23,42 @@ package com.nextcloud.client.preferences;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.utils.FileSortOrder;
import androidx.annotation.Nullable;
/**
* This interface provides single point of entry for access to all application
* preferences and allows clients to subscribe for specific configuration
* changes.
*/
public interface AppPreferences {
/**
* Preferences listener. Callbacks should be invoked on main thread.
*
* Miantainers should extend this interface with callbacks for specific
* events.
*/
interface Listener {
default void onDarkThemeModeChanged(DarkMode mode) {
/* default empty implementation */
};
}
/**
* Registers preferences listener. It no-ops if listener
* is already registered.
*
* @param listener application preferences listener
*/
void addListener(@Nullable Listener listener);
/**
* Unregister listener. It no-ops if listener is not registered.
*
* @param listener application preferences listener
*/
void removeListener(@Nullable Listener listener);
void setKeysReInitEnabled();
boolean isKeysReInitEnabled();
@@ -239,6 +273,20 @@ public interface AppPreferences {
*/
int getUploaderBehaviour();
/**
* Changes dark theme mode
*
* This is reactive property. Listeners will be invoked if registered.
*
* @param mode dark mode setting: on, off, system
*/
void setDarkThemeMode(DarkMode mode);
/**
* @return dark mode setting: on, off, system
*/
DarkMode getDarkThemeMode();
/**
* Saves the uploader behavior which the user has set last.
*
@@ -21,12 +21,12 @@
package com.nextcloud.client.preferences;
import android.accounts.Account;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import com.nextcloud.client.account.CurrentAccountProvider;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.FileDataStorageManager;
@@ -35,19 +35,30 @@ import com.owncloud.android.ui.activity.PassCodeActivity;
import com.owncloud.android.ui.activity.SettingsActivity;
import com.owncloud.android.utils.FileSortOrder;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import androidx.annotation.Nullable;
import static com.owncloud.android.ui.fragment.OCFileListFragment.FOLDER_LAYOUT_LIST;
/**
* Helper to simplify reading of Preferences all around the app
* Implementation of application-wide preferences using {@link SharedPreferences}.
*
* Users should not use this class directly. Please use {@link AppPreferences} interafce
* instead.
*/
public final class AppPreferencesImpl implements AppPreferences {
/**
* Constant to access value of last path selected by the user to upload a file shared from other app.
* Value handled by the app without direct access in the UI.
*/
public static final String AUTO_PREF__LAST_SEEN_VERSION_CODE = "lastSeenVersionCode";
public static final String STORAGE_PATH = "storage_path";
public static final String PREF__DARK_THEME = "dark_theme_mode";
public static final float DEFAULT_GRID_COLUMN = 4.0f;
private static final String AUTO_PREF__LAST_UPLOAD_PATH = "last_upload_path";
private static final String AUTO_PREF__UPLOAD_FROM_LOCAL_LAST_PATH = "upload_from_local_last_path";
private static final String AUTO_PREF__UPLOAD_FILE_EXTENSION_MAP_URL = "prefs_upload_file_extension_map_url";
@@ -68,6 +79,7 @@ public final class AppPreferencesImpl implements AppPreferences {
private static final String PREF__AUTO_UPLOAD_INIT = "autoUploadInit";
private static final String PREF__FOLDER_SORT_ORDER = "folder_sort_order";
private static final String PREF__FOLDER_LAYOUT = "folder_layout";
private static final String PREF__LOCK_TIMESTAMP = "lock_timestamp";
private static final String PREF__SHOW_MEDIA_SCAN_NOTIFICATIONS = "show_media_scan_notifications";
private static final String PREF__LOCK = SettingsActivity.PREFERENCE_LOCK;
@@ -79,7 +91,54 @@ public final class AppPreferencesImpl implements AppPreferences {
private final Context context;
private final SharedPreferences preferences;
private final CurrentAccountProvider currentAccountProvider;
private final ListenerRegistry listeners;
/**
* Adapter delegating raw {@link SharedPreferences.OnSharedPreferenceChangeListener} calls
* with key-value pairs to respective {@link com.nextcloud.client.preferences.AppPreferences.Listener} method.
*/
static class ListenerRegistry implements SharedPreferences.OnSharedPreferenceChangeListener {
private final AppPreferences preferences;
private final Set<Listener> listeners;
ListenerRegistry(AppPreferences preferences) {
this.preferences = preferences;
this.listeners = new CopyOnWriteArraySet<>();
}
void add(@Nullable final Listener listener) {
if (listener != null) {
listeners.add(listener);
}
}
void remove(@Nullable final Listener listener) {
if (listener != null) {
listeners.remove(listener);
}
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (PREF__DARK_THEME.equals(key)) {
DarkMode mode = preferences.getDarkThemeMode();
for(Listener l : listeners) {
l.onDarkThemeModeChanged(mode);
}
}
}
}
/**
* This is a temporary workaround to access app preferences in places that cannot use
* dependency injection yet. Use injected component via {@link AppPreferences} interface.
*
* WARNING: this creates new instance! it does not return app-wide singleton
*
* @param context Context used to create shared preferences
* @return New instance of app preferences component
*/
@Deprecated
public static AppPreferences fromContext(Context context) {
final CurrentAccountProvider currentAccountProvider = UserAccountManagerImpl.fromContext(context);
final SharedPreferences prefs = android.preference.PreferenceManager.getDefaultSharedPreferences(context);
@@ -90,6 +149,18 @@ public final class AppPreferencesImpl implements AppPreferences {
this.context = appContext;
this.preferences = preferences;
this.currentAccountProvider = currentAccountProvider;
this.listeners = new ListenerRegistry(this);
this.preferences.registerOnSharedPreferenceChangeListener(listeners);
}
@Override
public void addListener(@Nullable AppPreferences.Listener listener) {
this.listeners.add(listener);
}
@Override
public void removeListener(@Nullable AppPreferences.Listener listener) {
this.listeners.remove(listener);
}
@Override
@@ -211,7 +282,7 @@ public final class AppPreferencesImpl implements AppPreferences {
@Override
public String getFolderLayout(OCFile folder) {
return getFolderPreference(context,
currentAccountProvider.getCurrentAccount(),
currentAccountProvider.getUser(),
PREF__FOLDER_LAYOUT,
folder,
FOLDER_LAYOUT_LIST);
@@ -220,7 +291,7 @@ public final class AppPreferencesImpl implements AppPreferences {
@Override
public void setFolderLayout(OCFile folder, String layout_name) {
setFolderPreference(context,
currentAccountProvider.getCurrentAccount(),
currentAccountProvider.getUser(),
PREF__FOLDER_LAYOUT,
folder,
layout_name);
@@ -229,7 +300,7 @@ public final class AppPreferencesImpl implements AppPreferences {
@Override
public FileSortOrder getSortOrderByFolder(OCFile folder) {
return FileSortOrder.sortOrders.get(getFolderPreference(context,
currentAccountProvider.getCurrentAccount(),
currentAccountProvider.getUser(),
PREF__FOLDER_SORT_ORDER,
folder,
FileSortOrder.sort_a_to_z.name));
@@ -238,7 +309,7 @@ public final class AppPreferencesImpl implements AppPreferences {
@Override
public void setSortOrder(OCFile folder, FileSortOrder sortOrder) {
setFolderPreference(context,
currentAccountProvider.getCurrentAccount(),
currentAccountProvider.getUser(),
PREF__FOLDER_SORT_ORDER,
folder,
sortOrder.name);
@@ -251,28 +322,23 @@ public final class AppPreferencesImpl implements AppPreferences {
@Override
public FileSortOrder getSortOrderByType(FileSortOrder.Type type, FileSortOrder defaultOrder) {
Account account = currentAccountProvider.getCurrentAccount();
if (account == null) {
User user = currentAccountProvider.getUser();
if (user.isAnonymous()) {
return defaultOrder;
}
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
String value = dataProvider.getValue(account.name, PREF__FOLDER_SORT_ORDER + "_" + type);
String value = dataProvider.getValue(user.getAccountName(), PREF__FOLDER_SORT_ORDER + "_" + type);
return value.isEmpty() ? defaultOrder : FileSortOrder.sortOrders.get(value);
}
@Override
public void setSortOrder(FileSortOrder.Type type, FileSortOrder sortOrder) {
Account account = currentAccountProvider.getCurrentAccount();
if (account == null) {
throw new IllegalArgumentException("Account may not be null!");
}
User user = currentAccountProvider.getUser();
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
dataProvider.storeOrUpdateKeyValue(account.name, PREF__FOLDER_SORT_ORDER + "_" + type, sortOrder.name);
dataProvider.storeOrUpdateKeyValue(user.getAccountName(), PREF__FOLDER_SORT_ORDER + "_" + type, sortOrder.name);
}
@Override
@@ -340,6 +406,21 @@ public final class AppPreferencesImpl implements AppPreferences {
return preferences.getInt(AUTO_PREF__UPLOADER_BEHAVIOR, 1);
}
@Override
public void setDarkThemeMode(DarkMode mode) {
preferences.edit().putString(PREF__DARK_THEME, mode.name()).apply();
}
@Override
public DarkMode getDarkThemeMode() {
try {
return DarkMode.valueOf(preferences.getString(PREF__DARK_THEME, DarkMode.LIGHT.name()));
} catch (ClassCastException e) {
preferences.edit().putString(PREF__DARK_THEME, DarkMode.LIGHT.name()).apply();
return DarkMode.DARK;
}
}
@Override
public void setUploaderBehaviour(int uploaderBehaviour) {
preferences.edit().putInt(AUTO_PREF__UPLOADER_BEHAVIOR, uploaderBehaviour).apply();
@@ -495,22 +576,22 @@ public final class AppPreferencesImpl implements AppPreferences {
* @return Preference value
*/
private static String getFolderPreference(final Context context,
final Account account,
final User user,
final String preferenceName,
final OCFile folder,
final String defaultValue) {
if (account == null) {
if (user.isAnonymous()) {
return defaultValue;
}
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
FileDataStorageManager storageManager = new FileDataStorageManager(account, context.getContentResolver());
FileDataStorageManager storageManager = new FileDataStorageManager(user.toPlatformAccount(), context.getContentResolver());
String value = dataProvider.getValue(account.name, getKeyFromFolder(preferenceName, folder));
String value = dataProvider.getValue(user.getAccountName(), getKeyFromFolder(preferenceName, folder));
OCFile prefFolder = folder;
while (prefFolder != null && value.isEmpty()) {
prefFolder = storageManager.getFileById(prefFolder.getParentId());
value = dataProvider.getValue(account.name, getKeyFromFolder(preferenceName, prefFolder));
value = dataProvider.getValue(user.getAccountName(), getKeyFromFolder(preferenceName, prefFolder));
}
return value.isEmpty() ? defaultValue : value;
}
@@ -524,16 +605,12 @@ public final class AppPreferencesImpl implements AppPreferences {
* @param value Preference value to set.
*/
private static void setFolderPreference(final Context context,
final Account account,
final User user,
final String preferenceName,
final OCFile folder,
final String value) {
if (account == null) {
throw new IllegalArgumentException("Account may not be null!");
}
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
dataProvider.storeOrUpdateKeyValue(account.name, getKeyFromFolder(preferenceName, folder), value);
dataProvider.storeOrUpdateKeyValue(user.getAccountName(), getKeyFromFolder(preferenceName, folder), value);
}
private static String getKeyFromFolder(String preferenceName, OCFile folder) {
@@ -0,0 +1,27 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2019 Tobias Kaminsky
* Copyright (C) 2019 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 <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.preferences;
public enum DarkMode {
DARK, LIGHT, SYSTEM
}
@@ -0,0 +1,366 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.nextcloud.java.util;
import com.nextcloud.java.util.function.Predicate;
import java.util.NoSuchElementException;
import androidx.core.util.Consumer;
import androidx.core.util.ObjectsCompat;
import androidx.core.util.Supplier;
import kotlin.jvm.functions.Function1;
/**
* This class is backported from Java 8 to be used on older Android API levels.
* It uses available interfaces from Kotlin and androidx. It is semantically
* identical with Java 8 API, allowing smooth migration when those APIs become
* available.
*
* A container object which may or may not contain a non-null value.
* If a value is present, {@code isPresent()} will return {@code true} and
* {@code get()} will return the value.
*
* <p>Additional methods that depend on the presence or absence of a contained
* value are provided, such as {@link #orElse(java.lang.Object) orElse()}
* (return a default value if value not present) and
* {@link #ifPresent(Consumer) ifPresent()} (execute a block
* of code if the value is present).
*/
public final class Optional<T> {
/**
* Common instance for {@code empty()}.
*/
private static final Optional<?> EMPTY = new Optional<>();
/**
* If non-null, the value; if null, indicates no value is present
*/
private final T value;
/**
* Constructs an empty instance.
*
* @implNote Generally only one empty instance, {@link Optional#EMPTY},
* should exist per VM.
*/
private Optional() {
this.value = null;
}
/**
* Returns an empty {@code Optional} instance. No value is present for this
* Optional.
*
* @apiNote Though it may be tempting to do so, avoid testing if an object
* is empty by comparing with {@code ==} against instances returned by
* {@code Option.empty()}. There is no guarantee that it is a singleton.
* Instead, use {@link #isPresent()}.
*
* @param <T> Type of the non-existent value
* @return an empty {@code Optional}
*/
public static<T> Optional<T> empty() {
@SuppressWarnings("unchecked")
Optional<T> t = (Optional<T>) EMPTY;
return t;
}
/**
* Constructs an instance with the value present.
*
* @param value the non-null value to be present
* @throws NullPointerException if value is null
*/
private Optional(T value) {
if (value == null) {
throw new NullPointerException();
}
this.value = value;
}
/**
* Returns an {@code Optional} with the specified present non-null value.
*
* @param <T> the class of the value
* @param value the value to be present, which must be non-null
* @return an {@code Optional} with the value present
* @throws NullPointerException if value is null
*/
public static <T> Optional<T> of(T value) {
return new Optional<>(value);
}
/**
* Returns an {@code Optional} describing the specified value, if non-null,
* otherwise returns an empty {@code Optional}.
*
* @param <T> the class of the value
* @param value the possibly-null value to describe
* @return an {@code Optional} with a present value if the specified value
* is non-null, otherwise an empty {@code Optional}
*/
public static <T> Optional<T> ofNullable(T value) {
return value == null ? empty() : of(value);
}
/**
* If a value is present in this {@code Optional}, returns the value,
* otherwise throws {@code NoSuchElementException}.
*
* @return the non-null value held by this {@code Optional}
* @throws NoSuchElementException if there is no value present
*
* @see Optional#isPresent()
*/
public T get() {
if (value == null) {
throw new NoSuchElementException("No value present");
}
return value;
}
/**
* Return {@code true} if there is a value present, otherwise {@code false}.
*
* @return {@code true} if there is a value present, otherwise {@code false}
*/
public boolean isPresent() {
return value != null;
}
/**
* If a value is present, invoke the specified consumer with the value,
* otherwise do nothing.
*
* @param consumer block to be executed if a value is present
* @throws NullPointerException if value is present and {@code consumer} is
* null
*/
public void ifPresent(Consumer<? super T> consumer) {
if (value != null) {
consumer.accept(value);
}
}
/**
* If a value is present, and the value matches the given predicate,
* return an {@code Optional} describing the value, otherwise return an
* empty {@code Optional}.
*
* @param predicate a predicate to apply to the value, if present
* @return an {@code Optional} describing the value of this {@code Optional}
* if a value is present and the value matches the given predicate,
* otherwise an empty {@code Optional}
* @throws NullPointerException if the predicate is null
*/
public Optional<T> filter(Predicate<? super T> predicate) {
if (predicate == null) {
throw new NullPointerException();
}
if (!isPresent()) {
return this;
} else {
return predicate.test(value) ? this : empty();
}
}
/**
* If a value is present, apply the provided mapping function to it,
* and if the result is non-null, return an {@code Optional} describing the
* result. Otherwise return an empty {@code Optional}.
*
* @apiNote This method supports post-processing on optional values, without
* the need to explicitly check for a return status. For example, the
* following code traverses a stream of file names, selects one that has
* not yet been processed, and then opens that file, returning an
* {@code Optional<FileInputStream>}:
*
* <pre>{@code
* Optional<FileInputStream> fis =
* names.stream().filter(name -> !isProcessedYet(name))
* .findFirst()
* .map(name -> new FileInputStream(name));
* }</pre>
*
* Here, {@code findFirst} returns an {@code Optional<String>}, and then
* {@code map} returns an {@code Optional<FileInputStream>} for the desired
* file if one exists.
*
* @param <U> The type of the result of the mapping function
* @param mapper a mapping function to apply to the value, if present
* @return an {@code Optional} describing the result of applying a mapping
* function to the value of this {@code Optional}, if a value is present,
* otherwise an empty {@code Optional}
* @throws NullPointerException if the mapping function is null
*/
public<U> Optional<U> map(Function1<? super T, ? extends U> mapper) {
if (mapper == null) {
throw new NullPointerException();
}
if (!isPresent()) {
return empty();
} else {
return Optional.ofNullable(mapper.invoke(value));
}
}
/**
* If a value is present, apply the provided {@code Optional}-bearing
* mapping function to it, return that result, otherwise return an empty
* {@code Optional}. This method is similar to {@link #map(Function1)},
* but the provided mapper is one whose result is already an {@code Optional},
* and if invoked, {@code flatMap} does not wrap it with an additional
* {@code Optional}.
*
* @param <U> The type parameter to the {@code Optional} returned by
* @param mapper a mapping function to apply to the value, if present
* the mapping function
* @return the result of applying an {@code Optional}-bearing mapping
* function to the value of this {@code Optional}, if a value is present,
* otherwise an empty {@code Optional}
* @throws NullPointerException if the mapping function is null or returns
* a null result
*/
public<U> Optional<U> flatMap(Function1<? super T, Optional<U>> mapper) {
if(mapper == null) {
throw new NullPointerException();
}
if (!isPresent()) {
return empty();
} else {
Optional<U> u = mapper.invoke(value);
if (u == null) {
throw new NullPointerException();
}
return u;
}
}
/**
* Return the value if present, otherwise return {@code other}.
*
* @param other the value to be returned if there is no value present, may
* be null
* @return the value, if present, otherwise {@code other}
*/
public T orElse(T other) {
return value != null ? value : other;
}
/**
* Return the value if present, otherwise invoke {@code other} and return
* the result of that invocation.
*
* @param other a {@code Supplier} whose result is returned if no value
* is present
* @return the value if present otherwise the result of {@code other.get()}
* @throws NullPointerException if value is not present and {@code other} is
* null
*/
public T orElseGet(Supplier<? extends T> other) {
return value != null ? value : other.get();
}
/**
* Return the contained value, if present, otherwise throw an exception
* to be created by the provided supplier.
*
* @apiNote A method reference to the exception constructor with an empty
* argument list can be used as the supplier. For example,
* {@code IllegalStateException::new}
*
* @param <X> Type of the exception to be thrown
* @param exceptionSupplier The supplier which will return the exception to
* be thrown
* @return the present value
* @throws X if there is no value present
* @throws NullPointerException if no value is present and
* {@code exceptionSupplier} is null
*/
public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
if (value != null) {
return value;
} else {
throw exceptionSupplier.get();
}
}
/**
* Indicates whether some other object is "equal to" this Optional. The
* other object is considered equal if:
* <ul>
* <li>it is also an {@code Optional} and;
* <li>both instances have no value present or;
* <li>the present values are "equal to" each other via {@code equals()}.
* </ul>
*
* @param obj an object to be tested for equality
* @return {code true} if the other object is "equal to" this object
* otherwise {@code false}
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Optional)) {
return false;
}
Optional<?> other = (Optional<?>) obj;
return ObjectsCompat.equals(value, other.value);
}
/**
* Returns the hash code value of the present value, if any, or 0 (zero) if
* no value is present.
*
* @return hash code value of the present value or 0 if no value is present
*/
@Override
public int hashCode() {
return ObjectsCompat.hashCode(value);
}
/**
* Returns a non-empty string representation of this Optional suitable for
* debugging. The exact presentation format is unspecified and may vary
* between implementations and versions.
*
* @implSpec If a value is present the result must include its string
* representation in the result. Empty and present Optionals must be
* unambiguously differentiable.
*
* @return the string representation of this instance
*/
@Override
public String toString() {
return value != null
? String.format("Optional[%s]", value)
: "Optional.empty";
}
}
@@ -0,0 +1,121 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.nextcloud.java.util.function;
/**
* This class is backported from Java 8 to be used on older Android API levels.
*
* Represents a predicate (boolean-valued function) of one argument.
*
* <p>This is a <a href="package-summary.html">functional interface</a>
* whose functional method is {@link #test(Object)}.
*
* @param <T> the type of the input to the predicate
*/
@FunctionalInterface
public interface Predicate<T> {
/**
* Evaluates this predicate on the given argument.
*
* @param t the input argument
* @return {@code true} if the input argument matches the predicate,
* otherwise {@code false}
*/
boolean test(T t);
/**
* Returns a composed predicate that represents a short-circuiting logical
* AND of this predicate and another. When evaluating the composed
* predicate, if this predicate is {@code false}, then the {@code other}
* predicate is not evaluated.
*
* <p>Any exceptions thrown during evaluation of either predicate are relayed
* to the caller; if evaluation of this predicate throws an exception, the
* {@code other} predicate will not be evaluated.
*
* @param other a predicate that will be logically-ANDed with this
* predicate
* @return a composed predicate that represents the short-circuiting logical
* AND of this predicate and the {@code other} predicate
* @throws NullPointerException if other is null
*/
default Predicate<T> and(Predicate<? super T> other) {
if (other == null) {
throw new NullPointerException();
}
return (t) -> test(t) && other.test(t);
}
/**
* Returns a predicate that represents the logical negation of this
* predicate.
*
* @return a predicate that represents the logical negation of this
* predicate
*/
default Predicate<T> negate() {
return (t) -> !test(t);
}
/**
* Returns a composed predicate that represents a short-circuiting logical
* OR of this predicate and another. When evaluating the composed
* predicate, if this predicate is {@code true}, then the {@code other}
* predicate is not evaluated.
*
* <p>Any exceptions thrown during evaluation of either predicate are relayed
* to the caller; if evaluation of this predicate throws an exception, the
* {@code other} predicate will not be evaluated.
*
* @param other a predicate that will be logically-ORed with this
* predicate
* @return a composed predicate that represents the short-circuiting logical
* OR of this predicate and the {@code other} predicate
* @throws NullPointerException if other is null
*/
default Predicate<T> or(Predicate<? super T> other) {
if (other == null) {
throw new NullPointerException();
}
return (t) -> test(t) || other.test(t);
}
/**
* Returns a predicate that tests if two arguments are equal according
* to {@link androidx.core.util.ObjectsCompat#equals(Object, Object)}.
*
* @param <T> the type of arguments to the predicate
* @param targetRef the object reference with which to compare for equality,
* which may be {@code null}
* @return a predicate that tests if two arguments are equal according
* to {@link androidx.core.util.ObjectsCompat#equals(Object, Object)}
*/
static <T> Predicate<T> isEqual(Object targetRef) {
return (null == targetRef)
? object -> object == null
: object -> targetRef.equals(object);
}
}
@@ -0,0 +1,26 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <[email protected]>
* Copyright (C) 2019 Chris Narkiewicz
* Copyright (C) 2019 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 <https://www.gnu.org/licenses/>.
*/
/**
* This is a compatibility package providing some backported Java 8 classes
* not available in some older Android runtimes.
*/
package com.nextcloud.java.util;
+41 -15
View File
@@ -45,6 +45,7 @@ import com.evernote.android.job.JobManager;
import com.evernote.android.job.JobRequest;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.appinfo.AppInfo;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.device.PowerManagementService;
import com.nextcloud.client.di.ActivityInjector;
import com.nextcloud.client.di.DaggerAppComponent;
@@ -56,6 +57,7 @@ import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.onboarding.OnboardingService;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.nextcloud.client.preferences.DarkMode;
import com.owncloud.android.authentication.PassCodeManager;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.MediaFolder;
@@ -100,6 +102,7 @@ import javax.net.ssl.SSLEngine;
import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.util.Pair;
import androidx.multidex.MultiDexApplication;
import dagger.android.AndroidInjector;
@@ -160,6 +163,9 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
@Inject
BackgroundJobManager backgroundJobManager;
@Inject
Clock clock;
private PassCodeManager passCodeManager;
@SuppressWarnings("unused")
@@ -242,6 +248,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
@SuppressFBWarnings("ST")
@Override
public void onCreate() {
setAppTheme(preferences.getDarkThemeMode());
super.onCreate();
insertConscrypt();
@@ -266,7 +273,8 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
preferences,
uploadsStorageManager,
connectivityService,
powerManagementService
powerManagementService,
clock
)
);
@@ -302,7 +310,8 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
accountManager,
connectivityService,
powerManagementService,
backgroundJobManager);
backgroundJobManager,
clock);
initContactsBackup(accountManager);
notificationChannels();
@@ -460,23 +469,24 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
final UserAccountManager accountManager,
final ConnectivityService connectivityService,
final PowerManagementService powerManagementService,
final BackgroundJobManager jobManager
final BackgroundJobManager jobManager,
final Clock clock
) {
updateToAutoUpload();
cleanOldEntries();
updateAutoUploadEntries();
cleanOldEntries(clock);
updateAutoUploadEntries(clock);
if (getAppContext() != null) {
if (PermissionUtil.checkSelfPermission(getAppContext(),
Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
splitOutAutoUploadEntries();
splitOutAutoUploadEntries(clock);
} else {
AppPreferences preferences = AppPreferencesImpl.fromContext(getAppContext());
preferences.setAutoUploadSplitEntriesEnabled(true);
}
}
initiateExistingAutoUploadEntries();
initiateExistingAutoUploadEntries(clock);
FilesSyncHelper.scheduleFilesSyncIfNeeded(mContext, jobManager);
FilesSyncHelper.restartJobsIfNeeded(
@@ -571,6 +581,8 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
}
}
// dummy change
public static Context getAppContext() {
return MainApp.mContext;
@@ -683,18 +695,18 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
}
}
private static void updateAutoUploadEntries() {
private static void updateAutoUploadEntries(Clock clock) {
// updates entries to reflect their true paths
Context context = getAppContext();
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
if (!preferences.isAutoUploadPathsUpdateEnabled()) {
SyncedFolderProvider syncedFolderProvider =
new SyncedFolderProvider(MainApp.getAppContext().getContentResolver(), preferences);
new SyncedFolderProvider(MainApp.getAppContext().getContentResolver(), preferences, clock);
syncedFolderProvider.updateAutoUploadPaths(mContext);
}
}
private static void splitOutAutoUploadEntries() {
private static void splitOutAutoUploadEntries(Clock clock) {
Context context = getAppContext();
AppPreferences preferences = AppPreferencesImpl.fromContext(context);
if (!preferences.isAutoUploadSplitEntriesEnabled()) {
@@ -703,7 +715,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
Log_OC.i(TAG, "Migrate synced_folders records for image/video split");
ContentResolver contentResolver = context.getContentResolver();
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver, preferences);
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver, preferences, clock);
final List<MediaFolder> imageMediaFolders = MediaProvider.getImageFolders(contentResolver, 1, null, true);
final List<MediaFolder> videoMediaFolders = MediaProvider.getVideoFolders(contentResolver, 1, null, true);
@@ -749,12 +761,12 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
}
}
private static void initiateExistingAutoUploadEntries() {
private static void initiateExistingAutoUploadEntries(Clock clock) {
new Thread(() -> {
AppPreferences preferences = AppPreferencesImpl.fromContext(getAppContext());
if (!preferences.isAutoUploadInitialized()) {
SyncedFolderProvider syncedFolderProvider =
new SyncedFolderProvider(MainApp.getAppContext().getContentResolver(), preferences);
new SyncedFolderProvider(MainApp.getAppContext().getContentResolver(), preferences, clock);
for (SyncedFolder syncedFolder : syncedFolderProvider.getSyncedFolders()) {
if (syncedFolder.isEnabled()) {
@@ -768,7 +780,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
}).start();
}
private static void cleanOldEntries() {
private static void cleanOldEntries(Clock clock) {
// previous versions of application created broken entries in the SyncedFolderProvider
// database, and this cleans all that and leaves 1 (newest) entry per synced folder
@@ -777,7 +789,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
if (!preferences.isLegacyClean()) {
SyncedFolderProvider syncedFolderProvider =
new SyncedFolderProvider(context.getContentResolver(), preferences);
new SyncedFolderProvider(context.getContentResolver(), preferences, clock);
List<SyncedFolder> syncedFolderList = syncedFolderProvider.getSyncedFolders();
Map<Pair<String, String>, Long> syncedFolders = new HashMap<>();
@@ -811,4 +823,18 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
return dispatchingAndroidInjector;
}
public static void setAppTheme(DarkMode mode) {
switch (mode) {
case LIGHT:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
break;
case DARK:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
break;
case SYSTEM:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
break;
}
}
}
@@ -92,6 +92,7 @@ import android.widget.Toast;
import com.blikoon.qrcodescanner.QrCodeActivity;
import com.google.android.material.snackbar.Snackbar;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.device.DeviceInfo;
import com.nextcloud.client.di.Injectable;
@@ -402,12 +403,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
setClient(progressBar);
// show snackbar after 60s to switch back to old login method
if (showLegacyLogin) {
if (showLegacyLogin && getResources().getBoolean(R.bool.show_old_login)) {
final String finalBaseURL = baseURL;
new Handler().postDelayed(() -> DisplayUtils.createSnackbar(mLoginWebView,
R.string.fallback_weblogin_text,
Snackbar.LENGTH_INDEFINITE)
.setActionTextColor(getResources().getColor(R.color.white))
.setActionTextColor(getResources().getColor(R.color.themed_fg))
.setBackgroundTint(getResources().getColor(R.color.themed_bg))
.setTextColor(getResources().getColor(R.color.themed_fg))
.setAction(R.string.fallback_weblogin_back, v -> {
mLoginWebView.setVisibility(View.INVISIBLE);
webViewLoginMethod = false;
@@ -1733,8 +1736,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
}
/// add the new account as default in preferences, if there is none already
Account defaultAccount = accountManager.getCurrentAccount();
if (defaultAccount == null) {
User defaultAccount = accountManager.getUser();
if (defaultAccount.isAnonymous()) {
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
editor.putString("select_oc_account", accountName);
editor.apply();
@@ -24,6 +24,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.PowerManager;
import android.os.SystemClock;
import android.view.Window;
import android.view.WindowManager;
@@ -102,7 +103,7 @@ public final class PassCodeManager {
activity.startActivityForResult(i, PASSCODE_ACTIVITY);
} else {
if (!askedForPin && preferences.getLockTimestamp() != 0) {
preferences.setLockTimestamp(System.currentTimeMillis());
preferences.setLockTimestamp(SystemClock.elapsedRealtime());
}
}
@@ -124,7 +125,7 @@ public final class PassCodeManager {
}
private boolean passCodeShouldBeRequested(Long timestamp) {
return (System.currentTimeMillis() - timestamp) > PASS_CODE_TIMEOUT &&
return (SystemClock.elapsedRealtime() - timestamp) > PASS_CODE_TIMEOUT &&
visibleActivitiesCounter <= 0 && isPassCodeEnabled();
}
@@ -133,7 +134,7 @@ public final class PassCodeManager {
}
private boolean deviceCredentialsShouldBeRequested(Long timestamp, Activity activity) {
return (System.currentTimeMillis() - timestamp) > PASS_CODE_TIMEOUT && visibleActivitiesCounter <= 0 &&
return (SystemClock.elapsedRealtime() - timestamp) > PASS_CODE_TIMEOUT && visibleActivitiesCounter <= 0 &&
deviceCredentialsAreEnabled(activity);
}
@@ -54,8 +54,6 @@ import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.MimeType;
import com.owncloud.android.utils.MimeTypeUtil;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
@@ -1259,8 +1257,8 @@ public class FileDataStorageManager {
private void resetShareFlagsInAllFiles() {
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, false);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, Boolean.FALSE);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, Boolean.FALSE);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?";
String[] whereArgs = new String[]{account.name};
@@ -1279,8 +1277,8 @@ public class FileDataStorageManager {
private void resetShareFlagsInFolder(OCFile folder) {
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, false);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, Boolean.FALSE);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, Boolean.FALSE);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PARENT + "=?";
String[] whereArgs = new String[]{account.name, String.valueOf(folder.getFileId())};
@@ -1299,8 +1297,8 @@ public class FileDataStorageManager {
private void resetShareFlagInAFile(String filePath) {
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, false);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, false);
cv.put(ProviderTableMeta.FILE_SHARED_VIA_LINK, Boolean.FALSE);
cv.put(ProviderTableMeta.FILE_SHARED_WITH_SHAREE, Boolean.FALSE);
cv.put(ProviderTableMeta.FILE_PUBLIC_LINK, "");
String where = ProviderTableMeta.FILE_ACCOUNT_OWNER + AND + ProviderTableMeta.FILE_PATH + "=?";
String[] whereArgs = new String[]{account.name, filePath};
@@ -1970,7 +1968,7 @@ public class FileDataStorageManager {
return capability;
}
@NotNull
@NonNull
private ContentValues createContentValues(String accountName, OCCapability capability) {
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME, accountName);
@@ -37,7 +37,9 @@ import com.owncloud.android.utils.ThemeUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
@@ -51,11 +53,11 @@ public final class MediaProvider {
private static final Uri IMAGES_MEDIA_URI = android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
private static final String[] FILE_PROJECTION = new String[]{MediaStore.MediaColumns.DATA};
private static final String IMAGES_FILE_SELECTION = MediaStore.Images.Media.BUCKET_ID + "=";
private static final String[] IMAGES_FOLDER_PROJECTION = {"Distinct " + MediaStore.Images.Media.BUCKET_ID,
private static final String[] IMAGES_FOLDER_PROJECTION = {MediaStore.Images.Media.BUCKET_ID,
MediaStore.Images.Media.BUCKET_DISPLAY_NAME};
private static final String IMAGES_FOLDER_SORT_ORDER = MediaStore.Images.Media.BUCKET_DISPLAY_NAME + " ASC";
private static final String[] VIDEOS_FOLDER_PROJECTION = {"Distinct " + MediaStore.Video.Media.BUCKET_ID,
private static final String[] VIDEOS_FOLDER_PROJECTION = {MediaStore.Video.Media.BUCKET_ID,
MediaStore.Video.Media.BUCKET_DISPLAY_NAME};
private MediaProvider() {
@@ -86,28 +88,35 @@ public final class MediaProvider {
String dataPath = MainApp.getStoragePath() + File.separator + MainApp.getDataFolder();
if (cursorFolders != null) {
String folderName;
String fileSortOrder = MediaStore.Images.Media.DATE_TAKEN + " DESC LIMIT " + itemLimit;
Cursor cursorImages;
while (cursorFolders.moveToNext()) {
String folderId = cursorFolders.getString(cursorFolders.getColumnIndex(MediaStore.Images.Media
.BUCKET_ID));
Map<String, String> uniqueFolders = new HashMap<>();
// since sdk 29 we have to manually distinct on bucket id
while (cursorFolders.moveToNext()) {
uniqueFolders.put(cursorFolders.getString(
cursorFolders.getColumnIndex(MediaStore.Images.Media.BUCKET_ID)),
cursorFolders.getString(
cursorFolders.getColumnIndex(MediaStore.Images.Media.BUCKET_DISPLAY_NAME))
);
}
cursorFolders.close();
for (Map.Entry<String, String> folder : uniqueFolders.entrySet()) {
MediaFolder mediaFolder = new MediaFolder();
folderName = cursorFolders.getString(cursorFolders.getColumnIndex(
MediaStore.Images.Media.BUCKET_DISPLAY_NAME));
mediaFolder.type = MediaFolderType.IMAGE;
mediaFolder.folderName = folderName;
mediaFolder.folderName = folder.getValue();
mediaFolder.filePaths = new ArrayList<>();
// query images
cursorImages = contentResolver.query(
IMAGES_MEDIA_URI,
FILE_PROJECTION,
IMAGES_FILE_SELECTION + folderId,
null,
fileSortOrder
IMAGES_MEDIA_URI,
FILE_PROJECTION,
IMAGES_FILE_SELECTION + folder.getKey(),
null,
fileSortOrder
);
Log.d(TAG, "Reading images for " + mediaFolder.folderName);
@@ -116,7 +125,7 @@ public final class MediaProvider {
while (cursorImages.moveToNext()) {
filePath = cursorImages.getString(cursorImages.getColumnIndexOrThrow(
MediaStore.MediaColumns.DATA));
MediaStore.MediaColumns.DATA));
// check if valid path and file exists
if (isValidAndExistingFilePath(filePath)) {
@@ -131,11 +140,11 @@ public final class MediaProvider {
// count images
Cursor count = contentResolver.query(
IMAGES_MEDIA_URI,
FILE_PROJECTION,
IMAGES_FILE_SELECTION + folderId,
null,
null);
IMAGES_MEDIA_URI,
FILE_PROJECTION,
IMAGES_FILE_SELECTION + folder.getKey(),
null,
null);
if (count != null) {
mediaFolder.numberOfFiles = count.getCount();
@@ -146,7 +155,6 @@ public final class MediaProvider {
}
}
}
cursorFolders.close();
}
return mediaFolders;
@@ -203,31 +211,38 @@ public final class MediaProvider {
String fileSortOrder = MediaStore.Video.Media.DATE_TAKEN + " DESC LIMIT " + itemLimit;
Cursor cursorVideos;
while (cursorFolders.moveToNext()) {
String folderId = cursorFolders.getString(cursorFolders.getColumnIndex(MediaStore.Video.Media
.BUCKET_ID));
Map<String, String> uniqueFolders = new HashMap<>();
// since sdk 29 we have to manually distinct on bucket id
while (cursorFolders.moveToNext()) {
uniqueFolders.put(cursorFolders.getString(
cursorFolders.getColumnIndex(MediaStore.Video.Media.BUCKET_ID)),
cursorFolders.getString(
cursorFolders.getColumnIndex(MediaStore.Video.Media.BUCKET_DISPLAY_NAME))
);
}
cursorFolders.close();
for (Map.Entry<String, String> folder : uniqueFolders.entrySet()) {
MediaFolder mediaFolder = new MediaFolder();
folderName = cursorFolders.getString(cursorFolders.getColumnIndex(
MediaStore.Video.Media.BUCKET_DISPLAY_NAME));
mediaFolder.type = MediaFolderType.VIDEO;
mediaFolder.folderName = folderName;
mediaFolder.folderName = folder.getValue();
mediaFolder.filePaths = new ArrayList<>();
// query videos
cursorVideos = contentResolver.query(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
FILE_PROJECTION,
MediaStore.Video.Media.BUCKET_ID + "=" + folderId,
null,
fileSortOrder);
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
FILE_PROJECTION,
MediaStore.Video.Media.BUCKET_ID + "=" + folder.getKey(),
null,
fileSortOrder);
Log.d(TAG, "Reading videos for " + mediaFolder.folderName);
if (cursorVideos != null) {
String filePath;
while (cursorVideos.moveToNext()) {
filePath = cursorVideos.getString(cursorVideos.getColumnIndexOrThrow(
MediaStore.MediaColumns.DATA));
MediaStore.MediaColumns.DATA));
if (filePath != null) {
mediaFolder.filePaths.add(filePath);
@@ -241,11 +256,11 @@ public final class MediaProvider {
// count images
Cursor count = contentResolver.query(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
FILE_PROJECTION,
MediaStore.Video.Media.BUCKET_ID + "=" + folderId,
null,
null);
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
FILE_PROJECTION,
MediaStore.Video.Media.BUCKET_ID + "=" + folder.getKey(),
null,
null);
if (count != null) {
mediaFolder.numberOfFiles = count.getCount();
@@ -155,6 +155,8 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
favorite = source.readInt() == 1;
encrypted = source.readInt() == 1;
encryptedFileName = source.readString();
ownerId = source.readString();
ownerDisplayName = source.readString();
mountType = (WebdavEntry.MountType) source.readSerializable();
}
@@ -185,6 +187,8 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
dest.writeInt(favorite ? 1 : 0);
dest.writeInt(encrypted ? 1 : 0);
dest.writeString(encryptedFileName);
dest.writeString(ownerId);
dest.writeString(ownerDisplayName);
dest.writeSerializable(mountType);
}
@@ -23,30 +23,29 @@ package com.owncloud.android.datamodel;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* Synced folder entity containing all information per synced folder.
*/
@Getter
@Setter
@AllArgsConstructor
public class SyncedFolder implements Serializable, Cloneable {
public static final long UNPERSISTED_ID = Long.MIN_VALUE;
public static final long EMPTY_ENABLED_TIMESTAMP_MS = -1;
private static final long serialVersionUID = -793476118299906429L;
private long id = UNPERSISTED_ID;
private String localPath;
private String remotePath;
private Boolean wifiOnly;
private Boolean chargingOnly;
private Boolean subfolderByDate;
private String account;
private Integer uploadAction;
private boolean enabled;
private MediaFolderType type;
@Getter @Setter private long id;
@Getter @Setter private String localPath;
@Getter @Setter private String remotePath;
@Getter @Setter private boolean wifiOnly;
@Getter @Setter private boolean chargingOnly;
@Getter @Setter private boolean subfolderByDate;
@Getter @Setter private String account;
@Getter @Setter private int uploadAction;
@Getter private boolean enabled;
@Getter private long enabledTimestampMs;
@Getter @Setter private MediaFolderType type;
@Getter @Setter private boolean hidden;
/**
* constructor for new, to be persisted entity.
@@ -59,11 +58,43 @@ public class SyncedFolder implements Serializable, Cloneable {
* @param account the account owning the synced folder
* @param uploadAction the action to be done after the upload
* @param enabled flag if synced folder config is active
* @param timestampMs the current timestamp in milliseconds
* @param type the type of the folder
* @param hidden hide item flag
*/
public SyncedFolder(String localPath, String remotePath, Boolean wifiOnly, Boolean chargingOnly,
Boolean subfolderByDate, String account, Integer uploadAction, Boolean enabled,
MediaFolderType type) {
public SyncedFolder(String localPath,
String remotePath,
boolean wifiOnly,
boolean chargingOnly,
boolean subfolderByDate,
String account,
int uploadAction,
boolean enabled,
long timestampMs,
MediaFolderType type,
boolean hidden) {
this(UNPERSISTED_ID, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate, account, uploadAction,
enabled, timestampMs, type, hidden);
}
/**
* constructor for wrapping existing folders.
*
* @param id id
*/
protected SyncedFolder(long id,
String localPath,
String remotePath,
boolean wifiOnly,
boolean chargingOnly,
boolean subfolderByDate,
String account,
int uploadAction,
boolean enabled,
long timestampMs,
MediaFolderType type,
boolean hidden) {
this.id = id;
this.localPath = localPath;
this.remotePath = remotePath;
this.wifiOnly = wifiOnly;
@@ -71,8 +102,17 @@ public class SyncedFolder implements Serializable, Cloneable {
this.subfolderByDate = subfolderByDate;
this.account = account;
this.uploadAction = uploadAction;
this.enabled = enabled;
this.setEnabled(enabled, timestampMs);
this.type = type;
this.hidden = hidden;
}
/**
* @param timestampMs the current timestamp in milliseconds
*/
public void setEnabled(boolean enabled, long timestampMs) {
this.enabled = enabled;
this.enabledTimestampMs = enabled ? timestampMs : EMPTY_ENABLED_TIMESTAMP_MS;
}
public Object clone() {
@@ -53,21 +53,43 @@ public class SyncedFolderDisplayItem extends SyncedFolder {
* @param folderName the UI info for the folder's name
* @param numberOfFiles the UI info for number of files within the folder
* @param type the type of the folder
* @param hidden hide item flag
*/
public SyncedFolderDisplayItem(long id, String localPath, String remotePath, Boolean wifiOnly, Boolean chargingOnly,
Boolean subfolderByDate, String account, Integer uploadAction, Boolean enabled,
List<String> filePaths, String folderName, long numberOfFiles, MediaFolderType type)
{
super(id, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate, account, uploadAction, enabled, type);
public SyncedFolderDisplayItem(long id,
String localPath,
String remotePath,
boolean wifiOnly,
boolean chargingOnly,
boolean subfolderByDate,
String account,
int uploadAction,
boolean enabled,
long timestampMs,
List<String> filePaths,
String folderName,
long numberOfFiles,
MediaFolderType type,
boolean hidden) {
super(id, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate, account, uploadAction, enabled,
timestampMs, type, hidden);
this.filePaths = filePaths;
this.folderName = folderName;
this.numberOfFiles = numberOfFiles;
}
public SyncedFolderDisplayItem(long id, String localPath, String remotePath, Boolean wifiOnly, Boolean chargingOnly,
Boolean subfolderByDate, String account, Integer uploadAction, Boolean enabled,
String folderName, MediaFolderType type) {
super(id, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate, account, uploadAction, enabled, type);
public SyncedFolderDisplayItem(long id,
String localPath,
String remotePath,
boolean wifiOnly,
boolean chargingOnly,
boolean subfolderByDate,
String account,
int uploadAction,
boolean enabled,
long timestampMs,
String folderName, MediaFolderType type, boolean hidden) {
super(id, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate, account, uploadAction, enabled,
timestampMs, type, hidden);
this.folderName = folderName;
}
}
@@ -27,6 +27,7 @@ import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.owncloud.android.db.ProviderMeta;
@@ -47,20 +48,22 @@ import static com.owncloud.android.datamodel.OCFile.PATH_SEPARATOR;
public class SyncedFolderProvider extends Observable {
static private final String TAG = SyncedFolderProvider.class.getSimpleName();
private ContentResolver mContentResolver;
private AppPreferences preferences;
private final ContentResolver mContentResolver;
private final AppPreferences preferences;
private final Clock clock;
/**
* constructor.
*
* @param contentResolver the ContentResolver to work with.
*/
public SyncedFolderProvider(ContentResolver contentResolver, AppPreferences preferences) {
public SyncedFolderProvider(ContentResolver contentResolver, AppPreferences preferences, Clock clock) {
if (contentResolver == null) {
throw new IllegalArgumentException("Cannot create an instance with a NULL contentResolver");
}
mContentResolver = contentResolver;
this.preferences = preferences;
this.clock = clock;
}
/**
@@ -162,7 +165,7 @@ public class SyncedFolderProvider extends Observable {
// read sync folder object and update
SyncedFolder syncedFolder = createSyncedFolderFromCursor(cursor);
syncedFolder.setEnabled(enabled);
syncedFolder.setEnabled(enabled, clock.getCurrentTime());
// update sync folder object in db
result = updateSyncFolder(syncedFolder);
@@ -335,23 +338,27 @@ public class SyncedFolderProvider extends Observable {
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_LOCAL_PATH));
String remotePath = cursor.getString(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_REMOTE_PATH));
Boolean wifiOnly = cursor.getInt(cursor.getColumnIndex(
boolean wifiOnly = cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_WIFI_ONLY)) == 1;
Boolean chargingOnly = cursor.getInt(cursor.getColumnIndex(
boolean chargingOnly = cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_CHARGING_ONLY)) == 1;
Boolean subfolderByDate = cursor.getInt(cursor.getColumnIndex(
boolean subfolderByDate = cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_SUBFOLDER_BY_DATE)) == 1;
String accountName = cursor.getString(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ACCOUNT));
Integer uploadAction = cursor.getInt(cursor.getColumnIndex(
int uploadAction = cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_UPLOAD_ACTION));
Boolean enabled = cursor.getInt(cursor.getColumnIndex(
boolean enabled = cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ENABLED)) == 1;
long enabledTimestampMs = cursor.getLong(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ENABLED_TIMESTAMP_MS));
MediaFolderType type = MediaFolderType.getById(cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_TYPE)));
boolean hidden = cursor.getInt(cursor.getColumnIndex(
ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_HIDDEN)) == 1;
syncedFolder = new SyncedFolder(id, localPath, remotePath, wifiOnly, chargingOnly, subfolderByDate,
accountName, uploadAction, enabled, type);
accountName, uploadAction, enabled, enabledTimestampMs, type, hidden);
}
return syncedFolder;
}
@@ -367,13 +374,15 @@ public class SyncedFolderProvider extends Observable {
ContentValues cv = new ContentValues();
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_LOCAL_PATH, syncedFolder.getLocalPath());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_REMOTE_PATH, syncedFolder.getRemotePath());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_WIFI_ONLY, syncedFolder.getWifiOnly());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_CHARGING_ONLY, syncedFolder.getChargingOnly());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_WIFI_ONLY, syncedFolder.isWifiOnly());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_CHARGING_ONLY, syncedFolder.isChargingOnly());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ENABLED, syncedFolder.isEnabled());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_SUBFOLDER_BY_DATE, syncedFolder.getSubfolderByDate());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ENABLED_TIMESTAMP_MS, syncedFolder.getEnabledTimestampMs());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_SUBFOLDER_BY_DATE, syncedFolder.isSubfolderByDate());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_ACCOUNT, syncedFolder.getAccount());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_UPLOAD_ACTION, syncedFolder.getUploadAction());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_TYPE, syncedFolder.getType().getId());
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_HIDDEN, syncedFolder.isHidden());
return cv;
}
@@ -66,7 +66,6 @@ import com.owncloud.android.utils.MimeTypeUtil;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.FileNotFoundException;
@@ -76,6 +75,7 @@ import java.net.URLEncoder;
import java.util.List;
import java.util.Locale;
import androidx.annotation.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
@@ -868,7 +868,7 @@ public final class ThumbnailsCacheManager {
return Math.round(r.getDimension(R.dimen.file_avatar_size));
}
private @NotNull
private @NonNull
Drawable doAvatarInBackground() {
Bitmap avatar;
@@ -1173,7 +1173,8 @@ public final class ThumbnailsCacheManager {
Bitmap resultBitmap = Bitmap.createBitmap(pxW, pxH, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(resultBitmap);
c.drawColor(MainApp.getAppContext().getResources().getColor(R.color.background_color));
// TODO check based on https://github.com/nextcloud/android/pull/3459#discussion_r339935975
c.drawColor(MainApp.getAppContext().getResources().getColor(R.color.background_color_png));
c.drawBitmap(bitmap, 0, 0, null);
return resultBitmap;
@@ -30,6 +30,7 @@ import android.database.Cursor;
import android.net.Uri;
import com.nextcloud.client.account.CurrentAccountProvider;
import com.nextcloud.client.account.User;
import com.owncloud.android.db.OCUpload;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import com.owncloud.android.db.UploadResult;
@@ -345,24 +346,19 @@ public class UploadsStorageManager extends Observable {
}
public OCUpload[] getCurrentAndPendingUploadsForCurrentAccount() {
Account account = currentAccountProvider.getCurrentAccount();
User user = currentAccountProvider.getUser();
if (account != null) {
return getUploads(
ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_IN_PROGRESS.value +
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"==" + UploadResult.DELAYED_FOR_WIFI.getValue() +
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"==" + UploadResult.LOCK_FAILED.getValue() +
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"==" + UploadResult.DELAYED_FOR_CHARGING.getValue() +
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"==" + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
" AND " + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?",
account.name);
} else {
return new OCUpload[0];
}
return getUploads(ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_IN_PROGRESS.value +
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"==" + UploadResult.DELAYED_FOR_WIFI.getValue() +
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"==" + UploadResult.LOCK_FAILED.getValue() +
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"==" + UploadResult.DELAYED_FOR_CHARGING.getValue() +
" OR " + ProviderTableMeta.UPLOADS_LAST_RESULT +
"==" + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
" AND " + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?",
user.getAccountName());
}
/**
@@ -384,14 +380,10 @@ public class UploadsStorageManager extends Observable {
}
public OCUpload[] getFinishedUploadsForCurrentAccount() {
Account account = currentAccountProvider.getCurrentAccount();
User user = currentAccountProvider.getUser();
if (account != null) {
return getUploads(ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_SUCCEEDED.value + AND +
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?", account.name);
} else {
return new OCUpload[0];
}
return getUploads(ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_SUCCEEDED.value + AND +
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?", user.getAccountName());
}
/**
@@ -403,23 +395,19 @@ public class UploadsStorageManager extends Observable {
}
public OCUpload[] getFailedButNotDelayedUploadsForCurrentAccount() {
Account account = currentAccountProvider.getCurrentAccount();
User user = currentAccountProvider.getUser();
if (account != null) {
return getUploads(ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_FAILED.value +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_FOR_WIFI.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.LOCK_FAILED.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_FOR_CHARGING.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
AND + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?",
account.name);
} else {
return new OCUpload[0];
}
return getUploads(ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_FAILED.value +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_FOR_WIFI.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.LOCK_FAILED.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_FOR_CHARGING.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
AND + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?",
user.getAccountName());
}
/**
@@ -446,50 +434,41 @@ public class UploadsStorageManager extends Observable {
}
public long clearFailedButNotDelayedUploads() {
Account account = currentAccountProvider.getCurrentAccount();
long result = 0;
if (account != null) {
result = getDB().delete(
ProviderTableMeta.CONTENT_URI_UPLOADS,
ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_FAILED.value +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.LOCK_FAILED.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_FOR_WIFI.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_FOR_CHARGING.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
AND + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?",
new String[]{account.name}
);
}
User user = currentAccountProvider.getUser();
final long deleted = getDB().delete(
ProviderTableMeta.CONTENT_URI_UPLOADS,
ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_FAILED.value +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.LOCK_FAILED.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_FOR_WIFI.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_FOR_CHARGING.getValue() +
AND + ProviderTableMeta.UPLOADS_LAST_RESULT +
"<>" + UploadResult.DELAYED_IN_POWER_SAVE_MODE.getValue() +
AND + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?",
new String[]{user.getAccountName()}
);
Log_OC.d(TAG, "delete all failed uploads but those delayed for Wifi");
if (result > 0) {
if (deleted > 0) {
notifyObserversNow();
}
return result;
return deleted;
}
public long clearSuccessfulUploads() {
Account account = currentAccountProvider.getCurrentAccount();
long result = 0;
if (account != null) {
result = getDB().delete(
ProviderTableMeta.CONTENT_URI_UPLOADS,
ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_SUCCEEDED.value + AND +
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?", new String[]{account.name}
);
}
User user = currentAccountProvider.getUser();
final long deleted = getDB().delete(
ProviderTableMeta.CONTENT_URI_UPLOADS,
ProviderTableMeta.UPLOADS_STATUS + "==" + UploadStatus.UPLOAD_SUCCEEDED.value + AND +
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "== ?", new String[]{user.getAccountName()}
);
Log_OC.d(TAG, "delete all successful uploads");
if (result > 0) {
if (deleted > 0) {
notifyObserversNow();
}
return result;
return deleted;
}
/**
@@ -31,7 +31,7 @@ import com.owncloud.android.MainApp;
*/
public class ProviderMeta {
public static final String DB_NAME = "filelist";
public static final int DB_VERSION = 49;
public static final int DB_VERSION = 51;
private ProviderMeta() {
// No instance
@@ -220,10 +220,12 @@ public class ProviderMeta {
public static final String SYNCED_FOLDER_WIFI_ONLY = "wifi_only";
public static final String SYNCED_FOLDER_CHARGING_ONLY = "charging_only";
public static final String SYNCED_FOLDER_ENABLED = "enabled";
public static final String SYNCED_FOLDER_ENABLED_TIMESTAMP_MS = "enabled_timestamp_ms";
public static final String SYNCED_FOLDER_TYPE = "type";
public static final String SYNCED_FOLDER_SUBFOLDER_BY_DATE = "subfolder_by_date";
public static final String SYNCED_FOLDER_ACCOUNT = "account";
public static final String SYNCED_FOLDER_UPLOAD_ACTION = "upload_option";
public static final String SYNCED_FOLDER_HIDDEN = "hidden";
// Columns of external links table
public static final String EXTERNAL_LINKS_ICON_URL = "icon_url";
@@ -28,6 +28,7 @@ import android.content.Context;
import android.content.Intent;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.device.PowerManagementService;
import com.nextcloud.client.jobs.BackgroundJobManager;
import com.nextcloud.client.network.ConnectivityService;
@@ -53,6 +54,7 @@ public class BootupBroadcastReceiver extends BroadcastReceiver {
@Inject ConnectivityService connectivityService;
@Inject PowerManagementService powerManagementService;
@Inject BackgroundJobManager backgroundJobManager;
@Inject Clock clock;
/**
* Receives broadcast intent reporting that the system was just boot up.
@@ -69,7 +71,8 @@ public class BootupBroadcastReceiver extends BroadcastReceiver {
accountManager,
connectivityService,
powerManagementService,
backgroundJobManager);
backgroundJobManager,
clock);
MainApp.initContactsBackup(accountManager);
} else {
Log_OC.d(TAG, "Getting wrong intent: " + intent.getAction());
@@ -76,8 +76,6 @@ import com.owncloud.android.ui.notifications.NotificationUtils;
import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.ThemeUtils;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.AbstractList;
import java.util.HashMap;
@@ -396,10 +394,10 @@ public class FileUploader extends Service
public void retryFailedUploads(
@NonNull final Context context,
@Nullable final Account account,
@NotNull final UploadsStorageManager uploadsStorageManager,
@NotNull final ConnectivityService connectivityService,
@NotNull final UserAccountManager accountManager,
@NotNull final PowerManagementService powerManagementService,
@NonNull final UploadsStorageManager uploadsStorageManager,
@NonNull final ConnectivityService connectivityService,
@NonNull final UserAccountManager accountManager,
@NonNull final PowerManagementService powerManagementService,
@Nullable final UploadResult uploadResult
) {
OCUpload[] failedUploads = uploadsStorageManager.getFailedUploads();
@@ -38,6 +38,7 @@ import com.evernote.android.job.Job;
import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.google.gson.Gson;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
@@ -57,18 +58,16 @@ import com.owncloud.android.ui.activity.ContactsPreferenceActivity;
import com.owncloud.android.ui.events.AccountRemovedEvent;
import com.owncloud.android.utils.EncryptionUtils;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.FilesSyncHelper;
import com.owncloud.android.utils.PushUtils;
import org.greenrobot.eventbus.EventBus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import static android.content.Context.ACCOUNT_SERVICE;
import static com.owncloud.android.ui.activity.ManageAccountsActivity.PENDING_FOR_REMOVAL;
@@ -81,17 +80,19 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
public static final String ACCOUNT = "account";
public static final String REMOTE_WIPE = "remote_wipe";
private UploadsStorageManager uploadsStorageManager;
private UserAccountManager userAccountManager;
private final UploadsStorageManager uploadsStorageManager;
private final UserAccountManager userAccountManager;
private final Clock clock;
public AccountRemovalJob(UploadsStorageManager uploadStorageManager, UserAccountManager accountManager) {
public AccountRemovalJob(UploadsStorageManager uploadStorageManager, UserAccountManager accountManager, Clock clock) {
this.uploadsStorageManager = uploadStorageManager;
this.userAccountManager = accountManager;
this.clock = clock;
}
@NonNull
@Override
protected Result onRunJob(@NotNull Params params) {
protected Result onRunJob(@NonNull Params params) {
Context context = MainApp.getAppContext();
PersistableBundleCompat bundle = params.getExtras();
Account account = userAccountManager.getAccountByName(bundle.getString(ACCOUNT, ""));
@@ -129,7 +130,7 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
arbitraryDataProvider.deleteKeyForAccount(account.name, PENDING_FOR_REMOVAL);
// remove synced folders set for account
remoceSyncedFolders(context, account, arbitraryDataProvider);
remoceSyncedFolders(context, account, clock);
// delete all uploads for account
uploadsStorageManager.removeAccountUploads(account);
@@ -174,17 +175,16 @@ public class AccountRemovalJob extends Job implements AccountManagerCallback<Boo
}
}
private void remoceSyncedFolders(Context context, Account account, ArbitraryDataProvider arbitraryDataProvider) {
private void remoceSyncedFolders(Context context, Account account, Clock clock) {
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(context.getContentResolver(),
AppPreferencesImpl.fromContext(context));
AppPreferencesImpl.fromContext(context),
clock);
List<SyncedFolder> syncedFolders = syncedFolderProvider.getSyncedFolders();
List<Long> syncedFolderIds = new ArrayList<>();
for (SyncedFolder syncedFolder : syncedFolders) {
if (syncedFolder.getAccount().equals(account.name)) {
arbitraryDataProvider.deleteKeyForAccount(FilesSyncHelper.GLOBAL,
FilesSyncHelper.SYNCEDFOLDERINITIATED + syncedFolder.getId());
syncedFolderIds.add(syncedFolder.getId());
}
}
@@ -34,6 +34,7 @@ import android.text.TextUtils;
import com.evernote.android.job.Job;
import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.device.PowerManagementService;
import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.preferences.AppPreferences;
@@ -76,22 +77,25 @@ public class FilesSyncJob extends Job {
public static final String OVERRIDE_POWER_SAVING = "overridePowerSaving";
private static final String WAKELOCK_TAG_SEPARATION = ":";
private UserAccountManager userAccountManager;
private AppPreferences preferences;
private UploadsStorageManager uploadsStorageManager;
private ConnectivityService connectivityService;
private PowerManagementService powerManagementService;
private final UserAccountManager userAccountManager;
private final AppPreferences preferences;
private final UploadsStorageManager uploadsStorageManager;
private final ConnectivityService connectivityService;
private final PowerManagementService powerManagementService;
private final Clock clock;
FilesSyncJob(final UserAccountManager userAccountManager,
final AppPreferences preferences,
final UploadsStorageManager uploadsStorageManager,
final ConnectivityService connectivityService,
final PowerManagementService powerManagementService) {
final PowerManagementService powerManagementService,
final Clock clock) {
this.userAccountManager = userAccountManager;
this.preferences = preferences;
this.uploadsStorageManager = uploadsStorageManager;
this.connectivityService = connectivityService;
this.powerManagementService = powerManagementService;
this.clock = clock;
}
@NonNull
@@ -126,13 +130,12 @@ public class FilesSyncJob extends Job {
userAccountManager,
connectivityService,
powerManagementService);
FilesSyncHelper.insertAllDBEntries(preferences, skipCustom);
FilesSyncHelper.insertAllDBEntries(preferences, clock, skipCustom);
// Create all the providers we'll need
final ContentResolver contentResolver = context.getContentResolver();
final FilesystemDataProvider filesystemDataProvider = new FilesystemDataProvider(contentResolver);
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver,
preferences);
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver, preferences, clock);
Locale currentLocale = context.getResources().getConfiguration().locale;
SimpleDateFormat sFormatter = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", currentLocale);
@@ -189,10 +192,10 @@ public class FilesSyncJob extends Job {
remotePath = resources.getString(R.string.syncedFolder_remote_folder);
} else {
needsCharging = syncedFolder.getChargingOnly();
needsWifi = syncedFolder.getWifiOnly();
needsCharging = syncedFolder.isChargingOnly();
needsWifi = syncedFolder.isWifiOnly();
uploadAction = syncedFolder.getUploadAction();
subfolderByDate = syncedFolder.getSubfolderByDate();
subfolderByDate = syncedFolder.isSubfolderByDate();
remotePath = syncedFolder.getRemotePath();
}
@@ -39,6 +39,7 @@ import android.text.TextUtils;
import com.evernote.android.job.Job;
import com.google.gson.Gson;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.owncloud.android.R;
@@ -74,11 +75,13 @@ public class MediaFoldersDetectionJob extends Job {
private static final String DISABLE_DETECTION_CLICK = "DISABLE_DETECTION_CLICK";
private UserAccountManager userAccountManager;
private Random randomId = new Random();
private final UserAccountManager userAccountManager;
private final Clock clock;
private final Random randomId = new Random();
MediaFoldersDetectionJob(UserAccountManager accountManager) {
MediaFoldersDetectionJob(UserAccountManager accountManager, Clock clock) {
this.userAccountManager = accountManager;
this.clock = clock;
}
@NonNull
@@ -88,7 +91,8 @@ public class MediaFoldersDetectionJob extends Job {
ContentResolver contentResolver = context.getContentResolver();
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(contentResolver);
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(contentResolver,
AppPreferencesImpl.fromContext(context));
AppPreferencesImpl.fromContext(context),
clock);
Gson gson = new Gson();
String arbitraryDataString;
MediaFoldersModel mediaFoldersModel;
@@ -29,6 +29,7 @@ import android.content.Context;
import com.evernote.android.job.Job;
import com.evernote.android.job.JobCreator;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.device.PowerManagementService;
import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.preferences.AppPreferences;
@@ -48,6 +49,7 @@ public class NCJobCreator implements JobCreator {
private final UploadsStorageManager uploadsStorageManager;
private final ConnectivityService connectivityService;
private final PowerManagementService powerManagementService;
private final Clock clock;
public NCJobCreator(
Context context,
@@ -55,7 +57,8 @@ public class NCJobCreator implements JobCreator {
AppPreferences preferences,
UploadsStorageManager uploadsStorageManager,
ConnectivityService connectivityServices,
PowerManagementService powerManagementService
PowerManagementService powerManagementService,
Clock clock
) {
this.context = context;
this.accountManager = accountManager;
@@ -63,6 +66,7 @@ public class NCJobCreator implements JobCreator {
this.uploadsStorageManager = uploadsStorageManager;
this.connectivityService = connectivityServices;
this.powerManagementService = powerManagementService;
this.clock = clock;
}
@Override
@@ -73,19 +77,20 @@ public class NCJobCreator implements JobCreator {
case ContactsImportJob.TAG:
return new ContactsImportJob();
case AccountRemovalJob.TAG:
return new AccountRemovalJob(uploadsStorageManager, accountManager);
return new AccountRemovalJob(uploadsStorageManager, accountManager, clock);
case FilesSyncJob.TAG:
return new FilesSyncJob(accountManager,
preferences,
uploadsStorageManager,
connectivityService,
powerManagementService);
powerManagementService,
clock);
case OfflineSyncJob.TAG:
return new OfflineSyncJob(accountManager, connectivityService, powerManagementService);
case NotificationJob.TAG:
return new NotificationJob(context, accountManager);
case MediaFoldersDetectionJob.TAG:
return new MediaFoldersDetectionJob(accountManager);
return new MediaFoldersDetectionJob(accountManager, clock);
default:
return null;
}
@@ -253,7 +253,6 @@ public class NotificationJob extends Job {
OwnCloudAccount ocAccount = new OwnCloudAccount(currentAccount, context);
OwnCloudClient client = OwnCloudClientManagerFactory.getDefaultSingleton()
.getClientFor(ocAccount, context);
client.setOwnCloudVersion(accountManager.getServerVersion(currentAccount));
RemoteOperationResult result = new GetNotificationRemoteOperation(decryptedPushMessage.nid)
.execute(client);
@@ -306,7 +305,6 @@ public class NotificationJob extends Job {
OwnCloudAccount ocAccount = new OwnCloudAccount(currentAccount, context);
OwnCloudClient client = OwnCloudClientManagerFactory.getDefaultSingleton()
.getClientFor(ocAccount, context);
client.setOwnCloudVersion(accountManager.getServerVersion(currentAccount));
String actionType = intent.getStringExtra(KEY_NOTIFICATION_ACTION_TYPE);
String actionLink = intent.getStringExtra(KEY_NOTIFICATION_ACTION_LINK);
@@ -30,6 +30,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpStatus;
import java.util.ArrayList;
@@ -119,7 +120,7 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
Log_OC.d(TAG, "Authentication method found: " + authenticationMethodToString(authMethod));
if (authMethod != AuthenticationMethod.UNKNOWN) {
result = new RemoteOperationResult(true, result.getHttpCode(), result.getHttpPhrase(), null);
result = new RemoteOperationResult(true, result.getHttpCode(), result.getHttpPhrase(), new Header[0]);
}
ArrayList<Object> data = new ArrayList<>();
data.add(authMethod);
@@ -31,6 +31,7 @@ import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.provider.OpenableColumns;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.MainApp;
import com.owncloud.android.datamodel.FileDataStorageManager;
@@ -61,8 +62,8 @@ public class DiskLruImageCacheFileProvider extends ContentProvider {
}
private OCFile getFile(Uri uri) {
Account account = accountManager.getCurrentAccount();
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(account,
User user = accountManager.getUser();
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(user.toPlatformAccount(),
MainApp.getAppContext().getContentResolver());
return fileDataStorageManager.getFileByPath(uri.getPath());
@@ -42,9 +42,11 @@ import android.net.Uri;
import android.os.Binder;
import android.text.TextUtils;
import com.nextcloud.client.core.Clock;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.SyncedFolder;
import com.owncloud.android.db.ProviderMeta;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
import com.owncloud.android.lib.common.accounts.AccountUtils;
@@ -58,7 +60,10 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import javax.inject.Inject;
import androidx.annotation.NonNull;
import dagger.android.AndroidInjection;
/**
* The ContentProvider for the ownCloud App.
@@ -91,6 +96,7 @@ public class FileContentProvider extends ContentProvider {
public static final int ARBITRARY_DATA_TABLE_INTRODUCTION_VERSION = 20;
public static final int MINIMUM_PATH_SEGMENTS_SIZE = 1;
@Inject protected Clock clock;
private DataBaseHelper mDbHelper;
private Context mContext;
private UriMatcher mUriMatcher;
@@ -414,6 +420,7 @@ public class FileContentProvider extends ContentProvider {
@Override
public boolean onCreate() {
AndroidInjection.inject(this);
mDbHelper = new DataBaseHelper(getContext());
mContext = getContext();
@@ -822,10 +829,12 @@ public class FileContentProvider extends ContentProvider {
+ ProviderTableMeta.SYNCED_FOLDER_WIFI_ONLY + " INTEGER, " // wifi_only
+ ProviderTableMeta.SYNCED_FOLDER_CHARGING_ONLY + " INTEGER, " // charging only
+ ProviderTableMeta.SYNCED_FOLDER_ENABLED + " INTEGER, " // enabled
+ ProviderTableMeta.SYNCED_FOLDER_ENABLED_TIMESTAMP_MS + " INTEGER, " // enable date
+ ProviderTableMeta.SYNCED_FOLDER_SUBFOLDER_BY_DATE + " INTEGER, " // subfolder by date
+ ProviderTableMeta.SYNCED_FOLDER_ACCOUNT + " TEXT, " // account
+ ProviderTableMeta.SYNCED_FOLDER_UPLOAD_ACTION + " INTEGER, " // upload action
+ ProviderTableMeta.SYNCED_FOLDER_TYPE + " INTEGER );" // type
+ ProviderTableMeta.SYNCED_FOLDER_TYPE + " INTEGER, " // type
+ ProviderTableMeta.SYNCED_FOLDER_HIDDEN + " INTEGER );" // hidden
);
}
@@ -2013,6 +2022,48 @@ public class FileContentProvider extends ContentProvider {
if (!upgraded) {
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
}
if (oldVersion < 50 && newVersion >= 50) {
Log_OC.i(SQL, "Entering in the #50 add persistent enable date to synced_folders table");
db.beginTransaction();
try {
db.execSQL(ALTER_TABLE + ProviderTableMeta.SYNCED_FOLDERS_TABLE_NAME +
ADD_COLUMN + ProviderTableMeta.SYNCED_FOLDER_ENABLED_TIMESTAMP_MS + " INTEGER ");
db.execSQL("UPDATE " + ProviderTableMeta.SYNCED_FOLDERS_TABLE_NAME + " SET " +
ProviderTableMeta.SYNCED_FOLDER_ENABLED_TIMESTAMP_MS + " = CASE " +
" WHEN enabled = 0 THEN " + SyncedFolder.EMPTY_ENABLED_TIMESTAMP_MS + " " +
" ELSE " + clock.getCurrentTime() +
" END ");
upgraded = true;
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
if (!upgraded) {
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
}
if (oldVersion < 51 && newVersion >= 51) {
Log_OC.i(SQL, "Entering in the #51 add show/hide to folderSync table");
db.beginTransaction();
try {
db.execSQL(ALTER_TABLE + ProviderTableMeta.SYNCED_FOLDERS_TABLE_NAME +
ADD_COLUMN + ProviderTableMeta.SYNCED_FOLDER_HIDDEN + " INTEGER ");
upgraded = true;
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
if (!upgraded) {
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
}
}
@Override
@@ -34,6 +34,7 @@ import android.os.Looper;
import android.provider.BaseColumns;
import android.widget.Toast;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
@@ -180,18 +181,14 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
// need to trust on the AccountUtils to get the current account since the query in the client side is not
// directly started by our code, but from SearchView implementation
Account account = accountManager.getCurrentAccount();
if (account == null) {
throw new IllegalArgumentException("Account may not be null!");
}
User user = accountManager.getUser();
String userQuery = lastPathSegment.toLowerCase(Locale.ROOT);
// request to the OC server about users and groups matching userQuery
GetShareesRemoteOperation searchRequest = new GetShareesRemoteOperation(userQuery, REQUESTED_PAGE,
RESULTS_PER_PAGE);
RemoteOperationResult result = searchRequest.execute(account, getContext());
RemoteOperationResult result = searchRequest.execute(user.toPlatformAccount(), getContext());
List<JSONObject> names = new ArrayList<>();
if (result.isSuccess()) {
@@ -217,8 +214,10 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
Uri remoteBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_REMOTE).build();
Uri emailBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_EMAIL).build();
FileDataStorageManager manager = new FileDataStorageManager(account, getContext().getContentResolver());
boolean federatedShareAllowed = manager.getCapability(account.name).getFilesSharingFederationOutgoing()
FileDataStorageManager manager = new FileDataStorageManager(user.toPlatformAccount(),
getContext().getContentResolver());
boolean federatedShareAllowed = manager.getCapability(user.getAccountName())
.getFilesSharingFederationOutgoing()
.isTrue();
try {
@@ -37,7 +37,6 @@ import android.os.Process;
import android.text.TextUtils;
import android.util.Pair;
import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.MainApp;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
@@ -51,7 +50,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.RestoreFileVersionRemoteOperation;
import com.owncloud.android.lib.resources.files.model.FileVersion;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.lib.resources.users.GetUserInfoRemoteOperation;
import com.owncloud.android.operations.CheckCurrentCredentialsOperation;
import com.owncloud.android.operations.CopyFileOperation;
@@ -76,8 +74,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentMap;
import javax.inject.Inject;
import dagger.android.AndroidInjection;
public class OperationsService extends Service {
@@ -137,8 +133,6 @@ public class OperationsService extends Service {
private ConcurrentMap<Integer, Pair<RemoteOperation, RemoteOperationResult>>
mUndispatchedFinishedOperations = new ConcurrentHashMap<>();
@Inject UserAccountManager accountManager;
private static class Target {
public Uri mServerUrl;
public Account mAccount;
@@ -164,7 +158,7 @@ public class OperationsService extends Service {
HandlerThread thread = new HandlerThread("Operations thread",
Process.THREAD_PRIORITY_BACKGROUND);
thread.start();
mOperationsHandler = new ServiceHandler(thread.getLooper(), this, accountManager);
mOperationsHandler = new ServiceHandler(thread.getLooper(), this);
mOperationsBinder = new OperationsServiceBinder(mOperationsHandler);
// Separated worker thread for download of folders (WIP)
@@ -400,16 +394,14 @@ public class OperationsService extends Service {
private Target mLastTarget;
private OwnCloudClient mOwnCloudClient;
private FileDataStorageManager mStorageManager;
private UserAccountManager accountManager;
public ServiceHandler(Looper looper, OperationsService service, UserAccountManager accountManager) {
public ServiceHandler(Looper looper, OperationsService service) {
super(looper);
if (service == null) {
throw new IllegalArgumentException("Received invalid NULL in parameter 'service'");
}
mService = service;
this.accountManager = accountManager;
}
@Override
@@ -443,9 +435,6 @@ public class OperationsService extends Service {
mOwnCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
getClientFor(ocAccount, mService);
OwnCloudVersion version = accountManager.getServerVersion(mLastTarget.mAccount);
mOwnCloudClient.setOwnCloudVersion(version);
mStorageManager = new FileDataStorageManager(
mLastTarget.mAccount,
mService.getContentResolver()
@@ -1,38 +0,0 @@
/**
* ownCloud Android client application
*
* Copyright (C) 2015 ownCloud Inc.
*
* 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;
import android.content.Context;
import android.preference.CheckBoxPreference;
import android.view.View;
import com.owncloud.android.R;
public class RadioButtonPreference extends CheckBoxPreference implements View.OnLongClickListener {
public RadioButtonPreference(Context context) {
super(context, null, android.R.attr.checkBoxPreferenceStyle);
setWidgetLayoutResource(R.layout.preference_widget_radiobutton);
}
@Override
public boolean onLongClick(View v) {
return true;
}
}
@@ -23,16 +23,15 @@ package com.owncloud.android.ui;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Build;
import android.preference.SwitchPreference;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Switch;
import com.owncloud.android.R;
import com.owncloud.android.utils.ThemeUtils;
import androidx.annotation.RequiresApi;
import androidx.core.graphics.drawable.DrawableCompat;
@@ -57,12 +56,11 @@ public class ThemeableSwitchPreference extends SwitchPreference {
protected void onBindView(View view) {
super.onBindView(view);
if (view instanceof ViewGroup && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (view instanceof ViewGroup) {
findSwitch((ViewGroup) view);
}
}
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN)
private void findSwitch(ViewGroup viewGroup) {
ColorStateList thumbColorStateList = null;
ColorStateList trackColorStateList = null;
@@ -76,12 +74,14 @@ public class ThemeableSwitchPreference extends SwitchPreference {
if(thumbColorStateList == null && trackColorStateList == null) {
int color = ThemeUtils.primaryAccentColor(getContext());
int trackColor = Color.argb(77, Color.red(color), Color.green(color), Color.blue(color));
int trackColorUnchecked = getContext().getResources().getColor(R.color.switch_track_color_unchecked);
thumbColorStateList = new ColorStateList(
new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
new int[]{color, Color.WHITE});
trackColorStateList = new ColorStateList(
new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
new int[]{trackColor, Color.parseColor("#4D000000")});
new int[][]{new int[]{android.R.attr.state_checked},
new int[]{}},
new int[]{trackColor, trackColorUnchecked});
}
// setting the thumb color
@@ -29,10 +29,10 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.activities.model.RichObject;
import com.owncloud.android.lib.resources.files.FileUtils;
@@ -169,7 +169,8 @@ public class ActivitiesActivity extends FileActivity implements ActivityListInte
PorterDuff.Mode.SRC_IN);
FileDataStorageManager storageManager = new FileDataStorageManager(getAccount(), getContentResolver());
adapter = new ActivityListAdapter(this, getUserAccountManager(), this, storageManager, getCapabilities(), false);
adapter = new ActivityListAdapter(this, getUserAccountManager(), this, storageManager,
getCapabilities(), false);
recyclerView.setAdapter(adapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
@@ -237,7 +238,7 @@ public class ActivitiesActivity extends FileActivity implements ActivityListInte
}
@Override
public void showActivities(List<Object> activities, OwnCloudClient client, int lastGiven) {
public void showActivities(List<Object> activities, NextcloudClient client, int lastGiven) {
boolean clear = false;
if (this.lastGiven == UNDEFINED) {
clear = true;
@@ -247,12 +248,8 @@ public class ActivitiesActivity extends FileActivity implements ActivityListInte
// Hide the recyclerView if list is empty
if (adapter.isEmpty()) {
showEmptyContent(noResultsHeadline, noResultsMessage);
recyclerView.setVisibility(View.INVISIBLE);
emptyContentMessage.setText(noResultsMessage);
emptyContentHeadline.setText(noResultsHeadline);
emptyContentMessage.setVisibility(View.VISIBLE);
emptyContentHeadline.setVisibility(View.VISIBLE);
} else {
emptyContentMessage.setVisibility(View.INVISIBLE);
emptyContentHeadline.setVisibility(View.INVISIBLE);
@@ -307,6 +304,9 @@ public class ActivitiesActivity extends FileActivity implements ActivityListInte
emptyContentProgressBar.setVisibility(View.GONE);
emptyContentIcon.setVisibility(View.VISIBLE);
emptyContentHeadline.setVisibility(View.VISIBLE);
emptyContentMessage.setVisibility(View.VISIBLE);
}
}
@@ -18,8 +18,8 @@
*/
package com.owncloud.android.ui.activities;
import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.ui.activity.BaseActivity;
import java.util.List;
@@ -27,7 +27,7 @@ import java.util.List;
public interface ActivitiesContract {
interface View {
void showActivities(List<Object> activities, OwnCloudClient client, int lastGiven);
void showActivities(List<Object> activities, NextcloudClient client, int lastGiven);
void showActivitiesLoadError(String error);
void showActivityDetailUI(OCFile ocFile);
void showActivityDetailUIIsNull();
@@ -19,8 +19,8 @@
package com.owncloud.android.ui.activities;
import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.ui.activities.data.activities.ActivitiesRepository;
import com.owncloud.android.ui.activities.data.files.FilesRepository;
import com.owncloud.android.ui.activity.BaseActivity;
@@ -51,7 +51,7 @@ public class ActivitiesPresenter implements ActivitiesContract.ActionListener {
activitiesView.setProgressIndicatorState(true);
activitiesRepository.getActivities(lastGiven, new ActivitiesRepository.LoadActivitiesCallback() {
@Override
public void onActivitiesLoaded(List<Object> activities, OwnCloudClient client, int lastGiven) {
public void onActivitiesLoaded(List<Object> activities, NextcloudClient client, int lastGiven) {
if (!activityStopped) {
activitiesView.setProgressIndicatorState(false);
@@ -99,7 +99,6 @@ public class StickyHeaderItemDecoration extends RecyclerView.ItemDecoration {
int headerPosition = adapter.getHeaderPositionForItem(itemPosition);
int layoutId = adapter.getHeaderLayout(itemPosition);
View header = LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
header.setBackgroundColor(Color.WHITE);
adapter.bindHeaderData(header, headerPosition);
return header;
}
@@ -18,7 +18,7 @@
*/
package com.owncloud.android.ui.activities.data.activities;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.nextcloud.common.NextcloudClient;
import java.util.List;
@@ -29,7 +29,7 @@ import androidx.annotation.NonNull;
*/
public interface ActivitiesRepository {
interface LoadActivitiesCallback {
void onActivitiesLoaded(List<Object> activities, OwnCloudClient client, int lastGiven);
void onActivitiesLoaded(List<Object> activities, NextcloudClient client, int lastGiven);
void onActivitiesLoadedError(String error);
}
@@ -18,7 +18,7 @@
*/
package com.owncloud.android.ui.activities.data.activities;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.lib.resources.activities.model.Activity;
import java.util.List;
@@ -31,7 +31,7 @@ import java.util.List;
public interface ActivitiesServiceApi {
interface ActivitiesServiceCallback<T> {
void onLoaded(T activities, OwnCloudClient client, int lastGiven);
void onLoaded(T activities, NextcloudClient client, int lastGiven);
void onError (String error);
}
@@ -29,10 +29,10 @@ import android.content.Context;
import android.os.AsyncTask;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
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.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -58,8 +58,9 @@ public class ActivitiesServiceApiImpl implements ActivitiesServiceApi {
@Override
public void getAllActivities(int lastGiven, ActivitiesServiceCallback<List<Object>> callback) {
Account account = accountManager.getCurrentAccount();
GetActivityListTask getActivityListTask = new GetActivityListTask(account, accountManager, lastGiven, callback);
GetActivityListTask getActivityListTask = new GetActivityListTask(accountManager.getUser().toPlatformAccount(),
lastGiven,
callback);
getActivityListTask.execute();
}
@@ -68,17 +69,14 @@ public class ActivitiesServiceApiImpl implements ActivitiesServiceApi {
private final ActivitiesServiceCallback<List<Object>> callback;
private List<Object> activities;
private Account account;
private UserAccountManager accountManager;
private int lastGiven;
private String errorMessage;
private OwnCloudClient ownCloudClient;
private NextcloudClient client;
private GetActivityListTask(Account account,
UserAccountManager accountManager,
int lastGiven,
ActivitiesServiceCallback<List<Object>> callback) {
this.account = account;
this.accountManager = accountManager;
this.lastGiven = lastGiven;
this.callback = callback;
activities = new ArrayList<>();
@@ -91,9 +89,8 @@ public class ActivitiesServiceApiImpl implements ActivitiesServiceApi {
OwnCloudAccount ocAccount;
try {
ocAccount = new OwnCloudAccount(account, context);
ownCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
getClientFor(ocAccount, MainApp.getAppContext());
ownCloudClient.setOwnCloudVersion(accountManager.getServerVersion(account));
client = OwnCloudClientManagerFactory.getDefaultSingleton().
getNextcloudClientFor(ocAccount, MainApp.getAppContext());
GetActivitiesRemoteOperation getRemoteActivitiesOperation;
if (lastGiven > 0) {
@@ -102,7 +99,7 @@ public class ActivitiesServiceApiImpl implements ActivitiesServiceApi {
getRemoteActivitiesOperation = new GetActivitiesRemoteOperation();
}
final RemoteOperationResult result = getRemoteActivitiesOperation.execute(ownCloudClient);
final RemoteOperationResult result = getRemoteActivitiesOperation.execute(client);
if (result.isSuccess() && result.getData() != null) {
final ArrayList<Object> data = result.getData();
@@ -141,7 +138,7 @@ public class ActivitiesServiceApiImpl implements ActivitiesServiceApi {
protected void onPostExecute(Boolean success) {
super.onPostExecute(success);
if (success) {
callback.onLoaded(activities, ownCloudClient, lastGiven);
callback.onLoaded(activities, client, lastGiven);
} else {
callback.onError(errorMessage);
}
@@ -18,7 +18,7 @@
*/
package com.owncloud.android.ui.activities.data.activities;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.nextcloud.common.NextcloudClient;
import java.util.List;
@@ -38,7 +38,7 @@ public class RemoteActivitiesRepository implements ActivitiesRepository {
activitiesServiceApi.getAllActivities(lastGiven,
new ActivitiesServiceApi.ActivitiesServiceCallback<List<Object>>() {
@Override
public void onLoaded(List<Object> activities, OwnCloudClient client, int lastGiven) {
public void onLoaded(List<Object> activities, NextcloudClient client, int lastGiven) {
callback.onActivitiesLoaded(activities, client, lastGiven);
}
@@ -22,19 +22,16 @@
*/
package com.owncloud.android.ui.activities.data.files;
import android.accounts.Account;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.content.Context;
import android.os.AsyncTask;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.network.ClientFactory;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
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.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -44,8 +41,6 @@ import com.owncloud.android.operations.RefreshFolderOperation;
import com.owncloud.android.ui.activity.BaseActivity;
import com.owncloud.android.utils.FileStorageUtils;
import java.io.IOException;
/**
* Implementation of the Files service API that communicates with the NextCloud remote server.
*/
@@ -54,15 +49,18 @@ public class FilesServiceApiImpl implements FilesServiceApi {
private static final String TAG = FilesServiceApiImpl.class.getSimpleName();
private UserAccountManager accountManager;
private ClientFactory clientFactory;
public FilesServiceApiImpl(UserAccountManager accountManager) {
public FilesServiceApiImpl(UserAccountManager accountManager, ClientFactory clientFactory) {
this.accountManager = accountManager;
this.clientFactory = clientFactory;
}
@Override
public void readRemoteFile(String fileUrl, BaseActivity activity, FilesServiceCallback<OCFile> callback) {
ReadRemoteFileTask readRemoteFileTask = new ReadRemoteFileTask(
accountManager,
clientFactory,
fileUrl,
activity,
callback
@@ -77,30 +75,28 @@ public class FilesServiceApiImpl implements FilesServiceApi {
// TODO: Figure out a better way to do this than passing a BaseActivity reference.
private final BaseActivity baseActivity;
private final String fileUrl;
private final Account account;
private final User user;
private final UserAccountManager accountManager;
private final ClientFactory clientFactory;
private ReadRemoteFileTask(UserAccountManager accountManager,
ClientFactory clientFactory,
String fileUrl,
BaseActivity baseActivity,
FilesServiceCallback<OCFile> callback) {
this.callback = callback;
this.baseActivity = baseActivity;
this.fileUrl = fileUrl;
this.account = accountManager.getCurrentAccount();
this.user = accountManager.getUser();
this.accountManager = accountManager;
this.clientFactory = clientFactory;
}
@Override
protected Boolean doInBackground(Void... voids) {
final Context context = MainApp.getAppContext();
OwnCloudAccount ocAccount;
OwnCloudClient ownCloudClient;
try {
ocAccount = new OwnCloudAccount(account, context);
ownCloudClient = OwnCloudClientManagerFactory.getDefaultSingleton().
getClientFor(ocAccount, MainApp.getAppContext());
ownCloudClient.setOwnCloudVersion(accountManager.getServerVersion(account));
OwnCloudClient ownCloudClient = clientFactory.create(user);
// always update file as it could be an old state saved in database
RemoteOperationResult resultRemoteFileOp = new ReadFileRemoteOperation(fileUrl).execute(ownCloudClient);
@@ -111,28 +107,19 @@ public class FilesServiceApiImpl implements FilesServiceApi {
if (remoteOcFile.isFolder()) {
// perform folder synchronization
RemoteOperation synchFolderOp = new RefreshFolderOperation(remoteOcFile,
System.currentTimeMillis(),
false,
true,
baseActivity.getStorageManager(),
baseActivity.getAccount(),
context);
System.currentTimeMillis(),
false,
true,
baseActivity.getStorageManager(),
baseActivity.getAccount(),
context);
synchFolderOp.execute(ownCloudClient);
}
}
return true;
} catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException e) {
} catch (ClientFactory.CreationException e) {
Log_OC.e(TAG, "Account not found", e);
errorMessage = baseActivity.getString(R.string.account_not_found);
} catch (IOException e) {
Log_OC.e(TAG, "IO error", e);
errorMessage = baseActivity.getString(R.string.io_error);
} catch (OperationCanceledException e) {
Log_OC.e(TAG, "Operation has been canceled", e);
errorMessage = baseActivity.getString(R.string.operation_canceled);
} catch (AuthenticatorException e) {
Log_OC.e(TAG, "Authentication Exception", e);
errorMessage = baseActivity.getString(R.string.authentication_exception);
}
return false;
@@ -8,9 +8,14 @@ import android.accounts.OperationCanceledException;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.PersistableBundle;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.java.util.Optional;
import com.nextcloud.client.preferences.DarkMode;
import com.owncloud.android.MainApp;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
@@ -19,43 +24,93 @@ import com.owncloud.android.lib.resources.status.OCCapability;
import javax.inject.Inject;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
/**
* Base activity with common behaviour for activities dealing with ownCloud {@link Account}s .
*/
public abstract class BaseActivity extends AppCompatActivity implements Injectable {
private static final String TAG = BaseActivity.class.getSimpleName();
/**
* ownCloud {@link Account} where the main {@link OCFile} handled by the activity is located.
*/
private Account mCurrentAccount;
private Account currentAccount;
/**
* Capabilities of the server where {@link #mCurrentAccount} lives.
* Capabilities of the server where {@link #currentAccount} lives.
*/
private OCCapability mCapabilities;
private OCCapability capabilities;
/**
* Access point to the cached database for the current ownCloud {@link Account}.
*/
private FileDataStorageManager mStorageManager;
private FileDataStorageManager storageManager;
/**
* Tracks whether the activity should be recreate()'d after a theme change
*/
private boolean themeChangePending;
private boolean paused;
@Inject UserAccountManager accountManager;
@Inject AppPreferences preferences;
private AppPreferences.Listener onPreferencesChanged = new AppPreferences.Listener() {
@Override
public void onDarkThemeModeChanged(DarkMode mode) {
onThemeSettingsModeChanged();
}
};
public UserAccountManager getUserAccountManager() {
return accountManager;
}
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
preferences.addListener(onPreferencesChanged);
}
@Override
protected void onDestroy() {
super.onDestroy();
preferences.removeListener(onPreferencesChanged);
}
@Override
protected void onPause() {
super.onPause();
paused = true;
}
@Override
protected void onResume() {
super.onResume();
paused = false;
if (themeChangePending) {
recreate();
}
}
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
Account account = accountManager.getCurrentAccount();
setAccount(account, false);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Log_OC.v(TAG, "onNewIntent() start");
Account current = accountManager.getCurrentAccount();
if (current != null && mCurrentAccount != null && !mCurrentAccount.name.equals(current.name)) {
mCurrentAccount = current;
if (current != null && currentAccount != null && !currentAccount.name.equals(current.name)) {
currentAccount = current;
}
Log_OC.v(TAG, "onNewIntent() stop");
}
@@ -68,13 +123,21 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
protected void onRestart() {
Log_OC.v(TAG, "onRestart() start");
super.onRestart();
boolean validAccount = mCurrentAccount != null && accountManager.exists(mCurrentAccount);
boolean validAccount = currentAccount != null && accountManager.exists(currentAccount);
if (!validAccount) {
swapToDefaultAccount();
}
Log_OC.v(TAG, "onRestart() end");
}
private void onThemeSettingsModeChanged() {
if (paused) {
themeChangePending = true;
} else {
recreate();
}
}
/**
* Sets and validates the ownCloud {@link Account} associated to the Activity.
*
@@ -87,10 +150,19 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
protected void setAccount(Account account, boolean savedAccount) {
boolean validAccount = account != null && accountManager.setCurrentOwnCloudAccount(account.name);
if (validAccount) {
mCurrentAccount = account;
currentAccount = account;
} else {
swapToDefaultAccount();
}
if(currentAccount != null) {
storageManager = new FileDataStorageManager(currentAccount, getContentResolver());
capabilities = storageManager.getCapability(currentAccount.name);
}
}
protected void setUser(User user) {
setAccount(user.toPlatformAccount(), false);
}
/**
@@ -106,7 +178,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
/// no account available: force account creation
createAccount(true);
} else {
mCurrentAccount = newAccount;
currentAccount = newAccount;
}
}
@@ -127,26 +199,6 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
new Handler());
}
/**
* Called when the ownCloud {@link Account} associated to the Activity was just updated.
*
* Child classes must grant that state depending on the {@link Account} is updated.
*/
@Deprecated
protected void onAccountSet() {
if (getAccount() != null) {
mStorageManager = new FileDataStorageManager(getAccount(), getContentResolver());
mCapabilities = mStorageManager.getCapability(mCurrentAccount.name);
} else {
Log_OC.e(TAG, "onAccountChanged was called with NULL account associated!");
}
}
@Deprecated
protected void setAccount(Account account) {
mCurrentAccount = account;
}
/**
* Getter for the capabilities of the server where the current OC account lives.
*
@@ -154,7 +206,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
* set yet.
*/
public OCCapability getCapabilities() {
return mCapabilities;
return capabilities;
}
/**
@@ -165,20 +217,19 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
* is located.
*/
public Account getAccount() {
return mCurrentAccount;
return currentAccount;
}
@Override
protected void onStart() {
super.onStart();
if(mCurrentAccount != null) {
onAccountSet();
public Optional<User> getUser() {
if (currentAccount != null) {
return accountManager.getUser(currentAccount.name);
} else {
return Optional.empty();
}
}
public FileDataStorageManager getStorageManager() {
return mStorageManager;
return storageManager;
}
/**
@@ -22,7 +22,6 @@
package com.owncloud.android.ui.activity;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
@@ -93,7 +92,7 @@ public class CommunityActivity extends FileActivity {
getString(R.string.contributing_link)))));
MaterialButton reportButton = findViewById(R.id.community_testing_report);
reportButton.getBackground().setColorFilter(ThemeUtils.primaryColor(this, true), PorterDuff.Mode.SRC_ATOP);
reportButton.setBackgroundColor(ThemeUtils.primaryColor(this,true));
reportButton.setOnClickListener(v -> DisplayUtils.startLinkIntent(this, R.string.report_issue_link));
}
@@ -41,6 +41,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.text.Html;
import android.view.Menu;
import android.view.MenuItem;
@@ -56,10 +57,12 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.google.android.material.navigation.NavigationView;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.account.User;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.network.ClientFactory;
import com.nextcloud.client.onboarding.FirstRunActivity;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.DarkMode;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.PassCodeManager;
@@ -69,7 +72,6 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.ExternalLink;
import com.owncloud.android.lib.common.ExternalLinkType;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.Quota;
import com.owncloud.android.lib.common.UserInfo;
import com.owncloud.android.lib.common.accounts.ExternalLinksOperation;
@@ -109,7 +111,9 @@ import javax.inject.Inject;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.graphics.drawable.DrawerArrowDrawable;
import androidx.core.content.ContextCompat;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
@@ -215,6 +219,9 @@ public abstract class DrawerActivity extends ToolbarActivity
@Inject
AppPreferences preferences;
@Inject
ClientFactory clientFactory;
/**
* Initializes the drawer, its content and highlights the menu item with the given id.
* This method needs to be called after the content view has been set.
@@ -355,21 +362,19 @@ public abstract class DrawerActivity extends ToolbarActivity
navigationView.getMenu().setGroupVisible(R.id.drawer_menu_accounts, false);
}
Account account = accountManager.getCurrentAccount();
User account = accountManager.getUser();
filterDrawerMenu(navigationView.getMenu(), account);
}
private void filterDrawerMenu(Menu menu, Account account) {
OCCapability capability = null;
if (account != null) {
FileDataStorageManager storageManager = new FileDataStorageManager(account, getContentResolver());
capability = storageManager.getCapability(account.name);
}
private void filterDrawerMenu(final Menu menu, @NonNull final User user) {
FileDataStorageManager storageManager = new FileDataStorageManager(user.toPlatformAccount(),
getContentResolver());
OCCapability capability = storageManager.getCapability(user.getAccountName());
boolean hasSearchSupport = accountManager.getServerVersion(account).isSearchSupported();
boolean hasSearchSupport = user.getServer().getVersion().isSearchSupported();
DrawerMenuUtil.filterSearchMenuItems(menu, account, getResources(), hasSearchSupport);
DrawerMenuUtil.filterTrashbinMenuItem(menu, account, capability, accountManager);
DrawerMenuUtil.filterSearchMenuItems(menu, user.toPlatformAccount(), getResources(), hasSearchSupport);
DrawerMenuUtil.filterTrashbinMenuItem(menu, user.toPlatformAccount(), capability, accountManager);
DrawerMenuUtil.filterActivityMenuItem(menu, capability);
DrawerMenuUtil.setupHomeMenuItem(menu, getResources());
@@ -683,7 +688,7 @@ public abstract class DrawerActivity extends ToolbarActivity
if (mNavigationView != null && mDrawerLayout != null) {
if (persistingAccounts.size() > 0) {
repopulateAccountList(persistingAccounts);
setAccountInDrawer(accountManager.getCurrentAccount());
setAccountInDrawer(accountManager.getUser());
populateDrawerOwnCloudAccounts();
// activate second/end account avatar
@@ -789,30 +794,25 @@ public abstract class DrawerActivity extends ToolbarActivity
* sets the given account name in the drawer in case the drawer is available. The account name is shortened
* beginning from the @-sign in the username.
*
* @param account the account to be set in the drawer
* @param user the account to be set in the drawer
*/
protected void setAccountInDrawer(Account account) {
if (mDrawerLayout != null && account != null) {
protected void setAccountInDrawer(User user) {
if (mDrawerLayout != null && user != null) {
TextView username = (TextView) findNavigationViewChildById(R.id.drawer_username);
TextView usernameFull = (TextView) findNavigationViewChildById(R.id.drawer_username_full);
usernameFull.setText(DisplayUtils.convertIdn(account.name.substring(account.name.lastIndexOf('@') + 1),
String name = user.getAccountName();
usernameFull.setText(DisplayUtils.convertIdn(name.substring(name.lastIndexOf('@') + 1),
false));
usernameFull.setTextColor(ThemeUtils.fontColor(this));
try {
OwnCloudAccount oca = new OwnCloudAccount(account, this);
username.setText(oca.getDisplayName());
username.setTextColor(ThemeUtils.fontColor(this));
} catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException e) {
Log_OC.w(TAG, "Couldn't read display name of account fallback to account name");
username.setText(UserAccountManager.getUsername(account));
}
username.setText(user.toOwnCloudAccount().getDisplayName());
username.setTextColor(ThemeUtils.fontColor(this));
View currentAccountView = findNavigationViewChildById(R.id.drawer_current_account);
currentAccountView.setTag(account.name);
currentAccountView.setTag(name);
DisplayUtils.setAvatar(account, this, mCurrentAccountAvatarRadiusDimension, getResources(),
DisplayUtils.setAvatar(user.toPlatformAccount(), this, mCurrentAccountAvatarRadiusDimension, getResources(),
currentAccountView, this);
// check and show quota info if available
@@ -956,6 +956,7 @@ public abstract class DrawerActivity extends ToolbarActivity
};
DisplayUtils.downloadIcon(getUserAccountManager(),
clientFactory,
this,
firstQuota.iconUrl,
target,
@@ -989,7 +990,17 @@ public abstract class DrawerActivity extends ToolbarActivity
MenuItem menuItem = mNavigationView.getMenu().getItem(i);
if (menuItem.getIcon() != null) {
menuItem.getIcon().clearColorFilter();
menuItem.setTitle(Html.fromHtml("<font color='#000000'>" + menuItem.getTitle() + "</font>"));
if (menuItem.getGroupId() != R.id.drawer_menu_accounts
|| menuItem.getItemId() == R.id.drawer_menu_account_add
|| menuItem.getItemId() == R.id.drawer_menu_account_manage) {
ThemeUtils.tintDrawable(
menuItem.getIcon(), ContextCompat.getColor(this, R.color.drawer_menu_icon));
}
menuItem.setTitle(Html.fromHtml(
"<font color='"
+ ThemeUtils.colorToHexString(ContextCompat.getColor(this, R.color.text_color))
+ "'>" + menuItem.getTitle()
+ "</font>"));
}
}
@@ -1012,14 +1023,14 @@ public abstract class DrawerActivity extends ToolbarActivity
// set user space information
Thread t = new Thread(new Runnable() {
public void run() {
final Account currentAccount = accountManager.getCurrentAccount();
final User user = accountManager.getUser();
if (currentAccount == null) {
if (user.isAnonymous()) {
return;
}
final Context context = MainApp.getAppContext();
RemoteOperationResult result = new GetUserInfoRemoteOperation().execute(currentAccount, context);
RemoteOperationResult result = new GetUserInfoRemoteOperation().execute(user.toPlatformAccount(), context);
if (result.isSuccess() && result.getData() != null) {
final UserInfo userInfo = (UserInfo) result.getData().get(0);
@@ -1068,7 +1079,7 @@ public abstract class DrawerActivity extends ToolbarActivity
float density = getResources().getDisplayMetrics().density;
final int size = Math.round(24 * density);
int greyColor = getResources().getColor(R.color.standard_grey);
int greyColor = ContextCompat.getColor(this, R.color.drawer_menu_icon);
for (final ExternalLink link : externalLinksProvider.getExternalLink(ExternalLinkType.LINK)) {
int id = mNavigationView.getMenu().add(R.id.drawer_menu_external_links,
@@ -1089,6 +1100,7 @@ public abstract class DrawerActivity extends ToolbarActivity
};
DisplayUtils.downloadIcon(getUserAccountManager(),
clientFactory,
this,
link.iconUrl,
target,
@@ -1263,6 +1275,12 @@ public abstract class DrawerActivity extends ToolbarActivity
@Override
protected void onResume() {
super.onResume();
if (AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) {
getDelegate().setLocalNightMode(DarkMode.DARK == preferences.getDarkThemeMode() ?
AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO);
getDelegate().applyDayNight();
}
setDrawerMenuItemChecked(mCheckedMenuItem);
}
@@ -1278,7 +1296,7 @@ public abstract class DrawerActivity extends ToolbarActivity
// current account has changed
if (data.getBooleanExtra(ManageAccountsActivity.KEY_CURRENT_ACCOUNT_CHANGED, false)) {
setAccount(accountManager.getCurrentAccount());
setAccount(accountManager.getCurrentAccount(), false);
updateAccountList();
restart();
} else {
@@ -1360,12 +1378,11 @@ public abstract class DrawerActivity extends ToolbarActivity
}
}
Account currentAccount = accountManager.getCurrentAccount();
mAvatars[0] = currentAccount;
User user = accountManager.getUser();
mAvatars[0] = user.toPlatformAccount();
int j = 0;
for (int i = 1; i <= 2 && i < persistingAccounts.size() && j < persistingAccounts.size(); j++) {
if (!currentAccount.equals(persistingAccounts.get(j))) {
if (!user.equals(persistingAccounts.get(j))) {
mAvatars[i] = persistingAccounts.get(j);
i++;
}
@@ -1421,7 +1438,7 @@ public abstract class DrawerActivity extends ToolbarActivity
@Override
protected void onStop() {
if (preferences.getLockTimestamp() != 0) {
preferences.setLockTimestamp(System.currentTimeMillis());
preferences.setLockTimestamp(SystemClock.elapsedRealtime());
}
EventBus.getDefault().unregister(this);
super.onStop();
@@ -1447,11 +1464,10 @@ public abstract class DrawerActivity extends ToolbarActivity
getCapabilities.execute(getStorageManager(), getBaseContext());
}
Account account = accountManager.getCurrentAccount();
if (account != null && getStorageManager() != null &&
getStorageManager().getCapability(account.name) != null &&
getStorageManager().getCapability(account.name).getExternalLinks().isTrue()) {
User user = accountManager.getUser();
String name = user.getAccountName();
if (getStorageManager() != null && getStorageManager().getCapability(name) != null &&
getStorageManager().getCapability(name).getExternalLinks().isTrue()) {
int count = arbitraryDataProvider.getIntegerValue(FilesSyncHelper.GLOBAL,
FileActivity.APP_OPENED_COUNT);
@@ -1466,7 +1482,7 @@ public abstract class DrawerActivity extends ToolbarActivity
Log_OC.d("ExternalLinks", "update via api");
RemoteOperation getExternalLinksOperation = new ExternalLinksOperation();
RemoteOperationResult result = getExternalLinksOperation.execute(account, this);
RemoteOperationResult result = getExternalLinksOperation.execute(user.toPlatformAccount(), this);
if (result.isSuccess() && result.getData() != null) {
externalLinksProvider.deleteAllExternalLinks();
@@ -28,7 +28,6 @@ package com.owncloud.android.ui.activity;
import android.Manifest;
import android.accounts.Account;
import android.accounts.AuthenticatorException;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -42,7 +41,6 @@ import android.content.SyncRequest;
import android.content.pm.PackageManager;
import android.content.res.Resources.NotFoundException;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
@@ -54,11 +52,13 @@ import android.view.View;
import android.view.ViewTreeObserver;
import com.google.android.material.snackbar.Snackbar;
import com.nextcloud.client.account.User;
import com.nextcloud.client.appinfo.AppInfo;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.media.PlayerServiceConnection;
import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
@@ -321,7 +321,7 @@ public class FileDisplayActivity extends FileActivity
}
} else {
createMinFragments(savedInstanceState);
refreshList(true);
syncAndUpdateFolder(true);
}
setIndeterminate(mSyncInProgress);
@@ -394,7 +394,7 @@ public class FileDisplayActivity extends FileActivity
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted
EventBus.getDefault().post(new TokenPushEvent());
refreshList(true);
syncAndUpdateFolder(true);
// toggle on is save since this is the only scenario this code gets accessed
} else {
// permission denied --> do nothing
@@ -502,9 +502,13 @@ public class FileDisplayActivity extends FileActivity
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (ACTION_DETAILS.equalsIgnoreCase(intent.getAction())) {
OCFile file = intent.getParcelableExtra(EXTRA_FILE);
setFile(file);
setIntent(intent);
setFile(intent.getParcelableExtra(EXTRA_FILE));
showDetails(file);
} else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
handleOpenFileViaIntent(intent);
} else if (RESTART.equals(intent.getAction())) {
@@ -685,7 +689,7 @@ public class FileDisplayActivity extends FileActivity
updateActionBarTitleAndHomeButton(null);
}
public void refreshListOfFilesFragment(boolean fromSearch) {
public void updateListOfFilesFragment(boolean fromSearch) {
OCFileListFragment fileListFragment = getListOfFilesFragment();
if (fileListFragment != null) {
fileListFragment.listDirectory(MainApp.isOnlyOnDevice(), fromSearch);
@@ -765,7 +769,7 @@ public class FileDisplayActivity extends FileActivity
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
inflater.inflate(R.menu.activity_file_display, menu);
menu.findItem(R.id.action_create_dir).setVisible(false);
menu.findItem(R.id.action_select_all).setVisible(false);
@@ -937,7 +941,6 @@ public class FileDisplayActivity extends FileActivity
/**
* Called, when the user selected something for uploading
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
@@ -1075,10 +1078,7 @@ public class FileDisplayActivity extends FileActivity
ArrayList<Parcelable> streamsToUpload = new ArrayList<>();
//getClipData is only supported on api level 16+, Jelly Bean
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN &&
contentIntent.getClipData() != null &&
contentIntent.getClipData().getItemCount() > 0) {
if (contentIntent.getClipData() != null && contentIntent.getClipData().getItemCount() > 0) {
for (int i = 0; i < contentIntent.getClipData().getItemCount(); i++) {
streamsToUpload.add(contentIntent.getClipData().getItemAt(i).getUri());
@@ -1162,13 +1162,6 @@ public class FileDisplayActivity extends FileActivity
} else {
// all closed
//if PreviewImageActivity called this activity and mDualPane==false then calls PreviewImageActivity again
if (ACTION_DETAILS.equalsIgnoreCase(getIntent().getAction()) && !mDualPane) {
getIntent().setAction(null);
getIntent().putExtra(EXTRA_FILE, (OCFile) null);
startImagePreview(getFile(), false);
}
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (mDualPane || getSecondFragment() == null) {
OCFile currentDir = getCurrentDir();
@@ -1210,6 +1203,7 @@ public class FileDisplayActivity extends FileActivity
protected void onResume() {
Log_OC.v(TAG, "onResume() start");
super.onResume();
syncAndUpdateFolder(false);
OCFile startFile = null;
if (getIntent() != null && getIntent().getParcelableExtra(EXTRA_FILE) != null) {
@@ -1222,7 +1216,7 @@ public class FileDisplayActivity extends FileActivity
searchView.setQuery(searchQuery, false);
} else if (getListOfFilesFragment() != null && !getListOfFilesFragment().isSearchFragment()
&& startFile == null) {
refreshListOfFilesFragment(false);
updateListOfFilesFragment(false);
} else {
getListOfFilesFragment().listDirectory(startFile, false, false);
updateActionBarTitleAndHomeButton(startFile);
@@ -1470,7 +1464,7 @@ public class FileDisplayActivity extends FileActivity
String linkedToRemotePath =
intent.getStringExtra(FileUploader.EXTRA_LINKED_TO_PATH);
if (linkedToRemotePath == null || isAscendant(linkedToRemotePath)) {
refreshListOfFilesFragment(false);
updateListOfFilesFragment(false);
}
}
@@ -1554,7 +1548,7 @@ public class FileDisplayActivity extends FileActivity
if (sameAccount && isDescendant) {
String linkedToRemotePath = intent.getStringExtra(FileDownloader.EXTRA_LINKED_TO_PATH);
if (linkedToRemotePath == null || isAscendant(linkedToRemotePath)) {
refreshListOfFilesFragment(false);
updateListOfFilesFragment(false);
}
refreshSecondFragment(
intent.getAction(),
@@ -1825,7 +1819,7 @@ public class FileDisplayActivity extends FileActivity
}
OCFile parentFile = getStorageManager().getFileById(removedFile.getParentId());
if (parentFile != null && parentFile.equals(getCurrentDir())) {
refreshListOfFilesFragment(false);
updateListOfFilesFragment(false);
}
supportInvalidateOptionsMenu();
} else {
@@ -1881,7 +1875,7 @@ public class FileDisplayActivity extends FileActivity
private void onMoveFileOperationFinish(MoveFileOperation operation,
RemoteOperationResult result) {
if (result.isSuccess()) {
refreshListOfFilesFragment(false);
syncAndUpdateFolder(true);
} else {
try {
DisplayUtils.showSnackMessage(
@@ -1919,7 +1913,7 @@ public class FileDisplayActivity extends FileActivity
fileDetailFragment.getFileDetailSharingFragment().refreshPublicShareFromDB();
fileDetailFragment.getFileDetailSharingFragment().onUpdateShareInformation(result, getFile());
}
refreshListOfFilesFragment(false);
updateListOfFilesFragment(false);
} else {
// Detect Failure (403) --> maybe needs password
String password = operation.getPassword();
@@ -1972,7 +1966,7 @@ public class FileDisplayActivity extends FileActivity
if (result.isSuccess()) {
updateFileFromDB();
refreshListOfFilesFragment(false);
updateListOfFilesFragment(false);
} else if (fileDetailFragment != null && fileDetailFragment.getView() != null) {
String errorResponse;
@@ -2022,7 +2016,7 @@ public class FileDisplayActivity extends FileActivity
*/
private void onCopyFileOperationFinish(CopyFileOperation operation, RemoteOperationResult result) {
if (result.isSuccess()) {
refreshListOfFilesFragment(false);
updateListOfFilesFragment(false);
} else {
try {
DisplayUtils.showSnackMessage(
@@ -2076,7 +2070,7 @@ public class FileDisplayActivity extends FileActivity
}
if (getStorageManager().getFileById(renamedFile.getParentId()).equals(getCurrentDir())) {
refreshListOfFilesFragment(false);
updateListOfFilesFragment(false);
}
} else {
@@ -2136,7 +2130,7 @@ public class FileDisplayActivity extends FileActivity
*/
@Override
public void onTransferStateChanged(OCFile file, boolean downloading, boolean uploading) {
refreshListOfFilesFragment(false);
updateListOfFilesFragment(false);
FileFragment details = getSecondFragment();
if (details instanceof FileDetailFragment &&
file.equals(details.getFile())) {
@@ -2447,15 +2441,15 @@ public class FileDisplayActivity extends FileActivity
@Override
public void onRefresh(boolean ignoreETag) {
refreshList(ignoreETag);
syncAndUpdateFolder(ignoreETag);
}
@Override
public void onRefresh() {
refreshList(true);
syncAndUpdateFolder(true);
}
private void refreshList(boolean ignoreETag) {
private void syncAndUpdateFolder(boolean ignoreETag) {
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (listOfFiles != null && !listOfFiles.isSearchFragment()) {
OCFile folder = listOfFiles.getCurrentFile();
@@ -2545,8 +2539,8 @@ public class FileDisplayActivity extends FileActivity
@Override
public void onStart() {
super.onStart();
final Account account = getAccount();
if (account != null) {
Optional<User> optionalUser = getUser();
if (optionalUser.isPresent()) {
/// Check whether the 'main' OCFile handled by the Activity is contained in the
// current Account
OCFile file = getFile();
@@ -2572,10 +2566,12 @@ public class FileDisplayActivity extends FileActivity
}
setFile(file);
setAccountInDrawer(account);
User user = optionalUser.get();
setAccountInDrawer(user);
setupDrawer();
final boolean accountChanged = !account.equals(mLastDisplayedAccount);
final String lastDisplayedAccountName = mLastDisplayedAccount != null ? mLastDisplayedAccount.name : null;
final boolean accountChanged = !user.getAccountName().equals(lastDisplayedAccountName);
if (accountChanged) {
Log_OC.d(TAG, "Initializing Fragments in onAccountChanged..");
initFragmentsWithFile();
@@ -2587,7 +2583,11 @@ public class FileDisplayActivity extends FileActivity
updateActionBarTitleAndHomeButton(file.isFolder() ? null : file);
}
}
mLastDisplayedAccount = account;
if (optionalUser.isPresent()) {
mLastDisplayedAccount = optionalUser.get().toPlatformAccount();
} else {
mLastDisplayedAccount = null;
}
EventBus.getDefault().post(new TokenPushEvent());
checkForNewDevVersionNecessary(findViewById(R.id.root_layout), getApplicationContext());
@@ -2621,7 +2621,8 @@ public class FileDisplayActivity extends FileActivity
return;
}
setAccount(newAccount);
setAccount(newAccount, false);
updateAccountList();
}
String fileId = String.valueOf(intent.getStringExtra(KEY_FILE_ID));
@@ -25,6 +25,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.ColorStateList;
import android.content.res.Resources.NotFoundException;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
@@ -37,10 +38,10 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.preferences.AppPreferences;
import com.google.android.material.button.MaterialButton;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.operations.RemoteOperation;
@@ -90,8 +91,8 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
private boolean mSearchOnlyFolders;
private boolean mDoNotEnterEncryptedFolder;
protected Button mCancelBtn;
protected Button mChooseBtn;
protected MaterialButton mCancelBtn;
protected MaterialButton mChooseBtn;
private String caption;
@Inject AppPreferences preferences;
@@ -292,11 +293,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
menu.findItem(R.id.action_switch_view).setVisible(false);
menu.findItem(R.id.action_sync_account).setVisible(false);
menu.findItem(R.id.action_select_all).setVisible(false);
// menu.findItem(R.id.action_sort).setVisible(false);
inflater.inflate(R.menu.activity_folder_picker, menu);
return true;
}
@@ -405,7 +402,8 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
mChooseBtn = findViewById(R.id.folder_picker_btn_choose);
if (mChooseBtn != null) {
mChooseBtn.getBackground().setColorFilter(ThemeUtils.primaryColor(this, true), PorterDuff.Mode.SRC_ATOP);
mChooseBtn.setBackgroundTintMode(PorterDuff.Mode.SRC_ATOP);
mChooseBtn.setBackgroundTintList(ColorStateList.valueOf(ThemeUtils.primaryColor(this, true)));
mChooseBtn.setOnClickListener(this);
}
@@ -38,6 +38,7 @@ import android.view.MenuItem;
import com.evernote.android.job.JobRequest;
import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.onboarding.FirstRunActivity;
import com.owncloud.android.MainApp;
@@ -126,15 +127,12 @@ public class ManageAccountsActivity extends FileActivity implements AccountListA
Account[] accountList = AccountManager.get(this).getAccountsByType(MainApp.getAccountType(this));
originalAccounts = DisplayUtils.toAccountNameSet(Arrays.asList(accountList));
Account currentAccount = getUserAccountManager().getCurrentAccount();
Account currentAccount = getAccount();
if (currentAccount != null) {
originalCurrentAccount = currentAccount.name;
}
setAccount(currentAccount);
onAccountSet();
arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
multipleAccountsSupported = getResources().getBoolean(R.bool.multiaccount_support);
@@ -201,11 +199,11 @@ public class ManageAccountsActivity extends FileActivity implements AccountListA
* @return true if account list has changed, false if not
*/
private boolean hasCurrentAccountChanged() {
Account account = getUserAccountManager().getCurrentAccount();
if (account == null) {
User account = getUserAccountManager().getUser();
if (account.isAnonymous()) {
return true;
} else {
return !account.name.equals(originalCurrentAccount);
return !account.getAccountName().equals(originalCurrentAccount);
}
}
@@ -323,7 +321,8 @@ public class ManageAccountsActivity extends FileActivity implements AccountListA
}
}
if (getUserAccountManager().getCurrentAccount() == null) {
User user = getUserAccountManager().getUser();
if (user.isAnonymous()) {
String accountName = "";
Account[] accounts = AccountManager.get(this).getAccountsByType(MainApp.getAccountType(this));
if (accounts.length != 0) {
@@ -24,9 +24,6 @@
package com.owncloud.android.ui.activity;
import android.accounts.Account;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.os.Bundle;
@@ -39,13 +36,14 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import com.google.android.material.snackbar.Snackbar;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.network.ClientFactory;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.jobs.NotificationJob;
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.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
@@ -58,9 +56,10 @@ import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.PushUtils;
import com.owncloud.android.utils.ThemeUtils;
import java.io.IOException;
import java.util.List;
import javax.inject.Inject;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
@@ -109,7 +108,9 @@ public class NotificationsActivity extends FileActivity implements Notifications
private NotificationListAdapter adapter;
private Snackbar snackbar;
private OwnCloudClient client;
private Account currentAccount;
private Optional<User> optionalUser;
@Inject ClientFactory clientFactory;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -119,16 +120,18 @@ public class NotificationsActivity extends FileActivity implements Notifications
setContentView(R.layout.notifications_layout);
unbinder = ButterKnife.bind(this);
currentAccount = getAccount();
optionalUser = getUser();
// use account from intent (opened via android notification can have a different account than current one)
if (getIntent() != null && getIntent().getExtras() != null) {
String account = getIntent().getExtras().getString(NotificationJob.KEY_NOTIFICATION_ACCOUNT);
if (account != null && (currentAccount == null || !account.equalsIgnoreCase(currentAccount.name))) {
accountManager.setCurrentOwnCloudAccount(account);
setAccount(getUserAccountManager().getCurrentAccount());
currentAccount = getAccount();
String accountName = getIntent().getExtras().getString(NotificationJob.KEY_NOTIFICATION_ACCOUNT);
if(accountName != null && optionalUser.isPresent()) {
User user = optionalUser.get();
if (user.getAccountName().equalsIgnoreCase(accountName)) {
accountManager.setCurrentOwnCloudAccount(accountName);
setUser(getUserAccountManager().getUser());
optionalUser = getUser();
}
}
}
@@ -142,7 +145,7 @@ public class NotificationsActivity extends FileActivity implements Notifications
setupDrawer(R.id.nav_notifications);
ThemeUtils.setColoredTitle(getSupportActionBar(), getString(R.string.drawer_item_notifications), this);
if (currentAccount == null) {
if (!optionalUser.isPresent()) {
// show error
runOnUiThread(() -> setEmptyContent(noResultsHeadline, getString(R.string.account_not_found)));
return;
@@ -156,7 +159,6 @@ public class NotificationsActivity extends FileActivity implements Notifications
swipeEmptyListRefreshLayout.setOnRefreshListener(() -> {
setLoadingMessage();
fetchAndSetData();
});
setupPushWarning();
@@ -175,16 +177,16 @@ public class NotificationsActivity extends FileActivity implements Notifications
snackbar = Snackbar.make(emptyContentContainer, R.string.push_notifications_not_implemented,
Snackbar.LENGTH_INDEFINITE);
} else {
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
boolean usesOldLogin = arbitraryDataProvider.getBooleanValue(currentAccount.name,
final ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
final String accountName = optionalUser.isPresent() ? optionalUser.get().getAccountName() : "";
final boolean usesOldLogin = arbitraryDataProvider.getBooleanValue(accountName,
UserAccountManager.ACCOUNT_USES_STANDARD_PASSWORD);
if (usesOldLogin) {
snackbar = Snackbar.make(emptyContentContainer, R.string.push_notifications_old_login,
Snackbar.LENGTH_INDEFINITE);
} else {
String pushValue = arbitraryDataProvider.getValue(currentAccount.name, PushUtils.KEY_PUSH);
String pushValue = arbitraryDataProvider.getValue(accountName, PushUtils.KEY_PUSH);
if (pushValue == null || pushValue.isEmpty()) {
snackbar = Snackbar.make(emptyContentContainer, R.string.push_notifications_temp_error,
@@ -250,13 +252,11 @@ public class NotificationsActivity extends FileActivity implements Notifications
private void fetchAndSetData() {
Thread t = new Thread(() -> {
if (client == null) {
if (client == null && optionalUser.isPresent()) {
try {
OwnCloudAccount ocAccount = new OwnCloudAccount(currentAccount, this);
client = OwnCloudClientManagerFactory.getDefaultSingleton().getClientFor(ocAccount, this);
client.setOwnCloudVersion(accountManager.getServerVersion(currentAccount));
} catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException |
IOException | OperationCanceledException | AuthenticatorException e) {
User user = optionalUser.get();
client = clientFactory.create(user);
} catch (ClientFactory.CreationException e) {
Log_OC.e(TAG, "Error initializing client", e);
}
}
@@ -303,7 +303,7 @@ public class NotificationsActivity extends FileActivity implements Notifications
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.notifications_actions_menu, menu);
getMenuInflater().inflate(R.menu.activity_notifications, menu);
return true;
}
@@ -23,8 +23,8 @@
package com.owncloud.android.ui.activity;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
@@ -97,7 +97,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
int elementColor = ThemeUtils.elementColor(this);
mBCancel = findViewById(R.id.cancel);
mBCancel.getBackground().setColorFilter(elementColor, PorterDuff.Mode.SRC_ATOP);
mBCancel.setBackgroundColor(ThemeUtils.primaryColor(this));
mPassCodeHdr = findViewById(R.id.header);
mPassCodeHdrExplanation = findViewById(R.id.explanation);
@@ -240,7 +240,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
if (ACTION_CHECK.equals(getIntent().getAction())) {
if (checkPassCode()) {
/// pass code accepted in request, user is allowed to access the app
AppPreferencesImpl.fromContext(this).setLockTimestamp(System.currentTimeMillis());
AppPreferencesImpl.fromContext(this).setLockTimestamp(SystemClock.elapsedRealtime());
hideSoftKeyboard();
finish();
@@ -250,7 +250,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
} else if (ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) {
if (checkPassCode()) {
AppPreferencesImpl.fromContext(this).setLockTimestamp(System.currentTimeMillis());
AppPreferencesImpl.fromContext(this).setLockTimestamp(SystemClock.elapsedRealtime());
Intent resultIntent = new Intent();
resultIntent.putExtra(KEY_CHECK_RESULT, true);
setResult(RESULT_OK, resultIntent);
@@ -34,6 +34,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.ColorStateList;
import android.content.res.Resources.NotFoundException;
import android.graphics.Color;
import android.graphics.PorterDuff;
@@ -63,6 +64,7 @@ import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import com.google.android.material.button.MaterialButton;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.preferences.AppPreferences;
import com.owncloud.android.MainApp;
@@ -206,8 +208,6 @@ public class ReceiveExternalFilesActivity extends FileActivity
Log_OC.i(TAG, "No ownCloud account is available");
DialogNoAccount dialog = new DialogNoAccount();
dialog.show(getSupportFragmentManager(), null);
} else if (!savedAccount) {
setAccount(accounts[0]);
}
if (!somethingToUpload()) {
@@ -400,6 +400,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
final EditText userInput = view.findViewById(R.id.user_input);
setFilename(userInput, selectPos);
userInput.setHighlightColor(ThemeUtils.primaryColor(getContext()));
userInput.requestFocus();
final Spinner spinner = view.findViewById(R.id.file_type);
@@ -677,7 +678,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
// there is no need for checking for is there more then one
// account at this point
// since account setup can set only one account at time
setAccount(accounts[0]);
setAccount(accounts[0], false);
populateDirectoryList();
}
}
@@ -748,10 +749,10 @@ public class ReceiveExternalFilesActivity extends FileActivity
mListView.setAdapter(sa);
}
Button btnChooseFolder = findViewById(R.id.uploader_choose_folder);
btnChooseFolder.setOnClickListener(this);
btnChooseFolder.getBackground().setColorFilter(ThemeUtils.primaryColor(getAccount(), true, this),
PorterDuff.Mode.SRC_ATOP);
MaterialButton btnChooseFolder = findViewById(R.id.uploader_choose_folder);
btnChooseFolder.setBackgroundTintMode(PorterDuff.Mode.SRC_ATOP);
btnChooseFolder.setBackgroundTintList(ColorStateList.valueOf(ThemeUtils.primaryColor(this, true)));
btnChooseFolder.setOnClickListener(this);
btnChooseFolder.setTextColor(ThemeUtils.fontColor(this));
if (mFile.canWrite()) {
@@ -1015,7 +1016,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.receive_file_menu, menu);
inflater.inflate(R.menu.activity_receive_external_files, menu);
if (!isHaveMultipleAccount()) {
MenuItem switchAccountMenu = menu.findItem(R.id.action_switch_account);
@@ -25,6 +25,7 @@ import android.app.KeyguardManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.SystemClock;
import android.widget.Toast;
import com.nextcloud.client.preferences.AppPreferencesImpl;
@@ -53,7 +54,7 @@ public class RequestCredentialsActivity extends Activity {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS) {
if (resultCode == Activity.RESULT_OK) {
AppPreferencesImpl.fromContext(this).setLockTimestamp(System.currentTimeMillis());
AppPreferencesImpl.fromContext(this).setLockTimestamp(SystemClock.elapsedRealtime());
finishWithResult(KEY_CHECK_RESULT_TRUE);
} else if (resultCode == Activity.RESULT_CANCELED) {
finishWithResult(KEY_CHECK_RESULT_CANCEL);
@@ -49,6 +49,7 @@ import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.google.android.material.snackbar.Snackbar;
import com.nextcloud.client.account.CurrentAccountProvider;
import com.nextcloud.client.account.User;
import com.nextcloud.client.network.ClientFactory;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
@@ -155,7 +156,8 @@ public class RichDocumentsWebView extends ExternalSiteWebView {
break;
}
Glide.with(this).using(new CustomGlideStreamLoader(currentAccountProvider)).load(template.getThumbnailLink())
Glide.with(this).using(new CustomGlideStreamLoader(currentAccountProvider, clientFactory))
.load(template.getThumbnailLink())
.placeholder(placeholder)
.error(placeholder)
.into(thumbnail);
@@ -250,7 +252,7 @@ public class RichDocumentsWebView extends ExternalSiteWebView {
}
if ("image/png".equalsIgnoreCase(file.getMimeType())) {
thumbnailView.setBackgroundColor(getResources().getColor(R.color.background_color));
thumbnailView.setBackgroundColor(getResources().getColor(R.color.bg_default));
}
} else {
thumbnailView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(file.getMimeType(), file.getFileName(),
@@ -314,9 +316,9 @@ public class RichDocumentsWebView extends ExternalSiteWebView {
OCFile file = data.getParcelableExtra(FolderPickerActivity.EXTRA_FILES);
new Thread(() -> {
Account account = currentAccountProvider.getCurrentAccount();
User user = currentAccountProvider.getUser();
RichDocumentsCreateAssetOperation operation = new RichDocumentsCreateAssetOperation(file.getRemotePath());
RemoteOperationResult result = operation.execute(account, this);
RemoteOperationResult result = operation.execute(user.toPlatformAccount(), this);
if (result.isSuccess()) {
String asset = (String) result.getSingleData();
@@ -25,7 +25,6 @@
*/
package com.owncloud.android.ui.activity;
import android.accounts.Account;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -39,7 +38,6 @@ import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
@@ -53,12 +51,15 @@ import android.view.ViewGroup;
import android.view.Window;
import android.webkit.URLUtil;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.etm.EtmActivity;
import com.nextcloud.client.logger.ui.LogsActivity;
import com.nextcloud.client.network.ClientFactory;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.nextcloud.client.preferences.DarkMode;
import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
@@ -70,8 +71,6 @@ import com.owncloud.android.datastorage.DataStorageProvider;
import com.owncloud.android.datastorage.StoragePoint;
import com.owncloud.android.lib.common.ExternalLink;
import com.owncloud.android.lib.common.ExternalLinkType;
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.asynctasks.LoadingVersionNumberTask;
import com.owncloud.android.utils.DeviceCredentialUtils;
@@ -81,6 +80,7 @@ import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.ThemeUtils;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
@@ -96,7 +96,7 @@ import androidx.core.content.res.ResourcesCompat;
*
* It proxies the necessary calls via {@link androidx.appcompat.app.AppCompatDelegate} to be used with AppCompat.
*/
public class SettingsActivity extends PreferenceActivity
public class SettingsActivity extends ThemedPreferenceActivity
implements StorageMigration.StorageMigrationProgressListener, LoadingVersionNumberTask.VersionDevInterface,
Injectable {
@@ -108,6 +108,7 @@ public class SettingsActivity extends PreferenceActivity
public static final String LOCK_PASSCODE = "passcode";
public static final String LOCK_DEVICE_CREDENTIALS = "device_credentials";
public final static String PREFERENCE_USE_FINGERPRINT = "use_fingerprint";
public static final String PREFERENCE_SHOW_MEDIA_SCAN_NOTIFICATIONS = "show_media_scan_notifications";
@@ -131,10 +132,11 @@ public class SettingsActivity extends PreferenceActivity
private String storagePath;
private String pendingLock;
private Account account;
private User user;
@Inject ArbitraryDataProvider arbitraryDataProvider;
@Inject AppPreferences preferences;
@Inject UserAccountManager accountManager;
@Inject ClientFactory clientFactory;
@SuppressWarnings("deprecation")
@Override
@@ -157,7 +159,7 @@ public class SettingsActivity extends PreferenceActivity
String appVersion = getAppVersion();
PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference("preference_screen");
account = accountManager.getCurrentAccount();
user = accountManager.getUser();
// retrieve user's base uri
setupBaseUri();
@@ -409,7 +411,7 @@ public class SettingsActivity extends PreferenceActivity
}
private void setupE2EMnemonicPreference(PreferenceCategory preferenceCategoryMore) {
String mnemonic = arbitraryDataProvider.getValue(account.name, EncryptionUtils.MNEMONIC);
String mnemonic = arbitraryDataProvider.getValue(user.getAccountName(), EncryptionUtils.MNEMONIC);
Preference pMnemonic = findPreference("mnemonic");
if (pMnemonic != null) {
@@ -604,11 +606,11 @@ public class SettingsActivity extends PreferenceActivity
final SwitchPreference pUploadOnWifiCheckbox = (SwitchPreference) findPreference("synced_folder_on_wifi");
pUploadOnWifiCheckbox.setChecked(
arbitraryDataProvider.getBooleanValue(account, SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI));
arbitraryDataProvider.getBooleanValue(user.toPlatformAccount(), SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI));
pUploadOnWifiCheckbox.setOnPreferenceClickListener(preference -> {
arbitraryDataProvider.storeOrUpdateKeyValue(account.name, SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI,
String.valueOf(pUploadOnWifiCheckbox.isChecked()));
arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(), SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI,
String.valueOf(pUploadOnWifiCheckbox.isChecked()));
return true;
});
@@ -692,6 +694,34 @@ public class SettingsActivity extends PreferenceActivity
}
loadStoragePath();
ListPreference themePref = (ListPreference) findPreference("darkTheme");
List<String> themeEntries = new ArrayList<>(3);
themeEntries.add(getString(R.string.prefs_value_theme_light));
themeEntries.add(getString(R.string.prefs_value_theme_dark));
themeEntries.add(getString(R.string.prefs_value_theme_system));
List<String> themeValues = new ArrayList<>(3);
themeValues.add(DarkMode.LIGHT.name());
themeValues.add(DarkMode.DARK.name());
themeValues.add(DarkMode.SYSTEM.name());
themePref.setEntries(themeEntries.toArray(new String[0]));
themePref.setEntryValues(themeValues.toArray(new String[0]));
if (TextUtils.isEmpty(themePref.getEntry())) {
themePref.setValue(DarkMode.LIGHT.name());
themePref.setSummary(TextUtils.isEmpty(themePref.getEntry()) ? DarkMode.LIGHT.name() : themePref.getEntry());
}
themePref.setOnPreferenceChangeListener((preference, newValue) -> {
DarkMode mode = DarkMode.valueOf((String) newValue);
preferences.setDarkThemeMode(mode);
MainApp.setAppTheme(mode);
return true;
});
}
private String getAppVersion() {
@@ -727,7 +757,7 @@ public class SettingsActivity extends PreferenceActivity
Window window = getWindow();
if (window != null) {
window.getDecorView().setBackgroundDrawable(new ColorDrawable(ResourcesCompat
.getColor(getResources(), R.color.background_color, null)));
.getColor(getResources(), R.color.bg_default, null)));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setStatusBarColor(ThemeUtils.primaryColor(this));
@@ -755,7 +785,7 @@ public class SettingsActivity extends PreferenceActivity
davDroidLoginIntent.setData(Uri.parse(serverBaseUri.toString() + AuthenticatorActivity.WEB_LOGIN));
davDroidLoginIntent.putExtra("davPath", DAV_PATH);
}
davDroidLoginIntent.putExtra("username", UserAccountManager.getUsername(account));
davDroidLoginIntent.putExtra("username", UserAccountManager.getUsername(user.toPlatformAccount()));
startActivityForResult(davDroidLoginIntent, ACTION_REQUEST_CODE_DAVDROID_SETUP);
} else {
@@ -780,9 +810,7 @@ public class SettingsActivity extends PreferenceActivity
// retrieve and set user's base URI
Thread t = new Thread(() -> {
try {
OwnCloudAccount ocAccount = new OwnCloudAccount(account, MainApp.getAppContext());
serverBaseUri = OwnCloudClientManagerFactory.getDefaultSingleton().getClientFor(ocAccount,
getApplicationContext()).getBaseUri();
serverBaseUri = clientFactory.create(user).getBaseUri();
} catch (Exception e) {
Log_OC.e(TAG, "Error retrieving user's base URI", e);
}
@@ -848,7 +876,7 @@ public class SettingsActivity extends PreferenceActivity
RequestCredentialsActivity.KEY_CHECK_RESULT_TRUE) {
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
String mnemonic = arbitraryDataProvider.getValue(account.name, EncryptionUtils.MNEMONIC);
String mnemonic = arbitraryDataProvider.getValue(user.getAccountName(), EncryptionUtils.MNEMONIC);
int accentColor = ThemeUtils.primaryAccentColor(this);
@@ -1008,5 +1036,4 @@ public class SettingsActivity extends PreferenceActivity
public void returnVersion(Integer latestVersion) {
FileActivity.showDevSnackbar(this, latestVersion, true);
}
}
@@ -30,7 +30,6 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -144,7 +143,8 @@ public class SsoGrantPermissionActivity extends BaseActivity {
int start = text.indexOf(textBlock);
int end = start + textBlock.length();
ssb.setSpan(new StyleSpan(Typeface.BOLD), start, end, 0);
ssb.setSpan(new ForegroundColorSpan(Color.BLACK), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
ssb.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.text_color)), start, end,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return ssb;
@@ -21,7 +21,6 @@
package com.owncloud.android.ui.activity;
import android.accounts.Account;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.NotificationManager;
@@ -38,12 +37,18 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.google.android.material.button.MaterialButton;
import com.nextcloud.client.account.User;
import com.nextcloud.client.core.Clock;
import com.nextcloud.client.device.PowerManagementService;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
@@ -86,6 +91,9 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import static android.provider.Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS;
import static com.owncloud.android.datamodel.SyncedFolderDisplayItem.UNPERSISTED_ID;
@@ -101,18 +109,37 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
private static final String SYNCED_FOLDER_PREFERENCES_DIALOG_TAG = "SYNCED_FOLDER_PREFERENCES_DIALOG";
private static final String TAG = SyncedFoldersActivity.class.getSimpleName();
private RecyclerView mRecyclerView;
private SyncedFolderAdapter mAdapter;
private LinearLayout mProgress;
private TextView mEmpty;
private SyncedFolderProvider mSyncedFolderProvider;
private SyncedFolderPreferencesDialogFragment mSyncedFolderPreferencesDialogFragment;
@BindView(R.id.empty_list_view)
public LinearLayout emptyContentContainer;
@BindView(R.id.empty_list_icon)
public ImageView emptyContentIcon;
@BindView(R.id.empty_list_progress)
public ProgressBar emptyContentProgressBar;
@BindView(R.id.empty_list_view_headline)
public TextView emptyContentHeadline;
@BindView(R.id.empty_list_view_text)
public TextView emptyContentMessage;
@BindView(R.id.empty_list_view_action)
public MaterialButton emptyContentActionButton;
@BindView(android.R.id.list)
public RecyclerView mRecyclerView;
private SyncedFolderAdapter adapter;
private SyncedFolderProvider syncedFolderProvider;
private SyncedFolderPreferencesDialogFragment syncedFolderPreferencesDialogFragment;
private boolean showSidebar = true;
private String path;
private int type;
@Inject AppPreferences preferences;
@Inject PowerManagementService powerManagementService;
@Inject Clock clock;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -123,16 +150,17 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
}
setContentView(R.layout.synced_folders_layout);
ButterKnife.bind(this);
String account;
Account currentAccount;
if (getIntent() != null && getIntent().getExtras() != null) {
account = getIntent().getExtras().getString(NotificationJob.KEY_NOTIFICATION_ACCOUNT);
currentAccount = getAccount();
if (account != null && currentAccount != null && !account.equalsIgnoreCase(currentAccount.name)) {
accountManager.setCurrentOwnCloudAccount(account);
setAccount(getUserAccountManager().getCurrentAccount());
final String accountName = getIntent().getExtras().getString(NotificationJob.KEY_NOTIFICATION_ACCOUNT);
Optional<User> optionalUser = getUser();
if (optionalUser.isPresent() && accountName != null) {
User user = optionalUser.get();
if (!accountName.equalsIgnoreCase(user.getAccountName())) {
accountManager.setCurrentOwnCloudAccount(accountName);
setUser(getUserAccountManager().getUser());
}
}
path = getIntent().getStringExtra(MediaFoldersDetectionJob.KEY_MEDIA_FOLDER_PATH);
@@ -175,7 +203,7 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.synced_folders_menu, menu);
inflater.inflate(R.menu.activity_synced_folders, menu);
if (powerManagementService.isPowerSavingExclusionAvailable()) {
MenuItem item = menu.findItem(R.id.action_disable_power_save_check);
@@ -216,50 +244,56 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
* sets up the UI elements and loads all media/synced folders.
*/
private void setupContent() {
mRecyclerView = findViewById(android.R.id.list);
mProgress = findViewById(android.R.id.progress);
mEmpty = findViewById(android.R.id.empty);
final int gridWidth = getResources().getInteger(R.integer.media_grid_width);
boolean lightVersion = getResources().getBoolean(R.bool.syncedFolder_light);
mAdapter = new SyncedFolderAdapter(this, gridWidth, this, lightVersion);
mSyncedFolderProvider = new SyncedFolderProvider(getContentResolver(), preferences);
adapter = new SyncedFolderAdapter(this, clock, gridWidth, this, lightVersion);
syncedFolderProvider = new SyncedFolderProvider(getContentResolver(), preferences, clock);
emptyContentIcon.setImageResource(R.drawable.nav_synced_folders);
emptyContentActionButton.setBackgroundColor(ThemeUtils.primaryColor(this));
emptyContentActionButton.setTextColor(ThemeUtils.fontColor(this));
final GridLayoutManager lm = new GridLayoutManager(this, gridWidth);
mAdapter.setLayoutManager(lm);
adapter.setLayoutManager(lm);
int spacing = getResources().getDimensionPixelSize(R.dimen.media_grid_spacing);
mRecyclerView.addItemDecoration(new MediaGridItemDecoration(spacing));
mRecyclerView.setLayoutManager(lm);
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setAdapter(adapter);
load(gridWidth * 2, false);
}
@OnClick(R.id.empty_list_view_action)
public void showHiddenItems() {
if (adapter.getSectionCount() == 0 && adapter.getUnfilteredSectionCount() > adapter.getSectionCount()) {
adapter.toggleHiddenItemsVisibility();
emptyContentContainer.setVisibility(View.GONE);
mRecyclerView.setVisibility(View.VISIBLE);
}
}
/**
* loads all media/synced folders, adds them to the recycler view adapter and shows the list.
*
* @param perFolderMediaItemLimit the amount of media items to be loaded/shown per media folder
*/
private void load(final int perFolderMediaItemLimit, boolean force) {
if (mAdapter.getItemCount() > 0 && !force) {
if (adapter.getItemCount() > 0 && !force) {
return;
}
setListShown(false);
showLoadingContent();
final List<MediaFolder> mediaFolders = MediaProvider.getImageFolders(getContentResolver(),
perFolderMediaItemLimit, this, false);
mediaFolders.addAll(MediaProvider.getVideoFolders(getContentResolver(), perFolderMediaItemLimit,
this, false));
List<SyncedFolder> syncedFolderArrayList = mSyncedFolderProvider.getSyncedFolders();
List<SyncedFolder> syncedFolderArrayList = syncedFolderProvider.getSyncedFolders();
List<SyncedFolder> currentAccountSyncedFoldersList = new ArrayList<>();
Account currentAccount = getUserAccountManager().getCurrentAccount();
User user = getUserAccountManager().getUser();
for (SyncedFolder syncedFolder : syncedFolderArrayList) {
if (currentAccount != null && syncedFolder.getAccount().equals(currentAccount.name)) {
if (syncedFolder.getAccount().equals(user.getAccountName())) {
// delete non-existing & disabled synced folders
if (!new File(syncedFolder.getLocalPath()).exists() && !syncedFolder.isEnabled()) {
mSyncedFolderProvider.deleteSyncedFolder(syncedFolder.getId());
syncedFolderProvider.deleteSyncedFolder(syncedFolder.getId());
} else {
currentAccountSyncedFoldersList.add(syncedFolder);
}
@@ -269,14 +303,14 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
List<SyncedFolderDisplayItem> syncFolderItems = sortSyncedFolderItems(
mergeFolderData(currentAccountSyncedFoldersList, mediaFolders));
mAdapter.setSyncFolderItems(syncFolderItems);
mAdapter.notifyDataSetChanged();
setListShown(true);
adapter.setSyncFolderItems(syncFolderItems);
adapter.notifyDataSetChanged();
showList();
if (!TextUtils.isEmpty(path)) {
int section = mAdapter.getSectionByLocalPathAndType(path, type);
int section = adapter.getSectionByLocalPathAndType(path, type);
if (section >= 0) {
onSyncFolderSettingsClick(section, mAdapter.get(section));
onSyncFolderSettingsClick(section, adapter.get(section));
}
}
}
@@ -380,16 +414,18 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
syncedFolder.getId(),
syncedFolder.getLocalPath(),
syncedFolder.getRemotePath(),
syncedFolder.getWifiOnly(),
syncedFolder.getChargingOnly(),
syncedFolder.getSubfolderByDate(),
syncedFolder.isWifiOnly(),
syncedFolder.isChargingOnly(),
syncedFolder.isSubfolderByDate(),
syncedFolder.getAccount(),
syncedFolder.getUploadAction(),
syncedFolder.isEnabled(),
clock.getCurrentTime(),
filePaths,
localFolder.getName(),
files.length,
syncedFolder.getType());
syncedFolder.getType(),
syncedFolder.isHidden());
}
/**
@@ -405,16 +441,18 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
syncedFolder.getId(),
syncedFolder.getLocalPath(),
syncedFolder.getRemotePath(),
syncedFolder.getWifiOnly(),
syncedFolder.getChargingOnly(),
syncedFolder.getSubfolderByDate(),
syncedFolder.isWifiOnly(),
syncedFolder.isChargingOnly(),
syncedFolder.isSubfolderByDate(),
syncedFolder.getAccount(),
syncedFolder.getUploadAction(),
syncedFolder.isEnabled(),
clock.getCurrentTime(),
mediaFolder.filePaths,
mediaFolder.folderName,
mediaFolder.numberOfFiles,
mediaFolder.type);
mediaFolder.type,
syncedFolder.isHidden());
}
/**
@@ -432,13 +470,15 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
true,
false,
false,
getAccount().name,
getAccount().name,
FileUploader.LOCAL_BEHAVIOUR_FORGET,
false,
clock.getCurrentTime(),
mediaFolder.filePaths,
mediaFolder.folderName,
mediaFolder.numberOfFiles,
mediaFolder.type);
mediaFolder.type,
false);
}
private File[] getFileList(File localFolder) {
@@ -484,15 +524,35 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
}
/**
* show/hide recycler view list or the empty message / progress info.
*
* @param shown flag if list should be shown
* show recycler view list or the empty message info (in case list is empty).
*/
private void setListShown(boolean shown) {
private void showList() {
if (mRecyclerView != null) {
mRecyclerView.setVisibility(shown ? View.VISIBLE : View.GONE);
mProgress.setVisibility(shown ? View.GONE : View.VISIBLE);
mEmpty.setVisibility(shown && mAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
mRecyclerView.setVisibility(View.VISIBLE);
emptyContentProgressBar.setVisibility(View.GONE);
checkAndShowEmptyListContent();
}
}
private void checkAndShowEmptyListContent() {
if (adapter.getSectionCount() == 0 && adapter.getUnfilteredSectionCount() > adapter.getSectionCount()) {
emptyContentContainer.setVisibility(View.VISIBLE);
int hiddenFoldersCount = adapter.getHiddenFolderCount();
showEmptyContent(getString(R.string.drawer_synced_folders),
getResources().getQuantityString(R.plurals.synced_folders_show_hidden_folders,
hiddenFoldersCount,
hiddenFoldersCount),
getResources().getQuantityString(R.plurals.synced_folders_show_hidden_folders,
hiddenFoldersCount,
hiddenFoldersCount));
} else if (adapter.getSectionCount() == 0 && adapter.getUnfilteredSectionCount() == 0) {
emptyContentContainer.setVisibility(View.VISIBLE);
showEmptyContent(getString(R.string.drawer_synced_folders),
getString(R.string.synced_folders_no_results));
} else {
emptyContentContainer.setVisibility(View.GONE);
}
}
@@ -518,8 +578,8 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
Log.d(TAG, "Show custom folder dialog");
SyncedFolderDisplayItem emptyCustomFolder = new SyncedFolderDisplayItem(
SyncedFolder.UNPERSISTED_ID, null, null, true, false,
false, getAccount().name,
FileUploader.LOCAL_BEHAVIOUR_FORGET, false, null, MediaFolderType.CUSTOM);
false, getAccount().name, FileUploader.LOCAL_BEHAVIOUR_FORGET, false,
clock.getCurrentTime(), null, MediaFolderType.CUSTOM, false);
onSyncFolderSettingsClick(0, emptyCustomFolder);
}
@@ -548,14 +608,11 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
@Override
public void onSyncStatusToggleClick(int section, SyncedFolderDisplayItem syncedFolderDisplayItem) {
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(MainApp.getAppContext().
getContentResolver());
if (syncedFolderDisplayItem.getId() > UNPERSISTED_ID) {
mSyncedFolderProvider.updateSyncedFolderEnabled(syncedFolderDisplayItem.getId(),
syncedFolderDisplayItem.isEnabled());
syncedFolderProvider.updateSyncedFolderEnabled(syncedFolderDisplayItem.getId(),
syncedFolderDisplayItem.isEnabled());
} else {
long storedId = mSyncedFolderProvider.storeSyncedFolder(syncedFolderDisplayItem);
long storedId = syncedFolderProvider.storeSyncedFolder(syncedFolderDisplayItem);
if (storedId != -1) {
syncedFolderDisplayItem.setId(storedId);
}
@@ -565,9 +622,6 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
FilesSyncHelper.insertAllDBEntriesForSyncedFolder(syncedFolderDisplayItem);
showBatteryOptimizationInfo();
} else {
String syncedFolderInitiatedKey = "syncedFolderIntitiated_" + syncedFolderDisplayItem.getId();
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey);
}
}
@@ -577,22 +631,72 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
FragmentTransaction ft = fm.beginTransaction();
ft.addToBackStack(null);
mSyncedFolderPreferencesDialogFragment = SyncedFolderPreferencesDialogFragment.newInstance(
syncedFolderPreferencesDialogFragment = SyncedFolderPreferencesDialogFragment.newInstance(
syncedFolderDisplayItem, section);
mSyncedFolderPreferencesDialogFragment.show(ft, SYNCED_FOLDER_PREFERENCES_DIALOG_TAG);
syncedFolderPreferencesDialogFragment.show(ft, SYNCED_FOLDER_PREFERENCES_DIALOG_TAG);
}
@Override
public void onVisibilityToggleClick(int section, SyncedFolderDisplayItem syncedFolder) {
syncedFolder.setHidden(!syncedFolder.isHidden());
saveOrUpdateSyncedFolder(syncedFolder);
adapter.setSyncFolderItem(section, syncedFolder);
checkAndShowEmptyListContent();
}
private void showEmptyContent(String headline, String message) {
showEmptyContent(headline, message, false);
emptyContentActionButton.setVisibility(View.GONE);
}
private void showEmptyContent(String headline, String message, String action) {
showEmptyContent(headline, message, false);
emptyContentActionButton.setText(action);
emptyContentActionButton.setVisibility(View.VISIBLE);
emptyContentMessage.setVisibility(View.GONE);
}
private void showLoadingContent() {
showEmptyContent(
getString(R.string.drawer_synced_folders),
getString(R.string.synced_folders_loading_folders),
true
);
emptyContentActionButton.setVisibility(View.GONE);
}
private void showEmptyContent(String headline, String message, boolean loading) {
if (emptyContentContainer != null) {
emptyContentContainer.setVisibility(View.VISIBLE);
mRecyclerView.setVisibility(View.GONE);
emptyContentHeadline.setText(headline);
emptyContentMessage.setText(message);
emptyContentMessage.setVisibility(View.VISIBLE);
if (loading) {
emptyContentProgressBar.setVisibility(View.VISIBLE);
emptyContentIcon.setVisibility(View.GONE);
} else {
emptyContentProgressBar.setVisibility(View.GONE);
emptyContentIcon.setVisibility(View.VISIBLE);
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == SyncedFolderPreferencesDialogFragment.REQUEST_CODE__SELECT_REMOTE_FOLDER
&& resultCode == RESULT_OK && mSyncedFolderPreferencesDialogFragment != null) {
&& resultCode == RESULT_OK && syncedFolderPreferencesDialogFragment != null) {
OCFile chosenFolder = data.getParcelableExtra(FolderPickerActivity.EXTRA_FOLDER);
mSyncedFolderPreferencesDialogFragment.setRemoteFolderSummary(chosenFolder.getRemotePath());
syncedFolderPreferencesDialogFragment.setRemoteFolderSummary(chosenFolder.getRemotePath());
}
if (requestCode == SyncedFolderPreferencesDialogFragment.REQUEST_CODE__SELECT_LOCAL_FOLDER
&& resultCode == RESULT_OK && mSyncedFolderPreferencesDialogFragment != null) {
&& resultCode == RESULT_OK && syncedFolderPreferencesDialogFragment != null) {
String localPath = data.getStringExtra(UploadFilesActivity.EXTRA_CHOSEN_FILES);
mSyncedFolderPreferencesDialogFragment.setLocalFolderSummary(localPath);
syncedFolderPreferencesDialogFragment.setLocalFolderSummary(localPath);
} else {
super.onActivityResult(requestCode, resultCode, data);
}
@@ -600,76 +704,80 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
@Override
public void onSaveSyncedFolderPreference(SyncedFolderParcelable syncedFolder) {
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(MainApp.getAppContext().
getContentResolver());
// custom folders newly created aren't in the list already,
// so triggering a refresh
if (MediaFolderType.CUSTOM == syncedFolder.getType() && syncedFolder.getId() == UNPERSISTED_ID) {
SyncedFolderDisplayItem newCustomFolder = new SyncedFolderDisplayItem(
SyncedFolder.UNPERSISTED_ID, syncedFolder.getLocalPath(), syncedFolder.getRemotePath(),
syncedFolder.getWifiOnly(), syncedFolder.getChargingOnly(), syncedFolder.getSubfolderByDate(),
syncedFolder.getAccount(), syncedFolder.getUploadAction(), syncedFolder.getEnabled(),
new File(syncedFolder.getLocalPath()).getName(), syncedFolder.getType());
long storedId = mSyncedFolderProvider.storeSyncedFolder(newCustomFolder);
if (storedId != -1) {
newCustomFolder.setId(storedId);
if (newCustomFolder.isEnabled()) {
FilesSyncHelper.insertAllDBEntriesForSyncedFolder(newCustomFolder);
} else {
String syncedFolderInitiatedKey = "syncedFolderIntitiated_" + newCustomFolder.getId();
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey);
}
}
mAdapter.addSyncFolderItem(newCustomFolder);
syncedFolder.isWifiOnly(), syncedFolder.isChargingOnly(), syncedFolder.isSubfolderByDate(),
syncedFolder.getAccount(), syncedFolder.getUploadAction(), syncedFolder.isEnabled(),
clock.getCurrentTime(), new File(syncedFolder.getLocalPath()).getName(), syncedFolder.getType(), syncedFolder.isHidden());
saveOrUpdateSyncedFolder(newCustomFolder);
adapter.addSyncFolderItem(newCustomFolder);
} else {
SyncedFolderDisplayItem item = mAdapter.get(syncedFolder.getSection());
item = updateSyncedFolderItem(item, syncedFolder.getLocalPath(), syncedFolder.getRemotePath(), syncedFolder
.getWifiOnly(), syncedFolder.getChargingOnly(), syncedFolder.getSubfolderByDate(), syncedFolder
.getUploadAction(), syncedFolder.getEnabled());
SyncedFolderDisplayItem item = adapter.get(syncedFolder.getSection());
updateSyncedFolderItem(item, syncedFolder.getId(), syncedFolder.getLocalPath(),
syncedFolder.getRemotePath(), syncedFolder
.isWifiOnly(), syncedFolder.isChargingOnly(), syncedFolder.isSubfolderByDate(), syncedFolder
.getUploadAction(), syncedFolder.isEnabled());
if (syncedFolder.getId() == UNPERSISTED_ID) {
// newly set up folder sync config
long storedId = mSyncedFolderProvider.storeSyncedFolder(item);
if (storedId != -1) {
item.setId(storedId);
if (item.isEnabled()) {
FilesSyncHelper.insertAllDBEntriesForSyncedFolder(item);
} else {
String syncedFolderInitiatedKey = "syncedFolderIntitiated_" + item.getId();
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey);
}
}
} else {
// existing synced folder setup to be updated
mSyncedFolderProvider.updateSyncFolder(item);
if (item.isEnabled()) {
FilesSyncHelper.insertAllDBEntriesForSyncedFolder(item);
} else {
String syncedFolderInitiatedKey = "syncedFolderIntitiated_" + item.getId();
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey);
}
}
saveOrUpdateSyncedFolder(item);
mAdapter.setSyncFolderItem(syncedFolder.getSection(), item);
// TODO test if notifiyItemChanged is suffiecient (should improve performance)
adapter.notifyDataSetChanged();
}
mSyncedFolderPreferencesDialogFragment = null;
syncedFolderPreferencesDialogFragment = null;
if (syncedFolder.getEnabled()) {
if (syncedFolder.isEnabled()) {
showBatteryOptimizationInfo();
}
}
private void saveOrUpdateSyncedFolder(SyncedFolderDisplayItem item) {
if (item.getId() == UNPERSISTED_ID) {
// newly set up folder sync config
storeSyncedFolder(item);
} else {
// existing synced folder setup to be updated
syncedFolderProvider.updateSyncFolder(item);
if (item.isEnabled()) {
FilesSyncHelper.insertAllDBEntriesForSyncedFolder(item);
} else {
String syncedFolderInitiatedKey = "syncedFolderIntitiated_" + item.getId();
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(MainApp.getAppContext().
getContentResolver());
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey);
}
}
}
private void storeSyncedFolder(SyncedFolderDisplayItem item) {
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(MainApp.getAppContext().
getContentResolver());
long storedId = syncedFolderProvider.storeSyncedFolder(item);
if (storedId != -1) {
item.setId(storedId);
if (item.isEnabled()) {
FilesSyncHelper.insertAllDBEntriesForSyncedFolder(item);
} else {
String syncedFolderInitiatedKey = "syncedFolderIntitiated_" + item.getId();
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey);
}
}
}
@Override
public void onCancelSyncedFolderPreference() {
mSyncedFolderPreferencesDialogFragment = null;
syncedFolderPreferencesDialogFragment = null;
}
@Override
public void onDeleteSyncedFolderPreference(SyncedFolderParcelable syncedFolder) {
mSyncedFolderProvider.deleteSyncedFolder(syncedFolder.getId());
mAdapter.removeItem(syncedFolder.getSection());
syncedFolderProvider.deleteSyncedFolder(syncedFolder.getId());
adapter.removeItem(syncedFolder.getSection());
}
/**
@@ -683,24 +791,24 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
* @param subfolderByDate created sub folders
* @param uploadAction upload action
* @param enabled is sync enabled
* @return the updated item
*/
private SyncedFolderDisplayItem updateSyncedFolderItem(SyncedFolderDisplayItem item,
private void updateSyncedFolderItem(SyncedFolderDisplayItem item,
long id,
String localPath,
String remotePath,
Boolean wifiOnly,
Boolean chargingOnly,
Boolean subfolderByDate,
boolean wifiOnly,
boolean chargingOnly,
boolean subfolderByDate,
Integer uploadAction,
Boolean enabled) {
boolean enabled) {
item.setId(id);
item.setLocalPath(localPath);
item.setRemotePath(remotePath);
item.setWifiOnly(wifiOnly);
item.setChargingOnly(chargingOnly);
item.setSubfolderByDate(subfolderByDate);
item.setUploadAction(uploadAction);
item.setEnabled(enabled);
return item;
item.setEnabled(enabled, clock.getCurrentTime());
}
@Override
@@ -727,7 +835,6 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
@Override
protected void onResume() {
super.onResume();
setDrawerMenuItemChecked(R.id.nav_synced_folders);
}
@@ -0,0 +1,83 @@
/*
* Nextcloud Android client application
*
* @author Daniel Bailey
* Copyright (C) 2019 Daniel Bailey
*
* 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.ui.activity;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.DarkMode;
import javax.inject.Inject;
import androidx.annotation.Nullable;
public class ThemedPreferenceActivity extends PreferenceActivity {
/**
* Tracks whether the activity should be recreate()'d after a theme change
*/
private boolean themeChangePending;
private boolean paused;
@Inject AppPreferences preferences;
private AppPreferences.Listener onThemeChangedListener = new AppPreferences.Listener() {
@Override
public void onDarkThemeModeChanged(DarkMode mode) {
preferences.setDarkThemeMode(mode);
if (paused) {
themeChangePending = true;
return;
}
recreate();
}
};
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
preferences.addListener(onThemeChangedListener);
}
@Override
protected void onDestroy() {
super.onDestroy();
preferences.removeListener(onThemeChangedListener);
}
@Override
protected void onPause() {
super.onPause();
paused = true;
}
@Override
protected void onResume() {
super.onResume();
paused = false;
if (themeChangePending) {
recreate();
}
}
}
@@ -35,7 +35,6 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
@@ -92,7 +91,7 @@ public class UploadFilesActivity extends FileActivity implements
private boolean mSelectAll;
private boolean mLocalFolderPickerMode;
private LocalFileListFragment mFileListFragment;
protected Button mUploadBtn;
protected MaterialButton mUploadBtn;
private Spinner mBehaviourSpinner;
private Account mAccountOnCreation;
private DialogFragment mCurrentDialog;
@@ -178,7 +177,8 @@ public class UploadFilesActivity extends FileActivity implements
mCancelButton.setOnClickListener(this);
mUploadBtn = findViewById(R.id.upload_files_btn_upload);
mUploadBtn.getBackground().setColorFilter(ThemeUtils.primaryColor(this, true), PorterDuff.Mode.SRC_ATOP);
mUploadBtn.setBackgroundTintMode(PorterDuff.Mode.SRC_ATOP);
mUploadBtn.setBackgroundTintList(ColorStateList.valueOf(ThemeUtils.primaryColor(this, true)));
mUploadBtn.setOnClickListener(this);
int localBehaviour = preferences.getUploaderBehaviour();
@@ -254,7 +254,7 @@ public class UploadFilesActivity extends FileActivity implements
@Override
public boolean onCreateOptionsMenu(Menu menu) {
mOptionsMenu = menu;
getMenuInflater().inflate(R.menu.upload_files_picker, menu);
getMenuInflater().inflate(R.menu.activity_upload_files, menu);
if(!mLocalFolderPickerMode) {
MenuItem selectAll = menu.findItem(R.id.action_select_all);
@@ -43,9 +43,11 @@ import com.evernote.android.job.Job;
import com.evernote.android.job.JobManager;
import com.evernote.android.job.JobRequest;
import com.evernote.android.job.util.support.PersistableBundleCompat;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.device.PowerManagementService;
import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.files.services.FileUploader;
@@ -230,9 +232,9 @@ public class UploadListActivity extends FileActivity {
protected void onStart() {
super.onStart();
ThemeUtils.setColoredTitle(getSupportActionBar(), R.string.uploads_view_title, this);
final Account account = getAccount();
if (account != null) {
setAccountInDrawer(account);
final Optional<User> optionalUser = getUser();
if (optionalUser.isPresent()) {
setAccountInDrawer(optionalUser.get());
}
}
@@ -269,7 +271,7 @@ public class UploadListActivity extends FileActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.upload_list_menu, menu);
inflater.inflate(R.menu.activity_upload_list, menu);
return true;
}
@@ -26,7 +26,7 @@
package com.owncloud.android.ui.activity;
import android.accounts.Account;
import android.app.AlertDialog;
import androidx.appcompat.app.AlertDialog;
import android.app.Dialog;
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
@@ -135,9 +135,6 @@ public class UserInfoActivity extends FileActivity implements Injectable {
setContentView(R.layout.user_info_layout);
unbinder = ButterKnife.bind(this);
setAccount(getUserAccountManager().getCurrentAccount());
onAccountSet();
boolean useBackgroundImage = URLUtil.isValidUrl(
getStorageManager().getCapability(account.name).getServerBackground());
@@ -159,7 +156,7 @@ public class UserInfoActivity extends FileActivity implements Injectable {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.user_info_menu, menu);
inflater.inflate(R.menu.activity_user_info, menu);
return true;
}
@@ -32,9 +32,9 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.nextcloud.client.account.CurrentAccountProvider;
import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.resources.activities.model.Activity;
import com.owncloud.android.lib.resources.files.model.FileVersion;
import com.owncloud.android.lib.resources.status.OCCapability;
@@ -69,7 +69,7 @@ public class ActivityAndVersionListAdapter extends ActivityListAdapter {
this.versionListInterface = versionListInterface;
}
public void setActivityAndVersionItems(List<Object> items, OwnCloudClient newClient, boolean clear) {
public void setActivityAndVersionItems(List<Object> items, NextcloudClient newClient, boolean clear) {
if (client == null) {
client = newClient;
}
@@ -24,7 +24,6 @@ package com.owncloud.android.ui.adapter;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.PictureDrawable;
import android.net.Uri;
import android.text.Spannable;
@@ -52,11 +51,12 @@ import com.bumptech.glide.load.model.StreamEncoder;
import com.bumptech.glide.load.resource.file.FileToStreamDecoder;
import com.caverock.androidsvg.SVG;
import com.nextcloud.client.account.CurrentAccountProvider;
import com.nextcloud.client.network.ClientFactory;
import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.activities.model.Activity;
import com.owncloud.android.lib.resources.activities.model.RichElement;
@@ -91,10 +91,11 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
private final ActivityListInterface activityListInterface;
private final int px;
private static final String TAG = ActivityListAdapter.class.getSimpleName();
protected OwnCloudClient client;
protected NextcloudClient client;
protected Context context;
private CurrentAccountProvider currentAccountProvider;
private ClientFactory clientFactory;
private FileDataStorageManager storageManager;
private OCCapability capability;
protected List<Object> values;
@@ -118,7 +119,7 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
this.isDetailView = isDetailView;
}
public void setActivityItems(List<Object> activityItems, OwnCloudClient client, boolean clear) {
public void setActivityItems(List<Object> activityItems, NextcloudClient client, boolean clear) {
this.client = client;
String sTime = "";
@@ -247,8 +248,11 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
if (MimeTypeUtil.isImageOrVideo(previewObject.getMimeType())) {
int placeholder = R.drawable.file;
Glide.with(context).using(new CustomGlideStreamLoader(currentAccountProvider)).load(previewObject.getSource()).
placeholder(placeholder).error(placeholder).into(imageView);
Glide.with(context).using(new CustomGlideStreamLoader(currentAccountProvider, clientFactory))
.load(previewObject.getSource())
.placeholder(placeholder)
.error(placeholder)
.into(imageView);
} else {
if (MimeTypeUtil.isFolder(previewObject.getMimeType())) {
imageView.setImageDrawable(
@@ -298,8 +302,10 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
String uri = client.getBaseUri() + "/index.php/apps/files/api/v1/thumbnail/" + px + "/" + px +
Uri.encode(file.getRemotePath(), "/");
Glide.with(context).using(new CustomGlideStreamLoader(currentAccountProvider)).load(uri).placeholder(placeholder)
.error(placeholder).into(fileIcon); // using custom fetcher
Glide.with(context).using(new CustomGlideStreamLoader(currentAccountProvider, clientFactory))
.load(uri).placeholder(placeholder)
.error(placeholder)
.into(fileIcon); // using custom fetcher
} else {
if (isDetailView) {
@@ -369,7 +375,12 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
}
}, idx1, idx2, 0);
ssb.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), idx1, idx2, 0);
ssb.setSpan(new ForegroundColorSpan(Color.BLACK), idx1, idx2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
ssb.setSpan(
new ForegroundColorSpan(context.getResources().getColor(R.color.text_color)),
idx1,
idx2,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
}
idx1 = text.indexOf('{', idx2);
}
@@ -23,7 +23,6 @@ package com.owncloud.android.ui.adapter;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -156,7 +155,7 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
gridViewHolder.checkbox.setImageDrawable(ThemeUtils.tintDrawable(R.drawable.ic_checkbox_marked,
ThemeUtils.primaryColor(mContext)));
} else {
gridViewHolder.itemLayout.setBackgroundColor(Color.WHITE);
gridViewHolder.itemLayout.setBackgroundColor(mContext.getResources().getColor(R.color.bg_default));
gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_blank_outline);
}
@@ -22,8 +22,6 @@ package com.owncloud.android.ui.adapter;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.PictureDrawable;
import android.net.Uri;
@@ -77,7 +75,7 @@ import butterknife.ButterKnife;
public class NotificationListAdapter extends RecyclerView.Adapter<NotificationListAdapter.NotificationViewHolder> {
private static final String FILE = "file";
private StyleSpan styleSpanBold = new StyleSpan(Typeface.BOLD);
private ForegroundColorSpan foregroundColorSpanBlack = new ForegroundColorSpan(Color.BLACK);
private ForegroundColorSpan foregroundColorSpanBlack;
private List<Notification> notificationsList;
private OwnCloudClient client;
@@ -87,6 +85,8 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
this.notificationsList = new ArrayList<>();
this.client = client;
this.notificationsActivity = notificationsActivity;
foregroundColorSpanBlack = new ForegroundColorSpan(
notificationsActivity.getResources().getColor(R.color.text_color));
}
public void setNotificationItems(List<Notification> notificationItems) {
@@ -166,15 +166,14 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
int primaryColor = ThemeUtils.primaryColor(notificationsActivity);
if (action.primary) {
button.getBackground().setColorFilter(primaryColor, PorterDuff.Mode.SRC_ATOP);
button.setBackgroundColor(primaryColor);
button.setTextColor(ThemeUtils.fontColor(notificationsActivity));
button.setTypeface(button.getTypeface(), Typeface.BOLD);
} else {
button.setStrokeColor(ColorStateList.valueOf(resources.getColor(R.color.grey_200)));
button.setStrokeWidth(3);
button.getBackground().setColorFilter(resources.getColor(R.color.transparent),
PorterDuff.Mode.SRC_ATOP);
button.setBackgroundColor(resources.getColor(R.color.transparent));
button.setTextColor(primaryColor);
button.setTypeface(button.getTypeface(), Typeface.BOLD);
}
@@ -30,7 +30,6 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Handler;
@@ -48,6 +47,7 @@ import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.BitmapImageViewTarget;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.preferences.AppPreferences;
import com.owncloud.android.R;
@@ -118,7 +118,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
private Set<OCFile> checkedFiles;
private FileDataStorageManager mStorageManager;
private Account account;
private User user;
private OCFileListFragmentInterface ocFileListFragmentInterface;
private FilesFilter mFilesFilter;
@@ -136,7 +136,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
public OCFileListAdapter(
Context context,
Account account,
User user,
AppPreferences preferences,
UserAccountManager accountManager,
ComponentsGetter transferServiceGetter,
@@ -148,16 +148,16 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
mContext = context;
this.preferences = preferences;
this.accountManager = accountManager;
this.account = account;
this.user = user;
mHideItemOptions = argHideItemOptions;
this.gridView = gridView;
checkedFiles = new HashSet<>();
this.transferServiceGetter = transferServiceGetter;
if (account != null) {
if (this.user != null) {
AccountManager platformAccountManager = AccountManager.get(mContext);
userId = platformAccountManager.getUserData(account,
userId = platformAccountManager.getUserData(this.user.toPlatformAccount(),
com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID);
} else {
userId = "";
@@ -330,7 +330,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
gridViewHolder.checkbox.setImageDrawable(ThemeUtils.tintDrawable(R.drawable.ic_checkbox_marked,
ThemeUtils.primaryColor(mContext)));
} else {
gridViewHolder.itemLayout.setBackgroundColor(Color.WHITE);
gridViewHolder.itemLayout.setBackgroundColor(mContext.getResources().getColor(R.color.bg_default));
gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_blank_outline);
}
@@ -400,7 +400,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
showFederatedShareAvatar(sharee.getUserId(), avatarRadius, resources, avatar);
} else {
avatar.setTag(sharee);
DisplayUtils.setAvatar(account,
DisplayUtils.setAvatar(user.toPlatformAccount(),
sharee.getUserId(),
sharee.getDisplayName(),
this,
@@ -461,17 +461,17 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
OperationsService.OperationsServiceBinder operationsServiceBinder = transferServiceGetter.getOperationsServiceBinder();
FileDownloader.FileDownloaderBinder fileDownloaderBinder = transferServiceGetter.getFileDownloaderBinder();
FileUploader.FileUploaderBinder fileUploaderBinder = transferServiceGetter.getFileUploaderBinder();
if (operationsServiceBinder != null && operationsServiceBinder.isSynchronizing(account, file)) {
if (operationsServiceBinder != null && operationsServiceBinder.isSynchronizing(user.toPlatformAccount(), file)) {
//synchronizing
gridViewHolder.localFileIndicator.setImageResource(R.drawable.ic_synchronizing);
gridViewHolder.localFileIndicator.setVisibility(View.VISIBLE);
} else if (fileDownloaderBinder != null && fileDownloaderBinder.isDownloading(account, file)) {
} else if (fileDownloaderBinder != null && fileDownloaderBinder.isDownloading(user.toPlatformAccount(), file)) {
// downloading
gridViewHolder.localFileIndicator.setImageResource(R.drawable.ic_synchronizing);
gridViewHolder.localFileIndicator.setVisibility(View.VISIBLE);
} else if (fileUploaderBinder != null && fileUploaderBinder.isUploading(account, file)) {
} else if (fileUploaderBinder != null && fileUploaderBinder.isUploading(user.toPlatformAccount(), file)) {
//uploading
gridViewHolder.localFileIndicator.setImageResource(R.drawable.ic_synchronizing);
gridViewHolder.localFileIndicator.setVisibility(View.VISIBLE);
@@ -576,13 +576,17 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(file, thumbnailView)) {
try {
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
new ThumbnailsCacheManager.ThumbnailGenerationTask(thumbnailView, mStorageManager,
account, asyncTasks);
new ThumbnailsCacheManager.ThumbnailGenerationTask(thumbnailView,
mStorageManager,
user.toPlatformAccount(),
asyncTasks);
if (thumbnail == null) {
thumbnail = BitmapUtils.drawableToBitmap(
MimeTypeUtil.getFileTypeIcon(file.getMimeType(), file.getFileName(),
account, mContext));
MimeTypeUtil.getFileTypeIcon(file.getMimeType(),
file.getFileName(),
user.toPlatformAccount(),
mContext));
}
final ThumbnailsCacheManager.AsyncThumbnailDrawable asyncDrawable =
new ThumbnailsCacheManager.AsyncThumbnailDrawable(mContext.getResources(),
@@ -598,12 +602,12 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
}
if ("image/png".equalsIgnoreCase(file.getMimeType())) {
thumbnailView.setBackgroundColor(mContext.getResources().getColor(R.color.background_color));
thumbnailView.setBackgroundColor(mContext.getResources().getColor(R.color.bg_default));
}
} else {
thumbnailView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(file.getMimeType(),
file.getFileName(),
account,
user.toPlatformAccount(),
mContext));
}
}
@@ -686,7 +690,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
sharedIconView.setImageResource(R.drawable.ic_unshared);
sharedIconView.setContentDescription(mContext.getString(R.string.shared_icon_share));
}
if (accountManager.accountOwnsFile(file, account)) {
if (accountManager.accountOwnsFile(file, user.toPlatformAccount())) {
sharedIconView.setOnClickListener(view -> ocFileListFragmentInterface.onShareIconClick(file));
} else {
sharedIconView.setOnClickListener(view -> ocFileListFragmentInterface.showShareDetailView(file));
@@ -704,7 +708,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
* @param limitToMimeType show only files of this mimeType
*/
public void swapDirectory(
Account account,
User account,
OCFile directory,
FileDataStorageManager updatedStorageManager,
boolean onlyOnDevice, String limitToMimeType
@@ -713,8 +717,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
if (updatedStorageManager != null && !updatedStorageManager.equals(mStorageManager)) {
mStorageManager = updatedStorageManager;
showShareAvatar = mStorageManager.getCapability(account.name).getVersion().isShareesOnDavSupported();
this.account = account;
showShareAvatar = mStorageManager.getCapability(account.getAccountName()).getVersion().isShareesOnDavSupported();
this.user = account;
}
if (mStorageManager != null) {
mFiles = mStorageManager.getFolderContent(directory, onlyOnDevice);
@@ -745,11 +749,11 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
FileDataStorageManager storageManager, OCFile folder, boolean clear) {
if (storageManager != null && mStorageManager == null) {
mStorageManager = storageManager;
showShareAvatar = mStorageManager.getCapability(account.name).getVersion().isShareesOnDavSupported();
showShareAvatar = mStorageManager.getCapability(user.getAccountName()).getVersion().isShareesOnDavSupported();
}
if (mStorageManager == null) {
mStorageManager = new FileDataStorageManager(account, mContext.getContentResolver());
mStorageManager = new FileDataStorageManager(user.toPlatformAccount(), mContext.getContentResolver());
}
if (clear) {
@@ -809,12 +813,12 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
shares.add(ocShare);
// get ocFile from Server to have an up-to-date copy
RemoteOperationResult result = new ReadFileRemoteOperation(ocShare.getPath()).execute(account,
RemoteOperationResult result = new ReadFileRemoteOperation(ocShare.getPath()).execute(user.toPlatformAccount(),
mContext);
if (result.isSuccess()) {
OCFile file = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
FileStorageUtils.searchForLocalFileInDefaultPath(file, account);
FileStorageUtils.searchForLocalFileInDefaultPath(file, user.toPlatformAccount());
file = mStorageManager.saveFileWithParent(file, mContext);
ShareType newShareType = ocShare.getShareType();
@@ -869,7 +873,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
for (Object remoteFile : objects) {
OCFile ocFile = FileStorageUtils.fillOCFile((RemoteFile) remoteFile);
FileStorageUtils.searchForLocalFileInDefaultPath(ocFile, account);
FileStorageUtils.searchForLocalFileInDefaultPath(ocFile, user.toPlatformAccount());
try {
if (ExtendedListFragment.SearchType.PHOTO_SEARCH == searchType) {
@@ -886,9 +890,9 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
true,
false,
mStorageManager,
account,
user.toPlatformAccount(),
mContext);
refreshFolderOperation.execute(account, mContext);
refreshFolderOperation.execute(user.toPlatformAccount(), mContext);
}
}
Loaded 100 of 345 files, more files were not shown because too many files have changed in this diff. Show more