OSDN Git Service

Handful of small changes / bug fixes
authorAdam Cohen <adamcohen@google.com>
Thu, 19 Sep 2013 02:09:15 +0000 (19:09 -0700)
committerAdam Cohen <adamcohen@google.com>
Thu, 19 Sep 2013 02:10:53 +0000 (19:10 -0700)
-> Fixed fade in of overview panel on first animation
-> Fixed long press issue in page indicator region
-> Added background scrim to overview mode
-> Fading search bar in overview mode / disabling clickability
   of search bar and mic

Change-Id: Ic9bf84f7cb9ff2991c5b4e93273d9e3f65556e5c

src/com/android/launcher3/Launcher.java
src/com/android/launcher3/PagedView.java
src/com/android/launcher3/Workspace.java

index 6e6cdf6..aad9b9f 100644 (file)
@@ -1139,6 +1139,7 @@ public class Launcher extends Activity
                 startSettings();
             }
         });
+        mOverviewPanel.setAlpha(0f);
 
         // Setup the workspace
         mWorkspace.setHapticFeedbackEnabled(false);
index 30c3ea7..d8fc983 100644 (file)
@@ -133,6 +133,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
     protected float mTotalMotionX;
     private int mLastScreenCenter = -1;
 
+    private boolean mCancelTap;
+
     private int[] mPageScrolls;
 
     protected final static int TOUCH_STATE_REST = 0;
@@ -735,7 +737,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
         // NOTE: We multiply by 1.5f to account for the fact that depending on the offset of the
         // viewport, we can be at most one and a half screens offset once we scale down
         DisplayMetrics dm = getResources().getDisplayMetrics();
-        int maxSize = Math.max(dm.widthPixels, dm.heightPixels);
+        int maxSize = Math.max(dm.widthPixels, dm.heightPixels + mInsets.top + mInsets.bottom);
         int parentWidthSize, parentHeightSize;
         int scaledWidthSize, scaledHeightSize;
         if (mUseMinScale) {
@@ -1851,7 +1853,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
                     onDropToDelete();
                 }
             } else {
-                onUnhandledTap(ev);
+                if (!mCancelTap) {
+                    onUnhandledTap(ev);
+                }
             }
 
             // Remove the callback to wait for the side page hover timeout
@@ -1884,6 +1888,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
     private void resetTouchState() {
         releaseVelocityTracker();
         endReordering();
+        mCancelTap = false;
         mTouchState = TOUCH_STATE_REST;
         mActivePointerId = INVALID_POINTER;
     }
@@ -2156,6 +2161,12 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
         return mAllowLongPress;
     }
 
+    @Override
+    public boolean performLongClick() {
+        mCancelTap = true;
+        return super.performLongClick();
+    }
+
     /**
      * Set true to allow long-press events to be triggered, usually checked by
      * {@link Launcher} to accept or block dpad-initiated long-presses.
index 2758b87..76d60a8 100644 (file)
@@ -1795,6 +1795,7 @@ public class Workspace extends SmoothPagedView
         float finalBackgroundAlpha = stateIsSpringLoaded ? 1.0f : 0f;
         float finalHotseatAndPageIndicatorAlpha = (stateIsOverview || stateIsSmall) ? 0f : 1f;
         float finalOverviewPanelAlpha = stateIsOverview ? 1f : 0f;
+        float finalSearchBarAlpha = stateIsOverview ? 0f : 1f;
 
         boolean zoomIn = true;
         mNewScale = 1.0f;
@@ -1857,6 +1858,7 @@ public class Workspace extends SmoothPagedView
             }
         }
 
+        View searchBar = mLauncher.getQsbBar();
         if (animated) {
             LauncherViewPropertyAnimator scale = new LauncherViewPropertyAnimator(this);
             scale.scaleX(mNewScale)
@@ -1903,16 +1905,20 @@ public class Workspace extends SmoothPagedView
             }
             ObjectAnimator hotseatAlpha = ObjectAnimator.ofFloat(mLauncher.getHotseat(), "alpha",
                     finalHotseatAndPageIndicatorAlpha);
+            ObjectAnimator searchBarAlpha = ObjectAnimator.ofFloat(searchBar,
+                    "alpha", finalSearchBarAlpha);
             ObjectAnimator overviewPanelAlpha = ObjectAnimator.ofFloat(mLauncher.getOverviewPanel(),
                     "alpha", finalOverviewPanelAlpha);
             overviewPanelAlpha.addUpdateListener(new AlphaUpdateListener(
                     mLauncher.getOverviewPanel()));
             hotseatAlpha.addUpdateListener(new AlphaUpdateListener(mLauncher.getHotseat()));
+            searchBarAlpha.addUpdateListener(new AlphaUpdateListener(searchBar));
             if (getPageIndicator() != null) {
                 pageIndicatorAlpha.addUpdateListener(new AlphaUpdateListener(getPageIndicator()));
             }
             anim.play(overviewPanelAlpha);
             anim.play(hotseatAlpha);
+            anim.play(searchBarAlpha);
             anim.play(pageIndicatorAlpha);
             anim.setStartDelay(delay);
         } else {
@@ -1924,6 +1930,13 @@ public class Workspace extends SmoothPagedView
                 getPageIndicator().setAlpha(finalHotseatAndPageIndicatorAlpha);
                 AlphaUpdateListener.updateVisibility(getPageIndicator());
             }
+            searchBar.setAlpha(finalSearchBarAlpha);
+            AlphaUpdateListener.updateVisibility(mLauncher.getSearchBar());
+        }
+        if (finalSearchBarAlpha == 0) {
+            mLauncher.setVoiceButtonProxyVisible(false);
+        } else {
+            mLauncher.setVoiceButtonProxyVisible(true);
         }
 
         if (stateIsSpringLoaded) {
@@ -1932,6 +1945,9 @@ public class Workspace extends SmoothPagedView
             // be showing once AppsCustomize disappears
             animateBackgroundGradient(getResources().getInteger(
                     R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f, false);
+        } else if (stateIsOverview) {
+            animateBackgroundGradient(getResources().getInteger(
+                    R.integer.config_appsCustomizeSpringLoadedBgAlpha) / 100f, true);
         } else {
             // Fade the background gradient away
             animateBackgroundGradient(0f, true);