Simplifying all-apps search box

> Giving the search box a solid background so that it work fine with scrolling
> bottom shadow logic for search box

Bug: 73085356
Change-Id: Ie4dc4922be39ffd8e2d562becedbd4c6f820e6c9
This commit is contained in:
Sunny Goyal
2018-03-01 14:55:22 -08:00
parent dd535466bf
commit dbd6bb348c
13 changed files with 85 additions and 187 deletions

View File

@@ -27,7 +27,6 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.android.launcher3.R;
@@ -68,6 +67,7 @@ public class FloatingHeaderView extends LinearLayout implements
private int mTranslationY;
private boolean mForwardToRecyclerView;
protected boolean mTabsHidden;
protected int mMaxTranslation;
public FloatingHeaderView(@NonNull Context context) {
@@ -85,6 +85,7 @@ public class FloatingHeaderView extends LinearLayout implements
}
public void setup(AllAppsContainerView.AdapterHolder[] mAH, boolean tabsHidden) {
mTabsHidden = tabsHidden;
mTabLayout.setVisibility(tabsHidden ? View.GONE : View.VISIBLE);
mMainRV = setupRV(mMainRV, mAH[AllAppsContainerView.AdapterHolder.MAIN].recyclerView);
mWorkRV = setupRV(mWorkRV, mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView);
@@ -105,7 +106,13 @@ public class FloatingHeaderView extends LinearLayout implements
}
public int getMaxTranslation() {
return mMaxTranslation;
if (mMaxTranslation == 0 && mTabsHidden) {
return getResources().getDimensionPixelSize(R.dimen.all_apps_search_bar_bottom_padding);
} else if (mMaxTranslation > 0 && mTabsHidden) {
return mMaxTranslation + getPaddingTop();
} else {
return mMaxTranslation;
}
}
private boolean canSnapAt(int currentScrollY) {