androidx.swiperefreshlayout.widget.CircularProgressDrawable Java Examples
The following examples show how to use
androidx.swiperefreshlayout.widget.CircularProgressDrawable.
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: EditAddedArticleActivity.java From android-app with GNU General Public License v3.0 | 6 votes |
private void openLater() { cancelAutoclose(); openPending = true; Drawable oldImage = openButton.getDrawable(); CircularProgressDrawable progressDrawable = new CircularProgressDrawable(this) { @Override public int getIntrinsicWidth() { return oldImage.getIntrinsicWidth(); } @Override public int getIntrinsicHeight() { return oldImage.getIntrinsicHeight(); } }; progressDrawable.setStyle(CircularProgressDrawable.DEFAULT); openButton.setImageDrawable(progressDrawable); progressDrawable.start(); openButton.setEnabled(false); openButton.setClickable(false); }
Example #2
Source File: IndeterminateMaterialProgressBar.java From HgLauncher with GNU General Public License v3.0 | 5 votes |
public IndeterminateMaterialProgressBar(Context context, AttributeSet attrs) { super(context, attrs); final DisplayMetrics metrics = getResources().getDisplayMetrics(); final float screenDensity = metrics.density; CircularProgressDrawable drawable = new CircularProgressDrawable(context); drawable.setColorSchemeColors(getResources().getColor(R.color.colorPrimary)); drawable.setStrokeWidth(WIDTH_DP * screenDensity); setIndeterminateDrawable(drawable); }
Example #3
Source File: IndeterminateMaterialProgressBar.java From HgLauncher with GNU General Public License v3.0 | 5 votes |
public IndeterminateMaterialProgressBar(Context context, AttributeSet attrs) { super(context, attrs); final DisplayMetrics metrics = getResources().getDisplayMetrics(); final float screenDensity = metrics.density; CircularProgressDrawable drawable = new CircularProgressDrawable(context); drawable.setColorSchemeColors(getResources().getColor(R.color.colorPrimary)); drawable.setStrokeWidth(WIDTH_DP * screenDensity); setIndeterminateDrawable(drawable); }
Example #4
Source File: OverviewRecyclerBaseFragment.java From Easy_xkcd with Apache License 2.0 | 5 votes |
private CircularProgressDrawable getCircularProgress() { CircularProgressDrawable circularProgressDrawable = new CircularProgressDrawable(getActivity()); circularProgressDrawable.setCenterRadius(60.0f); circularProgressDrawable.setStrokeWidth(5.0f); circularProgressDrawable.setColorSchemeColors(themePrefs.nightThemeEnabled() ? themePrefs.getAccentColorNight() : themePrefs.getAccentColor()); circularProgressDrawable.start(); return circularProgressDrawable; }
Example #5
Source File: ComicFragment.java From Easy_xkcd with Apache License 2.0 | 5 votes |
protected CircularProgressDrawable getProgressCircle() { CircularProgressDrawable circularProgressDrawable = new CircularProgressDrawable(getActivity()); circularProgressDrawable.setStrokeWidth(5.0f); circularProgressDrawable.setCenterRadius(100.0f); circularProgressDrawable.setColorSchemeColors(themePrefs.nightThemeEnabled() ? themePrefs.getAccentColorNight() : themePrefs.getAccentColor()); circularProgressDrawable.start(); return circularProgressDrawable; }
Example #6
Source File: WhatIfOverviewFragment.java From Easy_xkcd with Apache License 2.0 | 5 votes |
private CircularProgressDrawable getCircularProgress() { CircularProgressDrawable circularProgressDrawable = new CircularProgressDrawable(context); circularProgressDrawable.setCenterRadius(60.0f); circularProgressDrawable.setStrokeWidth(5.0f); circularProgressDrawable.setColorSchemeColors(themePrefs.getAccentColor()); circularProgressDrawable.start(); return circularProgressDrawable; }
Example #7
Source File: AttachmentGallery.java From mage-android with Apache License 2.0 | 4 votes |
void addAttachment(ViewGroup gallery, final Attachment a) { final AppCompatImageView iv = new AppCompatImageView(context); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(width, height); iv.setLayoutParams(lp); iv.setBackgroundColor(ResourcesCompat.getColor(context.getResources(), R.color.background_attachment, context.getTheme())); lp.setMargins(0, 16, 25, 16); iv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (attachmentClickListener != null) { attachmentClickListener.onAttachmentClick(a); } } }); gallery.addView(iv); CircularProgressDrawable progress = new CircularProgressDrawable(context); progress.setStrokeWidth(10f); progress.setCenterRadius(width / 4); progress.setColorSchemeColors(context.getResources().getColor(R.color.md_blue_600), context.getResources().getColor(R.color.md_orange_A200)); progress.start(); boolean isVideo = false; if (a.getLocalPath() != null) { String fileExtension = MimeTypeMap.getFileExtensionFromUrl(a.getLocalPath()); String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension.toLowerCase()); isVideo = mimeType.startsWith("video/"); } else if (a.getContentType() != null) { isVideo = a.getContentType().startsWith("video/"); } Collection<BitmapTransformation> transformations = new ArrayList<>(); transformations.add(new CenterCrop()); if (isVideo) { transformations.add(new VideoOverlayTransformation(context)); } GlideApp.with(context) .asBitmap() .load(a) .placeholder(progress) .fallback(R.drawable.ic_attachment_200dp) .error(R.drawable.ic_attachment_200dp) .transforms(transformations.toArray(new BitmapTransformation[]{})) .into(iv); }
Example #8
Source File: CircularProgressImageView.java From ProjectX with Apache License 2.0 | 4 votes |
private void initView(Context context, AttributeSet attrs, int defStyleAttr) { mProgress = new CircularProgressDrawable(context); mProgress.setBackgroundColor(0x00000000); mProgress.setAlpha(255); mProgress.setCallback(this); mProgress.setArrowEnabled(false); final DisplayMetrics metrics = context.getResources().getDisplayMetrics(); mSizeLarge = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, SIZE_LARGE, metrics); mSizeNormal = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, SIZE_DEFAULT, metrics); mSize = mSizeNormal; final ArrayList<Integer> colors = new ArrayList<>(); final TypedArray custom = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressImageView, defStyleAttr, 0); final int style = custom.getInt(R.styleable.CircularProgressImageView_cpStyle, DEFAULT); mProgress.setStyle(style); if (style == LARGE) mSize = mSizeLarge; else mSize = mSizeNormal; if (custom.hasValue(R.styleable.CircularProgressImageView_cpStrokeWidth)) { mProgress.setStrokeWidth( custom.getDimension(R.styleable.CircularProgressImageView_cpStrokeWidth, 1f)); mSize = -1; } if (custom.hasValue(R.styleable.CircularProgressImageView_cpCenterRadius)) { mProgress.setCenterRadius( custom.getDimension(R.styleable.CircularProgressImageView_cpCenterRadius, 1f)); mSize = -1; } mPaddingEdge = custom.getDimensionPixelSize( R.styleable.CircularProgressImageView_cpPaddingEdge, mPaddingEdge); boolean autoStart = custom.getBoolean( R.styleable.CircularProgressImageView_cpAutoStart, true); int color = custom.getColor( R.styleable.CircularProgressImageView_cpShadowsCircleColor, DEFAULT_COLOR); float elevation = custom.getDimension(R.styleable.CircularProgressImageView_cpElevation, getResources().getDisplayMetrics().density * SHADOW_ELEVATION); if (custom.hasValue(R.styleable.CircularProgressImageView_cpSchemeColor1)) { colors.add(custom.getColor( R.styleable.CircularProgressImageView_cpSchemeColor1, Color.BLACK)); } if (custom.hasValue(R.styleable.CircularProgressImageView_cpSchemeColor2)) { colors.add(custom.getColor( R.styleable.CircularProgressImageView_cpSchemeColor2, Color.BLACK)); } if (custom.hasValue(R.styleable.CircularProgressImageView_cpSchemeColor3)) { colors.add(custom.getColor( R.styleable.CircularProgressImageView_cpSchemeColor3, Color.BLACK)); } if (custom.hasValue(R.styleable.CircularProgressImageView_cpSchemeColor4)) { colors.add(custom.getColor( R.styleable.CircularProgressImageView_cpSchemeColor4, Color.BLACK)); } if (custom.hasValue(R.styleable.CircularProgressImageView_cpSchemeColor5)) { colors.add(custom.getColor( R.styleable.CircularProgressImageView_cpSchemeColor5, Color.BLACK)); } custom.recycle(); setElevationCompat(elevation); Drawable background = getBackground(); if (background == null) setShadowsCircleBackground(color); final int size = colors.size(); if (size > 0) { int[] colorArray = new int[size]; for (int i = 0; i < size; i++) { colorArray[i] = colors.get(i); } mProgress.setColorSchemeColors(colorArray); } setImageDrawable(mProgress); if (autoStart) start(); }