Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
~ Copyright (c) 2026 DuckDuckGo
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/daxColorSurface" />
<stroke
android:width="1dp"
android:color="?attr/daxColorContainer" />
<corners android:radius="20dp" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import androidx.core.content.res.use
import androidx.core.view.doOnAttach
import androidx.core.view.isNotEmpty
import androidx.core.view.isVisible
Expand All @@ -41,6 +42,7 @@ import dagger.android.support.AndroidSupportInjection
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import javax.inject.Inject
import com.duckduckgo.mobile.android.R as CommonR

@InjectWith(ViewScope::class)
class ContextualSuggestionsView @JvmOverloads constructor(
Expand All @@ -65,8 +67,14 @@ class ContextualSuggestionsView @JvmOverloads constructor(

private val viewStateJob = ConflatedJob()

@DrawableRes
private val suggestionBackgroundRes: Int = context.obtainStyledAttributes(attrs, R.styleable.ContextualSuggestionsView).use {
it.getResourceId(R.styleable.ContextualSuggestionsView_suggestionBackground, CommonR.drawable.duck_ai_prompt_background)
}

init {
orientation = VERTICAL
loadingView.setBackgroundResource(suggestionBackgroundRes)
addView(
loadingView,
LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT).apply { bottomMargin = LOADING_MARGIN_BOTTOM_DP.toPx() },
Expand Down Expand Up @@ -128,6 +136,7 @@ class ContextualSuggestionsView @JvmOverloads constructor(
val inflater = LayoutInflater.from(context)
viewState.suggestions.forEach { suggestion ->
val itemBinding = ItemContextualSuggestionBinding.inflate(inflater, cardsContainer, false)
itemBinding.suggestionLabel.setBackgroundResource(suggestionBackgroundRes)
itemBinding.suggestionLabel.text = suggestion.label
itemBinding.suggestionLabel.setCompoundDrawablesRelativeWithIntrinsicBounds(iconResFor(suggestion.icon), 0, 0, 0)
itemBinding.root.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,19 @@
<com.duckduckgo.duckchat.impl.contextual.suggestions.ContextualSuggestionsView
android:id="@+id/entrySuggestionsView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:suggestionBackground="@drawable/duck_ai_suggested_prompts_background" />

<com.duckduckgo.common.ui.view.text.DaxTextView
android:id="@+id/entryPromptQuickAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/keyline_2"
android:background="@drawable/background_large_rounded_surface"
android:background="@drawable/duck_ai_suggested_prompts_background"
android:drawableStart="@drawable/ic_summarize_16"
android:drawablePadding="@dimen/keyline_2"
android:padding="@dimen/keyline_2"
android:paddingVertical="@dimen/keyline_2"
android:paddingHorizontal="@dimen/keyline_3"
android:text="@string/duckAIContextualPromptSummarize"
android:visibility="gone"
app:typography="body2_bold" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
android:layout_marginBottom="@dimen/keyline_2"
android:background="@drawable/duck_ai_prompt_background"
android:drawablePadding="@dimen/keyline_2"
android:padding="@dimen/keyline_2"
android:paddingVertical="@dimen/keyline_2"
android:paddingHorizontal="@dimen/keyline_3"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared padding leaks past redesign

Low Severity

Padding on suggested prompt chips was updated in the shared item_contextual_suggestion layout, but the new chip chrome is opt-in via suggestionBackground. With contextualSheetRedesign off, DuckChatContextualFragment still uses the old background while chips pick up the new padding, and contextualPromptQuickAction there still uses the previous padding, so sibling chips no longer match.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fac724e. Configure here.

app:typography="body2_bold"
tools:drawableStart="@drawable/ic_summarize_16"
tools:text="Summarize this page" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2026 DuckDuckGo
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<resources>
<declare-styleable name="ContextualSuggestionsView">
<attr name="suggestionBackground" format="reference" />
</declare-styleable>
</resources>
Loading