Loading res/drawable/page_indicator.xml 0 → 100644 +6 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="?attr/folderPaginationColor"/> <size android:width="@dimen/page_indicator_size" android:height="@dimen/page_indicator_size"/> </shape> No newline at end of file res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ <!-- Folders --> <dimen name="page_indicator_dot_size">8dp</dimen> <dimen name="page_indicator_current_page_indicator_size">10dp</dimen> <dimen name="page_indicator_size">10dp</dimen> <dimen name="folder_cell_x_padding">9dp</dimen> Loading src/com/android/launcher3/pageindicators/PageIndicatorDots.java +22 −7 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.graphics.Outline; import android.graphics.Paint; import android.graphics.Paint.Style; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Property; import android.view.View; Loading Loading @@ -84,9 +85,11 @@ public class PageIndicatorDots extends View implements PageIndicator { }; private final Paint mPaginationPaint; private final Drawable mPageIndicatorDrawable; private final float mDotRadius; private final float mCircleGap; private final float mPageIndicatorSize; private final float mPageIndicatorRadius; private final boolean mIsRtl; private int mNumPages; Loading Loading @@ -125,13 +128,22 @@ public class PageIndicatorDots extends View implements PageIndicator { mPaginationPaint.setColor(Themes.getAttrColor(context, R.attr.folderPaginationColor)); mDotRadius = getResources().getDimension(R.dimen.page_indicator_dot_size) / 2; if (SHOW_DELIGHTFUL_PAGINATION_FOLDER.get()) { mPageIndicatorSize = getResources().getDimension( R.dimen.page_indicator_size); mPageIndicatorRadius = mPageIndicatorSize / 2; mPageIndicatorDrawable = context.getDrawable(R.drawable.page_indicator); mPageIndicatorDrawable.setBounds(0, 0, (int) mPageIndicatorSize, (int) mPageIndicatorSize); mCircleGap = DOT_GAP_FACTOR_FLOAT * mDotRadius; } else { mPageIndicatorSize = 0; mPageIndicatorRadius = 0; mPageIndicatorDrawable = null; mCircleGap = DOT_GAP_FACTOR * mDotRadius; } mPageIndicatorSize = getResources().getDimension( R.dimen.page_indicator_current_page_indicator_size); if (!SHOW_DELIGHTFUL_PAGINATION_FOLDER.get()) { setOutlineProvider(new MyOutlineProver()); } Loading Loading @@ -308,16 +320,19 @@ public class PageIndicatorDots extends View implements PageIndicator { mPaginationPaint.setAlpha(PAGE_INDICATOR_ALPHA); if (SHOW_DELIGHTFUL_PAGINATION_FOLDER.get()) { RectF currRect = getActiveRect(); int scrollPerPage = getScrollPerPage(); // Moves the canvas to start at the top left corner of the page indicator canvas.translate(currRect.left, currRect.top); int scrollPerPage = getScrollPerPage(); // This IF is to avoid division by 0 if (scrollPerPage != 0) { int delta = mCurrentScroll % scrollPerPage; canvas.rotate((INDICATOR_ROTATION * delta) / scrollPerPage, currRect.centerX(), currRect.centerY()); mPageIndicatorRadius, mPageIndicatorRadius); } canvas.drawRect(currRect, mPaginationPaint); mPageIndicatorDrawable.draw(canvas); } else { canvas.drawRoundRect(getActiveRect(), mDotRadius, mDotRadius, mPaginationPaint); } Loading @@ -334,7 +349,7 @@ public class PageIndicatorDots extends View implements PageIndicator { float startXIndicator = ((getWidth() - (mNumPages * mCircleGap) + mDotRadius) / 2) - getOffset(); float indicatorPosition = startXIndicator + getIndicatorScrollDistance() + (mPageIndicatorSize / 2); + mPageIndicatorRadius; // If the indicator gets close enough to a dot then we change the radius // of the dot based on how close the indicator is to it. Loading Loading @@ -391,7 +406,7 @@ public class PageIndicatorDots extends View implements PageIndicator { * the indicator is centered in with the indicator circles */ private float getOffset() { return (mPageIndicatorSize / 2) - mDotRadius; return mPageIndicatorRadius - mDotRadius; } /** Loading Loading
res/drawable/page_indicator.xml 0 → 100644 +6 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="?attr/folderPaginationColor"/> <size android:width="@dimen/page_indicator_size" android:height="@dimen/page_indicator_size"/> </shape> No newline at end of file
res/values/dimens.xml +1 −1 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ <!-- Folders --> <dimen name="page_indicator_dot_size">8dp</dimen> <dimen name="page_indicator_current_page_indicator_size">10dp</dimen> <dimen name="page_indicator_size">10dp</dimen> <dimen name="folder_cell_x_padding">9dp</dimen> Loading
src/com/android/launcher3/pageindicators/PageIndicatorDots.java +22 −7 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.graphics.Outline; import android.graphics.Paint; import android.graphics.Paint.Style; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Property; import android.view.View; Loading Loading @@ -84,9 +85,11 @@ public class PageIndicatorDots extends View implements PageIndicator { }; private final Paint mPaginationPaint; private final Drawable mPageIndicatorDrawable; private final float mDotRadius; private final float mCircleGap; private final float mPageIndicatorSize; private final float mPageIndicatorRadius; private final boolean mIsRtl; private int mNumPages; Loading Loading @@ -125,13 +128,22 @@ public class PageIndicatorDots extends View implements PageIndicator { mPaginationPaint.setColor(Themes.getAttrColor(context, R.attr.folderPaginationColor)); mDotRadius = getResources().getDimension(R.dimen.page_indicator_dot_size) / 2; if (SHOW_DELIGHTFUL_PAGINATION_FOLDER.get()) { mPageIndicatorSize = getResources().getDimension( R.dimen.page_indicator_size); mPageIndicatorRadius = mPageIndicatorSize / 2; mPageIndicatorDrawable = context.getDrawable(R.drawable.page_indicator); mPageIndicatorDrawable.setBounds(0, 0, (int) mPageIndicatorSize, (int) mPageIndicatorSize); mCircleGap = DOT_GAP_FACTOR_FLOAT * mDotRadius; } else { mPageIndicatorSize = 0; mPageIndicatorRadius = 0; mPageIndicatorDrawable = null; mCircleGap = DOT_GAP_FACTOR * mDotRadius; } mPageIndicatorSize = getResources().getDimension( R.dimen.page_indicator_current_page_indicator_size); if (!SHOW_DELIGHTFUL_PAGINATION_FOLDER.get()) { setOutlineProvider(new MyOutlineProver()); } Loading Loading @@ -308,16 +320,19 @@ public class PageIndicatorDots extends View implements PageIndicator { mPaginationPaint.setAlpha(PAGE_INDICATOR_ALPHA); if (SHOW_DELIGHTFUL_PAGINATION_FOLDER.get()) { RectF currRect = getActiveRect(); int scrollPerPage = getScrollPerPage(); // Moves the canvas to start at the top left corner of the page indicator canvas.translate(currRect.left, currRect.top); int scrollPerPage = getScrollPerPage(); // This IF is to avoid division by 0 if (scrollPerPage != 0) { int delta = mCurrentScroll % scrollPerPage; canvas.rotate((INDICATOR_ROTATION * delta) / scrollPerPage, currRect.centerX(), currRect.centerY()); mPageIndicatorRadius, mPageIndicatorRadius); } canvas.drawRect(currRect, mPaginationPaint); mPageIndicatorDrawable.draw(canvas); } else { canvas.drawRoundRect(getActiveRect(), mDotRadius, mDotRadius, mPaginationPaint); } Loading @@ -334,7 +349,7 @@ public class PageIndicatorDots extends View implements PageIndicator { float startXIndicator = ((getWidth() - (mNumPages * mCircleGap) + mDotRadius) / 2) - getOffset(); float indicatorPosition = startXIndicator + getIndicatorScrollDistance() + (mPageIndicatorSize / 2); + mPageIndicatorRadius; // If the indicator gets close enough to a dot then we change the radius // of the dot based on how close the indicator is to it. Loading Loading @@ -391,7 +406,7 @@ public class PageIndicatorDots extends View implements PageIndicator { * the indicator is centered in with the indicator circles */ private float getOffset() { return (mPageIndicatorSize / 2) - mDotRadius; return mPageIndicatorRadius - mDotRadius; } /** Loading