diff options
author | Winson Chung <winsonc@google.com> | 2010-11-15 13:45:50 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-11-15 13:45:50 -0800 |
commit | 67f7f18203b2ada5e8d5eea771f73c6448af6d93 (patch) | |
tree | 3991961b34fe8f8b839b2b05a43eb4b9c7b92b22 | |
parent | eed565d5126cb40b2a7ecdf5f6e8ac7a7464007b (diff) | |
parent | e22a8e9d3eafe569fe0f4d284c77af08c6e2fe28 (diff) | |
download | android_packages_apps_Trebuchet-67f7f18203b2ada5e8d5eea771f73c6448af6d93.tar.gz android_packages_apps_Trebuchet-67f7f18203b2ada5e8d5eea771f73c6448af6d93.tar.bz2 android_packages_apps_Trebuchet-67f7f18203b2ada5e8d5eea771f73c6448af6d93.zip |
Merge "Minor fixes to Launcher"
-rw-r--r-- | res/values/strings.xml | 10 | ||||
-rw-r--r-- | src/com/android/launcher2/BubbleTextView.java | 9 | ||||
-rw-r--r-- | src/com/android/launcher2/CustomizePagedView.java | 42 | ||||
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher2/PagedViewIcon.java | 12 |
5 files changed, 37 insertions, 38 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index f26dfc855..a8a996935 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -79,9 +79,13 @@ <!-- External-drop widget pick label format string [CHAR_LIMIT=25] --> <string name="external_drop_widget_pick_format" translatable="false">%1$s (%2$d x %3$d)</string> - <!-- External-drop widget error string --> - <string name="external_drop_widget_error">Could not install clipboard item</string> - <!-- External-drop widget pick title --> + <!-- External-drop widget error string. This is the error that is shown + when you drag and item into the homescreen and it is unable to fit, + or an error is encountered. [CHAR_LIMIT=50] --> + <string name="external_drop_widget_error">Could not drop item onto this homescreen</string> + <!-- External-drop widget pick title. This is shown as the title of the + dialog which allows you to pick which widgets to handle a particular + drop if there are multiple choices. [CHAR_LIMIT=35] --> <string name="external_drop_widget_pick_title">Select widget to create</string> <!-- Folders --> diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java index 076f574de..f4a3d4499 100644 --- a/src/com/android/launcher2/BubbleTextView.java +++ b/src/com/android/launcher2/BubbleTextView.java @@ -39,6 +39,7 @@ public class BubbleTextView extends TextView { private final RectF mRect = new RectF(); private Paint mPaint; + private int mPrevAlpha = -1; private boolean mBackgroundSizeChanged; private Drawable mBackground; @@ -147,7 +148,11 @@ public class BubbleTextView extends TextView { @Override protected boolean onSetAlpha(int alpha) { - mPaint.setAlpha(alpha); - return super.onSetAlpha(alpha); + if (mPrevAlpha != alpha) { + mPrevAlpha = alpha; + mPaint.setAlpha(alpha); + super.onSetAlpha(alpha); + } + return true; } } diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java index 1763a00f6..a0e3528ec 100644 --- a/src/com/android/launcher2/CustomizePagedView.java +++ b/src/com/android/launcher2/CustomizePagedView.java @@ -303,9 +303,10 @@ public class CustomizePagedView extends PagedView @Override public void onClick(View v) { - if (!v.isInTouchMode()) { - return; - } + // Return early if this is not initiated from a touch + if (!v.isInTouchMode()) return; + // Return early if we are still animating the pages + if (mNextPage == INVALID_PAGE) return; // On certain pages, we allow single tap to mark items as selected so that they can be // dropped onto the mini workspaces @@ -368,9 +369,10 @@ public class CustomizePagedView extends PagedView @Override public boolean onLongClick(View v) { - if (!v.isInTouchMode()) { - return false; - } + // Return early if this is not initiated from a touch + if (!v.isInTouchMode()) return false; + // Return early if we are still animating the pages + if (mNextPage == INVALID_PAGE) return false; // End the current choice mode before we start dragging anything if (isChoiceMode(CHOICE_MODE_SINGLE)) { @@ -604,17 +606,9 @@ public class CustomizePagedView extends PagedView layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop, mPageLayoutPaddingRight, mPageLayoutPaddingBottom); - // Temporary change to prevent the last page from being too small (and items bleeding - // onto it). We can remove this once we properly fix the fading algorithm - if (i < numPages - 1) { - addView(layout, new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.MATCH_PARENT)); - } else { - addView(layout, new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.MATCH_PARENT)); - } + addView(layout, new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.MATCH_PARENT)); } } @@ -665,17 +659,9 @@ public class CustomizePagedView extends PagedView layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop, mPageLayoutPaddingRight, mPageLayoutPaddingBottom); - // Temporary change to prevent the last page from being too small (and items bleeding - // onto it). We can remove this once we properly fix the fading algorithm - if (i < numPages - 1) { - addView(layout, new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.WRAP_CONTENT, - LinearLayout.LayoutParams.MATCH_PARENT)); - } else { - addView(layout, new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.MATCH_PARENT)); - } + addView(layout, new LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.MATCH_PARENT)); } } diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 109696c0a..caa1e1298 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -57,7 +57,7 @@ public abstract class PagedView extends ViewGroup { // The min drag distance to trigger a page shift (regardless of velocity) private static final int MIN_LENGTH_FOR_MOVE = 200; - private static final int PAGE_SNAP_ANIMATION_DURATION = 1000; + private static final int PAGE_SNAP_ANIMATION_DURATION = 750; protected static final float NANOTIME_DIV = 1000000000.0f; // the velocity at which a fling gesture will cause us to snap to the next page diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java index 50ba8d459..b9b9b377e 100644 --- a/src/com/android/launcher2/PagedViewIcon.java +++ b/src/com/android/launcher2/PagedViewIcon.java @@ -52,7 +52,7 @@ public class PagedViewIcon extends TextView implements Checkable { private Object mIconCacheKey; private PagedViewIconCache mIconCache; - private int mAlpha; + private int mAlpha = -1; private int mHolographicAlpha; private boolean mIsChecked; @@ -162,9 +162,13 @@ public class PagedViewIcon extends TextView implements Checkable { public void setAlpha(float alpha) { final float viewAlpha = sHolographicOutlineHelper.viewAlphaInterpolator(alpha); final float holographicAlpha = sHolographicOutlineHelper.highlightAlphaInterpolator(alpha); - mAlpha = (int) (viewAlpha * 255); - mHolographicAlpha = (int) (holographicAlpha * 255); - super.setAlpha(viewAlpha); + int newViewAlpha = (int) (viewAlpha * 255); + int newHolographicAlpha = (int) (holographicAlpha * 255); + if ((mAlpha != newViewAlpha) || (mHolographicAlpha != newHolographicAlpha)) { + mAlpha = newViewAlpha; + mHolographicAlpha = newHolographicAlpha; + super.setAlpha(viewAlpha); + } } public void invalidateCheckedImage() { |