Show add button when WidgetCell text is tapped

This change adds the click listener to the cell itself as well as
the preview, so that clicks anywhere in the cell will show the add
button. Only long clicks on the preview image will start the
drag-and-drop (current behavior).

Bug: 323886237
Test: manual tap on Widget cell
Flag: ACONFIG com.android.launcher3.enable_widget_tap_to_add TEAMFOOD
Change-Id: I23b9b1261979971deffcf1132d95bd6a03c92c47
This commit is contained in:
Willie Koomson
2024-04-05 01:08:56 +00:00
parent dcc2d82d4e
commit 1d439df9b1
3 changed files with 3 additions and 0 deletions
@@ -216,6 +216,7 @@ public class WidgetsBottomSheet extends BaseWidgetSheet {
protected WidgetCell addItemCell(ViewGroup parent) {
WidgetCell widget = (WidgetCell) LayoutInflater.from(getContext())
.inflate(R.layout.widget_cell, parent, false);
widget.setOnClickListener(this);
View previewContainer = widget.findViewById(R.id.widget_preview_container);
previewContainer.setOnClickListener(this);
@@ -160,6 +160,7 @@ public final class WidgetsListTableViewHolderBinder
WidgetCell widget = (WidgetCell) mLayoutInflater.inflate(
R.layout.widget_cell, tableRow, false);
// set up touch.
widget.setOnClickListener(mIconClickListener);
View preview = widget.findViewById(R.id.widget_preview_container);
preview.setOnClickListener(mIconClickListener);
preview.setOnLongClickListener(mIconLongClickListener);
@@ -123,6 +123,7 @@ public final class WidgetsRecommendationTableLayout extends TableLayout {
private WidgetCell addItemCell(ViewGroup parent) {
WidgetCell widget = (WidgetCell) LayoutInflater.from(
getContext()).inflate(R.layout.widget_cell, parent, false);
widget.setOnClickListener(mWidgetCellOnClickListener);
View previewContainer = widget.findViewById(R.id.widget_preview_container);
previewContainer.setOnClickListener(mWidgetCellOnClickListener);