Updating all apps to match spec
Change-Id: Ie351fdea2e3b05ca911e6533f0c5d00c17e0847c
diff --git a/src/com/android/launcher3/BaseRecyclerViewFastScrollPopup.java b/src/com/android/launcher3/BaseRecyclerViewFastScrollPopup.java
index da7fa41..37584fe 100644
--- a/src/com/android/launcher3/BaseRecyclerViewFastScrollPopup.java
+++ b/src/com/android/launcher3/BaseRecyclerViewFastScrollPopup.java
@@ -32,9 +32,9 @@
private static final float FAST_SCROLL_OVERLAY_Y_OFFSET_FACTOR = 1.5f;
- private static final int SHADOW_INSET = 6;
+ private static final int SHADOW_INSET = 5;
private static final int SHADOW_SHIFT_Y = 4;
- private static final float SHADOW_ALPHA_MULTIPLIER = 0.6f;
+ private static final float SHADOW_ALPHA_MULTIPLIER = 0.5f;
private Resources mRes;
private BaseRecyclerView mRv;
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 84c29dc..a31c8ae 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1370,7 +1370,9 @@
mDragController.addDropTarget(mWorkspace);
mDropTargetBar.setup(mDragController);
- mAllAppsController.setupViews(mAppsView, mHotseat, mWorkspace);
+ if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
+ mAllAppsController.setupViews(mAppsView, mHotseat, mWorkspace);
+ }
if (TestingUtils.MEMORY_DUMP_ENABLED) {
TestingUtils.addWeightWatcher(this);
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index c3da491..868408f 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -25,11 +25,14 @@
import android.text.SpannableStringBuilder;
import android.text.method.TextKeyListener;
import android.util.AttributeSet;
+import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import com.android.launcher3.AppInfo;
@@ -58,7 +61,6 @@
import java.util.List;
-
/**
* A merge algorithm that merges every section indiscriminately.
*/
@@ -66,8 +68,8 @@
@Override
public boolean continueMerging(AlphabeticalAppsList.SectionInfo section,
- AlphabeticalAppsList.SectionInfo withSection,
- int sectionAppCount, int numAppsPerRow, int mergeCount) {
+ AlphabeticalAppsList.SectionInfo withSection,
+ int sectionAppCount, int numAppsPerRow, int mergeCount) {
// Don't merge the predicted apps
if (section.firstAppItem.viewType != AllAppsGridAdapter.ICON_VIEW_TYPE) {
return false;
@@ -98,8 +100,8 @@
@Override
public boolean continueMerging(AlphabeticalAppsList.SectionInfo section,
- AlphabeticalAppsList.SectionInfo withSection,
- int sectionAppCount, int numAppsPerRow, int mergeCount) {
+ AlphabeticalAppsList.SectionInfo withSection,
+ int sectionAppCount, int numAppsPerRow, int mergeCount) {
// Don't merge the predicted apps
if (section.firstAppItem.viewType != AllAppsGridAdapter.ICON_VIEW_TYPE) {
return false;
@@ -148,6 +150,7 @@
private View mSearchContainer;
private ExtendedEditText mSearchInput;
+ private ImageView mSearchIcon;
private HeaderElevationController mElevationController;
private SpannableStringBuilder mSearchQueryBuilder = null;
@@ -232,6 +235,7 @@
mSearchBarController.setVisibility(View.INVISIBLE);
}
}
+
/**
* Sets the search bar that shows above the a-z list.
*/
@@ -261,8 +265,8 @@
Utilities.mapCoordInSelfToDescendent(mAppsRecyclerView, this, point);
// if the MotionEvent is inside the thumb, container should not be pulled down.
- if (mAppsRecyclerView.getScrollBar().isNearThumb(point[0], point[1])){
- return false;
+ if (mAppsRecyclerView.getScrollBar().isNearThumb(point[0], point[1])) {
+ return false;
}
// If scroller is at the very top, then it's okay for the container to be pulled down.
if (Float.compare(0f, mAppsRecyclerView.getScrollBar().getThumbOffset().y) == 0) {
@@ -270,6 +274,7 @@
}
return false;
}
+
/**
* Focuses the search field and begins an app search.
*/
@@ -305,6 +310,42 @@
mSearchContainer = findViewById(R.id.search_container);
mSearchInput = (ExtendedEditText) findViewById(R.id.search_box_input);
+ mSearchIcon = (ImageView) findViewById(R.id.search_icon);
+
+ final LinearLayout.LayoutParams searchParams =
+ (LinearLayout.LayoutParams) mSearchInput.getLayoutParams();
+ mSearchInput.setOnFocusChangeListener(new OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View view, boolean focused) {
+ if (focused) {
+ searchParams.width = LayoutParams.MATCH_PARENT;
+ mSearchInput.setLayoutParams(searchParams);
+ mSearchInput.setGravity(Gravity.FILL_HORIZONTAL | Gravity.CENTER_VERTICAL);
+ mSearchIcon.setVisibility(View.GONE);
+ } else {
+ searchParams.width = LayoutParams.WRAP_CONTENT;
+ mSearchInput.setLayoutParams(searchParams);
+ mSearchInput.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
+ mSearchIcon.setVisibility(View.VISIBLE);
+ }
+ }
+ });
+
+ final OnClickListener searchFocusListener = new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (!mSearchInput.isFocused()) {
+ mSearchInput.requestFocus();
+ final InputMethodManager imm =
+ (InputMethodManager)getContext().getSystemService(
+ Context.INPUT_METHOD_SERVICE);
+ imm.showSoftInput(mSearchInput, 0);
+ }
+ }
+ };
+ mSearchInput.setOnClickListener(searchFocusListener);
+ mSearchContainer.setOnClickListener(searchFocusListener);
+
mElevationController = Utilities.ATLEAST_LOLLIPOP
? new HeaderElevationController.ControllerVL(mSearchContainer)
: new HeaderElevationController.ControllerV16(mSearchContainer);
@@ -379,7 +420,11 @@
if (mNumAppsPerRow > 0) {
int iconSize = availableWidth / mNumAppsPerRow;
int iconSpacing = (iconSize - grid.allAppsIconSizePx) / 2;
- mSearchInput.setPaddingRelative(iconSpacing, 0, iconSpacing, 0);
+ final int thumbMaxWidth =
+ getResources().getDimensionPixelSize(
+ R.dimen.container_fastscroll_thumb_max_width);
+ mSearchContainer.setPaddingRelative(
+ iconSpacing + thumbMaxWidth, 0, iconSpacing + thumbMaxWidth, 0);
}
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
@@ -452,7 +497,6 @@
lp.leftMargin = bgPadding.left;
lp.rightMargin = bgPadding.right;
-
// Clip the view to the left and right edge of the background to
// to prevent shadows from rendering beyond the edges
final Rect newClipBounds = new Rect(
@@ -472,7 +516,7 @@
MarginLayoutParams mlp = (MarginLayoutParams) mAppsRecyclerView.getLayoutParams();
Rect insets = mLauncher.getDragLayer().getInsets();
- getContentView().setPadding(0,0,0, insets.bottom);
+ getContentView().setPadding(0, 0, 0, insets.bottom);
int height = insets.top + grid.hotseatCellHeightPx;
mlp.topMargin = height;
@@ -482,10 +526,10 @@
(LinearLayout.LayoutParams) mSearchInput.getLayoutParams();
llp.topMargin = insets.top;
mSearchInput.setLayoutParams(llp);
+ mSearchIcon.setLayoutParams(llp);
lp.height = height;
}
- mSearchContainer.getBackground().setAlpha(0);
}
mSearchContainer.setLayoutParams(lp);
}
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 8a14a66..ac256b1 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -408,6 +408,7 @@
mAppsView.setVisibility(View.INVISIBLE);
mHotseat.setBackgroundTransparent(false /* transparent */);
mHotseat.setVisibility(View.VISIBLE);
+ mAppsView.reset();
setProgress(mShiftRange);
}