-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix/update folder icons #12003
Merged
Merged
Bugfix/update folder icons #12003
Changes from 57 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
22e1f7e
Add getFileIcon function inside OCFile
0358dce
Add isAutoUploadFolder function to SyncedFolderProvider
b351c57
Use getFileIcon for thumbnailView
2dc0d56
Add folder_encrypted icon
65461a7
Use folder key icon for encrypted state
e4dd05c
Add folder overlay icons
c7cb4fa
Use overlay method to get file icon
80cf6f0
Use new method for get thumbnail image
32b8993
Add DrawableUtil
4b35088
Use overlay method for UploadAdapter
bbea0e0
Apply color changes for folder
929b704
Use overlay method for ShortcutUtil
16db8c0
Use overlay method for ShareActivity
aee3ffd
Change drawable to layer drawable
44e38c6
Use overlay method for EditorWebView
3aa9c8a
Remove ViewThemeUtils usage to provide correct folder color
9870a80
Remove duplicated default folder icon func from MimeTypeUtil
ca09000
Use overlay method for GroupfolderListAdapter
1f39139
Mark failed tests
29e934f
Add DrawableUtilTests for testing overlaying icons
23cd9f9
Rename OCFile function name to getFileIcon
f745db1
Extract getFileOverlayIcon function from getFileIcon
bfd8079
Add OCFileIconTests
7aa837f
Add tests for each different folder icon type
6ed626d
Remove Mockito from OCFileIconTests
6fc9970
Rename getFileOverlayIcon to getFileOverlayIconId
48bdbac
Replace null check with assert due to ContextCompat.getDrawable nulla…
651908a
Todo comment added
c570c4f
Add viewThemeUtils for different primary colors
6ccefc4
Remove unused icons from project directory
15f5856
Move getFileIcon into the MimeTypeUtil
8105a02
Add default folder icon function added due to apply color primary
8b9361f
Use getDefaultFolderIcon
095c19b
Add different folder types
afdd18a
Change overlay icon color to white
88de0a2
Change top margin to 4
be543f6
Change top margin to 3 due to ss tests
b0c584b
Support overlay drawable icon for Dark mode
9e4bac2
Add isDarkModeEnabled function
59cacab
Use isDarkModeEnabled function
c618b20
Reset overlay icon size
6ae12b0
Add extensions package under utils
a0083b9
Change overlay icon size according to density
68f3c6e
Update usage of addDrawableAsOverlay function
b38c54a
Update screenshots
7458ba3
Fix detekt findings
bbeccfb
Change overlaying mechanism
dbbe6de
Add licence header for new files
3b74655
Add licence header for new icons
5be983b
Fix imports for gPlay flavour
c94a190
Fix spotlessKotlinCheck
a3014ad
Fix Static code analysis warnings
5b7bb2f
test analysis.yml not running on garm
tobiasKaminsky 3ab49e4
Fix spotlessKotlinCheck
a24609f
Fix code analysis
ffdf859
Fix spotlessKotlinCheck
alperozturk96 1e4e417
Fix autoUploadFolder
alperozturk96 95453d8
Remove FIXME comments
alperozturk96 ff69191
fix nullability of getDarkThemeMode function
alperozturk96 887c197
Fix SplashScreen title tests
alperozturk96 b853dce
Add testOnlyOnServer function inside AbstractIT
alperozturk96 e56ab6d
Fix testMetaData
alperozturk96 cd54020
Fix testCreationAndUploadTimestamp
alperozturk96 7e0d058
Fix spotlessKotlinCheck
alperozturk96 cde7edb
Fix Codacy Spotbugs
alperozturk96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+18 Bytes
(100%)
....ui.fragment.FileDetailFragmentStaticServerIT_showFileDetailDetailsFragment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+9.13 KB
(180%)
...ncloud.android.ui.fragment.OCFileListFragmentStaticServerIT_showFolderTypes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
app/src/androidTest/java/com/owncloud/android/datamodel/OCFileIconTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* Nextcloud Android client application | ||
* | ||
* @author Alper Ozturk | ||
* Copyright (C) 2023 Alper Ozturk | ||
* Copyright (C) 2023 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.datamodel | ||
|
||
import com.owncloud.android.R | ||
import com.owncloud.android.lib.common.network.WebdavEntry.MountType | ||
import org.junit.After | ||
import org.junit.Before | ||
import org.junit.Test | ||
|
||
class OCFileIconTests { | ||
|
||
private val path = "/path/to/a/file.txt" | ||
private var sut: OCFile? = null | ||
|
||
@Before | ||
fun setup() { | ||
sut = OCFile(path) | ||
} | ||
|
||
@Test | ||
fun testGetFileOverlayIconWhenFileIsAutoUploadFolderShouldReturnFolderOverlayUploadIcon() { | ||
val fileOverlayIcon = sut?.getFileOverlayIconId(true) | ||
val expectedDrawable = R.drawable.ic_folder_overlay_upload | ||
assert(fileOverlayIcon == expectedDrawable) | ||
} | ||
|
||
@Test | ||
fun testGetFileOverlayIconWhenFileIsEncryptedShouldReturnFolderOverlayKeyIcon() { | ||
sut?.isEncrypted = true | ||
val fileOverlayIcon = sut?.getFileOverlayIconId(false) | ||
val expectedDrawable = R.drawable.ic_folder_overlay_key | ||
assert(fileOverlayIcon == expectedDrawable) | ||
} | ||
|
||
@Test | ||
fun testGetFileOverlayIconWhenFileIsGroupFolderShouldReturnFolderOverlayAccountGroupIcon() { | ||
sut?.mountType = MountType.GROUP | ||
val fileOverlayIcon = sut?.getFileOverlayIconId(false) | ||
val expectedDrawable = R.drawable.ic_folder_overlay_account_group | ||
assert(fileOverlayIcon == expectedDrawable) | ||
} | ||
|
||
@Test | ||
fun testGetFileOverlayIconWhenFileIsSharedViaLinkShouldReturnFolderOverlayLinkIcon() { | ||
sut?.isSharedViaLink = true | ||
val fileOverlayIcon = sut?.getFileOverlayIconId(false) | ||
val expectedDrawable = R.drawable.ic_folder_overlay_link | ||
assert(fileOverlayIcon == expectedDrawable) | ||
} | ||
|
||
@Test | ||
fun testGetFileOverlayIconWhenFileIsSharedShouldReturnFolderOverlayShareIcon() { | ||
sut?.isSharedWithSharee = true | ||
val fileOverlayIcon = sut?.getFileOverlayIconId(false) | ||
val expectedDrawable = R.drawable.ic_folder_overlay_share | ||
assert(fileOverlayIcon == expectedDrawable) | ||
} | ||
|
||
@Test | ||
fun testGetFileOverlayIconWhenFileIsExternalShouldReturnFolderOverlayExternalIcon() { | ||
sut?.mountType = MountType.EXTERNAL | ||
val fileOverlayIcon = sut?.getFileOverlayIconId(false) | ||
val expectedDrawable = R.drawable.ic_folder_overlay_external | ||
assert(fileOverlayIcon == expectedDrawable) | ||
} | ||
|
||
@Test | ||
fun testGetFileOverlayIconWhenFileIsLockedShouldReturnFolderOverlayLockIcon() { | ||
sut?.isLocked = true | ||
val fileOverlayIcon = sut?.getFileOverlayIconId(false) | ||
val expectedDrawable = R.drawable.ic_folder_overlay_lock | ||
assert(fileOverlayIcon == expectedDrawable) | ||
} | ||
|
||
@Test | ||
fun testGetFileOverlayIconWhenFileIsFolderShouldReturnNull() { | ||
val fileOverlayIcon = sut?.getFileOverlayIconId(false) | ||
assert(fileOverlayIcon == null) | ||
} | ||
|
||
@After | ||
fun destroy() { | ||
sut = null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
app/src/androidTest/java/com/owncloud/android/utils/DrawableUtilTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Nextcloud Android client application | ||
* | ||
* @author Alper Ozturk | ||
* Copyright (C) 2023 Alper Ozturk | ||
* Copyright (C) 2023 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.utils | ||
|
||
import android.content.Context | ||
import android.graphics.Bitmap | ||
import android.graphics.drawable.BitmapDrawable | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import org.junit.After | ||
import org.junit.Assert.fail | ||
import org.junit.Before | ||
import org.junit.Test | ||
|
||
class DrawableUtilTests { | ||
|
||
private var sut: DrawableUtil? = null | ||
private var context: Context? = null | ||
|
||
@Before | ||
fun setUp() { | ||
sut = DrawableUtil() | ||
context = InstrumentationRegistry.getInstrumentation().context | ||
} | ||
|
||
@Test | ||
fun testAddDrawableAsOverlayWhenGivenValidDrawablesShouldContainTwoDrawable() { | ||
val bitmap: Bitmap = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_8888) | ||
val drawable = BitmapDrawable(context?.resources, bitmap) | ||
|
||
val layerDrawable = sut?.addDrawableAsOverlay(drawable, drawable) | ||
|
||
if (layerDrawable == null) { | ||
fail("Layer drawable expected to be not null") | ||
} | ||
|
||
assert(layerDrawable?.numberOfLayers == 2) | ||
} | ||
|
||
@After | ||
fun destroy() { | ||
sut = null | ||
context = null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are those really failing?
In latest run I only saw location and activity error.
If they are not failing, please remove those comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran those marked test still fails in my local machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why the tests fails is that CI/CD runs on Android 8. My local device is Android 14 so the tests are failing. For example the expected file path is different on newer Android versions.