Merge "Disabling OverviewActionsView buttons while scrolling or clear all shown." into ub-launcher3-rvc-dev

This commit is contained in:
TreeHugger Robot 2020-05-08 00:02:54 +00:00 committed by Android (Google) Code Review
commit e4d1a71413
4 changed files with 43 additions and 2 deletions

View File

@ -123,6 +123,7 @@ import com.android.quickstep.TaskThumbnailCache;
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;
@ -597,9 +598,18 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
}
}
@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 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
setCurrentPage(0);
mDwbToastShown = false;
mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, 0);
LayoutUtils.setViewEnabled(mActionsView, true);
}
public @Nullable TaskView getRunningTaskView() {

View File

@ -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>

View File

@ -21,6 +21,8 @@ import static com.android.quickstep.util.WindowSizeStrategy.LAUNCHER_ACTIVITY_SI
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 @@ public class LayoutUtils {
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);
}
}
}
}

View File

@ -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>