summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/widget
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-06-04 17:18:17 -0700
committerWinson Chung <winsonc@google.com>2015-06-15 14:22:47 -0700
commitef7f874a889b609bd34e692b9c9a1f8cefd1ea95 (patch)
tree23d364f99ae51ea31a9d4e9e9c5bcf7048db7184 /src/com/android/launcher3/widget
parente89cf793ab22fcb8cea3ff94ca981659208446db (diff)
downloadandroid_packages_apps_Trebuchet-ef7f874a889b609bd34e692b9c9a1f8cefd1ea95.tar.gz
android_packages_apps_Trebuchet-ef7f874a889b609bd34e692b9c9a1f8cefd1ea95.tar.bz2
android_packages_apps_Trebuchet-ef7f874a889b609bd34e692b9c9a1f8cefd1ea95.zip
Refactoring all apps search to support external search bar.
- Adding support for an external search bar that can be used to search a container view. This adds a new interface AllAppsSearchController which manages the external search bar. Each controller will have its own search implementation which means that we no longer need a common AppSearchManager interface. - Removing elevation controller as we no longer have a builtin search bar in all apps - Refactoring container view insets so that they behave the same in all containers. - Refactoring apps view to ensure that we only update the number of columns with the available width - Cleaning up LauncherCallbacks interface Bug: 20127840 Bug: 21494973 Change-Id: I710b8e18196961d77d8a29f0c345531d480936fe
Diffstat (limited to 'src/com/android/launcher3/widget')
-rw-r--r--src/com/android/launcher3/widget/WidgetsContainerView.java42
-rw-r--r--src/com/android/launcher3/widget/WidgetsRecyclerView.java7
2 files changed, 14 insertions, 35 deletions
diff --git a/src/com/android/launcher3/widget/WidgetsContainerView.java b/src/com/android/launcher3/widget/WidgetsContainerView.java
index 51f2a5f05..500311add 100644
--- a/src/com/android/launcher3/widget/WidgetsContainerView.java
+++ b/src/com/android/launcher3/widget/WidgetsContainerView.java
@@ -66,6 +66,7 @@ public class WidgetsContainerView extends BaseContainerView
private IconCache mIconCache;
/* Recycler view related member variables */
+ private View mContent;
private WidgetsRecyclerView mView;
private WidgetsListAdapter mAdapter;
@@ -98,6 +99,7 @@ public class WidgetsContainerView extends BaseContainerView
@Override
protected void onFinishInflate() {
+ mContent = findViewById(R.id.content);
mView = (WidgetsRecyclerView) findViewById(R.id.widgets_list_view);
mView.setAdapter(mAdapter);
@@ -112,7 +114,6 @@ public class WidgetsContainerView extends BaseContainerView
});
mPadding.set(getPaddingLeft(), getPaddingTop(), getPaddingRight(),
getPaddingBottom());
- onUpdatePaddings();
}
//
@@ -335,33 +336,18 @@ public class WidgetsContainerView extends BaseContainerView
//
@Override
- protected void onUpdatePaddings() {
- if (mFixedBounds.isEmpty()) {
- // If there are no fixed bounds, then use the default padding and insets
- setPadding(mPadding.left + mInsets.left, mPadding.top + mInsets.top,
- mPadding.right + mInsets.right, mPadding.bottom + mInsets.bottom);
- } else {
- // If there are fixed bounds, then we update the padding to reflect the fixed bounds.
- setPadding(mFixedBounds.left, mFixedBounds.top, getMeasuredWidth() - mFixedBounds.right,
- mFixedBounds.bottom);
- }
-
- int inset = mFixedBounds.isEmpty() ? mView.getScrollbarWidth() : mFixedBoundsContainerInset;
- mView.setPadding(inset + mView.getScrollbarWidth(), inset,
- inset, inset);
- }
-
- @Override
- protected void onUpdateBackgrounds() {
- InsetDrawable background;
- // Update the background of the reveal view and list to be inset with the fixed bound
- // insets instead of the default insets
- // TODO: Use quantum_panel instead of quantum_panel_shape.
- int inset = mFixedBounds.isEmpty() ? mView.getScrollbarWidth() : mFixedBoundsContainerInset;
- background = new InsetDrawable(
- getContext().getResources().getDrawable(R.drawable.quantum_panel_shape),
- inset, 0, inset, 0);
- mView.updateBackgroundPadding(background);
+ protected void onUpdateBackgroundAndPaddings(Rect searchBarBounds, Rect padding) {
+ // Apply the top-bottom padding to the content itself so that the launcher transition is
+ // clipped correctly
+ mContent.setPadding(0, padding.top, 0, padding.bottom);
+
+ // TODO: Use quantum_panel_dark instead of quantum_panel_shape_dark.
+ InsetDrawable background = new InsetDrawable(
+ getResources().getDrawable(R.drawable.quantum_panel_shape_dark), padding.left, 0,
+ padding.right, 0);
+ mView.setBackground(background);
+ getRevealView().setBackground(background.getConstantState().newDrawable());
+ mView.updateBackgroundPadding(padding);
}
/**
diff --git a/src/com/android/launcher3/widget/WidgetsRecyclerView.java b/src/com/android/launcher3/widget/WidgetsRecyclerView.java
index 9d265f87e..fa7e2f0a2 100644
--- a/src/com/android/launcher3/widget/WidgetsRecyclerView.java
+++ b/src/com/android/launcher3/widget/WidgetsRecyclerView.java
@@ -18,11 +18,9 @@ package com.android.launcher3.widget;
import android.content.Context;
import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.util.AttributeSet;
import android.view.View;
-
import com.android.launcher3.BaseRecyclerView;
import com.android.launcher3.Utilities;
import com.android.launcher3.model.WidgetsModel;
@@ -35,7 +33,6 @@ public class WidgetsRecyclerView extends BaseRecyclerView {
private static final String TAG = "WidgetsRecyclerView";
private WidgetsModel mWidgets;
- private Rect mBackgroundPadding = new Rect();
public WidgetsRecyclerView(Context context) {
this(context, null);
@@ -61,10 +58,6 @@ public class WidgetsRecyclerView extends BaseRecyclerView {
addOnItemTouchListener(this);
}
- public void updateBackgroundPadding(Drawable background) {
- background.getPadding(mBackgroundPadding);
- }
-
/**
* Sets the widget model in this view, used to determine the fast scroll position.
*/