Example usage for android.widget ProgressBar getResources

List of usage examples for android.widget ProgressBar getResources

Introduction

In this page you can find the example usage for android.widget ProgressBar getResources.

Prototype

public Resources getResources() 

Source Link

Document

Returns the resources associated with this view.

Usage

From source file:com.synox.android.utils.DisplayUtils.java

/**
 * sets the coloring of the given progress bar to color_accent.
 *
 * @param progressBar the progress bar to be colored
 *///  w  ww.  j a va 2 s .  c  o  m
public static void colorPreLollipopHorizontalProgressBar(ProgressBar progressBar) {
    if (progressBar != null && Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
        int color = progressBar.getResources().getColor(R.color.accent);
        progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
        progressBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    }
}

From source file:com.cerema.cloud2.utils.DisplayUtils.java

/**
 * sets the coloring of the given progress bar to color_accent.
 *
 * @param progressBar the progress bar to be colored
 *//*  ww  w.  j  a  v a2  s  .c  om*/
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);
    }
}