From 850d2e718560cb12ae73292e9d39f21a93d3c2c1 Mon Sep 17 00:00:00 2001 From: Andrew Flynn Date: Thu, 26 Apr 2012 16:51:20 -0700 Subject: Support split status bar in launcher Change-Id: I2f6687f52e8326f80e84251e39bf6cd6dc9b2f2b --- res/values-sw600dp/dimens.xml | 19 +++++++++---------- res/values-sw720dp/dimens.xml | 1 + src/com/android/launcher2/CellLayout.java | 22 ++++++++++------------ src/com/android/launcher2/FolderIcon.java | 12 ++++++++---- src/com/android/launcher2/Hotseat.java | 2 +- 5 files changed, 29 insertions(+), 27 deletions(-) diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml index 07976323b..1b866707a 100644 --- a/res/values-sw600dp/dimens.xml +++ b/res/values-sw600dp/dimens.xml @@ -16,26 +16,25 @@ 72dp - 78 + 75 3dp 4dp -1dp -1dp - 94dip - 9dp - 9dp - 9dp - 9dp - 94dp + 82dip + 0dp + 0dp + 33dp + 33dp + 82dp - 75dp + 72dp 96dp 96dp - 0dp 96dp @@ -55,6 +54,6 @@ 32dp 0dp 0dp - 32dp + 28dp diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml index 37f62b881..04937cd90 100644 --- a/res/values-sw720dp/dimens.xml +++ b/res/values-sw720dp/dimens.xml @@ -27,6 +27,7 @@ 96dp 96dp + 75dp -1 diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 1223d1c35..6f4759d1e 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -447,6 +447,8 @@ public class CellLayout extends ViewGroup { } } + int previewOffset = FolderRingAnimator.sPreviewSize; + // The folder outer / inner ring image(s) for (int i = 0; i < mFolderOuterRings.size(); i++) { FolderRingAnimator fra = mFolderOuterRings.get(i); @@ -458,7 +460,7 @@ public class CellLayout extends ViewGroup { cellToPoint(fra.mCellX, fra.mCellY, mTempLocation); int centerX = mTempLocation[0] + mCellWidth / 2; - int centerY = mTempLocation[1] + FolderRingAnimator.sPreviewSize / 2; + int centerY = mTempLocation[1] + previewOffset / 2; canvas.save(); canvas.translate(centerX - width / 2, centerY - height / 2); @@ -473,7 +475,7 @@ public class CellLayout extends ViewGroup { cellToPoint(fra.mCellX, fra.mCellY, mTempLocation); centerX = mTempLocation[0] + mCellWidth / 2; - centerY = mTempLocation[1] + FolderRingAnimator.sPreviewSize / 2; + centerY = mTempLocation[1] + previewOffset / 2; canvas.save(); canvas.translate(centerX - width / 2, centerY - width / 2); d.setBounds(0, 0, width, height); @@ -488,7 +490,7 @@ public class CellLayout extends ViewGroup { cellToPoint(mFolderLeaveBehindCell[0], mFolderLeaveBehindCell[1], mTempLocation); int centerX = mTempLocation[0] + mCellWidth / 2; - int centerY = mTempLocation[1] + FolderRingAnimator.sPreviewSize / 2; + int centerY = mTempLocation[1] + previewOffset / 2; canvas.save(); canvas.translate(centerX - width / 2, centerY - width / 2); @@ -570,12 +572,8 @@ public class CellLayout extends ViewGroup { return mIsHotseat ? mHotseatChildScale : mChildScale; } - public boolean addViewToCellLayout( - View child, int index, int childId, LayoutParams params, boolean markCells) { - return addViewToCellLayout(child, index, childId, params, markCells, false); - } - private void scaleChild(BubbleTextView bubbleChild, float pivot, float scale) { + private void scaleChild(BubbleTextView bubbleChild, float scale) { // If we haven't measured the child yet, do it now // (this happens if we're being dropped from all-apps if (bubbleChild.getLayoutParams() instanceof LayoutParams && @@ -595,7 +593,7 @@ public class CellLayout extends ViewGroup { } public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params, - boolean markCells, boolean allApps) { + boolean markCells) { final LayoutParams lp = params; // Hotseat icons - scale down and remove text @@ -608,14 +606,14 @@ public class CellLayout extends ViewGroup { // Start the child with 100% scale and visible text resetChild(bubbleChild); - if (mIsHotseat && !allApps && mHotseatChildScale >= 0) { + if (mIsHotseat && mHotseatChildScale >= 0) { // Scale/make transparent for a hotseat - scaleChild(bubbleChild, 0f, mHotseatChildScale); + scaleChild(bubbleChild, mHotseatChildScale); bubbleChild.setTextColor(getResources().getColor(android.R.color.transparent)); } else if (mChildScale >= 0) { // Else possibly still scale it if we need to for smaller icons - scaleChild(bubbleChild, 0f, mChildScale); + scaleChild(bubbleChild, mChildScale); } } diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java index 4a713293a..d64308406 100644 --- a/src/com/android/launcher2/FolderIcon.java +++ b/src/com/android/launcher2/FolderIcon.java @@ -198,11 +198,13 @@ public class FolderIcon extends LinearLayout implements FolderListener { } mAcceptAnimator = ValueAnimator.ofFloat(0f, 1f); mAcceptAnimator.setDuration(CONSUMPTION_ANIMATION_DURATION); + + final int previewSize = sPreviewSize; mAcceptAnimator.addUpdateListener(new AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { final float percent = (Float) animation.getAnimatedValue(); - mOuterRingSize = (1 + percent * OUTER_RING_GROWTH_FACTOR) * sPreviewSize; - mInnerRingSize = (1 + percent * INNER_RING_GROWTH_FACTOR) * sPreviewSize; + mOuterRingSize = (1 + percent * OUTER_RING_GROWTH_FACTOR) * previewSize; + mInnerRingSize = (1 + percent * INNER_RING_GROWTH_FACTOR) * previewSize; if (mCellLayout != null) { mCellLayout.invalidate(); } @@ -225,11 +227,13 @@ public class FolderIcon extends LinearLayout implements FolderListener { } mNeutralAnimator = ValueAnimator.ofFloat(0f, 1f); mNeutralAnimator.setDuration(CONSUMPTION_ANIMATION_DURATION); + + final int previewSize = sPreviewSize; mNeutralAnimator.addUpdateListener(new AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { final float percent = (Float) animation.getAnimatedValue(); - mOuterRingSize = (1 + (1 - percent) * OUTER_RING_GROWTH_FACTOR) * sPreviewSize; - mInnerRingSize = (1 + (1 - percent) * INNER_RING_GROWTH_FACTOR) * sPreviewSize; + mOuterRingSize = (1 + (1 - percent) * OUTER_RING_GROWTH_FACTOR) * previewSize; + mInnerRingSize = (1 + (1 - percent) * INNER_RING_GROWTH_FACTOR) * previewSize; if (mCellLayout != null) { mCellLayout.invalidate(); } diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java index a6c9fb28a..15d606d8f 100644 --- a/src/com/android/launcher2/Hotseat.java +++ b/src/com/android/launcher2/Hotseat.java @@ -132,6 +132,6 @@ public class Hotseat extends FrameLayout { int y = getCellYFromOrder(mAllAppsButtonRank); CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1); lp.canReorder = false; - mContent.addViewToCellLayout(allAppsButton, -1, 0, lp, true, true); + mContent.addViewToCellLayout(allAppsButton, -1, 0, lp, true); } } -- cgit v1.2.3