Merge "Animating the folder title & page indicator when a multi-page folder is opened for the first time" into ub-launcher3-burnaby

This commit is contained in:
Sunny Goyal authored and Android (Google) Code Review committed 2015-05-13 03:25:37 +00:00
commit bfcb652c77
4 files changed
+95 -18

No files matched your search

+32 -6
View File
@@ -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;
}
}