Merge "Disabling OverviewActionsView buttons while scrolling or clear all shown." into ub-launcher3-rvc-dev
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index d9cbe0b..31563ad 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -123,6 +123,7 @@
import com.android.quickstep.TaskUtils;
import com.android.quickstep.ViewUtils;
import com.android.quickstep.util.AppWindowAnimationHelper;
+import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.WindowSizeStrategy;
import com.android.systemui.plugins.ResourceProvider;
@@ -598,8 +599,17 @@
}
@Override
+ protected void onPageBeginTransition() {
+ super.onPageBeginTransition();
+ LayoutUtils.setViewEnabled(mActionsView, false);
+ }
+
+ @Override
protected void onPageEndTransition() {
super.onPageEndTransition();
+ if (getScrollX() == getScrollForPage(getPageNearestToCenterOfScreen())) {
+ LayoutUtils.setViewEnabled(mActionsView, true);
+ }
if (getNextPage() > 0) {
setSwipeDownShouldLaunchApp(true);
}
@@ -958,6 +968,7 @@
setCurrentPage(0);
mDwbToastShown = false;
mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0);
+ LayoutUtils.setViewEnabled(mActionsView, true);
}
public @Nullable TaskView getRunningTaskView() {
diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml
index c97ee7c..d3c4f4d 100644
--- a/quickstep/res/values/styles.xml
+++ b/quickstep/res/values/styles.xml
@@ -79,8 +79,8 @@
<style name="OverviewActionButton"
parent="@android:style/Widget.DeviceDefault.Button.Borderless">
- <item name="android:textColor">?attr/workspaceTextColor</item>
- <item name="android:drawableTint">?attr/workspaceTextColor</item>
+ <item name="android:textColor">@color/overview_button</item>
+ <item name="android:drawableTint">@color/overview_button</item>
<item name="android:tint">?attr/workspaceTextColor</item>
<item name="android:drawablePadding">4dp</item>
<item name="android:textAllCaps">false</item>
diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
index 14e5485..fa53be2 100644
--- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java
+++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
@@ -21,6 +21,8 @@
import android.content.Context;
import android.graphics.Rect;
+import android.view.View;
+import android.view.ViewGroup;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
@@ -66,4 +68,21 @@
return srcHeight / targetHeight;
}
}
+
+ /**
+ * Recursively sets view and all children enabled/disabled.
+ * @param viewGroup Top most parent view to change.
+ * @param enabled True = enable, False = disable.
+ */
+ public static void setViewEnabled(ViewGroup viewGroup, boolean enabled) {
+ viewGroup.setEnabled(enabled);
+ for (int i = 0; i < viewGroup.getChildCount(); i++) {
+ View child = viewGroup.getChildAt(i);
+ if (child instanceof ViewGroup) {
+ setViewEnabled((ViewGroup) child, enabled);
+ } else {
+ child.setEnabled(enabled);
+ }
+ }
+ }
}
diff --git a/res/color/overview_button.xml b/res/color/overview_button.xml
new file mode 100644
index 0000000..6ac36bf
--- /dev/null
+++ b/res/color/overview_button.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:alpha="1"
+ android:color="?attr/workspaceTextColor"
+ android:state_enabled="true" />
+ <item
+ android:alpha="?android:disabledAlpha"
+ android:color="?attr/workspaceTextColor"
+ android:state_enabled="false" />
+</selector>
\ No newline at end of file