Skip to content

Commit

Permalink
ADS: Voice Search (#2677)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1174433894299346/1203514942123197

### Description
PR to update Voice Search
Design review in https://app.asana.com/0/1174433894299346/1203600732931512

Co-authored-by: Noelia Alcala <nalcalag@gmail.com>
Co-authored-by: Aitor Viana <aitorvs@gmail.com>
  • Loading branch information
3 people committed Jan 12, 2023
1 parent 8c800f7 commit 819b290
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 93 deletions.
22 changes: 3 additions & 19 deletions app/src/main/res/drawable/ic_microphone_24.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
<!--
~ Copyright (c) 2022 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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="25">
android:viewportHeight="24">
<path
android:pathData="M12,2.535C9.81,2.535 8.035,4.31 8.035,6.5V11.5C8.035,13.69 9.81,15.465 12,15.465C14.19,15.465 15.965,13.69 15.965,11.5V6.5C15.965,4.31 14.19,2.535 12,2.535ZM9.965,6.5C9.965,5.376 10.876,4.465 12,4.465C13.124,4.465 14.035,5.376 14.035,6.5V11.5C14.035,12.624 13.124,13.535 12,13.535C10.876,13.535 9.965,12.624 9.965,11.5V6.5Z"
android:pathData="M12,2.035C9.81,2.035 8.035,3.81 8.035,6v5c0,2.19 1.775,3.965 3.965,3.965S15.965,13.19 15.965,11V6c0,-2.19 -1.775,-3.965 -3.965,-3.965zM9.965,6c0,-1.124 0.911,-2.035 2.035,-2.035s2.035,0.911 2.035,2.035v5c0,1.124 -0.911,2.035 -2.035,2.035S9.965,12.124 9.965,11V6z"
android:fillColor="?attr/daxColorPrimaryIcon"
android:fillType="evenOdd"/>
<path
android:pathData="M7,20.5C6.448,20.5 6,20.948 6,21.5C6,22.052 6.448,22.5 7,22.5H17C17.552,22.5 18,22.052 18,21.5C18,20.948 17.552,20.5 17,20.5H13V19.438C16.946,18.946 20,15.58 20,11.5C20,10.948 19.552,10.5 19,10.5C18.448,10.5 18,10.948 18,11.5C18,14.814 15.314,17.5 12,17.5C8.686,17.5 6,14.814 6,11.5C6,10.948 5.552,10.5 5,10.5C4.448,10.5 4,10.948 4,11.5C4,15.58 7.054,18.946 11,19.438V20.5H7Z"
android:pathData="M7,20c-0.552,0 -1,0.448 -1,1s0.448,1 1,1h10c0.552,0 1,-0.448 1,-1s-0.448,-1 -1,-1h-4v-1.062c3.946,-0.492 7,-3.858 7,-7.938 0,-0.552 -0.448,-1 -1,-1s-1,0.448 -1,1c0,3.314 -2.686,6 -6,6s-6,-2.686 -6,-6c0,-0.552 -0.448,-1 -1,-1s-1,0.448 -1,1c0,4.08 3.054,7.446 7,7.938V20H7z"
android:fillColor="?attr/daxColorPrimaryIcon"/>
</vector>
19 changes: 10 additions & 9 deletions app/src/main/res/layout/activity_system_search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:importantForAccessibility="no"
android:src="@drawable/ic_ddg_logo"
android:padding="4dp"
android:src="@drawable/ic_ddg_logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Expand All @@ -84,24 +84,25 @@

</androidx.appcompat.widget.AppCompatEditText>

<com.duckduckgo.mobile.android.ui.view.button.IconButton
<ImageView
android:id="@+id/voiceSearchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:contentDescription="@string/voiceSearchIconContentDescription"
android:padding="@dimen/keyline_2"
android:padding="@dimen/toolbarIconPadding"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/clearTextButton"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_microphone_24"/>
app:srcCompat="@drawable/ic_microphone_24" />

<ImageView
android:id="@+id/clearTextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:contentDescription="@string/clearButtonContentDescription"
android:padding="3dp"
android:padding="@dimen/toolbarIconPadding"
android:src="@drawable/ic_close_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -116,7 +117,7 @@

</com.google.android.material.appbar.AppBarLayout>

<include layout="@layout/include_quick_access_items"/>
<include layout="@layout/include_quick_access_items" />

<androidx.core.widget.NestedScrollView
android:id="@+id/results"
Expand All @@ -131,9 +132,9 @@
android:id="@+id/resultsContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:background="?attr/daxColorSurface"
android:backgroundTint="?attr/daxColorSurface"
android:clipToPadding="false"
android:elevation="4dp">

<androidx.recyclerview.widget.RecyclerView
Expand All @@ -155,11 +156,11 @@
android:paddingEnd="16dp"
android:paddingBottom="2dp"
android:text="@string/systemSearchDeviceAppLabel"
app:typography="caption_allCaps"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/autocompleteSuggestions"/>
app:layout_constraintTop_toBottomOf="@id/autocompleteSuggestions"
app:typography="caption_allCaps" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/deviceAppSuggestions"
Expand Down
41 changes: 20 additions & 21 deletions app/src/main/res/layout/include_omnibar_toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:paddingEnd="6dp"
android:background="@drawable/omnibar_field_background">

<com.airbnb.lottie.LottieAnimationView
Expand All @@ -61,12 +62,12 @@
android:layout_height="0dp"
android:importantForAccessibility="no"
android:paddingStart="16dp"
app:lottie_autoPlay="false"
android:scaleType="centerCrop"
android:saveEnabled="false"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/omniBarContainer"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintTop_toTopOf="parent"
app:lottie_autoPlay="false" />

<com.airbnb.lottie.LottieAnimationView
android:id="@+id/shieldIcon"
Expand Down Expand Up @@ -94,7 +95,7 @@
android:importantForAccessibility="no"
android:padding="4dp"
android:src="@drawable/ic_ddg_logo"
android:visibility="gone"/>
android:visibility="gone" />

<ImageView
android:id="@+id/searchIcon"
Expand All @@ -103,7 +104,7 @@
android:gravity="center"
android:importantForAccessibility="no"
android:padding="6dp"
android:src="@drawable/ic_find_search_20_a05"/>
android:src="@drawable/ic_find_search_20_a05" />

<FrameLayout
android:id="@+id/scene_root"
Expand All @@ -113,7 +114,8 @@
android:layout_marginStart="17dp"
android:layout_marginEnd="4dp"
android:visibility="gone">
<include layout="@layout/cookie_scene_1"/>

<include layout="@layout/cookie_scene_1" />
</FrameLayout>

<!-- Placeholder should have same size a sibling ImageViews. size = image_width + padding -->
Expand All @@ -122,26 +124,27 @@
android:layout_width="32dp"
android:layout_height="32dp"
android:gravity="center"
android:visibility="invisible"/>
android:visibility="invisible" />

</FrameLayout>

<View
android:id="@+id/cookieDummyView"
android:layout_width="@dimen/omnibarCookieAnimationBannerHeight"
android:layout_height="@dimen/omnibarCookieAnimationBannerHeight"
android:alpha="0"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="2dp"
android:alpha="0"
android:background="@drawable/cookies_dummy_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/omniBarContainer"
app:layout_constraintTop_toTopOf="parent"
android:layout_gravity="start|center_vertical"
android:background="@drawable/cookies_dummy_background" />
app:layout_constraintTop_toTopOf="parent" />

<com.airbnb.lottie.LottieAnimationView
android:id="@+id/cookieAnimation"
android:layout_gravity="start|center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="2dp"
android:saveEnabled="false"
app:layout_constraintBottom_toBottomOf="parent"
Expand All @@ -162,7 +165,6 @@
android:inputType="textUri|textNoSuggestions"
android:maxLines="1"
android:paddingStart="5dp"
android:paddingEnd="8dp"
android:selectAllOnFocus="true"
android:textColor="?attr/daxColorPrimaryText"
android:textColorHint="?attr/daxColorSecondaryText"
Expand All @@ -174,15 +176,15 @@
app:layout_constraintStart_toEndOf="@id/omnibarIconContainer"
app:layout_constraintTop_toTopOf="parent" />

<com.duckduckgo.mobile.android.ui.view.button.IconButton
<ImageView
android:id="@+id/voiceSearchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/voiceSearchIconContentDescription"
android:padding="@dimen/keyline_2"
android:padding="@dimen/toolbarIconPadding"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/clearTextButton"
app:layout_constraintTop_toTopOf="parent"
Expand All @@ -192,11 +194,9 @@
android:id="@+id/clearTextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/clearButtonContentDescription"
android:padding="3dp"
android:padding="@dimen/toolbarIconPadding"
android:src="@drawable/ic_close_24"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down Expand Up @@ -225,7 +225,6 @@
android:id="@+id/fireIconMenu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="2dp"
android:paddingStart="4dp"
android:paddingEnd="4dp"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down
22 changes: 3 additions & 19 deletions common-ui/src/main/res/drawable/ic_menu_vertical_24.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
<!--
~ Copyright (c) 2022 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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,14C13.105,14 14,13.105 14,12C14,10.895 13.105,10 12,10C10.895,10 10,10.895 10,12C10,13.105 10.895,14 12,14Z"
android:pathData="M12,14c1.105,0 2,-0.895 2,-2s-0.895,-2 -2,-2 -2,0.895 -2,2 0.895,2 2,2z"
android:fillColor="?attr/daxColorPrimaryIcon"/>
<path
android:pathData="M12,7C13.105,7 14,6.105 14,5C14,3.895 13.105,3 12,3C10.895,3 10,3.895 10,5C10,6.105 10.895,7 12,7Z"
android:pathData="M12,7c1.105,0 2,-0.895 2,-2s-0.895,-2 -2,-2 -2,0.895 -2,2 0.895,2 2,2z"
android:fillColor="?attr/daxColorPrimaryIcon"/>
<path
android:pathData="M12,21C13.105,21 14,20.105 14,19C14,17.895 13.105,17 12,17C10.895,17 10,17.895 10,19C10,20.105 10.895,21 12,21Z"
android:pathData="M12,21c1.105,0 2,-0.895 2,-2s-0.895,-2 -2,-2 -2,0.895 -2,2 0.895,2 2,2z"
android:fillColor="?attr/daxColorPrimaryIcon"/>
</vector>
1 change: 1 addition & 0 deletions voice-search/voice-search-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies {
implementation project(path: ':anvil-annotations')

implementation AndroidX.appCompat
implementation Google.android.material
implementation AndroidX.constraintLayout
implementation AndroidX.core.ktx
implementation AndroidX.lifecycle.runtime.ktx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Build
import android.os.Bundle
import android.view.WindowManager
import androidx.core.view.postDelayed
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.flowWithLifecycle
Expand Down Expand Up @@ -66,6 +67,10 @@ class VoiceSearchActivity : DuckDuckGoActivity() {
}

private fun configureViews() {
window.setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
)
binding.indicator.onAction {
if (it == INDICATOR_CLICKED) {
viewModel.userInitiatesSearchComplete()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/white"
android:fillColor="?attr/daxColorWhite"
android:pathData="M9,6C9,4.3432 10.3431,3 12,3C13.6569,3 15,4.3432 15,6V11C15,12.6569 13.6569,14 12,14C10.3431,14 9,12.6569 9,11V6Z" />
<path
android:fillColor="@color/white"
android:fillColor="?attr/daxColorWhite"
android:pathData="M7,19C6.4477,19 6,19.4477 6,20C6,20.5523 6.4477,21 7,21H17C17.5523,21 18,20.5523 18,20C18,19.4477 17.5523,19 17,19H13V17.9291C16.3923,17.4439 19,14.5265 19,11C19,10.4477 18.5523,10 18,10C17.4477,10 17,10.4477 17,11C17,13.7614 14.7614,16 12,16C9.2386,16 7,13.7614 7,11C7,10.4477 6.5523,10 6,10C5.4477,10 5,10.4477 5,11C5,14.5265 7.6077,17.4439 11,17.9291V19H7Z" />
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimaryDark">
android:background="?attr/daxColorBackground">

<FrameLayout
android:id="@+id/overlay"
Expand All @@ -31,21 +31,21 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_marginTop="@dimen/keyline_5"
android:background="@android:color/transparent"
android:theme="@style/Widget.DuckDuckGo.ToolbarTheme"
app:layout_constraintTop_toTopOf="parent"
app:popupTheme="@style/Widget.DuckDuckGo.PopUpOverflowMenu" />

<TextView
<com.duckduckgo.mobile.android.ui.view.text.DaxTextView
android:id="@+id/speechResults"
style="@style/TextAppearance.DuckDuckGo.Body1"
app:typography="body1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:layout_marginHorizontal="@dimen/keyline_6"
android:ellipsize="end"
android:gravity="center"
android:maxLines="3"
android:textColor="?attr/normalTextColor"
app:layout_constraintBottom_toTopOf="@+id/indicator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -62,16 +62,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/speechResults" />

<TextView
<com.duckduckgo.mobile.android.ui.view.text.DaxTextView
android:id="@+id/footer"
style="@style/TextAppearance.DuckDuckGo.Body2"
app:typography="body2"
app:textType="secondary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:layout_marginBottom="30dp"
android:layout_marginHorizontal="@dimen/keyline_6"
android:layout_marginBottom="80dp"
android:gravity="center"
android:text="@string/voiceSearchListeningFooter"
android:textColor="?attr/secondaryTextColor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
Expand Down
Loading

0 comments on commit 819b290

Please sign in to comment.