merge in ics-release history after reset to master
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 63d7b3b..0f4a3ba 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -242,5 +242,6 @@
<string name="folder_cling_create_folder">To make a new folder on your home screen, stack one app on top of another.</string>
<!-- The text on the button to dismiss a cling [CHAR_LIMIT=none] -->
<string name="cling_dismiss">OK</string>
+ <add-resource type="string" name="default_folder_name" />
</resources>
diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java
index 4762193..b7943ec 100644
--- a/src/com/android/launcher2/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher2/AppWidgetResizeFrame.java
@@ -111,11 +111,11 @@
Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
addView(mBottomHandle, lp);
- Resources r = context.getResources();
- mWidgetPaddingLeft = r.getDimensionPixelSize(R.dimen.app_widget_padding_left);
- mWidgetPaddingTop = r.getDimensionPixelSize(R.dimen.app_widget_padding_top);
- mWidgetPaddingRight = r.getDimensionPixelSize(R.dimen.app_widget_padding_right);
- mWidgetPaddingBottom = r.getDimensionPixelSize(R.dimen.app_widget_padding_bottom);
+ Launcher.Padding p = mLauncher.getPaddingForWidget(widgetView.getAppWidgetInfo().provider);
+ mWidgetPaddingLeft = p.left;
+ mWidgetPaddingTop = p.top;
+ mWidgetPaddingRight = p.right;
+ mWidgetPaddingBottom = p.bottom;
if (mResizeMode == AppWidgetProviderInfo.RESIZE_HORIZONTAL) {
mTopHandle.setVisibility(GONE);
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 560c3c7..ca4d614 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -711,9 +711,11 @@
layout.createHardwareLayers();
+ /* TEMPORARILY DISABLE HOLOGRAPHIC ICONS
if (mFadeInAdjacentScreens) {
prepareGenerateHoloOutlinesTask(page, items, images);
}
+ */
}
/**
@@ -1020,11 +1022,57 @@
int cellHeight = ((contentHeight - mPageLayoutPaddingTop - mPageLayoutPaddingBottom
- ((mWidgetCountY - 1) * mWidgetHeightGap)) / mWidgetCountY);
+ // Prepare the set of widgets to load previews for in the background
int offset = page * numItemsPerPage;
for (int i = offset; i < Math.min(offset + numItemsPerPage, mWidgets.size()); ++i) {
items.add(mWidgets.get(i));
}
+ // Prepopulate the pages with the other widget info, and fill in the previews later
+ PagedViewGridLayout layout = (PagedViewGridLayout) getPageAt(page);
+ layout.setColumnCount(layout.getCellCountX());
+ for (int i = 0; i < items.size(); ++i) {
+ Object rawInfo = items.get(i);
+ PendingAddItemInfo createItemInfo = null;
+ PagedViewWidget widget = (PagedViewWidget) mLayoutInflater.inflate(
+ R.layout.apps_customize_widget, layout, false);
+ if (rawInfo instanceof AppWidgetProviderInfo) {
+ // Fill in the widget information
+ AppWidgetProviderInfo info = (AppWidgetProviderInfo) rawInfo;
+ createItemInfo = new PendingAddWidgetInfo(info, null, null);
+ int[] cellSpans = mLauncher.getSpanForWidget(info, null);
+ widget.applyFromAppWidgetProviderInfo(info, -1, cellSpans,
+ mHolographicOutlineHelper);
+ widget.setTag(createItemInfo);
+ } else if (rawInfo instanceof ResolveInfo) {
+ // Fill in the shortcuts information
+ ResolveInfo info = (ResolveInfo) rawInfo;
+ createItemInfo = new PendingAddItemInfo();
+ createItemInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
+ createItemInfo.componentName = new ComponentName(info.activityInfo.packageName,
+ info.activityInfo.name);
+ widget.applyFromResolveInfo(mPackageManager, info, mHolographicOutlineHelper);
+ widget.setTag(createItemInfo);
+ }
+ widget.setOnClickListener(this);
+ widget.setOnLongClickListener(this);
+ widget.setOnTouchListener(this);
+
+ // Layout each widget
+ int ix = i % mWidgetCountX;
+ int iy = i / mWidgetCountX;
+ GridLayout.LayoutParams lp = new GridLayout.LayoutParams(
+ GridLayout.spec(iy, GridLayout.LEFT),
+ GridLayout.spec(ix, GridLayout.TOP));
+ lp.width = cellWidth;
+ lp.height = cellHeight;
+ lp.setGravity(Gravity.TOP | Gravity.LEFT);
+ if (ix > 0) lp.leftMargin = mWidgetWidthGap;
+ if (iy > 0) lp.topMargin = mWidgetHeightGap;
+ layout.addView(widget, lp);
+ }
+
+ // Load the widget previews
if (immediate) {
AsyncTaskPageData data = new AsyncTaskPageData(page, items, cellWidth, cellHeight,
mWidgetCountX, null, null);
@@ -1033,7 +1081,6 @@
} else {
prepareLoadWidgetPreviewsTask(page, items, cellWidth, cellHeight, mWidgetCountX);
}
- PagedViewGridLayout layout = (PagedViewGridLayout) getPageAt(page);
}
private void loadWidgetPreviewsInBackground(AppsCustomizeAsyncTask task,
AsyncTaskPageData data) {
@@ -1073,65 +1120,25 @@
private void onSyncWidgetPageItems(AsyncTaskPageData data) {
int page = data.page;
PagedViewGridLayout layout = (PagedViewGridLayout) getPageAt(page);
- // Only set the column count once we have items
- layout.setColumnCount(layout.getCellCountX());
ArrayList<Object> items = data.items;
int count = items.size();
- int cellWidth = data.cellWidth;
- int cellHeight = data.cellHeight;
- int cellCountX = data.cellCountX;
for (int i = 0; i < count; ++i) {
- Object rawInfo = items.get(i);
- PendingAddItemInfo createItemInfo = null;
- PagedViewWidget widget = (PagedViewWidget) mLayoutInflater.inflate(
- R.layout.apps_customize_widget, layout, false);
- if (rawInfo instanceof AppWidgetProviderInfo) {
- // Fill in the widget information
- AppWidgetProviderInfo info = (AppWidgetProviderInfo) rawInfo;
- createItemInfo = new PendingAddWidgetInfo(info, null, null);
- int[] cellSpans = mLauncher.getSpanForWidget(info, null);
- FastBitmapDrawable preview = new FastBitmapDrawable(data.generatedImages.get(i));
- widget.applyFromAppWidgetProviderInfo(info, preview, -1, cellSpans,
- mHolographicOutlineHelper);
- widget.setTag(createItemInfo);
- } else if (rawInfo instanceof ResolveInfo) {
- // Fill in the shortcuts information
- ResolveInfo info = (ResolveInfo) rawInfo;
- createItemInfo = new PendingAddItemInfo();
- createItemInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
- createItemInfo.componentName = new ComponentName(info.activityInfo.packageName,
- info.activityInfo.name);
- FastBitmapDrawable preview = new FastBitmapDrawable(data.generatedImages.get(i));
- widget.applyFromResolveInfo(mPackageManager, info, preview,
- mHolographicOutlineHelper);
- widget.setTag(createItemInfo);
+ PagedViewWidget widget = (PagedViewWidget) layout.getChildAt(i);
+ if (widget != null) {
+ widget.applyPreview(new FastBitmapDrawable(data.generatedImages.get(i)), i);
}
- widget.setOnClickListener(this);
- widget.setOnLongClickListener(this);
- widget.setOnTouchListener(this);
-
- // Layout each widget
- int ix = i % cellCountX;
- int iy = i / cellCountX;
- GridLayout.LayoutParams lp = new GridLayout.LayoutParams(
- GridLayout.spec(iy, GridLayout.LEFT),
- GridLayout.spec(ix, GridLayout.TOP));
- lp.width = cellWidth;
- lp.height = cellHeight;
- lp.setGravity(Gravity.TOP | Gravity.LEFT);
- if (ix > 0) lp.leftMargin = mWidgetWidthGap;
- if (iy > 0) lp.topMargin = mWidgetHeightGap;
- layout.addView(widget, lp);
}
layout.createHardwareLayer();
invalidate();
forceUpdateAdjacentPagesAlpha();
+ /* TEMPORARILY DISABLE HOLOGRAPHIC ICONS
if (mFadeInAdjacentScreens) {
prepareGenerateHoloOutlinesTask(data.page, data.items, data.generatedImages);
}
+ */
}
private void onHolographicPageItemsLoaded(AsyncTaskPageData data) {
// Invalidate early to short-circuit children invalidates
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index 79e27b0..cdc89ba 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -256,6 +256,11 @@
}
}
+ void clearPressedOrFocusedBackground() {
+ mPressedOrFocusedBackground = null;
+ setCellLayoutPressedOrFocusedIcon();
+ }
+
Bitmap getPressedOrFocusedBackground() {
return mPressedOrFocusedBackground;
}
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 1b863de..8a198f8 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -53,7 +53,8 @@
* Represents a set of icons chosen by the user or generated by the system.
*/
public class Folder extends LinearLayout implements DragSource, View.OnClickListener,
- View.OnLongClickListener, DropTarget, FolderListener, TextView.OnEditorActionListener {
+ View.OnLongClickListener, DropTarget, FolderListener, TextView.OnEditorActionListener,
+ View.OnFocusChangeListener {
private static final String TAG = "Launcher.Folder";
@@ -148,6 +149,7 @@
mContent.setGridSize(0, 0);
mFolderName = (FolderEditText) findViewById(R.id.folder_name);
mFolderName.setFolder(this);
+ mFolderName.setOnFocusChangeListener(this);
// We find out how tall the text view wants to be (it is set to wrap_content), so that
// we can allocate the appropriate amount of space for it.
@@ -193,16 +195,6 @@
}
}
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (ev.getAction() == MotionEvent.ACTION_DOWN) {
- mFolderName.getHitRect(mHitRect);
- if (mHitRect.contains((int) ev.getX(), (int) ev.getY()) && !mIsEditingName) {
- startEditingFolderName();
- }
- }
- return false;
- }
-
public boolean onLongClick(View v) {
Object tag = v.getTag();
if (tag instanceof ShortcutInfo) {
@@ -1024,4 +1016,10 @@
public void getLocationInDragLayer(int[] loc) {
mLauncher.getDragLayer().getLocationInDragLayer(this, loc);
}
+
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (v == mFolderName && hasFocus) {
+ startEditingFolderName();
+ }
+ }
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 02fccc5..83bce6d 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -75,9 +75,9 @@
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
-import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
+import android.view.View.OnLongClickListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
@@ -876,10 +876,16 @@
if (appInfo.targetSdkVersion >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
Resources r = getResources();
- p.left = r.getDimensionPixelSize(R.dimen.app_widget_padding_left);
- p.right = r.getDimensionPixelSize(R.dimen.app_widget_padding_right);
- p.top = r.getDimensionPixelSize(R.dimen.app_widget_padding_top);
- p.bottom = r.getDimensionPixelSize(R.dimen.app_widget_padding_bottom);
+ // The default padding values are private API currently, but will be added in
+ // API level 15. The current values are (8, 8, 8, 8).
+ p.left = r.getDimensionPixelSize(com.android.internal.
+ R.dimen.default_app_widget_padding_left);
+ p.right = r.getDimensionPixelSize(com.android.internal.
+ R.dimen.default_app_widget_padding_right);
+ p.top = r.getDimensionPixelSize(com.android.internal.
+ R.dimen.default_app_widget_padding_top);
+ p.bottom = r.getDimensionPixelSize(com.android.internal.
+ R.dimen.default_app_widget_padding_bottom);
}
return p;
diff --git a/src/com/android/launcher2/LauncherAppWidgetHostView.java b/src/com/android/launcher2/LauncherAppWidgetHostView.java
index 7917118..1a4a45e 100644
--- a/src/com/android/launcher2/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher2/LauncherAppWidgetHostView.java
@@ -116,18 +116,6 @@
}
@Override
- public void setAppWidget(int appWidgetId, AppWidgetProviderInfo info) {
- super.setAppWidget(appWidgetId, info);
- // Sometimes the AppWidgetManager returns a null AppWidgetProviderInfo object for
- // a widget, eg. for some widgets in safe mode.
- if (info != null) {
- // We add necessary padding to the AppWidgetHostView
- Launcher.Padding padding = mLauncher.getPaddingForWidget(info.provider);
- setPadding(padding.left, padding.top, padding.right, padding.bottom);
- }
- }
-
- @Override
public int getDescendantFocusability() {
return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
}
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 8bc38c2..afb2b94 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -39,6 +39,7 @@
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.Interpolator;
import android.widget.Checkable;
@@ -402,6 +403,14 @@
if (mTouchState == TOUCH_STATE_REST) {
pageEndMoving();
}
+
+ // Notify the user when the page changes
+ if (AccessibilityManager.getInstance(getContext()).isEnabled()) {
+ AccessibilityEvent ev =
+ AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED);
+ ev.getText().add(getCurrentPageDescription());
+ sendAccessibilityEventUnchecked(ev);
+ }
return true;
}
return false;
@@ -1860,27 +1869,6 @@
}
}
- @Override
- public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
- // Do not append text content to scroll events they are fired frequently
- // and the client has already received another event type with the text.
- if (event.getEventType() != AccessibilityEvent.TYPE_VIEW_SCROLLED) {
- super.dispatchPopulateAccessibilityEvent(event);
- }
-
- onPopulateAccessibilityEvent(event);
- return false;
- }
-
- @Override
- public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
- super.onPopulateAccessibilityEvent(event);
-
- if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
- event.getText().add(getCurrentPageDescription());
- }
- }
-
protected String getCurrentPageDescription() {
int page = (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage;
return String.format(mContext.getString(R.string.default_scroll_format),
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index 4e06570..adf94ab 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -52,6 +52,9 @@
public class PagedViewWidget extends LinearLayout implements Checkable {
static final String TAG = "PagedViewWidgetLayout";
+ private static final int sPreviewFadeInDuration = 80;
+ private static final int sPreviewFadeInStaggerDuration = 20;
+
private final Paint mPaint = new Paint();
private Bitmap mHolographicOutline;
private HolographicOutlineHelper mHolographicOutlineHelper;
@@ -111,14 +114,12 @@
}
public void applyFromAppWidgetProviderInfo(AppWidgetProviderInfo info,
- FastBitmapDrawable preview, int maxWidth, int[] cellSpan,
- HolographicOutlineHelper holoOutlineHelper) {
+ int maxWidth, int[] cellSpan, HolographicOutlineHelper holoOutlineHelper) {
mHolographicOutlineHelper = holoOutlineHelper;
final ImageView image = (ImageView) findViewById(R.id.widget_preview);
if (maxWidth > -1) {
image.setMaxWidth(maxWidth);
}
- image.setImageDrawable(preview);
image.setContentDescription(info.label);
mPreviewImageView = image;
final TextView name = (TextView) findViewById(R.id.widget_name);
@@ -130,11 +131,10 @@
}
public void applyFromResolveInfo(PackageManager pm, ResolveInfo info,
- FastBitmapDrawable preview, HolographicOutlineHelper holoOutlineHelper) {
+ HolographicOutlineHelper holoOutlineHelper) {
mHolographicOutlineHelper = holoOutlineHelper;
CharSequence label = info.loadLabel(pm);
final ImageView image = (ImageView) findViewById(R.id.widget_preview);
- image.setImageDrawable(preview);
image.setContentDescription(label);
mPreviewImageView = image;
final TextView name = (TextView) findViewById(R.id.widget_name);
@@ -145,6 +145,18 @@
}
}
+ void applyPreview(FastBitmapDrawable preview, int index) {
+ final ImageView image = (ImageView) findViewById(R.id.widget_preview);
+ if (preview != null) {
+ image.setImageDrawable(preview);
+ image.setAlpha(0f);
+ image.animate()
+ .alpha(1f)
+ .setDuration(sPreviewFadeInDuration + (index * sPreviewFadeInStaggerDuration))
+ .start();
+ }
+ }
+
public void setHolographicOutline(Bitmap holoOutline) {
mHolographicOutline = holoOutline;
invalidate();
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 873c038..70289d4 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1882,6 +1882,12 @@
dragRect = new Rect(0, 0, child.getWidth(), previewSize);
}
+ // Clear the pressed state if necessary
+ if (child instanceof BubbleTextView) {
+ BubbleTextView icon = (BubbleTextView) child;
+ icon.clearPressedOrFocusedBackground();
+ }
+
mDragController.startDrag(b, dragLayerX, dragLayerY, source, child.getTag(),
DragController.DRAG_ACTION_MOVE, dragRect);
b.recycle();