修改点的颜色
This commit is contained in:
@@ -24,17 +24,24 @@ import android.animation.ValueAnimator;
|
|||||||
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.Outline;
|
import android.graphics.Outline;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Property;
|
import android.util.Property;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewOutlineProvider;
|
import android.view.ViewOutlineProvider;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
import android.view.animation.OvershootInterpolator;
|
import android.view.animation.OvershootInterpolator;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
import com.android.uiuios.DeviceProfile;
|
||||||
|
import com.android.uiuios.Insettable;
|
||||||
|
import com.android.uiuios.Launcher;
|
||||||
import com.android.uiuios.R;
|
import com.android.uiuios.R;
|
||||||
import com.android.uiuios.Utilities;
|
import com.android.uiuios.Utilities;
|
||||||
import com.android.uiuios.util.Themes;
|
import com.android.uiuios.util.Themes;
|
||||||
@@ -43,7 +50,7 @@ import com.android.uiuios.util.Themes;
|
|||||||
* {@link PageIndicator} which shows dots per page. The active page is shown with the current
|
* {@link PageIndicator} which shows dots per page. The active page is shown with the current
|
||||||
* accent color.
|
* accent color.
|
||||||
*/
|
*/
|
||||||
public class PageIndicatorDots extends View implements PageIndicator {
|
public class PageIndicatorDots extends View implements PageIndicator , Insettable {
|
||||||
|
|
||||||
private static final float SHIFT_PER_ANIMATION = 0.5f;
|
private static final float SHIFT_PER_ANIMATION = 0.5f;
|
||||||
private static final float SHIFT_THRESHOLD = 0.1f;
|
private static final float SHIFT_THRESHOLD = 0.1f;
|
||||||
@@ -97,6 +104,8 @@ public class PageIndicatorDots extends View implements PageIndicator {
|
|||||||
|
|
||||||
private float[] mEntryAnimationRadiusFactors;
|
private float[] mEntryAnimationRadiusFactors;
|
||||||
|
|
||||||
|
private Launcher mLauncher;
|
||||||
|
|
||||||
public PageIndicatorDots(Context context) {
|
public PageIndicatorDots(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
}
|
}
|
||||||
@@ -113,9 +122,11 @@ public class PageIndicatorDots extends View implements PageIndicator {
|
|||||||
mDotRadius = getResources().getDimension(R.dimen.page_indicator_dot_size) / 2;
|
mDotRadius = getResources().getDimension(R.dimen.page_indicator_dot_size) / 2;
|
||||||
setOutlineProvider(new MyOutlineProver());
|
setOutlineProvider(new MyOutlineProver());
|
||||||
|
|
||||||
mActiveColor = Themes.getColorAccent(context);
|
// mActiveColor = Themes.getColorAccent(context);
|
||||||
mInActiveColor = Themes.getAttrColor(context, android.R.attr.colorControlHighlight);
|
// mInActiveColor = Themes.getAttrColor(context, android.R.attr.colorControlHighlight);
|
||||||
|
mActiveColor = Color.WHITE;
|
||||||
|
mInActiveColor = Color.LTGRAY;
|
||||||
|
//点的颜色
|
||||||
mIsRtl = Utilities.isRtl(getResources());
|
mIsRtl = Utilities.isRtl(getResources());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +137,9 @@ public class PageIndicatorDots extends View implements PageIndicator {
|
|||||||
currentScroll = totalScroll - currentScroll;
|
currentScroll = totalScroll - currentScroll;
|
||||||
}
|
}
|
||||||
int scrollPerPage = totalScroll / (mNumPages - 1);
|
int scrollPerPage = totalScroll / (mNumPages - 1);
|
||||||
|
if (scrollPerPage == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int pageToLeft = currentScroll / scrollPerPage;
|
int pageToLeft = currentScroll / scrollPerPage;
|
||||||
int pageToLeftScroll = pageToLeft * scrollPerPage;
|
int pageToLeftScroll = pageToLeft * scrollPerPage;
|
||||||
int pageToRightScroll = pageToLeftScroll + scrollPerPage;
|
int pageToRightScroll = pageToLeftScroll + scrollPerPage;
|
||||||
@@ -300,6 +314,25 @@ public class PageIndicatorDots extends View implements PageIndicator {
|
|||||||
return sTempRect;
|
return sTempRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInsets(Rect insets) {
|
||||||
|
mLauncher = Launcher.getLauncher(getContext());
|
||||||
|
DeviceProfile grid = mLauncher.getDeviceProfile();
|
||||||
|
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
|
||||||
|
|
||||||
|
if (grid.isVerticalBarLayout()) {
|
||||||
|
Rect padding = grid.workspacePadding;
|
||||||
|
lp.leftMargin = padding.left + grid.workspaceCellPaddingXPx;
|
||||||
|
lp.rightMargin = padding.right + grid.workspaceCellPaddingXPx;
|
||||||
|
lp.bottomMargin = padding.bottom;
|
||||||
|
} else {
|
||||||
|
lp.leftMargin = lp.rightMargin = 0;
|
||||||
|
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||||
|
lp.bottomMargin = grid.hotseatBarSizePx + insets.bottom;
|
||||||
|
}
|
||||||
|
setLayoutParams(lp);
|
||||||
|
}
|
||||||
|
|
||||||
private class MyOutlineProver extends ViewOutlineProvider {
|
private class MyOutlineProver extends ViewOutlineProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user