Java源码示例:org.adw.library.widgets.discreteseekbar.internal.compat.SeekBarCompat
示例1
public void setFloatOffset(int x) {
mOffset = x;
int centerDiffX = mMarker.getMeasuredWidth() / 2;
int offset = (x - centerDiffX);
mMarker.offsetLeftAndRight(offset - mMarker.getLeft());
//Without hardware acceleration (or API levels<11), offsetting a view seems to NOT invalidate the proper area.
//We should calc the proper invalidate Rect but this will be for now...
if (!SeekBarCompat.isHardwareAccelerated(this)) {
invalidate();
}
}
示例2
private void updateThumbPos(int posX) {
int thumbWidth = mThumb.getIntrinsicWidth();
int halfThumb = thumbWidth / 2;
int start;
if (isRtl()) {
start = getWidth() - getPaddingRight() - mAddedTouchBounds;
posX = start - posX - thumbWidth;
} else {
start = getPaddingLeft() + mAddedTouchBounds;
posX = start + posX;
}
mThumb.copyBounds(mInvalidateRect);
mThumb.setBounds(posX, mInvalidateRect.top, posX + thumbWidth, mInvalidateRect.bottom);
if (isRtl()) {
mScrubber.getBounds().right = start - halfThumb;
mScrubber.getBounds().left = posX + halfThumb;
} else {
mScrubber.getBounds().left = start + halfThumb;
mScrubber.getBounds().right = posX + halfThumb;
}
final Rect finalBounds = mTempRect;
mThumb.copyBounds(finalBounds);
if (!isInEditMode()) {
mIndicator.move(finalBounds.centerX());
}
mInvalidateRect.inset(-mAddedTouchBounds, -mAddedTouchBounds);
finalBounds.inset(-mAddedTouchBounds, -mAddedTouchBounds);
mInvalidateRect.union(finalBounds);
SeekBarCompat.setHotspotBounds(mRipple, finalBounds.left, finalBounds.top, finalBounds.right, finalBounds.bottom);
invalidate(mInvalidateRect);
}
示例3
public void setFloatOffset(int x) {
mOffset = x;
int centerDiffX = mMarker.getMeasuredWidth() / 2;
int offset = (x - centerDiffX);
mMarker.offsetLeftAndRight(offset - mMarker.getLeft());
//Without hardware acceleration (or API levels<11), offsetting a view seems to NOT invalidate the proper area.
//We should calc the proper invalidate Rect but this will be for now...
if (!SeekBarCompat.isHardwareAccelerated(this)) {
invalidate();
}
}
示例4
private void updateThumbPos(int posX) {
int thumbWidth = mThumb.getIntrinsicWidth();
int halfThumb = thumbWidth / 2;
int start;
if (isRtl()) {
start = getWidth() - getPaddingRight() - mAddedTouchBounds;
posX = start - posX - thumbWidth;
} else {
start = getPaddingLeft() + mAddedTouchBounds;
posX = start + posX;
}
mThumb.copyBounds(mInvalidateRect);
mThumb.setBounds(posX, mInvalidateRect.top, posX + thumbWidth, mInvalidateRect.bottom);
if (isRtl()) {
mScrubber.getBounds().right = start - halfThumb;
mScrubber.getBounds().left = posX + halfThumb;
} else {
mScrubber.getBounds().left = start + halfThumb;
mScrubber.getBounds().right = posX + halfThumb;
}
final Rect finalBounds = mTempRect;
mThumb.copyBounds(finalBounds);
if (!isInEditMode()) {
mIndicator.move(finalBounds.centerX());
}
mInvalidateRect.inset(-mAddedTouchBounds, -mAddedTouchBounds);
finalBounds.inset(-mAddedTouchBounds, -mAddedTouchBounds);
mInvalidateRect.union(finalBounds);
SeekBarCompat.setHotspotBounds(mRipple, finalBounds.left, finalBounds.top, finalBounds.right, finalBounds.bottom);
invalidate(mInvalidateRect);
}
示例5
public void setFloatOffset(int x) {
mOffset = x;
int centerDiffX = mMarker.getMeasuredWidth() / 2;
int offset = (x - centerDiffX);
mMarker.offsetLeftAndRight(offset - mMarker.getLeft());
//Without hardware acceleration (or API levels<11), offsetting a view seems to NOT invalidate the proper area.
//We should calc the proper invalidate Rect but this will be for now...
if (!SeekBarCompat.isHardwareAccelerated(this)) {
invalidate();
}
}
示例6
private void updateThumbPos(int posX) {
int thumbWidth = mThumb.getIntrinsicWidth();
int halfThumb = thumbWidth / 2;
int start;
if (isRtl()) {
start = getWidth() - getPaddingRight() - mAddedTouchBounds;
posX = start - posX - thumbWidth;
} else {
start = getPaddingLeft() + mAddedTouchBounds;
posX = start + posX;
}
mThumb.copyBounds(mInvalidateRect);
mThumb.setBounds(posX, mInvalidateRect.top, posX + thumbWidth, mInvalidateRect.bottom);
if (isRtl()) {
mScrubber.getBounds().right = start - halfThumb;
mScrubber.getBounds().left = posX + halfThumb;
} else {
mScrubber.getBounds().left = start + halfThumb;
mScrubber.getBounds().right = posX + halfThumb;
}
final Rect finalBounds = mTempRect;
mThumb.copyBounds(finalBounds);
if (!isInEditMode()) {
mIndicator.move(finalBounds.centerX());
}
mInvalidateRect.inset(-mAddedTouchBounds, -mAddedTouchBounds);
finalBounds.inset(-mAddedTouchBounds, -mAddedTouchBounds);
mInvalidateRect.union(finalBounds);
SeekBarCompat.setHotspotBounds(mRipple, finalBounds.left, finalBounds.top, finalBounds.right, finalBounds.bottom);
invalidate(mInvalidateRect);
}
示例7
public void setFloatOffset(int x) {
mOffset = x;
int centerDiffX = mMarker.getMeasuredWidth() / 2;
int offset = (x - centerDiffX);
mMarker.offsetLeftAndRight(offset - mMarker.getLeft());
//Without hardware acceleration (or API levels<11), offsetting a view seems to NOT invalidate the proper area.
//We should calc the proper invalidate Rect but this will be for now...
if (!SeekBarCompat.isHardwareAccelerated(this)) {
invalidate();
}
}
示例8
private void updateThumbPos(int posX) {
int thumbWidth = mThumb.getIntrinsicWidth();
int halfThumb = thumbWidth / 2;
int start;
if (isRtl()) {
start = getWidth() - getPaddingRight() - mAddedTouchBounds;
posX = start - posX - thumbWidth;
} else {
start = getPaddingLeft() + mAddedTouchBounds;
posX = start + posX;
}
mThumb.copyBounds(mInvalidateRect);
mThumb.setBounds(posX, mInvalidateRect.top, posX + thumbWidth, mInvalidateRect.bottom);
if (isRtl()) {
mScrubber.getBounds().right = start - halfThumb;
mScrubber.getBounds().left = posX + halfThumb;
} else {
mScrubber.getBounds().left = start + halfThumb;
mScrubber.getBounds().right = posX + halfThumb;
}
final Rect finalBounds = mTempRect;
mThumb.copyBounds(finalBounds);
if (!isInEditMode()) {
mIndicator.move(finalBounds.centerX());
}
mInvalidateRect.inset(-mAddedTouchBounds, -mAddedTouchBounds);
finalBounds.inset(-mAddedTouchBounds, -mAddedTouchBounds);
mInvalidateRect.union(finalBounds);
SeekBarCompat.setHotspotBounds(mRipple, finalBounds.left, finalBounds.top, finalBounds.right, finalBounds.bottom);
invalidate(mInvalidateRect);
}
示例9
public void setFloatOffset(int x) {
mOffset = x;
int centerDiffX = mMarker.getMeasuredWidth() / 2;
int offset = (x - centerDiffX);
mMarker.offsetLeftAndRight(offset - mMarker.getLeft());
//Without hardware acceleration (or API levels<11), offsetting a view seems to NOT invalidate the proper area.
//We should calc the proper invalidate Rect but this will be for now...
if (!SeekBarCompat.isHardwareAccelerated(this)) {
invalidate();
}
}
示例10
private void updateThumbPos(int posX) {
int thumbWidth = mThumb.getIntrinsicWidth();
int halfThumb = thumbWidth / 2;
int start;
if (isRtl()) {
start = getWidth() - getPaddingRight() - mAddedTouchBounds;
posX = start - posX - thumbWidth;
} else {
start = getPaddingLeft() + mAddedTouchBounds;
posX = start + posX;
}
mThumb.copyBounds(mInvalidateRect);
mThumb.setBounds(posX, mInvalidateRect.top, posX + thumbWidth, mInvalidateRect.bottom);
if (isRtl()) {
mScrubber.getBounds().right = start - halfThumb;
mScrubber.getBounds().left = posX + halfThumb;
} else {
mScrubber.getBounds().left = start + halfThumb;
mScrubber.getBounds().right = posX + halfThumb;
}
final Rect finalBounds = mTempRect;
mThumb.copyBounds(finalBounds);
if (!isInEditMode()) {
mIndicator.move(finalBounds.centerX());
}
mInvalidateRect.inset(-mAddedTouchBounds, -mAddedTouchBounds);
finalBounds.inset(-mAddedTouchBounds, -mAddedTouchBounds);
mInvalidateRect.union(finalBounds);
SeekBarCompat.setHotspotBounds(mRipple, finalBounds.left, finalBounds.top, finalBounds.right, finalBounds.bottom);
invalidate(mInvalidateRect);
}
示例11
public void setFloatOffset(int x) {
mOffset = x;
int centerDiffX = mMarker.getMeasuredWidth() / 2;
int offset = (x - centerDiffX);
mMarker.offsetLeftAndRight(offset - mMarker.getLeft());
//Without hardware acceleration (or API levels<11), offsetting a view seems to NOT invalidate the proper area.
//We should calc the proper invalidate Rect but this will be for now...
if (!SeekBarCompat.isHardwareAccelerated(this)) {
invalidate();
}
}
示例12
private void updateThumbPos(int posX) {
int thumbWidth = mThumb.getIntrinsicWidth();
int halfThumb = thumbWidth / 2;
int start;
if (isRtl()) {
start = getWidth() - getPaddingRight() - mAddedTouchBounds;
posX = start - posX - thumbWidth;
} else {
start = getPaddingLeft() + mAddedTouchBounds;
posX = start + posX;
}
mThumb.copyBounds(mInvalidateRect);
mThumb.setBounds(posX, mInvalidateRect.top, posX + thumbWidth, mInvalidateRect.bottom);
if (isRtl()) {
mScrubber.getBounds().right = start - halfThumb;
mScrubber.getBounds().left = posX + halfThumb;
} else {
mScrubber.getBounds().left = start + halfThumb;
mScrubber.getBounds().right = posX + halfThumb;
}
final Rect finalBounds = mTempRect;
mThumb.copyBounds(finalBounds);
if (!isInEditMode()) {
mIndicator.move(finalBounds.centerX());
}
mInvalidateRect.inset(-mAddedTouchBounds, -mAddedTouchBounds);
finalBounds.inset(-mAddedTouchBounds, -mAddedTouchBounds);
mInvalidateRect.union(finalBounds);
SeekBarCompat.setHotspotBounds(mRipple, finalBounds.left, finalBounds.top, finalBounds.right, finalBounds.bottom);
invalidate(mInvalidateRect);
}
示例13
public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue) {
super(context, attrs, defStyleAttr);
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
R.attr.discreteSeekBarStyle, R.style.DefaultSeekBar);
int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
int textAppearanceId = a.getResourceId(R.styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
R.style.DefaultIndicatorTextAppearance);
mNumber = new TextView(context);
//Add some padding to this textView so the bubble has some space to breath
mNumber.setPadding(padding, 0, padding, 0);
mNumber.setTextAppearance(context, textAppearanceId);
mNumber.setGravity(Gravity.CENTER);
mNumber.setText(maxValue);
mNumber.setMaxLines(1);
mNumber.setSingleLine(true);
SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
mNumber.setVisibility(View.INVISIBLE);
//add some padding for the elevation shadow not to be clipped
//I'm sure there are better ways of doing this...
setPadding(padding, padding, padding, padding);
resetSizes(maxValue);
mSeparation = (int) (SEPARATION_DP * displayMetrics.density);
int thumbSize = (int) (ThumbDrawable.DEFAULT_SIZE_DP * displayMetrics.density);
ColorStateList color = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_indicatorColor);
mMarkerDrawable = new MarkerDrawable(color, thumbSize);
mMarkerDrawable.setCallback(this);
mMarkerDrawable.setMarkerListener(this);
mMarkerDrawable.setExternalOffset(padding);
//Elevation for anroid 5+
float elevation = a.getDimension(R.styleable.DiscreteSeekBar_dsb_indicatorElevation, ELEVATION_DP * displayMetrics.density);
ViewCompat.setElevation(this, elevation);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
}
a.recycle();
}
示例14
private boolean isInScrollingContainer() {
return SeekBarCompat.isInScrollingContainer(getParent());
}
示例15
public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue) {
super(context, attrs, defStyleAttr);
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
R.attr.discreteSeekBarStyle, R.style.DefaultSeekBar);
int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
int textAppearanceId = a.getResourceId(R.styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
R.style.DefaultIndicatorTextAppearance);
mNumber = new TextView(context);
//Add some padding to this textView so the bubble has some space to breath
mNumber.setPadding(padding, 0, padding, 0);
mNumber.setTextAppearance(context, textAppearanceId);
mNumber.setGravity(Gravity.CENTER);
mNumber.setText(maxValue);
mNumber.setMaxLines(1);
mNumber.setSingleLine(true);
SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
mNumber.setVisibility(View.INVISIBLE);
//add some padding for the elevation shadow not to be clipped
//I'm sure there are better ways of doing this...
setPadding(padding, padding, padding, padding);
resetSizes(maxValue);
mSeparation = (int) (SEPARATION_DP * displayMetrics.density);
int thumbSize = (int) (ThumbDrawable.DEFAULT_SIZE_DP * displayMetrics.density);
ColorStateList color = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_indicatorColor);
mMarkerDrawable = new MarkerDrawable(color, thumbSize);
mMarkerDrawable.setCallback(this);
mMarkerDrawable.setMarkerListener(this);
mMarkerDrawable.setExternalOffset(padding);
//Elevation for anroid 5+
float elevation = a.getDimension(R.styleable.DiscreteSeekBar_dsb_indicatorElevation, ELEVATION_DP * displayMetrics.density);
ViewCompat.setElevation(this, elevation);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
}
a.recycle();
}
示例16
private boolean isInScrollingContainer() {
return SeekBarCompat.isInScrollingContainer(getParent());
}
示例17
public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue) {
super(context, attrs, defStyleAttr);
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
R.attr.discreteSeekBarStyle, R.style.DefaultSeekBar);
int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
int textAppearanceId = a.getResourceId(R.styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
R.style.DefaultIndicatorTextAppearance);
mNumber = new TextView(context);
//Add some padding to this textView so the bubble has some space to breath
mNumber.setPadding(padding, 0, padding, 0);
mNumber.setTextAppearance(context, textAppearanceId);
mNumber.setGravity(Gravity.CENTER);
mNumber.setText(maxValue);
mNumber.setMaxLines(1);
mNumber.setSingleLine(true);
SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
mNumber.setVisibility(View.INVISIBLE);
//add some padding for the elevation shadow not to be clipped
//I'm sure there are better ways of doing this...
setPadding(padding, padding, padding, padding);
resetSizes(maxValue);
mSeparation = (int) (SEPARATION_DP * displayMetrics.density);
int thumbSize = (int) (ThumbDrawable.DEFAULT_SIZE_DP * displayMetrics.density);
ColorStateList color = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_indicatorColor);
mMarkerDrawable = new MarkerDrawable(color, thumbSize);
mMarkerDrawable.setCallback(this);
mMarkerDrawable.setMarkerListener(this);
mMarkerDrawable.setExternalOffset(padding);
//Elevation for anroid 5+
float elevation = a.getDimension(R.styleable.DiscreteSeekBar_dsb_indicatorElevation, ELEVATION_DP * displayMetrics.density);
ViewCompat.setElevation(this, elevation);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
}
a.recycle();
}
示例18
private boolean isInScrollingContainer() {
return SeekBarCompat.isInScrollingContainer(getParent());
}
示例19
public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue) {
super(context, attrs, defStyleAttr);
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
R.attr.discreteSeekBarStyle, R.style.Widget_DiscreteSeekBar);
int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
int textAppearanceId = a.getResourceId(R.styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
R.style.Widget_DiscreteIndicatorTextAppearance);
mNumber = new TextView(context);
//Add some padding to this textView so the bubble has some space to breath
mNumber.setPadding(padding, 0, padding, 0);
mNumber.setTextAppearance(context, textAppearanceId);
mNumber.setGravity(Gravity.CENTER);
mNumber.setText(maxValue);
mNumber.setMaxLines(1);
mNumber.setSingleLine(true);
SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
mNumber.setVisibility(View.INVISIBLE);
//add some padding for the elevation shadow not to be clipped
//I'm sure there are better ways of doing this...
setPadding(padding, padding, padding, padding);
resetSizes(maxValue);
mSeparation = (int) (SEPARATION_DP * displayMetrics.density);
int thumbSize = (int) (ThumbDrawable.DEFAULT_SIZE_DP * displayMetrics.density);
ColorStateList color = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_indicatorColor);
mMarkerDrawable = new MarkerDrawable(color, thumbSize);
mMarkerDrawable.setCallback(this);
mMarkerDrawable.setMarkerListener(this);
mMarkerDrawable.setExternalOffset(padding);
//Elevation for anroid 5+
float elevation = a.getDimension(R.styleable.DiscreteSeekBar_dsb_indicatorElevation, ELEVATION_DP * displayMetrics.density);
ViewCompat.setElevation(this, elevation);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
}
a.recycle();
}
示例20
private boolean isInScrollingContainer() {
return SeekBarCompat.isInScrollingContainer(getParent());
}
示例21
public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue, int thumbSize, int separation) {
super(context, attrs, defStyleAttr);
//as we're reading the parent DiscreteSeekBar attributes, it may wrongly set this view's visibility.
setVisibility(View.VISIBLE);
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
R.attr.discreteSeekBarStyle, R.style.Widget_DiscreteSeekBar);
int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
int textAppearanceId = a.getResourceId(R.styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
R.style.Widget_DiscreteIndicatorTextAppearance);
mNumber = new TextView(context);
//Add some padding to this textView so the bubble has some space to breath
mNumber.setPadding(padding, 0, padding, 0);
mNumber.setTextAppearance(context, textAppearanceId);
mNumber.setGravity(Gravity.CENTER);
mNumber.setText(maxValue);
mNumber.setMaxLines(1);
mNumber.setSingleLine(true);
SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
mNumber.setVisibility(View.INVISIBLE);
//add some padding for the elevation shadow not to be clipped
//I'm sure there are better ways of doing this...
setPadding(padding, padding, padding, padding);
resetSizes(maxValue);
mSeparation = separation;
ColorStateList color = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_indicatorColor);
mMarkerDrawable = new MarkerDrawable(color, thumbSize);
mMarkerDrawable.setCallback(this);
mMarkerDrawable.setMarkerListener(this);
mMarkerDrawable.setExternalOffset(padding);
//Elevation for anroid 5+
float elevation = a.getDimension(R.styleable.DiscreteSeekBar_dsb_indicatorElevation, ELEVATION_DP * displayMetrics.density);
ViewCompat.setElevation(this, elevation);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
}
a.recycle();
}
示例22
private boolean isInScrollingContainer() {
return SeekBarCompat.isInScrollingContainer(getParent());
}
示例23
public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue) {
super(context, attrs, defStyleAttr);
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
R.attr.discreteSeekBarStyle, R.style.DefaultSeekBar);
int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
int textAppearanceId = a.getResourceId(R.styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
R.style.DefaultIndicatorTextAppearance);
mNumber = new TextView(context);
//Add some padding to this textView so the bubble has some space to breath
mNumber.setPadding(padding, 0, padding, 0);
mNumber.setTextAppearance(context, textAppearanceId);
mNumber.setGravity(Gravity.CENTER);
mNumber.setText(maxValue);
mNumber.setMaxLines(1);
mNumber.setSingleLine(true);
SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
mNumber.setVisibility(View.INVISIBLE);
//add some padding for the elevation shadow not to be clipped
//I'm sure there are better ways of doing this...
setPadding(padding, padding, padding, padding);
resetSizes(maxValue);
mSeparation = (int) (SEPARATION_DP * displayMetrics.density);
int thumbSize = (int) (ThumbDrawable.DEFAULT_SIZE_DP * displayMetrics.density);
ColorStateList color = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_indicatorColor);
mMarkerDrawable = new MarkerDrawable(color, thumbSize);
mMarkerDrawable.setCallback(this);
mMarkerDrawable.setMarkerListener(this);
mMarkerDrawable.setExternalOffset(padding);
//Elevation for anroid 5+
float elevation = a.getDimension(R.styleable.DiscreteSeekBar_dsb_indicatorElevation, ELEVATION_DP * displayMetrics.density);
ViewCompat.setElevation(this, elevation);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
}
a.recycle();
}
示例24
private boolean isInScrollingContainer() {
return SeekBarCompat.isInScrollingContainer(getParent());
}
示例25
/**
* Sets the color of the seekbar ripple
*
* @param colorStateList The ColorStateList the track ripple will be changed to
*/
public void setRippleColor(@NonNull ColorStateList colorStateList) {
SeekBarCompat.setRippleColor(mRipple, colorStateList);
}