mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Clean up work profile
This includes - Dismiss work edu on launcher state change - Remove work tab flash on first setup - Make edu bottom sheet adopt theme color - Fix Work toggle bottom inset Bug: 149200572 Bug: 149197172 Bug: 149199058 Bug: 149215103 Bug: 149198955 Bug: 145595763 Bug:149481723 Test: Manual Change-Id: I39a30782b80fd3a66bede55754fa30a940d2caee
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.android.launcher3.views;
|
||||
|
||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
|
||||
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
|
||||
|
||||
import android.animation.Animator;
|
||||
@@ -62,6 +64,7 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
|
||||
protected final ObjectAnimator mOpenCloseAnimator;
|
||||
|
||||
protected View mContent;
|
||||
private final View mColorScrim;
|
||||
protected Interpolator mScrollInterpolator;
|
||||
|
||||
// range [0, 1], 0=> completely open, 1=> completely closed
|
||||
@@ -85,11 +88,30 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
|
||||
announceAccessibilityChanges();
|
||||
}
|
||||
});
|
||||
int scrimColor = getScrimColor(mLauncher);
|
||||
mColorScrim = scrimColor != -1 ? createColorScrim(mLauncher, scrimColor) : null;
|
||||
}
|
||||
|
||||
protected void attachToContainer() {
|
||||
if (mColorScrim != null) {
|
||||
getPopupContainer().addView(mColorScrim);
|
||||
}
|
||||
getPopupContainer().addView(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a scrim color for a sliding view. if returned value is -1, no scrim is added.
|
||||
*/
|
||||
protected int getScrimColor(Context context) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected void setTranslationShift(float translationShift) {
|
||||
mTranslationShift = translationShift;
|
||||
mContent.setTranslationY(mTranslationShift * mContent.getHeight());
|
||||
if (mColorScrim != null) {
|
||||
mColorScrim.setAlpha(1 - mTranslationShift);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,7 +149,8 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
|
||||
/* SingleAxisSwipeDetector.Listener */
|
||||
|
||||
@Override
|
||||
public void onDragStart(boolean start) { }
|
||||
public void onDragStart(boolean start) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDrag(float displacement) {
|
||||
@@ -185,9 +208,25 @@ public abstract class AbstractSlideInView extends AbstractFloatingView
|
||||
protected void onCloseComplete() {
|
||||
mIsOpen = false;
|
||||
getPopupContainer().removeView(this);
|
||||
if (mColorScrim != null) {
|
||||
getPopupContainer().removeView(mColorScrim);
|
||||
}
|
||||
}
|
||||
|
||||
protected BaseDragLayer getPopupContainer() {
|
||||
return mLauncher.getDragLayer();
|
||||
}
|
||||
|
||||
|
||||
protected static View createColorScrim(Context context, int bgColor) {
|
||||
View view = new View(context);
|
||||
view.forceHasOverlappingRendering(false);
|
||||
view.setBackgroundColor(bgColor);
|
||||
|
||||
BaseDragLayer.LayoutParams lp = new BaseDragLayer.LayoutParams(MATCH_PARENT, MATCH_PARENT);
|
||||
lp.ignoreInsets = true;
|
||||
view.setLayoutParams(lp);
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user