Java Code Examples for android.widget.SeekBar#setThumbTintList()
The following examples show how to use
android.widget.SeekBar#setThumbTintList() .
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: Easel.java From andela-crypto-app with Apache License 2.0 | 6 votes |
/** * Tint the {@link SeekBar} * * @param seekBar the seekbar * @param color the color */ public static void tint(@NonNull SeekBar seekBar, @ColorInt int color) { ColorStateList s1 = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { seekBar.setThumbTintList(s1); seekBar.setProgressTintList(s1); } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { Drawable progressDrawable = DrawableCompat.wrap(seekBar.getProgressDrawable()); seekBar.setProgressDrawable(progressDrawable); DrawableCompat.setTintList(progressDrawable, s1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { Drawable thumbDrawable = DrawableCompat.wrap(seekBar.getThumb()); DrawableCompat.setTintList(thumbDrawable, s1); seekBar.setThumb(thumbDrawable); } } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mode = PorterDuff.Mode.MULTIPLY; } if (seekBar.getIndeterminateDrawable() != null) seekBar.getIndeterminateDrawable().setColorFilter(color, mode); if (seekBar.getProgressDrawable() != null) seekBar.getProgressDrawable().setColorFilter(color, mode); } }
Example 2
Source File: MDTintHelper.java From NewsMe with Apache License 2.0 | 6 votes |
public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color) { ColorStateList s1 = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { seekBar.setThumbTintList(s1); seekBar.setProgressTintList(s1); } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { Drawable progressDrawable = DrawableCompat.wrap(seekBar.getProgressDrawable()); seekBar.setProgressDrawable(progressDrawable); DrawableCompat.setTintList(progressDrawable, s1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { Drawable thumbDrawable = DrawableCompat.wrap(seekBar.getThumb()); DrawableCompat.setTintList(thumbDrawable, s1); seekBar.setThumb(thumbDrawable); } } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mode = PorterDuff.Mode.MULTIPLY; } if (seekBar.getIndeterminateDrawable() != null) seekBar.getIndeterminateDrawable().setColorFilter(color, mode); if (seekBar.getProgressDrawable() != null) seekBar.getProgressDrawable().setColorFilter(color, mode); } }
Example 3
Source File: MDTintHelper.java From talk-android with MIT License | 6 votes |
@SuppressLint("NewApi") public static void setTint(SeekBar seekBar, int color) { ColorStateList s1 = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { seekBar.setThumbTintList(s1); seekBar.setProgressTintList(s1); } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { Drawable progressDrawable = DrawableCompat.wrap(seekBar.getProgressDrawable()); seekBar.setProgressDrawable(progressDrawable); DrawableCompat.setTintList(progressDrawable, s1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { Drawable thumbDrawable = DrawableCompat.wrap(seekBar.getThumb()); DrawableCompat.setTintList(thumbDrawable, s1); seekBar.setThumb(thumbDrawable); } } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mode = PorterDuff.Mode.MULTIPLY; } if (seekBar.getIndeterminateDrawable() != null) seekBar.getIndeterminateDrawable().setColorFilter(color, mode); if (seekBar.getProgressDrawable() != null) seekBar.getProgressDrawable().setColorFilter(color, mode); } }
Example 4
Source File: EmTintUtils.java From AndroidTint with Apache License 2.0 | 6 votes |
public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color) { ColorStateList s1 = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { seekBar.setThumbTintList(s1); seekBar.setProgressTintList(s1); } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { Drawable progressDrawable = DrawableCompat.wrap(seekBar.getProgressDrawable()); seekBar.setProgressDrawable(progressDrawable); DrawableCompat.setTintList(progressDrawable, s1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { Drawable thumbDrawable = DrawableCompat.wrap(seekBar.getThumb()); DrawableCompat.setTintList(thumbDrawable, s1); seekBar.setThumb(thumbDrawable); } } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mode = PorterDuff.Mode.MULTIPLY; } if (seekBar.getIndeterminateDrawable() != null) seekBar.getIndeterminateDrawable().setColorFilter(color, mode); if (seekBar.getProgressDrawable() != null) seekBar.getProgressDrawable().setColorFilter(color, mode); } }
Example 5
Source File: TintHelper.java From a with GNU General Public License v3.0 | 5 votes |
public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color, boolean useDarker) { final ColorStateList s1 = getDisabledColorStateList(color, ContextCompat.getColor(seekBar.getContext(), useDarker ? R.color.ate_control_disabled_dark : R.color.ate_control_disabled_light)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { seekBar.setThumbTintList(s1); seekBar.setProgressTintList(s1); } else { Drawable progressDrawable = createTintedDrawable(seekBar.getProgressDrawable(), s1); seekBar.setProgressDrawable(progressDrawable); Drawable thumbDrawable = createTintedDrawable(seekBar.getThumb(), s1); seekBar.setThumb(thumbDrawable); } }
Example 6
Source File: TintHelper.java From MyBookshelf with GNU General Public License v3.0 | 5 votes |
public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color, boolean useDarker) { final ColorStateList s1 = getDisabledColorStateList(color, ContextCompat.getColor(seekBar.getContext(), useDarker ? R.color.ate_control_disabled_dark : R.color.ate_control_disabled_light)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { seekBar.setThumbTintList(s1); seekBar.setProgressTintList(s1); } else { Drawable progressDrawable = createTintedDrawable(seekBar.getProgressDrawable(), s1); seekBar.setProgressDrawable(progressDrawable); Drawable thumbDrawable = createTintedDrawable(seekBar.getThumb(), s1); seekBar.setThumb(thumbDrawable); } }
Example 7
Source File: TintHelper.java From APlayer with GNU General Public License v3.0 | 5 votes |
public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color, boolean useDarker) { final ColorStateList s1 = getDisabledColorStateList(color, ContextCompat.getColor(seekBar.getContext(), useDarker ? R.color.ate_control_disabled_dark : R.color.ate_control_disabled_light)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { seekBar.setThumbTintList(s1); seekBar.setProgressTintList(s1); } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { Drawable progressDrawable = createTintedDrawable(seekBar.getProgressDrawable(), s1); seekBar.setProgressDrawable(progressDrawable); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { Drawable thumbDrawable = createTintedDrawable(seekBar.getThumb(), s1); seekBar.setThumb(thumbDrawable); } } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mode = PorterDuff.Mode.MULTIPLY; } if (seekBar.getIndeterminateDrawable() != null) { seekBar.getIndeterminateDrawable().setColorFilter(color, mode); } if (seekBar.getProgressDrawable() != null) { seekBar.getProgressDrawable().setColorFilter(color, mode); } } }
Example 8
Source File: SeekBarColorAdapter.java From Scoops with Apache License 2.0 | 4 votes |
@Override public void applyColor(SeekBar view, @ColorInt int color) { view.setIndeterminateTintList(Utils.colorToStateList(color)); view.setThumbTintList(Utils.colorToStateList(color)); view.setProgressTintList(Utils.colorToStateList(color)); }