Loading res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ <!-- Name of an icon provider class. --> <string name="icon_provider_class" translatable="false"></string> <!-- Name of a drawable factory class. --> <string name="drawable_factory_class" translatable="false"></string> <!-- Package name of the default wallpaper picker. --> <string name="wallpaper_picker_package" translatable="false"></string> Loading src/com/android/launcher3/BubbleTextView.java +3 −17 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.launcher3; import android.annotation.TargetApi; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; Loading @@ -26,9 +25,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Region; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; import android.util.SparseArray; import android.util.TypedValue; Loading @@ -42,6 +39,7 @@ import android.widget.TextView; import com.android.launcher3.IconCache.IconLoadRequest; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.graphics.DrawableFactory; import com.android.launcher3.graphics.HolographicOutlineHelper; import com.android.launcher3.model.PackageItemInfo; Loading Loading @@ -190,7 +188,7 @@ public class BubbleTextView extends TextView } private void applyIconAndLabel(Bitmap icon, ItemInfo info) { FastBitmapDrawable iconDrawable = mLauncher.createIconDrawable(icon); FastBitmapDrawable iconDrawable = DrawableFactory.get(getContext()).newIcon(icon, info); iconDrawable.setIsDisabled(info.isDisabled()); setIcon(iconDrawable); setText(info.title); Loading @@ -201,15 +199,6 @@ public class BubbleTextView extends TextView } } /** * Used for measurement only, sets some dummy values on this view. */ public void applyDummyInfo() { ColorDrawable d = new ColorDrawable(); setIcon(mLauncher.resizeIconDrawable(d)); setText(""); } /** * Overrides the default long press timeout. */ Loading Loading @@ -528,12 +517,9 @@ public class BubbleTextView extends TextView /** * Sets the icon for this view based on the layout direction. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private void setIcon(Drawable icon) { mIcon = icon; if (mIconSize != -1) { mIcon.setBounds(0, 0, mIconSize, mIconSize); } applyCompoundDrawables(mIcon); } Loading src/com/android/launcher3/FastBitmapDrawable.java +15 −4 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ public class FastBitmapDrawable extends Drawable { private static final ColorMatrix sTempBrightnessMatrix = new ColorMatrix(); private static final ColorMatrix sTempFilterMatrix = new ColorMatrix(); private final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG); protected final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG); private final Bitmap mBitmap; private State mState = State.NORMAL; private boolean mIsDisabled; Loading @@ -116,6 +116,17 @@ public class FastBitmapDrawable extends Drawable { @Override public void draw(Canvas canvas) { drawInternal(canvas); } public void drawWithBrightness(Canvas canvas, float brightness) { float oldBrightness = getBrightness(); setBrightness(brightness); drawInternal(canvas); setBrightness(oldBrightness); } protected void drawInternal(Canvas canvas) { canvas.drawBitmap(mBitmap, null, getBounds(), mPaint); } Loading Loading @@ -278,7 +289,7 @@ public class FastBitmapDrawable extends Drawable { /** * Sets the saturation of this icon, 0 [full color] -> 1 [desaturated] */ public void setDesaturation(float desaturation) { private void setDesaturation(float desaturation) { int newDesaturation = (int) Math.floor(desaturation * REDUCED_FILTER_VALUE_SPACE); if (mDesaturation != newDesaturation) { mDesaturation = newDesaturation; Loading @@ -293,7 +304,7 @@ public class FastBitmapDrawable extends Drawable { /** * Sets the brightness of this icon, 0 [no add. brightness] -> 1 [2bright2furious] */ public void setBrightness(float brightness) { private void setBrightness(float brightness) { int newBrightness = (int) Math.floor(brightness * REDUCED_FILTER_VALUE_SPACE); if (mBrightness != newBrightness) { mBrightness = newBrightness; Loading @@ -301,7 +312,7 @@ public class FastBitmapDrawable extends Drawable { } } public float getBrightness() { private float getBrightness() { return (float) mBrightness / REDUCED_FILTER_VALUE_SPACE; } Loading src/com/android/launcher3/Hotseat.java +3 −2 Original line number Diff line number Diff line Loading @@ -129,14 +129,15 @@ public class Hotseat extends FrameLayout if (!FeatureFlags.NO_ALL_APPS_ICON) { // Add the Apps button Context context = getContext(); int allAppsButtonRank = mLauncher.getDeviceProfile().inv.getAllAppsButtonRank(); DeviceProfile grid = mLauncher.getDeviceProfile(); int allAppsButtonRank = grid.inv.getAllAppsButtonRank(); LayoutInflater inflater = LayoutInflater.from(context); TextView allAppsButton = (TextView) inflater.inflate(R.layout.all_apps_button, mContent, false); Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon); d.setBounds(0, 0, grid.iconSizePx, grid.iconSizePx); mLauncher.resizeIconDrawable(d); int scaleDownPx = getResources().getDimensionPixelSize(R.dimen.all_apps_button_scale_down); Rect bounds = d.getBounds(); d.setBounds(bounds.left, bounds.top + scaleDownPx / 2, bounds.right - scaleDownPx, Loading src/com/android/launcher3/Launcher.java +0 −18 Original line number Diff line number Diff line Loading @@ -4034,24 +4034,6 @@ public class Launcher extends Activity mWorkspace.moveToDefaultScreen(false); } /** * Returns a FastBitmapDrawable with the icon, accurately sized. */ public FastBitmapDrawable createIconDrawable(Bitmap icon) { FastBitmapDrawable d = new FastBitmapDrawable(icon); d.setFilterBitmap(true); resizeIconDrawable(d); return d; } /** * Resizes an icon drawable to the correct icon size. */ public Drawable resizeIconDrawable(Drawable icon) { icon.setBounds(0, 0, mDeviceProfile.iconSizePx, mDeviceProfile.iconSizePx); return icon; } /** * Prints out out state for debugging. */ Loading Loading
res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ <!-- Name of an icon provider class. --> <string name="icon_provider_class" translatable="false"></string> <!-- Name of a drawable factory class. --> <string name="drawable_factory_class" translatable="false"></string> <!-- Package name of the default wallpaper picker. --> <string name="wallpaper_picker_package" translatable="false"></string> Loading
src/com/android/launcher3/BubbleTextView.java +3 −17 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.launcher3; import android.annotation.TargetApi; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; Loading @@ -26,9 +25,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Region; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; import android.util.SparseArray; import android.util.TypedValue; Loading @@ -42,6 +39,7 @@ import android.widget.TextView; import com.android.launcher3.IconCache.IconLoadRequest; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.graphics.DrawableFactory; import com.android.launcher3.graphics.HolographicOutlineHelper; import com.android.launcher3.model.PackageItemInfo; Loading Loading @@ -190,7 +188,7 @@ public class BubbleTextView extends TextView } private void applyIconAndLabel(Bitmap icon, ItemInfo info) { FastBitmapDrawable iconDrawable = mLauncher.createIconDrawable(icon); FastBitmapDrawable iconDrawable = DrawableFactory.get(getContext()).newIcon(icon, info); iconDrawable.setIsDisabled(info.isDisabled()); setIcon(iconDrawable); setText(info.title); Loading @@ -201,15 +199,6 @@ public class BubbleTextView extends TextView } } /** * Used for measurement only, sets some dummy values on this view. */ public void applyDummyInfo() { ColorDrawable d = new ColorDrawable(); setIcon(mLauncher.resizeIconDrawable(d)); setText(""); } /** * Overrides the default long press timeout. */ Loading Loading @@ -528,12 +517,9 @@ public class BubbleTextView extends TextView /** * Sets the icon for this view based on the layout direction. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private void setIcon(Drawable icon) { mIcon = icon; if (mIconSize != -1) { mIcon.setBounds(0, 0, mIconSize, mIconSize); } applyCompoundDrawables(mIcon); } Loading
src/com/android/launcher3/FastBitmapDrawable.java +15 −4 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ public class FastBitmapDrawable extends Drawable { private static final ColorMatrix sTempBrightnessMatrix = new ColorMatrix(); private static final ColorMatrix sTempFilterMatrix = new ColorMatrix(); private final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG); protected final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG); private final Bitmap mBitmap; private State mState = State.NORMAL; private boolean mIsDisabled; Loading @@ -116,6 +116,17 @@ public class FastBitmapDrawable extends Drawable { @Override public void draw(Canvas canvas) { drawInternal(canvas); } public void drawWithBrightness(Canvas canvas, float brightness) { float oldBrightness = getBrightness(); setBrightness(brightness); drawInternal(canvas); setBrightness(oldBrightness); } protected void drawInternal(Canvas canvas) { canvas.drawBitmap(mBitmap, null, getBounds(), mPaint); } Loading Loading @@ -278,7 +289,7 @@ public class FastBitmapDrawable extends Drawable { /** * Sets the saturation of this icon, 0 [full color] -> 1 [desaturated] */ public void setDesaturation(float desaturation) { private void setDesaturation(float desaturation) { int newDesaturation = (int) Math.floor(desaturation * REDUCED_FILTER_VALUE_SPACE); if (mDesaturation != newDesaturation) { mDesaturation = newDesaturation; Loading @@ -293,7 +304,7 @@ public class FastBitmapDrawable extends Drawable { /** * Sets the brightness of this icon, 0 [no add. brightness] -> 1 [2bright2furious] */ public void setBrightness(float brightness) { private void setBrightness(float brightness) { int newBrightness = (int) Math.floor(brightness * REDUCED_FILTER_VALUE_SPACE); if (mBrightness != newBrightness) { mBrightness = newBrightness; Loading @@ -301,7 +312,7 @@ public class FastBitmapDrawable extends Drawable { } } public float getBrightness() { private float getBrightness() { return (float) mBrightness / REDUCED_FILTER_VALUE_SPACE; } Loading
src/com/android/launcher3/Hotseat.java +3 −2 Original line number Diff line number Diff line Loading @@ -129,14 +129,15 @@ public class Hotseat extends FrameLayout if (!FeatureFlags.NO_ALL_APPS_ICON) { // Add the Apps button Context context = getContext(); int allAppsButtonRank = mLauncher.getDeviceProfile().inv.getAllAppsButtonRank(); DeviceProfile grid = mLauncher.getDeviceProfile(); int allAppsButtonRank = grid.inv.getAllAppsButtonRank(); LayoutInflater inflater = LayoutInflater.from(context); TextView allAppsButton = (TextView) inflater.inflate(R.layout.all_apps_button, mContent, false); Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon); d.setBounds(0, 0, grid.iconSizePx, grid.iconSizePx); mLauncher.resizeIconDrawable(d); int scaleDownPx = getResources().getDimensionPixelSize(R.dimen.all_apps_button_scale_down); Rect bounds = d.getBounds(); d.setBounds(bounds.left, bounds.top + scaleDownPx / 2, bounds.right - scaleDownPx, Loading
src/com/android/launcher3/Launcher.java +0 −18 Original line number Diff line number Diff line Loading @@ -4034,24 +4034,6 @@ public class Launcher extends Activity mWorkspace.moveToDefaultScreen(false); } /** * Returns a FastBitmapDrawable with the icon, accurately sized. */ public FastBitmapDrawable createIconDrawable(Bitmap icon) { FastBitmapDrawable d = new FastBitmapDrawable(icon); d.setFilterBitmap(true); resizeIconDrawable(d); return d; } /** * Resizes an icon drawable to the correct icon size. */ public Drawable resizeIconDrawable(Drawable icon) { icon.setBounds(0, 0, mDeviceProfile.iconSizePx, mDeviceProfile.iconSizePx); return icon; } /** * Prints out out state for debugging. */ Loading