ProgressBar getProgressDrawable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ProgressBar getProgressDrawable method.

This code example shows how to use the following methods:getIndeterminateDrawable, getProgressDrawable
    } 
 
    private void applyProgressBarColor() { 
        if (mHeaderProgressBar != null) {
            if (mUseCustomProgressColor) {
                mHeaderProgressBar.getProgressDrawable()
                        .setColorFilter(mProgressDrawableColor, PorterDuff.Mode.SRC_ATOP);
                mHeaderProgressBar.getIndeterminateDrawable()
                        .setColorFilter(mProgressDrawableColor, PorterDuff.Mode.SRC_ATOP);
            } else { 
                mHeaderProgressBar.getProgressDrawable().clearColorFilter();
                mHeaderProgressBar.getIndeterminateDrawable().clearColorFilter();
            } 
        } 
    } 
 
    protected Drawable getActionBarBackground(Context context) {
        int[] android_styleable_ActionBar = {android.R.attr.background};
 
        // Need to get resource id of style pointed to from actionBarStyle 
7
CodeRank
This code example shows how to use the following methods:getIndeterminateDrawable, getProgressDrawable
This code example shows how to use the following methods:invalidate, getProgressDrawable, setProgress, setProgressDrawable, setSecondaryProgress
    progressLayerDrawable.setId(2, android.R.id.progress);
 
    //Copy the existing ProgressDrawable bounds to the new one. 
    Rect bounds = progressBar.getProgressDrawable().getBounds();
    progressBar.setProgressDrawable(progressLayerDrawable);     
    progressBar.getProgressDrawable().setBounds(bounds);
 
    // setProgress() ignores a change to the same value, so: 
    if (value1 == 0)
        progressBar.setProgress(1);
    else 
        progressBar.setProgress(0);
    progressBar.setProgress(value1);
 
    // setSecondaryProgress() ignores a change to the same value, so: 
    if (value2 == 0)
        progressBar.setSecondaryProgress(1);
    else 
        progressBar.setSecondaryProgress(0);
    progressBar.setSecondaryProgress(value2);

6
CodeRank
This code example shows how to use the following methods:getMax, getProgress, getProgressDrawable, getSecondaryProgress
     * progress increases we increase the drawable regions for the progress bar. 
     * Doing this gives us greater control and allows us to 
     * show the rounded cap on the progress bar. 
     */ 
    public void updateProgressBar() { 
        Drawable progressDrawable = progressBar.getProgressDrawable();
        int primaryProgress = progressBar.getProgress();
        int secondaryProgress = progressBar.getSecondaryProgress();
        int max = progressBar.getMax();
 
        if (progressDrawable != null && progressDrawable instanceof LayerDrawable) {
            LayerDrawable layerDrawable = (LayerDrawable) progressDrawable;
 
            final int width = layerDrawable.getBounds().right - layerDrawable.getBounds().left;
 
            final float primaryProgressScale = getScale(primaryProgress, max);
            final float secondaryProgressScale = getScale(secondaryProgress, max);
 
            Drawable primaryProgressDrawable = layerDrawable.findDrawableByLayerId(android.R.id.progress);
            Drawable secondaryProgressDrawable = layerDrawable.findDrawableByLayerId(android.R.id.secondaryProgress);
6
CodeRank
This code example shows how to use the following methods:setMax, getProgressDrawable, setProgress, setOnSeekBarChangeListener
		layout.setPadding(6,6,6,6);
		 
		params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		params.bottomMargin = 25;
		 
		mSeekBar = new SeekBar(mContext);
		mSeekBar.setOnSeekBarChangeListener(this);
		mSeekBar.getProgressDrawable().setColorFilter(0xbbff0000, PorterDuff.Mode.SRC_OVER);
		layout.addView(mSeekBar, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
		 
		if (shouldPersist()){ 
			mValue = getPersistedInt(mDefault);
 
		} 
 
		mSeekBar.setMax(mMax);
		mSeekBar.setProgress(mValue);
		return(layout);
	} 
	@Override 

6
CodeRank
This code example shows how to use the following methods:setMax, getProgressDrawable, setProgress, setOnSeekBarChangeListener
		mColorView.setBackgroundColor(0xffff0000);
		params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		params.bottomMargin = 25;
		layout.addView(mColorView, params);		
	 
		mSeekBarR = new SeekBar(mContext);
		mSeekBarR.setOnSeekBarChangeListener(this);
		mSeekBarR.getProgressDrawable().setColorFilter(0xbbff0000, PorterDuff.Mode.SRC_OVER);
		layout.addView(mSeekBarR, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
		mSeekBarG = new SeekBar(mContext);
		mSeekBarG.setOnSeekBarChangeListener(this);
		mSeekBarG.getProgressDrawable().setColorFilter(0xbb00ff00, PorterDuff.Mode.SRC_OVER);
		layout.addView(mSeekBarG, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
		mSeekBarB = new SeekBar(mContext);
		mSeekBarB.setOnSeekBarChangeListener(this);
		mSeekBarB.getProgressDrawable().setColorFilter(0xbb0000ff, PorterDuff.Mode.SRC_OVER);
		layout.addView(mSeekBarB, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
 
		if (shouldPersist()){ 
			mValue = getPersistedInt(mDefault);

6
CodeRank
This code example shows how to use the following methods:setMax, getProgressDrawable, setProgress, setOnSeekBarChangeListener
	 
		mSeekBarR = new SeekBar(mContext);
		mSeekBarR.setOnSeekBarChangeListener(this);
		mSeekBarR.getProgressDrawable().setColorFilter(0xbbff0000, PorterDuff.Mode.SRC_OVER);
		layout.addView(mSeekBarR, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
		mSeekBarG = new SeekBar(mContext);
		mSeekBarG.setOnSeekBarChangeListener(this);
		mSeekBarG.getProgressDrawable().setColorFilter(0xbb00ff00, PorterDuff.Mode.SRC_OVER);
		layout.addView(mSeekBarG, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
		mSeekBarB = new SeekBar(mContext);
		mSeekBarB.setOnSeekBarChangeListener(this);
		mSeekBarB.getProgressDrawable().setColorFilter(0xbb0000ff, PorterDuff.Mode.SRC_OVER);
		layout.addView(mSeekBarB, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
 
		if (shouldPersist()){ 
			mValue = getPersistedInt(mDefault);
			mRed = (mValue & 0x00ff0000) >> 16;
			mGreen = (mValue & 0x0000ff00) >> 8;
			mBlue = mValue & 0x000000ff;
		} 

6
CodeRank
This code example shows how to use the following methods:setMax, getProgressDrawable, setProgress, setOnSeekBarChangeListener
		mColorView.setBackgroundColor(0xffff0000);
		params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		params.bottomMargin = 25;
		layout.addView(mColorView, params);		
	 
		mSeekBarR = new SeekBar(mContext);
		mSeekBarR.setOnSeekBarChangeListener(this);
		mSeekBarR.getProgressDrawable().setColorFilter(0xbbff0000, PorterDuff.Mode.SRC_OVER);
		layout.addView(mSeekBarR, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
		mSeekBarG = new SeekBar(mContext);
		mSeekBarG.setOnSeekBarChangeListener(this);
		mSeekBarG.getProgressDrawable().setColorFilter(0xbb00ff00, PorterDuff.Mode.SRC_OVER);
		layout.addView(mSeekBarG, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
		mSeekBarB = new SeekBar(mContext);
		mSeekBarB.setOnSeekBarChangeListener(this);
		mSeekBarB.getProgressDrawable().setColorFilter(0xbb0000ff, PorterDuff.Mode.SRC_OVER);
		layout.addView(mSeekBarB, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
 
		if (shouldPersist()){ 
			mValue = getPersistedInt(mDefault);

6
CodeRank
This code example shows how to use the following methods:getProgressDrawable, setMax, setProgressDrawable
		this.max = max;
		this.current = Math.min(max, current);
		calculateChange(); 
		 
		txtMax.setText(max + "");
		bar.setMax(max);
	} 
	public int getMax() { return max; }
	 
	public void setTemporary(int temp) { 
		this.temp = temp; 
		if(temp < 0) {
			txtTemp.setText(temp + "");
		} else if(temp == 0) {
			txtTemp.setText("");
		} else { 
			txtTemp.setText("+" + temp);
		} 
	} 
	public int getTemporary() { return temp; }

5
CodeRank

Related ProgressBar getProgressDrawable Questions & Answers:

getProgressDrawable Method Overview
Get the drawable used to draw the progress bar in progress mode.
See Code Examples for other Android ProgressBar Methods: