-
Notifications
You must be signed in to change notification settings - Fork 1k
[Implementation] Widget 1: Search + Duck.ai #6576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/ana/add_duck_ai_entry_points_to_widgets_plus_additional_widgets
Are you sure you want to change the base?
[Implementation] Widget 1: Search + Duck.ai #6576
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
TestCase(3, 465), | ||
TestCase(4, 466), | ||
TestCase(3, 466), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We changed some of the dimens, so I updated the test to match the current expected behavior.
|
||
val views = RemoteViews(context.packageName, layoutId) | ||
views.setViewVisibility(R.id.searchInputBox, if (shouldShowHint) View.VISIBLE else View.INVISIBLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all this as in the new requirements we don't hide the hint.
@@ -20,7 +20,7 @@ | |||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:initialKeyguardLayout="@layout/search_widget_dark" | |||
android:initialLayout="@layout/search_widget_dark" | |||
android:minWidth="314dp" | |||
android:minWidth="250dp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New requirements.
@@ -20,7 +20,7 @@ | |||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:initialKeyguardLayout="@layout/search_widget_light" | |||
android:initialLayout="@layout/search_widget_light" | |||
android:minWidth="314dp" | |||
android:minWidth="250dp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New requirements.
@@ -141,7 +141,7 @@ | |||
<dimen name="searchWidgetSearchBarSideMargin">16dp</dimen> | |||
<dimen name="searchWidgetFavoriteItemContainerWidth">64dp</dimen> | |||
<dimen name="searchWidgetFavoriteItemContainerHeight">78dp</dimen> | |||
<dimen name="searchWidgetSearchBarHeight">46dp</dimen> | |||
<dimen name="searchWidgetSearchBarHeight">48dp</dimen> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New requirements.
* | ||
* @return Intent to open DuckChat. | ||
*/ | ||
fun openDuckChatIntent(): Intent? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened a proposal for the changes in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the first widget enhancement by integrating Duck.ai functionality into the search widget. The implementation replaces the RelativeLayout with LinearLayout for better control, adds Duck.ai and voice search icons with a separator, and includes dynamic configuration based on feature availability.
Key changes:
- Widget layout restructure from RelativeLayout to LinearLayout with new Duck.ai icon and separator
- SearchWidgetConfigurator class to handle dynamic widget configuration based on voice search and Duck.ai availability
- Broadcast receiver system to update widgets when Duck.ai becomes available or settings change
- Visual improvements including larger corner radius, updated icons, and better spacing
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
app/src/main/res/layout/search_widget_*.xml |
Layout restructure from RelativeLayout to LinearLayout with new Duck.ai icon, separator, and updated styling |
app/src/main/java/com/duckduckgo/widget/SearchWidgetConfigurator.kt |
New class handling dynamic widget configuration based on feature availability |
duckchat/duckchat-api/src/main/java/com/duckduckgo/duckchat/api/DuckChat.kt |
Added createDuckChatIntent() method and moved isDuckChatUserEnabled() from internal interface |
app/src/main/java/com/duckduckgo/widget/DuckAiSearchWidgetUpdaterReceiver.kt |
Broadcast receiver to update widgets when Duck.ai availability changes |
duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/repository/DuckChatFeatureRepository.kt |
Widget update broadcast on first Duck.ai usage |
app/src/main/java/com/duckduckgo/widget/SearchWidgetConfigurator.kt
Outdated
Show resolved
Hide resolved
4f9b5e7
to
6906ff5
Compare
40bb1d5
to
2c22a09
Compare
…idget configuration.
…operations and update widget visibility logic.
fun configureWidget( | ||
context: Context, | ||
remoteViews: RemoteViews, | ||
appWidgetManager: AppWidgetManager, | ||
appWidgetId: Int, | ||
fromFavWidget: Boolean, | ||
) { | ||
appCoroutineScope.launch(dispatcherProvider.io()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Would it be better to follow structured concurrency principles and mark this function suspend
instead of launching? That way the caller gets to decide the scope and lifecycle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! LGTM
Task/Issue URL: https://app.asana.com/1/137249556945/project/276630244458377/task/1210378258410691?focus=true
Description
This PR updates the search widget to include Duck.ai functionality by:
Steps to test this PR
Widget UI Updates
UI changes
See Asana Task.