Skip to content

Commit 119656c

Browse files
committed
Code reverted as for icons we will have separate cluster as "icon"
1 parent 070367f commit 119656c

File tree

6 files changed

+75
-122
lines changed

6 files changed

+75
-122
lines changed

app/src/androidTest/java/com/nmc/android/OCFileListBottomSheetDialogIT.kt

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
package com.nmc.android
22

33
import android.os.Looper
4+
import androidx.activity.result.contract.ActivityResultContract
45
import androidx.test.espresso.Espresso.onView
56
import androidx.test.espresso.assertion.ViewAssertions.matches
67
import androidx.test.espresso.intent.rule.IntentsTestRule
78
import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
89
import androidx.test.espresso.matcher.ViewMatchers.withText
910
import com.google.android.material.bottomsheet.BottomSheetBehavior
10-
import com.google.android.material.bottomsheet.BottomSheetDialog
1111
import com.google.gson.Gson
1212
import com.nextcloud.client.device.DeviceInfo
13+
import com.nextcloud.client.documentscan.AppScanOptionalFeature
14+
import com.nextcloud.client.preferences.AppPreferencesImpl
15+
import com.nextcloud.utils.EditorUtils
1316
import com.owncloud.android.AbstractIT
1417
import com.owncloud.android.datamodel.ArbitraryDataProvider
1518
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl
@@ -19,36 +22,34 @@ import com.owncloud.android.lib.common.DirectEditing
1922
import com.owncloud.android.lib.resources.status.CapabilityBooleanType
2023
import com.owncloud.android.ui.activity.FileDisplayActivity
2124
import com.owncloud.android.ui.fragment.OCFileListBottomSheetActions
22-
import com.owncloud.android.ui.fragment.OCFileListBottomSheetDialogFragment
25+
import com.owncloud.android.ui.fragment.OCFileListBottomSheetDialog
2326
import com.owncloud.android.utils.MimeTypeUtil
2427
import com.owncloud.android.utils.theme.CapabilityUtils
28+
import org.junit.Before
2529
import org.junit.Rule
2630
import org.junit.Test
31+
import org.mockito.Mock
32+
import org.mockito.MockitoAnnotations
2733

2834
class OCFileListBottomSheetDialogIT : AbstractIT() {
2935

36+
@Mock
37+
private lateinit var actions: OCFileListBottomSheetActions
38+
3039
@get:Rule
3140
val activityRule = IntentsTestRule(FileDisplayActivity::class.java, true, true)
3241

42+
@Before
43+
fun setUp() {
44+
MockitoAnnotations.initMocks(this)
45+
}
46+
3347
@Test
3448
fun validateCreateTextDocumentMenuOption() {
3549
if (Looper.myLooper() == null) {
3650
Looper.prepare()
3751
}
3852

39-
val action: OCFileListBottomSheetActions = object : OCFileListBottomSheetActions {
40-
override fun createFolder() {}
41-
override fun uploadFromApp() {}
42-
override fun uploadFiles() {}
43-
override fun newDocument() {}
44-
override fun newSpreadsheet() {}
45-
override fun newPresentation() {}
46-
override fun directCameraUpload() {}
47-
override fun scanDocUpload() {}
48-
override fun showTemplate(creator: Creator, headline: String) {}
49-
override fun createRichWorkspace() {}
50-
}
51-
5253
val info = DeviceInfo()
5354
val ocFile = OCFile("/test.md")
5455

@@ -81,19 +82,32 @@ class OCFileListBottomSheetDialogIT : AbstractIT() {
8182
capability.accountName = user.accountName
8283
CapabilityUtils.updateCapability(capability)
8384

84-
val sut = OCFileListBottomSheetDialogFragment(
85+
val appScanOptionalFeature: AppScanOptionalFeature = object : AppScanOptionalFeature() {
86+
override fun getScanContract(): ActivityResultContract<Unit, String?> {
87+
throw UnsupportedOperationException("Document scan is not available")
88+
}
89+
}
90+
91+
val editorUtils = EditorUtils(ArbitraryDataProviderImpl(targetContext))
92+
val sut = OCFileListBottomSheetDialog(
8593
activityRule.activity,
86-
action,
94+
actions,
8795
info,
8896
user,
89-
ocFile
97+
ocFile,
98+
activityRule.activity.themeUtils,
99+
activityRule.activity.viewThemeUtils,
100+
editorUtils,
101+
appScanOptionalFeature,
102+
//required when merging all branches as in MarketTracking AppPreferences is required
103+
AppPreferencesImpl.fromContext(targetContext)
90104
)
91105

92-
sut.show(activityRule.activity.supportFragmentManager, "")
106+
activityRule.activity.runOnUiThread { sut.show() }
93107

94108
waitForIdleSync()
95109

96-
(sut.requireDialog() as BottomSheetDialog).behavior.state = BottomSheetBehavior.STATE_EXPANDED
110+
sut.behavior.state = BottomSheetBehavior.STATE_EXPANDED
97111

98112
shortSleep()
99113

app/src/main/java/com/owncloud/android/utils/MimeTypeUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,10 @@ private static void populateMimeTypeIconMapping() {
496496
MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-visio.template", R.drawable.file_doc);
497497
MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-word.document.macroEnabled.12", R.drawable.file_doc);
498498
MIMETYPE_TO_ICON_MAPPING.put("application/vnd.ms-word.template.macroEnabled.12", R.drawable.file_doc);
499+
MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.formula", R.drawable.file_analytics);
500+
MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.formula-template", R.drawable.file_analytics);
501+
MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.graphics", R.drawable.file_analytics);
502+
MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.graphics-template", R.drawable.file_analytics);
499503
MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.presentation", R.drawable.file_ppt);
500504
MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.presentation-template", R.drawable.file_ppt);
501505
MIMETYPE_TO_ICON_MAPPING.put("application/vnd.oasis.opendocument.spreadsheet", R.drawable.file_xls);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--
2+
Nextcloud Android client application
3+
4+
Copyright (C) 2023 Nextcloud.
5+
6+
This program is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
8+
License as published by the Free Software Foundation; either
9+
version 3 of the License, or any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU AFFERO GENERAL PUBLIC LICENSE for more details.
15+
16+
You should have received a copy of the GNU Affero General Public
17+
License along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
-->
19+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
20+
android:width="16dp"
21+
android:height="16dp"
22+
android:viewportWidth="16"
23+
android:viewportHeight="16">
24+
<path
25+
android:fillColor="#49ABEA"
26+
android:fillType="nonZero"
27+
android:pathData="M2.5,1L11,1L14,4L14,14.5C14,14.78 13.78,15 13.5,15L2.5,15C2.22,15 2,14.78 2,14.5L2,1.5C2,1.22 2.22,1 2.5,1ZM5.126,8.72L6.698,6.972C6.751,6.987 6.808,6.996 6.866,6.996C6.966,6.996 7.06,6.971 7.143,6.927L8.562,7.992C8.554,8.03 8.55,8.07 8.55,8.11C8.55,8.439 8.821,8.71 9.15,8.71C9.479,8.71 9.75,8.439 9.75,8.11C9.75,8.071 9.746,8.032 9.738,7.995L11.166,6.932C11.246,6.973 11.338,6.996 11.434,6.996C11.763,6.996 12.034,6.725 12.034,6.396C12.032,6.068 11.762,5.798 11.434,5.796C11.105,5.796 10.834,6.067 10.834,6.396C10.834,6.417 10.835,6.438 10.837,6.458L9.391,7.562C9.317,7.529 9.235,7.511 9.15,7.511C9.063,7.511 8.981,7.529 8.906,7.563L7.459,6.483C7.464,6.454 7.466,6.426 7.466,6.396C7.464,6.068 7.194,5.798 6.866,5.796C6.537,5.796 6.266,6.067 6.266,6.396C6.266,6.459 6.276,6.52 6.294,6.577L4.696,8.38C4.659,8.372 4.621,8.368 4.582,8.368C4.253,8.368 3.982,8.639 3.982,8.968C3.982,9.296 4.253,9.567 4.582,9.567C4.911,9.567 5.182,9.296 5.182,8.968C5.181,8.879 5.161,8.796 5.126,8.72ZM8.58,9.852L8.58,12.993L9.722,12.993L9.722,9.852L8.58,9.852ZM6.294,8.71L6.294,12.993L7.436,12.993L7.436,8.71L6.294,8.71ZM4.01,10.709L4.01,12.993L5.152,12.993L5.152,10.709L4.01,10.709ZM10.864,8.71L10.864,12.993L12.006,12.993L12.006,8.71L10.864,8.71Z" />
28+
</vector>

app/src/main/res/drawable/file_doc.xml

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,7 @@
1818
1919
Icon provided by Android Material Library in Apache License 2.0
2020
-->
21-
<vector xmlns:android="http://schemas.android.com/apk/res/android"
22-
xmlns:aapt="http://schemas.android.com/aapt"
23-
android:width="64dp"
24-
android:height="64dp"
25-
android:viewportWidth="64"
26-
android:viewportHeight="64">
27-
<path android:pathData="M58.29,17.14V61.71A2.3,2.3 0,0 1,56 64H8a2.3,2.3 0,0 1,-2.29 -2.29V2.29A2.3,2.3 0,0 1,8 0H41.14Z">
28-
<aapt:attr name="android:fillColor">
29-
<gradient
30-
android:endX="32"
31-
android:endY="0"
32-
android:startX="32"
33-
android:startY="64"
34-
android:type="linear">
35-
<item
36-
android:color="#FFDDD6D3"
37-
android:offset="0" />
38-
<item
39-
android:color="#FFE9E4E2"
40-
android:offset="0.39" />
41-
<item
42-
android:color="#FFE9E4E2"
43-
android:offset="1" />
44-
</gradient>
45-
</aapt:attr>
46-
</path>
47-
<path
48-
android:fillAlpha="0.7"
49-
android:fillColor="#b9ada7"
50-
android:pathData="M58.29,17.14H43.43a2.29,2.29 0,0 1,-2.29 -2.28V0Z"
51-
android:strokeAlpha="0.7" />
52-
<path
53-
android:fillColor="#529ad6"
54-
android:pathData="M44,22.86L20,22.86a1.76,1.76 0,0 0,-1.71 1.71v1.72L45.71,26.29L45.71,24.57A1.76,1.76 0,0 0,44 22.86ZM18.29,48.57A1.76,1.76 0,0 0,20 50.29L44,50.29a1.76,1.76 0,0 0,1.71 -1.72v-20L18.29,28.57v20ZM22.86,32L41.14,32v2.29L22.86,34.29ZM22.86,37.71L41.14,37.71L41.14,40L22.86,40ZM22.86,43.43L34.29,43.43v2.28L22.86,45.71Z" />
21+
<vector android:height="72dp" android:viewportHeight="16"
22+
android:viewportWidth="16" android:width="72dp" xmlns:android="http://schemas.android.com/apk/res/android">
23+
<path android:fillColor="#49abea" android:pathData="m2.5,1c-0.28,0 -0.5,0.22 -0.5,0.5v13c0,0.28 0.22,0.5 0.5,0.5h11c0.28,0 0.5,-0.22 0.5,-0.5v-10.5l-3,-3h-8.5zM4,3h6v1h-6v-1zM4,6h5v1h-5v-1zM4,9h8v1h-8v-1zM4,12h4v1h-4v-1z"/>
5524
</vector>
Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,4 @@
1-
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:aapt="http://schemas.android.com/aapt"
3-
android:width="64dp"
4-
android:height="64dp"
5-
android:viewportWidth="64"
6-
android:viewportHeight="64">
7-
<path android:pathData="M58.29,17.14V61.71A2.3,2.3 0,0 1,56 64H8a2.3,2.3 0,0 1,-2.29 -2.29V2.29A2.3,2.3 0,0 1,8 0H41.14Z">
8-
<aapt:attr name="android:fillColor">
9-
<gradient
10-
android:endX="32"
11-
android:endY="0"
12-
android:startX="32"
13-
android:startY="64"
14-
android:type="linear">
15-
<item
16-
android:color="#FFDDD6D3"
17-
android:offset="0" />
18-
<item
19-
android:color="#FFE9E4E2"
20-
android:offset="0.39" />
21-
<item
22-
android:color="#FFE9E4E2"
23-
android:offset="1" />
24-
</gradient>
25-
</aapt:attr>
26-
</path>
27-
<path
28-
android:fillAlpha="0.7"
29-
android:fillColor="#b9ada7"
30-
android:pathData="M58.29,17.14H43.43a2.29,2.29 0,0 1,-2.29 -2.28V0Z"
31-
android:strokeAlpha="0.7" />
32-
<path
33-
android:fillColor="#ff9a1e"
34-
android:pathData="M44,22.86L20,22.86a1.76,1.76 0,0 0,-1.71 1.71v1.72L45.71,26.29L45.71,24.57A1.68,1.68 0,0 0,44 22.86ZM18.29,48.57A1.76,1.76 0,0 0,20 50.29L44,50.29a1.76,1.76 0,0 0,1.71 -1.72v-20L18.29,28.57v20ZM37.71,30.86h4.58L42.29,48L37.71,48ZM29.71,35.43h4.58L34.29,48L29.71,48ZM21.71,40h4.58v8L21.71,48Z" />
1+
<vector android:height="72dp" android:viewportHeight="16"
2+
android:viewportWidth="16" android:width="72dp" xmlns:android="http://schemas.android.com/apk/res/android">
3+
<path android:fillColor="#f0965f" android:pathData="m1.5,2c-0.25,0 -0.5,0.25 -0.5,0.5v11c0,0.25 0.25,0.5 0.5,0.5h13c0.25,0 0.5,-0.25 0.5,-0.5v-11c0,-0.25 -0.25,-0.5 -0.5,-0.5zM2,5h12v6h-12z"/>
354
</vector>
Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,4 @@
1-
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:aapt="http://schemas.android.com/aapt"
3-
android:width="64dp"
4-
android:height="64dp"
5-
android:viewportWidth="64"
6-
android:viewportHeight="64">
7-
<path android:pathData="M58.29,17.14V61.71A2.3,2.3 0,0 1,56 64H8a2.3,2.3 0,0 1,-2.29 -2.29V2.29A2.3,2.3 0,0 1,8 0H41.14Z">
8-
<aapt:attr name="android:fillColor">
9-
<gradient
10-
android:endX="32"
11-
android:endY="0"
12-
android:startX="32"
13-
android:startY="64"
14-
android:type="linear">
15-
<item
16-
android:color="#FFDDD6D3"
17-
android:offset="0" />
18-
<item
19-
android:color="#FFE9E4E2"
20-
android:offset="0.39" />
21-
<item
22-
android:color="#FFE9E4E2"
23-
android:offset="1" />
24-
</gradient>
25-
</aapt:attr>
26-
</path>
27-
<path
28-
android:fillAlpha="0.7"
29-
android:fillColor="#b9ada7"
30-
android:pathData="M58.29,17.14H43.43a2.29,2.29 0,0 1,-2.29 -2.28V0Z"
31-
android:strokeAlpha="0.7" />
32-
<path
33-
android:fillColor="#bfcb44"
34-
android:pathData="M44,22.86L20,22.86a1.76,1.76 0,0 0,-1.71 1.71v1.72L45.71,26.29L45.71,24.57A1.76,1.76 0,0 0,44 22.86ZM28.57,50.29h6.86L35.43,28.57L28.57,28.57ZM18.29,48.57A1.76,1.76 0,0 0,20 50.29h6.29L26.29,28.57h-8ZM37.71,50.29L44,50.29a1.76,1.76 0,0 0,1.71 -1.72v-20h-8Z" />
1+
<vector android:height="72dp" android:viewportHeight="16"
2+
android:viewportWidth="16" android:width="72dp" xmlns:android="http://schemas.android.com/apk/res/android">
3+
<path android:fillColor="#9abd4e" android:pathData="m2.5,1c-0.28,0 -0.5,0.22 -0.5,0.5v13c0,0.28 0.22,0.5 0.5,0.5h11c0.28,0 0.5,-0.22 0.5,-0.5v-10.5l-3,-3h-8.5zM4,4h2v2h-2v-2zM7,4h5v2h-5v-2zM4,7h2v2h-2v-2zM7,7h5v2h-5v-2zM4,10h2v2h-2v-2zM7,10h5v2h-5v-2z"/>
354
</vector>

0 commit comments

Comments
 (0)