diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-02-17 10:39:44 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-02-17 11:37:30 -0800 |
commit | 9b29ca5add472b6bdebfa7936142b3aad6cbe3c5 (patch) | |
tree | cbdd86330d225c9300ac2d745e5acd82f68aca01 /src/com | |
parent | 519fbdb2b3c58820bb458fda52044e4c8abef596 (diff) | |
download | android_packages_apps_Trebuchet-9b29ca5add472b6bdebfa7936142b3aad6cbe3c5.tar.gz android_packages_apps_Trebuchet-9b29ca5add472b6bdebfa7936142b3aad6cbe3c5.tar.bz2 android_packages_apps_Trebuchet-9b29ca5add472b6bdebfa7936142b3aad6cbe3c5.zip |
Defining HomeScreenElementTheme for elements which appear on top of
wallpaper
> Using HomeScreenElementTheme for workspace items
> Fixing view inflation where wrong layout inflater was being used
Change-Id: I92e278dbfb609ad7af9c2f47351f23f03cf12049
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher3/CellLayout.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 5 | ||||
-rw-r--r-- | src/com/android/launcher3/PagedView.java | 8 | ||||
-rw-r--r-- | src/com/android/launcher3/WidgetPreviewLoader.java | 9 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 9 | ||||
-rw-r--r-- | src/com/android/launcher3/folder/FolderIcon.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/folder/FolderPagedView.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher3/pageindicators/CaretDrawable.java | 2 |
8 files changed, 21 insertions, 22 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index e0fcbf04d..cac6c065a 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -57,6 +57,7 @@ import com.android.launcher3.graphics.DragPreviewProvider; import com.android.launcher3.util.CellAndSpan; import com.android.launcher3.util.GridOccupancy; import com.android.launcher3.util.ParcelableSparseArray; +import com.android.launcher3.util.Themes; import com.android.launcher3.util.Thunk; import java.lang.annotation.Retention; @@ -236,7 +237,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { for (int i = 0; i < mDragOutlines.length; i++) { mDragOutlines[i] = new Rect(-1, -1, -1, -1); } - mDragOutlinePaint.setColor(getResources().getColor(R.color.outline_color)); + mDragOutlinePaint.setColor(Themes.getAttrColor(context, android.R.attr.textColorPrimary)); // When dragging things around the home screens, we show a green outline of // where the item will land. The outlines gradually fade out, leaving a trail diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 14b9c8290..c5cefa678 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -65,6 +65,7 @@ import android.view.HapticFeedbackConstants; import android.view.KeyEvent; import android.view.KeyboardShortcutGroup; import android.view.KeyboardShortcutInfo; +import android.view.LayoutInflater; import android.view.Menu; import android.view.MotionEvent; import android.view.View; @@ -1432,8 +1433,8 @@ public class Launcher extends BaseActivity * @return A View inflated from layoutResId. */ public View createShortcut(ViewGroup parent, ShortcutInfo info) { - BubbleTextView favorite = (BubbleTextView) getLayoutInflater().inflate(R.layout.app_icon, - parent, false); + BubbleTextView favorite = (BubbleTextView) LayoutInflater.from(parent.getContext()) + .inflate(R.layout.app_icon, parent, false); favorite.applyFromShortcutInfo(info); favorite.setCompoundDrawablePadding(mDeviceProfile.iconDrawablePaddingPx); favorite.setOnClickListener(this); diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index fb6a611e7..31e3dda32 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -50,6 +50,7 @@ import android.view.animation.Interpolator; import com.android.launcher3.anim.PropertyListBuilder; import com.android.launcher3.pageindicators.PageIndicator; import com.android.launcher3.util.LauncherEdgeEffect; +import com.android.launcher3.util.Themes; import com.android.launcher3.util.Thunk; import java.util.ArrayList; @@ -226,11 +227,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * density); setOnHierarchyChangeListener(this); setWillNotDraw(false); - } - protected void setEdgeGlowColor(int color) { - mEdgeGlowLeft.setColor(color); - mEdgeGlowRight.setColor(color); + int edgeEffectColor = Themes.getAttrColor(getContext(), android.R.attr.colorEdgeEffect); + mEdgeGlowLeft.setColor(edgeEffectColor); + mEdgeGlowRight.setColor(edgeEffectColor); } protected void setDefaultInterpolator(Interpolator interpolator) { diff --git a/src/com/android/launcher3/WidgetPreviewLoader.java b/src/com/android/launcher3/WidgetPreviewLoader.java index 689cc9b3e..6dc65d9a5 100644 --- a/src/com/android/launcher3/WidgetPreviewLoader.java +++ b/src/com/android/launcher3/WidgetPreviewLoader.java @@ -416,19 +416,20 @@ public class WidgetPreviewLoader { float shadowBlur = res.getDimension(R.dimen.widget_preview_shadow_blur); float keyShadowDistance = res.getDimension(R.dimen.widget_preview_key_shadow_distance); float corner = res.getDimension(R.dimen.widget_preview_corner_radius); + int shadowColor = ColorUtils.setAlphaComponent( + res.getColor(R.color.default_shadow_color_no_alpha), + ShadowGenerator.AMBIENT_SHADOW_ALPHA); RectF bounds = new RectF(shadowBlur, shadowBlur, width - shadowBlur, height - shadowBlur - keyShadowDistance); p.setColor(Color.WHITE); // Key shadow - p.setShadowLayer(shadowBlur, 0, keyShadowDistance, - ShadowGenerator.KEY_SHADOW_ALPHA << 24); + p.setShadowLayer(shadowBlur, 0, keyShadowDistance, shadowColor); c.drawRoundRect(bounds, corner, corner, p); // Ambient shadow - p.setShadowLayer(shadowBlur, 0, 0, - ColorUtils.setAlphaComponent(Color.BLACK, ShadowGenerator.AMBIENT_SHADOW_ALPHA)); + p.setShadowLayer(shadowBlur, 0, 0, shadowColor); c.drawRoundRect(bounds, corner, corner, p); p.clearShadowLayer(); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 56aa69e5c..6d52ea3da 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -43,6 +43,7 @@ import android.util.AttributeSet; import android.util.Log; import android.util.Property; import android.util.SparseArray; +import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewDebug; @@ -528,8 +529,6 @@ public class Workspace extends PagedView // Set the wallpaper dimensions when Launcher starts up setWallpaperDimension(); - - setEdgeGlowColor(getResources().getColor(R.color.workspace_edge_effect_color)); } @Override @@ -622,7 +621,7 @@ public class Workspace extends PagedView if (qsb == null) { // In transposed layout, we add the QSB in the Grid. As workspace does not touch the // edges, we do not need a full width QSB. - qsb = mLauncher.getLayoutInflater().inflate( + qsb = LayoutInflater.from(getContext()).inflate( mLauncher.getDeviceProfile().isVerticalBarLayout() ? R.layout.qsb_container : R.layout.qsb_blocker_view, firstPage, false); @@ -707,7 +706,7 @@ public class Workspace extends PagedView // Inflate the cell layout, but do not add it automatically so that we can get the newly // created CellLayout. - CellLayout newScreen = (CellLayout) mLauncher.getLayoutInflater().inflate( + CellLayout newScreen = (CellLayout) LayoutInflater.from(getContext()).inflate( R.layout.workspace_screen, this, false /* attachToRoot */); newScreen.setOnLongClickListener(mLongClickListener); newScreen.setOnClickListener(mLauncher); @@ -725,7 +724,7 @@ public class Workspace extends PagedView public void createCustomContentContainer() { CellLayout customScreen = (CellLayout) - mLauncher.getLayoutInflater().inflate(R.layout.workspace_screen, this, false); + LayoutInflater.from(getContext()).inflate(R.layout.workspace_screen, this, false); customScreen.disableDragTarget(); customScreen.disableJailContent(); diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java index 96d56759d..604540022 100644 --- a/src/com/android/launcher3/folder/FolderIcon.java +++ b/src/com/android/launcher3/folder/FolderIcon.java @@ -177,7 +177,8 @@ public class FolderIcon extends FrameLayout implements FolderListener { } DeviceProfile grid = launcher.getDeviceProfile(); - FolderIcon icon = (FolderIcon) LayoutInflater.from(launcher).inflate(resId, group, false); + FolderIcon icon = (FolderIcon) LayoutInflater.from(group.getContext()) + .inflate(resId, group, false); // For performance and compatibility reasons we render the preview using a software layer. // In particular, hardware path clipping has spotty ecosystem support and bad performance. diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java index eecce183a..532e5a6c7 100644 --- a/src/com/android/launcher3/folder/FolderPagedView.java +++ b/src/com/android/launcher3/folder/FolderPagedView.java @@ -35,17 +35,14 @@ import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherModel; import com.android.launcher3.PagedView; import com.android.launcher3.R; import com.android.launcher3.ShortcutAndWidgetContainer; import com.android.launcher3.ShortcutInfo; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace.ItemOperator; -import com.android.launcher3.dragndrop.DragController; import com.android.launcher3.keyboard.ViewGroupFocusHelper; import com.android.launcher3.pageindicators.PageIndicator; -import com.android.launcher3.util.Themes; import com.android.launcher3.util.Thunk; import java.util.ArrayList; @@ -108,7 +105,6 @@ public class FolderPagedView extends PagedView { mIsRtl = Utilities.isRtl(getResources()); setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES); - setEdgeGlowColor(Themes.getAttrColor(context, android.R.attr.colorEdgeEffect)); mFocusIndicatorHelper = new ViewGroupFocusHelper(this); } diff --git a/src/com/android/launcher3/pageindicators/CaretDrawable.java b/src/com/android/launcher3/pageindicators/CaretDrawable.java index 0a00e24e9..32e57a9f6 100644 --- a/src/com/android/launcher3/pageindicators/CaretDrawable.java +++ b/src/com/android/launcher3/pageindicators/CaretDrawable.java @@ -46,7 +46,7 @@ public class CaretDrawable extends Drawable { final int strokeWidth = res.getDimensionPixelSize(R.dimen.all_apps_caret_stroke_width); final int shadowSpread = res.getDimensionPixelSize(R.dimen.all_apps_caret_shadow_spread); - mCaretPaint.setColor(res.getColor(R.color.workspace_icon_text_color)); + mCaretPaint.setColor(Themes.getAttrColor(context, android.R.attr.textColorPrimary)); mCaretPaint.setAntiAlias(true); mCaretPaint.setStrokeWidth(strokeWidth); mCaretPaint.setStyle(Paint.Style.STROKE); |