Java Code Examples for android.widget.ProgressBar#setIndeterminateTintList()
The following examples show how to use
android.widget.ProgressBar#setIndeterminateTintList() .
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: CreateGroupChatActivity.java From NaviBee with GNU General Public License v3.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_confirm, menu); ProgressBar pb = new ProgressBar(this); MenuItem progressItem = menu.findItem(R.id.menu_confirm_progress); int px = (int) (24 * Resources.getSystem().getDisplayMetrics().density); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(3*px, 3*px); pb.setLayoutParams(lp); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { pb.setIndeterminateTintList( ColorStateList.valueOf(0xff000000) ); } pb.setPaddingRelative(px, px, px, px); progressItem.setActionView(pb); return true; }
Example 2
Source File: BaseActivity.java From WeiXinRecordedDemo with MIT License | 6 votes |
public TextView showProgressDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setCancelable(false); View view = View.inflate(this, R.layout.dialog_loading, null); builder.setView(view); ProgressBar pb_loading = (ProgressBar) view.findViewById(R.id.pb_loading); TextView tv_hint = (TextView) view.findViewById(R.id.tv_hint); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { pb_loading.setIndeterminateTintList(ContextCompat.getColorStateList(this, R.color.blue)); } progressDialog = builder.create(); progressDialog.show(); return tv_hint; }
Example 3
Source File: Easel.java From andela-crypto-app with Apache License 2.0 | 6 votes |
public static void tint(@NonNull ProgressBar progressBar, @ColorInt int color, boolean skipIndeterminate) { ColorStateList sl = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { progressBar.setProgressTintList(sl); progressBar.setSecondaryProgressTintList(sl); if (!skipIndeterminate) progressBar.setIndeterminateTintList(sl); } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mode = PorterDuff.Mode.MULTIPLY; } if (!skipIndeterminate && progressBar.getIndeterminateDrawable() != null) progressBar.getIndeterminateDrawable().setColorFilter(color, mode); if (progressBar.getProgressDrawable() != null) progressBar.getProgressDrawable().setColorFilter(color, mode); } }
Example 4
Source File: MDTintHelper.java From NewsMe with Apache License 2.0 | 6 votes |
public static void setTint(@NonNull ProgressBar progressBar, @ColorInt int color, boolean skipIndeterminate) { ColorStateList sl = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { progressBar.setProgressTintList(sl); progressBar.setSecondaryProgressTintList(sl); if (!skipIndeterminate) progressBar.setIndeterminateTintList(sl); } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mode = PorterDuff.Mode.MULTIPLY; } if (!skipIndeterminate && progressBar.getIndeterminateDrawable() != null) progressBar.getIndeterminateDrawable().setColorFilter(color, mode); if (progressBar.getProgressDrawable() != null) progressBar.getProgressDrawable().setColorFilter(color, mode); } }
Example 5
Source File: MDTintHelper.java From talk-android with MIT License | 6 votes |
@SuppressLint("NewApi") public static void setTint(ProgressBar progressBar, int color, boolean skipIndeterminate) { ColorStateList sl = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { progressBar.setProgressTintList(sl); progressBar.setSecondaryProgressTintList(sl); if (!skipIndeterminate) progressBar.setIndeterminateTintList(sl); } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mode = PorterDuff.Mode.MULTIPLY; } if (!skipIndeterminate && progressBar.getIndeterminateDrawable() != null) progressBar.getIndeterminateDrawable().setColorFilter(color, mode); if (progressBar.getProgressDrawable() != null) progressBar.getProgressDrawable().setColorFilter(color, mode); } }
Example 6
Source File: TintHelper.java From APlayer with GNU General Public License v3.0 | 6 votes |
public static void setTint(@NonNull ProgressBar progressBar, @ColorInt int color, boolean skipIndeterminate) { ColorStateList sl = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { progressBar.setProgressTintList(sl); progressBar.setSecondaryProgressTintList(sl); if (!skipIndeterminate) { progressBar.setIndeterminateTintList(sl); } } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mode = PorterDuff.Mode.MULTIPLY; } if (!skipIndeterminate && progressBar.getIndeterminateDrawable() != null) { progressBar.getIndeterminateDrawable().setColorFilter(color, mode); } if (progressBar.getProgressDrawable() != null) { progressBar.getProgressDrawable().setColorFilter(color, mode); } } }
Example 7
Source File: EmTintUtils.java From AndroidTint with Apache License 2.0 | 6 votes |
public static void setTint(@NonNull ProgressBar progressBar, @ColorInt int color, boolean skipIndeterminate) { ColorStateList sl = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { progressBar.setProgressTintList(sl); progressBar.setSecondaryProgressTintList(sl); if (!skipIndeterminate) progressBar.setIndeterminateTintList(sl); } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { mode = PorterDuff.Mode.MULTIPLY; } if (!skipIndeterminate && progressBar.getIndeterminateDrawable() != null) progressBar.getIndeterminateDrawable().setColorFilter(color, mode); if (progressBar.getProgressDrawable() != null) progressBar.getProgressDrawable().setColorFilter(color, mode); } }
Example 8
Source File: IndeterminateTintSetter.java From aircon with MIT License | 5 votes |
@Override protected void setAttr(final ProgressBar view, final int color) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.setIndeterminateTintList(ColorStateList.valueOf(color)); } else { DrawableCompat.setTint(view.getIndeterminateDrawable(), color); } }
Example 9
Source File: TintHelper.java From a with GNU General Public License v3.0 | 5 votes |
public static void setTint(@NonNull ProgressBar progressBar, @ColorInt int color, boolean skipIndeterminate) { ColorStateList sl = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { progressBar.setProgressTintList(sl); progressBar.setSecondaryProgressTintList(sl); if (!skipIndeterminate) progressBar.setIndeterminateTintList(sl); } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (!skipIndeterminate && progressBar.getIndeterminateDrawable() != null) progressBar.getIndeterminateDrawable().setColorFilter(color, mode); if (progressBar.getProgressDrawable() != null) progressBar.getProgressDrawable().setColorFilter(color, mode); } }
Example 10
Source File: TintHelper.java From MyBookshelf with GNU General Public License v3.0 | 5 votes |
public static void setTint(@NonNull ProgressBar progressBar, @ColorInt int color, boolean skipIndeterminate) { ColorStateList sl = ColorStateList.valueOf(color); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { progressBar.setProgressTintList(sl); progressBar.setSecondaryProgressTintList(sl); if (!skipIndeterminate) progressBar.setIndeterminateTintList(sl); } else { PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN; if (!skipIndeterminate && progressBar.getIndeterminateDrawable() != null) progressBar.getIndeterminateDrawable().setColorFilter(color, mode); if (progressBar.getProgressDrawable() != null) progressBar.getProgressDrawable().setColorFilter(color, mode); } }
Example 11
Source File: LoadingFragment.java From leanback-extensions with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_loading, container, false); FrameLayout loadingContainer = (FrameLayout) view.findViewById(R.id.fragment_loading_container); loadingContainer.setBackgroundColor(backgroundColor); progressBar = new ProgressBar(container.getContext()); if (container instanceof FrameLayout) { FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(progressWidth, progressHeight, Gravity.CENTER); progressBar.setLayoutParams(layoutParams); } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { if (progressBar.getIndeterminateDrawable() != null) { progressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor(progressColor), PorterDuff.Mode.SRC_IN); } } else { ColorStateList stateList = ColorStateList.valueOf(progressColor); progressBar.setIndeterminateTintMode(PorterDuff.Mode.SRC_IN); progressBar.setIndeterminateTintList(stateList); progressBar.setProgressBackgroundTintMode(PorterDuff.Mode.SRC_IN); progressBar.setProgressBackgroundTintList(stateList); progressBar.setIndeterminate(true); } loadingContainer.addView(progressBar); return view; }
Example 12
Source File: UIProgressDialog.java From UIWidget with Apache License 2.0 | 5 votes |
@Override public View createProgressView() { mProgressBar = new ProgressBar(mContext); mProgressBar.setLayoutParams(new ViewGroup.LayoutParams(mLoadingSize, mLoadingSize)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mIndeterminateDrawable == null) { mProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mLoadingColor)); } if (mIndeterminateDrawable != null) { mProgressBar.setIndeterminateDrawable(mIndeterminateDrawable); } return mProgressBar; }
Example 13
Source File: FastLoadMoreView.java From FastLib with Apache License 2.0 | 5 votes |
private void initView(BaseViewHolder holder) { if (holder == null) { return; } holder.setText(R.id.tv_loadingFastLoadMore, mLoadingText) .setTextColor(R.id.tv_loadingFastLoadMore, mLoadingTextColor) .setText(R.id.tv_loadFailFastLoadMore, mLoadFailText) .setTextColor(R.id.tv_loadFailFastLoadMore, mLoadFailTextColor) .setText(R.id.tv_loadEndFastLoadMore, mLoadEndText) .setTextColor(R.id.tv_loadEndFastLoadMore, mLoadEndTextColor); TextView tvLoading = holder.getView(R.id.tv_loadingFastLoadMore); TextView tvLoadFail = holder.getView(R.id.tv_loadFailFastLoadMore); TextView tvLoadEnd = holder.getView(R.id.tv_loadEndFastLoadMore); ProgressBar pbLoading = holder.getView(R.id.pb_loadingFastLoadMore); tvLoading.setTextSize(TypedValue.COMPLEX_UNIT_PX, mLoadingTextSize); tvLoading.getPaint().setFakeBoldText(mLoadingTextFakeBold); tvLoadFail.setTextSize(TypedValue.COMPLEX_UNIT_PX, mLoadFailTextSize); tvLoadFail.getPaint().setFakeBoldText(mLoadFailTextFakeBold); tvLoadEnd.setTextSize(TypedValue.COMPLEX_UNIT_PX, mLoadEndTextSize); tvLoadEnd.getPaint().setFakeBoldText(mLoadEndTextFakeBold); if (mLoadingSize >= 0) { pbLoading.getIndeterminateDrawable().setBounds(0, 0, mLoadingSize, mLoadingSize); ViewGroup.LayoutParams params = pbLoading.getLayoutParams(); params.width = mLoadingSize; params.height = mLoadingSize; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { pbLoading.setIndeterminateTintList(ColorStateList.valueOf(mLoadingProgressColor)); } if (mLoadingProgressDrawable != null) { mLoadingProgressDrawable.setBounds(pbLoading.getIndeterminateDrawable().getBounds()); pbLoading.setIndeterminateDrawable(mLoadingProgressDrawable); } }
Example 14
Source File: ProgressBarColorAdapter.java From Scoops with Apache License 2.0 | 4 votes |
@Override public void applyColor(ProgressBar view, @ColorInt int color) { view.setIndeterminateTintList(Utils.colorToStateList(color)); }