summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2014-07-07 11:58:56 -0700
committerAdam Cohen <adamcohen@google.com>2014-07-07 15:29:53 -0700
commit96bb79819ef9ddf2d1c0cb0b72c2c9f6db26b4fd (patch)
tree91ff1045255107518b9ea6c9d08667b44ef5a8d2 /src
parente54e67f8982f42190dcc3b2ee02092f474d1f7c6 (diff)
downloadandroid_packages_apps_Trebuchet-96bb79819ef9ddf2d1c0cb0b72c2c9f6db26b4fd.tar.gz
android_packages_apps_Trebuchet-96bb79819ef9ddf2d1c0cb0b72c2c9f6db26b4fd.tar.bz2
android_packages_apps_Trebuchet-96bb79819ef9ddf2d1c0cb0b72c2c9f6db26b4fd.zip
Enabling quantum look and feel everywhere
-> _l assets become default, new folder icon look is default -> Starting to unify folder look / feel with all apps -> New page indicators Change-Id: I50b2c647fbcbe6ed27705527d8e16bd89e123d0b
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java8
-rw-r--r--src/com/android/launcher3/BubbleTextView.java40
-rw-r--r--src/com/android/launcher3/CellLayout.java5
-rw-r--r--src/com/android/launcher3/DeviceProfile.java14
-rw-r--r--src/com/android/launcher3/Folder.java9
-rw-r--r--src/com/android/launcher3/FolderIcon.java17
-rw-r--r--src/com/android/launcher3/Hotseat.java4
-rw-r--r--src/com/android/launcher3/Launcher.java13
-rw-r--r--src/com/android/launcher3/PagedViewIcon.java23
9 files changed, 44 insertions, 89 deletions
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 04426a8f1..2520b8a12 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -1007,6 +1007,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
layout.setPadding(mAllAppsPadding.left, mAllAppsPadding.top, mAllAppsPadding.right,
mAllAppsPadding.bottom);
setVisibilityOnChildren(layout, View.VISIBLE);
+
+ Resources res = getContext().getResources();
+ layout.setBackground(res.getDrawable(R.drawable.quantum_panel));
}
public void syncAppsPageItems(int page, boolean immediate) {
@@ -1437,6 +1440,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
}
+ // TODO: clean this up
+ alpha = 1;
+ translationX = 0;
+ scale = 1;
+
v.setTranslationX(translationX);
v.setScaleX(scale);
v.setScaleY(scale);
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 160a5ebcc..54d7e506e 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -17,7 +17,9 @@
package com.android.launcher3;
import android.content.Context;
+import android.content.res.ColorStateList;
import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
@@ -64,7 +66,7 @@ public class BubbleTextView extends TextView {
private float mSlop;
private int mTextColor;
- private boolean mShadowsEnabled = true;
+ private boolean mCustomShadowsEnabled = true;
private boolean mIsTextVisible;
private boolean mBackgroundSizeChanged;
@@ -72,22 +74,28 @@ public class BubbleTextView extends TextView {
private boolean mStayPressed;
private CheckLongPressHelper mLongPressHelper;
- private int mInstallState;
private CharSequence mDefaultText = "";
public BubbleTextView(Context context) {
- super(context);
- init();
+ this(context, null, 0);
}
public BubbleTextView(Context context, AttributeSet attrs) {
- super(context, attrs);
- init();
+ this(context, attrs, 0);
}
public BubbleTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+
+ Resources res = context.getResources();
+ TypedArray a = context.obtainStyledAttributes(attrs,
+ R.styleable.BubbleTextView, defStyle, 0);
+ setGlowColor(a.getColor(R.styleable.BubbleTextView_glowColor,
+ res.getColor(R.color.outline_color)));
+ mCustomShadowsEnabled = a.getBoolean(R.styleable.BubbleTextView_customShadows, true);
+ a.recycle();
+
init();
}
@@ -98,7 +106,6 @@ public class BubbleTextView extends TextView {
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
- setTextColor(getResources().getColor(R.color.workspace_icon_text_color));
}
private void init() {
@@ -106,12 +113,9 @@ public class BubbleTextView extends TextView {
mBackground = getBackground();
mOutlineHelper = HolographicOutlineHelper.obtain(getContext());
-
- final Resources res = getContext().getResources();
- mFocusedOutlineColor = mFocusedGlowColor = mPressedOutlineColor = mPressedGlowColor =
- res.getColor(R.color.outline_color);
-
- setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
+ if (mCustomShadowsEnabled) {
+ setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
+ }
}
public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache) {
@@ -322,7 +326,7 @@ public class BubbleTextView extends TextView {
@Override
public void draw(Canvas canvas) {
- if (!mShadowsEnabled) {
+ if (!mCustomShadowsEnabled) {
super.draw(canvas);
return;
}
@@ -384,10 +388,10 @@ public class BubbleTextView extends TextView {
super.setTextColor(color);
}
- public void setShadowsEnabled(boolean enabled) {
- mShadowsEnabled = enabled;
- getPaint().clearShadowLayer();
- invalidate();
+ @Override
+ public void setTextColor(ColorStateList colors) {
+ mTextColor = colors.getDefaultColor();
+ super.setTextColor(colors);
}
public void setTextVisibility(boolean visible) {
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index a0c9c2ed9..8ca8d9105 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -217,11 +217,6 @@ public class CellLayout extends ViewGroup {
mNormalBackground = res.getDrawable(R.drawable.screenpanel);
mActiveGlowBackground = res.getDrawable(R.drawable.screenpanel_hover);
- if (Utilities.isLmp()) {
- mNormalBackground = res.getDrawable(R.drawable.screenpanel_l);
- mActiveGlowBackground = res.getDrawable(R.drawable.screenpanel_hover_l);
- }
-
mOverScrollLeft = res.getDrawable(R.drawable.overscroll_glow_left);
mOverScrollRight = res.getDrawable(R.drawable.overscroll_glow_right);
mForegroundPadding =
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 8470b39a3..c0f505481 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -767,11 +767,10 @@ public class DeviceProfile {
(allAppsIconSizePx / DynamicGrid.DEFAULT_ICON_SIZE_PX)));
pageIndicator = host.findViewById(R.id.apps_customize_page_indicator);
if (pageIndicator != null) {
- lp = (FrameLayout.LayoutParams) pageIndicator.getLayoutParams();
- lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
- lp.width = LayoutParams.WRAP_CONTENT;
- lp.height = pageIndicatorHeight;
- pageIndicator.setLayoutParams(lp);
+ LinearLayout.LayoutParams lllp = (LinearLayout.LayoutParams) pageIndicator.getLayoutParams();
+ lllp.width = LayoutParams.WRAP_CONTENT;
+ lllp.height = pageIndicatorHeight;
+ pageIndicator.setLayoutParams(lllp);
}
AppsCustomizePagedView pagedView = (AppsCustomizePagedView)
@@ -796,6 +795,11 @@ public class DeviceProfile {
padding.bottom = Math.max(0, pageIndicatorHeight - paddingTB);
pagedView.setAllAppsPadding(padding);
pagedView.setWidgetsPageIndicatorPadding(pageIndicatorHeight);
+
+ // Horizontal padding for the whole paged view
+ int pagedViewPadding =
+ res.getDimensionPixelSize(R.dimen.apps_customize_horizontal_padding);
+ pagedView.setPadding(pagedViewPadding, 0, pagedViewPadding, 0);
}
}
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 2216b9eca..47c8a4a0f 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -566,8 +566,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
}
protected View createAndAddShortcut(ShortcutInfo item) {
- final BubbleTextView textView =
- (BubbleTextView) mInflater.inflate(R.layout.application, this, false);
+ final TextView textView =
+ (TextView) mInflater.inflate(R.layout.folder_application, this, false);
textView.setCompoundDrawables(null,
Utilities.createIconDrawable(item.getIcon(mIconCache)), null, null);
textView.setText(item.title);
@@ -575,11 +575,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
textView.setContentDescription(item.contentDescription);
}
textView.setTag(item);
- textView.setTextColor(getResources().getColor(R.color.folder_items_text_color));
- textView.setShadowsEnabled(false);
- textView.setGlowColor(getResources().getColor(R.color.folder_items_glow_color));
- textView.applyState();
-
textView.setOnClickListener(this);
textView.setOnLongClickListener(this);
diff --git a/src/com/android/launcher3/FolderIcon.java b/src/com/android/launcher3/FolderIcon.java
index be6cf4857..ab8976a59 100644
--- a/src/com/android/launcher3/FolderIcon.java
+++ b/src/com/android/launcher3/FolderIcon.java
@@ -71,9 +71,7 @@ public class FolderIcon extends FrameLayout implements FolderListener {
private static final float OUTER_RING_GROWTH_FACTOR = 0.3f;
// The amount of vertical spread between items in the stack [0...1]
- private static final float PERSPECTIVE_SHIFT_FACTOR = 0.24f;
-
- private static final float PERSPECTIVE_SHIFT_FACTOR_L = 0.18f;
+ private static final float PERSPECTIVE_SHIFT_FACTOR = 0.18f;
// Flag as to whether or not to draw an outer ring. Currently none is designed.
public static final boolean HAS_OUTER_RING = true;
@@ -503,16 +501,11 @@ public class FolderIcon extends FrameLayout implements FolderListener {
int adjustedAvailableSpace = (int) ((mAvailableSpaceInPreview / 2) * (1 + 0.8f));
int unscaledHeight = (int) (mIntrinsicIconSize * (1 + PERSPECTIVE_SHIFT_FACTOR));
- if (Utilities.isLmp()) {
- unscaledHeight = (int) (mIntrinsicIconSize * (1 + PERSPECTIVE_SHIFT_FACTOR_L));
- }
+
mBaselineIconScale = (1.0f * adjustedAvailableSpace / unscaledHeight);
mBaselineIconSize = (int) (mIntrinsicIconSize * mBaselineIconScale);
mMaxPerspectiveShift = mBaselineIconSize * PERSPECTIVE_SHIFT_FACTOR;
- if (Utilities.isLmp()) {
- mMaxPerspectiveShift = mBaselineIconSize * PERSPECTIVE_SHIFT_FACTOR_L;
- }
mPreviewOffsetX = (mTotalWidth - mAvailableSpaceInPreview) / 2;
mPreviewOffsetY = previewPadding + grid.folderBackgroundOffset;
@@ -563,14 +556,10 @@ public class FolderIcon extends FrameLayout implements FolderListener {
// We want to imagine our coordinates from the bottom left, growing up and to the
// right. This is natural for the x-axis, but for the y-axis, we have to invert things.
float transY = mAvailableSpaceInPreview - (offset + scaledSize + scaleOffsetCorrection) + getPaddingTop();
- float transX = offset + scaleOffsetCorrection;
+ float transX = (mAvailableSpaceInPreview - scaledSize) / 2;
float totalScale = mBaselineIconScale * scale;
final int overlayAlpha = (int) (80 * (1 - r));
- if (Utilities.isLmp()) {
- transX = (mAvailableSpaceInPreview - scaledSize) / 2;
- }
-
if (params == null) {
params = new PreviewItemDrawingParams(transX, transY, totalScale, overlayAlpha);
} else {
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index 4b2543328..2d171238f 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -151,10 +151,6 @@ public class Hotseat extends FrameLayout {
inflater.inflate(R.layout.all_apps_button, mContent, false);
Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);
- if (Utilities.isLmp()) {
- d = context.getResources().getDrawable(R.drawable.all_apps_button_icon_l);
- }
-
Utilities.resizeIconDrawable(d);
allAppsButton.setCompoundDrawables(null, d, null, null);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 93a780789..a85b5b18d 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1285,10 +1285,6 @@ public class Launcher extends Activity
}
});
widgetButton.setOnTouchListener(getHapticFeedbackTouchListener());
- if (Utilities.isLmp()) {
- ((TextView) widgetButton).setCompoundDrawablesWithIntrinsicBounds(0,
- R.drawable.widget_button_l, 0, 0);
- }
View wallpaperButton = findViewById(R.id.wallpaper_button);
wallpaperButton.setOnClickListener(new OnClickListener() {
@@ -1301,11 +1297,6 @@ public class Launcher extends Activity
});
wallpaperButton.setOnTouchListener(getHapticFeedbackTouchListener());
- if (Utilities.isLmp()) {
- ((TextView) wallpaperButton).setCompoundDrawablesWithIntrinsicBounds(0,
- R.drawable.wallpaper_button_l, 0, 0);
- }
-
View settingsButton = findViewById(R.id.settings_button);
if (hasSettings()) {
settingsButton.setOnClickListener(new OnClickListener() {
@@ -1317,10 +1308,6 @@ public class Launcher extends Activity
}
});
settingsButton.setOnTouchListener(getHapticFeedbackTouchListener());
- if (Utilities.isLmp()) {
- ((TextView) settingsButton).setCompoundDrawablesWithIntrinsicBounds(0,
- R.drawable.setting_button_l, 0, 0);
- }
} else {
settingsButton.setVisibility(View.GONE);
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) widgetButton.getLayoutParams();
diff --git a/src/com/android/launcher3/PagedViewIcon.java b/src/com/android/launcher3/PagedViewIcon.java
index 713d3a42f..e819d5edf 100644
--- a/src/com/android/launcher3/PagedViewIcon.java
+++ b/src/com/android/launcher3/PagedViewIcon.java
@@ -111,27 +111,4 @@ public class PagedViewIcon extends TextView {
setAlpha(1f);
}
}
-
- @Override
- public void draw(Canvas canvas) {
- // If text is transparent, don't draw any shadow
- if (getCurrentTextColor() == getResources().getColor(android.R.color.transparent)) {
- getPaint().clearShadowLayer();
- super.draw(canvas);
- return;
- }
-
- // We enhance the shadow by drawing the shadow twice
- getPaint().setShadowLayer(BubbleTextView.SHADOW_LARGE_RADIUS, 0.0f,
- BubbleTextView.SHADOW_Y_OFFSET, BubbleTextView.SHADOW_LARGE_COLOUR);
- super.draw(canvas);
- canvas.save(Canvas.CLIP_SAVE_FLAG);
- canvas.clipRect(getScrollX(), getScrollY() + getExtendedPaddingTop(),
- getScrollX() + getWidth(),
- getScrollY() + getHeight(), Region.Op.INTERSECT);
- getPaint().setShadowLayer(BubbleTextView.SHADOW_SMALL_RADIUS, 0.0f, 0.0f,
- BubbleTextView.SHADOW_SMALL_COLOUR);
- super.draw(canvas);
- canvas.restore();
- }
}