mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Making caret visibility part of state definition
> Hiding the caret in fast overview state > Hiding caret in task swipe down interaction Bug: 79700605 Change-Id: I984d535bc75802501e8aeb13c8f37387f331e5bc
This commit is contained in:
@@ -100,9 +100,9 @@ public class OverviewState extends LauncherState {
|
||||
@Override
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
|
||||
return 0;
|
||||
return VERTICAL_SWIPE_INDICATOR;
|
||||
} else {
|
||||
return HOTSEAT_SEARCH_BOX |
|
||||
return HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR |
|
||||
(launcher.getAppsView().getFloatingHeaderView().hasVisibleContent()
|
||||
? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ import android.view.ViewDebug;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.views.ScrimView;
|
||||
import com.android.quickstep.OverviewInteractionState;
|
||||
import com.android.quickstep.util.ClipAnimationHelper;
|
||||
import com.android.quickstep.util.LayoutUtils;
|
||||
@@ -136,6 +139,12 @@ public class LauncherRecentsView extends RecentsView<Launcher> {
|
||||
}
|
||||
anim.play(ObjectAnimator.ofFloat(
|
||||
mActivity.getAllAppsController(), ALL_APPS_PROGRESS, allAppsProgressOffscreen));
|
||||
|
||||
ObjectAnimator dragHandleAnim = ObjectAnimator.ofInt(
|
||||
mActivity.findViewById(R.id.scrim_view), ScrimView.DRAG_HANDLE_ALPHA, 0);
|
||||
dragHandleAnim.setInterpolator(Interpolators.ACCEL_2);
|
||||
anim.play(dragHandleAnim);
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
@@ -150,7 +159,7 @@ public class LauncherRecentsView extends RecentsView<Launcher> {
|
||||
mActivity.getStateManager().goToState(NORMAL, false /* animate */);
|
||||
} else {
|
||||
LauncherState state = mActivity.getStateManager().getState();
|
||||
mActivity.getAllAppsController().setProgress(state.getVerticalProgress(mActivity));
|
||||
mActivity.getAllAppsController().setState(state);
|
||||
}
|
||||
super.onTaskLaunched(success);
|
||||
}
|
||||
|
||||
@@ -153,15 +153,6 @@ public class ShelfScrimView extends ScrimView {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateDragHandleAlpha() {
|
||||
if (mDrawingFlatColor) {
|
||||
super.updateDragHandleAlpha();
|
||||
} else if (mDragHandle != null) {
|
||||
mDragHandle.setAlpha(255);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
float translate = drawBackground(canvas);
|
||||
|
||||
@@ -51,6 +51,7 @@ public class LauncherState {
|
||||
public static final int ALL_APPS_HEADER = 1 << 2;
|
||||
public static final int ALL_APPS_HEADER_EXTRA = 1 << 3; // e.g. app predictions
|
||||
public static final int ALL_APPS_CONTENT = 1 << 4;
|
||||
public static final int VERTICAL_SWIPE_INDICATOR = 1 << 5;
|
||||
|
||||
protected static final int FLAG_MULTI_PAGE = 1 << 0;
|
||||
protected static final int FLAG_DISABLE_ACCESSIBILITY = 1 << 1;
|
||||
@@ -201,9 +202,9 @@ public class LauncherState {
|
||||
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
|
||||
return HOTSEAT_ICONS;
|
||||
return HOTSEAT_ICONS | VERTICAL_SWIPE_INDICATOR;
|
||||
}
|
||||
return HOTSEAT_ICONS | HOTSEAT_SEARCH_BOX;
|
||||
return HOTSEAT_ICONS | HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@ import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS_HEADER;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.LauncherState.VERTICAL_SWIPE_INDICATOR;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_VERTICAL_PROGRESS;
|
||||
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
|
||||
@@ -198,6 +199,9 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil
|
||||
setter.setViewAlpha(mAppsView.getContentView(), hasContent ? 1 : 0, LINEAR);
|
||||
setter.setViewAlpha(mAppsView.getScrollBar(), hasContent ? 1 : 0, LINEAR);
|
||||
mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasContent, setter);
|
||||
|
||||
setter.setInt(mScrimView, ScrimView.DRAG_HANDLE_ALPHA,
|
||||
(visibleElements & VERTICAL_SWIPE_INDICATOR) != 0 ? 255 : 0, LINEAR);
|
||||
}
|
||||
|
||||
public AnimatorListenerAdapter getProgressAnimatorListener() {
|
||||
|
||||
@@ -45,6 +45,7 @@ import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
|
||||
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
|
||||
import android.support.v4.widget.ExploreByTouchHelper;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Property;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -73,6 +74,19 @@ import java.util.List;
|
||||
public class ScrimView extends View implements Insettable, OnChangeListener,
|
||||
AccessibilityStateChangeListener, StateListener {
|
||||
|
||||
public static final Property<ScrimView, Integer> DRAG_HANDLE_ALPHA =
|
||||
new Property<ScrimView, Integer>(Integer.TYPE, "dragHandleAlpha") {
|
||||
|
||||
@Override
|
||||
public Integer get(ScrimView scrimView) {
|
||||
return scrimView.mDragHandleAlpha;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(ScrimView scrimView, Integer value) {
|
||||
scrimView.setDragHandleAlpha(value);
|
||||
}
|
||||
};
|
||||
private static final int WALLPAPERS = R.string.wallpaper_button_text;
|
||||
private static final int WIDGETS = R.string.widget_button_text;
|
||||
private static final int SETTINGS = R.string.settings_button_text;
|
||||
@@ -102,6 +116,8 @@ public class ScrimView extends View implements Insettable, OnChangeListener,
|
||||
@Nullable
|
||||
protected Drawable mDragHandle;
|
||||
|
||||
private int mDragHandleAlpha = 255;
|
||||
|
||||
public ScrimView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mLauncher = Launcher.getLauncher(context);
|
||||
@@ -187,7 +203,17 @@ public class ScrimView extends View implements Insettable, OnChangeListener,
|
||||
|
||||
protected void updateDragHandleAlpha() {
|
||||
if (mDragHandle != null) {
|
||||
mDragHandle.setAlpha(Math.round(255 * Utilities.boundToRange(mProgress, 0, 1)));
|
||||
mDragHandle.setAlpha(mDragHandleAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
private void setDragHandleAlpha(int alpha) {
|
||||
if (alpha != mDragHandleAlpha) {
|
||||
mDragHandleAlpha = alpha;
|
||||
if (mDragHandle != null) {
|
||||
mDragHandle.setAlpha(mDragHandleAlpha);
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user