Skip to content

Commit de79e0c

Browse files
committed
update pictograms to use integrated backgrounds
1 parent 9341cac commit de79e0c

14 files changed

+395
-217
lines changed

duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/settings/DuckChatSettingsActivity.kt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import com.duckduckgo.browser.api.ui.BrowserScreens.FeedbackActivityWithEmptyPar
3333
import com.duckduckgo.browser.api.ui.BrowserScreens.WebViewActivityWithParams
3434
import com.duckduckgo.common.ui.DuckDuckGoActivity
3535
import com.duckduckgo.common.ui.spans.DuckDuckGoClickableSpan
36+
import com.duckduckgo.common.ui.store.AppTheme
3637
import com.duckduckgo.common.ui.view.addClickableSpan
3738
import com.duckduckgo.common.ui.view.gone
3839
import com.duckduckgo.common.ui.view.show
@@ -70,6 +71,9 @@ class DuckChatSettingsActivity : DuckDuckGoActivity() {
7071
@Inject
7172
lateinit var pixel: Pixel
7273

74+
@Inject
75+
lateinit var appTheme: AppTheme
76+
7377
override fun onCreate(savedInstanceState: Bundle?) {
7478
super.onCreate(savedInstanceState)
7579

@@ -132,8 +136,8 @@ class DuckChatSettingsActivity : DuckDuckGoActivity() {
132136

133137
binding.duckAiInputScreenToggleContainer.isVisible = viewState.shouldShowInputScreenToggle
134138
configureInputScreenToggle(
135-
withoutAi = InputScreenToggleButton.WithoutAi(isActive = !viewState.isInputScreenEnabled),
136-
withAi = InputScreenToggleButton.WithAi(isActive = viewState.isInputScreenEnabled),
139+
withoutAi = InputScreenToggleButton.WithoutAi(isActive = !viewState.isInputScreenEnabled, appTheme.isLightModeEnabled()),
140+
withAi = InputScreenToggleButton.WithAi(isActive = viewState.isInputScreenEnabled, appTheme.isLightModeEnabled()),
137141
)
138142

139143
binding.duckAiInputScreenDescription.isVisible = viewState.shouldShowInputScreenToggle
@@ -196,40 +200,36 @@ class DuckChatSettingsActivity : DuckDuckGoActivity() {
196200
) = with(binding) {
197201
val context = this@DuckChatSettingsActivity
198202
duckAiInputScreenToggleWithoutAiImage.setImageDrawable(ContextCompat.getDrawable(context, withoutAi.imageRes))
199-
duckAiInputScreenToggleWithoutAiImage.setBackgroundResource(withoutAi.backgroundRes)
200203
duckAiInputScreenToggleWithoutAiCheck.setImageDrawable(ContextCompat.getDrawable(context, withoutAi.checkRes))
201204

202205
duckAiInputScreenToggleWithAiImage.setImageDrawable(ContextCompat.getDrawable(context, withAi.imageRes))
203-
duckAiInputScreenToggleWithAiImage.setBackgroundResource(withAi.backgroundRes)
204206
duckAiInputScreenToggleWithAiCheck.setImageDrawable(ContextCompat.getDrawable(context, withAi.checkRes))
205207
}
206208

207209
private sealed class InputScreenToggleButton(isActive: Boolean) {
208210
abstract val imageRes: Int
209-
val backgroundRes: Int = if (isActive) {
210-
R.drawable.searchbox_background_active
211-
} else {
212-
R.drawable.searchbox_background
213-
}
211+
214212
val checkRes: Int = if (isActive) {
215213
CommonR.drawable.ic_check_blue_round_24
216214
} else {
217215
CommonR.drawable.ic_shape_circle_24
218216
}
219217

220-
class WithoutAi(isActive: Boolean) : InputScreenToggleButton(isActive) {
221-
override val imageRes: Int = if (isActive) {
222-
R.drawable.searchbox_withoutai_active
223-
} else {
224-
R.drawable.searchbox_withoutai
218+
class WithoutAi(isActive: Boolean, isLightMode: Boolean) : InputScreenToggleButton(isActive) {
219+
override val imageRes: Int = when {
220+
isActive && isLightMode -> R.drawable.searchbox_withoutai_active
221+
isActive && !isLightMode -> R.drawable.searchbox_withoutai_active_dark
222+
!isActive && isLightMode -> R.drawable.searchbox_withoutai_inactive
223+
else -> R.drawable.searchbox_withoutai_inactive_dark
225224
}
226225
}
227226

228-
class WithAi(isActive: Boolean) : InputScreenToggleButton(isActive) {
229-
override val imageRes: Int = if (isActive) {
230-
R.drawable.searchbox_withai_active
231-
} else {
232-
R.drawable.searchbox_withai
227+
class WithAi(isActive: Boolean, isLightMode: Boolean) : InputScreenToggleButton(isActive) {
228+
override val imageRes: Int = when {
229+
isActive && isLightMode -> R.drawable.searchbox_withai_active
230+
isActive && !isLightMode -> R.drawable.searchbox_withai_active_dark
231+
!isActive && isLightMode -> R.drawable.searchbox_withai_inactive
232+
else -> R.drawable.searchbox_withai_inactive_dark
233233
}
234234
}
235235
}

duckchat/duckchat-impl/src/main/res/drawable/searchbox_background.xml

Lines changed: 0 additions & 24 deletions
This file was deleted.

duckchat/duckchat-impl/src/main/res/drawable/searchbox_background_active.xml

Lines changed: 0 additions & 28 deletions
This file was deleted.

duckchat/duckchat-impl/src/main/res/drawable/searchbox_withai.xml

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
1-
<!--
2-
~ Copyright (c) 2025 DuckDuckGo
3-
~
4-
~ Licensed under the Apache License, Version 2.0 (the "License");
5-
~ you may not use this file except in compliance with the License.
6-
~ You may obtain a copy of the License at
7-
~
8-
~ http://www.apache.org/licenses/LICENSE-2.0
9-
~
10-
~ Unless required by applicable law or agreed to in writing, software
11-
~ distributed under the License is distributed on an "AS IS" BASIS,
12-
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
~ See the License for the specific language governing permissions and
14-
~ limitations under the License.
15-
-->
16-
171
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18-
android:width="128dp"
19-
android:height="72dp"
20-
android:viewportWidth="128"
21-
android:viewportHeight="72">
22-
<path
23-
android:pathData="M0,12C0,5.37 5.37,0 12,0h104c6.63,0 12,5.37 12,12v60H0V12Z"
24-
android:fillColor="?attr/daxColorWindow"/>
25-
<path
26-
android:pathData="M112,36a8,8 0,0 1,8 8v8a8,8 0,0 1,-8 8H16a8,8 0,0 1,-8 -8v-8a8,8 0,0 1,8 -8h96ZM82,12c5.52,0 10,4.48 10,10s-4.48,10 -10,10H46c-5.52,0 -10,-4.48 -10,-10s4.48,-10 10,-10h36Z"
27-
android:fillColor="?attr/daxColorControlFillPrimary"/>
2+
android:width="160dp"
3+
android:height="88dp"
4+
android:viewportWidth="160"
5+
android:viewportHeight="88">
286
<group>
297
<clip-path
30-
android:pathData="M0,12C0,5.37 5.37,0 12,0h104c6.63,0 12,5.37 12,12v60H0V12Z"/>
31-
<path
32-
android:pathData="M-1,12C-1,4.82 4.82,-1 12,-1h104c7.18,0 13,5.82 13,13h-2c0,-6.07 -4.93,-11 -11,-11L12,1C5.93,1 1,5.93 1,12h-2ZM128,72L0,72h128ZM-1,72L-1,12C-1,4.82 4.82,-1 12,-1v2C5.93,1 1,5.93 1,12v60h-2ZM116,-1c7.18,0 13,5.82 13,13v60h-2L127,12c0,-6.07 -4.93,-11 -11,-11v-2Z"
33-
android:fillColor="?attr/daxColorAccentBlue"/>
8+
android:pathData="M0,0h160v88H0z"/>
9+
<group>
10+
<clip-path
11+
android:pathData="M26,0L134,0A26,26 0,0 1,160 26L160,62A26,26 0,0 1,134 88L26,88A26,26 0,0 1,0 62L0,26A26,26 0,0 1,26 0z"/>
12+
<path
13+
android:pathData="M0,0h160v88H0z"
14+
android:fillColor="#3969EF"
15+
android:fillAlpha="0.2"/>
16+
<path
17+
android:pathData="M16,38c0,-14.36 11.64,-26 26,-26h76c14.36,0 26,11.64 26,26v50H16V38Z"
18+
android:fillColor="#3969EF"
19+
android:fillAlpha="0.2"/>
20+
<path
21+
android:pathData="M38,52L122,52A8,8 0,0 1,130 60L130,64A8,8 0,0 1,122 72L38,72A8,8 0,0 1,30 64L30,60A8,8 0,0 1,38 52z"
22+
android:fillColor="#fff"/>
23+
<group>
24+
<clip-path
25+
android:pathData="M16,38c0,-14.36 11.64,-26 26,-26h76c14.36,0 26,11.64 26,26v50H16V38Z"/>
26+
<path
27+
android:pathData="M11,38C11,20.88 24.88,7 42,7h76c17.12,0 31,13.88 31,31h-10c0,-11.6 -9.4,-21 -21,-21L42,17c-11.6,0 -21,9.4 -21,21L11,38ZM144,88L16,88h128ZM11,88L11,38C11,20.88 24.88,7 42,7v10c-11.6,0 -21,9.4 -21,21v50L11,88ZM118,7c17.12,0 31,13.88 31,31v50h-10L139,38c0,-11.6 -9.4,-21 -21,-21L118,7Z"
28+
android:fillColor="#3969EF"/>
29+
</group>
30+
<path
31+
android:pathData="M62,26L98,26A10,10 0,0 1,108 36L108,36A10,10 0,0 1,98 46L62,46A10,10 0,0 1,52 36L52,36A10,10 0,0 1,62 26z"
32+
android:fillColor="#fff"/>
33+
<path
34+
android:pathData="M93,30c3.31,0 6,2.39 6,5.34 0,2.24 -1.55,4.16 -3.74,4.95 -1.42,0.65 -4.91,1.31 -6.9,1.65a0.53,0.53 0,0 1,-0.49 -0.88l0.97,-1.12c0.21,-0.24 0.17,-0.61 -0.07,-0.82C87.68,38.16 87,36.82 87,35.34 87,32.39 89.69,30 93,30ZM93,31c-2.87,0 -5,2.05 -5,4.34 0,1.16 0.53,2.24 1.43,3.04 0.6,0.53 0.78,1.52 0.17,2.22l-0.11,0.12a68.24,68.24 0,0 0,2.32 -0.47c1.3,-0.29 2.43,-0.6 3.04,-0.88l0.04,-0.02 0.04,-0.01c1.87,-0.68 3.08,-2.26 3.08,-4.01C98,33.05 95.87,31 93,31ZM92.71,32.45c0.07,-0.3 0.5,-0.3 0.57,0l0.16,0.66c0.22,0.88 0.91,1.56 1.78,1.78l0.66,0.16c0.3,0.07 0.3,0.5 0,0.57l-0.66,0.17a2.45,2.45 0,0 0,-1.78 1.78l-0.16,0.66c-0.07,0.3 -0.5,0.3 -0.57,0l-0.17,-0.66a2.45,2.45 0,0 0,-1.78 -1.78l-0.66,-0.17c-0.3,-0.07 -0.3,-0.5 0,-0.57l0.66,-0.16a2.45,2.45 0,0 0,1.78 -1.78l0.17,-0.66ZM72,28a8,8 0,1 1,0 16L62,44a8,8 0,1 1,0 -16h10ZM66.25,30a5.25,5.25 0,1 0,3.34 9.3l2.56,2.55 0.08,0.06a0.5,0.5 0,0 0,0.69 -0.69l-0.06,-0.08 -2.55,-2.56A5.25,5.25 0,0 0,66.25 30ZM66.25,31a4.25,4.25 0,1 1,0 8.5,4.25 4.25,0 0,1 0,-8.5Z"
35+
android:fillColor="#3969EF"/>
36+
<path
37+
android:pathData="M38.5,56L38.5,56A0.5,0.5 0,0 1,39 56.5L39,67.5A0.5,0.5 0,0 1,38.5 68L38.5,68A0.5,0.5 0,0 1,38 67.5L38,56.5A0.5,0.5 0,0 1,38.5 56z"
38+
android:fillColor="#3969EF"/>
39+
</group>
3440
</group>
35-
<path
36-
android:pathData="M112.41,36.01A8,8 0,0 1,120 44v8a8,8 0,0 1,-7.59 7.99L112,60L16,60a8,8 0,0 1,-7.99 -7.59L8,52v-8a8,8 0,0 1,8 -8h96l0.41,0.01ZM16,37a7,7 0,0 0,-7 7v8a7,7 0,0 0,7 7h96a7,7 0,0 0,7 -7v-8a7,7 0,0 0,-7 -7L16,37ZM82,12c5.52,0 10,4.48 10,10 0,5.35 -4.2,9.72 -9.48,9.99L82,32L46,32l-0.51,-0.01C40.2,31.72 36,27.35 36,22c0,-5.52 4.48,-10 10,-10h36ZM46,13a9,9 0,1 0,0 18h36a9,9 0,1 0,0 -18L46,13ZM56,14a8,8 0,1 1,0 16L46,30a8,8 0,1 1,0 -16h10ZM50.25,16a5.25,5.25 0,1 0,3.34 9.3l2.56,2.56 0.08,0.06a0.5,0.5 0,0 0,0.69 -0.69l-0.06,-0.08 -2.55,-2.55A5.25,5.25 0,0 0,50.25 16ZM77,16c3.31,0 6,2.39 6,5.34 0,2.24 -1.55,4.16 -3.74,4.95 -1.42,0.65 -4.91,1.31 -6.9,1.65a0.53,0.53 0,0 1,-0.49 -0.88l0.97,-1.12c0.21,-0.24 0.17,-0.61 -0.07,-0.82C71.68,24.16 71,22.82 71,21.34 71,18.39 73.69,16 77,16ZM77,17c-2.87,0 -5,2.05 -5,4.34 0,1.16 0.53,2.24 1.43,3.04 0.6,0.53 0.78,1.52 0.17,2.22l-0.11,0.12a68.24,68.24 0,0 0,2.32 -0.47c1.3,-0.29 2.43,-0.6 3.04,-0.88l0.04,-0.02 0.04,-0.01c1.87,-0.68 3.08,-2.26 3.08,-4.01C82,19.05 79.87,17 77,17ZM50.25,17a4.25,4.25 0,1 1,0 8.5,4.25 4.25,0 0,1 0,-8.5ZM76.71,18.45c0.07,-0.3 0.5,-0.3 0.57,0l0.16,0.66c0.22,0.88 0.91,1.56 1.78,1.78l0.66,0.16c0.3,0.07 0.3,0.5 0,0.57l-0.66,0.17a2.45,2.45 0,0 0,-1.78 1.78l-0.16,0.66c-0.07,0.3 -0.5,0.3 -0.57,0l-0.17,-0.66a2.45,2.45 0,0 0,-1.78 -1.78l-0.66,-0.17c-0.3,-0.07 -0.3,-0.5 0,-0.57l0.66,-0.17a2.45,2.45 0,0 0,1.78 -1.78l0.17,-0.66Z"
37-
android:fillColor="?attr/daxColorAccentBlue"/>
3841
</vector>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="160dp"
3+
android:height="88dp"
4+
android:viewportWidth="160"
5+
android:viewportHeight="88">
6+
<group>
7+
<clip-path
8+
android:pathData="M0,0h160v88H0z"/>
9+
<group>
10+
<clip-path
11+
android:pathData="M26,0L134,0A26,26 0,0 1,160 26L160,62A26,26 0,0 1,134 88L26,88A26,26 0,0 1,0 62L0,26A26,26 0,0 1,26 0z"/>
12+
<path
13+
android:pathData="M0,0h160v88H0z"
14+
android:fillColor="#7295F6"
15+
android:fillAlpha="0.3"/>
16+
<path
17+
android:pathData="M16,38c0,-14.36 11.64,-26 26,-26h76c14.36,0 26,11.64 26,26v50H16V38Z"
18+
android:fillColor="#7295F6"
19+
android:fillAlpha="0.46"/>
20+
<path
21+
android:pathData="M38,52L122,52A8,8 0,0 1,130 60L130,64A8,8 0,0 1,122 72L38,72A8,8 0,0 1,30 64L30,60A8,8 0,0 1,38 52z"
22+
android:fillColor="#000"
23+
android:fillAlpha="0.3"/>
24+
<group>
25+
<clip-path
26+
android:pathData="M16,38c0,-14.36 11.64,-26 26,-26h76c14.36,0 26,11.64 26,26v50H16V38Z"/>
27+
<path
28+
android:pathData="M11,38C11,20.88 24.88,7 42,7h76c17.12,0 31,13.88 31,31h-10c0,-11.6 -9.4,-21 -21,-21L42,17c-11.6,0 -21,9.4 -21,21L11,38ZM144,88L16,88h128ZM11,88L11,38C11,20.88 24.88,7 42,7v10c-11.6,0 -21,9.4 -21,21v50L11,88ZM118,7c17.12,0 31,13.88 31,31v50h-10L139,38c0,-11.6 -9.4,-21 -21,-21L118,7Z"
29+
android:fillColor="#7295F6"/>
30+
</group>
31+
<path
32+
android:pathData="M62,26L98,26A10,10 0,0 1,108 36L108,36A10,10 0,0 1,98 46L62,46A10,10 0,0 1,52 36L52,36A10,10 0,0 1,62 26z"
33+
android:fillColor="#000"
34+
android:fillAlpha="0.3"/>
35+
<path
36+
android:pathData="M93,30c3.31,0 6,2.39 6,5.34 0,2.24 -1.55,4.16 -3.74,4.95 -1.42,0.65 -4.91,1.31 -6.9,1.65a0.53,0.53 0,0 1,-0.49 -0.88l0.97,-1.12c0.21,-0.24 0.17,-0.61 -0.07,-0.82C87.68,38.16 87,36.82 87,35.34 87,32.39 89.69,30 93,30ZM93,31c-2.87,0 -5,2.05 -5,4.34 0,1.16 0.53,2.24 1.43,3.04 0.6,0.53 0.78,1.52 0.17,2.22l-0.11,0.12a68.24,68.24 0,0 0,2.32 -0.47c1.3,-0.29 2.43,-0.6 3.04,-0.88l0.04,-0.02 0.04,-0.01c1.87,-0.68 3.08,-2.26 3.08,-4.01C98,33.05 95.87,31 93,31ZM92.71,32.45c0.07,-0.3 0.5,-0.3 0.57,0l0.16,0.66c0.22,0.88 0.91,1.56 1.78,1.78l0.66,0.16c0.3,0.07 0.3,0.5 0,0.57l-0.66,0.17a2.45,2.45 0,0 0,-1.78 1.78l-0.16,0.66c-0.07,0.3 -0.5,0.3 -0.57,0l-0.17,-0.66a2.45,2.45 0,0 0,-1.78 -1.78l-0.66,-0.17c-0.3,-0.07 -0.3,-0.5 0,-0.57l0.66,-0.16a2.45,2.45 0,0 0,1.78 -1.78l0.17,-0.66ZM72,28a8,8 0,1 1,0 16L62,44a8,8 0,1 1,0 -16h10ZM66.25,30a5.25,5.25 0,1 0,3.34 9.3l2.56,2.55 0.08,0.06a0.5,0.5 0,0 0,0.69 -0.69l-0.06,-0.08 -2.55,-2.56A5.25,5.25 0,0 0,66.25 30ZM66.25,31a4.25,4.25 0,1 1,0 8.5,4.25 4.25,0 0,1 0,-8.5Z"
37+
android:fillColor="#7295F6"/>
38+
<path
39+
android:pathData="M38.5,56L38.5,56A0.5,0.5 0,0 1,39 56.5L39,67.5A0.5,0.5 0,0 1,38.5 68L38.5,68A0.5,0.5 0,0 1,38 67.5L38,56.5A0.5,0.5 0,0 1,38.5 56z"
40+
android:fillColor="#7295F6"/>
41+
</group>
42+
</group>
43+
</vector>

0 commit comments

Comments
 (0)