diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-05-13 03:25:36 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-13 03:25:37 +0000 |
commit | bfcb652c77fe47fe75115ca299eac93217677e1c (patch) | |
tree | fe1ac218d27345346650e186841ab8764404cf11 /src/com/android/launcher3/FolderPagedView.java | |
parent | f13586eae96771fde7a4dea26d1d07a3e27d19fd (diff) | |
parent | b7e15adc7b67cb1d70ca72014b200dd6cbbf166a (diff) | |
download | android_packages_apps_Trebuchet-bfcb652c77fe47fe75115ca299eac93217677e1c.tar.gz android_packages_apps_Trebuchet-bfcb652c77fe47fe75115ca299eac93217677e1c.tar.bz2 android_packages_apps_Trebuchet-bfcb652c77fe47fe75115ca299eac93217677e1c.zip |
Merge "Animating the folder title & page indicator when a multi-page folder is opened for the first time" into ub-launcher3-burnaby
Diffstat (limited to 'src/com/android/launcher3/FolderPagedView.java')
-rw-r--r-- | src/com/android/launcher3/FolderPagedView.java | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/com/android/launcher3/FolderPagedView.java b/src/com/android/launcher3/FolderPagedView.java index 05b2bbf67..a6494d274 100644 --- a/src/com/android/launcher3/FolderPagedView.java +++ b/src/com/android/launcher3/FolderPagedView.java @@ -20,9 +20,11 @@ import android.annotation.SuppressLint; import android.content.Context; import android.util.AttributeSet; import android.util.Log; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.animation.DecelerateInterpolator; +import android.view.animation.OvershootInterpolator; import com.android.launcher3.FocusHelper.PagedFolderKeyEventListener; import com.android.launcher3.PageIndicator.PageMarkerResources; @@ -44,6 +46,8 @@ public class FolderPagedView extends PagedView { private static final int START_VIEW_REORDER_DELAY = 30; private static final float VIEW_REORDER_DELAY_FACTOR = 0.9f; + private static final int PAGE_INDICATOR_ANIMATION_DELAY = 150; + /** * Fraction of the width to scroll when showing the next page hint. */ @@ -70,7 +74,7 @@ public class FolderPagedView extends PagedView { private FocusIndicatorView mFocusIndicatorView; private PagedFolderKeyEventListener mKeyListener; - private View mPageIndicator; + private PageIndicator mPageIndicator; public FolderPagedView(Context context, AttributeSet attrs) { super(context, attrs); @@ -93,7 +97,7 @@ public class FolderPagedView extends PagedView { mFolder = folder; mFocusIndicatorView = (FocusIndicatorView) folder.findViewById(R.id.focus_indicator); mKeyListener = new PagedFolderKeyEventListener(folder); - mPageIndicator = folder.findViewById(R.id.folder_page_indicator); + mPageIndicator = (PageIndicator) folder.findViewById(R.id.folder_page_indicator); } /** @@ -330,11 +334,8 @@ public class FolderPagedView extends PagedView { setEnableOverscroll(getPageCount() > 1); // Update footer - int indicatorVisibility = mPageIndicator.getVisibility(); mPageIndicator.setVisibility(getPageCount() > 1 ? View.VISIBLE : View.GONE); - if (indicatorVisibility != mPageIndicator.getVisibility()) { - mFolder.updateFooterHeight(); - } + mFolder.mFolderName.setGravity(getPageCount() > 1 ? Gravity.START : Gravity.CENTER_HORIZONTAL); } public int getDesiredWidth() { @@ -624,4 +625,29 @@ public class FolderPagedView extends PagedView { } } } + + public void setMarkerScale(float scale) { + int count = mPageIndicator.getChildCount(); + for (int i = 0; i < count; i++) { + View marker = mPageIndicator.getChildAt(i); + marker.animate().cancel(); + marker.setScaleX(scale); + marker.setScaleY(scale); + } + } + + public void animateMarkers() { + int count = mPageIndicator.getChildCount(); + OvershootInterpolator interpolator = new OvershootInterpolator(4); + for (int i = 0; i < count; i++) { + mPageIndicator.getChildAt(i).animate().scaleX(1).scaleY(1) + .setInterpolator(interpolator) + .setDuration(Folder.FOOTER_ANIMATION_DURATION) + .setStartDelay(PAGE_INDICATOR_ANIMATION_DELAY * i); + } + } + + public int itemsPerPage() { + return mMaxItemsPerPage; + } } |