X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/5f2820355d53973f8c577516533fca069464a58b..6b84d83b3544f8de4e56186f6ecbccd3d612702b:/src/com/owncloud/android/utils/DisplayUtils.java diff --git a/src/com/owncloud/android/utils/DisplayUtils.java b/src/com/owncloud/android/utils/DisplayUtils.java index 7030c87f..3ae36e44 100644 --- a/src/com/owncloud/android/utils/DisplayUtils.java +++ b/src/com/owncloud/android/utils/DisplayUtils.java @@ -35,11 +35,15 @@ import java.util.Vector; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; +import android.graphics.Color; import android.graphics.Point; +import android.graphics.PorterDuff; import android.os.Build; import android.text.format.DateUtils; import android.view.Display; import android.webkit.MimeTypeMap; +import android.widget.ProgressBar; +import android.widget.SeekBar; import com.owncloud.android.MainApp; import com.owncloud.android.R; @@ -373,4 +377,33 @@ public class DisplayUtils { return size; } + /** + * sets the coloring of the given progress bar to color_accent. + * + * @param progressBar the progress bar to be colored + */ + public static void colorPreLollipopHorizontalProgressBar(ProgressBar progressBar) { + if (progressBar != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + int color = progressBar.getResources().getColor(R.color.color_accent); + progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); + progressBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); + } + } + + /** + * sets the coloring of the given seek bar to color_accent. + * + * @param seekBar the seek bar to be colored + */ + public static void colorPreLollipopHorizontalSeekBar(SeekBar seekBar) { + if (seekBar != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + colorPreLollipopHorizontalProgressBar(seekBar); + + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + int color = seekBar.getResources().getColor(R.color.color_accent); + seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN); + seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN); + } + } + } }