修改点的颜色
This commit is contained in:
@@ -24,17 +24,24 @@ import android.animation.ValueAnimator;
|
||||
import android.animation.ValueAnimator.AnimatorUpdateListener;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Property;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.view.animation.Interpolator;
|
||||
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.Utilities;
|
||||
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
|
||||
* 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_THRESHOLD = 0.1f;
|
||||
@@ -97,6 +104,8 @@ public class PageIndicatorDots extends View implements PageIndicator {
|
||||
|
||||
private float[] mEntryAnimationRadiusFactors;
|
||||
|
||||
private Launcher mLauncher;
|
||||
|
||||
public PageIndicatorDots(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -113,9 +122,11 @@ public class PageIndicatorDots extends View implements PageIndicator {
|
||||
mDotRadius = getResources().getDimension(R.dimen.page_indicator_dot_size) / 2;
|
||||
setOutlineProvider(new MyOutlineProver());
|
||||
|
||||
mActiveColor = Themes.getColorAccent(context);
|
||||
mInActiveColor = Themes.getAttrColor(context, android.R.attr.colorControlHighlight);
|
||||
|
||||
// mActiveColor = Themes.getColorAccent(context);
|
||||
// mInActiveColor = Themes.getAttrColor(context, android.R.attr.colorControlHighlight);
|
||||
mActiveColor = Color.WHITE;
|
||||
mInActiveColor = Color.LTGRAY;
|
||||
//点的颜色
|
||||
mIsRtl = Utilities.isRtl(getResources());
|
||||
}
|
||||
|
||||
@@ -126,6 +137,9 @@ public class PageIndicatorDots extends View implements PageIndicator {
|
||||
currentScroll = totalScroll - currentScroll;
|
||||
}
|
||||
int scrollPerPage = totalScroll / (mNumPages - 1);
|
||||
if (scrollPerPage == 0) {
|
||||
return;
|
||||
}
|
||||
int pageToLeft = currentScroll / scrollPerPage;
|
||||
int pageToLeftScroll = pageToLeft * scrollPerPage;
|
||||
int pageToRightScroll = pageToLeftScroll + scrollPerPage;
|
||||
@@ -300,6 +314,25 @@ public class PageIndicatorDots extends View implements PageIndicator {
|
||||
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 {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user