Merge "Set smartspace to 30% visibility on workspace edit for home gardening" into tm-qpr-dev

This commit is contained in:
Federico Baron
2022-10-24 19:17:29 +00:00
committed by Android (Google) Code Review
3 changed files with 20 additions and 1 deletions

View File

@@ -55,7 +55,6 @@ import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.core.graphics.ColorUtils;
import androidx.core.view.ViewCompat;

View File

@@ -919,6 +919,10 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
return mScreenOrder;
}
protected View getQsb() {
return mQsb;
}
/**
* Returns the screen ID of a page that is shown together with the given page screen ID when the
* two panel UI is enabled.

View File

@@ -29,11 +29,13 @@ import static com.android.launcher3.LauncherState.FLAG_HOTSEAT_INACCESSIBLE;
import static com.android.launcher3.LauncherState.HINT_STATE;
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.LauncherState.WORKSPACE_PAGE_INDICATOR;
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.ZOOM_OUT;
import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
import static com.android.launcher3.config.FeatureFlags.SHOW_HOME_GARDENING;
import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS;
import static com.android.launcher3.graphics.SysUiScrim.SYSUI_PROGRESS;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_FADE;
@@ -69,6 +71,8 @@ import com.android.systemui.plugins.ResourceProvider;
*/
public class WorkspaceStateTransitionAnimation {
private static final float QSB_DISABLED_ALPHA = 0.3f;
private static final FloatProperty<Workspace<?>> WORKSPACE_SCALE_PROPERTY =
WORKSPACE_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_WORKSPACE_STATE);
@@ -155,6 +159,18 @@ public class WorkspaceStateTransitionAnimation {
float hotseatIconsAlpha = (elements & HOTSEAT_ICONS) != 0 ? 1 : 0;
propertySetter.setViewAlpha(hotseat, hotseatIconsAlpha, hotseatFadeInterpolator);
if (SHOW_HOME_GARDENING.get()) {
propertySetter.setViewAlpha(
mWorkspace.getQsb(),
state == SPRING_LOADED ? QSB_DISABLED_ALPHA : 1,
workspaceFadeInterpolator);
propertySetter.addEndListener(success -> {
if (success) {
mWorkspace.getQsb().setClickable(state != SPRING_LOADED);
}
});
}
// Update the accessibility flags for hotseat based on launcher state.
hotseat.setImportantForAccessibility(
state.hasFlag(FLAG_HOTSEAT_INACCESSIBLE)