mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Changing the overviewState to show appsearch and floating header
Change-Id: I2cfd61cfc9978e4c8e4520f0f7217e49e7344c79
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.android.launcher3.allapps;
|
||||
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
@@ -29,6 +31,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.anim.PropertySetter;
|
||||
|
||||
public class FloatingHeaderView extends LinearLayout implements
|
||||
ValueAnimator.AnimatorUpdateListener {
|
||||
@@ -57,7 +60,7 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
}
|
||||
};
|
||||
|
||||
private ViewGroup mTabLayout;
|
||||
protected ViewGroup mTabLayout;
|
||||
private AllAppsRecyclerView mMainRV;
|
||||
private AllAppsRecyclerView mWorkRV;
|
||||
private AllAppsRecyclerView mCurrentRV;
|
||||
@@ -65,6 +68,8 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
private boolean mHeaderCollapsed;
|
||||
private int mSnappedScrolledY;
|
||||
private int mTranslationY;
|
||||
|
||||
private boolean mAllowTouchForwarding;
|
||||
private boolean mForwardToRecyclerView;
|
||||
|
||||
protected boolean mTabsHidden;
|
||||
@@ -91,7 +96,7 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
mWorkRV = setupRV(mWorkRV, mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView);
|
||||
mParent = (ViewGroup) mMainRV.getParent();
|
||||
setMainActive(true);
|
||||
reset();
|
||||
reset(false);
|
||||
}
|
||||
|
||||
private AllAppsRecyclerView setupRV(AllAppsRecyclerView old, AllAppsRecyclerView updated) {
|
||||
@@ -158,12 +163,19 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
int translateTo = 0;
|
||||
mAnimator.setIntValues(mTranslationY, translateTo);
|
||||
mAnimator.addUpdateListener(this);
|
||||
mAnimator.setDuration(150);
|
||||
mAnimator.start();
|
||||
public void reset(boolean animate) {
|
||||
if (mAnimator.isStarted()) {
|
||||
mAnimator.cancel();
|
||||
}
|
||||
if (animate) {
|
||||
mAnimator.setIntValues(mTranslationY, 0);
|
||||
mAnimator.addUpdateListener(this);
|
||||
mAnimator.setDuration(150);
|
||||
mAnimator.start();
|
||||
} else {
|
||||
mTranslationY = 0;
|
||||
apply();
|
||||
}
|
||||
mHeaderCollapsed = false;
|
||||
mSnappedScrolledY = -mMaxTranslation;
|
||||
mCurrentRV.scrollToTop();
|
||||
@@ -181,6 +193,10 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (!mAllowTouchForwarding) {
|
||||
mForwardToRecyclerView = false;
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
calcOffset(mTempOffset);
|
||||
ev.offsetLocation(mTempOffset.x, mTempOffset.y);
|
||||
mForwardToRecyclerView = mCurrentRV.onInterceptTouchEvent(ev);
|
||||
@@ -208,6 +224,19 @@ public class FloatingHeaderView extends LinearLayout implements
|
||||
p.x = getLeft() - mCurrentRV.getLeft() - mParent.getLeft();
|
||||
p.y = getTop() - mCurrentRV.getTop() - mParent.getTop();
|
||||
}
|
||||
|
||||
public void setContentVisibility(boolean hasHeader, boolean hasContent, PropertySetter setter) {
|
||||
setter.setViewAlpha(this, hasContent ? 1 : 0, LINEAR);
|
||||
allowTouchForwarding(hasContent);
|
||||
}
|
||||
|
||||
protected void allowTouchForwarding(boolean allow) {
|
||||
mAllowTouchForwarding = allow;
|
||||
}
|
||||
|
||||
public boolean hasVisibleContent() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user