summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/graphics
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-10-08 17:43:48 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-10-10 14:17:16 -0700
commit5d9fb0e92f2ef2b25f3aa93c1f89838ccc68aa88 (patch)
tree46764e909a89e51c294ca23b0eed69a481fa9333 /src/com/android/launcher3/graphics
parent631ffbda64b92b843f18af6756b52b1ac4c22461 (diff)
downloadandroid_packages_apps_Trebuchet-5d9fb0e92f2ef2b25f3aa93c1f89838ccc68aa88.tar.gz
android_packages_apps_Trebuchet-5d9fb0e92f2ef2b25f3aa93c1f89838ccc68aa88.tar.bz2
android_packages_apps_Trebuchet-5d9fb0e92f2ef2b25f3aa93c1f89838ccc68aa88.zip
Simplifying fast scroller logic
> Using a separate view for drawing the popup. This allows us to use elevation property instead of drawing the shadow as bitmap. > During the thumb animation, invalidating the full track width, instead of invalidating the track and thumb separately. > The thumb path is calculated at 0,0 and drawn using canvas.translate(). This avoids recalculating the path on every scroll. Change-Id: I48741e5b4432df0d939016db284d7aaf52cc2aa6
Diffstat (limited to 'src/com/android/launcher3/graphics')
-rw-r--r--src/com/android/launcher3/graphics/HolographicOutlineHelper.java22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/com/android/launcher3/graphics/HolographicOutlineHelper.java b/src/com/android/launcher3/graphics/HolographicOutlineHelper.java
index 0d70bdee1..9c397210e 100644
--- a/src/com/android/launcher3/graphics/HolographicOutlineHelper.java
+++ b/src/com/android/launcher3/graphics/HolographicOutlineHelper.java
@@ -158,18 +158,13 @@ public class HolographicOutlineHelper {
}
public Bitmap createMediumDropShadow(BubbleTextView view) {
- return createMediumDropShadow(view.getIcon(), view.getScaleX(), view.getScaleY(), true);
- }
-
- public Bitmap createMediumDropShadow(Drawable drawable, boolean shouldCache) {
- return createMediumDropShadow(drawable, 1f, 1f, shouldCache);
- }
-
- Bitmap createMediumDropShadow(Drawable drawable, float scaleX, float scaleY,
- boolean shouldCache) {
+ Drawable drawable = view.getIcon();
if (drawable == null) {
return null;
}
+
+ float scaleX = view.getScaleX();
+ float scaleY = view.getScaleY();
Rect rect = drawable.getBounds();
int bitmapWidth = (int) (rect.width() * scaleX);
@@ -179,14 +174,11 @@ public class HolographicOutlineHelper {
}
int key = (bitmapWidth << 16) | bitmapHeight;
- Bitmap cache = shouldCache ? mBitmapCache.get(key) : null;
+ Bitmap cache = mBitmapCache.get(key);
if (cache == null) {
cache = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Bitmap.Config.ALPHA_8);
mCanvas.setBitmap(cache);
-
- if (shouldCache) {
- mBitmapCache.put(key, cache);
- }
+ mBitmapCache.put(key, cache);
} else {
mCanvas.setBitmap(cache);
mCanvas.drawColor(Color.BLACK, PorterDuff.Mode.CLEAR);
@@ -206,7 +198,7 @@ public class HolographicOutlineHelper {
int resultWidth = bitmapWidth + extraSize;
int resultHeight = bitmapHeight + extraSize;
key = (resultWidth << 16) | resultHeight;
- Bitmap result = shouldCache ? mBitmapCache.get(key) : null;
+ Bitmap result = mBitmapCache.get(key);
if (result == null) {
result = Bitmap.createBitmap(resultWidth, resultHeight, Bitmap.Config.ALPHA_8);
mCanvas.setBitmap(result);