merge in ics-mr1-release history after reset to ics-mr1
diff --git a/res/drawable-sw600dp-hdpi/widget_resize_frame_holo.9.png b/res/drawable-sw600dp-hdpi/widget_resize_frame_holo.9.png
deleted file mode 100644
index 7d16d7d..0000000
--- a/res/drawable-sw600dp-hdpi/widget_resize_frame_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/widget_resize_handle_bottom.png b/res/drawable-sw600dp-hdpi/widget_resize_handle_bottom.png
deleted file mode 100644
index 045c15e..0000000
--- a/res/drawable-sw600dp-hdpi/widget_resize_handle_bottom.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/widget_resize_handle_left.png b/res/drawable-sw600dp-hdpi/widget_resize_handle_left.png
deleted file mode 100644
index f0fc4d6..0000000
--- a/res/drawable-sw600dp-hdpi/widget_resize_handle_left.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/widget_resize_handle_right.png b/res/drawable-sw600dp-hdpi/widget_resize_handle_right.png
deleted file mode 100644
index 9c1f366..0000000
--- a/res/drawable-sw600dp-hdpi/widget_resize_handle_right.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/widget_resize_handle_top.png b/res/drawable-sw600dp-hdpi/widget_resize_handle_top.png
deleted file mode 100644
index f7839ed..0000000
--- a/res/drawable-sw600dp-hdpi/widget_resize_handle_top.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/widget_resize_frame_holo.9.png b/res/drawable-sw600dp-mdpi/widget_resize_frame_holo.9.png
deleted file mode 100644
index e2e1396..0000000
--- a/res/drawable-sw600dp-mdpi/widget_resize_frame_holo.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/widget_resize_handle_bottom.png b/res/drawable-sw600dp-mdpi/widget_resize_handle_bottom.png
deleted file mode 100644
index 99ac1b2..0000000
--- a/res/drawable-sw600dp-mdpi/widget_resize_handle_bottom.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/widget_resize_handle_left.png b/res/drawable-sw600dp-mdpi/widget_resize_handle_left.png
deleted file mode 100644
index d031ddd..0000000
--- a/res/drawable-sw600dp-mdpi/widget_resize_handle_left.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/widget_resize_handle_right.png b/res/drawable-sw600dp-mdpi/widget_resize_handle_right.png
deleted file mode 100644
index f1b689c..0000000
--- a/res/drawable-sw600dp-mdpi/widget_resize_handle_right.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/widget_resize_handle_top.png b/res/drawable-sw600dp-mdpi/widget_resize_handle_top.png
deleted file mode 100644
index 40bef02..0000000
--- a/res/drawable-sw600dp-mdpi/widget_resize_handle_top.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-sw600dp-nodpi/bluecrystal.jpg b/res/drawable-sw600dp-nodpi/bluecrystal.jpg
index 2fa072b..d8caefb 100755
--- a/res/drawable-sw600dp-nodpi/bluecrystal.jpg
+++ b/res/drawable-sw600dp-nodpi/bluecrystal.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-nodpi/bluelinebots.jpg b/res/drawable-sw600dp-nodpi/bluelinebots.jpg
index c8d32a7..26dce37 100644
--- a/res/drawable-sw600dp-nodpi/bluelinebots.jpg
+++ b/res/drawable-sw600dp-nodpi/bluelinebots.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-nodpi/bots.jpg b/res/drawable-sw600dp-nodpi/bots.jpg
index 922acbb..ee3b715 100755
--- a/res/drawable-sw600dp-nodpi/bots.jpg
+++ b/res/drawable-sw600dp-nodpi/bots.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-nodpi/bucky.jpg b/res/drawable-sw600dp-nodpi/bucky.jpg
index c5a5b3e..20a5034 100755
--- a/res/drawable-sw600dp-nodpi/bucky.jpg
+++ b/res/drawable-sw600dp-nodpi/bucky.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-nodpi/city.jpg b/res/drawable-sw600dp-nodpi/city.jpg
index 72beb6b..9b4041f 100644
--- a/res/drawable-sw600dp-nodpi/city.jpg
+++ b/res/drawable-sw600dp-nodpi/city.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-nodpi/flowerbot.jpg b/res/drawable-sw600dp-nodpi/flowerbot.jpg
index 7adb3d2..5d9bb75 100644
--- a/res/drawable-sw600dp-nodpi/flowerbot.jpg
+++ b/res/drawable-sw600dp-nodpi/flowerbot.jpg
Binary files differ
diff --git a/res/drawable-sw600dp-nodpi/glowy_hex.jpg b/res/drawable-sw600dp-nodpi/glowy_hex.jpg
index 7d7cdbb..b007bfd 100644
--- a/res/drawable-sw600dp-nodpi/glowy_hex.jpg
+++ b/res/drawable-sw600dp-nodpi/glowy_hex.jpg
Binary files differ
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index af87653..1b01b48 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -18,9 +18,11 @@
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
android:background="#FF000000">
<LinearLayout
+ android:id="@+id/apps_customize_content"
android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:visibility="gone">
<!-- The layout_width of the tab bar gets overriden to align the content
with the text in the tabs in AppsCustomizeTabHost. -->
<FrameLayout
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index af5141f..c55853e 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -37,7 +37,6 @@
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Rect;
-import android.graphics.RectF;
import android.graphics.TableMaskFilter;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
@@ -45,6 +44,7 @@
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
+import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -168,7 +168,7 @@
* The Apps/Customize page that displays all the applications, widgets, and shortcuts.
*/
public class AppsCustomizePagedView extends PagedViewWithDraggableItems implements
- AllAppsView, View.OnClickListener, DragSource {
+ AllAppsView, View.OnClickListener, View.OnKeyListener, DragSource {
static final String LOG_TAG = "AppsCustomizePagedView";
/**
@@ -515,6 +515,10 @@
}
}
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ return FocusHelper.handleAppsCustomizeKeyEvent(v, keyCode, event);
+ }
+
/*
* PagedViewWithDraggableItems implementation
*/
@@ -663,14 +667,16 @@
private void updateCurrentTab(int currentPage) {
AppsCustomizeTabHost tabHost = getTabHost();
- String tag = tabHost.getCurrentTabTag();
- if (tag != null) {
- if (currentPage >= mNumAppsPages &&
- !tag.equals(tabHost.getTabTagForContentType(ContentType.Widgets))) {
- tabHost.setCurrentTabFromContent(ContentType.Widgets);
- } else if (currentPage < mNumAppsPages &&
- !tag.equals(tabHost.getTabTagForContentType(ContentType.Applications))) {
- tabHost.setCurrentTabFromContent(ContentType.Applications);
+ if (tabHost != null) {
+ String tag = tabHost.getCurrentTabTag();
+ if (tag != null) {
+ if (currentPage >= mNumAppsPages &&
+ !tag.equals(tabHost.getTabTagForContentType(ContentType.Widgets))) {
+ tabHost.setCurrentTabFromContent(ContentType.Widgets);
+ } else if (currentPage < mNumAppsPages &&
+ !tag.equals(tabHost.getTabTagForContentType(ContentType.Applications))) {
+ tabHost.setCurrentTabFromContent(ContentType.Applications);
+ }
}
}
}
@@ -720,6 +726,7 @@
icon.setOnClickListener(this);
icon.setOnLongClickListener(this);
icon.setOnTouchListener(this);
+ icon.setOnKeyListener(this);
int index = i - startIndex;
int x = index % mCellCountX;
@@ -1075,6 +1082,7 @@
widget.setOnClickListener(this);
widget.setOnLongClickListener(this);
widget.setOnTouchListener(this);
+ widget.setOnKeyListener(this);
// Layout each widget
int ix = i % mWidgetCountX;
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 41f8d7e..334b369 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -28,6 +28,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
+import android.widget.LinearLayout;
import android.widget.TabHost;
import android.widget.TabWidget;
import android.widget.TextView;
@@ -49,9 +50,11 @@
private AppsCustomizePagedView mAppsCustomizePane;
private boolean mSuppressContentCallback = false;
private FrameLayout mAnimationBuffer;
+ private LinearLayout mContent;
private boolean mInTransition;
private boolean mResetAfterTransition;
+ private Animator mLauncherTransition;
public AppsCustomizeTabHost(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -93,6 +96,7 @@
mTabsContainer = tabsContainer;
mAppsCustomizePane = appsCustomizePane;
mAnimationBuffer = (FrameLayout) findViewById(R.id.animation_buffer);
+ mContent = (LinearLayout) findViewById(R.id.apps_customize_content);
if (tabs == null || mAppsCustomizePane == null) throw new Resources.NotFoundException();
// Configure the tabs content factory to return the same paged view (that we change the
@@ -202,6 +206,17 @@
// Take the visible pages and re-parent them temporarily to mAnimatorBuffer
// and then cross fade to the new pages
+ int[] visiblePageRange = new int[2];
+ mAppsCustomizePane.getVisiblePages(visiblePageRange);
+ if (visiblePageRange[0] == -1 && visiblePageRange[1] == -1) {
+ // If we can't get the visible page ranges, then just skip the animation
+ reloadCurrentPage();
+ return;
+ }
+ ArrayList<View> visiblePages = new ArrayList<View>();
+ for (int i = visiblePageRange[0]; i <= visiblePageRange[1]; i++) {
+ visiblePages.add(mAppsCustomizePane.getPageAt(i));
+ }
// We want the pages to be rendered in exactly the same way as they were when
// their parent was mAppsCustomizePane -- so set the scroll on mAnimationBuffer
@@ -209,16 +224,15 @@
// parameters to be correct for each of the pages
mAnimationBuffer.scrollTo(mAppsCustomizePane.getScrollX(), 0);
- int[] visiblePageRange = new int[2];
- mAppsCustomizePane.getVisiblePages(visiblePageRange);
- ArrayList<View> visiblePages = new ArrayList<View>();
- for (int i = visiblePageRange[0]; i <= visiblePageRange[1]; i++) {
- visiblePages.add(mAppsCustomizePane.getPageAt(i));
- }
// mAppsCustomizePane renders its children in reverse order, so
// add the pages to mAnimationBuffer in reverse order to match that behavior
for (int i = visiblePages.size() - 1; i >= 0; i--) {
View child = visiblePages.get(i);
+ if (child instanceof PagedViewCellLayout) {
+ ((PagedViewCellLayout) child).resetChildrenOnKeyListeners();
+ } else if (child instanceof PagedViewGridLayout) {
+ ((PagedViewGridLayout) child).resetChildrenOnKeyListeners();
+ }
PagedViewWidget.setDeletePreviewsWhenDetachedFromWindow(false);
mAppsCustomizePane.removeView(child);
PagedViewWidget.setDeletePreviewsWhenDetachedFromWindow(true);
@@ -313,21 +327,49 @@
}
}
- /* LauncherTransitionable overrides */
- @Override
- public void onLauncherTransitionStart(Launcher l, Animator animation, boolean toWorkspace) {
- mInTransition = true;
+ private void enableAndBuildHardwareLayer() {
// isHardwareAccelerated() checks if we're attached to a window and if that
// window is HW accelerated-- we were sometimes not attached to a window
// and buildLayer was throwing an IllegalStateException
- if (animation != null && isHardwareAccelerated()) {
+ if (isHardwareAccelerated()) {
// Turn on hardware layers for performance
setLayerType(LAYER_TYPE_HARDWARE, null);
- // force building the layer at the beginning of the animation, so you don't get a
- // blip early in the animation
+ // force building the layer, so you don't get a blip early in an animation
+ // when the layer is created layer
buildLayer();
}
+ }
+
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+ if (mLauncherTransition != null) {
+ enableAndBuildHardwareLayer();
+ mLauncherTransition.start();
+ mLauncherTransition = null;
+ }
+ }
+
+ /* LauncherTransitionable overrides */
+ @Override
+ public boolean onLauncherTransitionStart(Launcher l, Animator animation, boolean toWorkspace) {
+ mInTransition = true;
+ boolean delayLauncherTransitionUntilLayout = false;
+ mLauncherTransition = null;
+
+ // if the content wasn't visible before, delay the launcher animation until after a cal
+ // to layout -- this prevents a blip
+ if (animation != null) {
+ if (mContent.getVisibility() == GONE) {
+ mLauncherTransition = animation;
+ delayLauncherTransitionUntilLayout = true;
+ }
+ mContent.setVisibility(VISIBLE);
+ if (!delayLauncherTransitionUntilLayout) {
+ enableAndBuildHardwareLayer();
+ }
+ }
+
if (!toWorkspace && !LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.showScrollingIndicator(false);
}
@@ -335,6 +377,7 @@
mAppsCustomizePane.reset();
mResetAfterTransition = false;
}
+ return delayLauncherTransitionUntilLayout;
}
@Override
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index f91a471..7ee03fc 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2225,10 +2225,6 @@
alphaAnim.setStartDelay(startDelay);
alphaAnim.start();
- if (toView instanceof LauncherTransitionable) {
- ((LauncherTransitionable) toView).onLauncherTransitionStart(instance, scaleAnim,
- false);
- }
scaleAnim.addListener(new AnimatorListenerAdapter() {
boolean animationCancelled = false;
@@ -2272,7 +2268,18 @@
// toView should appear right at the end of the workspace shrink animation
mStateAnimation = new AnimatorSet();
mStateAnimation.play(scaleAnim).after(startDelay);
- mStateAnimation.start();
+
+ boolean delayAnim = false;
+ if (toView instanceof LauncherTransitionable) {
+ LauncherTransitionable lt = (LauncherTransitionable) toView;
+ delayAnim = lt.onLauncherTransitionStart(instance, mStateAnimation, false);
+ }
+ // if the anim is delayed, the LauncherTransitionable is responsible for starting it
+ if (!delayAnim) {
+ // TODO: q-- what if this anim is cancelled before being started? or started after
+ // being cancelled?
+ mStateAnimation.start();
+ }
} else {
toView.setTranslationX(0.0f);
toView.setTranslationY(0.0f);
@@ -3249,6 +3256,7 @@
}
interface LauncherTransitionable {
- void onLauncherTransitionStart(Launcher l, Animator animation, boolean toWorkspace);
+ // return true if the callee will take care of start the animation by itself
+ boolean onLauncherTransitionStart(Launcher l, Animator animation, boolean toWorkspace);
void onLauncherTransitionEnd(Launcher l, Animator animation, boolean toWorkspace);
}
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 14ef53f..49c25b5 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -752,17 +752,18 @@
getVisiblePages(mTempVisiblePagesRange);
final int leftScreen = mTempVisiblePagesRange[0];
final int rightScreen = mTempVisiblePagesRange[1];
+ if (leftScreen != -1 && rightScreen != -1) {
+ final long drawingTime = getDrawingTime();
+ // Clip to the bounds
+ canvas.save();
+ canvas.clipRect(mScrollX, mScrollY, mScrollX + mRight - mLeft,
+ mScrollY + mBottom - mTop);
- final long drawingTime = getDrawingTime();
- // Clip to the bounds
- canvas.save();
- canvas.clipRect(mScrollX, mScrollY, mScrollX + mRight - mLeft,
- mScrollY + mBottom - mTop);
-
- for (int i = rightScreen; i >= leftScreen; i--) {
- drawChild(canvas, getPageAt(i), drawingTime);
+ for (int i = rightScreen; i >= leftScreen; i--) {
+ drawChild(canvas, getPageAt(i), drawingTime);
+ }
+ canvas.restore();
}
- canvas.restore();
}
}
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 6266ca2..ef39813 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -151,6 +151,16 @@
mChildren.removeViewAt(index);
}
+ /**
+ * Clears all the key listeners for the individual icons.
+ */
+ public void resetChildrenOnKeyListeners() {
+ int childCount = mChildren.getChildCount();
+ for (int j = 0; j < childCount; ++j) {
+ mChildren.getChildAt(j).setOnKeyListener(null);
+ }
+ }
+
@Override
public int getPageChildCount() {
return mChildren.getChildCount();
diff --git a/src/com/android/launcher2/PagedViewGridLayout.java b/src/com/android/launcher2/PagedViewGridLayout.java
index 01d7593..5c32e09 100644
--- a/src/com/android/launcher2/PagedViewGridLayout.java
+++ b/src/com/android/launcher2/PagedViewGridLayout.java
@@ -46,6 +46,16 @@
return mCellCountY;
}
+ /**
+ * Clears all the key listeners for the individual widgets.
+ */
+ public void resetChildrenOnKeyListeners() {
+ int childCount = getChildCount();
+ for (int j = 0; j < childCount; ++j) {
+ getChildAt(j).setOnKeyListener(null);
+ }
+ }
+
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// PagedView currently has issues with different-sized pages since it calculates the
// offset of each page to scroll to before it updates the actual size of each page
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index 3cc7786..b03d867 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -155,18 +155,6 @@
}
@Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- return FocusHelper.handleAppsCustomizeKeyEvent(this, keyCode, event)
- || super.onKeyDown(keyCode, event);
- }
-
- @Override
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- return FocusHelper.handleAppsCustomizeKeyEvent(this, keyCode, event)
- || super.onKeyUp(keyCode, event);
- }
-
- @Override
public boolean isChecked() {
return mIsChecked;
}
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index d3541ff..18fa249 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -183,18 +183,6 @@
}
@Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- return FocusHelper.handleAppsCustomizeKeyEvent(this, keyCode, event)
- || super.onKeyDown(keyCode, event);
- }
-
- @Override
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- return FocusHelper.handleAppsCustomizeKeyEvent(this, keyCode, event)
- || super.onKeyUp(keyCode, event);
- }
-
- @Override
protected void onDraw(Canvas canvas) {
if (mAlpha > 0) {
super.onDraw(canvas);