Skip to content

Commit 043fa13

Browse files
authored
Add new label to AI Features / Search & Duck.ai (#6881)
Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1211530840331107?focus=true ### Description - Adds the new label next to “AI Features” and “Search & Duck.ai" ### Steps to test this PR - [ ] Go to settings - [ ] Verify that the “new” label is visible next to “AI Features" - [ ] Tap on “AI Features" - [ ] Verify that the “new” label is visible next to the”Search & Duck.ai" ### UI changes | Before | After | | ------ | ----- | <img width="1080" height="2340" alt="Screenshot_20251003_092310" src="https://github.com/user-attachments/assets/c75b404a-bec9-4db9-819b-23ec2e0b64bb" />|<img width="1080" height="2340" alt="Screenshot_20251003_104723" src="https://github.com/user-attachments/assets/c0125178-b24e-4383-a768-14503df73dfe" /> | Before | After | | ------ | ----- | <img width="1080" height="2340" alt="Screenshot_20251003_090747" src="https://github.com/user-attachments/assets/db58d887-4e90-4c8a-a0da-78a668bff59b" />|<img width="1080" height="2340" alt="Screenshot_20251003_091610" src="https://github.com/user-attachments/assets/1719eee3-1a35-4016-a62f-3f6240672a28" />
1 parent 7ab8105 commit 043fa13

File tree

8 files changed

+63
-12
lines changed

8 files changed

+63
-12
lines changed

app/src/main/res/layout/view_settings_item_duck_chat.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
android:layout_width="match_parent"
2222
android:layout_height="wrap_content"
2323
app:primaryText="@string/duck_chat_title"
24-
app:leadingIcon="@drawable/ic_ai_chat_color_24"/>
24+
app:leadingIcon="@drawable/ic_ai_chat_color_24"
25+
app:showNewPill="true" />

design-system/src/main/java/com/duckduckgo/common/ui/view/listitem/BookmarksListItem.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class BookmarksListItem @JvmOverloads constructor(
5353
get() = binding.trailingSwitch
5454
override val betaPill: ImageView?
5555
get() = null
56+
override val newPill: ImageView?
57+
get() = null
5658

5759
override val itemContainer: View
5860
get() = binding.itemContainer

design-system/src/main/java/com/duckduckgo/common/ui/view/listitem/DaxListItem.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ abstract class DaxListItem(
5353
internal abstract val trailingIconContainer: View
5454
internal abstract val trailingSwitch: DaxSwitch
5555
internal abstract val betaPill: ImageView?
56+
internal abstract val newPill: ImageView?
5657
internal abstract val itemContainer: View
5758
internal abstract val verticalPadding: Int
5859

design-system/src/main/java/com/duckduckgo/common/ui/view/listitem/OneLineListItem.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import android.view.View
2222
import android.widget.ImageView
2323
import com.duckduckgo.common.ui.view.DaxSwitch
2424
import com.duckduckgo.common.ui.view.getColorFromAttr
25+
import com.duckduckgo.common.ui.view.gone
2526
import com.duckduckgo.common.ui.view.listitem.DaxListItem.IconSize.Medium
27+
import com.duckduckgo.common.ui.view.show
2628
import com.duckduckgo.common.ui.view.text.DaxTextView
2729
import com.duckduckgo.common.ui.viewbinding.viewBinding
2830
import com.duckduckgo.mobile.android.R
@@ -54,6 +56,9 @@ class OneLineListItem @JvmOverloads constructor(
5456
override val betaPill: ImageView?
5557
get() = null
5658

59+
override val newPill: ImageView
60+
get() = binding.newPill
61+
5762
override val itemContainer: View
5863
get() = binding.itemContainer
5964

@@ -122,6 +127,13 @@ class OneLineListItem @JvmOverloads constructor(
122127
val switchEnabled = getBoolean(R.styleable.OneLineListItem_switchEnabled, true)
123128
setSwitchEnabled(switchEnabled)
124129

130+
if (getBoolean(R.styleable.OneLineListItem_showNewPill, false)) {
131+
newPill.setImageResource(R.drawable.ic_new_pill)
132+
newPill.show()
133+
} else {
134+
newPill.gone()
135+
}
136+
125137
recycle()
126138
}
127139
}

design-system/src/main/java/com/duckduckgo/common/ui/view/listitem/TwoLineListItem.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class TwoLineListItem @JvmOverloads constructor(
5454
get() = binding.trailingSwitch
5555
override val betaPill: ImageView
5656
get() = binding.betaPill
57+
override val newPill: ImageView?
58+
get() = null
5759

5860
override val itemContainer: View
5961
get() = binding.itemContainer

design-system/src/main/res/layout/view_one_line_list_item.xml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,37 @@
4141

4242
</FrameLayout>
4343

44-
<com.duckduckgo.common.ui.view.text.DaxTextView
45-
android:id="@+id/primaryText"
44+
<LinearLayout
4645
android:layout_width="0dp"
4746
android:layout_height="wrap_content"
4847
android:layout_marginStart="@dimen/keyline_4"
4948
android:layout_marginEnd="@dimen/keyline_1"
50-
android:textColor="@color/primary_text_color_selector"
49+
android:gravity="center_vertical"
50+
android:orientation="horizontal"
5151
app:layout_constraintBottom_toBottomOf="parent"
5252
app:layout_constraintEnd_toStartOf="@+id/trailingBarrier"
5353
app:layout_constraintStart_toEndOf="@id/leadingIconBackground"
54-
app:layout_constraintTop_toTopOf="parent"
55-
app:typography="body1"
56-
tools:ignore="InvalidColorAttribute"
57-
tools:text="Title" />
54+
app:layout_constraintTop_toTopOf="parent">
55+
56+
<com.duckduckgo.common.ui.view.text.DaxTextView
57+
android:id="@+id/primaryText"
58+
android:layout_width="wrap_content"
59+
android:layout_height="wrap_content"
60+
android:textColor="@color/primary_text_color_selector"
61+
app:typography="body1"
62+
tools:ignore="InvalidColorAttribute"
63+
tools:text="Title" />
64+
65+
<ImageView
66+
android:id="@+id/newPill"
67+
android:layout_width="wrap_content"
68+
android:layout_height="wrap_content"
69+
android:layout_marginStart="@dimen/keyline_2"
70+
android:src="@drawable/ic_new_pill"
71+
android:visibility="gone"
72+
tools:visibility="visible" />
73+
74+
</LinearLayout>
5875

5976
<androidx.constraintlayout.widget.Barrier
6077
android:id="@+id/trailingBarrier"

design-system/src/main/res/values/attrs-lists.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<!-- New Pill -->
4343
<enum name="newPill" value="2" />
4444
</attr>
45+
<attr name="showNewPill" format="boolean"/>
4546
<attr name="showSwitch" format="boolean"/>
4647
<attr name="switchEnabled" format="boolean"/>
4748
<attr name="leadingIconBackground">
@@ -89,6 +90,7 @@
8990
<attr name="trailingIconTint"/>
9091
<attr name="showSwitch"/>
9192
<attr name="switchEnabled"/>
93+
<attr name="showNewPill"/>
9294
</declare-styleable>
9395

9496
<!--Two Line Item view-->

duckchat/duckchat-impl/src/main/res/layout/activity_duck_chat_settings.xml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,28 @@
157157
android:scaleType="fitCenter"
158158
android:src="@drawable/searchbox_withai_inactive" />
159159

160-
<com.duckduckgo.common.ui.view.text.DaxTextView
160+
<LinearLayout
161161
android:layout_width="wrap_content"
162162
android:layout_height="wrap_content"
163163
android:layout_marginTop="6dp"
164164
android:gravity="center"
165-
android:text="@string/input_screen_user_pref_with_ai"
166-
app:textType="primary"
167-
app:typography="caption" />
165+
android:orientation="horizontal">
166+
167+
<com.duckduckgo.common.ui.view.text.DaxTextView
168+
android:layout_width="wrap_content"
169+
android:layout_height="wrap_content"
170+
android:gravity="center"
171+
android:text="@string/input_screen_user_pref_with_ai"
172+
app:textType="primary"
173+
app:typography="caption" />
174+
175+
<ImageView
176+
android:layout_width="wrap_content"
177+
android:layout_height="wrap_content"
178+
android:layout_marginStart="6dp"
179+
android:src="@drawable/ic_new_pill" />
180+
181+
</LinearLayout>
168182

169183
<ImageView
170184
android:id="@+id/duckAiInputScreenToggleWithAiCheck"

0 commit comments

Comments
 (0)