Skip to content

Commit c1ac383

Browse files
committed
NMC-1920: Customized theming related changes for grid and list views.
NMC-2121: Theming applied to passcode. NMC-2374: Image edit functionality customized. NMC-1941: Fixed error message coming after camera permission allowed. NMC-2052: Fix back arrow appearing as hamburger icon. NC PR: nextcloud#11769 NMC-2465: Fix local db version to avoid crash during app upgrade. NMC-2576: Disabled switch account SnackBar. NMC-2123: Widget disabled. NMC-2127: System default night mode. NMC-1919: Backup Calendar-Contacts configured with test cases. NMC-2089: Reduce log levels NMC-4633: disable permission check in search screen Media View multi-selection customized NMC-4799: uploads screen icon color fix NMC-4862: deactivate github report snackbar Added androidTest to verify colors, strings, dimens customized in this branch PR for NMC.
1 parent 2081ff8 commit c1ac383

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1244
-226
lines changed
Lines changed: 363 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,363 @@
1+
/*
2+
* Nextcloud - Android Client
3+
*
4+
* SPDX-FileCopyrightText: 2025 TSI-mc <surinder.kumar@t-systems.com>
5+
* SPDX-License-Identifier: AGPL-3.0-or-later
6+
*/
7+
8+
package com.nmc.android
9+
10+
import android.content.Context
11+
import android.content.res.Configuration
12+
import android.graphics.Color
13+
import androidx.core.content.ContextCompat
14+
import androidx.test.core.app.ApplicationProvider
15+
import androidx.test.ext.junit.runners.AndroidJUnit4
16+
import com.owncloud.android.R
17+
import junit.framework.TestCase.assertEquals
18+
import org.junit.Test
19+
import org.junit.runner.RunWith
20+
21+
/**
22+
* Test class to verify the colors customized in this branch PR for NMC
23+
*/
24+
@RunWith(AndroidJUnit4::class)
25+
class AppColorTest {
26+
private val expectedColorMap = mapOf(
27+
R.color.list_item_lastmod_and_filesize_text to ExpectedColor(
28+
light = "#666666",
29+
dark = "#B2B2B2"
30+
),
31+
R.color.text_color to ExpectedColor(
32+
light = "#191919",
33+
dark = "#E3E3E3"
34+
),
35+
R.color.light_grey to ExpectedColor(
36+
light = "#F5F5F5",
37+
dark = "#F5F5F5" // same for light and dark
38+
),
39+
R.color.secondary_text_color to ExpectedColor(
40+
light = "#B2B2B2",
41+
dark = "#A5A5A5"
42+
),
43+
R.color.action_mode_background to ExpectedColor(
44+
light = "#FFFFFF",
45+
dark = "#121212"
46+
),
47+
R.color.selected_item_background to ExpectedColor(
48+
light = "#F2F2F2",
49+
dark = "#4C4C4C"
50+
),
51+
R.color.drawer_active_item_background to ExpectedColor(
52+
light = "#919191",
53+
dark = "#FFFFFF"
54+
),
55+
R.color.fontAppbar to ExpectedColor(
56+
light = "#191919",
57+
dark = "#FFFFFF"
58+
),
59+
R.color.icon_color to ExpectedColor(
60+
light = "#191919",
61+
dark = "#FFFFFF"
62+
),
63+
R.color.sort_text_color to ExpectedColor(
64+
light = "#E20074", // primary magenta color
65+
dark = "#B2B2B2"
66+
),
67+
R.color.list_icon_color to ExpectedColor(
68+
light = "#191919",
69+
dark = "#B2B2B2"
70+
),
71+
R.color.warning_icon_color to ExpectedColor(
72+
light = "#191919",
73+
dark = "#CCCCCC"
74+
),
75+
R.color.divider_color to ExpectedColor(
76+
light = "#B2B2B2",
77+
dark = "#4C4C4C"
78+
),
79+
R.color.spinner_bg_color to ExpectedColor(
80+
light = "#FFFFFF",
81+
dark = "#333333"
82+
),
83+
R.color.refresh_layout_bg_color to ExpectedColor(
84+
light = "#FFFFFF",
85+
dark = "#2D2D2D"
86+
),
87+
R.color.primary_button_disabled_color to ExpectedColor(
88+
light = "#F2F2F2",
89+
dark = "#4C4C4C"
90+
),
91+
R.color.toolbar_divider_color to ExpectedColor(
92+
light = "#CCCCCC",
93+
dark = "#4C4C4C"
94+
),
95+
R.color.et_highlight_color to ExpectedColor(
96+
light = "#77c4ff",
97+
dark = "#77c4ff" // same for light and dark
98+
),
99+
R.color.white_trans_70 to ExpectedColor(
100+
light = "#B3FFFFFF",
101+
dark = "#B3FFFFFF" // same for light and dark
102+
),
103+
R.color.progress_bar_background to ExpectedColor(
104+
light = "#E5E5E5",
105+
dark = "#E5E5E5" // same for light and dark
106+
),
107+
R.color.dark_grey to ExpectedColor(
108+
light = "#101010",
109+
dark = "#101010" // same for light and dark
110+
),
111+
R.color.grey_0 to ExpectedColor(
112+
light = "#F2F2F2",
113+
dark = "#F2F2F2" // same for light and dark
114+
),
115+
R.color.grey_10 to ExpectedColor(
116+
light = "#E5E5E5",
117+
dark = "#E5E5E5" // same for light and dark
118+
),
119+
R.color.grey_30 to ExpectedColor(
120+
light = "#B2B2B2",
121+
dark = "#B2B2B2" // same for light and dark
122+
),
123+
R.color.grey_60 to ExpectedColor(
124+
light = "#666666",
125+
dark = "#666666" // same for light and dark
126+
),
127+
R.color.grey_70 to ExpectedColor(
128+
light = "#4C4C4C",
129+
dark = "#4C4C4C" // same for light and dark
130+
),
131+
R.color.grey_80 to ExpectedColor(
132+
light = "#333333",
133+
dark = "#333333" // same for light and dark
134+
),
135+
R.color.snackbar_bg_color to ExpectedColor(
136+
light = "#323232",
137+
dark = "#333333"
138+
),
139+
R.color.snackbar_txt_color to ExpectedColor(
140+
light = "#FFFFFF",
141+
dark = "#F2F2F2"
142+
),
143+
R.color.alert_bg_color to ExpectedColor(
144+
light = "#FFFFFF",
145+
dark = "#333333"
146+
),
147+
R.color.alert_txt_color to ExpectedColor(
148+
light = "#191919",
149+
dark = "#F2F2F2"
150+
),
151+
R.color.nav_selected_bg_color to ExpectedColor(
152+
light = "#F2F2F2",
153+
dark = "#666666"
154+
),
155+
R.color.nav_txt_unselected_color to ExpectedColor(
156+
light = "#191919",
157+
dark = "#F2F2F2"
158+
),
159+
R.color.nav_txt_selected_color to ExpectedColor(
160+
light = "#E20074", // primary magenta color
161+
dark = "#F2F2F2"
162+
),
163+
R.color.nav_icon_unselected_color to ExpectedColor(
164+
light = "#191919",
165+
dark = "#B2B2B2"
166+
),
167+
R.color.nav_icon_selected_color to ExpectedColor(
168+
light = "#E20074", // primary magenta color
169+
dark = "#FFFFFF"
170+
),
171+
R.color.nav_divider_color to ExpectedColor(
172+
light = "#B2B2B2",
173+
dark = "#B2B2B2" // same for light and dark
174+
),
175+
R.color.nav_bg_color to ExpectedColor(
176+
light = "#FFFFFF",
177+
dark = "#333333"
178+
),
179+
R.color.drawer_quota_txt_color to ExpectedColor(
180+
light = "#191919",
181+
dark = "#FFFFFF"
182+
),
183+
R.color.bottom_sheet_bg_color to ExpectedColor(
184+
light = "#FFFFFF",
185+
dark = "#333333"
186+
),
187+
R.color.bottom_sheet_icon_color to ExpectedColor(
188+
light = "#191919",
189+
dark = "#B2B2B2"
190+
),
191+
R.color.bottom_sheet_txt_color to ExpectedColor(
192+
light = "#191919",
193+
dark = "#F2F2F2"
194+
),
195+
R.color.popup_menu_bg to ExpectedColor(
196+
light = "#FFFFFF",
197+
dark = "#333333"
198+
),
199+
R.color.popup_menu_txt_color to ExpectedColor(
200+
light = "#191919",
201+
dark = "#F2F2F2"
202+
),
203+
R.color.overflow_bg_color to ExpectedColor(
204+
light = "#FFFFFF",
205+
dark = "#333333"
206+
),
207+
R.color.switch_thumb_checked_enabled to ExpectedColor(
208+
light = "#E20074", // primary magenta color
209+
dark = "#E20074", // same for light and dark
210+
),
211+
R.color.switch_track_checked_enabled to ExpectedColor(
212+
light = "#F399C7",
213+
dark = "#F399C7" // same for light and dark
214+
),
215+
R.color.switch_thumb_unchecked_enabled to ExpectedColor(
216+
light = "#FFFFFF",
217+
dark = "#FFFFFF" // same for light and dark
218+
),
219+
R.color.switch_track_unchecked_enabled to ExpectedColor(
220+
light = "#B2B2B2",
221+
dark = "#B2B2B2" // same for light and dark
222+
),
223+
R.color.switch_thumb_disabled to ExpectedColor(
224+
light = "#E5E5E5",
225+
dark = "#4C4C4C"
226+
),
227+
R.color.switch_track_disabled to ExpectedColor(
228+
light = "#F2F2F2",
229+
dark = "#666666"
230+
),
231+
R.color.checkbox_checked_enabled to ExpectedColor(
232+
light = "#E20074", // primary magenta color
233+
dark = "#E20074", // same for light and dark
234+
),
235+
R.color.checkbox_unchecked_enabled to ExpectedColor(
236+
light = "#B2B2B2",
237+
dark = "#B2B2B2" // same for light and dark
238+
),
239+
R.color.checkbox_checked_disabled to ExpectedColor(
240+
light = "#B2B2B2",
241+
dark = "#4C4C4C"
242+
),
243+
R.color.checkbox_unchecked_disabled to ExpectedColor(
244+
light = "#CCCCCC",
245+
dark = "#4C4C4C"
246+
),
247+
R.color.share_title_txt_color to ExpectedColor(
248+
light = "#191919",
249+
dark = "#FFFFFF"
250+
),
251+
R.color.share_subtitle_txt_color to ExpectedColor(
252+
light = "#B2B2B2",
253+
dark = "#B2B2B2"
254+
),
255+
R.color.share_info_txt_color to ExpectedColor(
256+
light = "#191919",
257+
dark = "#F2F2F2"
258+
),
259+
R.color.share_search_border_color to ExpectedColor(
260+
light = "#191919",
261+
dark = "#F2F2F2"
262+
),
263+
R.color.share_btn_txt_color to ExpectedColor(
264+
light = "#191919",
265+
dark = "#F2F2F2"
266+
),
267+
R.color.share_list_item_txt_color to ExpectedColor(
268+
light = "#191919",
269+
dark = "#F2F2F2"
270+
),
271+
R.color.share_disabled_txt_color to ExpectedColor(
272+
light = "#B2B2B2",
273+
dark = "#666666"
274+
),
275+
R.color.share_txt_color to ExpectedColor(
276+
light = "#191919",
277+
dark = "#F2F2F2"
278+
),
279+
R.color.share_et_divider to ExpectedColor(
280+
light = "#000000",
281+
dark = "#FFFFFF"
282+
),
283+
R.color.share_warning_txt_color to ExpectedColor(
284+
light = "#191919",
285+
dark = "#191919" // same for light and dark
286+
),
287+
R.color.sharing_warning_bg_color to ExpectedColor(
288+
light = "#F6E5EB",
289+
dark = "#F6E5EB" // same for light and dark
290+
),
291+
R.color.sharing_warning_border_color to ExpectedColor(
292+
light = "#C16F81",
293+
dark = "#C16F81" // same for light and dark
294+
),
295+
R.color.share_color to ExpectedColor(
296+
light = "#0D39DF",
297+
dark = "#0D39DF" // same for light and dark
298+
),
299+
R.color.shared_with_me_color to ExpectedColor(
300+
light = "#0099ff",
301+
dark = "#0099ff" // same for light and dark
302+
),
303+
R.color.share_blue_color to ExpectedColor(
304+
light = "#2238df",
305+
dark = "#7d94f9"
306+
),
307+
R.color.scan_doc_bg_color to ExpectedColor(
308+
light = "#F2F2F2",
309+
dark = "#121212"
310+
),
311+
R.color.scan_text_color to ExpectedColor(
312+
light = "#191919",
313+
dark = "#F2F2F2"
314+
),
315+
R.color.scan_edit_bottom_color to ExpectedColor(
316+
light = "#F2F2F2",
317+
dark = "#333333"
318+
),
319+
R.color.scan_count_bg_color to ExpectedColor(
320+
light = "#B2B2B2",
321+
dark = "#333333"
322+
),
323+
R.color.neptune to ExpectedColor(
324+
light = "#77b6bb",
325+
dark = "#77b6bb" // same for light and dark
326+
),
327+
R.color.neptune_50 to ExpectedColor(
328+
light = "#5077b6bb",
329+
dark = "#5077b6bb" // same for light and dark
330+
),
331+
)
332+
333+
@Test
334+
fun validateLightModeColors() {
335+
validateColors(Configuration.UI_MODE_NIGHT_NO) { Color.parseColor(it.light) }
336+
}
337+
338+
@Test
339+
fun validateDarkModeColors() {
340+
validateColors(Configuration.UI_MODE_NIGHT_YES) { Color.parseColor(it.dark) }
341+
}
342+
343+
private fun validateColors(
344+
nightMode: Int,
345+
expectedSelector: (ExpectedColor) -> Int
346+
) {
347+
val appContext = ApplicationProvider.getApplicationContext<Context>()
348+
val conf = Configuration(appContext.resources.configuration)
349+
conf.uiMode = (conf.uiMode and Configuration.UI_MODE_NIGHT_MASK.inv()) or nightMode
350+
val ctx = appContext.createConfigurationContext(conf)
351+
352+
expectedColorMap.forEach { (colorRes, expectedColor) ->
353+
val expected = expectedSelector(expectedColor)
354+
val actual = ContextCompat.getColor(ctx, colorRes)
355+
assertEquals(
356+
"Color mismatch: ${ctx.resources.getResourceName(colorRes)}",
357+
expected, actual
358+
)
359+
}
360+
}
361+
362+
data class ExpectedColor(val light: String, val dark: String)
363+
}

0 commit comments

Comments
 (0)