summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-03-13 18:58:03 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-03-13 18:58:03 +0000
commit4eaacc7485b85ec964c0ff384dda781f7f17ec74 (patch)
tree2a76c577d5caca7127c07d46ccf6743f8c1b56b6 /src
parent02a7624fc3e64aa1bd47bc06e4d9c434b8659402 (diff)
parent9b29ca5add472b6bdebfa7936142b3aad6cbe3c5 (diff)
downloadpackages_apps_Trebuchet-4eaacc7485b85ec964c0ff384dda781f7f17ec74.tar.gz
packages_apps_Trebuchet-4eaacc7485b85ec964c0ff384dda781f7f17ec74.tar.bz2
packages_apps_Trebuchet-4eaacc7485b85ec964c0ff384dda781f7f17ec74.zip
Merge "Defining HomeScreenElementTheme for elements which appear on top of wallpaper" into ub-launcher3-master
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/CellLayout.java3
-rw-r--r--src/com/android/launcher3/Launcher.java5
-rw-r--r--src/com/android/launcher3/PagedView.java8
-rw-r--r--src/com/android/launcher3/WidgetPreviewLoader.java9
-rw-r--r--src/com/android/launcher3/Workspace.java9
-rw-r--r--src/com/android/launcher3/folder/FolderIcon.java3
-rw-r--r--src/com/android/launcher3/folder/FolderPagedView.java3
-rw-r--r--src/com/android/launcher3/pageindicators/CaretDrawable.java2
8 files changed, 21 insertions, 21 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 70137aa7c..c0946a0e3 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;
@@ -235,7 +236,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 0a0859758..a69f501d7 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;
@@ -1421,8 +1422,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 862ed25f9..8f8d32ccc 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;
@@ -527,8 +528,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
@@ -621,7 +620,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 9395572bf..ced9c9e8d 100644
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -180,7 +180,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);
icon.setClipToPadding(false);
icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_icon_name);
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index bc78324e7..2a6007a4e 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -35,7 +35,6 @@ 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;
@@ -44,7 +43,6 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace.ItemOperator;
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;
@@ -107,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);