mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
First pass of the Launcher Overlay interface / impl
-> Added simple reference launcher extension -> Make launcher able to handle a null qsb Change-Id: Ib1575243cac800a335e95bbf00cdc394bb4741c3
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.launcher3;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -37,7 +38,7 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
|
||||
private static final int sTransitionOutDuration = 175;
|
||||
|
||||
private ObjectAnimator mDropTargetBarAnim;
|
||||
private ObjectAnimator mQSBSearchBarAnim;
|
||||
private ValueAnimator mQSBSearchBarAnim;
|
||||
private static final AccelerateInterpolator sAccelerateInterpolator =
|
||||
new AccelerateInterpolator();
|
||||
|
||||
@@ -70,28 +71,38 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
|
||||
mInfoDropTarget.setLauncher(launcher);
|
||||
mDeleteDropTarget.setLauncher(launcher);
|
||||
mQSBSearchBar = launcher.getQsbBar();
|
||||
if (mEnableDropDownDropTargets) {
|
||||
mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "translationY", 0,
|
||||
-mBarHeight);
|
||||
if (mQSBSearchBar != null) {
|
||||
if (mEnableDropDownDropTargets) {
|
||||
mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "translationY", 0,
|
||||
-mBarHeight);
|
||||
} else {
|
||||
mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "alpha", 1f, 0f);
|
||||
}
|
||||
setupAnimation(mQSBSearchBarAnim, mQSBSearchBar);
|
||||
} else {
|
||||
mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "alpha", 1f, 0f);
|
||||
// Create a no-op animation of the search bar is null
|
||||
mQSBSearchBarAnim = ValueAnimator.ofFloat(0, 0);
|
||||
mQSBSearchBarAnim.setDuration(sTransitionInDuration);
|
||||
}
|
||||
setupAnimation(mQSBSearchBarAnim, mQSBSearchBar);
|
||||
}
|
||||
|
||||
private void prepareStartAnimation(View v) {
|
||||
// Enable the hw layers before the animation starts (will be disabled in the onAnimationEnd
|
||||
// callback below)
|
||||
v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||
if (v != null) {
|
||||
v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupAnimation(ObjectAnimator anim, final View v) {
|
||||
private void setupAnimation(ValueAnimator anim, final View v) {
|
||||
anim.setInterpolator(sAccelerateInterpolator);
|
||||
anim.setDuration(sTransitionInDuration);
|
||||
anim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
v.setLayerType(View.LAYER_TYPE_NONE, null);
|
||||
if (v != null) {
|
||||
v.setLayerType(View.LAYER_TYPE_NONE, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -145,9 +156,9 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
|
||||
mQSBSearchBarAnim.reverse();
|
||||
} else {
|
||||
mQSBSearchBarAnim.cancel();
|
||||
if (mEnableDropDownDropTargets) {
|
||||
if (mQSBSearchBar != null && mEnableDropDownDropTargets) {
|
||||
mQSBSearchBar.setTranslationY(0);
|
||||
} else {
|
||||
} else if (mQSBSearchBar != null) {
|
||||
mQSBSearchBar.setAlpha(1f);
|
||||
}
|
||||
}
|
||||
@@ -161,9 +172,9 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
|
||||
mQSBSearchBarAnim.start();
|
||||
} else {
|
||||
mQSBSearchBarAnim.cancel();
|
||||
if (mEnableDropDownDropTargets) {
|
||||
if (mQSBSearchBar != null && mEnableDropDownDropTargets) {
|
||||
mQSBSearchBar.setTranslationY(-mBarHeight);
|
||||
} else {
|
||||
} else if (mQSBSearchBar != null) {
|
||||
mQSBSearchBar.setAlpha(0f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user