Example usage for android.widget ProgressBar setProgressDrawable

List of usage examples for android.widget ProgressBar setProgressDrawable

Introduction

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

Prototype

public void setProgressDrawable(Drawable d) 

Source Link

Document

Define the drawable used to draw the progress bar in progress mode.

Usage

From source file:br.org.funcate.dynamicforms.views.GPictureView.java

public ProgressBar getProgressBar(final Context context) {
    ProgressBar progressBar = new ProgressBar(context);
    // Get the Drawable custom_progressbar
    Drawable draw = getResources().getDrawable(R.drawable.customprogressbar);
    // set the drawable as progress drawable
    progressBar.setProgressDrawable(draw);
    progressBar.setVisibility(View.VISIBLE);
    progressBar.setPadding(5, 5, 5, 5);/*from   w w w  .j  ava2s.  c o  m*/
    progressBar.setLayoutParams(new LinearLayout.LayoutParams(thumbnailWidth, thumbnailHeight));
    return progressBar;
}

From source file:com.goliathonline.android.kegbot.ui.WhatsOnFragment.java

private void onTapQueryComplete(Cursor cursor) {
    if (cursor == null)
        return;//from  w w  w .  j  av  a 2  s . c  o  m
    else if (cursor.getCount() == 0)
        return;

    final LayoutInflater inflater = getActivity().getLayoutInflater();

    final View onTapView = inflater.inflate(R.layout.whats_on_tap, mRootView, false);
    final TextView onTapTitleView = (TextView) onTapView.findViewById(R.id.on_tap);
    final TextView onTapSubTitleView = (TextView) onTapView.findViewById(R.id.whats_on_subtitle);
    final ProgressBar kegProgress = (ProgressBar) onTapView.findViewById(R.id.kegProgress);
    final ImageView tapImage = (ImageView) onTapView.findViewById(R.id.tap_image);
    final TextView degreesText = (TextView) onTapView.findViewById(R.id.temperature);

    cursor.moveToFirst();
    final String tapImageUrl = cursor.getString(TapsQuery.IMAGE_URL);

    if (!TextUtils.isEmpty(tapImageUrl)) {
        BitmapUtils.fetchImage(getActivity(), tapImageUrl, null, null,
                new BitmapUtils.OnFetchCompleteListener() {
                    public void onFetchComplete(Object cookie, Bitmap result) {
                        if (result != null) {
                            tapImage.setImageBitmap(result);
                        }
                    }
                });
    }

    onTapTitleView.setText(cursor.getString(TapsQuery.BEER_NAME));

    final Double mlRemain = cursor.getDouble(TapsQuery.VOL_REMAIN);
    final String pintsRemain = UnitUtils.mlToPint(Double.toString(mlRemain));
    final Double mlTotal = cursor.getDouble(TapsQuery.VOL_SIZE);
    final Double mlPoured = mlTotal - mlRemain;
    final String pintsPoured = UnitUtils.mlToPint(Double.toString(mlPoured));
    final Double lastTemp = cursor.getDouble(TapsQuery.LAST_TEMP);
    final String temperature = UnitUtils.cToF(Double.toString(lastTemp));

    onTapSubTitleView.setText("Pints Poured: " + pintsPoured + " (" + pintsRemain + " remain)");

    kegProgress.setProgressDrawable(getResources().getDrawable(R.drawable.progress));
    kegProgress.setProgress((int) cursor.getDouble(TapsQuery.PERCENT_FULL));

    degreesText.setText(temperature + DEGREES);

    cursor.close();
    mRootView.addView(onTapView);

}