Example usage for android.widget ProgressBar getIndeterminateDrawable

List of usage examples for android.widget ProgressBar getIndeterminateDrawable

Introduction

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

Prototype

public Drawable getIndeterminateDrawable() 

Source Link

Document

Get the drawable used to draw the progress bar in indeterminate mode.

Usage

From source file:org.catrobat.paintroid.dialog.IndeterminateProgressDialog.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.custom_progress_dialog);

    // Remove this section once AppCompat supports tinting Progressbars
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
        if (progressBar != null) {
            Drawable drawable = progressBar.getIndeterminateDrawable();
            drawable.setColorFilter(ContextCompat.getColor(getContext(), R.color.tools_text_color),
                    PorterDuff.Mode.SRC_IN);
        }/*from w w w .  j a  va  2s .c  o  m*/
    }

    setCancelable(false);
}

From source file:com.cerema.cloud2.ui.dialog.IndeterminateProgressDialog.java

/**
 * {@inheritDoc}/*from  w  w  w  . j  ava  2s.  c  om*/
 */
@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.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) {

                if (keyCode == KeyEvent.KEYCODE_BACK) {
                    return true;
                }
                return false;
            }

        };
        progressDialog.setOnKeyListener(keyListener);
    }

    return progressDialog;
}

From source file:org.fossasia.phimpme.share.nextcloud.IndeterminateProgressDialog.java

/**
 * {@inheritDoc}/* ww w . ja va  2  s .  co  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.colorAccent),
                    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) {

                if (keyCode == KeyEvent.KEYCODE_BACK) {
                    return true;
                }
                return false;
            }

        };
        progressDialog.setOnKeyListener(keyListener);
    }

    return progressDialog;
}

From source file:com.uowd.sport.nestdrecylerviews_vert_horizontal.ImagePagerAdapterMixCatalouge.java

@Override
public Object instantiateItem(ViewGroup view, final int position) {
    final View imageLayout = inflater.inflate(R.layout.horizontal_item, view, false);
    final ImageView imageView = (ImageView) imageLayout.findViewById(R.id.random_image_view);
    final ProgressBar pBar = (ProgressBar) imageLayout.findViewById(R.id.progressBar);
    pBar.setVisibility(View.VISIBLE);
    pBar.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(ac, R.color.ColorPrimary),
            android.graphics.PorterDuff.Mode.MULTIPLY);
    imageView.setTag(position);/*from  w w  w.j a  v  a 2 s .  c om*/

    String mCollectionType = "2";

    Picasso.with(ac.getApplicationContext())
            .load("https://gizbo.ae/GizboApp/GizboImages/catalogues/1155/" + mCollectionType + "/"
                    + _mImagesName.get(position).replace("/thumbnails", ""))
            .into(imageView, new com.squareup.picasso.Callback() {
                @Override
                public void onSuccess() {
                    pBar.setVisibility(View.GONE);
                }

                @Override
                public void onError() {
                    //pBar.setVisibility(View.GONE);
                }
            });
    view.addView(imageLayout, 0);
    return imageLayout;
}

From source file:com.knurld.dropboxdemo.KnurldActivity.java

public PopupWindow showLoadingPopup(View view) {
    View spinnerView = LayoutInflater.from((Activity) context).inflate(R.layout.loading_popup, null);
    ProgressBar progressBar = (ProgressBar) spinnerView.findViewById(R.id.speakProgress);
    progressBar.getIndeterminateDrawable().setColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY);

    PopupWindow popupWindow = new PopupWindow(spinnerView, 500, 500);
    popupWindow.setFocusable(true);//  www.ja  v  a 2  s. c om
    popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0);
    return popupWindow;
}

From source file:com.knurld.dropboxdemo.KnurldActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_loading);
    ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressSpinner);
    progressBar.getIndeterminateDrawable().setColorFilter(Color.rgb(226, 132, 59), PorterDuff.Mode.MULTIPLY);

    context = this;

    knurldServiceThread = new Thread(new Runnable() {
        @Override/*from   w ww .  j  a v a  2s .  c  o  m*/
        public void run() {
            knurldService = new KnurldService();
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    showSetup();
                }
            });
        }
    });
    knurldServiceThread.start();
}

From source file:ca.rmen.android.scrumchatter.dialog.ProgressDialogFragment.java

/**
 * @return an indeterminate, non-cancelable, ProgressDialog with a message.
 *//*from   w  w w .  j  a v  a 2  s .co  m*/
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Log.v(TAG, "onCreateDialog: savedInstanceState = " + savedInstanceState);
    ProgressDialog dialog = new ProgressDialog(getActivity());
    Bundle arguments = getArguments();
    dialog.setMessage(arguments.getString(DialogFragmentFactory.EXTRA_MESSAGE));
    dialog.setIndeterminate(true);
    dialog.setOnShowListener(shownDialog -> {
        ProgressBar progressBar = (ProgressBar) ((ProgressDialog) shownDialog)
                .findViewById(android.R.id.progress);
        if (progressBar != null) {
            Drawable drawable = progressBar.getIndeterminateDrawable();
            if (drawable != null) {
                drawable.setColorFilter(
                        ContextCompat.getColor(getActivity(), R.color.scrum_chatter_accent_color),
                        android.graphics.PorterDuff.Mode.SRC_IN);
            }
        }
    });
    dialog.setCancelable(false);
    return dialog;
}

From source file:com.adithya321.sharesanalysis.fragments.ShareHoldingsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.share_sales, menu);
    actionProgressItem = menu.findItem(R.id.action_progress);
    actionRefreshItem = menu.findItem(R.id.action_refresh);
    actionProgressItem.setVisible(true);
    actionRefreshItem.setVisible(false);

    ProgressBar progressBar = (ProgressBar) actionProgressItem.getActionView()
            .findViewById(R.id.pbProgressAction);
    progressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor(android.R.color.white),
            android.graphics.PorterDuff.Mode.SRC_IN);

    super.onCreateOptionsMenu(menu, inflater);
}

From source file:de.gebatzens.ggvertretungsplan.fragment.RemoteDataFragment.java

public View createLoadingView() {
    LinearLayout l = new LinearLayout(getActivity());
    l.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    l.setGravity(Gravity.CENTER);//from  w ww . j a v a 2 s.c o  m

    ProgressBar pb = new ProgressBar(getActivity());
    pb.getIndeterminateDrawable().setColorFilter(GGApp.GG_APP.provider.getColor(), PorterDuff.Mode.SRC_IN);
    pb.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    pb.setVisibility(ProgressBar.VISIBLE);

    l.addView(pb);
    return l;
}

From source file:de.gebatzens.sia.fragment.RemoteDataFragment.java

public View createLoadingView() {
    ScrollView sv = new ScrollView(getActivity());
    sv.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    sv.setTag("gg_scroll");
    sv.setFillViewport(true);/*from  www.  ja v a  2s  . c om*/
    LinearLayout l = new LinearLayout(getActivity());
    l.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    l.setGravity(Gravity.CENTER);

    ProgressBar pb = new ProgressBar(getActivity());
    pb.getIndeterminateDrawable().setColorFilter(SIAApp.SIA_APP.school.getAccentColor(),
            PorterDuff.Mode.SRC_IN);
    pb.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    pb.setVisibility(ProgressBar.VISIBLE);

    l.addView(pb);
    sv.addView(l);
    return sv;
}