Compare commits

..
Author SHA1 Message Date
Tobias Kaminsky e1b8044aa0 daily dev 20200730
Remove all uploads after test for sure
hide sort/list group on previews
optimize sorting/layout bar spacing for home/search bar
optimize toolbar layout
properly reset header for preview fragments
proper coloring and sizing for toolbar_standard.xml(s)
lint: Use ResourcesCompat.getDrawable()
lint: remove unused resources
improve notification icon dark theming
proper margin calculations
remove padding
Write some UI tests for NotificationsActivity
make button text non-all-caps for consistent styling
When going into subfolder or show details: show header even if it was scrolled away
if photo search returns less photos than limit -> hide spinner
Trashbin: show empty message only if empty
Activity list: - show correct placeholder - click on preview open file
add ROOM handling for sharees
align grid/sort buttons
add WebAuthn support using hwsecurity-fido2:4.1.0
Update translations
Update Nextcloud Android library
2020-07-30 03:40:39 +02:00
Tobias Kaminsky a92d1ee5ff Merge remote-tracking branch 'origin/master' into dev 2020-07-30 03:31:54 +02:00
Andy Scherzinger 663c0beda5 Merge pull request #6395 from cotechde/webauthn
add passwordless WebAuthn logins
2020-07-29 21:25:48 +02:00
Tobias Kaminsky eedb5008bb Merge pull request #6573 from nextcloud/uploadStorageTest
Remove all uploads after test for sure
2020-07-29 14:42:07 +02:00
tobiasKaminsky 29a0c138c7 Remove all uploads after test for sure
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-29 13:00:50 +02:00
Tobias Kaminsky 0976f7abe2 Merge pull request #6566 from nextcloud/uiTestsColor
Test different primary colors / dark mode
2020-07-29 11:53:25 +02:00
Tobias Kaminsky f7d886037a Merge pull request #6569 from nextcloud/fixToolbar
Fix toolbar
2020-07-29 11:28:18 +02:00
tobiasKaminsky c9c0ae9e46 Allow to run different colors on dark/light mode
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-29 11:20:25 +02:00
Andy Scherzinger e02b9adf8a hide sort/list group on previews
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-29 08:20:53 +02:00
Andy Scherzinger fdb4489e38 Updated screenshots
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-29 08:20:53 +02:00
Andy Scherzinger 130503a6e3 optimize sorting/layout bar spacing for home/search bar
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-29 08:20:52 +02:00
Andy Scherzinger af924761b7 optimize toolbar layout
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-29 08:20:51 +02:00
Andy Scherzinger e7cd9ce6bc properly reset header for preview fragments
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-29 08:20:51 +02:00
Andy Scherzinger ddd7b901da proper coloring and sizing for toolbar_standard.xml(s)
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-29 08:20:46 +02:00
Nextcloud bot 0a062ea937 [tx-robot] updated from transifex 2020-07-29 03:34:20 +00:00
Andy Scherzinger ef1aaead0c Merge pull request #6561 from nextcloud/notificationButtonStyling
Make button text non-all-caps for consistent styling
2020-07-28 22:22:16 +02:00
nextcloud-android-bot 8f1d7b5b95 Drone: update Lint results to reflect reduced error/warning count [skip ci]
Signed-off-by: nextcloud-android-bot <[email protected]>
2020-07-28 19:28:59 +00:00
Andy Scherzinger 774beec484 lint: Use ResourcesCompat.getDrawable()
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 21:20:44 +02:00
Andy Scherzinger 6b6e7c7f2c lint: remove unused resources
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 21:17:16 +02:00
Andy Scherzinger 4c547c2de2 update screenshot due to updated testcase data
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 18:01:08 +02:00
Andy Scherzinger d1bd1dd16e use proper testing date within this century
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 17:44:26 +02:00
Andy Scherzinger a514ad81a0 update test screenshot due to consolidated icon tinting
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 17:39:29 +02:00
Andy Scherzinger ed229267d2 improve notification icon dark theming
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 17:28:15 +02:00
Andy Scherzinger 080dc4047f proper button styling
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 17:28:14 +02:00
Andy Scherzinger f744a2351d proper code formatting
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 17:28:13 +02:00
Andy Scherzinger 7d14c90b7d proper margin calculations
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 17:28:13 +02:00
Andy Scherzinger 6c8d52119f remove padding
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 17:28:12 +02:00
tobiasKaminsky 76c20b22db Write some UI tests for NotificationsActivity
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-28 17:28:11 +02:00
Andy Scherzinger 3bba95365c make button text non-all-caps for consistent styling
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-28 17:28:11 +02:00
Andy Scherzinger 81654379f9 Merge pull request #6562 from nextcloud/headerScroll
When going into subfolder or show details: show header even if it was scrolled away
2020-07-28 17:08:40 +02:00
tobiasKaminsky 376ad933fb When going into subfolder or show details: show header even if it was scrolled away
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-28 14:40:20 +02:00
Andy Scherzinger c981833bc1 Merge pull request #6560 from nextcloud/fixLargeTest
make sure to delete all uploads
2020-07-28 12:05:18 +02:00
tobiasKaminsky cdf0c97001 make sure to delete all uploads
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-28 11:35:21 +02:00
Nextcloud bot cb27c7b413 [tx-robot] updated from transifex 2020-07-28 03:32:22 +00:00
Tobias Kaminsky 49612f91f7 Merge remote-tracking branch 'origin/master' into dev 2020-07-28 03:30:48 +02:00
Andy Scherzinger 919539846f Merge pull request #6553 from nextcloud/photoSearch
if photo search returns less photos than limit -> hide spinner
2020-07-27 12:06:27 +02:00
Tobias Kaminsky 17a19bd4be Merge pull request #6537 from nextcloud/trashbinLoading
Trashbin: show empty message only if empty
2020-07-27 11:30:33 +02:00
tobiasKaminsky 0be925f00e if photo search returns less photos than limit -> hide spinner
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-27 11:25:17 +02:00
Nextcloud bot 1000c9b83f [tx-robot] updated from transifex 2020-07-27 03:30:44 +00:00
Tobias Kaminsky 53710cad77 Merge remote-tracking branch 'origin/master' into dev 2020-07-26 03:30:49 +02:00
Nextcloud bot 2bd5b1cb27 [tx-robot] updated from transifex 2020-07-25 03:31:17 +00:00
Tobias Kaminsky 55f11313d8 Merge remote-tracking branch 'origin/master' into dev 2020-07-25 03:33:16 +02:00
tobiasKaminsky e1bb072588 Trashbin: show empty message only if empty
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-24 17:28:44 +02:00
Andy Scherzinger 675e6dc4d5 Merge pull request #6519 from nextcloud/activityList
Enhancing activity list
2020-07-24 13:59:30 +02:00
Andy Scherzinger 3a324f11e6 Merge pull request #6528 from nextcloud/federatedIcon
add ROOM handling for sharees
2020-07-24 13:41:32 +02:00
tobiasKaminsky 681263cc7f Activity list:
- show correct placeholder
- click on preview open file

Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-24 12:43:46 +02:00
Tobias Kaminsky 10580c9579 Merge pull request #6523 from nextcloud/sameHeight
align grid/sort buttons
2020-07-24 08:43:36 +02:00
tobiasKaminsky 7a9cf103b4 add ROOM handling for sharees
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-24 08:33:45 +02:00
Nextcloud bot 2248911da0 [tx-robot] updated from transifex 2020-07-24 03:33:06 +00:00
Tobias Kaminsky e8ca3b9a2a daily dev 20200724
fix crash on folder picker of synced folder
Fixed create folder due to new system (write on server is only performed upon unlock) added test case for remove file
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-07-24 03:41:10 +02:00
Tobias Kaminsky 3a5baf8a29 Merge remote-tracking branch 'origin/master' into dev 2020-07-24 03:32:06 +02:00
Andy Scherzinger 6fda99a633 Merge pull request #6522 from nextcloud/fabCrash
fix crash on folder picker of synced folder
2020-07-23 20:41:05 +02:00
Andy Scherzinger eed4293c43 Updated screenshots
Signed-off-by: Andy Scherzinger <[email protected]>
2020-07-23 19:20:42 +02:00
tobiasKaminsky d6890111bb align grid/sort buttons
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-23 18:10:40 +02:00
tobiasKaminsky a3487adbdf fix crash on folder picker of synced folder
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-23 16:40:57 +02:00
Tobias Kaminsky 57919b63c7 Merge pull request #6514 from nextcloud/dependabot/gradle/androidx.work-work-runtime-ktx-2.4.0
Bump work-runtime-ktx from 2.3.4 to 2.4.0
2020-07-23 09:12:16 +02:00
dependabot-preview[bot] 5dfeb14412 Bump work-runtime-ktx from 2.3.4 to 2.4.0
Bumps work-runtime-ktx from 2.3.4 to 2.4.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-23 08:20:30 +02:00
Tobias Kaminsky 10b5113299 Merge pull request #6515 from nextcloud/dependabot/gradle/androidx.work-work-runtime-2.4.0
Bump work-runtime from 2.3.4 to 2.4.0
2020-07-23 08:19:12 +02:00
dependabot-preview[bot] e0c15717f7 Bump work-runtime from 2.3.4 to 2.4.0
Bumps work-runtime from 2.3.4 to 2.4.0.

Signed-off-by: dependabot-preview[bot] <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-23 07:39:39 +02:00
Andy Scherzinger ed94dfb139 Merge pull request #6479 from nextcloud/encUpdate
Fixed create folder due to new system (write on server is only performed upon unlock)
2020-07-23 07:06:24 +02:00
Nextcloud bot 623a0e9c59 [tx-robot] updated from transifex 2020-07-23 03:34:13 +00:00
Tobias Kaminsky 4dc69acc6c daily dev 20200723
Add huawei upload
ETM internal strings that specify background jobs do not need to be translated
Update translations
2020-07-23 03:38:24 +02:00
Tobias Kaminsky 721f3824df Merge remote-tracking branch 'origin/master' into dev 2020-07-23 03:30:50 +02:00
tobiasKaminsky 907e9f0b26 Fixed create folder due to new system (write on server is only performed upon unlock)
added test case for remove file

Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-22 16:47:53 +02:00
Andy Scherzinger 1bf3425ab2 Merge pull request #6511 from nextcloud/huawei
Add huawei upload
2020-07-22 16:47:11 +02:00
tobiasKaminsky 933c61d0c9 Fixed create folder due to new system (write on server is only performed upon unlock)
added test case for remove file

Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-22 16:28:48 +02:00
tobiasKaminsky b39d3d4182 Add huawei upload
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-22 14:43:44 +02:00
Nextcloud bot d852aff107 [tx-robot] updated from transifex 2020-07-22 08:10:53 +00:00
Tobias Kaminsky 8e97d363fe Merge pull request #6503 from nextcloud/doNotTranslateETM
ETM internal strings that specify background jobs do not need to be translated
2020-07-22 07:11:15 +02:00
Nextcloud bot cb6ccbe650 [tx-robot] updated from transifex 2020-07-22 03:32:50 +00:00
Tobias Kaminsky 37fa5dbf6c daily dev 20200722
Warn on NC16 as outdated server
Test login on integrationTests
Update 3rd-party dependencies
2020-07-22 03:38:19 +02:00
Tobias Kaminsky 779b179025 Merge remote-tracking branch 'origin/master' into dev 2020-07-22 03:30:47 +02:00
tobiasKaminsky 121c6c1f23 Fixed create folder due to new system (write on server is only performed upon unlock)
added test case for remove file

Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-21 14:58:28 +02:00
tobiasKaminsky 4d040fba86 ETM internal strings that specify background jobs do not need to be translated
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-21 11:52:29 +02:00
Tobias Kaminsky 2dfde203c8 Merge pull request #6501 from nextcloud/bumpServerVersions
Warn on NC16 as outdated server
2020-07-21 11:47:11 +02:00
Dominik Schürmann c5e624f1e2 add WebAuthn support using hwsecurity-fido2:4.1.0
Signed-off-by: Dominik Schürmann <[email protected]>
2020-07-21 09:17:46 +02:00
tobiasKaminsky f4684f15c1 Warn on NC16 as outdated server
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-21 08:35:18 +02:00
dependabot-preview[bot] 14cec7d029 Merge pull request #6498 from nextcloud/dependabot/gradle/net.bytebuddy-byte-buddy-android-1.10.13 2020-07-21 05:25:32 +00:00
Tobias Kaminsky 4fad4403fc Merge pull request #4146 from nextcloud/loginOnEmulator
Test login on integrationTests
2020-07-21 07:15:37 +02:00
dependabot-preview[bot] 95c2db021f Merge pull request #6497 from nextcloud/dependabot/gradle/org.mockito-mockito-android-3.4.4 2020-07-21 05:11:16 +00:00
Tobias Kaminsky 85632d6721 daily dev 20200721
upon encryption directly ask for mnemonic/setup
supprss lint warning
New download manager
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-07-21 03:40:56 +02:00
Tobias Kaminsky 1561f1415d Merge remote-tracking branch 'origin/master' into dev 2020-07-21 03:31:55 +02:00
dependabot-preview[bot] 8cf7ba60b5 Bump byte-buddy-android from 1.10.10 to 1.10.13
Bumps [byte-buddy-android](https://github.com/raphw/byte-buddy) from 1.10.10 to 1.10.13.
- [Release notes](https://github.com/raphw/byte-buddy/releases)
- [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
- [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.10.10...byte-buddy-1.10.13)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-07-21 01:14:06 +00:00
dependabot-preview[bot] a8db8ef38f Bump mockito-android from 3.3.3 to 3.4.4
Bumps [mockito-android](https://github.com/mockito/mockito) from 3.3.3 to 3.4.4.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.3.3...v3.4.4)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-07-21 01:12:35 +00:00
Tobias Kaminsky 7861eb787e Merge pull request #6495 from nextcloud/directlyAskForE2E
upon encryption directly ask for mnemonic/setup
2020-07-20 17:13:26 +02:00
tobiasKaminsky 196b16d1d3 Test login on integrationTests
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-20 16:17:27 +02:00
Tobias Kaminsky 4f97110ab3 Merge pull request #6048 from nextcloud/ezaquarii/new-download-manager
New download manager
2020-07-20 12:52:49 +02:00
dependabot-preview[bot] 2150295acc Merge pull request #6493 from nextcloud/dependabot/gradle/daggerVersion-2.28.3 2020-07-20 10:42:44 +00:00
tobiasKaminsky de0467381c upon encryption directly ask for mnemonic/setup
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-20 12:33:58 +02:00
tobiasKaminsky 5a9d578018 supprss lint warning
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-20 12:28:50 +02:00
Chris Narkiewicz 75b9fa8551 New download manager
Signed-off-by: Chris Narkiewicz <[email protected]>
2020-07-20 12:28:47 +02:00
dependabot-preview[bot] 72b9dd069a Bump daggerVersion from 2.28.1 to 2.28.3
Bumps `daggerVersion` from 2.28.1 to 2.28.3.

Updates `dagger` from 2.28.1 to 2.28.3
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.28.1...dagger-2.28.3)

Updates `dagger-android` from 2.28.1 to 2.28.3
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.28.1...dagger-2.28.3)

Updates `dagger-android-support` from 2.28.1 to 2.28.3
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.28.1...dagger-2.28.3)

Updates `dagger-compiler` from 2.28.1 to 2.28.3
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.28.1...dagger-2.28.3)

Updates `dagger-android-processor` from 2.28.1 to 2.28.3
- [Release notes](https://github.com/google/dagger/releases)
- [Changelog](https://github.com/google/dagger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/dagger/compare/dagger-2.28.1...dagger-2.28.3)

Signed-off-by: dependabot-preview[bot] <[email protected]>
Signed-off-by: tobiasKaminsky <[email protected]>
2020-07-20 12:26:12 +02:00
Andy Scherzinger 51f48549c3 Merge pull request #6494 from nextcloud/dependabot/gradle/org.mockito-mockito-android-3.4.4
Bump mockito-android from 3.4.2 to 3.4.4
2020-07-20 11:53:50 +02:00
Andy Scherzinger 1b1823db0a Merge pull request #6492 from nextcloud/dependabot/gradle/org.mockito-mockito-core-3.4.4
Bump mockito-core from 3.4.2 to 3.4.4
2020-07-20 11:53:27 +02:00
dependabot-preview[bot] 65a2b895f5 Bump mockito-core from 3.4.2 to 3.4.4
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.4.2 to 3.4.4.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.4.2...v3.4.4)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-07-20 09:32:57 +00:00
dependabot-preview[bot] 81bb72344c Bump mockito-android from 3.4.2 to 3.4.4
Bumps [mockito-android](https://github.com/mockito/mockito) from 3.4.2 to 3.4.4.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.4.2...v3.4.4)

Signed-off-by: dependabot-preview[bot] <[email protected]>
2020-07-20 09:32:06 +00:00
Tobias Kaminsky 633c82de93 daily dev 20200718
Use same color for status bar
Fix crash on missing user
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-07-18 03:40:42 +02:00
Tobias Kaminsky e85cf54640 Merge remote-tracking branch 'origin/master' into dev 2020-07-18 03:31:58 +02:00
Tobias Kaminsky 9a64fe7aff daily dev 20200717
new screenshots, disabled non working
Add tests for dialogs
fix wrong show of sort/list group and FAB in details or text preview
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-07-17 03:40:10 +02:00
Tobias Kaminsky 2afbf11f73 Merge remote-tracking branch 'origin/master' into dev 2020-07-17 03:30:49 +02:00
Tobias Kaminsky 3b2fd340d3 Merge remote-tracking branch 'origin/master' into dev 2020-07-16 03:32:45 +02:00
Tobias Kaminsky 225f133341 daily dev 20200714
Migrate FileMenuFiler to User model
Migrate UploadFileOperation to User model
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-07-14 03:41:44 +02:00
Tobias Kaminsky ef5362f877 Merge remote-tracking branch 'origin/master' into dev 2020-07-14 03:32:22 +02:00
Tobias Kaminsky d7b9d5df07 daily dev 20200711
Theme login with server capability
remove unused import
spotbugs: remove unused variables
dialog buttons shouldn't have a background color
make sure dialog button text is not allCaps and title is standard material colored
remove unused variable
Remove title theming of modal dialog
show downloaded encrypted files in subfolders
direct login works again
Update translations
2020-07-11 03:38:10 +02:00
Tobias Kaminsky d27dd7c4c6 Merge remote-tracking branch 'origin/master' into dev 2020-07-11 03:30:50 +02:00
Tobias Kaminsky 5e8a2b714c daily dev 20200710
Migrate data transfer listener to User model
Update translations
2020-07-10 03:38:29 +02:00
Tobias Kaminsky 77c76bd10f Merge remote-tracking branch 'origin/master' into dev 2020-07-10 03:30:49 +02:00
Tobias Kaminsky 062151a248 daily dev 20200708
do not user NotNull, but NonNull
Migrate SetupEncryptionDialogFragment to User model
Migrate MimeTypeUtil.getFileTypeIcon to User model
Migrate PreviewImagePagerAdapter to User model
Update translations
2020-07-08 03:38:10 +02:00
Tobias Kaminsky 9c139e5186 Merge remote-tracking branch 'origin/master' into dev 2020-07-08 03:30:49 +02:00
Tobias Kaminsky ff823480c9 daily dev 20200707
fix possible NPE
minor code formatting
Fix ReceiveExternalFilesActivity account -> user
Migrate MumeTypeUtil.folderTypeIcon to user model
Migrate UploadListAdapter to User model
Migrate player service and preview fragment to User model
Update translations
2020-07-07 03:38:16 +02:00
Tobias Kaminsky a7182dc7ae Merge remote-tracking branch 'origin/master' into dev 2020-07-07 03:30:49 +02:00
Tobias Kaminsky 867b3c25d7 daily dev 20200705
Update translations
2020-07-05 03:40:28 +02:00
Tobias Kaminsky dd52045b4d Merge remote-tracking branch 'origin/master' into dev 2020-07-05 03:31:06 +02:00
Tobias Kaminsky 40ab5cffa1 daily dev 20200704
remove fileDrop capability
Resolve #6399 adding theming logic for share link icons
Spotbugs: MS 	com.owncloud.android.db.ProviderMeta$ProviderTableMeta.FILE_ALL_COLUMNS is a mutable array MS 	com.owncloud.android.providers.UsersAndGroupsSearchProvider.ACTION_SHARE_WITH isn't final and can't be protected from malicious code MS 	com.owncloud.android.utils.FileSortOrder.sortOrders is a mutable collection MS 	org.nextcloud.providers.cursors.FileCursor.DEFAULT_DOCUMENT_PROJECTION should be package protected
Edit label for public share split up between public share and user shares
l10n: Delete a space character
Update translations
Update Nextcloud Android library
2020-07-04 03:41:11 +02:00
Tobias Kaminsky 371160b479 Merge remote-tracking branch 'origin/master' into dev 2020-07-04 03:32:26 +02:00
Tobias Kaminsky ce4e1c15f5 Merge remote-tracking branch 'origin/master' into dev 2020-07-03 03:32:14 +02:00
Tobias Kaminsky 75650bcfe8 Merge remote-tracking branch 'origin/master' into dev 2020-07-02 03:40:59 +02:00
Tobias Kaminsky 2f7597cc68 daily dev 20200701
remove EditShareFragment.java
remove unused ressources
add default to switch
fix switch statement
add missing import
fix test
minor code changes after rebase
Synced folder dialog: remove local and remote folder icons
Synced folder dialog: use display name instead of full path for local folder
Synced folder dialog: remove folder path expand action
Deep link handler tests
Move user filtering to deep link handler
Refactored deep link handling
Deep link handler prototype
allow 3 times deep nextcloud nesting
Update pattern matcher to allow pretty urls
allow pretty urls
revert library
fixes after rebase
remove literals in conditional statements
UI fine tuning for link items / sharing fragments
add multiple share links
Add to jetified-dagger-lint-aar-2.28.1 for custom lint check
Bump to dagger 2.28.1
Provide DeckApi via dependency injection framework
Migate file details and share details to User model
Fix NPE in OCFileListFragment when OCFile is null
Update translations
Update 3rd-party dependencies
2020-07-01 03:38:05 +02:00
Tobias Kaminsky d31a83c426 Merge remote-tracking branch 'origin/master' into dev 2020-07-01 03:30:46 +02:00
Tobias Kaminsky b630abe052 daily dev 20200630
Lint ignore
Replace fragment by FragmentContainerView
remove element color references
remove unused method
improve edge case FAB coloring
move primary action button theming to new theming method
Introduce light/dark theme / black/white primary-color-aware primary-button theming
proper coloring of drawer items in black/white edge case scenarios
proper button coloring for dark theme + black primary color
Remove duplacation
black nav bar on image preview
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-06-30 03:43:25 +02:00
Tobias Kaminsky 07a2106d45 Merge remote-tracking branch 'origin/master' into dev 2020-06-30 03:32:48 +02:00
Tobias Kaminsky cbfa9ff6cb daily dev 20200627
lint: remove unused resource
Enhance FileDetailSharingFragment: - remove no users text - disable search view if reshare is not allowed - show note icon
Hide on scrolling for activities and notifications
fix #5468 if we have no activity, do nothing
2020-06-27 03:38:19 +02:00
Tobias Kaminsky 6db7c79962 Merge remote-tracking branch 'origin/master' into dev 2020-06-27 03:30:49 +02:00
Tobias Kaminsky 21f2ce7425 daily dev 20200626
changes due to CR
Removed legacy login cleaned up a bit AuthenticatorActivity
add null check
fix OCP_OVERLY_CONCRETE_PARAMETER
use fixed spotbug version
fix tests
make function puplic for testing
Fix zoom, toggle background
Removed possible NPE
removed duplicated sort/switch grid buttons
Changes due to CR
Hide on scrolling, fix https://github.com/nextcloud/android/issues/6238
use view instead of linear layout as common parent
Update translations
Update 3rd-party dependencies
2020-06-26 03:40:15 +02:00
Tobias Kaminsky 8ba7eb619e Merge remote-tracking branch 'origin/master' into dev 2020-06-26 03:30:48 +02:00
Tobias Kaminsky 7140340c59 daily dev 20200625
Remove useless parents
fix USBR_UNNECESSARY_STORE_BEFORE_RETURN
remove unused constants
fix URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD
on user share permission: unshare as destructive option on bottom
Use same search hint as on server
rich workspace not in folder picker activity
#6247 View Binding - Fix new SpotBugs performance warning (unread field)
fix LSC_LITERAL_STRING_COMPARISON
#6247 View Binding - Remove unused imports
#6247 View Binding - SendButtonAdapter.ViewHolder
#6247 View Binding - AccountItemBinding & AccountActionBinding
#6247 View Binding - ConflictResolveDialogBinding
Combined ShareActivity with FileDetailSharingFragment as much as possible
Update Nextcloud Android library
2020-06-25 03:40:02 +02:00
Tobias Kaminsky 360f9dab90 Merge remote-tracking branch 'origin/master' into dev 2020-06-25 03:31:45 +02:00
Tobias Kaminsky 86ebd24f2d daily dev 20200624
Fixed NPE when hiding ssl cert
#6247 View Binding - Fix codacy issue
#6247 View Binding - FileDisplayActivity and partial Ssl views
Fix improper deleting synced folder by OfflineSyncWork
Remove redundant style
color nav bar
Update Nextcloud Android library
2020-06-24 03:40:08 +02:00
Tobias Kaminsky 99d6c1c5fd Merge remote-tracking branch 'origin/master' into dev 2020-06-24 03:31:44 +02:00
Tobias Kaminsky a04f52915a daily dev 20200620
minor changes to build.gradle and fixed type on uploadReport.sh
minor changes to build.gradle
Use always recommended spotbug version, defined by plugin exclude data binding generated classes
Fixed Lint: MissingClass: Missing registered class Range: Outside Range UseAppTint: app:tint attribute should be used on ImageView UseCompatLoadingForDrawables UseCompatTextViewDrawableXml
Fix spotbugs output
update combinedTestReport
change to newer spotbugs
change Gradle to 6.1.1
Update Nextcloud Android library
Update 3rd-party dependencies
2020-06-20 03:43:55 +02:00
Tobias Kaminsky 0de60103b1 Merge remote-tracking branch 'origin/master' into dev 2020-06-20 03:32:16 +02:00
Tobias Kaminsky 94dfdd88a6 daily dev 20200619
check if activity is running before showing dialog
Migrate ContactsPreferenceActivity startup to type-safe API
Show "photos" in title
centralize intent creation for - FileUploader - ConflictsResolveActivity
Update translations
2020-06-19 03:37:42 +02:00
Tobias Kaminsky 33d5826337 Merge remote-tracking branch 'origin/master' into dev 2020-06-19 03:30:43 +02:00
Tobias Kaminsky b65fd5bd46 daily dev 20200618
Theme refresh bugfix
Fix appbar photos view when enter in background
remove unneeded linearLayout id
Drop Android 4.2 support
Use MaterialButton for addAccount action in accounts screen
Add touch states to file_list_actions_bottom_sheet
tint first run
perperly align 3-dot menu of folder items
Update translations
Update 3rd-party dependencies
2020-06-18 03:38:57 +02:00
Tobias Kaminsky 6d3c96c8f3 Merge remote-tracking branch 'origin/master' into dev 2020-06-18 03:30:42 +02:00
Tobias Kaminsky fbb3a339bc daily dev 20200617
remove non needed exceptions
Split off of #5150
Update translations
Update Nextcloud Android library
2020-06-17 03:40:21 +02:00
Tobias Kaminsky 5d9d094f42 Merge remote-tracking branch 'origin/master' into dev 2020-06-17 03:32:15 +02:00
Tobias Kaminsky 49a93485c4 daily dev 20200611
add lint ignore for newApi within build dir
Ignore RestrictedApiCheck for generated files
Check also generated sources to avoid unused resources warning
Add account: grey color align text
Fix unit tests
#6247 View Binding - ShareFileFragment (Remove Jetbrains annotation)
#6247 View Binding - ShareFileFragment
Update translations
Update Nextcloud Android library
2020-06-11 03:40:38 +02:00
Tobias Kaminsky a2487ff457 Merge remote-tracking branch 'origin/master' into dev 2020-06-11 03:32:07 +02:00
Tobias Kaminsky b633ebd86b daily dev 20200610
replace edge colors
remove action_sort
Fix crash when creating client
Update translations
Update 3rd-party dependencies
2020-06-10 03:39:31 +02:00
Tobias Kaminsky 77ab8116cc Merge remote-tracking branch 'origin/master' into dev 2020-06-10 03:30:43 +02:00
Tobias Kaminsky 75ce22d2db daily dev 20200609
use check arrow for chosen account
Update translations
2020-06-09 03:37:23 +02:00
Tobias Kaminsky 9801bbef76 Merge remote-tracking branch 'origin/master' into dev 2020-06-09 03:30:42 +02:00
Tobias Kaminsky 45ef15cd66 daily dev 20200607
Fix format
Added some tool hints for easier development
Update translations
2020-06-07 03:37:58 +02:00
Tobias Kaminsky 36eaee63b6 Merge remote-tracking branch 'origin/master' into dev 2020-06-07 03:30:44 +02:00
Tobias Kaminsky 6bd0fd9eb6 daily dev 20200606
set gradient via imageview for markdown previews
invert activity icon on dark mode removed outer white border on shared_via_ink
split up unit&IT tests from screenshot tests
drone/ updateScreenshot update
fix #6137
Fix after rebase
Add local variable for storageManager
Add etag column to capabilities table
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-06-06 03:41:58 +02:00
Tobias Kaminsky 5adef2978a Merge remote-tracking branch 'origin/master' into dev 2020-06-06 03:32:13 +02:00
Tobias Kaminsky 9016b98cb1 daily dev 20200605
show rich workspace in grid spanned across first row
Adjusted one comment
Fixed a bug relative to actionmode + Enhanced actionmode behaviour
ReceiveExternalFiles to new layout
Upload list activity: new sort / switch button
set sorting button text for trashbin activity, extract button text logic to utils method
Fix lint
Fix onResume FileDetailFragment
Improve google style
Fix appbar when show FileDetailFragment
Fix contextual action bar theme
Appbar like google and fix property file appbar
change trashbin view to new layout
Update translations
2020-06-05 03:37:21 +02:00
Tobias Kaminsky 389b0efe14 Merge remote-tracking branch 'origin/master' into dev 2020-06-05 03:30:43 +02:00
Tobias Kaminsky b0ac12f933 daily dev 20200604
invert if to make it more readable
only scroll to position, if highlighted item exists
Replaced primary color by element color for chosen Sort-By element
Applied a new fallback color for DarkMode
Update translations
Update Nextcloud Android library
2020-06-04 03:40:14 +02:00
Tobias Kaminsky d968dc20b3 Merge remote-tracking branch 'origin/master' into dev 2020-06-04 03:32:07 +02:00
Tobias Kaminsky e9734ffb00 daily dev 20200603
fix search related items in drawer
Removed unused items in FileDisplayActivity + Fixed some bugs
Fixed lint
Removed startSynchronization method
Removed unused Sync account + Fixed a display inconsistency bug
Increased searchview width when deployed
Restructured options menu + Removed unused items
Update translations
2020-06-03 03:37:27 +02:00
Tobias Kaminsky 89eaa947e1 Merge remote-tracking branch 'origin/master' into dev 2020-06-03 03:30:42 +02:00
Tobias Kaminsky 134286eff1 daily dev 20200530
exclude all files for backup
Do not show rich workspace when "on devices"
correct empty message for "on devices"
2020-05-30 03:37:18 +02:00
Tobias Kaminsky fe20249af3 Merge remote-tracking branch 'origin/master' into dev 2020-05-30 03:30:41 +02:00
Tobias Kaminsky af14a5ae95 daily dev 20200529
synced folder dialog, if disabled: - do not allow to click on any item - checkboxes are grey
refresh favorites result in actually reloading favorites
Fixed the color for Drawer Quota + fixed a global bug about color
Replaced the logo and header drawer background/color
Adjusted drawer quota font-size + Formated Drawer XML code
Fixed spotbugs useless issue
Fixed Android Studio lint
Adjusted drawer menu item tint management
Increased the Drawer Quota progressbar height
Replaced Drawer logo color by Primary one (with white-replace)
Fixed some Drawer errors due to clean
Added Drawer logo description
Removed the Drawer profiles part + removed unused code
Remove deprecated method and fix color in light
Refactor UploadFilesActivity
fix test
fix favorite star to top
re-arrange code
hide share icon in grid mode
Update Nextcloud Android library
Update 3rd-party dependencies
2020-05-29 03:40:29 +02:00
Tobias Kaminsky 9ed8713503 Merge remote-tracking branch 'origin/master' into dev 2020-05-29 03:32:08 +02:00
Tobias Kaminsky bb83592db3 daily dev 20200527
Revert "Fixed unused resources linter warning"
Fixed unused resources linter warning
Implemented "Switch to account" feature in Accounts list
Fix #6147
Fix lint
- disabling test_orchestrator - E2E tests only on NC19+ - fixed Tests
Improve design
Fixed definitively KTLint errors
Enhanced code syntax
Fixed Spotbugs and KtLint reports
Aligned icons + Cleaned code + Implemented listeners
Implemented ChooseAccountFragment dialog + Fixed some things around accounts management
do not let media scanner throw an exception as otherwise upload fails
Update translations
2020-05-27 03:47:28 +02:00
Tobias Kaminsky 2d3aef36f6 Merge remote-tracking branch 'origin/master' into dev 2020-05-27 03:40:55 +02:00
Tobias Kaminsky 74e7b13968 daily dev 20200526
FIX: #5752 Upload files: too much whitespace
Revert "[FIX: #5752] Upload files: too much whitespace"
If we cancel by user, we pass a reason, so app can handle it correctly
Add jaxb dependencies for builde (with jdk>8)
Fix contacts backup job interval
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-05-26 03:40:28 +02:00
Tobias Kaminsky df6256edd4 Merge remote-tracking branch 'origin/master' into dev 2020-05-26 03:32:03 +02:00
Tobias Kaminsky 5843499d7a daily dev 20200523
Add media title to mediaStore if necessary
Set title in mediaStore, when upload from "move to <nc> folder"
insert uploaded image to mediaStore
do not use media scanner
Update translations
Update 3rd-party dependencies
2020-05-23 03:37:13 +02:00
Tobias Kaminsky 46c410cad6 Merge remote-tracking branch 'origin/master' into dev 2020-05-23 03:30:40 +02:00
Tobias Kaminsky 016fa1373a daily dev 20200521
Fix upload and wrote tests
Fix upload and wrote tests
Properly show default/generated avatar if there is no one yet
Fix navigationbar in all activity
Improve userinfo item
Use ConstraintLayout
Refactor
Remove old layout
E2E overhaul - Limit online editing/stream when e2e-encrypted file - download files in subfolder to correct local folder name - use httpd/unix-directory for folder in metadata - set encryption status of subfolder
Update translations
2020-05-21 03:37:11 +02:00
Tobias Kaminsky 2c1c49076c Merge remote-tracking branch 'origin/master' into dev 2020-05-21 03:30:40 +02:00
Tobias Kaminsky d9f2d996bf daily dev 20200520
Fix wrongly sized png thumbnail after download #6006
Update translations
Update Nextcloud Android library
2020-05-20 03:39:01 +02:00
Tobias Kaminsky 13f071a721 Merge remote-tracking branch 'origin/master' into dev 2020-05-20 03:31:35 +02:00
Tobias Kaminsky 3963a0dec1 daily dev 20200519
Add licence
Add light navigationbar and fix statusbar with actionMode
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-05-19 03:40:50 +02:00
Tobias Kaminsky b417d6eae9 Merge remote-tracking branch 'origin/master' into dev 2020-05-19 03:31:38 +02:00
Tobias Kaminsky 561c5f4b94 daily dev 20200517
fix unused background
remove unused files and colors
Remove unused background for selection in grid_sync_item
Replace list_selector background by ripple effect
remove unused background in grid_image
remove unused background list_selector on grid_item
remove unused properties in list_item
Fix selected item background color
Update translations
2020-05-17 03:37:19 +02:00
Tobias Kaminsky 40c2de359f Merge remote-tracking branch 'origin/master' into dev 2020-05-17 03:30:41 +02:00
Tobias Kaminsky 2c2a07de46 daily dev 20200516
Fixed linter warnings
Add SQL query pagination to fix #5891
Add some tests for upload storage manager
Minor changes after rebase
Appbar like google
Bug fix
Fix toolbar color un darkmode
Fix tiny jump
Improve color in darkmode and fix another searchview collapsed
Fix when searchview is open and reload page
Implement new searchbar
Don't show new appbar with DeviceOnly
Fix userinfo and previewimage toolbar
Remove redundant code
Fix SyncedFoldersActivity
Fix select nav_all_files in drawer
Only show new app bar for "all_files"
Add home search appbar
spotbugs: Unused public or protected field
Fix wrong extra_account, which used user instead of account
Fix linter warnings
Tried to fix the "Spotbug" NAB detections
Removed "Dead store" spotbug error for PhotoSearchTask
Cleaned up the old toolbar progressbar dependent code
Replaced toolbar loading by SwipeRefresh in Files list
Update translations
Update 3rd-party dependencies
2020-05-16 03:37:24 +02:00
Tobias Kaminsky 7f00d2b018 Merge remote-tracking branch 'origin/master' into dev 2020-05-16 03:30:39 +02:00
Tobias Kaminsky 2b0f55982e daily dev 20200515
Fix the star for favorite for shimmers
fix crash when populating info on vanished activity
Fix the shimmer that had been accidentally hidden on master
spotbugs. needless boxing of a boolean constant
Fix gridview enabled name
Fix grid image padding dimension name
remove some warnings
fix thumbnail dynamic size
Fix fab behavior hide and ripple color
Fix after rebase
DeckApi unit test
Adjusted javadoc
Removed logging
Add license header and code format
Internal refactoring of the DeckApiImpl
Add some java doc
Rename interface and implementation for Deck integration
Use Optional for DeckIntegration and better name for interface
Don't instantiate intent each time in the for loop
Don't spam logs
Small refactorings
Added default serialVersionUID for new Exception classes
Fix typo in handle
Add GPL headers
Move Deck exception classes into own files
Move Deck integration logic to own package
Set shimmer corner same as the thumbnail
remove unused imports
Set thumbnail shimmer height same as the thumbnail
set new margin for icons in grid view
custom different radius for icons on the grid view and the list view
3 Columns on grid mode
add margin in grid mode
Add corners in shimmer effect for all modes
add thumbnail corners on grid and list mode fix to 8dp
Update translations
2020-05-15 03:37:12 +02:00
Tobias Kaminsky f53b16a48c Merge remote-tracking branch 'origin/master' into dev 2020-05-15 03:30:41 +02:00
Tobias Kaminsky bfc054f38a daily dev 20200513
consistent naming schema for folder icons
replace folder icons with material design like versions
Implemented a fixed width for local file indicator
remove EXTRA_FILE_PATH
move field to local variable
Fixed a bug relative to account switch
Splitted User ClickListener interface in two methods
spotbugs: FCBL_FIELD_COULD_BE_LOCAL
Replaced "Open" by "View Profile" and removed french translation for transifex
Aligned the files icons
Fix parameters passed to downloader during contacts list download
Added account deletion feature
Enabled the actions and the inflating for Accounts Management
Implemented view in listener + Pre-implemented menu inflating
Applied a listener on account menu button
Pre-added a menu to manage accounts
Translation fix
Update strings.xml file
Update strings.xml file
Update Nextcloud Android library
2020-05-13 03:39:50 +02:00
Tobias Kaminsky 08ed7a971e Merge remote-tracking branch 'origin/master' into dev 2020-05-13 03:31:58 +02:00
Tobias Kaminsky 1bc187ec48 daily dev 20200512
Fixed account extra argument passed to OperationsService when starting sync
Update translations
Update Nextcloud Android library
2020-05-12 03:39:16 +02:00
Tobias Kaminsky 93e0fef71b Merge remote-tracking branch 'origin/master' into dev 2020-05-12 03:31:41 +02:00
Tobias Kaminsky cbe99d978e daily dev 20200508
remove unused file
Update translations
2020-05-08 03:37:28 +02:00
Tobias Kaminsky 0734102c4c Merge remote-tracking branch 'origin/master' into dev 2020-05-08 03:30:55 +02:00
Tobias Kaminsky 4e1ef91f8c daily dev 20200507
Refactor and readd unnecessary id
Fix account removal, #6012
Remove Evernote job scheduler dependency
show "no new version available" only when clicking on it, not in background check
Readd necessaries values
Improve sort button and hide if necessary
Reduce lint warning
Remove unused dependencies
Shimmer effect in grid mode
Improve ripple
Replace shimmer effect on list mode view
Add loaderViewLibrary for youtube skeleton effect
Improve margin and lower case button
fix some warnings for lint
Hide FAB in scroll
Reduce spotbugs
Hide when scroll
Add new sort and gridview switch button. Remove duplication
fix shimmer background marge for grid mode
Fix shimmer background width for grid mode
Background shimmer size on grid image is the same as the downloaded pictures
Infinite shimmer animation continue while scrolling until the thumbnail is loaded
Replaced some file and list icons
add a corner on the background of the shimmer
stop shimmer on network error and show a default picture
Shimmer effect only when you download a thumbnail and you only display gray during the progression
remove unused shimmer effects
Replaced some icons by Material ones + Removed a useless double-icon
add facebook shimmer effect
Replaced some icons
add facebook shimmer effect
Updated headers (removed due to autochange) + Replaced some icons by Material ones
Replaced some icons by Material ones to (removed useless icons)
Remove unused class
Update translations
2020-05-07 03:37:13 +02:00
Tobias Kaminsky 25adbd4f47 Merge remote-tracking branch 'origin/master' into dev 2020-05-07 03:30:44 +02:00
Tobias Kaminsky c3f015b695 daily dev 20200506
Migrate UserListAdapter to new User model
Update translations
Update 3rd-party dependencies
2020-05-06 03:38:18 +02:00
Tobias Kaminsky f0c09bdd7b Merge remote-tracking branch 'origin/master' into dev 2020-05-06 03:31:41 +02:00
Tobias Kaminsky abaecc3bcc daily dev 20200505
Fix color
Update translations
2020-05-05 03:37:33 +02:00
Tobias Kaminsky b12671234a Merge remote-tracking branch 'origin/master' into dev 2020-05-05 03:30:54 +02:00
Tobias Kaminsky 5e6beb78ff daily dev 20200501
fix typo organized imports
fix #4540
fix multiselect #5970
Migrate remaining jobs to WorkManager
Fixed invisible back-button
add missing work manager function to create notification work
Migrate NotificationJob to WorkManager API
Update translations
Update Nextcloud Android library
2020-05-01 03:37:40 +02:00
Tobias Kaminsky 834ad8018a Merge remote-tracking branch 'origin/master' into dev 2020-05-01 03:30:51 +02:00
Tobias Kaminsky 84d740c231 Merge remote-tracking branch 'origin/master' into dev 2020-04-30 03:31:56 +02:00
Tobias Kaminsky bbdeec4d9e daily dev 20200429
Fix background tests
Remove unused argument
Unused function
Improve methode name
Revert " Bugfix for #5929"
Fix dark mode "follow system"
Put back the Material values (due invision false values)
revert background image for notifications
Tinted checkboxes in ConflictsResolveDialog Activity icons have a 'night mode' background circle. Signed-off-by: Daniel Bailey <[email protected]>
set secondary action button in notifications to grey
proper toolbar theming ignoring dark/light theme for toolbar colors
properly theme SwipeRefreshLayout
unify divider colors
change dark theme background to #121212 see https://material.io/design/color/dark-theme.html#properties
dark theme favorite icon
don't tint drawer menu toggle
use proper rtl values
raise margin for bottom sheet menu item divider
Dark Mode Improvements (2)
Fixes bug whereby a user initiated change to dark mode isn't applied for "follow system".
Bump to 3.13 alpha
Better item selected background color in dark mode
Improve variable name
Change ActionMode color
Correction Whitespace and remove superficial comments
add missing back button in ManageAccountsActivity & UserInfoActivity
Enhanced dark mode for some text colors
Replaced comma separator by bullet character in files list
Adjusted size of file list item
Removed edited icons, merged changes in a new branch
Set color of hamburger icon
Replaced some icons by Material ones to (removed useless icons)
Fix setting background if change manualy dark theme (And remove duplication)
Changed Drawer and global texts colors
Reformat ThemeUtils
Black Status bar in light theme <23 api
Refactor and fix bug
Change font color for darkmode and remove unused code
Refactor
New color, white for light theme and grey for dark theme. New progressbar
Fixed bug relative to inflating (due to < API 21)
Start files sync job when enabling auto upload
Migrate file sync related jobs to WorkManager API
Replaced colors by native Android ones
Update translations
2020-04-29 03:37:24 +02:00
Tobias Kaminsky 5858f68878 Merge remote-tracking branch 'origin/master' into dev 2020-04-29 03:30:49 +02:00
Tobias Kaminsky c1396fd3b8 daily dev 20200425
Update translations
2020-04-25 03:37:28 +02:00
Tobias Kaminsky 46f0880b83 Merge remote-tracking branch 'origin/master' into dev 2020-04-25 03:30:55 +02:00
Tobias Kaminsky 8b9147ac4a daily dev 20200424
Switch to bouncycastle
Update translations
2020-04-24 03:41:00 +02:00
Tobias Kaminsky 4653f10957 Merge remote-tracking branch 'origin/master' into dev 2020-04-24 03:31:09 +02:00
Tobias Kaminsky 894b4b0977 daily dev 20200423
Formated the code (applied DRY principle)
Resolved the crash when account is not new (Auth)
refactorings
close SSO streams
Update translations
2020-04-23 03:39:51 +02:00
Tobias Kaminsky 1a473b6f6e Merge remote-tracking branch 'origin/master' into dev 2020-04-23 03:31:03 +02:00
Tobias Kaminsky fde2de08e0 daily dev 20200422
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-04-22 03:41:23 +02:00
Tobias Kaminsky f53e509085 Merge remote-tracking branch 'origin/master' into dev 2020-04-22 03:32:05 +02:00
Tobias Kaminsky d37e0e8254 Merge remote-tracking branch 'origin/master' into dev 2020-04-21 03:33:10 +02:00
Tobias Kaminsky c0e80d5ebd daily dev 20200417
code formatting
Make the name collision policy for auto uploads selectable, fixes #5599.
Release connections after usage
[FIX: #5752] Upload files: too much whitespace
Readd enableAccountHandling for show slider
Update 3rd-party dependencies
2020-04-17 03:41:33 +02:00
Tobias Kaminsky f22a7c70b3 Merge remote-tracking branch 'origin/master' into dev 2020-04-17 03:30:56 +02:00
Tobias Kaminsky 8a5d4bec67 daily dev 20200416
fix https://github.com/nextcloud/android/issues/5457
Update translations
2020-04-16 03:38:24 +02:00
Tobias Kaminsky 766b7c755a Merge remote-tracking branch 'origin/master' into dev 2020-04-16 03:30:53 +02:00
Tobias Kaminsky 6c889e62cb daily dev 20200415
Don't put User model into ConflictsResolveActivity account extra
show all files when clicking on show files
Update translations
Update Nextcloud Android library
2020-04-15 03:40:19 +02:00
Tobias Kaminsky 7f3ca4fa9f Merge remote-tracking branch 'origin/master' into dev 2020-04-15 03:32:45 +02:00
Tobias Kaminsky e53d40a4e3 daily dev 20200410
Fix OOM during image browsing
Do not tint dialog
Migrate FileDownloader server to User model
2020-04-10 03:37:11 +02:00
Tobias Kaminsky bf7e13efbf Merge remote-tracking branch 'origin/master' into dev 2020-04-10 03:30:52 +02:00
Tobias Kaminsky 7a9e67e788 daily dev 20200409
Log exception in ContactsImportWork catch block
codacy: Avoid unused local variables
codacy: Avoid unused method parameters
reformat code
codacy: Unnecessary use of fully qualified name
codacy: Avoid unused private fields
codacy: Avoid unused imports
check if at least one account is set up, before receiving files
Change pdf icon
Directly show loading spinner show "no files" only if folder is known to be empty
Fix crash while showing ConflictDialog
Rich workspaces: can be null (if disabled), or string (empty or with content)
Search: only parse search if search event is there
NC18+: add possibility to set expiration date on user/group shares
Ninja-fix formatting of CONTRIBUTING.md
Migrate contacts import job to new API
Migrate ChooseRichDocumentsTemplateDialogFragment to User
Migrate EditShareFragment to new User model
Remove deprecated contacts backup job
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-04-09 03:39:02 +02:00
Tobias Kaminsky fbfefd5235 Merge remote-tracking branch 'origin/master' into dev 2020-04-09 03:30:53 +02:00
Tobias Kaminsky 535624264c Merge remote-tracking branch 'origin/master' into dev 2020-04-08 03:32:01 +02:00
Tobias Kaminsky a7bf4aa581 daily dev 20200405
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-04-05 03:38:20 +02:00
Tobias Kaminsky 67e2fee514 Merge remote-tracking branch 'origin/master' into dev 2020-04-05 03:30:56 +02:00
Tobias Kaminsky 7d2d48f1c6 Merge remote-tracking branch 'origin/master' into dev 2020-04-04 03:32:38 +02:00
Tobias Kaminsky 7f47effb34 daily dev 20200403
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-04-03 03:39:12 +02:00
Tobias Kaminsky 7651a9df83 Merge remote-tracking branch 'origin/master' into dev 2020-04-03 03:30:54 +02:00
Tobias Kaminsky d66a60e6af Merge remote-tracking branch 'origin/master' into dev 2020-04-02 03:34:12 +02:00
Tobias Kaminsky 697d660d42 daily dev 20200331
if no offline editor is available, use OO/Cool/Text
edit downloaded md/text file is working now
First use preferred mimetypes, then editor for optional mimetypes
Update translations
Update 3rd-party dependencies
2020-03-31 03:38:56 +02:00
Tobias Kaminsky c45ae25414 Merge remote-tracking branch 'origin/master' into dev 2020-03-31 03:30:55 +02:00
Tobias Kaminsky 14d6e473a3 daily dev 20200327
Changelog for 3.11.0
Add changelog for 3.11.0
Update translations
2020-03-27 03:37:11 +01:00
Tobias Kaminsky 46051694fe Merge remote-tracking branch 'origin/master' into dev 2020-03-27 03:30:50 +01:00
Tobias Kaminsky 44793c2ba7 daily dev 20200325
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-03-25 03:42:24 +01:00
Tobias Kaminsky 9caa4ab460 Merge remote-tracking branch 'origin/master' into dev 2020-03-25 03:32:41 +01:00
Tobias Kaminsky 42f5469afc daily dev 20200324
Bump to latest firebase messaging
fix activity image loading
Update translations
Update 3rd-party dependencies
2020-03-24 03:38:55 +01:00
Tobias Kaminsky 0b19e2129d Merge remote-tracking branch 'origin/master' into dev 2020-03-24 03:30:51 +01:00
Tobias Kaminsky 796db9d195 daily dev 20200323
Fix for sso Grant/Deny dialog text color in dark mode.
Wrong string
Update translations
2020-03-23 03:37:18 +01:00
Tobias Kaminsky bc2a0725ac Merge remote-tracking branch 'origin/master' into dev 2020-03-23 03:30:52 +01:00
Tobias Kaminsky 78f1289cd5 daily dev 20200320
revert to master lib
Add circle support for searching / displaying
Fixes "Report a bug" button in community tab
Adjusted file list banner background colour in dark mode
Tint buttons in upload
Dark Mode Improvements
fix lint to exclude correct freemarker version
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-03-20 03:40:13 +01:00
Tobias Kaminsky 1227572edd Merge remote-tracking branch 'origin/master' into dev 2020-03-20 03:32:19 +01:00
Tobias Kaminsky f8428a0d1f daily dev 20200319
remove outdated background for dev
Update translations
2020-03-19 03:37:09 +01:00
Tobias Kaminsky 5f30815410 Merge remote-tracking branch 'origin/master' into dev 2020-03-19 03:30:50 +01:00
Tobias Kaminsky e568054e94 daily dev 20200318
fix wrong assumption how conflict dialog show work updated tests
Update translations
Update Nextcloud Android library
Update 3rd-party dependencies
2020-03-18 03:37:22 +01:00
Tobias Kaminsky 0c051fd72b Merge remote-tracking branch 'origin/master' into dev 2020-03-18 03:30:52 +01:00
Tobias Kaminsky 3f1dfed3a8 Merge remote-tracking branch 'origin/master' into dev 2020-03-17 03:32:02 +01:00
Tobias Kaminsky 0c7bec049f daily dev 20200313
Migrate contacts backup job to new background job manager API
add gradient to preview images in toolbar
fix crash when sorting in folder picker
remove unneeded ressource
adjust share size
Correct font color in dark mode
tint back button correctly
Update translations
2020-03-13 03:37:10 +01:00
Tobias Kaminsky f36ac479a8 Merge remote-tracking branch 'origin/master' into dev 2020-03-13 03:30:52 +01:00
Tobias Kaminsky 510c6c26e8 daily dev 20200312
v3.12.-Alpha1
Fix border of disabled FAB
Update translations
Update Nextcloud Android library
2020-03-12 03:39:22 +01:00
Tobias Kaminsky 909c9606ce Merge remote-tracking branch 'origin/master' into dev 2020-03-12 03:31:58 +01:00
Tobias Kaminsky 4923a8efa7 daily dev 20200311
All files shows root again annotated functions with correct NonNull
Improve readability on active drawer item
Use UTF8 PostMethod everywhere
Update contributing.md
Update translations
2020-03-11 03:36:49 +01:00
Tobias Kaminsky 3e741eee31 Merge remote-tracking branch 'origin/master' into dev 2020-03-11 03:30:50 +01:00
Tobias Kaminsky 99e3843427 daily dev 20200310
Fix NPE on restoring file detail sharing fragment
Update translations
2020-03-10 03:36:51 +01:00
Tobias Kaminsky 3996901d7c Merge remote-tracking branch 'origin/master' into dev 2020-03-10 03:30:50 +01:00
Tobias Kaminsky c09264bc0f daily dev 20200307
remove unused dimens value
remove unneeded call
use correct dimens id
remove sdk17 checks
Remove outdated right/left as now only start/end is needed
change minimum supported Android version to 4.2
Properly signal error when user id migration fails
Enabled migration manager in MainApp
Removed MigrationManager Robolectric tests
Support for optional migrations
Migrations manager
remove ununsed raw files
remove unused class
Update translations
Update 3rd-party dependencies
2020-03-07 03:38:14 +01:00
Tobias Kaminsky 4f7fd16470 Merge remote-tracking branch 'origin/master' into dev 2020-03-07 03:30:49 +01:00
Tobias Kaminsky d19e9e0556 daily dev 20200306
Fix test
Update Nextcloud Android library
Update 3rd-party dependencies
2020-03-06 03:41:32 +01:00
Tobias Kaminsky 56d7169ca2 Merge remote-tracking branch 'origin/master' into dev 2020-03-06 03:32:20 +01:00
Tobias Kaminsky 3a77d8071d daily dev 20200305
update dev changelog recognition for updating library
Update translations
Update Nextcloud Android library
2020-03-05 07:27:09 +01:00
Tobias Kaminsky a65b208355 Merge remote-tracking branch 'origin/master' into dev 2020-03-05 07:19:03 +01:00
Tobias Kaminsky 0f0173ccf3 Merge remote-tracking branch 'origin/master' into dev 2020-03-05 03:32:28 +01:00
Tobias Kaminsky 8c2c38d916 daily dev 20200304
switch back to light mode after test
remove unneeded strings
Disable old login method
Update Nextcloud Android library
2020-03-04 03:37:34 +01:00
Tobias Kaminsky 4f0bf90433 Merge remote-tracking branch 'origin/master' into dev 2020-03-04 03:30:48 +01:00
Tobias Kaminsky bd01843be7 daily dev 20200303
fix dev lib replacement
dev: change library before building
Show slideshow as new activity
Update translations
Update Nextcloud Android library
2020-03-03 07:35:01 +01:00
Tobias Kaminsky d5fe7679da Merge remote-tracking branch 'origin/master' into dev 2020-03-03 07:26:42 +01:00
Tobias Kaminsky be11180ca9 Merge remote-tracking branch 'origin/master' into dev 2020-03-03 03:32:22 +01:00
Tobias Kaminsky 9938f2e421 daily dev 20200228
3facd6c20 Merge remote-tracking branch 'origin/master' into dev
d88dac628 Merge pull request #5536 from nextcloud/changeFolderString
42d1dafaf Change to better english
43dfa7a77 Merge pull request #5528 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.6.0
4481af43f Merge pull request #5529 from nextcloud/dependabot/gradle/org.mockito-mockito-core-3.3.1
36dbdf5f6 Merge pull request #5527 from nextcloud/dependabot/gradle/markwonVersion-4.2.2
cd893c685 Bump mockito-core from 3.3.0 to 3.3.1
8b14e8a8b Bump detekt-gradle-plugin from 1.5.1 to 1.6.0
82d0ad98d Bump markwonVersion from 4.2.1 to 4.2.2
eb94a66b2 [tx-robot] updated from transifex
543e25667 [tx-robot] updated from transifex
97c53b38c daily dev 20200225
2020-02-28 03:41:00 +01:00
Tobias Kaminsky 3facd6c200 Merge remote-tracking branch 'origin/master' into dev 2020-02-28 03:32:21 +01:00
Tobias Kaminsky 97c53b38ce daily dev 20200225
d7febee4f Merge remote-tracking branch 'origin/master' into dev
a163321fa Merge pull request #5511 from nextcloud/dependabot/gradle/org.mockito-mockito-core-3.3.0
6ab91c959 [tx-robot] updated from transifex
68d6fe555 daily dev 20200224
2020-02-25 03:39:00 +01:00
Tobias Kaminsky d7febee4fa Merge remote-tracking branch 'origin/master' into dev 2020-02-25 03:32:22 +01:00
Tobias Kaminsky 68d6fe5557 daily dev 20200224
f782e3d9f Merge remote-tracking branch 'origin/master' into dev
c6bb9744e Merge pull request #5498 from nextcloud/stableMaterial
0b90250b6 [tx-robot] updated from transifex
7b049a99d [tx-robot] updated from transifex
70471b623 [tx-robot] updated from transifex
bdaaf63fc [tx-robot] updated from transifex
1cc383df2 daily dev 20200222
2020-02-24 03:37:29 +01:00
Tobias Kaminsky f782e3d9fd Merge remote-tracking branch 'origin/master' into dev 2020-02-24 03:30:48 +01:00
Tobias Kaminsky 1cc383df2a daily dev 20200222
84cef3baf Merge remote-tracking branch 'origin/master' into dev
e1b8d525e Merge pull request #5445 from nextcloud/headMethod
92f5e07b9 [tx-robot] updated from transifex
de4fc2cd2 daily dev 20200221
2020-02-22 03:37:31 +01:00
Tobias Kaminsky 84cef3bafc Merge remote-tracking branch 'origin/master' into dev 2020-02-22 03:30:46 +01:00
Tobias Kaminsky de4fc2cd2b daily dev 20200221
9b3f00c12 Merge remote-tracking branch 'origin/master' into dev
da6a29a51 Merge pull request #5493 from nextcloud/dependabot/gradle/androidx.work-work-runtime-ktx-2.3.2
2356e839d Bump work-runtime-ktx from 2.3.1 to 2.3.2
7305272bd Merge pull request #5494 from nextcloud/dependabot/gradle/androidx.work-work-runtime-2.3.2
be238a3f9 Merge pull request #5471 from nextcloud/richWorkspace18only
65548c4b4 [tx-robot] updated from transifex
ac6a64b67 Drone: update Lint results to reflect reduced error/warning count [skip ci]
993aa4afb Bump work-runtime from 2.3.0 to 2.3.2
0f1da5238 [tx-robot] updated from transifex
26bbfa353 daily dev 20200219
2020-02-21 03:37:48 +01:00
Tobias Kaminsky 9b3f00c12d Merge remote-tracking branch 'origin/master' into dev 2020-02-21 03:30:48 +01:00
Tobias Kaminsky 26bbfa3538 daily dev 20200219
3f62afabf Merge remote-tracking branch 'origin/master' into dev
5d428fe9a Merge pull request #4788 from nextcloud/instantupload_all
49f3a6725 ConflictsResolveActivity: code style and readability improvements
6540e3ef7 Upload list conflicts: replace trash icon with menu and add resolve action
a4ff1f11d Customize upload sync conflict notification strings
e77ffa00a Fix synced folder layout form control widgets alignment
91ef307e7 Fix database migration of field forceOverwrite to NameCollisionPolicy
52d089b18 FileUploader: fix codacy issues and SpotBugs
ec27f840a FileUploader: code cleanup
7713a28a4 FileUploader: require explicit NameCollisionPolicy and change default used value
6783e8ab4 Make file uploads ask the user what to do when the file already exists on remote
213002f44 Make newly created synced folders auto upload existing files by default
1b7bd72c4 ADD: [instantupload] setting to also upload existing files
c24345316 Merge pull request #5465 from nextcloud/fix/create-folder-crash-autosync
d178cde22 daily dev 20200218
2020-02-19 03:37:25 +01:00
Tobias Kaminsky 3f62afabf6 Merge remote-tracking branch 'origin/master' into dev 2020-02-19 03:30:48 +01:00
Tobias Kaminsky d178cde220 daily dev 20200218
2b26a5176 Merge remote-tracking branch 'origin/master' into dev
4616b0d40 Merge pull request #5447 from nextcloud/ezaquarii/migrate-jobs-to-new-user-model
20b910a64 Merge pull request #5442 from nextcloud/ezaquarii/fix-crash-on-text-file-creation
0977c3791 Fix crash during text file creation
5c74f2b1b [tx-robot] updated from transifex
27fabe745 [tx-robot] updated from transifex
60295480b daily dev 20200215
2020-02-18 03:37:38 +01:00
Tobias Kaminsky 2b26a5176a Merge remote-tracking branch 'origin/master' into dev 2020-02-18 03:30:49 +01:00
Tobias Kaminsky 60295480b5 daily dev 20200215
020e5a2c3 Merge remote-tracking branch 'origin/master' into dev
490b292ad Merge pull request #5300 from nextcloud/sharedSearchAgain
61027524f test
af93382c6 test
68f06ea15 [tx-robot] updated from transifex
2d82f80e9 daily dev 20200214
2020-02-15 03:37:26 +01:00
Tobias Kaminsky 020e5a2c3b Merge remote-tracking branch 'origin/master' into dev 2020-02-15 03:30:49 +01:00
Tobias Kaminsky 2d82f80e9c daily dev 20200214
706ae93a3 Merge remote-tracking branch 'origin/master' into dev
045a7aa9e Merge pull request #5466 from nextcloud/squareIcon
eefeda930 Add square google icon
7156aaff2 [tx-robot] updated from transifex
57ce989a5 daily dev 20200213
2020-02-14 03:38:38 +01:00
Tobias Kaminsky 706ae93a32 Merge remote-tracking branch 'origin/master' into dev 2020-02-14 03:31:56 +01:00
Tobias Kaminsky 57ce989a5a daily dev 20200213
23fea78a9 Merge remote-tracking branch 'origin/master' into dev
67880e275 Merge pull request #5450 from nextcloud/etmScreenshots
a063f32d2 Merge pull request #5434 from nextcloud/ezaquarii/migrate-account-list-to-new-user-model
d841f6425 Screenshot tests for ETM
0569b0de6 Screenshot tests ManageAccountsActivity
53024d1cd Migrate account list to new user model
e716c99a9 [tx-robot] updated from transifex
1dd355dde daily dev 20200212
2020-02-13 03:37:26 +01:00
Tobias Kaminsky 23fea78a96 Merge remote-tracking branch 'origin/master' into dev 2020-02-13 03:30:48 +01:00
Tobias Kaminsky 1dd355ddec daily dev 20200212
e1d684255 Merge remote-tracking branch 'origin/master' into dev
f520f2f9a Merge pull request #5436 from nextcloud/ezaquarii/make-user-model-parcelable
25cbeb4bd Merge pull request #5422 from nextcloud/gplayScreenshots
87eb8e0d1 [tx-robot] updated from transifex
644b91dce daily dev 20200211
2020-02-12 03:37:18 +01:00
Tobias Kaminsky e1d6842552 Merge remote-tracking branch 'origin/master' into dev 2020-02-12 03:30:48 +01:00
Tobias Kaminsky 644b91dce0 daily dev 20200211
92ddf10d0 Merge remote-tracking branch 'origin/master' into dev
5905b1c5a Merge pull request #5432 from nextcloud/ezaquarii/migrate-drawer-menu-utils-to-new-user-model
4be18adc2 Merge pull request #5064 from nextcloud/ezaquarii/extract-account-logic-from-base-activity-into-mixin
619b5d05d Merge pull request #5419 from nextcloud/dependabot/gradle/org.projectlombok-lombok-1.18.12
2d6e73dd3 Merge pull request #5414 from nextcloud/fixContactCrash
1bb04aa29 also increase annotationProcessor
6048243f4 Fix crash: Caused by: java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.lang.Void[]
0027df9d0 [tx-robot] updated from transifex
6dd5d925a Merge pull request #5443 from nextcloud/fixTransifex
b4db9d07a do not break line on transifex
b5fb9c137 Migrate drawer menu utilities to new user model
a906a14b1 daily dev 20200208
2020-02-11 03:38:43 +01:00
Tobias Kaminsky 92ddf10d07 Merge remote-tracking branch 'origin/master' into dev 2020-02-11 03:31:51 +01:00
Tobias Kaminsky a906a14b15 daily dev 20200208
66c25fa25 Merge remote-tracking branch 'origin/master' into dev
f415cd966 Merge pull request #5420 from nextcloud/dependabot/gradle/org.parceler-parceler-1.1.13
2b2800bc7 Bump parceler from 1.1.12 to 1.1.13
98d751880 Merge pull request #5418 from nextcloud/dependabot/gradle/org.parceler-parceler-api-1.1.13
8ce35e3f5 manually bump lint
6fbe0b595 daily dev 20200207
2020-02-08 03:38:35 +01:00
Tobias Kaminsky 66c25fa255 Merge remote-tracking branch 'origin/master' into dev 2020-02-08 03:31:55 +01:00
Tobias Kaminsky 6fbe0b5952 daily dev 20200207
ad21ad34c Merge remote-tracking branch 'origin/master' into dev
b13cba02c Merge pull request #5412 from nextcloud/dependabot/gradle/androidx.work-work-runtime-ktx-2.3.1
dc1a3f1f0 Drone: update Lint results to reflect reduced error/warning count [skip ci]
aa3727e03 Bump work-runtime-ktx from 2.3.0 to 2.3.1
7dbf43b2f Merge pull request #5413 from nextcloud/lint
4a1e1b1ca Bump to "Obsolete custom lint check"
f18b9363a daily dev 20200206
2020-02-07 03:37:51 +01:00
Tobias Kaminsky ad21ad34cd Merge remote-tracking branch 'origin/master' into dev 2020-02-07 03:30:48 +01:00
Tobias Kaminsky f18b9363ad daily dev 20200206
ac971ae36 Merge remote-tracking branch 'origin/master' into dev
94abac7f7 Merge pull request #5403 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.5.1
8890770fb Bump detekt-gradle-plugin from 1.5.0 to 1.5.1
823808e37 Merge pull request #5407 from nextcloud/changelog-master-stable-3.10.1
c7669fe9d Merge pull request #5393 from nextcloud/removeUnsetType
e8d00fd81 proper headline formatting
c5be0ad7e Merge pull request #5399 from nextcloud/extractArbitraryDataSet
a0de3e5ad Add changelog for 3.10.1
0936945b3 Merge pull request #5328 from nextcloud/fix/not-enough-space-dialog
c7d2b0e80 Merge pull request #5404 from nextcloud/uploadReportVerbose
7e4711a23 github comment if preliminary step failed
778fec9e2 extract openDrawer test into AbstractIT rebased
3a78c1b9d add more UI tests
e118f9a51 Remove UnsetType as we do not have bottom bar anymore…
c7ea6458b extract ArbitraryDataSet class cleanup
7c84a9f92 Merge pull request #5296 from nextcloud/fix/defective-search
f9a47e6b3 Formated the code
c64e90e8c Merge pull request #5401 from nextcloud/needlesslyBoxing
84adb9eaa Merge pull request #5400 from nextcloud/rakekniven-patch-1
0d0a4a319 Drone: update FindBugs results to reflect reduced error/warning count [skip ci]
d7918c59c Merge commit '1bf079d2cd85fe4770716bbf02790651290d66c1'
1bf079d2c NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION: Method needlessly boxes a boolean constant
e19b58178 l10n: Grammar: url -> URL
75c0871e6 Merge pull request #5395 from nextcloud/dependabot/gradle/org.greenrobot-eventbus-3.2.0
ebba5ea4e Merge pull request #5396 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.5.0
a2e327bdc [tx-robot] updated from transifex
a5d0fe936 daily dev 20200205
2020-02-06 03:39:07 +01:00
Tobias Kaminsky ac971ae36d Merge remote-tracking branch 'origin/master' into dev 2020-02-06 03:30:48 +01:00
Tobias Kaminsky a5d0fe9362 daily dev 20200205
4ce26101b Merge remote-tracking branch 'origin/master' into dev
f9af611a2 Merge pull request #4878 from nextcloud/ezaquarii/contributions-engineering-practices-section
fab19e8f7 minor enhancements
460389579 Added TOC links and Engineering section to CONTRIBUTING.md
f7d7a0c7a Merge pull request #5378 from nextcloud/dependabot/gradle/markwonVersion-4.2.1
f7220f461 Merge pull request #5246 from siebica/master
3d5a40fa0 Merge pull request #5169 from nextcloud/dependabot/gradle/io.gitlab.arturbosch.detekt-detekt-gradle-plugin-1.4.0
eb903ab48 add UI test for Markdown
64c253be6 Merge pull request #5089 from cheecodes/master
ff400e16b [tx-robot] updated from transifex
55f6aebab daily dev 20200204
2020-02-05 03:39:11 +01:00
Tobias Kaminsky 4ce26101b0 Merge remote-tracking branch 'origin/master' into dev 2020-02-05 03:30:47 +01:00
Tobias Kaminsky 55f6aebabf daily dev 20200204
c9d3605ec Merge remote-tracking branch 'origin/master' into dev
5d868e47f Merge pull request #5363 from nextcloud/fix/lolipop-webview-crash
0c272ad1d Merge pull request #5231 from nextcloud/roundedCorners
b787284ab bump spotbugs
6e202dd94 Merge pull request #5383 from nextcloud/whitePrimaryColor
66b78e0eb changed to 8dp
5ac25d545 remove unneeded resource
176c7f893 Merge pull request #5382 from nextcloud/prLineWrapping
120a6ca87 PR template: line wrapping
81c3bcef3 Merge pull request #5381 from nextcloud/movePRtemplate
622f1f9f6 move pr template
f8ff0e106 Auth activity with primary white color
aeee4beba [tx-robot] updated from transifex
d60133bb8 [tx-robot] updated from transifex
c3be96884 [tx-robot] updated from transifex
489b5e051 daily dev 20200201
2020-02-04 03:38:36 +01:00
Tobias Kaminsky c9d3605ec2 Merge remote-tracking branch 'origin/master' into dev 2020-02-04 03:31:42 +01:00
Tobias Kaminsky 489b5e0514 daily dev 20200201
158d06112 Merge remote-tracking branch 'origin/master' into dev
9c12102d2 Merge pull request #5360 from nextcloud/testDocumentation
b8d042e17 Basic documentation of how to test add checklist as PR template
e617e5708 Merge pull request #5358 from nextcloud/transifexFix
73697963c [tx-robot] updated from transifex
bd99ee995 No need of CDATA
a8409b3aa daily dev 20200131
2020-02-01 03:37:14 +01:00
Tobias Kaminsky 158d061127 Merge remote-tracking branch 'origin/master' into dev 2020-02-01 03:30:44 +01:00
Tobias Kaminsky a8409b3aa8 daily dev 20200131
d93f893b6 Merge remote-tracking branch 'origin/master' into dev
8dc162960 Merge pull request #5209 from nextcloud/ooDownloadFile
7f558a14a Merge pull request #5352 from nextcloud/dependabot/gradle/daggerVersion-2.26
613c24220 daily dev 20200130
2020-01-31 03:37:21 +01:00
Tobias Kaminsky d93f893b6b Merge remote-tracking branch 'origin/master' into dev 2020-01-31 03:30:42 +01:00
Tobias Kaminsky 613c242205 daily dev 20200130
edc6198f2 daily dev 20200129
0c3c286c0 Merge remote-tracking branch 'origin/master' into dev
4a9fc087a Merge pull request #5349 from nextcloud/devBranchMigration
cfb830668 dev: do not modify master, but push everything to dev branch
e03b819ef daily dev 20200129
2020-01-30 03:37:27 +01:00
Tobias Kaminsky edc6198f29 daily dev 20200129
0c3c286c0 Merge remote-tracking branch 'origin/master' into dev
4a9fc087a Merge pull request #5349 from nextcloud/devBranchMigration
cfb830668 dev: do not modify master, but push everything to dev branch
e03b819ef daily dev 20200129
2020-01-29 08:52:36 +01:00
Tobias Kaminsky 0c3c286c0a Merge remote-tracking branch 'origin/master' into dev 2020-01-29 08:45:22 +01:00
Tobias Kaminsky 7aab6137be daily dev 20200124
e4f099237 Merge pull request #5203 from nextcloud/directEditingPre5
04b5b6ae3 Merge pull request #5288 from nextcloud/dependabot/gradle/androidx.work-work-runtime-2.3.0
fc8c9b7bb Bump work-runtime from 2.2.0 to 2.3.0
63b5276c8 Merge pull request #5289 from nextcloud/dependabot/gradle/androidx.lifecycle-lifecycle-viewmodel-ktx-2.2.0
ed2e90bf3 Merge pull request #5286 from nextcloud/dependabot/gradle/androidx.work-work-runtime-ktx-2.3.0
ce6ce0663 [tx-robot] updated from transifex
b62d29194 Bump lifecycle-viewmodel-ktx from 2.1.0 to 2.2.0
d42566be7 Bump work-runtime-ktx from 2.2.0 to 2.3.0
f783eed9b [tx-robot] updated from transifex
642682b21 daily dev 20200122
2020-01-24 03:38:01 +01:00
230 changed files with 5504 additions and 563 deletions

No files matched your search

+6 -2
View File
@@ -56,6 +56,8 @@ steps:
services:
- name: server
image: nextcloudci/server:server-17 # also change in updateScreenshots.sh
environment:
EVAL: true
commands:
- BRANCH='stable18' /usr/local/bin/initnc.sh
- echo 127.0.0.1 server >> /etc/hosts
@@ -138,6 +140,8 @@ steps:
services:
- name: server
image: nextcloudci/server:server-17 # also change in updateScreenshots.sh
environment:
EVAL: true
commands:
- /usr/local/bin/initnc.sh
- echo 127.0.0.1 server >> /etc/hosts
@@ -188,7 +192,7 @@ steps:
- ./gradlew assembleGplayDebug
- scripts/wait_for_emulator.sh
- ./gradlew installGplayDebugAndroidTest
- ./gradlew gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest && scripts/deleteOutdatedComments.sh "stable" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- scripts/runAllScreenshotCombinations "stable" false
- name: notify
image: drillster/drone-email
settings:
@@ -243,7 +247,7 @@ steps:
- scripts/wait_for_emulator.sh
- ./gradlew installGplayDebugAndroidTest
- sed -i s"#5#1#" ./src/androidTest/java/com/nextcloud/client/RetryTestRule.kt
- ./gradlew gplayDebugExecuteScreenshotTests -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest && scripts/deleteOutdatedComments.sh "master" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "master" "Screenshot" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
- scripts/runAllScreenshotCombinations "master" false
- name: notify
image: drillster/drone-email
settings:
+2
View File
@@ -47,3 +47,5 @@ fastlane/Fastfile
# scan temporary files
**/fastlane/test_output
/fastlane/vendor/
/.bundle/
+1
View File
@@ -379,6 +379,7 @@ Generally, whenever you need:
* media playback
* networking
* logging
* notifications management
we have something more suitable.
+10
View File
@@ -0,0 +1,10 @@
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!
source "https://rubygems.org"
gem 'fastlane'
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
+180
View File
@@ -0,0 +1,180 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.2)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
atomos (0.1.3)
aws-eventstream (1.1.0)
aws-partitions (1.343.0)
aws-sdk-core (3.104.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.36.0)
aws-sdk-core (~> 3, >= 3.99.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.75.0)
aws-sdk-core (~> 3, >= 3.104.1)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.2.1)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.3)
claide (1.0.3)
colored (1.2)
colored2 (3.1.2)
commander-fastlane (4.4.6)
highline (~> 1.7.2)
declarative (0.0.20)
declarative-option (0.1.0)
digest-crc (0.6.1)
rake (~> 13.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
emoji_regex (3.0.0)
excon (0.75.0)
faraday (0.17.3)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
faraday (>= 0.7.4)
http-cookie (~> 1.0.0)
faraday_middleware (0.14.0)
faraday (>= 0.7.4, < 1.0)
fastimage (2.1.7)
fastlane (2.152.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
aws-sdk-s3 (~> 1.0)
babosa (>= 1.0.3, < 2.0.0)
bundler (>= 1.12.0, < 3.0.0)
colored
commander-fastlane (>= 4.4.6, < 5.0.0)
dotenv (>= 2.1.1, < 3.0.0)
emoji_regex (>= 0.1, < 4.0)
excon (>= 0.71.0, < 1.0.0)
faraday (>= 0.17, < 1.0)
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (>= 0.13.1, < 2.0)
fastimage (>= 2.1.0, < 3.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-api-client (>= 0.37.0, < 0.39.0)
google-cloud-storage (>= 1.15.0, < 2.0.0)
highline (>= 1.7.2, < 2.0.0)
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
multipart-post (~> 2.0.0)
plist (>= 3.1.0, < 4.0.0)
rubyzip (>= 2.0.0, < 3.0.0)
security (= 0.1.3)
simctl (~> 1.6.3)
slack-notifier (>= 2.0.0, < 3.0.0)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-huawei_appgallery_connect (1.0.9)
gh_inspector (1.1.3)
google-api-client (0.38.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.9)
httpclient (>= 2.8.1, < 3.0)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
signet (~> 0.12)
google-cloud-core (1.5.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
google-cloud-env (1.3.3)
faraday (>= 0.17.3, < 2.0)
google-cloud-errors (1.0.1)
google-cloud-storage (1.26.2)
addressable (~> 2.5)
digest-crc (~> 0.4)
google-api-client (~> 0.33)
google-cloud-core (~> 1.2)
googleauth (~> 0.9)
mini_mime (~> 1.0)
googleauth (0.13.0)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (~> 0.14)
highline (1.7.10)
http-cookie (1.0.3)
domain_name (~> 0.5)
httpclient (2.8.3)
jmespath (1.4.0)
json (2.3.1)
jwt (2.2.1)
memoist (0.16.2)
mini_magick (4.10.1)
mini_mime (1.0.2)
multi_json (1.15.0)
multipart-post (2.0.0)
nanaimo (0.3.0)
naturally (2.2.0)
os (1.1.0)
plist (3.5.0)
public_suffix (4.0.5)
rake (13.0.1)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rouge (2.0.7)
rubyzip (2.3.0)
security (0.1.3)
signet (0.14.0)
addressable (~> 2.3)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.8)
CFPropertyList
naturally
slack-notifier (2.3.2)
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
tty-cursor (0.7.1)
tty-screen (0.8.1)
tty-spinner (0.9.3)
tty-cursor (~> 0.7)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
word_wrap (1.0.0)
xcodeproj (1.17.1)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.0)
xcpretty (~> 0.2, >= 0.0.7)
PLATFORMS
ruby
DEPENDENCIES
fastlane
fastlane-plugin-huawei_appgallery_connect
BUNDLED WITH
2.1.4
+26 -13
View File
@@ -59,10 +59,10 @@ configurations {
ext {
jacocoVersion = "0.8.2"
daggerVersion = "2.28.1"
daggerVersion = "2.28.3"
markwonVersion = "4.4.0"
prismVersion = "2.0.0"
androidLibraryVersion = "master-SNAPSHOT"
androidLibraryVersion ="b313e2708597dfbcc1733277450d23831821f649"
travisBuild = System.getenv("TRAVIS") == "true"
@@ -171,8 +171,8 @@ android {
versionDev {
applicationId "com.nextcloud.android.beta"
dimension "default"
versionCode 20200129
versionName "20200129"
versionCode 20200730
versionName "20200730"
}
qa {
@@ -293,8 +293,8 @@ dependencies {
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.2.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation "androidx.work:work-runtime:2.3.4"
implementation "androidx.work:work-runtime-ktx:2.3.4"
implementation "androidx.work:work-runtime:2.4.0"
implementation "androidx.work:work-runtime-ktx:2.4.0"
implementation "androidx.fragment:fragment:1.2.5"
implementation 'com.github.albfernandez:juniversalchardet:2.0.3' // need this version for Android <7
compileOnly 'com.google.code.findbugs:annotations:2.0.1'
@@ -320,7 +320,8 @@ dependencies {
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.github.cotechde.hwsecurity:hwsecurity-fido:2.5.1'
implementation 'com.github.cotechde.hwsecurity:hwsecurity-fido:4.1.0'
implementation 'com.github.cotechde.hwsecurity:hwsecurity-fido2:4.1.0'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.10.1'
spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.7'
@@ -350,14 +351,16 @@ dependencies {
// dependencies for local unit tests
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:3.4.2'
testImplementation 'org.mockito:mockito-core:3.4.4'
testImplementation 'androidx.test:core:1.2.0'
testImplementation 'org.powermock:powermock-core:2.0.7'
testImplementation 'org.powermock:powermock-module-junit4:2.0.7'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.7'
testImplementation 'org.json:json:20200518'
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
testImplementation "androidx.arch.core:core-testing:2.1.0"
testImplementation 'androidx.arch.core:core-testing:2.1.0'
testImplementation 'io.mockk:mockk:1.10.0'
testImplementation 'io.mockk:mockk-android:1.10.0'
// dependencies for instrumented tests
// JUnit4 Rules
@@ -370,7 +373,20 @@ dependencies {
// Espresso core
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
androidTestImplementation 'org.mockito:mockito-core:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.2.0'
// Mocking support
androidTestImplementation 'com.github.tmurakami:dexopener:2.0.5' // required to allow mocking on API 27 and older
androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
androidTestImplementation 'org.mockito:mockito-core:3.4.4'
androidTestImplementation("org.mockito:mockito-android:3.4.4") {
exclude group: "net.bytebuddy", module: "byte-buddy-android"
}
androidTestImplementation 'net.bytebuddy:byte-buddy:1.10.13'
androidTestImplementation "net.bytebuddy:byte-buddy-android:1.10.13"
androidTestImplementation "io.mockk:mockk-android:1.10.0"
androidTestImplementation 'androidx.arch.core:core-testing:2.0.1'
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
// androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
// fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
@@ -388,9 +404,6 @@ dependencies {
// androidJacocoAnt "org.jacoco:org.jacoco.agent:${jacocoVersion}"
implementation "com.github.stateless4j:stateless4j:2.6.0"
androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
androidTestImplementation "org.mockito:mockito-android:3.4.2"
androidTestImplementation 'net.bytebuddy:byte-buddy:1.10.13'
}
spotbugs {
+6 -6
View File
@@ -83,14 +83,14 @@ complexity:
ignoreStringsRegex: '$^'
TooManyFunctions:
active: true
thresholdInFiles: 11
thresholdInClasses: 11
thresholdInInterfaces: 11
thresholdInObjects: 11
thresholdInFiles: 15
thresholdInClasses: 15
thresholdInInterfaces: 15
thresholdInObjects: 15
thresholdInEnums: 11
ignoreDeprecated: false
ignoreDeprecated: true
ignorePrivate: false
ignoreOverridden: false
ignoreOverridden: true
empty-blocks:
active: true
+17
View File
@@ -8,6 +8,9 @@ fastlane_version "2.58.0"
# export FASTLANE_NEXTCLOUD_KEY_ALIAS=""
# export FASTLANE_NEXTCLOUD_KEY_PASSWORD=""
# export FASTLANE_NEXTCLOUD_GITHUB_API_TOKEN=""
# export FASTLANE_NEXTCLOUD_HUAWEI_CLIENT_ID=""
# export FASTLANE_NEXTCLOUD_HUAWEI_CLIENT_SECRET=""
# export FASTLANE_NEXTCLOUD_HUAWEI_APP_ID=""
skip_docs
@@ -70,6 +73,7 @@ lane :releasePhase2_Final do |options|
checkIfAPKexists()
tag(info)
uploadToPlaystore_Final(info)
uploadToHuawei_Final(info)
createGithubRelease_Final(info)
fdroidMergeRequest_Final(info)
createChangelogPullRequest_Final(info)
@@ -116,6 +120,19 @@ lane :beautifyPhone do
sh("adb shell am broadcast -a com.android.systemui.demo -e command battery -e plugged false -e level 100")
end
# to install
# bundle exec fastlane add_plugin huawei_appgallery_connect
# bundle install --path build/vendor/bundle
private_lane :uploadToHuawei_Final do |options|
huawei_appgallery_connect(
client_id: ENV["FASTLANE_NEXTCLOUD_HUAWEI_CLIENT_ID"],
client_secret: ENV["FASTLANE_NEXTCLOUD_HUAWEI_CLIENT_SECRET"],
app_id: ENV["FASTLANE_NEXTCLOUD_HUAWEI_APP_ID"],
apk_path: "release/nextcloud-" + options["versionCode"] + ".apk",
submit_for_review: true,
)
end
## private lanes
desc "Build debug and test APK for screenshots"
+6
View File
@@ -0,0 +1,6 @@
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!
gem 'fastlane-plugin-huawei_appgallery_connect'
gem 'fastlane-plugin-huawei_appgallery_connect'
+2 -2
View File
@@ -58,8 +58,8 @@
<issue id="ObsoleteLintCustomCheck" severity="warning">
<ignore path="**/fragment-1.2.5/**/lint.jar" />
<ignore path="**/work-runtime-2.3.4/**/lint.jar" />
<ignore path="**/work-runtime-2.**/**/lint.jar" />
<ignore path="**/jetified-butterknife-runtime-10.2.1/**/lint.jar" />
<ignore path="**/jetified-dagger-lint-aar-2.28.1/**/lint.jar" />
<ignore path="**/jetified-dagger-lint-aar-2.28.**/**/lint.jar" />
</issue>
</lint>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

+1 -1
View File
@@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 83 warnings</span>
<span class="mdl-layout-title">Lint Report: 81 warnings</span>
+37 -5
View File
@@ -3,7 +3,9 @@
if [ $# -lt 2 ]; then
echo "1: record: true/false
2: class name
3: method name"
3: method name
4: darkMode / \"all\" to run all screenshot combinations
5: color"
exit
fi
@@ -14,7 +16,12 @@ emulator -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indire
cd src/androidTest/java
class=$(find | grep $2 | grep java | head -n1|sed s'/\//\./'g | sed s'#^\.\.##' | sed s'#\.java##')
class=$(find | grep $2 | grep -E "java$|kt$" | head -n1|sed s'/\//\./'g | sed s'#^\.\.##' | sed s'#\.java##'| sed s'#\.kt##')
if [[ -z $class ]]; then
echo "Class not found!"
exit 1
fi
cd ../../../
@@ -28,10 +35,35 @@ if [ -e $3 ] ; then
method=""
else
method="#$3"
# check if method exists
if [[ $(grep -c $3 $(find | grep $2 | grep -E "java$|kt$" | head -n1)) -eq 0 ]]; then
echo "Method not found!"
exit 1
fi
fi
if [ -e $4 ] ; then
darkMode=""
else
darkMode="-Pandroid.testInstrumentationRunnerArguments.DARKMODE=$4"
fi
if [ -e $5 ] ; then
color=""
else
color="-Pandroid.testInstrumentationRunnerArguments.COLOR=$5"
fi
if [[ $4 = "all" ]]; then
scripts/runAllScreenshotCombinations "noCI" "$1" "-Pandroid.testInstrumentationRunnerArguments.class=$class$method"
else
./gradlew gplayDebugExecuteScreenshotTests $record \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.class=$class$method \
$darkMode \
$color
fi
./gradlew gplayDebugExecuteScreenshotTests $record \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.class=$class$method
sed -i s'#<bool name="is_beta">true</bool>#<bool name="is_beta">false</bool>#'g src/main/res/values/setup.xml
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
## $1 noCI/stable/master: wether to run deleteOutdatedComments.sh or uploadReport.sh
## $2 true/false: record or verify screenshots
## $3 classMethod: piped from androidScreenshotTest
if [[ $2 = "true" ]]; then
record="-Precord"
else
record=""
fi
classMethod=$3
while read line
do
darkMode=$(echo "$line" | cut -d" " -f1)
color=$(echo "$line" | cut -d" " -f2)
echo "Run $color on $darkMode mode"
if [[ $1 = "noCI" ]]; then
./gradlew --console plain gplayDebugExecuteScreenshotTests \
$record \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
-Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" \
$classMethod </dev/null > /dev/null
if [[ $? -ne 0 ]]; then
exit
fi
else
./gradlew gplayDebugExecuteScreenshotTests \
$record \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \
-Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \
-Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" \
&& scripts/deleteOutdatedComments.sh "$1-$darkMode-$color" "Screenshot" "$DRONE_PULL_REQUEST" \
"$GIT_USERNAME" "$GIT_TOKEN" \
|| scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$DRONE_BUILD_NUMBER" \
"$1-$darkMode-$color" "Screenshot" "$DRONE_PULL_REQUEST" "$GIT_USERNAME" "$GIT_TOKEN"
fi
done < scripts/screenshotCombinations
+1
View File
@@ -0,0 +1 @@
light blue
@@ -25,7 +25,6 @@ package com.nextcloud.client;
import android.Manifest;
import android.view.View;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.R;
import com.owncloud.android.ui.activities.ActivitiesActivity;
@@ -60,16 +59,13 @@ public class ActivitiesActivityIT extends AbstractIT {
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
sut.runOnUiThread(new Runnable() {
@Override
public void run() {
sut.emptyContentContainer.setVisibility(View.VISIBLE);
sut.recyclerView.setVisibility(View.INVISIBLE);
}
sut.runOnUiThread(() -> {
sut.emptyContentContainer.setVisibility(View.VISIBLE);
sut.recyclerView.setVisibility(View.INVISIBLE);
});
waitForIdleSync();
Screenshot.snapActivity(sut).record();
screenshot(sut);
}
}
@@ -32,10 +32,13 @@ 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.e2ee.ToggleEncryptionRemoteOperation;
import com.owncloud.android.lib.resources.status.OCCapability;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.lib.resources.users.GetPrivateKeyOperation;
import com.owncloud.android.lib.resources.users.GetPublicKeyOperation;
import com.owncloud.android.lib.resources.users.SendCSROperation;
import com.owncloud.android.lib.resources.users.StorePrivateKeyOperation;
import com.owncloud.android.operations.GetCapabilitiesOperation;
import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.utils.CsrHelper;
import com.owncloud.android.utils.EncryptionUtils;
@@ -52,9 +55,11 @@ import java.io.IOException;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import static com.owncloud.android.lib.resources.status.OwnCloudVersion.nextcloud_19;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assume.assumeTrue;
@@ -80,6 +85,12 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
@Before
public void before() {
OCCapability capability = getStorageManager().getCapability(account.name);
if (capability.getVersion().equals(new OwnCloudVersion("0.0.0"))) {
// fetch new one
assertTrue(new GetCapabilitiesOperation().execute(client, getStorageManager()).isSuccess());
}
// tests only for NC19+
assumeTrue(getStorageManager()
.getCapability(account.name)
@@ -282,6 +293,7 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
}
OCFile fileToDelete = files.get(new Random().nextInt(files.size()));
assertNotNull(fileToDelete.getRemoteId());
Log_OC.d(this,
"[" + i + "/" + actionCount + "] " +
@@ -395,4 +407,58 @@ public class EndToEndRandomIT extends AbstractOnServerIT {
private String generateMnemonicString() {
return "1 2 3 4 5 6";
}
public void after() {
// remove all encrypted files
OCFile root = fileDataStorageManager.getFileByDecryptedRemotePath("/");
removeFolder(root);
// List<OCFile> files = fileDataStorageManager.getFolderContent(root, false);
//
// for (OCFile child : files) {
// removeFolder(child);
// }
assertEquals(0, fileDataStorageManager.getFolderContent(root, false).size());
super.after();
}
private void removeFolder(OCFile folder) {
Log_OC.d(this, "Start removing content of folder: " + folder.getDecryptedRemotePath());
List<OCFile> children = fileDataStorageManager.getFolderContent(folder, false);
// remove children
for (OCFile child : children) {
if (child.isFolder()) {
removeFolder(child);
// remove folder
Log_OC.d(this, "Remove folder: " + child.getDecryptedRemotePath());
if (!folder.isEncrypted() && child.isEncrypted()) {
assertTrue(new ToggleEncryptionRemoteOperation(child.getLocalId(),
child.getRemotePath(),
false)
.execute(client)
.isSuccess());
OCFile f = getStorageManager().getFileByEncryptedRemotePath(child.getRemotePath());
f.setEncrypted(false);
getStorageManager().saveFile(f);
child.setEncrypted(false);
}
} else {
Log_OC.d(this, "Remove file: " + child.getDecryptedRemotePath());
}
assertTrue(new RemoveFileOperation(child, false, account, false, targetContext)
.execute(client, getStorageManager())
.isSuccess()
);
}
Log_OC.d(this, "Finished removing content of folder: " + folder.getDecryptedRemotePath());
}
}
@@ -25,7 +25,6 @@ package com.nextcloud.client;
import android.Manifest;
import android.app.Activity;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractOnServerIT;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
@@ -126,7 +125,7 @@ public class FileDisplayActivityIT extends AbstractOnServerIT {
shortSleep();
shortSleep();
Screenshot.snapActivity(sut).record();
screenshot(sut);
}
@Test
@@ -24,7 +24,6 @@ package com.nextcloud.client;
import android.Manifest;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.R;
import com.owncloud.android.ui.activity.FileDisplayActivity;
@@ -57,7 +56,7 @@ public class FileDisplayActivityScreenshotIT extends AbstractIT {
sut.getListOfFilesFragment().setFabEnabled(false);
sut.getListOfFilesFragment().setEmptyListLoadingMessage();
Screenshot.snapActivity(sut).record();
screenshot(sut);
}
@Test
@@ -70,6 +69,6 @@ public class FileDisplayActivityScreenshotIT extends AbstractIT {
sut.getListOfFilesFragment().setFabEnabled(false);
sut.getListOfFilesFragment().setEmptyListLoadingMessage();
Screenshot.snapActivity(sut).record();
screenshot(sut);
}
}
@@ -25,7 +25,6 @@ package com.nextcloud.client;
import android.Manifest;
import android.app.Activity;
import com.facebook.testing.screenshot.Screenshot;
import com.nextcloud.client.onboarding.FirstRunActivity;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.utils.ScreenshotTest;
@@ -51,7 +50,7 @@ public class FirstRunActivityIT extends AbstractIT {
public void open() {
Activity sut = activityRule.launchActivity(null);
Screenshot.snapActivity(sut).record();
screenshot(sut);
}
}
@@ -1,52 +0,0 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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;
import android.Manifest;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activity.NotificationsActivity;
import com.owncloud.android.utils.ScreenshotTest;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
public class NotificationsActivityIT extends AbstractIT {
@Rule public IntentsTestRule<NotificationsActivity> activityRule = new IntentsTestRule<>(NotificationsActivity.class,
true,
false);
@Rule
public final GrantPermissionRule permissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test
@ScreenshotTest
public void openDrawer() {
super.openDrawer(activityRule);
}
}
@@ -22,14 +22,33 @@
package com.nextcloud.client;
import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import com.facebook.testing.screenshot.ScreenshotRunner;
import com.github.tmurakami.dexopener.DexOpener;
import androidx.test.runner.AndroidJUnitRunner;
public class ScreenshotTestRunner extends AndroidJUnitRunner {
@Override
public Application newApplication(ClassLoader cl, String className, Context context)
throws ClassNotFoundException, IllegalAccessException, InstantiationException {
/*
* Initialize DexOpener only on API below 28 to enable mocking of Kotlin classes.
* On API 28+ the platform supports mocking natively.
*/
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
DexOpener.install(this);
}
return super.newApplication(cl, className, context);
}
@Override
public void onCreate(Bundle args) {
super.onCreate(args);
@@ -25,7 +25,6 @@ package com.nextcloud.client;
import android.Manifest;
import android.app.Activity;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.ui.activity.SettingsActivity;
import com.owncloud.android.utils.ScreenshotTest;
@@ -49,8 +48,8 @@ public class SettingsActivityIT extends AbstractIT {
@Test
@ScreenshotTest
public void open() {
Activity test = activityRule.launchActivity(null);
Activity sut = activityRule.launchActivity(null);
Screenshot.snapActivity(test).record();
screenshot(sut);
}
}
@@ -25,7 +25,6 @@ package com.nextcloud.client;
import android.Manifest;
import android.content.Intent;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.datamodel.MediaFolderType;
import com.owncloud.android.datamodel.SyncedFolderDisplayItem;
@@ -87,6 +86,6 @@ public class SyncedFoldersActivityIT extends AbstractIT {
getInstrumentation().waitForIdleSync();
shortSleep();
Screenshot.snap(Objects.requireNonNull(sut.requireDialog().getWindow()).getDecorView()).record();
screenshot(Objects.requireNonNull(sut.requireDialog().getWindow()).getDecorView());
}
}
@@ -0,0 +1,71 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <[email protected]>
* Copyright (C) 2020 Chris Narkiewicz
* Copyright (C) 2020 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.os.Parcel
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotSame
import org.junit.Assert.assertTrue
import org.junit.Test
class MockUserTest {
private companion object {
const val ACCOUNT_NAME = "test_account_name"
const val ACCOUNT_TYPE = "test_account_type"
}
@Test
fun mock_user_is_parcelable() {
// GIVEN
// mock user instance
val original = MockUser(ACCOUNT_NAME, ACCOUNT_TYPE)
// WHEN
// instance is serialized into Parcel
// instance is retrieved from Parcel
val parcel = Parcel.obtain()
parcel.setDataPosition(0)
parcel.writeParcelable(original, 0)
parcel.setDataPosition(0)
val retrieved = parcel.readParcelable<User>(User::class.java.classLoader)
// THEN
// retrieved instance in distinct
// instances are equal
assertNotSame(original, retrieved)
assertTrue(retrieved is MockUser)
assertEquals(original, retrieved)
}
@Test
fun mock_user_has_platform_account() {
// GIVEN
// mock user instance
val mock = MockUser(ACCOUNT_NAME, ACCOUNT_TYPE)
// THEN
// can convert to platform account
val account = mock.toPlatformAccount()
assertEquals(ACCOUNT_NAME, account.name)
assertEquals(ACCOUNT_TYPE, account.type)
}
}
@@ -0,0 +1,240 @@
/**
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import android.content.ComponentName
import android.content.Context
import com.nextcloud.client.account.MockUser
import com.owncloud.android.datamodel.OCFile
import io.mockk.MockKAnnotations
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.mockk
import io.mockk.verify
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
class DownloaderConnectionTest {
lateinit var connection: DownloaderConnection
@MockK
lateinit var context: Context
@MockK
lateinit var firstDownloadListener: (Download) -> Unit
@MockK
lateinit var secondDownloadListener: (Download) -> Unit
@MockK
lateinit var firstStatusListener: (Downloader.Status) -> Unit
@MockK
lateinit var secondStatusListener: (Downloader.Status) -> Unit
@MockK
lateinit var binder: DownloaderService.Binder
val file get() = OCFile("/path")
val componentName = ComponentName("", DownloaderService::class.java.simpleName)
val user = MockUser()
@Before
fun setUp() {
MockKAnnotations.init(this, relaxed = true)
connection = DownloaderConnection(context, user)
}
@Test
fun listeners_are_set_after_connection() {
// GIVEN
// not connected
// listener is added
connection.registerDownloadListener(firstDownloadListener)
connection.registerDownloadListener(secondDownloadListener)
// WHEN
// service is bound
connection.onServiceConnected(componentName, binder)
// THEN
// all listeners are passed to the service
val listeners = mutableListOf<(Download) -> Unit>()
verify { binder.registerDownloadListener(capture(listeners)) }
assertEquals(listOf(firstDownloadListener, secondDownloadListener), listeners)
}
@Test
fun listeners_are_set_immediately_when_connected() {
// GIVEN
// service is bound
connection.onServiceConnected(componentName, binder)
// WHEN
// listeners are added
connection.registerDownloadListener(firstDownloadListener)
// THEN
// listener is forwarded to service
verify { binder.registerDownloadListener(firstDownloadListener) }
}
@Test
fun listeners_are_removed_when_unbinding() {
// GIVEN
// service is bound
// service has some listeners
connection.onServiceConnected(componentName, binder)
connection.registerDownloadListener(firstDownloadListener)
connection.registerDownloadListener(secondDownloadListener)
// WHEN
// service unbound
connection.unbind()
// THEN
// listeners removed from service
verify { binder.removeDownloadListener(firstDownloadListener) }
verify { binder.removeDownloadListener(secondDownloadListener) }
}
@Test
fun missed_updates_are_delivered_on_connection() {
// GIVEN
// not bound
// has listeners
// download is scheduled and is progressing
connection.registerDownloadListener(firstDownloadListener)
connection.registerDownloadListener(secondDownloadListener)
val request1 = Request(user, file)
connection.download(request1)
val download1 = Download(request1.uuid, DownloadState.RUNNING, 50, request1.file, request1)
val request2 = Request(user, file)
connection.download(request2)
val download2 = Download(request2.uuid, DownloadState.RUNNING, 50, request2.file, request1)
every { binder.getDownload(request1.uuid) } returns download1
every { binder.getDownload(request2.uuid) } returns download2
// WHEN
// service is bound
connection.onServiceConnected(componentName, binder)
// THEN
// listeners receive current download state for pending downloads
val firstListenerNotifications = mutableListOf<Download>()
verify { firstDownloadListener(capture(firstListenerNotifications)) }
assertEquals(listOf(download1, download2), firstListenerNotifications)
val secondListenerNotifications = mutableListOf<Download>()
verify { secondDownloadListener(capture(secondListenerNotifications)) }
assertEquals(listOf(download1, download2), secondListenerNotifications)
}
@Test
fun downloader_status_updates_are_delivered_on_connection() {
// GIVEN
// not bound
// has status listeners
val mockStatus: Downloader.Status = mockk()
every { binder.status } returns mockStatus
connection.registerStatusListener(firstStatusListener)
connection.registerStatusListener(secondStatusListener)
// WHEN
// service is bound
connection.onServiceConnected(componentName, binder)
// THEN
// downloader status is delivered
verify { firstStatusListener(mockStatus) }
verify { secondStatusListener(mockStatus) }
}
@Test
fun downloader_status_not_requested_if_no_listeners() {
// GIVEN
// not bound
// no status listeners
// WHEN
// service is bound
connection.onServiceConnected(componentName, binder)
// THEN
// downloader status is not requested
verify(exactly = 0) { binder.status }
}
@Test
fun not_running_if_not_connected() {
// GIVEN
// downloader is running
// connection not bound
every { binder.isRunning } returns true
// THEN
// not running
assertFalse(connection.isRunning)
}
@Test
fun is_running_from_binder_if_connected() {
// GIVEN
// service bound
every { binder.isRunning } returns true
connection.onServiceConnected(componentName, binder)
// WHEN
// is runnign flag accessed
val isRunning = connection.isRunning
// THEN
// call delegated to binder
assertTrue(isRunning)
verify(exactly = 1) { binder.isRunning }
}
@Test
fun missed_updates_not_tracked_before_listeners_registered() {
// GIVEN
// not bound
// some downloads requested without listener
val request = Request(user, file)
connection.download(request)
val download = Download(request.uuid, DownloadState.RUNNING, 50, request.file, request)
connection.registerDownloadListener(firstDownloadListener)
every { binder.getDownload(request.uuid) } returns download
// WHEN
// service is bound
connection.onServiceConnected(componentName, binder)
// THEN
// missed updates not redelivered
verify(exactly = 0) { firstDownloadListener(any()) }
}
}
@@ -0,0 +1,58 @@
/**
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import androidx.test.core.app.ApplicationProvider.getApplicationContext
import androidx.test.rule.ServiceTestRule
import com.nextcloud.client.account.MockUser
import io.mockk.MockKAnnotations
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeoutException
class DownloaderServiceTest {
@get:Rule
val service = ServiceTestRule.withTimeout(3, TimeUnit.SECONDS)
val user = MockUser()
@Before
fun setUp() {
MockKAnnotations.init(this, relaxed = true)
}
@Test(expected = TimeoutException::class)
fun cannot_bind_to_service_without_user() {
val intent = DownloaderService.createBindIntent(getApplicationContext(), user)
intent.removeExtra(DownloaderService.EXTRA_USER)
service.bindService(intent)
}
@Test
fun bind_with_user() {
val intent = DownloaderService.createBindIntent(getApplicationContext(), user)
val binder = service.bindService(intent)
assertTrue(binder is DownloaderService.Binder)
}
}
@@ -0,0 +1,281 @@
/**
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.nextcloud.client.account.User
import com.nextcloud.client.core.ManualAsyncRunner
import com.nextcloud.client.core.OnProgressCallback
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.common.OwnCloudClient
import io.mockk.MockKAnnotations
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.mockk
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Suite
import org.mockito.MockitoAnnotations
@RunWith(Suite::class)
@Suite.SuiteClasses(
DownloaderTest.Enqueue::class,
DownloaderTest.DownloadStatusUpdates::class
)
class DownloaderTest {
abstract class Base {
companion object {
const val MAX_DOWNLOAD_THREADS = 4
}
@MockK
lateinit var user: User
@MockK
lateinit var client: OwnCloudClient
@MockK
lateinit var mockTaskFactory: DownloadTask.Factory
/**
* All task mock functions created during test run are
* stored here.
*/
lateinit var downloadTaskMocks: MutableList<DownloadTask>
lateinit var runner: ManualAsyncRunner
lateinit var downloader: DownloaderImpl
/**
* Response value for all download tasks
*/
var downloadTaskResult: Boolean = true
/**
* Progress values posted by all download task mocks before
* returning result value
*/
var taskProgress = listOf<Int>()
@Before
fun setUpBase() {
MockKAnnotations.init(this, relaxed = true)
MockitoAnnotations.initMocks(this)
downloadTaskMocks = mutableListOf()
runner = ManualAsyncRunner()
downloader = DownloaderImpl(
runner = runner,
taskFactory = mockTaskFactory,
threads = MAX_DOWNLOAD_THREADS
)
downloadTaskResult = true
every { mockTaskFactory.create() } answers { createMockTask() }
}
private fun createMockTask(): DownloadTask {
val task = mockk<DownloadTask>()
every { task.download(any(), any(), any()) } answers {
taskProgress.forEach {
arg<OnProgressCallback<Int>>(1).invoke(it)
}
val request = arg<Request>(0)
DownloadTask.Result(request.file, downloadTaskResult)
}
downloadTaskMocks.add(task)
return task
}
}
class Enqueue : Base() {
@Test
fun enqueued_download_is_started_immediately() {
// GIVEN
// downloader has no running downloads
// WHEN
// download is enqueued
val file = OCFile("/path")
val request = Request(user, file)
downloader.download(request)
// THEN
// download is started immediately
val download = downloader.getDownload(request.uuid)
assertEquals(DownloadState.RUNNING, download?.state)
}
@Test
fun enqueued_downloads_are_pending_if_running_queue_is_full() {
// GIVEN
// downloader is downloading max simultaneous files
for (i in 0 until MAX_DOWNLOAD_THREADS) {
val file = OCFile("/running/download/path/$i")
val request = Request(user, file)
downloader.download(request)
val runningDownload = downloader.getDownload(request.uuid)
assertEquals(runningDownload?.state, DownloadState.RUNNING)
}
// WHEN
// another download is enqueued
val file = OCFile("/path")
val request = Request(user, file)
downloader.download(request)
// THEN
// download is pending
val download = downloader.getDownload(request.uuid)
assertEquals(DownloadState.PENDING, download?.state)
}
}
class DownloadStatusUpdates : Base() {
@get:Rule
val rule = InstantTaskExecutorRule()
val file = OCFile("/path")
@Test
fun download_task_completes() {
// GIVEN
// download is running
// download is being observed
val downloadUpdates = mutableListOf<Download>()
downloader.registerDownloadListener { downloadUpdates.add(it) }
downloader.download(Request(user, file))
// WHEN
// download task finishes successfully
runner.runOne()
// THEN
// listener is notified about status change
assertEquals(DownloadState.RUNNING, downloadUpdates[0].state)
assertEquals(DownloadState.COMPLETED, downloadUpdates[1].state)
}
@Test
fun download_task_fails() {
// GIVEN
// download is running
// download is being observed
val downloadUpdates = mutableListOf<Download>()
downloader.registerDownloadListener { downloadUpdates.add(it) }
downloader.download(Request(user, file))
// WHEN
// download task fails
downloadTaskResult = false
runner.runOne()
// THEN
// listener is notified about status change
assertEquals(DownloadState.RUNNING, downloadUpdates[0].state)
assertEquals(DownloadState.FAILED, downloadUpdates[1].state)
}
@Test
fun download_progress_is_updated() {
// GIVEN
// download is running
val downloadUpdates = mutableListOf<Download>()
downloader.registerDownloadListener { downloadUpdates.add(it) }
downloader.download(Request(user, file))
// WHEN
// download progress updated 4 times before completion
taskProgress = listOf(25, 50, 75, 100)
runner.runOne()
// THEN
// listener receives 6 status updates
// transition to running
// 4 progress updates
// completion
assertEquals(6, downloadUpdates.size)
if (downloadUpdates.size >= 6) {
assertEquals(DownloadState.RUNNING, downloadUpdates[0].state)
assertEquals(25, downloadUpdates[1].progress)
assertEquals(50, downloadUpdates[2].progress)
assertEquals(75, downloadUpdates[3].progress)
assertEquals(100, downloadUpdates[4].progress)
assertEquals(DownloadState.COMPLETED, downloadUpdates[5].state)
}
}
@Test
fun download_task_is_created_only_for_running_downloads() {
// WHEN
// multiple downloads are enqueued
for (i in 0 until MAX_DOWNLOAD_THREADS * 2) {
downloader.download(Request(user, file))
}
// THEN
// download task is created only for running downloads
assertEquals(MAX_DOWNLOAD_THREADS, downloadTaskMocks.size)
}
}
class RunningStatusUpdates : Base() {
@get:Rule
val rule = InstantTaskExecutorRule()
@Test
fun is_running_flag_on_enqueue() {
// WHEN
// download is enqueued
val file = OCFile("/path/to/file")
val request = Request(user, file)
downloader.download(request)
// THEN
// is running changes
assertTrue(downloader.isRunning)
}
@Test
fun is_running_flag_on_completion() {
// GIVEN
// a download is in progress
val file = OCFile("/path/to/file")
val request = Request(user, file)
downloader.download(request)
assertTrue(downloader.isRunning)
// WHEN
// download is processed
runner.runOne()
// THEN
// downloader is not running
assertFalse(downloader.isRunning)
}
}
}
@@ -0,0 +1,519 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import com.nextcloud.client.account.User
import com.owncloud.android.datamodel.OCFile
import io.mockk.CapturingSlot
import io.mockk.MockKAnnotations
import io.mockk.clearAllMocks
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.verify
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertSame
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Suite
import java.util.UUID
@RunWith(Suite::class)
@Suite.SuiteClasses(
RegistryTest.Pending::class,
RegistryTest.Start::class,
RegistryTest.Progress::class,
RegistryTest.Complete::class,
RegistryTest.GetDownloads::class,
RegistryTest.IsRunning::class
)
class RegistryTest {
abstract class Base {
companion object {
const val MAX_DOWNLOAD_THREADS = 4
const val PROGRESS_FULL = 100
const val PROGRESS_HALF = 50
}
@MockK
lateinit var user: User
lateinit var file: OCFile
@MockK
lateinit var onDownloadStart: (UUID, Request) -> Unit
@MockK
lateinit var onDownloadChanged: (Download) -> Unit
internal lateinit var registry: Registry
@Before
fun setUpBase() {
MockKAnnotations.init(this, relaxed = true)
file = OCFile("/test/path")
registry = Registry(onDownloadStart, onDownloadChanged, MAX_DOWNLOAD_THREADS)
resetMocks()
}
fun resetMocks() {
clearAllMocks()
every { onDownloadStart(any(), any()) } answers {}
every { onDownloadChanged(any()) } answers {}
}
}
class Pending : Base() {
@Test
fun inserting_pending_download() {
// GIVEN
// registry has no pending downloads
assertEquals(0, registry.pending.size)
// WHEN
// new download requests added
val addedDownloadsCount = 10
for (i in 0 until addedDownloadsCount) {
val request = Request(user, file)
registry.add(request)
}
// THEN
// download is added to the pending queue
assertEquals(addedDownloadsCount, registry.pending.size)
}
}
class Start : Base() {
companion object {
const val ENQUEUED_REQUESTS_COUNT = 10
}
@Before
fun setUp() {
for (i in 0 until ENQUEUED_REQUESTS_COUNT) {
registry.add(Request(user, file))
}
assertEquals(ENQUEUED_REQUESTS_COUNT, registry.pending.size)
}
@Test
fun starting_download() {
// WHEN
// started
registry.startNext()
// THEN
// up to max threads requests are started
// start callback is triggered
// update callback is triggered on download transition
// started downloads are in running state
assertEquals(
"Downloads not moved to running queue",
MAX_DOWNLOAD_THREADS,
registry.running.size
)
assertEquals(
"Downloads not moved from pending queue",
ENQUEUED_REQUESTS_COUNT - MAX_DOWNLOAD_THREADS,
registry.pending.size
)
verify(exactly = MAX_DOWNLOAD_THREADS) { onDownloadStart(any(), any()) }
val startedDownloads = mutableListOf<Download>()
verify(exactly = MAX_DOWNLOAD_THREADS) { onDownloadChanged(capture(startedDownloads)) }
assertEquals(
"Callbacks not invoked for running downloads",
MAX_DOWNLOAD_THREADS,
startedDownloads.size
)
startedDownloads.forEach {
assertEquals("Download not placed into running state", DownloadState.RUNNING, it.state)
}
}
@Test
fun start_is_ignored_if_no_more_free_threads() {
// WHEN
// max number of running downloads
registry.startNext()
assertEquals(MAX_DOWNLOAD_THREADS, registry.running.size)
clearAllMocks()
// WHEN
// starting more downloads
registry.startNext()
// THEN
// no more downloads can be started
assertEquals(MAX_DOWNLOAD_THREADS, registry.running.size)
verify(exactly = 0) { onDownloadStart(any(), any()) }
}
}
class Progress : Base() {
var uuid: UUID = UUID.randomUUID()
@Before
fun setUp() {
val request = Request(user, file)
uuid = registry.add(request)
registry.startNext()
assertEquals(uuid, request.uuid)
assertEquals(1, registry.running.size)
resetMocks()
}
@Test
fun download_progress_is_updated() {
// GIVEN
// a download is running
// WHEN
// download progress is updated
val progressHalf = 50
registry.progress(uuid, progressHalf)
// THEN
// progress is updated
// update callback is invoked
val download = mutableListOf<Download>()
verify { onDownloadChanged(capture(download)) }
assertEquals(1, download.size)
assertEquals(progressHalf, download.first().progress)
}
@Test
fun updates_for_non_running_downloads_are_ignored() {
// GIVEN
// download is not running
registry.complete(uuid, true)
assertEquals(0, registry.running.size)
resetMocks()
// WHEN
// progress for a non-running download is updated
registry.progress(uuid, PROGRESS_HALF)
// THEN
// progress update is ignored
verify(exactly = 0) { onDownloadChanged(any()) }
}
@Test
fun updates_for_non_existing_downloads_are_ignored() {
// GIVEN
// some download is running
// WHEN
// progress is updated for non-existing download
val nonExistingDownloadId = UUID.randomUUID()
registry.progress(nonExistingDownloadId, PROGRESS_HALF)
// THEN
// progress uppdate is ignored
verify(exactly = 0) { onDownloadChanged(any()) }
}
}
class Complete : Base() {
lateinit var uuid: UUID
@Before
fun setUp() {
uuid = registry.add(Request(user, file))
registry.startNext()
registry.progress(uuid, PROGRESS_FULL)
resetMocks()
}
@Test
fun complete_successful_download_with_updated_file() {
// GIVEN
// a download is running
// WHEN
// download is completed
// file has been updated
val updatedFile = OCFile("/updated/file")
registry.complete(uuid, true, updatedFile)
// THEN
// download is completed successfully
// status carries updated file
val slot = CapturingSlot<Download>()
verify { onDownloadChanged(capture(slot)) }
assertEquals(DownloadState.COMPLETED, slot.captured.state)
assertSame(slot.captured.file, updatedFile)
}
@Test
fun complete_successful_download() {
// GIVEN
// a download is running
// WHEN
// download is completed
// file is not updated
registry.complete(uuid = uuid, success = true, file = null)
// THEN
// download is completed successfully
// status carries previous file
val slot = CapturingSlot<Download>()
verify { onDownloadChanged(capture(slot)) }
assertEquals(DownloadState.COMPLETED, slot.captured.state)
assertSame(slot.captured.file, file)
}
@Test
fun complete_failed_download() {
// GIVEN
// a download is running
// WHEN
// download is failed
registry.complete(uuid, false)
// THEN
// download is completed successfully
val slot = CapturingSlot<Download>()
verify { onDownloadChanged(capture(slot)) }
assertEquals(DownloadState.FAILED, slot.captured.state)
}
}
class GetDownloads : Base() {
val pendingDownloadFile = OCFile("/pending")
val runningDownloadFile = OCFile("/running")
val completedDownloadFile = OCFile("/completed")
lateinit var pendingDownloadId: UUID
lateinit var runningDownloadId: UUID
lateinit var completedDownloadId: UUID
@Before
fun setUp() {
completedDownloadId = registry.add(Request(user, completedDownloadFile))
registry.startNext()
registry.complete(completedDownloadId, true)
runningDownloadId = registry.add(Request(user, runningDownloadFile))
registry.startNext()
pendingDownloadId = registry.add(Request(user, pendingDownloadFile))
resetMocks()
assertEquals(1, registry.pending.size)
assertEquals(1, registry.running.size)
assertEquals(1, registry.completed.size)
}
@Test
fun get_by_path_searches_pending_queue() {
// GIVEN
// file download is pending
// WHEN
// download status is retrieved
val download = registry.getDownload(pendingDownloadFile)
// THEN
// download from pending queue is returned
assertNotNull(download)
assertEquals(pendingDownloadId, download?.uuid)
}
@Test
fun get_by_id_searches_pending_queue() {
// GIVEN
// file download is pending
// WHEN
// download status is retrieved
val download = registry.getDownload(pendingDownloadId)
// THEN
// download from pending queue is returned
assertNotNull(download)
assertEquals(pendingDownloadId, download?.uuid)
}
@Test
fun get_by_path_searches_running_queue() {
// GIVEN
// file download is running
// WHEN
// download status is retrieved
val download = registry.getDownload(runningDownloadFile)
// THEN
// download from pending queue is returned
assertNotNull(download)
assertEquals(runningDownloadId, download?.uuid)
}
@Test
fun get_by_id_searches_running_queue() {
// GIVEN
// file download is running
// WHEN
// download status is retrieved
val download = registry.getDownload(runningDownloadId)
// THEN
// download from pending queue is returned
assertNotNull(download)
assertEquals(runningDownloadId, download?.uuid)
}
@Test
fun get_by_path_searches_completed_queue() {
// GIVEN
// file download is pending
// WHEN
// download status is retrieved
val download = registry.getDownload(completedDownloadFile)
// THEN
// download from pending queue is returned
assertNotNull(download)
assertEquals(completedDownloadId, download?.uuid)
}
@Test
fun get_by_id_searches_completed_queue() {
// GIVEN
// file download is pending
// WHEN
// download status is retrieved
val download = registry.getDownload(completedDownloadId)
// THEN
// download from pending queue is returned
assertNotNull(download)
assertEquals(completedDownloadId, download?.uuid)
}
@Test
fun not_found_by_path() {
// GIVEN
// no download for a file
val nonExistingDownloadFile = OCFile("/non-nexisting/download")
// WHEN
// download status is retrieved for a file
val download = registry.getDownload(nonExistingDownloadFile)
// THEN
// no download is found
assertNull(download)
}
@Test
fun not_found_by_id() {
// GIVEN
// no download for an id
val nonExistingId = UUID.randomUUID()
// WHEN
// download status is retrieved for a file
val download = registry.getDownload(nonExistingId)
// THEN
// no download is found
assertNull(download)
}
}
class IsRunning : Base() {
@Test
fun no_requests() {
// WHEN
// all queues empty
assertEquals(0, registry.pending.size)
assertEquals(0, registry.running.size)
assertEquals(0, registry.completed.size)
// THEN
// not running
assertFalse(registry.isRunning)
}
@Test
fun request_pending() {
// WHEN
// request is enqueued
registry.add(Request(user, OCFile("/path/alpha/1")))
assertEquals(1, registry.pending.size)
assertEquals(0, registry.running.size)
assertEquals(0, registry.completed.size)
// THEN
// is running
assertTrue(registry.isRunning)
}
@Test
fun request_running() {
// WHEN
// request is running
registry.add(Request(user, OCFile("/path/alpha/1")))
registry.startNext()
assertEquals(0, registry.pending.size)
assertEquals(1, registry.running.size)
assertEquals(0, registry.completed.size)
// THEN
// is running
assertTrue(registry.isRunning)
}
@Test
fun request_completed() {
// WHEN
// request is running
val id = registry.add(Request(user, OCFile("/path/alpha/1")))
registry.startNext()
registry.complete(id, true)
assertEquals(0, registry.pending.size)
assertEquals(0, registry.running.size)
assertEquals(1, registry.completed.size)
// THEN
// is not running
assertFalse(registry.isRunning)
}
}
}
@@ -7,9 +7,12 @@ import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import com.facebook.testing.screenshot.Screenshot;
import com.nextcloud.client.RetryTestRule;
import com.facebook.testing.screenshot.internal.TestNameDetector;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.account.UserAccountManagerImpl;
@@ -17,6 +20,8 @@ import com.nextcloud.client.device.BatteryStatus;
import com.nextcloud.client.device.PowerManagementService;
import com.nextcloud.client.network.Connectivity;
import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.nextcloud.client.preferences.DarkMode;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
@@ -27,6 +32,7 @@ import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientFactory;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.status.OCCapability;
import com.owncloud.android.operations.CreateFolderOperation;
import com.owncloud.android.operations.UploadFileOperation;
import com.owncloud.android.utils.FileStorageUtils;
@@ -35,7 +41,6 @@ import junit.framework.TestCase;
import org.apache.commons.io.FileUtils;
import org.junit.BeforeClass;
import org.junit.Rule;
import java.io.File;
import java.io.FileWriter;
@@ -61,12 +66,14 @@ import static org.junit.Assert.assertTrue;
*/
public abstract class AbstractIT {
@Rule public RetryTestRule retryTestRule = new RetryTestRule();
//@Rule public RetryTestRule retryTestRule = new RetryTestRule();
protected static OwnCloudClient client;
protected static Account account;
protected static User user;
protected static Context targetContext;
protected static String DARK_MODE = "";
protected static String COLOR = "";
protected Activity currentActivity;
@@ -109,6 +116,63 @@ public abstract class AbstractIT {
} catch (AccountUtils.AccountNotFoundException e) {
e.printStackTrace();
}
Bundle arguments = androidx.test.platform.app.InstrumentationRegistry.getArguments();
// color
String colorParameter = arguments.getString("COLOR");
if (!TextUtils.isEmpty(colorParameter)) {
FileDataStorageManager fileDataStorageManager = new FileDataStorageManager(account,
targetContext.getContentResolver());
String colorHex = null;
COLOR = colorParameter;
switch (colorParameter) {
case "red":
colorHex = "#7c0000";
break;
case "green":
colorHex = "#00ff00";
break;
case "white":
colorHex = "#ffffff";
break;
case "black":
colorHex = "#000000";
break;
default:
break;
}
if (colorHex != null) {
OCCapability capability = fileDataStorageManager.getCapability(account.name);
capability.setServerColor(colorHex);
fileDataStorageManager.saveCapabilities(capability);
}
}
// dark / light
String darkModeParameter = arguments.getString("DARKMODE");
if (darkModeParameter != null) {
if (darkModeParameter.equalsIgnoreCase("dark")) {
DARK_MODE = "dark";
AppPreferencesImpl.fromContext(targetContext).setDarkThemeMode(DarkMode.DARK);
MainApp.setAppTheme(DarkMode.DARK);
} else {
DARK_MODE = "light";
}
}
if (DARK_MODE.equalsIgnoreCase("light") && COLOR.equalsIgnoreCase("blue")) {
// use already existing names
DARK_MODE = "";
COLOR = "";
}
}
protected FileDataStorageManager getStorageManager() {
@@ -153,7 +217,7 @@ public abstract class AbstractIT {
waitForIdleSync();
Screenshot.snapActivity(sut).record();
screenshot(sut);
}
protected Activity getCurrentActivity() {
@@ -251,4 +315,26 @@ public abstract class AbstractIT {
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
assertTrue(result.getLogMessage(), result.isSuccess());
}
protected void screenshot(View view) {
Screenshot.snap(view).setName(createName()).record();
}
protected void screenshot(Activity sut) {
Screenshot.snapActivity(sut).setName(createName()).record();
}
private String createName() {
String name = TestNameDetector.getTestClass() + "_" + TestNameDetector.getTestName();
if (!DARK_MODE.isEmpty()) {
name = name + "_" + DARK_MODE;
}
if (!COLOR.isEmpty()) {
name = name + "_" + COLOR;
}
return name;
}
}
@@ -236,5 +236,10 @@ public abstract class AbstractOnServerIT extends AbstractIT {
RemoteOperationResult result = newUpload.execute(client, getStorageManager());
assertTrue(result.getLogMessage(), result.isSuccess());
//
// shortSleep();
// shortSleep();
//
// assertNotNull(getStorageManager().getFileByDecryptedRemotePath(ocUpload.getRemotePath()).getRemoteId());
}
}
@@ -30,8 +30,6 @@ import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.db.OCUpload;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation;
import com.owncloud.android.lib.resources.files.model.RemoteFile;
import com.owncloud.android.operations.RefreshFolderOperation;
import com.owncloud.android.operations.RemoveFileOperation;
import com.owncloud.android.operations.UploadFileOperation;
@@ -40,14 +38,8 @@ import com.owncloud.android.utils.FileStorageUtils;
import org.junit.After;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.attribute.BasicFileAttributes;
import androidx.annotation.NonNull;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;
@@ -318,23 +310,4 @@ public class UploadIT extends AbstractOnServerIT {
targetContext)
.execute(client, getStorageManager());
}
@Test
public void testUploadSameModificationDate() throws IOException {
File file = new File(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt");
BasicFileAttributes attributes = Files.readAttributes(file.toPath(), BasicFileAttributes.class);
long modifiedDate = attributes.lastModifiedTime().toMillis();
OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/nonEmpty.txt",
FOLDER + "nonEmpty.txt",
account.name);
shortSleep();
uploadOCUpload(ocUpload);
RemoteOperationResult readFileResult = new ReadFileRemoteOperation(FOLDER + "nonEmpty.txt").execute(client);
RemoteFile remoteFile = (RemoteFile) readFileResult.getData().get(0);
assertEquals(modifiedDate, remoteFile.getModifiedTimestamp());
}
}
@@ -26,5 +26,7 @@ public class FileDataStorageManagerContentResolverTest extends FileDataStorageMa
@Override
public void before() {
sut = new FileDataStorageManager(account, targetContext.getContentResolver());
super.before();
}
}
@@ -55,7 +55,13 @@ abstract public class FileDataStorageManagerTest extends AbstractOnServerIT {
protected FileDataStorageManager sut;
@Before
abstract public void before();
public void before() {
// make sure everything is removed
sut.deleteAllFiles();
sut.deleteVirtuals(VirtualFolderType.PHOTOS);
assertEquals(0, sut.getAllFiles().size());
}
@After
public void after() {
@@ -28,9 +28,9 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Random;
import androidx.test.InstrumentationRegistry;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -49,7 +49,7 @@ public class UploadStorageManagerTest extends AbstractIT {
@Before
public void setUp() {
Context instrumentationCtx = InstrumentationRegistry.getTargetContext();
Context instrumentationCtx = ApplicationProvider.getApplicationContext();
ContentResolver contentResolver = instrumentationCtx.getContentResolver();
uploadsStorageManager = new UploadsStorageManager(currentAccountProvider, contentResolver);
@@ -94,6 +94,7 @@ public class UploadStorageManagerTest extends AbstractIT {
int size = 3000;
ArrayList<OCUpload> uploads = new ArrayList<>();
deleteAllUploads();
assertEquals(0, uploadsStorageManager.getAllStoredUploads().length);
for (int i = 0; i < size; i++) {
@@ -156,8 +157,14 @@ public class UploadStorageManagerTest extends AbstractIT {
}
private OCUpload createUpload(Account account) {
OCUpload upload = new OCUpload(File.separator + "very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long LocalPath",
OCFile.PATH_SEPARATOR + "very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long RemotePath",
OCUpload upload = new OCUpload(File.separator + "very long long long long long long long long long long long " +
"long long long long long long long long long long long long long long " +
"long long long long long long long long long long long long long long " +
"long long long long long long long LocalPath",
OCFile.PATH_SEPARATOR + "very long long long long long long long long long " +
"long long long long long long long long long long long long long long " +
"long long long long long long long long long long long long long long " +
"long long long long long long long long long long long long RemotePath",
account.name);
upload.setFileSize(new Random().nextInt(20000) * 10000);
@@ -175,11 +182,15 @@ public class UploadStorageManagerTest extends AbstractIT {
return upload;
}
private void deleteAllUploads() {
uploadsStorageManager.removeAllUploads();
assertEquals(0, uploadsStorageManager.getAllStoredUploads().length);
}
@After
public void tearDown() {
for (Account account : getAllAccounts()) {
uploadsStorageManager.removeAccountUploads(account);
}
deleteAllUploads();
AccountManager platformAccountManager = AccountManager.get(targetContext);
platformAccountManager.removeAccountExplicitly(account2);
@@ -0,0 +1,98 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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.owncloud.android.operations;
import com.owncloud.android.AbstractOnServerIT;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.db.OCUpload;
import com.owncloud.android.utils.FileStorageUtils;
import org.junit.Test;
import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertTrue;
public class RemoveFileOperationIT extends AbstractOnServerIT {
@Test
public void deleteFolder() {
String parent = "/test/";
String path = parent + "folder1/";
assertTrue(new CreateFolderOperation(path, user, targetContext).execute(client, getStorageManager())
.isSuccess());
OCFile folder = getStorageManager().getFileByPath(path);
assertNotNull(folder);
assertTrue(new RemoveFileOperation(folder,
false,
account,
false,
targetContext)
.execute(client, getStorageManager())
.isSuccess());
OCFile parentFolder = getStorageManager().getFileByPath(parent);
assertNotNull(parentFolder);
assertTrue(new RemoveFileOperation(parentFolder,
false,
account,
false,
targetContext)
.execute(client, getStorageManager())
.isSuccess());
}
@Test
public void deleteFile() {
String parent = "/test/";
String path = parent + "empty.txt";
OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/empty.txt", path, account.name);
uploadOCUpload(ocUpload);
OCFile file = getStorageManager().getFileByPath(path);
assertNotNull(file);
assertTrue(new RemoveFileOperation(file,
false,
account,
false,
targetContext)
.execute(client, getStorageManager())
.isSuccess());
OCFile parentFolder = getStorageManager().getFileByPath(parent);
assertNotNull(parentFolder);
assertTrue(new RemoveFileOperation(parentFolder,
false,
account,
false,
targetContext)
.execute(client, getStorageManager())
.isSuccess());
}
}
@@ -0,0 +1,135 @@
/*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 Nextcloud GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.owncloud.android.ui;
import android.Manifest;
import android.accounts.Account;
import android.content.Context;
import android.os.Bundle;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import androidx.test.core.app.ActivityScenario;
import androidx.test.espresso.web.webdriver.DriverAtoms;
import androidx.test.espresso.web.webdriver.Locator;
import androidx.test.filters.LargeTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.GrantPermissionRule;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.web.sugar.Web.onWebView;
import static androidx.test.espresso.web.webdriver.DriverAtoms.findElement;
import static androidx.test.espresso.web.webdriver.DriverAtoms.webClick;
import static org.junit.Assert.assertEquals;
@LargeTest
public class LoginIT {
@Rule
public GrantPermissionRule permissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Before
public void setUp() {
tearDown();
ActivityScenario.launch(AuthenticatorActivity.class);
}
@AfterClass
public static void tearDown() {
Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
UserAccountManager accountManager = UserAccountManagerImpl.fromContext(targetContext);
if (accountManager.getAccounts().length > 0) {
accountManager.removeAllAccounts();
}
}
@Test
public void login() throws InterruptedException {
Bundle arguments = androidx.test.platform.app.InstrumentationRegistry.getArguments();
String baseUrl = arguments.getString("TEST_SERVER_URL");
String loginName = arguments.getString("TEST_SERVER_USERNAME");
String password = arguments.getString("TEST_SERVER_PASSWORD");
onView(withId(R.id.login)).perform(click());
onView(withId(R.id.host_url_input)).perform(typeText(baseUrl));
onView(withId(R.id.test_server_button)).perform(click());
Thread.sleep(3000);
onWebView().forceJavascriptEnabled();
// click on login
onWebView()
.withElement(findElement(Locator.XPATH, "//p[@id='redirect-link']/a"))
.perform(webClick());
// username
onWebView()
.withElement(findElement(Locator.XPATH, "//input[@id='user']"))
.perform(DriverAtoms.webKeys(loginName));
// password
onWebView()
.withElement(findElement(Locator.XPATH, "//input[@id='password']"))
.perform(DriverAtoms.webKeys(password));
// click login
onWebView()
.withElement(findElement(Locator.XPATH, "//input[@id='submit-form']"))
.perform(webClick());
Thread.sleep(2000);
// grant access
onWebView()
.withElement(findElement(Locator.XPATH, "//input[@type='submit']"))
.perform(webClick());
Thread.sleep(5 * 1000);
// check for account
Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
UserAccountManager accountManager = UserAccountManagerImpl.fromContext(targetContext);
assertEquals(1, accountManager.getAccounts().length);
Account account = accountManager.getAccounts()[0];
// account.name is loginName@baseUrl (without protocol)
assertEquals(loginName, account.name.split("@")[0]);
assertEquals(baseUrl.split("//")[1], account.name.split("@")[1]);
}
}
@@ -24,7 +24,6 @@ package com.owncloud.android.ui.activity;
import android.content.Intent;
import com.facebook.testing.screenshot.Screenshot;
import com.nextcloud.client.account.UserAccountManagerImpl;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.R;
@@ -38,6 +37,8 @@ import com.owncloud.android.utils.ScreenshotTest;
import org.junit.Rule;
import org.junit.Test;
import java.util.Objects;
import androidx.fragment.app.DialogFragment;
import androidx.test.espresso.intent.rule.IntentsTestRule;
@@ -87,7 +88,7 @@ public class ConflictsResolveActivityIT extends AbstractIT {
shortSleep();
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
}
// @Test
@@ -141,7 +142,7 @@ public class ConflictsResolveActivityIT extends AbstractIT {
// getInstrumentation().waitForIdleSync();
// shortSleep();
//
// Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
// screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
// }
@Test
@@ -222,7 +223,7 @@ public class ConflictsResolveActivityIT extends AbstractIT {
onView(withId(R.id.existing_checkbox)).perform(click());
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
onView(withText("OK")).perform(click());
@@ -267,7 +268,7 @@ public class ConflictsResolveActivityIT extends AbstractIT {
onView(withId(R.id.new_checkbox)).perform(click());
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
onView(withText("OK")).perform(click());
@@ -313,7 +314,7 @@ public class ConflictsResolveActivityIT extends AbstractIT {
onView(withId(R.id.new_checkbox)).perform(click());
DialogFragment dialog = (DialogFragment) sut.getSupportFragmentManager().findFragmentByTag("conflictDialog");
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
onView(withText("OK")).perform(click());
@@ -24,7 +24,6 @@ package com.owncloud.android.ui.activity;
import android.app.Activity;
import com.facebook.testing.screenshot.Screenshot;
import com.nextcloud.client.account.User;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.utils.ScreenshotTest;
@@ -47,7 +46,7 @@ public class ManageAccountsActivityIT extends AbstractIT {
shortSleep();
Screenshot.snapActivity(sut).record();
screenshot(sut);
}
@Test
@@ -61,6 +60,6 @@ public class ManageAccountsActivityIT extends AbstractIT {
shortSleep();
shortSleep();
Screenshot.snapActivity(getCurrentActivity()).record();
screenshot(getCurrentActivity());
}
}
@@ -0,0 +1,131 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky
* Copyright (C) 2020 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.owncloud.android.ui.activity
import androidx.test.espresso.intent.rule.IntentsTestRule
import com.facebook.testing.screenshot.Screenshot
import com.owncloud.android.AbstractIT
import com.owncloud.android.lib.resources.notifications.models.Action
import com.owncloud.android.lib.resources.notifications.models.Notification
import com.owncloud.android.lib.resources.notifications.models.RichObject
import com.owncloud.android.utils.ScreenshotTest
import org.junit.Rule
import org.junit.Test
import java.util.GregorianCalendar
class NotificationsActivityIT : AbstractIT() {
@get:Rule
var activityRule = IntentsTestRule(NotificationsActivity::class.java, true, false)
@Test
@ScreenshotTest
fun loading() {
val sut: NotificationsActivity = activityRule.launchActivity(null)
Screenshot.snapActivity(sut).record()
}
@Test
@ScreenshotTest
fun empty() {
val sut: NotificationsActivity = activityRule.launchActivity(null)
sut.runOnUiThread { sut.populateList(ArrayList<Notification>()) }
shortSleep()
screenshot(sut)
}
@Test
@ScreenshotTest
fun showNotifications() {
val sut: NotificationsActivity = activityRule.launchActivity(null)
val date = GregorianCalendar()
date.set(2005, 4, 17, 10, 35, 30)
val notifications = ArrayList<Notification>()
notifications.add(
Notification(
1,
"files",
"user",
date.time,
"objectType",
"objectId",
"App recommendation: Tasks",
"SubjectRich",
HashMap<String, RichObject>(),
"Sync tasks from various devices with your Nextcloud and edit them online.",
"MessageRich",
HashMap<String, RichObject>(),
"link",
"icon",
ArrayList<Action>()
)
)
val actions = ArrayList<Action>()
actions.add(Action("Send usage", "link", "url", true))
actions.add(Action("Not now", "link", "url", false))
notifications.add(
Notification(
1,
"files",
"user",
date.time,
"objectType",
"objectId",
"Help improve Nextcloud",
"SubjectRich",
HashMap<String, RichObject>(),
"Do you want to help us to improve Nextcloud" +
" by providing some anonymize data about your setup and usage?",
"MessageRich",
HashMap<String, RichObject>(),
"link",
"icon",
actions
)
)
sut.runOnUiThread { sut.populateList(notifications) }
shortSleep()
screenshot(sut)
}
@Test
@ScreenshotTest
fun error() {
val sut: NotificationsActivity = activityRule.launchActivity(null)
shortSleep()
sut.runOnUiThread { sut.setEmptyContent("Error", "Error! Please try again later!") }
screenshot(sut)
}
}
@@ -28,7 +28,6 @@ import android.accounts.AccountManager;
import android.content.Intent;
import android.os.Looper;
import com.facebook.testing.screenshot.Screenshot;
import com.nextcloud.client.account.RegisteredUser;
import com.nextcloud.client.account.Server;
import com.nextcloud.ui.ChooseAccountDialogFragment;
@@ -162,6 +161,6 @@ public class DialogFragmentIT extends AbstractIT {
getInstrumentation().waitForIdleSync();
shortSleep();
Screenshot.snap(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView()).record();
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
}
}
@@ -24,7 +24,6 @@ package com.owncloud.android.ui.dialog;
import android.Manifest;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.activity.FileDisplayActivity;
@@ -32,6 +31,8 @@ import com.owncloud.android.ui.activity.FileDisplayActivity;
import org.junit.Rule;
import org.junit.Test;
import java.util.Objects;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
@@ -58,7 +59,7 @@ public class SyncFileNotEnoughSpaceDialogFragmentTest extends AbstractIT {
getInstrumentation().waitForIdleSync();
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
}
@Test
@@ -72,6 +73,6 @@ public class SyncFileNotEnoughSpaceDialogFragmentTest extends AbstractIT {
getInstrumentation().waitForIdleSync();
Screenshot.snap(dialog.getDialog().getWindow().getDecorView()).record();
screenshot(Objects.requireNonNull(dialog.requireDialog().getWindow()).getDecorView());
}
}
@@ -24,7 +24,6 @@ package com.owncloud.android.ui.preview;
import android.Manifest;
import com.facebook.testing.screenshot.Screenshot;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.activity.FileDisplayActivity;
@@ -64,7 +63,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
shortSleep();
Screenshot.snapActivity(sut).record();
screenshot(sut);
}
@Test
@@ -82,6 +81,6 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
shortSleep();
Screenshot.snapActivity(sut).record();
screenshot(sut);
}
}
+1
View File
@@ -325,6 +325,7 @@
<service android:name=".services.OperationsService" />
<service android:name=".files.services.FileDownloader" />
<service android:name="com.nextcloud.client.files.downloader.DownloaderService" />
<service android:name=".files.services.FileUploader" />
<service android:name="com.nextcloud.client.media.PlayerService"/>
@@ -0,0 +1,80 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <[email protected]>
* Copyright (C) 2020 Chris Narkiewicz
* Copyright (C) 2020 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.net.Uri
import android.os.Parcel
import android.os.Parcelable
import com.owncloud.android.MainApp
import com.owncloud.android.lib.common.OwnCloudAccount
import com.owncloud.android.lib.common.OwnCloudBasicCredentials
import java.net.URI
/**
* This is a mock user object suitable for integration tests. Mocks obtained from code generators
* such as Mockito or MockK cannot be transported in Intent extras.
*/
data class MockUser(override val accountName: String, val accountType: String) : User, Parcelable {
constructor() : this(DEFAULT_MOCK_ACCOUNT_NAME, DEFAULT_MOCK_ACCOUNT_TYPE)
companion object {
@JvmField
val CREATOR: Parcelable.Creator<MockUser> = object : Parcelable.Creator<MockUser> {
override fun createFromParcel(source: Parcel): MockUser = MockUser(source)
override fun newArray(size: Int): Array<MockUser?> = arrayOfNulls(size)
}
const val DEFAULT_MOCK_ACCOUNT_NAME = "mock_account_name"
const val DEFAULT_MOCK_ACCOUNT_TYPE = "mock_account_type"
}
private constructor(source: Parcel) : this(
source.readString() as String,
source.readString() as String
)
override val server = Server(URI.create(""), MainApp.MINIMUM_SUPPORTED_SERVER_VERSION)
override val isAnonymous = false
override fun toPlatformAccount(): Account {
return Account(accountName, accountType)
}
override fun toOwnCloudAccount(): OwnCloudAccount {
return OwnCloudAccount(Uri.EMPTY, OwnCloudBasicCredentials("", ""))
}
override fun nameEquals(user: User?): Boolean {
return user?.accountName.equals(accountName, true)
}
override fun nameEquals(accountName: CharSequence?): Boolean {
return accountName?.toString().equals(this.accountType, true)
}
override fun describeContents() = 0
override fun writeToParcel(dest: Parcel, flags: Int) = with(dest) {
writeString(accountName)
writeString(accountType)
}
}
@@ -19,23 +19,53 @@
*/
package com.nextcloud.client.core
typealias OnResultCallback<T> = (T) -> Unit
typealias OnErrorCallback = (Throwable) -> Unit
typealias OnResultCallback<T> = (result: T) -> Unit
typealias OnErrorCallback = (error: Throwable) -> Unit
typealias OnProgressCallback<P> = (progress: P) -> Unit
typealias IsCancelled = () -> Boolean
typealias TaskFunction<RESULT, PROGRESS> = (
onProgress: OnProgressCallback<PROGRESS>,
isCancelled: IsCancelled
) -> RESULT
/**
* This interface allows to post background tasks that report results via callbacks invoked on main thread.
*
* It is provided as an alternative for heavy, platform specific and virtually untestable [android.os.AsyncTask]
*
* Please note that as of Android R, [android.os.AsyncTask] is deprecated and [java.util.concurrent] is a recommended
* alternative.
*/
interface AsyncRunner {
/**
* Post a quick background task and return immediately returning task cancellation interface.
*
* Quick task is a short piece of code that does not support interruption nor progress monitoring.
*
* @param task Task function returning result T; error shall be signalled by throwing an exception.
* @param onResult Callback called when task function returns a result.
* @param onError Callback called when task function throws an exception.
* @return Cancellable interface, allowing cancellation of a running task.
*/
fun <RESULT> postQuickTask(
task: () -> RESULT,
onResult: OnResultCallback<RESULT>? = null,
onError: OnErrorCallback? = null
): Cancellable
/**
* Post a background task and return immediately returning task cancellation interface.
*
* @param task Task function returning result T; error shall be signalled by throwing an exception.
* @param onResult Callback called when task function returns a result
* @param onError Callback called when task function throws an exception
* @return Cancellable interface, allowing to cancel running task.
* @param onResult Callback called when task function returns a result,
* @param onError Callback called when task function throws an exception.
* @param onProgress Callback called when task function reports progress update.
* @return Cancellable interface, allowing cancellation of a running task.
*/
fun <T> post(task: () -> T, onResult: OnResultCallback<T>? = null, onError: OnErrorCallback? = null): Cancellable
fun <RESULT, PROGRESS> postTask(
task: TaskFunction<RESULT, PROGRESS>,
onResult: OnResultCallback<RESULT>? = null,
onError: OnErrorCallback? = null,
onProgress: OnProgressCallback<PROGRESS>? = null
): Cancellable
}
@@ -31,8 +31,8 @@ package com.nextcloud.client.core
interface Cancellable {
/**
* Cancel running task. Task termination is not guaranteed, but the result
* shall not be delivered.
* Cancel running task. Task termination is not guaranteed, as some
* tasks cannot be interrupted, but the result will not be delivered.
*/
fun cancel()
}
@@ -0,0 +1,28 @@
/**
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.core
import android.app.Service
import android.os.Binder
/**
* This is a generic binder that provides access to a locally bound service instance.
*/
abstract class LocalBinder<S : Service>(val service: S) : Binder()
@@ -0,0 +1,105 @@
/**
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.core
import android.app.Service
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.os.IBinder
/**
* This is a local service connection providing a foundation for service
* communication logic.
*
* One can subclass it to create own service interaction API.
*/
abstract class LocalConnection<S : Service>(
protected val context: Context
) : ServiceConnection {
private var serviceBinder: LocalBinder<S>? = null
val service: S? get() = serviceBinder?.service
val isConnected: Boolean get() {
return serviceBinder != null
}
/**
* Override this method to create custom binding intent.
* Default implementation returns null, which disables binding.
*
* @see [bind]
*/
protected open fun createBindIntent(): Intent? {
return null
}
/**
* Bind local service. If [createBindIntent] returns null, it no-ops.
*/
fun bind() {
createBindIntent()?.let {
context.bindService(it, this, Context.BIND_AUTO_CREATE)
}
}
/**
* Unbind service if it is bound.
* If service is not bound, it no-ops.
*/
fun unbind() {
if (isConnected) {
onUnbind()
context.unbindService(this)
serviceBinder = null
}
}
/**
* Callback called when connection binds to a service.
* Any actions taken on service connection can be taken here.
*/
protected open fun onBound(binder: IBinder) {
// default no-op
}
/**
* Callback called when service is about to be unbound.
* Binder is still valid at this stage and can be used to
* perform cleanups. After exiting this method, service will
* no longer be available.
*/
protected open fun onUnbind() {
// default no-op
}
final override fun onServiceConnected(name: ComponentName, binder: IBinder) {
if (binder !is LocalBinder<*>) {
throw IllegalStateException("Binder is not extending ${LocalBinder::class.java.name}")
}
serviceBinder = binder as LocalBinder<S>
onBound(binder)
}
final override fun onServiceDisconnected(name: ComponentName) {
serviceBinder = null
}
}
@@ -27,14 +27,35 @@ import java.util.ArrayDeque
*/
class ManualAsyncRunner : AsyncRunner {
private val queue: ArrayDeque<Task<*>> = ArrayDeque()
private val queue: ArrayDeque<Runnable> = ArrayDeque()
override fun <T> post(task: () -> T, onResult: OnResultCallback<T>?, onError: OnErrorCallback?): Cancellable {
override fun <T> postQuickTask(
task: () -> T,
onResult: OnResultCallback<T>?,
onError: OnErrorCallback?
): Cancellable {
return postTask(
task = { _: OnProgressCallback<Any>, _: IsCancelled -> task.invoke() },
onResult = onResult,
onError = onError,
onProgress = null
)
}
override fun <T, P> postTask(
task: TaskFunction<T, P>,
onResult: OnResultCallback<T>?,
onError: OnErrorCallback?,
onProgress: OnProgressCallback<P>?
): Cancellable {
val remove: Function1<Runnable, Boolean> = queue::remove
val taskWrapper = Task(
postResult = { it.run() },
postResult = { it.run(); true },
removeFromQueue = remove,
taskBody = task,
onSuccess = onResult,
onError = onError
onError = onError,
onProgress = onProgress
)
queue.push(taskWrapper)
return taskWrapper
@@ -22,23 +22,32 @@ package com.nextcloud.client.core
import java.util.concurrent.atomic.AtomicBoolean
/**
* This is a wrapper for a function run in background.
*
* Runs task function and posts result if task is not cancelled.
* This is a wrapper for a task function runing in background.
* It executes task function and handles result or error delivery.
*/
internal class Task<T>(
private val postResult: (Runnable) -> Unit,
private val taskBody: () -> T,
@Suppress("LongParameterList")
internal class Task<T, P>(
private val postResult: (Runnable) -> Boolean,
private val removeFromQueue: (Runnable) -> Boolean,
private val taskBody: TaskFunction<T, P>,
private val onSuccess: OnResultCallback<T>?,
private val onError: OnErrorCallback?
private val onError: OnErrorCallback?,
private val onProgress: OnProgressCallback<P>?
) : Runnable, Cancellable {
val isCancelled: Boolean
get() = cancelled.get()
private val cancelled = AtomicBoolean(false)
private fun postProgress(p: P) {
postResult(Runnable { onProgress?.invoke(p) })
}
@Suppress("TooGenericExceptionCaught") // this is exactly what we want here
override fun run() {
@Suppress("TooGenericExceptionCaught") // this is exactly what we want here
try {
val result = taskBody.invoke()
val result = taskBody.invoke({ postProgress(it) }, this::isCancelled)
if (!cancelled.get()) {
postResult.invoke(
Runnable {
@@ -51,9 +60,11 @@ internal class Task<T>(
postResult(Runnable { onError?.invoke(t) })
}
}
removeFromQueue(this)
}
override fun cancel() {
cancelled.set(true)
removeFromQueue(this)
}
}
@@ -28,17 +28,44 @@ import java.util.concurrent.ScheduledThreadPoolExecutor
*
* Tasks are run on multi-threaded pool. If serialized execution is desired, set [corePoolSize] to 1.
*/
internal class ThreadPoolAsyncRunner(private val uiThreadHandler: Handler, corePoolSize: Int) : AsyncRunner {
internal class ThreadPoolAsyncRunner(
private val uiThreadHandler: Handler,
corePoolSize: Int,
val tag: String = "default"
) : AsyncRunner {
private val executor = ScheduledThreadPoolExecutor(corePoolSize)
override fun <T> post(task: () -> T, onResult: OnResultCallback<T>?, onError: OnErrorCallback?): Cancellable {
val taskWrapper = Task(this::postResult, task, onResult, onError)
override fun <T> postQuickTask(
task: () -> T,
onResult: OnResultCallback<T>?,
onError: OnErrorCallback?
): Cancellable {
val taskAdapter = { _: OnProgressCallback<Void>, _: IsCancelled -> task.invoke() }
return postTask(
taskAdapter,
onResult,
onError,
null
)
}
override fun <T, P> postTask(
task: TaskFunction<T, P>,
onResult: OnResultCallback<T>?,
onError: OnErrorCallback?,
onProgress: OnProgressCallback<P>?
): Cancellable {
val remove: Function1<Runnable, Boolean> = executor::remove
val taskWrapper = Task(
postResult = uiThreadHandler::post,
removeFromQueue = remove,
taskBody = task,
onSuccess = onResult,
onError = onError,
onProgress = onProgress
)
executor.execute(taskWrapper)
return taskWrapper
}
private fun postResult(r: Runnable) {
uiThreadHandler.post(r)
}
}
@@ -49,6 +49,8 @@ import com.nextcloud.client.migrations.MigrationsDb;
import com.nextcloud.client.migrations.MigrationsManager;
import com.nextcloud.client.migrations.MigrationsManagerImpl;
import com.nextcloud.client.network.ClientFactory;
import com.nextcloud.client.notifications.AppNotificationManager;
import com.nextcloud.client.notifications.AppNotificationManagerImpl;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.ui.activities.data.activities.ActivitiesRepository;
@@ -63,6 +65,7 @@ import org.greenrobot.eventbus.EventBus;
import java.io.File;
import javax.inject.Named;
import javax.inject.Singleton;
import dagger.Module;
@@ -164,9 +167,17 @@ class AppModule {
@Provides
@Singleton
AsyncRunner asyncRunner() {
AsyncRunner uiAsyncRunner() {
Handler uiHandler = new Handler();
return new ThreadPoolAsyncRunner(uiHandler, 4);
return new ThreadPoolAsyncRunner(uiHandler, 4, "ui");
}
@Provides
@Singleton
@Named("io")
AsyncRunner ioAsyncRunner() {
Handler uiHandler = new Handler();
return new ThreadPoolAsyncRunner(uiHandler, 8, "io");
}
@Provides
@@ -200,4 +211,10 @@ class AppModule {
Migrations migrations) {
return new MigrationsManagerImpl(appInfo, migrationsDb, asyncRunner, migrations.getSteps());
}
@Provides
@Singleton
AppNotificationManager notificationsManager(Context context, NotificationManager platformNotificationsManager) {
return new AppNotificationManagerImpl(context, context.getResources(), platformNotificationsManager);
}
}
@@ -22,6 +22,7 @@ package com.nextcloud.client.di;
import com.nextcloud.client.etm.EtmActivity;
import com.nextcloud.client.jobs.NotificationWork;
import com.nextcloud.client.files.downloader.DownloaderService;
import com.nextcloud.client.logger.ui.LogsActivity;
import com.nextcloud.client.media.PlayerService;
import com.nextcloud.client.onboarding.FirstRunActivity;
@@ -168,4 +169,5 @@ abstract class ComponentsModule {
@ContributesAndroidInjector abstract AccountManagerService accountManagerService();
@ContributesAndroidInjector abstract OperationsService operationsService();
@ContributesAndroidInjector abstract PlayerService playerService();
@ContributesAndroidInjector abstract DownloaderService fileDownloaderService();
}
@@ -21,15 +21,21 @@ package com.nextcloud.client.etm
import android.accounts.Account
import android.accounts.AccountManager
import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import android.content.res.Resources
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.nextcloud.client.account.User
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.etm.pages.EtmAccountsFragment
import com.nextcloud.client.etm.pages.EtmBackgroundJobsFragment
import com.nextcloud.client.etm.pages.EtmDownloaderFragment
import com.nextcloud.client.etm.pages.EtmMigrations
import com.nextcloud.client.etm.pages.EtmPreferencesFragment
import com.nextcloud.client.files.downloader.DownloaderConnection
import com.nextcloud.client.jobs.BackgroundJobManager
import com.nextcloud.client.jobs.JobInfo
import com.nextcloud.client.migrations.MigrationInfo
@@ -40,9 +46,12 @@ import com.owncloud.android.lib.common.accounts.AccountUtils
import javax.inject.Inject
@Suppress("LongParameterList") // Dependencies Injection
@SuppressLint("StaticFieldLeak")
class EtmViewModel @Inject constructor(
private val context: Context,
private val defaultPreferences: SharedPreferences,
private val platformAccountManager: AccountManager,
private val accountManager: UserAccountManager,
private val resources: Resources,
private val backgroundJobManager: BackgroundJobManager,
private val migrationsManager: MigrationsManager,
@@ -71,6 +80,7 @@ class EtmViewModel @Inject constructor(
*/
data class AccountData(val account: Account, val userData: Map<String, String?>)
val currentUser: User get() = accountManager.user
val currentPage: LiveData<EtmMenuEntry?> = MutableLiveData()
val pages: List<EtmMenuEntry> = listOf(
EtmMenuEntry(
@@ -92,8 +102,14 @@ class EtmViewModel @Inject constructor(
iconRes = R.drawable.ic_arrow_up,
titleRes = R.string.etm_migrations,
pageClass = EtmMigrations::class
),
EtmMenuEntry(
iconRes = R.drawable.ic_download_grey600,
titleRes = R.string.etm_downloader,
pageClass = EtmDownloaderFragment::class
)
)
val downloaderConnection = DownloaderConnection(context, accountManager.user)
val preferences: Map<String, String> get() {
return defaultPreferences.all
@@ -0,0 +1,133 @@
package com.nextcloud.client.etm.pages
import android.os.Bundle
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.nextcloud.client.etm.EtmBaseFragment
import com.nextcloud.client.files.downloader.Download
import com.nextcloud.client.files.downloader.Downloader
import com.nextcloud.client.files.downloader.Request
import com.owncloud.android.R
import com.owncloud.android.datamodel.OCFile
class EtmDownloaderFragment : EtmBaseFragment() {
companion object {
private const val TEST_DOWNLOAD_DUMMY_PATH = "/test/dummy_file.txt"
}
class Adapter(private val inflater: LayoutInflater) : RecyclerView.Adapter<Adapter.ViewHolder>() {
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val uuid = view.findViewById<TextView>(R.id.etm_download_uuid)
val path = view.findViewById<TextView>(R.id.etm_download_path)
val user = view.findViewById<TextView>(R.id.etm_download_user)
val state = view.findViewById<TextView>(R.id.etm_download_state)
val progress = view.findViewById<TextView>(R.id.etm_download_progress)
private val progressRow = view.findViewById<View>(R.id.etm_download_progress_row)
var progressEnabled: Boolean = progressRow.visibility == View.VISIBLE
get() {
return progressRow.visibility == View.VISIBLE
}
set(value) {
field = value
progressRow.visibility = if (value) {
View.VISIBLE
} else {
View.GONE
}
}
}
private var downloads = listOf<Download>()
fun setStatus(status: Downloader.Status) {
downloads = listOf(status.pending, status.running, status.completed).flatten().reversed()
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = inflater.inflate(R.layout.etm_download_list_item, parent, false)
return ViewHolder(view)
}
override fun getItemCount(): Int {
return downloads.size
}
override fun onBindViewHolder(vh: ViewHolder, position: Int) {
val download = downloads[position]
vh.uuid.text = download.uuid.toString()
vh.path.text = download.request.file.remotePath
vh.user.text = download.request.user.accountName
vh.state.text = download.state.toString()
if (download.progress >= 0) {
vh.progressEnabled = true
vh.progress.text = download.progress.toString()
} else {
vh.progressEnabled = false
}
}
}
private lateinit var adapter: Adapter
private lateinit var list: RecyclerView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setHasOptionsMenu(true)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_etm_downloader, container, false)
adapter = Adapter(inflater)
list = view.findViewById(R.id.etm_download_list)
list.layoutManager = LinearLayoutManager(context)
list.addItemDecoration(DividerItemDecoration(context, DividerItemDecoration.VERTICAL))
list.adapter = adapter
return view
}
override fun onResume() {
super.onResume()
vm.downloaderConnection.bind()
vm.downloaderConnection.registerStatusListener(this::onDownloaderStatusChanged)
}
override fun onPause() {
super.onPause()
vm.downloaderConnection.unbind()
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.fragment_etm_downloader, menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.etm_test_download -> {
scheduleTestDownload(); true
}
else -> super.onOptionsItemSelected(item)
}
}
private fun scheduleTestDownload() {
val request = Request(user = vm.currentUser, file = OCFile(TEST_DOWNLOAD_DUMMY_PATH), test = true)
vm.downloaderConnection.download(request)
}
private fun onDownloaderStatusChanged(status: Downloader.Status) {
adapter.setStatus(status)
}
}
@@ -0,0 +1,49 @@
/**
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import com.owncloud.android.datamodel.OCFile
import java.util.UUID
/**
* This class represents current download process state.
* This object is immutable by design.
*
* NOTE: Although [OCFile] object is mutable, it is caused by shortcomings
* of legacy design; please behave like an adult and treat it as immutable value.
*
* @property uuid Unique download process id
* @property state current download state
* @property progress download progress, 0-100 percent
* @property file downloaded file, if download is in progress or failed, it is remote; if finished successfully - local
* @property request initial download request
*/
data class Download(
val uuid: UUID,
val state: DownloadState,
val progress: Int,
val file: OCFile,
val request: Request
) {
/**
* True if download is no longer running, false if it is still being processed.
*/
val isFinished: Boolean get() = state == DownloadState.COMPLETED || state == DownloadState.FAILED
}
@@ -0,0 +1,27 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
enum class DownloadState {
PENDING,
RUNNING,
COMPLETED,
FAILED
}
@@ -0,0 +1,100 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import android.content.ContentResolver
import android.content.Context
import com.nextcloud.client.core.IsCancelled
import com.owncloud.android.datamodel.FileDataStorageManager
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.common.OwnCloudClient
import com.owncloud.android.operations.DownloadFileOperation
import com.owncloud.android.utils.MimeTypeUtil
import java.io.File
/**
* This runnable object encapsulates file download logic. It has been extracted to wrap
* network operation and storage manager interactions, as those pose testing challenges
* that cannot be addressed due to large number of dependencies.
*
* This design can be regarded as intermediary refactoring step.
*/
class DownloadTask(
val context: Context,
val contentResolver: ContentResolver,
val clientProvider: () -> OwnCloudClient
) {
data class Result(val file: OCFile, val success: Boolean)
/**
* This class is a helper factory to to keep static dependencies
* injection out of the downloader instance.
*
* @param context Context
* @param clientProvider Provide client - this must be called on background thread
* @param contentResolver content resovler used to access file storage
*/
class Factory(
private val context: Context,
private val clientProvider: () -> OwnCloudClient,
private val contentResolver: ContentResolver
) {
fun create(): DownloadTask {
return DownloadTask(context, contentResolver, clientProvider)
}
}
fun download(request: Request, progress: (Int) -> Unit, isCancelled: IsCancelled): Result {
val op = DownloadFileOperation(request.user.toPlatformAccount(), request.file, context)
val client = clientProvider.invoke()
val result = op.execute(client)
if (result.isSuccess) {
val storageManager = FileDataStorageManager(
request.user.toPlatformAccount(),
contentResolver
)
val file = saveDownloadedFile(op, storageManager)
return Result(file, true)
} else {
return Result(request.file, false)
}
}
private fun saveDownloadedFile(op: DownloadFileOperation, storageManager: FileDataStorageManager): OCFile {
val file = storageManager.getFileById(op.getFile().getFileId()) as OCFile
val syncDate = System.currentTimeMillis()
file.lastSyncDateForProperties = syncDate
file.lastSyncDateForData = syncDate
file.isUpdateThumbnailNeeded = true
file.modificationTimestamp = op.getModificationTimestamp()
file.modificationTimestampAtLastSyncForData = op.getModificationTimestamp()
file.etag = op.getEtag()
file.mimeType = op.getMimeType()
file.storagePath = op.getSavePath()
file.fileLength = File(op.getSavePath()).length()
file.remoteId = op.getFile().getRemoteId()
storageManager.saveFile(file)
if (MimeTypeUtil.isMedia(op.getMimeType())) {
FileDataStorageManager.triggerMediaScan(file.storagePath)
}
return file
}
}
@@ -0,0 +1,98 @@
/**
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import com.owncloud.android.datamodel.OCFile
import java.util.UUID
interface Downloader {
/**
* Snapshot of downloader status. All data is immutable and can be safely shared.
*/
data class Status(
val pending: List<Download>,
val running: List<Download>,
val completed: List<Download>
) {
companion object {
val EMPTY = Status(emptyList(), emptyList(), emptyList())
}
}
/**
* True if downloader has any pending or running downloads.
*/
val isRunning: Boolean
/**
* Status snapshot of all downloads.
*/
val status: Status
/**
* Register download progress listener. Registration is idempotent - listener can be registered only once.
*/
fun registerDownloadListener(listener: (Download) -> Unit)
/**
* Removes registered listener if exists.
*/
fun removeDownloadListener(listener: (Download) -> Unit)
/**
* Register downloader status listener. Registration is idempotent - listener can be registered only once.
*/
fun registerStatusListener(listener: (Status) -> Unit)
/**
* Removes registered listener if exists.
*/
fun removeStatusListener(listener: (Status) -> Unit)
/**
* Adds download request to pending queue and returns immediately.
*
* @param request Download request
*/
fun download(request: Request)
/**
* Find download status by UUID.
*
* @param uuid Download process uuid
* @return download status or null if not found
*/
fun getDownload(uuid: UUID): Download?
/**
* Query user's downloader for a download status. It performs linear search
* of all queues and returns first download matching [OCFile.remotePath].
*
* Since there can be multiple downloads with identical file in downloader's queues,
* order of search matters.
*
* It looks for pending downloads first, then running and completed queue last.
*
* @param file Downloaded file
* @return download status or null, if download does not exist
*/
fun getDownload(file: OCFile): Download?
}
@@ -0,0 +1,122 @@
/**
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import android.content.Context
import android.content.Intent
import android.os.IBinder
import com.nextcloud.client.account.User
import com.nextcloud.client.core.LocalConnection
import com.owncloud.android.datamodel.OCFile
import java.util.UUID
class DownloaderConnection(context: Context, val user: User) : LocalConnection<DownloaderService>(context), Downloader {
private var downloadListeners: MutableSet<(Download) -> Unit> = mutableSetOf()
private var statusListeners: MutableSet<(Downloader.Status) -> Unit> = mutableSetOf()
private var binder: DownloaderService.Binder? = null
private val downloadsRequiringStatusRedelivery: MutableSet<UUID> = mutableSetOf()
override val isRunning: Boolean
get() = binder?.isRunning ?: false
override val status: Downloader.Status
get() = binder?.status ?: Downloader.Status.EMPTY
override fun getDownload(uuid: UUID): Download? = binder?.getDownload(uuid)
override fun getDownload(file: OCFile): Download? = binder?.getDownload(file)
override fun download(request: Request) {
val intent = DownloaderService.createDownloadIntent(context, request)
context.startService(intent)
if (!isConnected && downloadListeners.size > 0) {
downloadsRequiringStatusRedelivery.add(request.uuid)
}
}
override fun registerDownloadListener(listener: (Download) -> Unit) {
downloadListeners.add(listener)
binder?.registerDownloadListener(listener)
}
override fun removeDownloadListener(listener: (Download) -> Unit) {
downloadListeners.remove(listener)
binder?.removeDownloadListener(listener)
}
override fun registerStatusListener(listener: (Downloader.Status) -> Unit) {
statusListeners.add(listener)
binder?.registerStatusListener(listener)
}
override fun removeStatusListener(listener: (Downloader.Status) -> Unit) {
statusListeners.remove(listener)
binder?.removeStatusListener(listener)
}
override fun createBindIntent(): Intent {
return DownloaderService.createBindIntent(context, user)
}
override fun onBound(binder: IBinder) {
super.onBound(binder)
this.binder = binder as DownloaderService.Binder
downloadListeners.forEach { listener ->
binder.registerDownloadListener(listener)
}
statusListeners.forEach { listener ->
binder.registerStatusListener(listener)
}
deliverMissedUpdates()
}
/**
* Since binding and download start are both asynchronous and the order
* is not guaranteed, some downloads might already finish when service is bound,
* resulting in lost notifications.
*
* Deliver all updates for pending downloads that were scheduled
* before service has been bound.
*/
private fun deliverMissedUpdates() {
val downloadUpdates = downloadsRequiringStatusRedelivery.mapNotNull { uuid ->
binder?.getDownload(uuid)
}
downloadListeners.forEach { listener ->
downloadUpdates.forEach { update ->
listener.invoke(update)
}
}
downloadsRequiringStatusRedelivery.clear()
if (statusListeners.isNotEmpty()) {
binder?.status?.let { status ->
statusListeners.forEach { it.invoke(status) }
}
}
}
override fun onUnbind() {
super.onUnbind()
downloadListeners.forEach { binder?.removeDownloadListener(it) }
statusListeners.forEach { binder?.removeStatusListener(it) }
}
}
@@ -0,0 +1,144 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import com.nextcloud.client.core.AsyncRunner
import com.nextcloud.client.core.IsCancelled
import com.nextcloud.client.core.OnProgressCallback
import com.nextcloud.client.core.TaskFunction
import com.owncloud.android.datamodel.OCFile
import java.util.UUID
/**
* Per-user file downloader.
*
* All notifications are performed on main thread. All download processes are run
* in the background.
*
* @param runner Background task runner. It is important to provide runner that is not shared with UI code.
* @param taskFactory Download task factory
* @param threads maximum number of concurrent download processes
*/
@Suppress("LongParameterList") // download operations requires those resources
class DownloaderImpl(
private val runner: AsyncRunner,
private val taskFactory: DownloadTask.Factory,
threads: Int = 1
) : Downloader {
companion object {
const val PROGRESS_PERCENTAGE_MAX = 100
const val PROGRESS_PERCENTAGE_MIN = 0
const val TEST_DOWNLOAD_PROGRESS_UPDATE_PERIOD_MS = 200L
}
private val registry = Registry(
onStartDownload = this::onStartDownload,
onDownloadChanged = this::onDownloadUpdate,
maxRunning = threads
)
private val downloadListeners: MutableSet<(Download) -> Unit> = mutableSetOf()
private val statusListeners: MutableSet<(Downloader.Status) -> Unit> = mutableSetOf()
override val isRunning: Boolean get() = registry.isRunning
override val status: Downloader.Status
get() = Downloader.Status(
pending = registry.pending,
running = registry.running,
completed = registry.completed
)
override fun registerDownloadListener(listener: (Download) -> Unit) {
downloadListeners.add(listener)
}
override fun removeDownloadListener(listener: (Download) -> Unit) {
downloadListeners.remove(listener)
}
override fun registerStatusListener(listener: (Downloader.Status) -> Unit) {
statusListeners.add(listener)
}
override fun removeStatusListener(listener: (Downloader.Status) -> Unit) {
statusListeners.remove(listener)
}
override fun download(request: Request) {
registry.add(request)
registry.startNext()
}
override fun getDownload(uuid: UUID): Download? = registry.getDownload(uuid)
override fun getDownload(file: OCFile): Download? = registry.getDownload(file)
private fun onStartDownload(uuid: UUID, request: Request) {
val downloadTask = createDownloadTask(request)
runner.postTask(
task = downloadTask,
onProgress = { progress: Int -> registry.progress(uuid, progress) },
onResult = { result -> registry.complete(uuid, result.success, result.file); registry.startNext() },
onError = { registry.complete(uuid, false); registry.startNext() }
)
}
private fun createDownloadTask(request: Request): TaskFunction<DownloadTask.Result, Int> {
return if (request.test) {
{ progress: OnProgressCallback<Int>, isCancelled: IsCancelled ->
testDownloadTask(request.file, progress, isCancelled)
}
} else {
val downloadTask = taskFactory.create()
val wrapper: TaskFunction<DownloadTask.Result, Int> = { progress: ((Int) -> Unit), isCancelled ->
downloadTask.download(request, progress, isCancelled)
}
wrapper
}
}
private fun onDownloadUpdate(download: Download) {
downloadListeners.forEach { it.invoke(download) }
if (statusListeners.isNotEmpty()) {
val status = this.status
statusListeners.forEach { it.invoke(status) }
}
}
/**
* Test download task is used only to simulate download process without
* any network traffic. It is used for development.
*/
private fun testDownloadTask(
file: OCFile,
onProgress: OnProgressCallback<Int>,
isCancelled: IsCancelled
): DownloadTask.Result {
for (i in PROGRESS_PERCENTAGE_MIN..PROGRESS_PERCENTAGE_MAX) {
onProgress(i)
if (isCancelled()) {
return DownloadTask.Result(file, false)
}
Thread.sleep(TEST_DOWNLOAD_PROGRESS_UPDATE_PERIOD_MS)
}
return DownloadTask.Result(file, true)
}
}
@@ -0,0 +1,155 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import android.app.Service
import android.content.Context
import android.content.Intent
import android.os.IBinder
import com.nextcloud.client.account.User
import com.nextcloud.client.core.AsyncRunner
import com.nextcloud.client.core.LocalBinder
import com.nextcloud.client.logger.Logger
import com.nextcloud.client.network.ClientFactory
import com.nextcloud.client.notifications.AppNotificationManager
import dagger.android.AndroidInjection
import javax.inject.Inject
import javax.inject.Named
class DownloaderService : Service() {
companion object {
const val TAG = "DownloaderService"
const val ACTION_DOWNLOAD = "download"
const val EXTRA_REQUEST = "request"
const val EXTRA_USER = "user"
fun createBindIntent(context: Context, user: User): Intent {
return Intent(context, DownloaderService::class.java).apply {
putExtra(EXTRA_USER, user)
}
}
fun createDownloadIntent(context: Context, request: Request): Intent {
return Intent(context, DownloaderService::class.java).apply {
action = ACTION_DOWNLOAD
putExtra(EXTRA_REQUEST, request)
}
}
}
/**
* Binder forwards [Downloader] API calls to selected instance of downloader.
*/
class Binder(
downloader: DownloaderImpl,
service: DownloaderService
) : LocalBinder<DownloaderService>(service),
Downloader by downloader
@Inject
lateinit var notificationsManager: AppNotificationManager
@Inject
lateinit var clientFactory: ClientFactory
@Inject
@Named("io")
lateinit var runner: AsyncRunner
@Inject
lateinit var logger: Logger
val isRunning: Boolean get() = downloaders.any { it.value.isRunning }
private val downloaders: MutableMap<String, DownloaderImpl> = mutableMapOf()
override fun onCreate() {
AndroidInjection.inject(this)
}
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
if (intent.action != ACTION_DOWNLOAD) {
return START_NOT_STICKY
}
if (!isRunning) {
startForeground(
AppNotificationManager.DOWNLOAD_NOTIFICATION_ID,
notificationsManager.buildDownloadServiceForegroundNotification()
)
}
val request = intent.getParcelableExtra(EXTRA_REQUEST) as Request
val downloader = getDownloader(request.user)
downloader.download(request)
logger.d(TAG, "Enqueued new download: ${request.uuid} ${request.file.remotePath}")
return START_NOT_STICKY
}
override fun onBind(intent: Intent?): IBinder? {
val user = intent?.getParcelableExtra<User>(EXTRA_USER)
if (user != null) {
return Binder(getDownloader(user), this)
} else {
return null
}
}
private fun onDownloadUpdate(download: Download) {
if (!isRunning) {
logger.d(TAG, "All downloads completed")
notificationsManager.cancelDownloadProgress()
stopForeground(true)
stopSelf()
} else {
notificationsManager.postDownloadProgress(
fileOwner = download.request.user,
file = download.request.file,
progress = download.progress,
allowPreview = !download.request.test
)
}
}
override fun onDestroy() {
super.onDestroy()
logger.d(TAG, "Stopping downloader service")
}
private fun getDownloader(user: User): DownloaderImpl {
val existingDownloader = downloaders[user.accountName]
return if (existingDownloader != null) {
existingDownloader
} else {
val downloadTaskFactory = DownloadTask.Factory(
applicationContext,
{ clientFactory.create(user) },
contentResolver
)
val newDownloader = DownloaderImpl(runner, downloadTaskFactory)
newDownloader.registerDownloadListener(this::onDownloadUpdate)
downloaders[user.accountName] = newDownloader
newDownloader
}
}
}
@@ -0,0 +1,162 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import com.owncloud.android.datamodel.OCFile
import java.lang.IllegalStateException
import java.util.TreeMap
import java.util.UUID
import kotlin.math.max
import kotlin.math.min
/**
* This class tracks status of all downloads. It serves as a state
* machine and drives the download background task scheduler via callbacks.
* Download status updates are triggering change callbacks that should be used
* to notify listeners.
*
* No listener registration mechanism is provided at this level.
*
* This class is not thread-safe. All access from multiple threads shall
* be lock protected.
*
* @property onStartDownload callback triggered when download is switched into running state
* @property onDownloadChanged callback triggered whenever download status update
* @property maxRunning maximum number of allowed simultaneous downloads
*/
internal class Registry(
private val onStartDownload: (UUID, Request) -> Unit,
private val onDownloadChanged: (Download) -> Unit,
private val maxRunning: Int = 2
) {
private val pendingQueue = TreeMap<UUID, Download>()
private val runningQueue = TreeMap<UUID, Download>()
private val completedQueue = TreeMap<UUID, Download>()
val isRunning: Boolean get() = pendingQueue.size > 0 || runningQueue.size > 0
val pending: List<Download> get() = pendingQueue.map { it.value }
val running: List<Download> get() = runningQueue.map { it.value }
val completed: List<Download> get() = completedQueue.map { it.value }
/**
* Insert new download into a pending queue.
*
* @return scheduled download id
*/
fun add(request: Request): UUID {
val download = Download(
uuid = request.uuid,
state = DownloadState.PENDING,
progress = 0,
file = request.file,
request = request
)
pendingQueue[download.uuid] = download
return download.uuid
}
/**
* Move pending downloads into a running queue up
* to max allowed simultaneous downloads.
*/
fun startNext() {
val freeThreads = max(0, maxRunning - runningQueue.size)
for (i in 0 until min(freeThreads, pendingQueue.size)) {
val key = pendingQueue.firstKey()
val pendingDownload = pendingQueue.remove(key) ?: throw IllegalStateException("Download $key not exist.")
val runningDownload = pendingDownload.copy(state = DownloadState.RUNNING)
runningQueue[key] = runningDownload
onStartDownload.invoke(key, runningDownload.request)
onDownloadChanged(runningDownload)
}
}
/**
* Update progress for a given download. If no download of a given id is currently running,
* update is ignored.
*
* @param uuid ID of the download to update
* @param progress progress 0-100%
*/
fun progress(uuid: UUID, progress: Int) {
val download = runningQueue[uuid]
if (download != null) {
val runningDownload = download.copy(progress = progress)
runningQueue[uuid] = runningDownload
onDownloadChanged(runningDownload)
}
}
/**
* Complete currently running download. If no download of a given id is currently running,
* update is ignored.
*
* @param uuid of the download to complete
* @param success if true, download will be marked as completed; if false - as failed
* @param file if provided, update file in download status; if null, existing value is retained
*/
fun complete(uuid: UUID, success: Boolean, file: OCFile? = null) {
val download = runningQueue.remove(uuid)
if (download != null) {
val status = if (success) {
DownloadState.COMPLETED
} else {
DownloadState.FAILED
}
val completedDownload = download.copy(state = status, file = file ?: download.file)
completedQueue[uuid] = completedDownload
onDownloadChanged(completedDownload)
}
}
/**
* Search for a download by file path. It traverses
* through all queues in order of pending, running and completed
* downloads and returns first download status matching
* file path.
*
* @param file Search for a file download
* @return download status if found, null otherwise
*/
fun getDownload(file: OCFile): Download? {
arrayOf(pendingQueue, runningQueue, completedQueue).forEach { queue ->
queue.forEach { entry ->
if (entry.value.request.file.remotePath == file.remotePath) {
return entry.value
}
}
}
return null
}
/**
* Get download status by id. It traverses
* through all queues in order of pending, running and completed
* downloads and returns first download status matching
* file path.
*
* @param id download id
* @return download status if found, null otherwise
*/
fun getDownload(uuid: UUID): Download? {
return pendingQueue[uuid] ?: runningQueue[uuid] ?: completedQueue[uuid]
}
}
@@ -0,0 +1,79 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz
* Copyright (C) 2020 Chris Narkiewicz <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.files.downloader
import android.os.Parcel
import android.os.Parcelable
import com.nextcloud.client.account.User
import com.owncloud.android.datamodel.OCFile
import java.util.UUID
/**
* Download request. This class should collect all information
* required to trigger download operation.
*
* Class is immutable by design, although [OCFile] or other
* types might not be immutable. Clients should no modify
* contents of this object.
*
* @property user Download will be triggered for a given user
* @property file Remote file to download
* @property uuid Unique request identifier; this identifier can be set in [Download]
* @property dummy if true, this requests a dummy test download; no real file transfer will occur
*/
class Request internal constructor(
val user: User,
val file: OCFile,
val uuid: UUID,
val test: Boolean = false
) : Parcelable {
constructor(user: User, file: OCFile) : this(user, file, UUID.randomUUID())
constructor(user: User, file: OCFile, test: Boolean) : this(user, file, UUID.randomUUID(), test)
constructor(parcel: Parcel) : this(
user = parcel.readParcelable<User>(User::class.java.classLoader) as User,
file = parcel.readParcelable<OCFile>(OCFile::class.java.classLoader) as OCFile,
uuid = parcel.readSerializable() as UUID,
test = parcel.readInt() != 0
)
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeParcelable(user, flags)
parcel.writeParcelable(file, flags)
parcel.writeSerializable(uuid)
parcel.writeInt(if (test) 1 else 0)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<Request> {
override fun createFromParcel(parcel: Parcel): Request {
return Request(parcel)
}
override fun newArray(size: Int): Array<Request?> {
return arrayOfNulls(size)
}
}
}
@@ -62,10 +62,8 @@ class AsyncFilter(private val asyncRunner: AsyncRunner, private val time: () ->
private fun <T> filterAsync(collection: Iterable<T>, predicate: (T) -> Boolean, onResult: (List<T>, Long) -> Unit) {
startTime = time.invoke()
filterTask = asyncRunner.post(
task = {
collection.filter { predicate.invoke(it) }
},
filterTask = asyncRunner.postQuickTask(
task = { collection.filter { predicate.invoke(it) } },
onResult = { filtered: List<T> ->
onFilterCompleted(filtered, onResult)
}
@@ -65,7 +65,7 @@ class LogsEmailSender(private val context: Context, private val clock: Clock, pr
fun send(logs: List<LogEntry>) {
if (task == null) {
val outFile = File(context.cacheDir, "attachments/logs.txt")
task = runner.post(Task(context, logs, outFile, clock.tz), onResult = { task = null; send(it) })
task = runner.postQuickTask(Task(context, logs, outFile, clock.tz), onResult = { task = null; send(it) })
}
}
@@ -61,7 +61,7 @@ internal class MigrationsManagerImpl(
return 0
}
(status as MutableLiveData<Status>).value = Status.RUNNING
asyncRunner.post(
asyncRunner.postQuickTask(
task = { asyncApplyMigrations(toApply) },
onResult = { onMigrationSuccess() },
onError = { onMigrationFailed(it) }
@@ -0,0 +1,38 @@
package com.nextcloud.client.notifications
import android.app.Notification
import com.nextcloud.client.account.User
import com.owncloud.android.datamodel.OCFile
/**
* Application-specific notification manager interface.
* Contrary to the platform [android.app.NotificationManager],
* it offer high-level, use-case oriented API.
*/
interface AppNotificationManager {
companion object {
const val DOWNLOAD_NOTIFICATION_ID = 1_000_000
}
/**
* Builds notification to be set when downloader starts in foreground.
*
* @return foreground downloader service notification
*/
fun buildDownloadServiceForegroundNotification(): Notification
/**
* Post download progress notification.
* @param fileOwner User owning the downloaded file
* @param file File being downloaded
* @param progress Progress as percentage (0-100)
* @param allowPreview if true, pending intent with preview action is added to the notification
*/
fun postDownloadProgress(fileOwner: User, file: OCFile, progress: Int, allowPreview: Boolean = true)
/**
* Removes download progress notification.
*/
fun cancelDownloadProgress()
}
@@ -0,0 +1,88 @@
package com.nextcloud.client.notifications
import android.app.Notification
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.res.Resources
import android.graphics.BitmapFactory
import android.os.Build
import androidx.core.app.NotificationCompat
import com.nextcloud.client.account.User
import com.owncloud.android.R
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.ui.activity.FileDisplayActivity
import com.owncloud.android.ui.notifications.NotificationUtils
import com.owncloud.android.ui.preview.PreviewImageActivity
import com.owncloud.android.ui.preview.PreviewImageFragment
import com.owncloud.android.utils.ThemeUtils
import javax.inject.Inject
class AppNotificationManagerImpl @Inject constructor(
private val context: Context,
private val resources: Resources,
private val platformNotificationsManager: NotificationManager
) : AppNotificationManager {
companion object {
const val PROGRESS_PERCENTAGE_MAX = 100
const val PROGRESS_PERCENTAGE_MIN = 0
}
private fun builder(channelId: String): NotificationCompat.Builder {
val color = ThemeUtils.primaryColor(context, true)
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationCompat.Builder(context, channelId).setColor(color)
} else {
NotificationCompat.Builder(context).setColor(color)
}
}
override fun buildDownloadServiceForegroundNotification(): Notification {
val icon = BitmapFactory.decodeResource(resources, R.drawable.notification_icon)
return builder(NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD)
.setContentTitle(resources.getString(R.string.app_name))
.setContentText(resources.getString(R.string.foreground_service_download))
.setSmallIcon(R.drawable.notification_icon)
.setLargeIcon(icon)
.build()
}
override fun postDownloadProgress(fileOwner: User, file: OCFile, progress: Int, allowPreview: Boolean) {
val builder = builder(NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD)
val content = resources.getString(
R.string.downloader_download_in_progress_content,
progress,
file.fileName
)
builder
.setSmallIcon(R.drawable.notification_icon)
.setTicker(resources.getString(R.string.downloader_download_in_progress_ticker))
.setContentTitle(resources.getString(R.string.downloader_download_in_progress_ticker))
.setOngoing(true)
.setProgress(PROGRESS_PERCENTAGE_MAX, progress, progress <= PROGRESS_PERCENTAGE_MIN)
.setContentText(content)
if (allowPreview) {
val openFileIntent = if (PreviewImageFragment.canBePreviewed(file)) {
PreviewImageActivity.previewFileIntent(context, fileOwner, file)
} else {
FileDisplayActivity.openFileIntent(context, fileOwner, file)
}
openFileIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
val pendingOpenFileIntent = PendingIntent.getActivity(
context,
System.currentTimeMillis().toInt(),
openFileIntent,
0
)
builder.setContentIntent(pendingOpenFileIntent)
}
platformNotificationsManager.notify(AppNotificationManager.DOWNLOAD_NOTIFICATION_ID, builder.build())
}
override fun cancelDownloadProgress() {
platformNotificationsManager.cancel(AppNotificationManager.DOWNLOAD_NOTIFICATION_ID)
}
}
@@ -119,7 +119,7 @@ import static com.owncloud.android.ui.activity.ContactsPreferenceActivity.PREFER
*/
public class MainApp extends MultiDexApplication implements HasAndroidInjector {
public static final OwnCloudVersion OUTDATED_SERVER_VERSION = OwnCloudVersion.nextcloud_15;
public static final OwnCloudVersion OUTDATED_SERVER_VERSION = OwnCloudVersion.nextcloud_16;
public static final OwnCloudVersion MINIMUM_SUPPORTED_SERVER_VERSION = OwnCloudVersion.nextcloud_13;
private static final String TAG = MainApp.class.getSimpleName();
@@ -147,6 +147,9 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import de.cotech.hw.fido.WebViewFidoBridge;
import de.cotech.hw.fido.ui.FidoDialogOptions;
import de.cotech.hw.fido2.WebViewWebauthnBridge;
import de.cotech.hw.fido2.ui.WebauthnDialogOptions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
@@ -219,7 +222,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private TextView mAuthStatusView;
private WebView mLoginWebView;
private WebViewFidoBridge webViewFidoBridge;
private WebViewFidoBridge webViewFidoU2fBridge;
private WebViewWebauthnBridge webViewWebauthnBridge;
private String mAuthStatusText = EMPTY_STRING;
private int mAuthStatusIcon;
@@ -361,7 +365,16 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
mLoginWebView.getSettings().setSaveFormData(false);
mLoginWebView.getSettings().setSavePassword(false);
webViewFidoBridge = WebViewFidoBridge.createInstanceForWebView(this, mLoginWebView);
FidoDialogOptions.Builder dialogOptionsBuilder = FidoDialogOptions.builder();
dialogOptionsBuilder.setShowSdkLogo(true);
dialogOptionsBuilder.setTheme(R.style.FidoDialog);
webViewFidoU2fBridge = WebViewFidoBridge.createInstanceForWebView(this, mLoginWebView, dialogOptionsBuilder);
WebauthnDialogOptions.Builder webauthnOptionsBuilder = WebauthnDialogOptions.builder();
webauthnOptionsBuilder.setShowSdkLogo(true);
webauthnOptionsBuilder.setAllowSkipPin(true);
webauthnOptionsBuilder.setTheme(R.style.FidoDialog);
webViewWebauthnBridge = WebViewWebauthnBridge.createInstanceForWebView(this, mLoginWebView, webauthnOptionsBuilder);
Map<String, String> headers = new HashMap<>();
headers.put(RemoteOperation.OCS_API_HEADER, RemoteOperation.OCS_API_HEADER_VALUE);
@@ -396,14 +409,16 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
mLoginWebView.setWebViewClient(new WebViewClient() {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
webViewFidoBridge.delegateShouldInterceptRequest(view, request);
webViewFidoU2fBridge.delegateShouldInterceptRequest(view, request);
webViewWebauthnBridge.delegateShouldInterceptRequest(view, request);
return super.shouldInterceptRequest(view, request);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
webViewFidoBridge.delegateOnPageStarted(view, url, favicon);
webViewFidoU2fBridge.delegateOnPageStarted(view, url, favicon);
webViewWebauthnBridge.delegateOnPageStarted(view, url, favicon);
}
@Override
@@ -46,6 +46,7 @@ import java.util.Locale;
import java.util.Observable;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
/**
* Database helper for storing list of files to be uploaded, including status
@@ -581,17 +582,17 @@ public class UploadsStorageManager extends Observable {
ContentValues cv = new ContentValues();
cv.put(ProviderTableMeta.UPLOADS_STATUS, UploadStatus.UPLOAD_FAILED.getValue());
cv.put(
ProviderTableMeta.UPLOADS_LAST_RESULT,
fail != null ? fail.getValue() : UploadResult.UNKNOWN.getValue()
);
ProviderTableMeta.UPLOADS_LAST_RESULT,
fail != null ? fail.getValue() : UploadResult.UNKNOWN.getValue()
);
cv.put(ProviderTableMeta.UPLOADS_UPLOAD_END_TIMESTAMP, Calendar.getInstance().getTimeInMillis());
int result = getDB().update(
ProviderTableMeta.CONTENT_URI_UPLOADS,
cv,
ProviderTableMeta.UPLOADS_STATUS + "=?",
new String[]{String.valueOf(UploadStatus.UPLOAD_IN_PROGRESS.getValue())}
);
ProviderTableMeta.CONTENT_URI_UPLOADS,
cv,
ProviderTableMeta.UPLOADS_STATUS + "=?",
new String[]{String.valueOf(UploadStatus.UPLOAD_IN_PROGRESS.getValue())}
);
if (result == 0) {
Log_OC.v(TAG, "No upload was killed");
@@ -603,12 +604,21 @@ public class UploadsStorageManager extends Observable {
return result;
}
@VisibleForTesting
public int removeAllUploads() {
Log_OC.v(TAG, "Delete all uploads!");
return getDB().delete(
ProviderTableMeta.CONTENT_URI_UPLOADS,
"",
new String[]{});
}
public int removeAccountUploads(Account account) {
Log_OC.v(TAG, "Delete all uploads for account " + account.name);
return getDB().delete(
ProviderTableMeta.CONTENT_URI_UPLOADS,
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "=?",
new String[]{account.name});
ProviderTableMeta.CONTENT_URI_UPLOADS,
ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "=?",
new String[]{account.name});
}
public enum UploadStatus {
@@ -21,7 +21,6 @@
package com.owncloud.android.operations;
import android.accounts.Account;
import android.content.Context;
import android.os.Build;
import android.util.Pair;
@@ -159,31 +158,6 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
.execute(client);
if (result.isSuccess()) {
RemoteOperationResult remoteFolderOperationResult = new ReadFolderRemoteOperation(encryptedRemotePath)
.execute(client);
createdRemoteFolder = (RemoteFile) remoteFolderOperationResult.getData().get(0);
OCFile newDir = new OCFile(createdRemoteFolder.getRemotePath());
newDir.setMimeType(MimeType.DIRECTORY);
newDir.setParentId(parent.getFileId());
newDir.setRemoteId(createdRemoteFolder.getRemoteId());
newDir.setModificationTimestamp(System.currentTimeMillis());
newDir.setEncrypted(true);
newDir.setPermissions(createdRemoteFolder.getPermissions());
newDir.setDecryptedRemotePath(parent.getDecryptedRemotePath() + filename + "/");
getStorageManager().saveFile(newDir);
RemoteOperationResult encryptionOperationResult = new ToggleEncryptionRemoteOperation(
newDir.getLocalId(),
newDir.getRemotePath(),
true)
.execute(client);
if (!encryptionOperationResult.isSuccess()) {
throw new RuntimeException("Error creating encrypted subfolder!");
}
// Key, always generate new one
byte[] key = EncryptionUtils.generateKey();
@@ -212,6 +186,43 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
token,
client,
metadataExists);
// unlock folder
if (token != null) {
RemoteOperationResult unlockFolderResult = EncryptionUtils.unlockFolder(parent, client, token);
if (unlockFolderResult.isSuccess()) {
token = null;
} else {
// TODO do better
throw new RuntimeException("Could not unlock folder!");
}
}
RemoteOperationResult remoteFolderOperationResult = new ReadFolderRemoteOperation(encryptedRemotePath)
.execute(client);
createdRemoteFolder = (RemoteFile) remoteFolderOperationResult.getData().get(0);
OCFile newDir = new OCFile(createdRemoteFolder.getRemotePath());
newDir.setMimeType(MimeType.DIRECTORY);
newDir.setParentId(parent.getFileId());
newDir.setRemoteId(createdRemoteFolder.getRemoteId());
newDir.setModificationTimestamp(System.currentTimeMillis());
newDir.setEncrypted(true);
newDir.setPermissions(createdRemoteFolder.getPermissions());
newDir.setDecryptedRemotePath(parent.getDecryptedRemotePath() + filename + "/");
getStorageManager().saveFile(newDir);
RemoteOperationResult encryptionOperationResult = new ToggleEncryptionRemoteOperation(
newDir.getLocalId(),
newDir.getRemotePath(),
true)
.execute(client);
if (!encryptionOperationResult.isSuccess()) {
throw new RuntimeException("Error creating encrypted subfolder!");
}
} else {
// revert to sane state in case of any error
Log_OC.e(TAG, remotePath + " hasn't been created");
@@ -249,7 +260,6 @@ public class CreateFolderOperation extends SyncOperation implements OnRemoteOper
// TODO do better
return new RemoteOperationResult(e);
} finally {
// unlock folder
if (token != null) {
RemoteOperationResult unlockFolderResult = EncryptionUtils.unlockFolder(parent, client, token);
@@ -85,6 +85,10 @@ public class DownloadFileOperation extends RemoteOperation {
this.context = context;
}
public DownloadFileOperation(Account account, OCFile file, Context context) {
this(account, file, null, null, null, context);
}
public String getSavePath() {
if (file.getStoragePath() != null) {
File parentFile = new File(file.getStoragePath()).getParentFile();
@@ -106,7 +106,7 @@ public class RemoveFileOperation extends SyncOperation {
context,
fileToRemove.getEncryptedFileName());
} else {
operation = new RemoveFileRemoteOperation(fileToRemove.getDecryptedRemotePath());
operation = new RemoveFileRemoteOperation(fileToRemove.getRemotePath());
}
result = operation.execute(client);
if (result.isSuccess() || result.getCode() == ResultCode.FILE_NOT_FOUND) {
@@ -604,7 +604,7 @@ public class UploadFileOperation extends SyncOperation {
metadata.getFiles().put(encryptedFileName, decryptedFile);
EncryptedFolderMetadata encryptedFolderMetadata = EncryptionUtils.encryptFolderMetadata(metadata,
privateKey);
privateKey);
String serializedFolderMetadata = EncryptionUtils.serializeJSON(encryptedFolderMetadata);
// upload metadata
@@ -613,6 +613,13 @@ public class UploadFileOperation extends SyncOperation {
token,
client,
metadataExists);
// unlock
result = EncryptionUtils.unlockFolder(parentFile, client, token);
if (result.isSuccess()) {
token = null;
}
}
} catch (FileNotFoundException e) {
Log_OC.d(TAG, mFile.getStoragePath() + " not exists anymore");
@@ -650,13 +657,14 @@ public class UploadFileOperation extends SyncOperation {
}
// unlock must be done always
// TODO check if in good state
RemoteOperationResult unlockFolderResult = EncryptionUtils.unlockFolder(parentFile,
client,
token);
if (token != null) {
RemoteOperationResult unlockFolderResult = EncryptionUtils.unlockFolder(parentFile,
client,
token);
if (!unlockFolderResult.isSuccess()) {
return unlockFolderResult;
if (!unlockFolderResult.isSuccess()) {
return unlockFolderResult;
}
}
// delete temporal file
@@ -52,7 +52,6 @@ import java.util.List;
import javax.inject.Inject;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
@@ -78,7 +78,6 @@ public class ContactsPreferenceActivity extends FileActivity implements FileFrag
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contacts_preference);
// setup toolbar
@@ -218,6 +218,13 @@ public class FileDisplayActivity extends FileActivity
@Inject
ConnectivityService connectivityService;
public static Intent openFileIntent(Context context, User user, OCFile file) {
final Intent intent = new Intent(context, PreviewImageActivity.class);
intent.putExtra(FileActivity.EXTRA_FILE, file);
intent.putExtra(FileActivity.EXTRA_ACCOUNT, user.toPlatformAccount());
return intent;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
Log_OC.v(TAG, "onCreate() start");
@@ -2137,6 +2144,7 @@ public class FileDisplayActivity extends FileActivity
return; // not reachable under normal conditions
}
if (showPreview && file.isDown() && !file.isDownloading() || streamMedia) {
showSortListGroup(false);
Fragment mediaFragment = PreviewMediaFragment.newInstance(file, user.get(), startPlaybackPosition, autoplay);
setSecondFragment(mediaFragment);
updateFragmentsVisibility(true);
@@ -2190,6 +2198,7 @@ public class FileDisplayActivity extends FileActivity
* @param folder {@link OCFile} to preview its rich workspace.
*/
public void startRichWorkspacePreview(OCFile folder) {
showSortListGroup(false);
Bundle args = new Bundle();
args.putParcelable(EXTRA_FILE, folder);
Fragment textPreviewFragment = Fragment.instantiate(getApplicationContext(),
@@ -60,6 +60,7 @@ import java.util.List;
import javax.inject.Inject;
import androidx.annotation.VisibleForTesting;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
@@ -239,7 +240,7 @@ public class NotificationsActivity extends FileActivity implements Notifications
private void setupContent() {
emptyContentIcon.setImageResource(R.drawable.ic_notification);
emptyContentProgressBar.getIndeterminateDrawable().setColorFilter(ThemeUtils.primaryAccentColor(this),
PorterDuff.Mode.SRC_IN);
PorterDuff.Mode.SRC_IN);
setLoadingMessage();
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
@@ -249,8 +250,18 @@ public class NotificationsActivity extends FileActivity implements Notifications
fetchAndSetData();
}
private void populateList(List<Notification> notifications) {
@VisibleForTesting
public void populateList(List<Notification> notifications) {
adapter.setNotificationItems(notifications);
if (notifications.size() > 0) {
swipeEmptyListRefreshLayout.setVisibility(View.GONE);
swipeListRefreshLayout.setVisibility(View.VISIBLE);
} else {
setEmptyContent(noResultsHeadline, noResultsMessage);
swipeListRefreshLayout.setVisibility(View.GONE);
swipeEmptyListRefreshLayout.setVisibility(View.VISIBLE);
}
}
private void fetchAndSetData() {
@@ -275,17 +286,7 @@ public class NotificationsActivity extends FileActivity implements Notifications
if (result.isSuccess() && result.getNotificationData() != null) {
final List<Notification> notifications = result.getNotificationData();
runOnUiThread(() -> {
populateList(notifications);
if (notifications.size() > 0) {
swipeEmptyListRefreshLayout.setVisibility(View.GONE);
swipeListRefreshLayout.setVisibility(View.VISIBLE);
} else {
setEmptyContent(noResultsHeadline, noResultsMessage);
swipeListRefreshLayout.setVisibility(View.GONE);
swipeEmptyListRefreshLayout.setVisibility(View.VISIBLE);
}
});
runOnUiThread(() -> populateList(notifications));
} else {
Log_OC.d(TAG, result.getLogMessage());
// show error
@@ -344,7 +345,8 @@ public class NotificationsActivity extends FileActivity implements Notifications
emptyContentProgressBar.setVisibility(View.VISIBLE);
}
private void setEmptyContent(String headline, String message) {
@VisibleForTesting
public void setEmptyContent(String headline, String message) {
if (emptyContentContainer != null && emptyContentMessage != null) {
emptyContentHeadline.setText(headline);
emptyContentMessage.setText(message);
@@ -53,7 +53,7 @@ import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
/**
* Base class providing toolbar registration functionality, see {@link #setupToolbar(boolean)}.
* Base class providing toolbar registration functionality, see {@link #setupToolbar(boolean, boolean)}.
*/
public abstract class ToolbarActivity extends BaseActivity {
protected MaterialButton mMenuButton;
@@ -234,7 +234,10 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
for (PreviewObject previewObject : activity.getPreviews()) {
if (!isDetailView || MimeTypeUtil.isImageOrVideo(previewObject.getMimeType()) ||
MimeTypeUtil.isVideo(previewObject.getMimeType())) {
ImageView imageView = createThumbnailNew(previewObject);
ImageView imageView = createThumbnailNew(previewObject,
activity
.getRichSubjectElement()
.getRichObjectList());
activityViewHolder.list.addView(imageView);
}
}
@@ -256,14 +259,26 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
}
}
private ImageView createThumbnailNew(PreviewObject previewObject) {
private ImageView createThumbnailNew(PreviewObject previewObject, List<RichObject> richObjectList) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(px, px);
params.setMargins(10, 10, 10, 10);
ImageView imageView = new ImageView(context);
imageView.setLayoutParams(params);
for (RichObject object : richObjectList) {
if (Integer.parseInt(object.getId()) == previewObject.getFileId()) {
imageView.setOnClickListener(v -> activityListInterface.onActivityClicked(object));
break;
}
}
if (MimeTypeUtil.isImageOrVideo(previewObject.getMimeType())) {
int placeholder = R.drawable.file;
int placeholder;
if (MimeTypeUtil.isImage(previewObject.getMimeType())) {
placeholder = R.drawable.file_image;
} else {
placeholder = R.drawable.file_movie;
}
Glide.with(context).using(new CustomGlideStreamLoader(currentAccountProvider, clientFactory))
.load(previewObject.getSource())
.placeholder(placeholder)
@@ -271,8 +286,7 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
.into(imageView);
} else {
if (MimeTypeUtil.isFolder(previewObject.getMimeType())) {
imageView.setImageDrawable(
MimeTypeUtil.getDefaultFolderIcon(context));
imageView.setImageDrawable(MimeTypeUtil.getDefaultFolderIcon(context));
} else {
imageView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(previewObject.getMimeType(), "", context));
}
@@ -20,8 +20,10 @@
package com.owncloud.android.ui.adapter;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
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;
@@ -136,11 +138,17 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
holder.message.setText(notification.getMessage());
// Todo set proper action icon (to be clarified how to pick)
if (!TextUtils.isEmpty(notification.getIcon())) {
downloadIcon(notification.getIcon(), holder.icon);
}
int nightModeFlag = notificationsActivity.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (Configuration.UI_MODE_NIGHT_YES == nightModeFlag) {
holder.icon.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
} else {
holder.icon.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN);
}
setButtons(holder, notification);
holder.dismiss.setOnClickListener(v -> new DeleteNotificationTask(client, notification, holder,
@@ -154,8 +162,13 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
Resources resources = notificationsActivity.getResources();
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(20, 0, 20, 0);
LinearLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(
resources.getDimensionPixelOffset(R.dimen.standard_half_margin),
0,
resources.getDimensionPixelOffset(R.dimen.standard_half_margin),
0
);
for (Action action : notification.getActions()) {
button = new MaterialButton(notificationsActivity);
@@ -164,21 +177,19 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
if (action.primary) {
ThemeUtils.colorPrimaryButton(button, notificationsActivity);
button.setTypeface(button.getTypeface(), Typeface.BOLD);
} else {
button.setBackgroundColor(resources.getColor(R.color.grey_200));
button.setTextColor(primaryColor);
button.setTypeface(button.getTypeface(), Typeface.BOLD);
}
button.setAllCaps(false);
button.setText(action.label);
button.setCornerRadiusResource(R.dimen.button_corner_radius);
button.setLayoutParams(params);
button.setGravity(Gravity.CENTER);
button.setPadding(40, 40, 40, 40);
button.setOnClickListener(v -> {
setButtonEnabled(holder, false);
@@ -433,30 +433,53 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
avatar.setImageResource(R.drawable.ic_people);
ThemeUtils.setIconColor(avatar.getDrawable());
} else {
if (sharee.getShareType().equals(ShareType.GROUP)) {
try {
avatar.setImageDrawable(
TextDrawable.createAvatarByUserId(sharee.getUserId(), avatarRadius));
} catch (Exception e) {
Log_OC.e(TAG, "Error calculating RGB value for active account icon.", e);
avatar.setImageResource(R.drawable.ic_people);
switch (sharee.getShareType()) {
case GROUP:
try {
avatar.setImageDrawable(TextDrawable.createAvatarByUserId(sharee.getUserId(),
avatarRadius));
} catch (Exception e) {
Log_OC.e(TAG, "Error calculating RGB value for active account icon.", e);
avatar.setImageResource(R.drawable.ic_people);
ThemeUtils.setIconColor(avatar.getDrawable());
}
break;
case ROOM:
try {
if (!TextUtils.isEmpty(sharee.getDisplayName())) {
avatar.setImageDrawable(
TextDrawable.createNamedAvatar(sharee.getDisplayName(), avatarRadius));
} else {
avatar.setImageDrawable(
TextDrawable.createAvatarByUserId(sharee.getUserId(), avatarRadius));
}
} catch (Exception e) {
Log_OC.e(TAG, "Error calculating RGB value for active account icon.", e);
avatar.setImageResource(R.drawable.ic_people);
ThemeUtils.setIconColor(avatar.getDrawable());
}
break;
case CIRCLE:
avatar.setImageResource(R.drawable.ic_circles);
ThemeUtils.setIconColor(avatar.getDrawable());
}
} else if (sharee.getShareType().equals(ShareType.CIRCLE)) {
avatar.setImageResource(R.drawable.ic_circles);
ThemeUtils.setIconColor(avatar.getDrawable());
} else if (sharee.getUserId().contains("@")) {
showFederatedShareAvatar(sharee.getUserId(), avatarRadius, resources, avatar);
} else {
avatar.setTag(sharee);
DisplayUtils.setAvatar(user,
sharee.getUserId(),
sharee.getDisplayName(),
this,
avatarRadius,
resources,
avatar,
activity);
break;
default:
if (sharee.getUserId().contains("@")) {
showFederatedShareAvatar(sharee.getUserId(), avatarRadius, resources, avatar);
} else {
avatar.setTag(sharee);
DisplayUtils.setAvatar(user,
sharee.getUserId(),
sharee.getDisplayName(),
this,
avatarRadius,
resources,
avatar,
activity);
}
}
}
@@ -581,7 +604,9 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
placeholder = TextDrawable.createAvatarByUserId(userId, avatarRadius);
} catch (Exception e) {
Log_OC.e(TAG, "Error calculating RGB value for active account icon.", e);
placeholder = ResourcesCompat.getDrawable(resources, R.drawable.account_circle_white, null);
placeholder = ThemeUtils.tintDrawable(ResourcesCompat.getDrawable(resources,
R.drawable.account_circle_white, null),
R.color.black);
}
avatar.setTag(null);
@@ -41,6 +41,7 @@ public class PhotoSearchTask extends AsyncTask<Void, Void, RemoteOperationResult
private WeakReference<PhotoFragment> photoFragmentWeakReference;
private SearchRemoteOperation searchRemoteOperation;
private FileDataStorageManager storageManager;
private int limit;
public PhotoSearchTask(int columnsCount,
PhotoFragment photoFragment,
@@ -76,7 +77,7 @@ public class PhotoSearchTask extends AsyncTask<Void, Void, RemoteOperationResult
if (isCancelled()) {
return new RemoteOperationResult(new Exception("Cancelled"));
} else {
int limit = 15 * columnCount;
limit = 15 * columnCount;
long timestamp = -1;
if (adapter.getLastTimestamp() > 0) {
@@ -105,6 +106,11 @@ public class PhotoSearchTask extends AsyncTask<Void, Void, RemoteOperationResult
} else {
OCFileListAdapter adapter = photoFragment.getAdapter();
if (result.getData().size() < limit) {
// stop loading spinner
photoFragment.setSearchDidNotFindNewPhotos(true);
}
adapter.setData(result.getData(),
ExtendedListFragment.SearchType.PHOTO_SEARCH,
storageManager,
@@ -44,6 +44,7 @@ import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.PopupMenu;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
@@ -419,12 +420,15 @@ public class OCFileListFragment extends ExtendedListFragment implements
*/
private void registerFabListener() {
FileActivity activity = (FileActivity) getActivity();
mFabMain.setOnClickListener(v -> new OCFileListBottomSheetDialog(activity,
this,
deviceInfo,
accountManager.getUser(),
getCurrentFile())
.show());
if (mFabMain != null) { // is not available in FolderPickerActivity
mFabMain.setOnClickListener(v -> new OCFileListBottomSheetDialog(activity,
this,
deviceInfo,
accountManager.getUser(),
getCurrentFile())
.show());
}
}
@Override
@@ -899,11 +903,13 @@ public class OCFileListFragment extends ExtendedListFragment implements
int position = mAdapter.getItemPosition(file);
if (file.isFolder()) {
resetHeaderScrollingState();
if (file.isEncrypted()) {
// check if API >= 19
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.KITKAT) {
Snackbar.make(getRecyclerView(), R.string.end_to_end_encryption_not_supported,
Snackbar.LENGTH_LONG).show();
Snackbar.LENGTH_LONG).show();
return;
}
@@ -914,13 +920,14 @@ public class OCFileListFragment extends ExtendedListFragment implements
.getCapability(user.getAccountName());
if (ocCapability.getEndToEndEncryption().isFalse() ||
ocCapability.getEndToEndEncryption().isUnknown()) {
ocCapability.getEndToEndEncryption().isUnknown()) {
Snackbar.make(getRecyclerView(), R.string.end_to_end_encryption_not_enabled,
Snackbar.LENGTH_LONG).show();
Snackbar.LENGTH_LONG).show();
return;
}// check if keys are stored
}
// check if keys are stored
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(
getContext().getContentResolver());
getContext().getContentResolver());
String publicKey = arbitraryDataProvider.getValue(user.toPlatformAccount(),
@@ -994,10 +1001,13 @@ public class OCFileListFragment extends ExtendedListFragment implements
((FileDisplayActivity) mContainerActivity).startContactListFragment(file);
} else if (PreviewTextFileFragment.canBePreviewed(file)) {
setFabVisible(false);
resetHeaderScrollingState();
((FileDisplayActivity) mContainerActivity).startTextPreview(file, false);
} else if (file.isDown()) {
if (PreviewMediaFragment.canBePreviewed(file)) {
// media preview
setFabVisible(false);
resetHeaderScrollingState();
((FileDisplayActivity) mContainerActivity).startMediaPreview(file, 0, true, true, false);
} else {
mContainerActivity.getFileOperationsHelper().openFile(file);
@@ -1011,6 +1021,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
if (PreviewMediaFragment.canBePreviewed(file) && account.getServer().getVersion()
.isMediaStreamingSupported() && !file.isEncrypted()) {
// stream media preview on >= NC14
setFabVisible(false);
resetHeaderScrollingState();
((FileDisplayActivity) mContainerActivity).startMediaPreview(file, 0, true, true, true);
} else if (FileMenuFilter.isEditorAvailable(requireContext().getContentResolver(),
accountManager.getUser(),
@@ -1111,6 +1123,9 @@ public class OCFileListFragment extends ExtendedListFragment implements
if (mActiveActionMode != null) {
mActiveActionMode.finish();
}
resetHeaderScrollingState();
mContainerActivity.showDetails(singleFile);
setFabVisible(false);
mContainerActivity.showSortListGroup(false);
@@ -1598,19 +1613,46 @@ public class OCFileListFragment extends ExtendedListFragment implements
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(EncryptionEvent event) {
final User user = accountManager.getUser();
try {
final User user = accountManager.getUser();
final OwnCloudClient client = clientFactory.create(user);
final ToggleEncryptionRemoteOperation toggleEncryptionOperation = new ToggleEncryptionRemoteOperation(
event.localId, event.remotePath, event.shouldBeEncrypted);
final RemoteOperationResult remoteOperationResult = toggleEncryptionOperation.execute(client);
OwnCloudClient client = clientFactory.create(user);
RemoteOperationResult remoteOperationResult = new ToggleEncryptionRemoteOperation(event.localId,
event.remotePath,
event.shouldBeEncrypted)
.execute(client);
if (remoteOperationResult.isSuccess()) {
mAdapter.setEncryptionAttributeForItemID(event.remoteId, event.shouldBeEncrypted);
// check if keys are stored
ArbitraryDataProvider arbitraryDataProvider =
new ArbitraryDataProvider(requireContext().getContentResolver());
String publicKey = arbitraryDataProvider.getValue(user.toPlatformAccount(),
EncryptionUtils.PUBLIC_KEY);
String privateKey = arbitraryDataProvider.getValue(user.toPlatformAccount(),
EncryptionUtils.PRIVATE_KEY);
if (publicKey.isEmpty() || privateKey.isEmpty()) {
Log_OC.d(TAG, "no public key for " + user.getAccountName());
FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
int position = mAdapter.getItemPosition(storageManager.getFileByRemoteId(event.remoteId));
SetupEncryptionDialogFragment dialog = SetupEncryptionDialogFragment.newInstance(user, position);
dialog.setTargetFragment(this, SetupEncryptionDialogFragment.SETUP_ENCRYPTION_REQUEST_CODE);
dialog.show(getParentFragmentManager(), SetupEncryptionDialogFragment.SETUP_ENCRYPTION_DIALOG_TAG);
}
} else if (remoteOperationResult.getHttpCode() == HttpStatus.SC_FORBIDDEN) {
Snackbar.make(getRecyclerView(), R.string.end_to_end_encryption_folder_not_empty, Snackbar.LENGTH_LONG).show();
Snackbar.make(getRecyclerView(),
R.string.end_to_end_encryption_folder_not_empty,
Snackbar.LENGTH_LONG).show();
} else {
Snackbar.make(getRecyclerView(), R.string.common_error_unknown, Snackbar.LENGTH_LONG).show();
Snackbar.make(getRecyclerView(),
R.string.common_error_unknown,
Snackbar.LENGTH_LONG).show();
}
} catch (ClientFactory.CreationException e) {
@@ -1820,4 +1862,12 @@ public class OCFileListFragment extends ExtendedListFragment implements
});
}
}
private void resetHeaderScrollingState() {
AppBarLayout appBarLayout = ((FileDisplayActivity) requireActivity()).findViewById(R.id.appbar);
if (appBarLayout != null) {
appBarLayout.setExpanded(true);
}
}
}
@@ -4,6 +4,7 @@
* @author Tobias Kaminsky
* Copyright (C) 2017 Tobias Kaminsky
* Copyright (C) 2017 Nextcloud GmbH.
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
* <p>
* 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
@@ -22,11 +23,9 @@
package com.owncloud.android.ui.fragment.contactsbackup;
import android.Manifest;
import android.content.BroadcastReceiver;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -58,12 +57,15 @@ import com.google.android.material.snackbar.Snackbar;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.di.Injectable;
import com.nextcloud.client.files.downloader.Download;
import com.nextcloud.client.files.downloader.DownloadState;
import com.nextcloud.client.files.downloader.DownloaderConnection;
import com.nextcloud.client.files.downloader.Request;
import com.nextcloud.client.jobs.BackgroundJobManager;
import com.nextcloud.client.network.ClientFactory;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.TextDrawable;
import com.owncloud.android.ui.activity.ContactsPreferenceActivity;
@@ -101,6 +103,7 @@ import butterknife.ButterKnife;
import ezvcard.Ezvcard;
import ezvcard.VCard;
import ezvcard.property.Photo;
import kotlin.Unit;
import static com.owncloud.android.ui.fragment.contactsbackup.ContactListFragment.getDisplayName;
@@ -148,6 +151,7 @@ public class ContactListFragment extends FileFragment implements Injectable {
@Inject UserAccountManager accountManager;
@Inject ClientFactory clientFactory;
@Inject BackgroundJobManager backgroundJobManager;
private DownloaderConnection fileDownloader;
public static ContactListFragment newInstance(OCFile file, User user) {
ContactListFragment frag = new ContactListFragment();
@@ -209,18 +213,12 @@ public class ContactListFragment extends FileFragment implements Injectable {
ocFile = getArguments().getParcelable(FILE_NAME);
setFile(ocFile);
user = getArguments().getParcelable(USER);
fileDownloader = new DownloaderConnection(getActivity(), user);
fileDownloader.registerDownloadListener(this::onDownloadUpdate);
fileDownloader.bind();
if (!ocFile.isDown()) {
Intent i = new Intent(getContext(), FileDownloader.class);
i.putExtra(FileDownloader.EXTRA_USER, user);
i.putExtra(FileDownloader.EXTRA_FILE, ocFile);
getContext().startService(i);
// Listen for download messages
IntentFilter downloadIntentFilter = new IntentFilter(FileDownloader.getDownloadAddedMessage());
downloadIntentFilter.addAction(FileDownloader.getDownloadFinishMessage());
DownloadFinishReceiver mDownloadFinishReceiver = new DownloadFinishReceiver();
getContext().registerReceiver(mDownloadFinishReceiver, downloadIntentFilter);
Request request = new Request(user, ocFile);
fileDownloader.download(request);
} else {
loadContactsTask.execute();
}
@@ -240,6 +238,14 @@ public class ContactListFragment extends FileFragment implements Injectable {
return view;
}
@Override
public void onDetach() {
super.onDetach();
if (fileDownloader != null) {
fileDownloader.unbind();
}
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
@@ -497,19 +503,13 @@ public class ContactListFragment extends FileFragment implements Injectable {
}
}
private class DownloadFinishReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (FileDownloader.getDownloadFinishMessage().equalsIgnoreCase(intent.getAction())) {
String downloadedRemotePath = intent.getStringExtra(FileDownloader.EXTRA_REMOTE_PATH);
FileDataStorageManager storageManager = new FileDataStorageManager(user.toPlatformAccount(),
context.getContentResolver());
ocFile = storageManager.getFileByPath(downloadedRemotePath);
loadContactsTask.execute();
}
private Unit onDownloadUpdate(Download download) {
final Activity activity = getActivity();
if (download.getState() == DownloadState.COMPLETED && activity != null) {
ocFile = download.getFile();
loadContactsTask.execute();
}
return Unit.INSTANCE;
}
public static class VCardComparator implements Comparator<VCard> {
@@ -864,7 +864,9 @@ public class FileOperationsHelper {
public void toggleEncryption(OCFile file, boolean shouldBeEncrypted) {
if (file.isEncrypted() != shouldBeEncrypted) {
EventBus.getDefault().post(new EncryptionEvent(file.getLocalId(), file.getRemoteId(), file.getRemotePath(),
EventBus.getDefault().post(new EncryptionEvent(file.getLocalId(),
file.getRemoteId(),
file.getRemotePath(),
shouldBeEncrypted));
}
}
@@ -80,12 +80,17 @@ public class PreviewImageActivity extends FileActivity implements
Injectable {
public static final String TAG = PreviewImageActivity.class.getSimpleName();
private static final String KEY_WAITING_FOR_BINDER = "WAITING_FOR_BINDER";
private static final String KEY_SYSTEM_VISIBLE = "TRUE";
public static final String EXTRA_VIRTUAL_TYPE = "EXTRA_VIRTUAL_TYPE";
public static Intent previewFileIntent(Context context, User user, OCFile file) {
final Intent intent = new Intent(context, PreviewImageActivity.class);
intent.putExtra(FileActivity.EXTRA_FILE, file);
intent.putExtra(FileActivity.EXTRA_ACCOUNT, user.toPlatformAccount());
return intent;
}
private ViewPager mViewPager;
private PreviewImagePagerAdapter mPreviewImagePagerAdapter;
private int mSavedPosition;
@@ -655,13 +655,13 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
}
private LayerDrawable generateCheckerboardLayeredDrawable(LoadImage result, Bitmap bitmap) {
Resources r = getResources();
Resources resources = getResources();
Drawable[] layers = new Drawable[2];
layers[0] = r.getDrawable(R.color.bg_default);
layers[0] = ResourcesCompat.getDrawable(resources, R.color.bg_default, null);
Drawable bitmapDrawable;
if (MIME_TYPE_PNG.equalsIgnoreCase(result.ocFile.getMimeType())) {
bitmapDrawable = new BitmapDrawable(getResources(), bitmap);
bitmapDrawable = new BitmapDrawable(resources, bitmap);
} else if (MIME_TYPE_SVG.equalsIgnoreCase(result.ocFile.getMimeType())) {
bitmapDrawable = result.drawable;
} else if (MIME_TYPE_GIF.equalsIgnoreCase(result.ocFile.getMimeType())) {
@@ -671,7 +671,7 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
bitmapDrawable = result.drawable;
}
} else {
bitmapDrawable = new BitmapDrawable(getResources(), bitmap);
bitmapDrawable = new BitmapDrawable(resources, bitmap);
}
layers[1] = bitmapDrawable;
@@ -69,10 +69,16 @@ import static com.owncloud.android.utils.DisplayUtils.openSortingOrderDialogFrag
* Presenting trashbin data, received from presenter
*/
public class TrashbinActivity extends FileActivity implements
TrashbinActivityInterface,
SortingOrderDialogFragment.OnSortingOrderListener,
TrashbinContract.View,
Injectable {
TrashbinActivityInterface,
SortingOrderDialogFragment.OnSortingOrderListener,
TrashbinContract.View,
Injectable {
@BindView(R.id.empty_list_progress)
public View emptyListProgress;
@BindView(R.id.empty_list_view)
public View emptyListView;
@BindView(R.id.empty_list_view_text)
public TextView emptyContentMessage;
@@ -131,8 +137,8 @@ public class TrashbinActivity extends FileActivity implements
private void setupContent() {
recyclerView = findViewById(android.R.id.list);
recyclerView.setEmptyView(findViewById(R.id.empty_list_view));
findViewById(R.id.empty_list_progress).setVisibility(View.GONE);
recyclerView.setEmptyView(emptyListView);
emptyListView.setVisibility(View.GONE);
emptyContentIcon.setImageResource(R.drawable.ic_delete);
emptyContentIcon.setVisibility(View.VISIBLE);
emptyContentHeadline.setText(noResultsHeadline);
@@ -276,6 +282,7 @@ public class TrashbinActivity extends FileActivity implements
if (active) {
trashbinListAdapter.setTrashbinFiles(trashbinFiles, true);
swipeListRefreshLayout.setRefreshing(false);
emptyListProgress.setVisibility(View.GONE);
}
}
@@ -314,6 +321,8 @@ public class TrashbinActivity extends FileActivity implements
emptyContentMessage.setVisibility(View.VISIBLE);
emptyContentIcon.setVisibility(View.VISIBLE);
emptyListView.setVisibility(View.VISIBLE);
emptyListProgress.setVisibility(View.GONE);
}
}
}
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Nextcloud Android client application
@author Chris Narkiewicz
Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:stretchColumns="1">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@string/etm_download_uuid" />
<TextView
android:id="@+id/etm_download_uuid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="d7edb387-0b61-4e4e-a728-ffab3055d700" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@string/etm_download_path" />
<TextView
android:id="@+id/etm_download_path"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="file path" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@string/etm_download_user" />
<TextView
android:id="@+id/etm_download_user"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="[email protected]" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@string/etm_download_state" />
<TextView
android:id="@+id/etm_download_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="PENDING" />
</TableRow>
<TableRow
android:id="@+id/etm_download_progress_row"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@string/etm_download_progress" />
<TextView
android:id="@+id/etm_download_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="50%" />
</TableRow>
</TableLayout>
Loaded 100 of 230 files, more files were not shown because too many files have changed in this diff. Show more