summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/folder/FolderPagedView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-05-19 01:40:40 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-05-19 01:40:40 +0000
commitc8e0fced52803f27ecaff234b1b6950b7b9fb18e (patch)
tree391350ff19d812cc0f52c9d5324ec90c530352ea /src/com/android/launcher3/folder/FolderPagedView.java
parentbdeaa0b079781a4c18ddc6f1e298d03a2374882d (diff)
parentc64cfdd8fa18de45fc1646c8ef2449f39ef83022 (diff)
downloadandroid_packages_apps_Trebuchet-c8e0fced52803f27ecaff234b1b6950b7b9fb18e.tar.gz
android_packages_apps_Trebuchet-c8e0fced52803f27ecaff234b1b6950b7b9fb18e.tar.bz2
android_packages_apps_Trebuchet-c8e0fced52803f27ecaff234b1b6950b7b9fb18e.zip
Updating the folder page indicator to be more like the framework page indicator (used in quick settings)
am: c64cfdd8fa * commit 'c64cfdd8fa18de45fc1646c8ef2449f39ef83022': Updating the folder page indicator to be more like the framework page indicator (used in quick settings) Change-Id: Ibd2d33dd2162495f19fe50eb952c4cf0fc788004
Diffstat (limited to 'src/com/android/launcher3/folder/FolderPagedView.java')
-rw-r--r--src/com/android/launcher3/folder/FolderPagedView.java52
1 files changed, 10 insertions, 42 deletions
diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java
index e1a143165..bb8ca160d 100644
--- a/src/com/android/launcher3/folder/FolderPagedView.java
+++ b/src/com/android/launcher3/folder/FolderPagedView.java
@@ -25,8 +25,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewDebug;
import android.view.animation.DecelerateInterpolator;
-import android.view.animation.Interpolator;
-import android.view.animation.OvershootInterpolator;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.CellLayout;
@@ -39,8 +37,6 @@ import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
-import com.android.launcher3.pageindicators.PageIndicatorDots;
-import com.android.launcher3.pageindicators.PageIndicator.PageMarkerResources;
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutAndWidgetContainer;
@@ -48,6 +44,7 @@ import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.dragndrop.DragController;
+import com.android.launcher3.pageindicators.PageIndicator;
import com.android.launcher3.util.Thunk;
import java.util.ArrayList;
@@ -65,13 +62,6 @@ 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_START_DELAY = 300;
- private static final int PAGE_INDICATOR_ANIMATION_STAGGERED_DELAY = 150;
- private static final int PAGE_INDICATOR_ANIMATION_DURATION = 400;
-
- // This value approximately overshoots to 1.5 times the original size.
- private static final float PAGE_INDICATOR_OVERSHOOT_TENSION = 4.9f;
-
/**
* Fraction of the width to scroll when showing the next page hint.
*/
@@ -103,7 +93,7 @@ public class FolderPagedView extends PagedView {
private FocusIndicatorView mFocusIndicatorView;
private PagedFolderKeyEventListener mKeyListener;
- private PageIndicatorDots mPageIndicator;
+ private PageIndicator mPageIndicator;
public FolderPagedView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -128,7 +118,7 @@ public class FolderPagedView extends PagedView {
mFolder = folder;
mFocusIndicatorView = (FocusIndicatorView) folder.findViewById(R.id.focus_indicator);
mKeyListener = new PagedFolderKeyEventListener(folder);
- mPageIndicator = (PageIndicatorDots) folder.findViewById(R.id.folder_page_indicator);
+ mPageIndicator = (PageIndicator) folder.findViewById(R.id.folder_page_indicator);
}
/**
@@ -285,6 +275,12 @@ public class FolderPagedView extends PagedView {
}
}
+ @Override
+ protected void onScrollChanged(int l, int t, int oldl, int oldt) {
+ super.onScrollChanged(l, t, oldl, oldt);
+ mPageIndicator.setScroll(l, mMaxScrollX);
+ }
+
/**
* Updates position and rank of all the children in the view.
* It essentially removes all views from all the pages and then adds them again in appropriate
@@ -369,7 +365,7 @@ public class FolderPagedView extends PagedView {
setEnableOverscroll(getPageCount() > 1);
// Update footer
- mPageIndicator.setVisibility(getPageCount() > 1 ? View.VISIBLE : View.GONE);
+ mPageIndicator.getView().setVisibility(getPageCount() > 1 ? View.VISIBLE : View.GONE);
// Set the gravity as LEFT or RIGHT instead of START, as START depends on the actual text.
mFolder.mFolderName.setGravity(getPageCount() > 1 ?
(mIsRtl ? Gravity.RIGHT : Gravity.LEFT) : Gravity.CENTER_HORIZONTAL);
@@ -409,12 +405,6 @@ public class FolderPagedView extends PagedView {
pageIndex * mMaxItemsPerPage + sTempPosArray[1] * mGridCountX + sTempPosArray[0]);
}
- @Override
- protected PageMarkerResources getPageIndicatorMarker(int pageIndex) {
- return new PageMarkerResources(R.drawable.ic_pageindicator_current_folder,
- R.drawable.ic_pageindicator_default_folder);
- }
-
public boolean isFull() {
return !ALLOW_FOLDER_SCROLL && getItemCount() >= mMaxItemsPerPage;
}
@@ -676,28 +666,6 @@ 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();
- Interpolator interpolator = new OvershootInterpolator(PAGE_INDICATOR_OVERSHOOT_TENSION);
- for (int i = 0; i < count; i++) {
- mPageIndicator.getChildAt(i).animate().scaleX(1).scaleY(1)
- .setInterpolator(interpolator)
- .setDuration(PAGE_INDICATOR_ANIMATION_DURATION)
- .setStartDelay(PAGE_INDICATOR_ANIMATION_STAGGERED_DELAY * i
- + PAGE_INDICATOR_ANIMATION_START_DELAY);
- }
- }
-
public int itemsPerPage() {
return mMaxItemsPerPage;
}