summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/BubbleTextView.java25
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java3
-rw-r--r--src/com/android/launcher3/allapps/AllAppsSearchBarController.java17
3 files changed, 31 insertions, 14 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 3d91306f8..33b3ad347 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -56,11 +56,12 @@ public class BubbleTextView extends TextView
private static SparseArray<Theme> sPreloaderThemes = new SparseArray<Theme>(2);
- private static final float SHADOW_LARGE_RADIUS = 4.0f;
- private static final float SHADOW_SMALL_RADIUS = 1.75f;
- private static final float SHADOW_Y_OFFSET = 2.0f;
- private static final int SHADOW_LARGE_COLOUR = 0xDD000000;
- private static final int SHADOW_SMALL_COLOUR = 0xCC000000;
+ // Dimensions in DP
+ private static final float AMBIENT_SHADOW_RADIUS = 2.5f;
+ private static final float KEY_SHADOW_RADIUS = 1f;
+ private static final float KEY_SHADOW_OFFSET = 0.5f;
+ private static final int AMBIENT_SHADOW_COLOR = 0x33000000;
+ private static final int KEY_SHADOW_COLOR = 0x66000000;
private static final int DISPLAY_WORKSPACE = 0;
private static final int DISPLAY_ALL_APPS = 1;
@@ -136,6 +137,10 @@ public class BubbleTextView extends TextView
// Draw the background itself as the parent is drawn twice.
mBackground = getBackground();
setBackground(null);
+
+ // Set shadow layer as the larger shadow to that the textView does not clip the shadow.
+ float density = getResources().getDisplayMetrics().density;
+ setShadowLayer(density * AMBIENT_SHADOW_RADIUS, 0, 0, AMBIENT_SHADOW_COLOR);
} else {
mBackground = null;
}
@@ -144,10 +149,6 @@ public class BubbleTextView extends TextView
mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
mOutlineHelper = HolographicOutlineHelper.obtain(getContext());
- if (mCustomShadowsEnabled) {
- setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
- }
-
setAccessibilityDelegate(mLauncher.getAccessibilityDelegate());
}
@@ -408,13 +409,15 @@ public class BubbleTextView extends TextView
}
// We enhance the shadow by drawing the shadow twice
- getPaint().setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
+ float density = getResources().getDisplayMetrics().density;
+ getPaint().setShadowLayer(density * AMBIENT_SHADOW_RADIUS, 0, 0, AMBIENT_SHADOW_COLOR);
super.draw(canvas);
canvas.save(Canvas.CLIP_SAVE_FLAG);
canvas.clipRect(getScrollX(), getScrollY() + getExtendedPaddingTop(),
getScrollX() + getWidth(),
getScrollY() + getHeight(), Region.Op.INTERSECT);
- getPaint().setShadowLayer(SHADOW_SMALL_RADIUS, 0.0f, 0.0f, SHADOW_SMALL_COLOUR);
+ getPaint().setShadowLayer(
+ density * KEY_SHADOW_RADIUS, 0.0f, density * KEY_SHADOW_OFFSET, KEY_SHADOW_COLOR);
super.draw(canvas);
canvas.restore();
}
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 8b1f95087..428f78401 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -210,6 +210,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
*/
public void addApps(List<AppInfo> apps) {
mApps.addApps(apps);
+ mSearchBarController.refreshSearchResult();
}
/**
@@ -217,6 +218,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
*/
public void updateApps(List<AppInfo> apps) {
mApps.updateApps(apps);
+ mSearchBarController.refreshSearchResult();
}
/**
@@ -224,6 +226,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
*/
public void removeApps(List<AppInfo> apps) {
mApps.removeApps(apps);
+ mSearchBarController.refreshSearchResult();
}
public void setSearchBarVisible(boolean visible) {
diff --git a/src/com/android/launcher3/allapps/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
index ac3593238..e75210b93 100644
--- a/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
+++ b/src/com/android/launcher3/allapps/AllAppsSearchBarController.java
@@ -45,6 +45,7 @@ public abstract class AllAppsSearchBarController
protected AlphabeticalAppsList mApps;
protected Callbacks mCb;
protected ExtendedEditText mInput;
+ private String mQuery;
protected DefaultAppSearchAlgorithm mSearchAlgorithm;
protected InputMethodManager mInputMethodManager;
@@ -90,14 +91,23 @@ public abstract class AllAppsSearchBarController
@Override
public void afterTextChanged(final Editable s) {
- String query = s.toString();
- if (query.isEmpty()) {
+ mQuery = s.toString();
+ if (mQuery.isEmpty()) {
mSearchAlgorithm.cancel(true);
mCb.clearSearchResult();
} else {
mSearchAlgorithm.cancel(false);
- mSearchAlgorithm.doSearch(query, mCb);
+ mSearchAlgorithm.doSearch(mQuery, mCb);
+ }
+ }
+
+ protected void refreshSearchResult() {
+ if (mQuery == null) {
+ return;
}
+ // If play store continues auto updating an app, we want to show partial result.
+ mSearchAlgorithm.cancel(false);
+ mSearchAlgorithm.doSearch(mQuery, mCb);
}
@Override
@@ -130,6 +140,7 @@ public abstract class AllAppsSearchBarController
* Resets the search bar state.
*/
public void reset() {
+ mQuery = null;
unfocusSearchField();
mCb.clearSearchResult();
mInput.setText("");