mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Updating the folder page indicator to be more like the
framework page indicator (used in quick settings) The active page is indicated with the accent color. During scroll the active indicator expands to 2 dots corresponding to the visible pages. Change-Id: Iaf57836b642cf87e5eed98048ecca7dd8e7643a4
This commit is contained in:
@@ -255,14 +255,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
||||
ViewGroup grandParent = (ViewGroup) parent.getParent();
|
||||
if (mPageIndicator == null && mPageIndicatorViewId > -1) {
|
||||
mPageIndicator = (PageIndicator) grandParent.findViewById(mPageIndicatorViewId);
|
||||
mPageIndicator.removeAllMarkers(true);
|
||||
|
||||
ArrayList<PageIndicator.PageMarkerResources> markers = new ArrayList<>();
|
||||
for (int i = 0; i < getChildCount(); ++i) {
|
||||
markers.add(getPageIndicatorMarker(i));
|
||||
}
|
||||
|
||||
mPageIndicator.addMarkers(markers, true);
|
||||
mPageIndicator.setMarkersCount(getChildCount());
|
||||
|
||||
OnClickListener listener = getPageIndicatorClickListener();
|
||||
if (listener != null) {
|
||||
@@ -356,10 +349,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
||||
PageIndicator getPageIndicator() {
|
||||
return mPageIndicator;
|
||||
}
|
||||
protected PageIndicator.PageMarkerResources getPageIndicatorMarker(int pageIndex) {
|
||||
return new PageIndicator.PageMarkerResources(R.drawable.ic_pageindicator_current,
|
||||
R.drawable.ic_pageindicator_default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the index of the currently displayed page. When in free scroll mode, this is the page
|
||||
@@ -962,10 +951,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
||||
// Update the page indicator, we don't update the page indicator as we
|
||||
// add/remove pages
|
||||
if (mPageIndicator != null && !isReordering(false)) {
|
||||
int pageIndex = indexOfChild(child);
|
||||
mPageIndicator.addMarker(pageIndex,
|
||||
getPageIndicatorMarker(pageIndex),
|
||||
true);
|
||||
mPageIndicator.addMarker();
|
||||
}
|
||||
|
||||
// This ensures that when children are added, they get the correct transforms / alphas
|
||||
@@ -982,11 +968,11 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private void removeMarkerForView(int index) {
|
||||
private void removeMarkerForView() {
|
||||
// Update the page indicator, we don't update the page indicator as we
|
||||
// add/remove pages
|
||||
if (mPageIndicator != null && !isReordering(false)) {
|
||||
mPageIndicator.removeMarker(index, true);
|
||||
mPageIndicator.removeMarker();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -994,21 +980,21 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
||||
public void removeView(View v) {
|
||||
// XXX: We should find a better way to hook into this before the view
|
||||
// gets removed form its parent...
|
||||
removeMarkerForView(indexOfChild(v));
|
||||
removeMarkerForView();
|
||||
super.removeView(v);
|
||||
}
|
||||
@Override
|
||||
public void removeViewInLayout(View v) {
|
||||
// XXX: We should find a better way to hook into this before the view
|
||||
// gets removed form its parent...
|
||||
removeMarkerForView(indexOfChild(v));
|
||||
removeMarkerForView();
|
||||
super.removeViewInLayout(v);
|
||||
}
|
||||
@Override
|
||||
public void removeViewAt(int index) {
|
||||
// XXX: We should find a better way to hook into this before the view
|
||||
// gets removed form its parent...
|
||||
removeMarkerForView(index);
|
||||
removeMarkerForView();
|
||||
super.removeViewAt(index);
|
||||
}
|
||||
@Override
|
||||
@@ -1016,7 +1002,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
||||
// Update the page indicator, we don't update the page indicator as we
|
||||
// add/remove pages
|
||||
if (mPageIndicator != null) {
|
||||
mPageIndicator.removeAllMarkers(true);
|
||||
mPageIndicator.setMarkersCount(0);
|
||||
}
|
||||
|
||||
super.removeAllViewsInLayout();
|
||||
|
||||
Reference in New Issue
Block a user