Loading src/com/android/launcher3/widget/BaseWidgetSheet.java +10 −2 Original line number Diff line number Diff line Loading @@ -141,9 +141,17 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<BaseActivity> if (enableWidgetTapToAdd()) { 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) { Loading src/com/android/launcher3/widget/WidgetCell.java +11 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ public class WidgetCell extends LinearLayout { private int mSourceContainer = CONTAINER_WIDGETS_TRAY; private CancellableTask mIconLoadRequest; private boolean mIsShowingAddButton = false; public WidgetCell(Context context) { this(context, null); Loading Loading @@ -534,6 +535,9 @@ public class WidgetCell extends LinearLayout { * @param callback Callback to be set on the button. */ public void showAddButton(View.OnClickListener callback) { if (mIsShowingAddButton) return; mIsShowingAddButton = true; mWidgetAddButton.setAlpha(0F); mWidgetAddButton.setVisibility(VISIBLE); mWidgetAddButton.setOnClickListener(callback); Loading @@ -555,6 +559,9 @@ public class WidgetCell extends LinearLayout { * Hide tap to add button. */ public void hideAddButton(boolean animate) { if (!mIsShowingAddButton) return; mIsShowingAddButton = false; mWidgetAddButton.setOnClickListener(null); mWidgetAddButton.animate().cancel(); mWidgetTextContainer.animate().cancel(); Loading @@ -579,4 +586,8 @@ public class WidgetCell extends LinearLayout { .alpha(1F) .setDuration(ADD_BUTTON_FADE_DURATION_MS); } public boolean isShowingAddButton() { return mIsShowingAddButton; } } Loading
src/com/android/launcher3/widget/BaseWidgetSheet.java +10 −2 Original line number Diff line number Diff line Loading @@ -141,9 +141,17 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<BaseActivity> if (enableWidgetTapToAdd()) { 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) { Loading
src/com/android/launcher3/widget/WidgetCell.java +11 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ public class WidgetCell extends LinearLayout { private int mSourceContainer = CONTAINER_WIDGETS_TRAY; private CancellableTask mIconLoadRequest; private boolean mIsShowingAddButton = false; public WidgetCell(Context context) { this(context, null); Loading Loading @@ -534,6 +535,9 @@ public class WidgetCell extends LinearLayout { * @param callback Callback to be set on the button. */ public void showAddButton(View.OnClickListener callback) { if (mIsShowingAddButton) return; mIsShowingAddButton = true; mWidgetAddButton.setAlpha(0F); mWidgetAddButton.setVisibility(VISIBLE); mWidgetAddButton.setOnClickListener(callback); Loading @@ -555,6 +559,9 @@ public class WidgetCell extends LinearLayout { * Hide tap to add button. */ public void hideAddButton(boolean animate) { if (!mIsShowingAddButton) return; mIsShowingAddButton = false; mWidgetAddButton.setOnClickListener(null); mWidgetAddButton.animate().cancel(); mWidgetTextContainer.animate().cancel(); Loading @@ -579,4 +586,8 @@ public class WidgetCell extends LinearLayout { .alpha(1F) .setDuration(ADD_BUTTON_FADE_DURATION_MS); } public boolean isShowingAddButton() { return mIsShowingAddButton; } }