Skip to content

Commit e3f5dbb

Browse files
authored
Duck.ai: Fullscreen early feedback (#7120)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1174433894299346/task/1211913117762480?focus=true ### Description This PR fixes a couple early feedback pieces that are easy to solve. ### Steps to test this PR _Voice_ - [x] Enable fullscreen mode and voice search - [x] Verify that the voice search icon is not visible in Duck.ai mode _Duck.ai header_ - [x] Enable fullscreen mode and open Duck.ai - [x] Verify that the header looks as expected (Duck.ai text present)
1 parent 0c8be51 commit e3f5dbb

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

app/src/main/java/com/duckduckgo/app/browser/omnibar/OmnibarLayout.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ class OmnibarLayout @JvmOverloads constructor(
864864
renderTabIcon(viewState)
865865
renderPulseAnimation(viewState)
866866
pageLoadingIndicator.isVisible = viewState.isLoading
867+
voiceSearchButton.isVisible = viewState.showVoiceSearch
867868
}
868869

869870
private fun renderCustomTabMode(

app/src/main/java/com/duckduckgo/app/browser/omnibar/OmnibarLayoutViewModel.kt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ class OmnibarLayoutViewModel @Inject constructor(
289289
showFireIcon = showControls,
290290
showBrowserMenu = showControls,
291291
showVoiceSearch = shouldShowVoiceSearch(
292+
viewMode = _viewState.value.viewMode,
292293
hasFocus = true,
293294
query = _viewState.value.omnibarText,
294295
hasQueryChanged = false,
@@ -335,6 +336,7 @@ class OmnibarLayoutViewModel @Inject constructor(
335336
showFireIcon = !isSplitOmnibarEnabled,
336337
showBrowserMenu = !isSplitOmnibarEnabled,
337338
showVoiceSearch = shouldShowVoiceSearch(
339+
viewMode = _viewState.value.viewMode,
338340
hasFocus = false,
339341
query = _viewState.value.omnibarText,
340342
hasQueryChanged = false,
@@ -404,17 +406,22 @@ class OmnibarLayoutViewModel @Inject constructor(
404406
}
405407

406408
private fun shouldShowVoiceSearch(
409+
viewMode: ViewMode,
407410
hasFocus: Boolean = false,
408411
query: String = "",
409412
hasQueryChanged: Boolean = false,
410413
urlLoaded: String = "",
411414
): Boolean {
412-
return voiceSearchAvailability.shouldShowVoiceSearch(
413-
hasFocus = hasFocus,
414-
query = query,
415-
hasQueryChanged = hasQueryChanged,
416-
urlLoaded = urlLoaded,
417-
)
415+
return if (viewMode == ViewMode.DuckAI) {
416+
false
417+
} else {
418+
voiceSearchAvailability.shouldShowVoiceSearch(
419+
hasFocus = hasFocus,
420+
query = query,
421+
hasQueryChanged = hasQueryChanged,
422+
urlLoaded = urlLoaded,
423+
)
424+
}
418425
}
419426

420427
fun onViewModeChanged(viewMode: ViewMode) {
@@ -474,6 +481,7 @@ class OmnibarLayoutViewModel @Inject constructor(
474481
leadingIconState = leadingIcon,
475482
scrollingEnabled = scrollingEnabled,
476483
showVoiceSearch = shouldShowVoiceSearch(
484+
viewMode = _viewState.value.viewMode,
477485
hasFocus = _viewState.value.hasFocus,
478486
query = _viewState.value.omnibarText,
479487
hasQueryChanged = false,
@@ -597,6 +605,7 @@ class OmnibarLayoutViewModel @Inject constructor(
597605
showFireIcon = showControls,
598606
showClearButton = showClearButton,
599607
showVoiceSearch = shouldShowVoiceSearch(
608+
viewMode = _viewState.value.viewMode,
600609
hasFocus = hasFocus,
601610
query = query,
602611
hasQueryChanged = query != updatedQuery,
@@ -672,6 +681,7 @@ class OmnibarLayoutViewModel @Inject constructor(
672681
expandedAnimated = omnibarViewState.forceExpand,
673682
updateOmnibarText = true,
674683
showVoiceSearch = shouldShowVoiceSearch(
684+
viewMode = _viewState.value.viewMode,
675685
hasFocus = omnibarViewState.isEditing,
676686
query = omnibarViewState.omnibarText,
677687
hasQueryChanged = true,
@@ -683,6 +693,7 @@ class OmnibarLayoutViewModel @Inject constructor(
683693
url = _viewState.value.url,
684694
logoUrl = omnibarViewState.serpLogo.logoUrl,
685695
)
696+
686697
SerpLogo.Normal, null -> getLeadingIconState(
687698
hasFocus = omnibarViewState.isEditing,
688699
url = _viewState.value.url,
@@ -721,6 +732,7 @@ class OmnibarLayoutViewModel @Inject constructor(
721732
omnibarText = omnibarText,
722733
updateOmnibarText = true,
723734
showVoiceSearch = shouldShowVoiceSearch(
735+
viewMode = _viewState.value.viewMode,
724736
hasFocus = omnibarViewState.isEditing,
725737
query = omnibarViewState.omnibarText,
726738
hasQueryChanged = true,
@@ -747,6 +759,7 @@ class OmnibarLayoutViewModel @Inject constructor(
747759
loadingProgress = loadingState.progress,
748760
leadingIconState = getLeadingIconState(it.hasFocus, loadingState.url, currentLogoUrl),
749761
showVoiceSearch = shouldShowVoiceSearch(
762+
viewMode = _viewState.value.viewMode,
750763
hasFocus = _viewState.value.hasFocus,
751764
query = _viewState.value.omnibarText,
752765
hasQueryChanged = false,
@@ -865,6 +878,7 @@ class OmnibarLayoutViewModel @Inject constructor(
865878
_viewState.update {
866879
it.copy(
867880
showVoiceSearch = shouldShowVoiceSearch(
881+
viewMode = _viewState.value.viewMode,
868882
urlLoaded = url,
869883
),
870884
)
@@ -895,6 +909,7 @@ class OmnibarLayoutViewModel @Inject constructor(
895909
duckDuckGoUrlDetector.isDuckDuckGoQueryUrl(viewState.value.url) -> "serp"
896910
else -> "website"
897911
}
912+
898913
else -> "unknown"
899914
}
900915
val launchSourceParams = mapOf("source" to launchSource)

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@
203203
android:layout_width="0dp"
204204
android:layout_height="wrap_content"
205205
android:orientation="horizontal"
206-
android:gravity="center_horizontal"
207-
app:layout_constraintEnd_toStartOf="@+id/endIconsContainer"
206+
android:gravity="center"
207+
app:layout_constraintEnd_toEndOf="parent"
208208
app:layout_constraintStart_toStartOf="parent"
209209
app:layout_constraintBottom_toBottomOf="parent"
210210
app:layout_constraintTop_toTopOf="parent">
@@ -240,6 +240,13 @@
240240
app:srcCompat="@drawable/ic_ai_chat_omnibar_24"
241241
tools:visibility="visible" />
242242

243+
<com.duckduckgo.common.ui.view.text.DaxTextView
244+
android:id="@+id/aiTitle"
245+
android:layout_marginStart="@dimen/keyline_1"
246+
android:layout_width="wrap_content"
247+
android:layout_height="wrap_content"
248+
android:text="@string/duck_chat_title"/>
249+
243250
</LinearLayout>
244251

245252
<View

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@
241241
app:srcCompat="@drawable/ic_ai_chat_omnibar_24"
242242
tools:visibility="visible" />
243243

244+
<com.duckduckgo.common.ui.view.text.DaxTextView
245+
android:id="@+id/aiTitle"
246+
android:layout_marginStart="@dimen/keyline_1"
247+
android:layout_width="wrap_content"
248+
android:layout_height="wrap_content"
249+
android:text="@string/duck_chat_title"/>
250+
244251
</LinearLayout>
245252

246253
<View

0 commit comments

Comments
 (0)