[Part 2] Clean up references for flags from past release.
Cleans up the tap to add flag.
Bug: 399933655
Flag: EXEMPT cleanup
Test: Screenshot tests
Change-Id: Ifc7bb572ed93f36ebb7f7ae808d0e14bba020a2f
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index fda5175..af31276 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -16,7 +16,6 @@
package com.android.launcher3.widget;
import static com.android.app.animation.Interpolators.EMPHASIZED;
-import static com.android.launcher3.Flags.enableWidgetTapToAdd;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_ADD_BUTTON_TAP;
@@ -150,40 +149,36 @@
return;
}
- if (enableWidgetTapToAdd()) {
- scrollToWidgetCell(wc);
+ scrollToWidgetCell(wc);
- if (mWidgetCellWithAddButton != null) {
- if (mWidgetCellWithAddButton.isShowingAddButton()) {
- // If there is a add button currently showing, hide it.
- mWidgetCellWithAddButton.hideAddButton(/* animate= */ true);
- } else {
- // The last recorded widget cell to show an add button is no longer showing it,
- // likely because the widget cell has been recycled or lost focus. If this is
- // the cell that has been clicked, we will show it below.
- mWidgetCellWithAddButton = null;
- }
- }
-
- if (mWidgetCellWithAddButton != wc) {
- // If click is on a cell not showing an add button, show it now.
- final PendingAddItemInfo info = (PendingAddItemInfo) wc.getTag();
- if (mActivityContext instanceof Launcher) {
- wc.showAddButton((view) -> addWidget(info));
- } else {
- wc.showAddButton((view) -> mActivityContext.getItemOnClickListener()
- .onClick(wc));
- }
- }
-
- mWidgetCellWithAddButton = mWidgetCellWithAddButton != wc ? wc : null;
- if (mWidgetCellWithAddButton != null) {
- mLastSelectedWidgetItem = mWidgetCellWithAddButton.getWidgetItem();
+ if (mWidgetCellWithAddButton != null) {
+ if (mWidgetCellWithAddButton.isShowingAddButton()) {
+ // If there is a add button currently showing, hide it.
+ mWidgetCellWithAddButton.hideAddButton(/* animate= */ true);
} else {
- mLastSelectedWidgetItem = null;
+ // The last recorded widget cell to show an add button is no longer showing it,
+ // likely because the widget cell has been recycled or lost focus. If this is
+ // the cell that has been clicked, we will show it below.
+ mWidgetCellWithAddButton = null;
}
+ }
+
+ if (mWidgetCellWithAddButton != wc) {
+ // If click is on a cell not showing an add button, show it now.
+ final PendingAddItemInfo info = (PendingAddItemInfo) wc.getTag();
+ if (mActivityContext instanceof Launcher) {
+ wc.showAddButton((view) -> addWidget(info));
+ } else {
+ wc.showAddButton((view) -> mActivityContext.getItemOnClickListener()
+ .onClick(wc));
+ }
+ }
+
+ mWidgetCellWithAddButton = mWidgetCellWithAddButton != wc ? wc : null;
+ if (mWidgetCellWithAddButton != null) {
+ mLastSelectedWidgetItem = mWidgetCellWithAddButton.getWidgetItem();
} else {
- mActivityContext.getItemOnClickListener().onClick(wc);
+ mLastSelectedWidgetItem = null;
}
}
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index 7a27bf4..130843b 100644
--- a/src/com/android/launcher3/widget/WidgetCell.java
+++ b/src/com/android/launcher3/widget/WidgetCell.java
@@ -18,7 +18,6 @@
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK;
-import static com.android.launcher3.Flags.enableWidgetTapToAdd;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY;
import static com.android.launcher3.widget.util.WidgetSizes.getWidgetItemSizePx;
@@ -152,24 +151,22 @@
mWidgetTextContainer = findViewById(R.id.widget_text_container);
mWidgetAddButton = findViewById(R.id.widget_add_button);
- if (enableWidgetTapToAdd()) {
- setAccessibilityDelegate(new AccessibilityDelegate() {
- @Override
- public void onInitializeAccessibilityNodeInfo(View host,
- AccessibilityNodeInfo info) {
- super.onInitializeAccessibilityNodeInfo(host, info);
- if (hasOnClickListeners()) {
- String accessibilityLabel = getResources().getString(
- mWidgetAddButton.isShown()
- ? R.string.widget_cell_tap_to_hide_add_button_label
- : R.string.widget_cell_tap_to_show_add_button_label);
- info.addAction(new AccessibilityNodeInfo.AccessibilityAction(ACTION_CLICK,
- accessibilityLabel));
- }
+ setAccessibilityDelegate(new AccessibilityDelegate() {
+ @Override
+ public void onInitializeAccessibilityNodeInfo(View host,
+ AccessibilityNodeInfo info) {
+ super.onInitializeAccessibilityNodeInfo(host, info);
+ if (hasOnClickListeners()) {
+ String accessibilityLabel = getResources().getString(
+ mWidgetAddButton.isShown()
+ ? R.string.widget_cell_tap_to_hide_add_button_label
+ : R.string.widget_cell_tap_to_show_add_button_label);
+ info.addAction(new AccessibilityNodeInfo.AccessibilityAction(ACTION_CLICK,
+ accessibilityLabel));
}
- });
- mWidgetAddButton.setVisibility(INVISIBLE);
- }
+ }
+ });
+ mWidgetAddButton.setVisibility(INVISIBLE);
}
public void setRemoteViewsPreview(RemoteViews view) {
@@ -210,9 +207,7 @@
showDescription(true);
showDimensions(true);
- if (enableWidgetTapToAdd()) {
- hideAddButton(/* animate= */ false);
- }
+ hideAddButton(/* animate= */ false);
if (mActiveRequest != null) {
mActiveRequest.cancel();