mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-17 09:38:19 +00:00
Fade out scrim when swiping to home
Bug: 134517106 Change-Id: Ica725e3a327c1c069e3859732ea6a878d361a3d8
This commit is contained in:
@@ -28,13 +28,20 @@ import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAnimUtils.ViewProgressProperty;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.LauncherStateManager;
|
||||
import com.android.launcher3.LauncherStateManager.AnimationConfig;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.ShortcutAndWidgetContainer;
|
||||
import com.android.launcher3.anim.AnimatorSetBuilder;
|
||||
import com.android.launcher3.anim.PropertySetter;
|
||||
import com.android.launcher3.anim.SpringObjectAnimator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
|
||||
/**
|
||||
@@ -56,7 +63,7 @@ public class StaggeredWorkspaceAnim {
|
||||
private final float mSpringTransY;
|
||||
private final View mViewToIgnore;
|
||||
|
||||
private final List<ValueAnimator> mAnimators = new ArrayList<>();
|
||||
private final List<Animator> mAnimators = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* @param floatingViewOriginalView The FloatingIconView's original view.
|
||||
@@ -104,6 +111,9 @@ public class StaggeredWorkspaceAnim {
|
||||
View qsb = launcher.findViewById(R.id.search_container_all_apps);
|
||||
addStaggeredAnimationForView(qsb, grid.inv.numRows + 2, totalRows);
|
||||
}
|
||||
|
||||
addWorkspaceScrimAnimationForState(launcher, BACKGROUND_APP, 0);
|
||||
addWorkspaceScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,4 +160,14 @@ public class StaggeredWorkspaceAnim {
|
||||
alpha.setStartDelay(startDelay);
|
||||
mAnimators.add(alpha);
|
||||
}
|
||||
|
||||
private void addWorkspaceScrimAnimationForState(Launcher launcher, LauncherState state,
|
||||
long duration) {
|
||||
AnimatorSetBuilder scrimAnimBuilder = new AnimatorSetBuilder();
|
||||
AnimationConfig scrimAnimConfig = new AnimationConfig();
|
||||
scrimAnimConfig.duration = duration;
|
||||
PropertySetter scrimPropertySetter = scrimAnimConfig.getPropertySetter(scrimAnimBuilder);
|
||||
launcher.getWorkspace().getStateTransitionAnimation().setScrim(scrimPropertySetter, state);
|
||||
mAnimators.add(scrimAnimBuilder.build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1394,6 +1394,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
builder.play(stepAnimator);
|
||||
}
|
||||
|
||||
public WorkspaceStateTransitionAnimation getStateTransitionAnimation() {
|
||||
return mStateTransitionAnimation;
|
||||
}
|
||||
|
||||
public void updateAccessibilityFlags() {
|
||||
// TODO: Update the accessibility flags appropriately when dragging.
|
||||
int accessibilityFlag = mLauncher.getStateManager().getState().workspaceAccessibilityFlag;
|
||||
|
||||
@@ -130,7 +130,10 @@ public class WorkspaceStateTransitionAnimation {
|
||||
propertySetter.setFloat(mWorkspace.getPageIndicator(), View.TRANSLATION_Y,
|
||||
hotseatScaleAndTranslation.translationY, translationInterpolator);
|
||||
|
||||
// Set scrim
|
||||
setScrim(propertySetter, state);
|
||||
}
|
||||
|
||||
public void setScrim(PropertySetter propertySetter, LauncherState state) {
|
||||
WorkspaceAndHotseatScrim scrim = mLauncher.getDragLayer().getScrim();
|
||||
propertySetter.setFloat(scrim, SCRIM_PROGRESS, state.getWorkspaceScrimAlpha(mLauncher),
|
||||
LINEAR);
|
||||
|
||||
Reference in New Issue
Block a user