List of usage examples for android.widget ProgressBar getIndeterminateDrawable
public Drawable getIndeterminateDrawable()
Get the drawable used to draw the progress bar in indeterminate mode.
From source file:xyz.klinker.android.article.Utils.java
/** * Changes the progress bar's color.//from ww w . j ava 2 s. com */ static void changeProgressBarColors(ProgressBar progressBar, int color) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrapDrawable = DrawableCompat.wrap(progressBar.getIndeterminateDrawable()); DrawableCompat.setTint(wrapDrawable, color); progressBar.setIndeterminateDrawable(DrawableCompat.unwrap(wrapDrawable)); } else { progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); } }
From source file:arun.com.chromer.browsing.article.util.ArticleUtil.java
/** * Changes the progress bar's color.//from ww w . ja v a 2 s . c o m */ public static void changeProgressBarColors(ProgressBar progressBar, int color) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { Drawable wrapDrawable = DrawableCompat.wrap(progressBar.getIndeterminateDrawable()); DrawableCompat.setTint(wrapDrawable, color); progressBar.setIndeterminateDrawable(DrawableCompat.unwrap(wrapDrawable)); } else { progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); } }
From source file:org.opensilk.common.ui.util.ThemeUtils.java
@TargetApi(21) public static void themeProgressBar2(ProgressBar progressBar, int color) { if (VersionUtils.hasLollipop()) { progressBar.getProgressDrawable().setTint(color); progressBar.getIndeterminateDrawable().setTint(color); } else {/*from w ww . j a va2 s .c om*/ progressBar.getProgressDrawable().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN); progressBar.getIndeterminateDrawable().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN); } }
From source file:com.owncloud.android.utils.ThemeUtils.java
/** * sets the coloring of the given progress bar to color_accent. * * @param progressBar the progress bar to be colored * @param color the color to be used *///from w w w . ja v a 2 s .co m public static void colorHorizontalProgressBar(ProgressBar progressBar, @ColorInt int color) { if (progressBar != null) { progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); progressBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); } }
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 *///from www .ja v a 2s . 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 *//*from w w w. j a va 2 s. co 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.color_accent); progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); progressBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); } }
From source file:com.uprayzner.mediator.adapters.PlanStandsListAdapter.java
private void setProgressColor(int color, ProgressBar bar) { bar.getIndeterminateDrawable().setColorFilter(color, android.graphics.PorterDuff.Mode.MULTIPLY); }
From source file:com.synox.android.ui.dialog.LoadingDialog.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Create a view by inflating desired layout View v = inflater.inflate(R.layout.loading_dialog, container, false); // set value/*ww w . j a v a 2s. com*/ TextView tv = (TextView) v.findViewById(R.id.loadingText); tv.setText(mMessage); // set progress wheel color ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.loadingBar); progressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.accent), PorterDuff.Mode.SRC_IN); return v; }
From source file:com.cerema.cloud2.ui.dialog.LoadingDialog.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Create a view by inflating desired layout View v = inflater.inflate(R.layout.loading_dialog, container, false); // set value/*from w ww .j av a 2 s.co m*/ TextView tv = (TextView) v.findViewById(R.id.loadingText); tv.setText(mMessage); // set progress wheel color ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.loadingBar); progressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.color_accent), PorterDuff.Mode.SRC_IN); return v; }
From source file:com.synox.android.ui.dialog.IndeterminateProgressDialog.java
/** * {@inheritDoc}// w w w .j a v a2 s .c o m */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { /// create indeterminate progress dialog final ProgressDialog progressDialog = new ProgressDialog(getActivity(), R.style.ProgressDialogTheme); progressDialog.setIndeterminate(true); progressDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { ProgressBar v = (ProgressBar) progressDialog.findViewById(android.R.id.progress); v.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.accent), android.graphics.PorterDuff.Mode.MULTIPLY); } }); /// set message int messageId = getArguments().getInt(ARG_MESSAGE_ID, R.string.placeholder_sentence); progressDialog.setMessage(getString(messageId)); /// set cancellation behavior boolean cancelable = getArguments().getBoolean(ARG_CANCELABLE, false); if (!cancelable) { progressDialog.setCancelable(false); // disable the back button OnKeyListener keyListener = new OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { return keyCode == KeyEvent.KEYCODE_BACK; } }; progressDialog.setOnKeyListener(keyListener); } return progressDialog; }