Merge branch 'master' into honeycomb-release

This commit is contained in:
The Android Automerger
2010-10-21 07:15:21 -07:00
18 changed files with 129 additions and 97 deletions
+8 -8
View File
@@ -15,8 +15,7 @@
-->
<com.android.launcher2.AllAppsTabbed
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
android:paddingTop="?android:attr/actionBarSize">
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
@@ -26,8 +25,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:tabStripEnabled="false"
android:paddingBottom="10dp" />
android:tabStripEnabled="false" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
@@ -37,11 +35,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
launcher:cellCountX="7"
launcher:cellCountY="4"
launcher:pageLayoutPaddingTop="10dp"
launcher:cellCountY="5"
launcher:pageLayoutWidthGap="36dp"
launcher:pageLayoutHeightGap="6dp"
launcher:pageLayoutPaddingTop="0dp"
launcher:pageLayoutPaddingBottom="15dp"
launcher:pageLayoutPaddingLeft="20dp"
launcher:pageLayoutPaddingRight="20dp">
launcher:pageLayoutPaddingLeft="40dp"
launcher:pageLayoutPaddingRight="40dp">
</com.android.launcher2.AllAppsPagedView>
</FrameLayout>
</LinearLayout>
+1 -1
View File
@@ -26,7 +26,7 @@
layout="@layout/all_apps_tabbed"
android:id="@+id/all_apps_view"
android:layout_width="match_parent"
android:layout_height="550dip"
android:layout_height="600dip"
android:layout_gravity="top"/>
<!-- The workspace contains 5 screens of cells -->
+6 -5
View File
@@ -26,8 +26,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:tabStripEnabled="false"
android:paddingBottom="10dp" />
android:tabStripEnabled="false" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
@@ -38,10 +37,12 @@
android:layout_height="match_parent"
launcher:cellCountX="5"
launcher:cellCountY="7"
launcher:pageLayoutPaddingTop="10dp"
launcher:pageLayoutWidthGap="36dp"
launcher:pageLayoutHeightGap="36dp"
launcher:pageLayoutPaddingTop="0dp"
launcher:pageLayoutPaddingBottom="10dp"
launcher:pageLayoutPaddingLeft="0dp"
launcher:pageLayoutPaddingRight="0dp">
launcher:pageLayoutPaddingLeft="20dp"
launcher:pageLayoutPaddingRight="20dp">
</com.android.launcher2.AllAppsPagedView>
</FrameLayout>
</LinearLayout>
@@ -24,5 +24,5 @@
launcher:cellCountY="4"
launcher:pageLayoutPaddingTop="15dp"
launcher:pageLayoutPaddingBottom="25dp"
launcher:pageLayoutPaddingLeft="0dp"
launcher:pageLayoutPaddingRight="0dp" />
launcher:pageLayoutPaddingLeft="15dp"
launcher:pageLayoutPaddingRight="15dp" />
+1 -1
View File
@@ -26,7 +26,7 @@
layout="@layout/all_apps_tabbed"
android:id="@+id/all_apps_view"
android:layout_width="match_parent"
android:layout_height="1000dip"
android:layout_height="1040dip"
android:layout_gravity="top"/>
<!-- The workspace contains 5 screens of cells -->
@@ -22,6 +22,7 @@
launcher:outlineColor="#FF8CD2FF"
launcher:checkedBlurColor="#FFBBE83C"
launcher:checkedOutlineColor="#FF8CD2FF"
launcher:scaledIconSize="64dp"
android:id="@+id/application_icon"
android:layout_width="match_parent"
@@ -30,7 +31,7 @@
android:paddingTop="2dip"
android:textColor="#FFFFFFFF"
android:textSize="14sp"
android:textSize="13sp"
android:shadowColor="#FF000000"
android:shadowDx="0.0"
android:shadowDy="1.0"
+2 -1
View File
@@ -23,7 +23,8 @@
<dimen name="smallScreenExtraSpacing">0dip</dimen>
<!-- vertical spacing between edge of screen and mini screen thumbnails -->
<dimen name="smallScreenVerticalMargin">60dip</dimen>
<dimen name="smallScreenVerticalMarginLandscape">30dip</dimen>
<dimen name="smallScreenVerticalMarginPortrait">60dip</dimen>
<dimen name="toolbar_padding">10dip</dimen>
+5
View File
@@ -66,6 +66,8 @@
<attr name="checkedBlurColor" format="color" />
<!-- The checked outline color of the holographic outline -->
<attr name="checkedOutlineColor" format="color" />
<!-- The scaled icon dimension -->
<attr name="scaledIconSize" format="dimension" />
</declare-styleable>
<!-- PagedViewWidgetIcon specific attributes. These attributes are used to
@@ -84,6 +86,9 @@
<attr name="cellCountX" />
<!-- The number of vertical cells in a page -->
<attr name="cellCountY" />
<!-- A spacing override for the icons within a page -->
<attr name="pageLayoutWidthGap" format="dimension" />
<attr name="pageLayoutHeightGap" format="dimension" />
<!-- The padding of the pages that are dynamically created per page -->
<attr name="pageLayoutPaddingTop" format="dimension" />
<attr name="pageLayoutPaddingBottom" format="dimension" />
@@ -358,6 +358,7 @@ public class AllAppsPagedView extends PagedView
layout.setCellCount(mCellCountX, mCellCountY);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
layout.setGap(mPageLayoutWidthGap, mPageLayoutHeightGap);
addView(layout);
}
@@ -414,7 +415,7 @@ public class AllAppsPagedView extends PagedView
final int index = i - startIndex;
final ApplicationInfo info = mFilteredApps.get(i);
PagedViewIcon icon = (PagedViewIcon) layout.getChildAt(index);
icon.applyFromApplicationInfo(info, mPageViewIconCache);
icon.applyFromApplicationInfo(info, mPageViewIconCache, true);
PagedViewCellLayout.LayoutParams params =
(PagedViewCellLayout.LayoutParams) icon.getLayoutParams();
+6 -5
View File
@@ -49,6 +49,8 @@ import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LayoutAnimationController;
import java.util.Arrays;
public class CellLayout extends ViewGroup implements Dimmable {
static final String TAG = "CellLayout";
@@ -107,6 +109,7 @@ public class CellLayout extends ViewGroup implements Dimmable {
// Used as an index into the above 3 arrays; indicates which is the most current value.
private int mDragOutlineCurrent = 0;
private final Paint mDragOutlinePaint = new Paint();
private Drawable mCrosshairsDrawable = null;
private InterruptibleInOutAnimator mCrosshairsAnimator = null;
@@ -188,7 +191,7 @@ public class CellLayout extends ViewGroup implements Dimmable {
mCrosshairsAnimator.getAnimator().addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
mCrosshairsVisibility = ((Float) animation.getAnimatedValue()).floatValue();
CellLayout.this.invalidate();
invalidate();
}
});
mCrosshairsAnimator.getAnimator().setInterpolator(mEaseOutInterpolator);
@@ -205,9 +208,7 @@ public class CellLayout extends ViewGroup implements Dimmable {
final float fromAlphaValue = 0;
final float toAlphaValue = (float)res.getInteger(R.integer.config_dragOutlineMaxAlpha);
for (int i = 0; i < mDragOutlineAlphas.length; i++) {
mDragOutlineAlphas[i] = fromAlphaValue;
}
Arrays.fill(mDragOutlineAlphas, fromAlphaValue);
for (int i = 0; i < mDragOutlineAnims.length; i++) {
final InterruptibleInOutAnimator anim =
@@ -404,7 +405,7 @@ public class CellLayout extends ViewGroup implements Dimmable {
}
}
final Paint paint = new Paint();
final Paint paint = mDragOutlinePaint;
for (int i = 0; i < mDragOutlines.length; i++) {
final float alpha = mDragOutlineAlphas[i];
if (alpha > 0) {
@@ -334,35 +334,18 @@ public class CustomizePagedView extends PagedView
}
if (enterChoiceMode) {
if (v instanceof Checkable) {
final Checkable c = (Checkable) v;
final boolean wasChecked = c.isChecked();
resetCheckedGrandchildren();
c.setChecked(!wasChecked);
final ItemInfo itemInfo = (ItemInfo) v.getTag();
// End the current choice mode when we have no items selected
/*if (!c.isChecked()) {
endChoiceMode();
} else if (isChoiceMode(CHOICE_MODE_NONE)) {
endChoiceMode();
startChoiceMode(CHOICE_MODE_SINGLE, this);
}*/
mChoiceMode = CHOICE_MODE_SINGLE;
Workspace w = mLauncher.getWorkspace();
int currentWorkspaceScreen = mLauncher.getCurrentWorkspaceScreen();
final CellLayout cl = (CellLayout)w.getChildAt(currentWorkspaceScreen);
Workspace w = mLauncher.getWorkspace();
int currentWorkspaceScreen = mLauncher.getCurrentWorkspaceScreen();
final CellLayout cl = (CellLayout)w.getChildAt(currentWorkspaceScreen);
cl.setHover(true);
animateClickFeedback(v, new Runnable() {
@Override
public void run() {
cl.setHover(false);
mLauncher.onWorkspaceClick(cl);
mChoiceMode = CHOICE_MODE_NONE;
}
});
}
animateClickFeedback(v, new Runnable() {
@Override
public void run() {
mLauncher.addExternalItemToScreen(itemInfo, cl);
}
});
return;
}
@@ -722,7 +705,7 @@ public class CustomizePagedView extends PagedView
final ApplicationInfo info = mApps.get(i);
PagedViewIcon icon = (PagedViewIcon) mInflater.inflate(
R.layout.all_apps_paged_view_application, layout, false);
icon.applyFromApplicationInfo(info, mPageViewIconCache);
icon.applyFromApplicationInfo(info, mPageViewIconCache, false);
icon.setOnClickListener(this);
icon.setOnLongClickListener(this);
@@ -23,7 +23,6 @@ import android.graphics.MaskFilter;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.TableMaskFilter;
public class HolographicOutlineHelper {
@@ -31,19 +30,24 @@ public class HolographicOutlineHelper {
private final Paint mBlurPaint = new Paint();
private final Paint mErasePaint = new Paint();
private static final BlurMaskFilter sLargeGlowBlurMaskFilter = new BlurMaskFilter(
10.0f, BlurMaskFilter.Blur.OUTER);
private static final BlurMaskFilter sThickOuterBlurMaskFilter = new BlurMaskFilter(
6.0f, BlurMaskFilter.Blur.OUTER);
private static final BlurMaskFilter sMediumOuterBlurMaskFilter = new BlurMaskFilter(
2.0f, BlurMaskFilter.Blur.OUTER);
private static final BlurMaskFilter sThinOuterBlurMaskFilter = new BlurMaskFilter(
1.0f, BlurMaskFilter.Blur.OUTER);
public static final int OUTER_BLUR_RADIUS;
private static final BlurMaskFilter sThickInnerBlurMaskFilter = new BlurMaskFilter(
4.0f, BlurMaskFilter.Blur.NORMAL);
private static final BlurMaskFilter sThinInnerBlurMaskFilter = new BlurMaskFilter(
1.0f, BlurMaskFilter.Blur.INNER);
private static final BlurMaskFilter sThickOuterBlurMaskFilter;
private static final BlurMaskFilter sMediumOuterBlurMaskFilter;
private static final BlurMaskFilter sThinOuterBlurMaskFilter;
private static final BlurMaskFilter sThickInnerBlurMaskFilter;
static {
final float scale = LauncherApplication.getScreenDensity();
OUTER_BLUR_RADIUS = (int) (scale * 6.0f);
sThickOuterBlurMaskFilter = new BlurMaskFilter(OUTER_BLUR_RADIUS,
BlurMaskFilter.Blur.OUTER);
sMediumOuterBlurMaskFilter = new BlurMaskFilter(scale * 2.0f, BlurMaskFilter.Blur.OUTER);
sThinOuterBlurMaskFilter = new BlurMaskFilter(scale * 1.0f, BlurMaskFilter.Blur.OUTER);
sThickInnerBlurMaskFilter = new BlurMaskFilter(scale * 4.0f, BlurMaskFilter.Blur.NORMAL);
}
private static final MaskFilter sFineClipTable = TableMaskFilter.CreateClipTable(0, 20);
private static final MaskFilter sCoarseClipTable = TableMaskFilter.CreateClipTable(0, 200);
@@ -81,7 +85,12 @@ public class HolographicOutlineHelper {
}
}
void applyGlow(Bitmap bitmap, Canvas canvas, int color) {
/**
* Apply an outer blur to the given bitmap.
* You should use OUTER_BLUR_RADIUS to ensure that the bitmap is big enough to draw
* the blur without clipping.
*/
void applyOuterBlur(Bitmap bitmap, Canvas canvas, int color) {
mBlurPaint.setMaskFilter(sThickOuterBlurMaskFilter);
Bitmap glow = bitmap.extractAlpha(mBlurPaint, mTempOffset);
+6 -16
View File
@@ -2669,24 +2669,14 @@ public final class Launcher extends Activity
}
}
void onWorkspaceClick(CellLayout layout) {
Object itemInfo = mAllAppsPagedView.getChosenItem();
if (itemInfo == null) {
itemInfo = mCustomizePagedView.getChosenItem();
void addExternalItemToScreen(ItemInfo itemInfo, CellLayout layout) {
if (!mWorkspace.addExternalItemToScreen(itemInfo, layout)) {
showOutOfSpaceMessage();
}
}
if (itemInfo == null) {
// No items are chosen in All Apps or Customize, so just zoom into the workspace
showWorkspace(true, layout);
} else {
// Act as if the chosen item was dropped on the given CellLayout
if (mWorkspace.addExternalItemToScreen(itemInfo, layout)) {
mAllAppsPagedView.endChoiceMode();
mCustomizePagedView.endChoiceMode();
} else {
showOutOfSpaceMessage();
}
}
void onWorkspaceClick(CellLayout layout) {
showWorkspace(true, layout);
}
private void updateButtonWithIconFromExternalActivity(
@@ -29,6 +29,7 @@ public class LauncherApplication extends Application {
public LauncherModel mModel;
public IconCache mIconCache;
private static boolean sIsScreenXLarge;
private static float sScreenDensity;
private static final boolean ENABLE_ROTATION = false;
@Override
@@ -40,6 +41,7 @@ public class LauncherApplication extends Application {
mIconCache = new IconCache(this);
mModel = new LauncherModel(this, mIconCache);
sIsScreenXLarge = (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
sScreenDensity = getResources().getDisplayMetrics().density;
// Register intent receivers
IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
@@ -101,4 +103,8 @@ public class LauncherApplication extends Application {
public static boolean isScreenXLarge() {
return sIsScreenXLarge;
}
public static float getScreenDensity() {
return sScreenDensity;
}
}
+7 -1
View File
@@ -96,6 +96,8 @@ public abstract class PagedView extends ViewGroup {
protected int mPageLayoutPaddingBottom;
protected int mPageLayoutPaddingLeft;
protected int mPageLayoutPaddingRight;
protected int mPageLayoutWidthGap;
protected int mPageLayoutHeightGap;
protected int mCellCountX;
protected int mCellCountY;
@@ -184,6 +186,10 @@ public abstract class PagedView extends ViewGroup {
R.styleable.PagedView_pageLayoutPaddingLeft, 10);
mPageLayoutPaddingRight = a.getDimensionPixelSize(
R.styleable.PagedView_pageLayoutPaddingRight, 10);
mPageLayoutWidthGap = a.getDimensionPixelSize(
R.styleable.PagedView_pageLayoutWidthGap, -1);
mPageLayoutHeightGap = a.getDimensionPixelSize(
R.styleable.PagedView_pageLayoutHeightGap, -1);
a.recycle();
setHapticFeedbackEnabled(false);
@@ -649,7 +655,7 @@ public abstract class PagedView extends ViewGroup {
* otherwise don't. mScroller.isFinished should be false when
* being flinged.
*/
final int xDist = (mScroller.getFinalX() - mScroller.getCurrX());
final int xDist = Math.abs(mScroller.getFinalX() - mScroller.getCurrX());
final boolean finishedScrolling = (mScroller.isFinished() || xDist < mTouchSlop);
if (finishedScrolling) {
mTouchState = TOUCH_STATE_REST;
@@ -46,6 +46,8 @@ public class PagedViewCellLayout extends ViewGroup {
private int mCellCountY;
private int mCellWidth;
private int mCellHeight;
private int mWidthGap;
private int mHeightGap;
private static int sDefaultCellDimensions = 96;
public PagedViewCellLayout(Context context) {
@@ -66,6 +68,7 @@ public class PagedViewCellLayout extends ViewGroup {
mCellCountX = LauncherModel.getCellCountX();
mCellCountY = LauncherModel.getCellCountY();
mHolographicAlpha = 0.0f;
mWidthGap = mHeightGap = -1;
}
@Override
@@ -168,12 +171,17 @@ public class PagedViewCellLayout extends ViewGroup {
paddingLeft += ((widthGap - minGap) * (mCellCountX - 1)) / 2;
}
*/
widthGap = heightGap = minGap;
if (mWidthGap > -1 && mHeightGap > -1) {
widthGap = mWidthGap;
heightGap = mHeightGap;
} else {
widthGap = heightGap = minGap;
}
int newWidth = mPaddingLeft + mPaddingRight + (mCellCountX * cellWidth) +
((mCellCountX - 1) * minGap);
((mCellCountX - 1) * widthGap);
int newHeight = mPaddingTop + mPaddingBottom + (mCellCountY * cellHeight) +
((mCellCountY - 1) * minGap);
((mCellCountY - 1) * heightGap);
final int count = getChildCount();
for (int i = 0; i < count; i++) {
@@ -252,6 +260,11 @@ public class PagedViewCellLayout extends ViewGroup {
requestLayout();
}
public void setGap(int widthGap, int heightGap) {
mWidthGap = widthGap;
mHeightGap = heightGap;
}
public void setCellDimensions(int width, int height) {
mCellWidth = width;
mCellHeight = height;
+12 -2
View File
@@ -54,6 +54,7 @@ public class PagedViewIcon extends TextView implements Checkable {
private Object mIconCacheKey;
private PagedViewIconCache mIconCache;
private int mScaledIconSize;
private int mAlpha;
private int mHolographicAlpha;
@@ -82,6 +83,7 @@ public class PagedViewIcon extends TextView implements Checkable {
mHoloOutlineColor = a.getColor(R.styleable.PagedViewIcon_outlineColor, 0);
mCheckedBlurColor = a.getColor(R.styleable.PagedViewIcon_checkedBlurColor, 0);
mCheckedOutlineColor = a.getColor(R.styleable.PagedViewIcon_checkedOutlineColor, 0);
mScaledIconSize = a.getDimensionPixelSize(R.styleable.PagedViewIcon_scaledIconSize, 64);
a.recycle();
if (sHolographicOutlineHelper == null) {
@@ -93,13 +95,21 @@ public class PagedViewIcon extends TextView implements Checkable {
setBackgroundDrawable(null);
}
public void applyFromApplicationInfo(ApplicationInfo info, PagedViewIconCache cache) {
public void applyFromApplicationInfo(ApplicationInfo info, PagedViewIconCache cache,
boolean scaleUp) {
mIconCache = cache;
mIconCacheKey = info;
mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
Bitmap icon;
if (scaleUp) {
icon = Bitmap.createScaledBitmap(info.iconBitmap, mScaledIconSize,
mScaledIconSize, true);
} else {
icon = info.iconBitmap;
}
setCompoundDrawablesWithIntrinsicBounds(null,
new FastBitmapDrawable(info.iconBitmap), null, null);
new FastBitmapDrawable(icon), null, null);
setText(info.title);
setTag(info);
}
+13 -8
View File
@@ -139,10 +139,10 @@ public class Workspace extends SmoothPagedView
private boolean mInScrollArea = false;
private HolographicOutlineHelper mOutlineHelper = new HolographicOutlineHelper();
private final HolographicOutlineHelper mOutlineHelper = new HolographicOutlineHelper();
private Bitmap mDragOutline = null;
private Rect mTempRect = new Rect();
private int[] mTempXY = new int[2];
private final Rect mTempRect = new Rect();
private final int[] mTempXY = new int[2];
/**
* Used to inflate the Workspace from XML.
@@ -715,7 +715,10 @@ public class Workspace extends SmoothPagedView
final int screenCount = getChildCount();
float totalWidth = screenCount * scaledPageWidth + (screenCount - 1) * extraScaledSpacing;
float newY = getResources().getDimension(R.dimen.smallScreenVerticalMargin);
boolean isPortrait = getMeasuredHeight() > getMeasuredWidth();
float newY = (isPortrait ?
getResources().getDimension(R.dimen.smallScreenVerticalMarginPortrait) :
getResources().getDimension(R.dimen.smallScreenVerticalMarginLandscape));
float finalAlpha = 1.0f;
float extraShrinkFactor = 1.0f;
if (shrinkPosition == ShrinkPosition.SHRINK_TO_BOTTOM_VISIBLE) {
@@ -991,14 +994,13 @@ public class Workspace extends SmoothPagedView
canvas.setBitmap(b);
canvas.drawBitmap(mDragOutline, 0, 0, null);
drawDragView(v, canvas, padding);
mOutlineHelper.applyGlow(b, canvas, outlineColor);
mOutlineHelper.applyOuterBlur(b, canvas, outlineColor);
return b;
}
void startDrag(CellLayout.CellInfo cellInfo) {
View child = cellInfo.cell;
final int blurPadding = 40;
// Make sure the drag was started by a long press as opposed to a long click.
if (!child.isInTouchMode()) {
@@ -1017,11 +1019,14 @@ public class Workspace extends SmoothPagedView
final Canvas canvas = new Canvas();
// We need to add extra padding to the bitmap to make room for the glow effect
final int bitmapPadding = HolographicOutlineHelper.OUTER_BLUR_RADIUS;
// The outline is used to visualize where the item will land if dropped
mDragOutline = createDragOutline(child, canvas, blurPadding);
mDragOutline = createDragOutline(child, canvas, bitmapPadding);
// The drag bitmap follows the touch point around on the screen
final Bitmap b = createDragBitmap(child, canvas, blurPadding);
final Bitmap b = createDragBitmap(child, canvas, bitmapPadding);
final int bmpWidth = b.getWidth();
final int bmpHeight = b.getHeight();