Java Code Examples for androidx.core.graphics.drawable.DrawableCompat#setHotspotBounds()
The following examples show how to use
androidx.core.graphics.drawable.DrawableCompat#setHotspotBounds() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseSlider.java From material-components-android with Apache License 2.0 | 5 votes |
private void updateHaloHotspot() { // Set the hotspot as the halo if RippleDrawable is being used. if (!shouldDrawCompatHalo() && getMeasuredWidth() > 0) { final Drawable background = getBackground(); if (background instanceof RippleDrawable) { int x = (int) (normalizeValue(values.get(focusedThumbIdx)) * trackWidth + trackSidePadding); int y = calculateTop(); DrawableCompat.setHotspotBounds( background, x - haloRadius, y - haloRadius, x + haloRadius, y + haloRadius); } } }
Example 2
Source File: DrawableWrapper.java From MHViewer with Apache License 2.0 | 4 votes |
public void setHotspotBounds(int left, int top, int right, int bottom) { DrawableCompat.setHotspotBounds(this.mDrawable, left, top, right, bottom); }
Example 3
Source File: ComparableDrawableWrapper.java From litho with Apache License 2.0 | 4 votes |
@Override public void setHotspotBounds(int left, int top, int right, int bottom) { DrawableCompat.setHotspotBounds(mDrawable, left, top, right, bottom); }
Example 4
Source File: RangeSeekBar.java From RangeSeekBar with MIT License | 4 votes |
/** * Updates the thumb drawable bounds. * * @param w Width of the view, including padding * @param thumb Drawable used for the thumb * @param scale Current progress between 0 and 1 * @param offset Vertical offset for centering. If set to Integer.MIN_VALUE, the current offset will be used. */ private void setThumbPos(int w, Drawable thumb, float scale, WhichThumb which, int offset) { logger.info("setThumbPos(%d, %g, %s, %d)", w, scale, which, offset); int available = (w - mPaddingLeft - mPaddingRight) - getProgressOffset(); available -= mThumbWidth; // The extra space for the thumb to move on the track available += mThumbOffset * 2; final int thumbPos = (int) (scale * available + 0.5f); final int top, bottom; if (offset == Integer.MIN_VALUE) { final Rect oldBounds = thumb.getBounds(); top = oldBounds.top; bottom = oldBounds.bottom; } else { top = offset; bottom = offset + mThumbHeight; } int left = thumbPos; int right = left + mThumbWidth; if (which == WhichThumb.End) { left += getProgressOffset(); right += getProgressOffset(); } final Drawable background = getBackground(); if (background != null && which == mWhichThumb) { final int offsetX = mPaddingLeft - mThumbOffset; final int offsetY = mPaddingTop; background.setBounds( left + offsetX, top + offsetY, right + offsetX, bottom + offsetY ); DrawableCompat.setHotspotBounds( background, left + offsetX, top + offsetY, right + offsetX, bottom + offsetY ); } thumb.setBounds(left, top, right, bottom); }
Example 5
Source File: DrawableWrapper.java From MaterialPreference with Apache License 2.0 | 4 votes |
@Override public void setHotspotBounds(int left, int top, int right, int bottom) { DrawableCompat.setHotspotBounds(mDrawable, left, top, right, bottom); }
Example 6
Source File: PaddingDrawable.java From material with Apache License 2.0 | 4 votes |
@Override public void setHotspotBounds(int left, int top, int right, int bottom) { if(mDrawable != null) DrawableCompat.setHotspotBounds(mDrawable, left, top, right, bottom); }
Example 7
Source File: DrawableWrapper.java From EhViewer with Apache License 2.0 | 4 votes |
public void setHotspotBounds(int left, int top, int right, int bottom) { DrawableCompat.setHotspotBounds(this.mDrawable, left, top, right, bottom); }