Search in sources :

Example 81 with ProgressBar

use of android.widget.ProgressBar in project bdcodehelper by boredream.

the class ImageBrowserAdapter method instantiateItem.

@Override
public View instantiateItem(final ViewGroup container, int position) {
    final View rootView = View.inflate(context, R.layout.item_image_browser, null);
    int index = position % picUrls.size();
    final ProgressBar pb_loading = (ProgressBar) rootView.findViewById(R.id.pb_loading);
    final ImageView iv_image_browser = (ImageView) rootView.findViewById(R.id.iv_image_browser);
    final PhotoViewAttacher pva = new PhotoViewAttacher(iv_image_browser);
    String url = picUrls.get(index).getImageUrl();
    Glide.with(context).load(url).diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop().crossFade().into(new SimpleTarget<GlideDrawable>() {

        @Override
        public void onLoadFailed(Exception e, Drawable errorDrawable) {
            super.onLoadFailed(e, errorDrawable);
            pb_loading.setVisibility(View.GONE);
            iv_image_browser.setVisibility(View.VISIBLE);
        }

        @Override
        public void onLoadStarted(Drawable placeholder) {
            super.onLoadStarted(placeholder);
            pb_loading.setVisibility(View.VISIBLE);
            iv_image_browser.setVisibility(View.GONE);
        }

        @Override
        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
            pb_loading.setVisibility(View.GONE);
            iv_image_browser.setVisibility(View.VISIBLE);
            iv_image_browser.setImageDrawable(resource);
            pva.update();
        }
    });
    pva.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {

        @Override
        public void onPhotoTap(View view, float x, float y) {
            context.onBackPressed();
        }
    });
    container.addView(rootView);
    return rootView;
}
Also used : GlideDrawable(com.bumptech.glide.load.resource.drawable.GlideDrawable) Drawable(android.graphics.drawable.Drawable) ImageView(android.widget.ImageView) View(android.view.View) PhotoViewAttacher(uk.co.senab.photoview.PhotoViewAttacher) ImageView(android.widget.ImageView) ProgressBar(android.widget.ProgressBar) GlideDrawable(com.bumptech.glide.load.resource.drawable.GlideDrawable)

Example 82 with ProgressBar

use of android.widget.ProgressBar in project coins-android by bubelov.

the class ProgressDialog method show.

public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable, OnCancelListener cancelListener) {
    ProgressDialog dialog = new ProgressDialog(context);
    dialog.setTitle(title);
    dialog.setCancelable(cancelable);
    dialog.setOnCancelListener(cancelListener);
    /* The next line will add the ProgressBar to the dialog. */
    dialog.addContentView(new ProgressBar(context), new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    dialog.show();
    return dialog;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) ProgressBar(android.widget.ProgressBar)

Example 83 with ProgressBar

use of android.widget.ProgressBar in project android-toolbox by Knickedi.

the class TabManagerView method generateDefaultTabProgrammatically.

private View generateDefaultTabProgrammatically() {
    DefaultLayoutSetup setup = mDefaultLayoutSetup;
    FrameLayout imageContainer = new FrameLayout(getContext());
    LinearLayout.LayoutParams icp = new LinearLayout.LayoutParams(setup.image + setup.overlayOffset * 2, LayoutParams.WRAP_CONTENT);
    icp.gravity = Gravity.CENTER_HORIZONTAL;
    imageContainer.setLayoutParams(icp);
    ProgressBar busy = new ProgressBar(getContext(), null, android.R.attr.progressBarStyleSmall);
    FrameLayout.LayoutParams bp = new FrameLayout.LayoutParams(setup.overlay, setup.overlay + setup.border);
    busy.setLayoutParams(bp);
    busy.setId(android.R.id.icon1);
    busy.setVisibility(View.GONE);
    busy.setPadding(0, 0, 0, setup.border);
    ImageView status = new ImageView(getContext());
    FrameLayout.LayoutParams sp = new FrameLayout.LayoutParams(setup.overlay, setup.overlay + setup.border);
    sp.gravity = Gravity.RIGHT | Gravity.TOP;
    status.setLayoutParams(sp);
    status.setId(android.R.id.icon2);
    status.setVisibility(View.GONE);
    status.setPadding(0, 0, 0, setup.border);
    ImageView image = new ImageView(getContext());
    FrameLayout.LayoutParams ip = new FrameLayout.LayoutParams(setup.image, setup.image + setup.border + setup.overlayOffset);
    ip.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
    image.setLayoutParams(ip);
    image.setId(android.R.id.icon);
    image.setVisibility(View.GONE);
    image.setPadding(0, setup.overlayOffset, 0, setup.border);
    imageContainer.addView(image);
    imageContainer.addView(busy);
    imageContainer.addView(status);
    LinearLayout tab = new LinearLayout(getContext());
    tab.setOrientation(LinearLayout.VERTICAL);
    tab.setGravity(Gravity.BOTTOM);
    tab.setPadding(setup.border, setup.border, setup.border, 0);
    TextView title = new TextView(getContext());
    LinearLayout.LayoutParams tp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    tp.gravity = Gravity.CENTER_HORIZONTAL;
    tp.bottomMargin = setup.border;
    title.setLayoutParams(tp);
    title.setEllipsize(TruncateAt.MARQUEE);
    title.setSingleLine(true);
    title.setId(android.R.id.title);
    title.setVisibility(View.GONE);
    title.setTextColor(new ColorStateList(new int[][] { { android.R.attr.state_selected }, { android.R.attr.state_pressed }, {} }, setup.titleColors));
    StateListDrawable background = new StateListDrawable();
    background.addState(new int[] { android.R.attr.state_selected }, new GradientDrawable(setup.selectedOrientation, setup.selectedColors));
    background.addState(new int[] { android.R.attr.state_pressed }, new GradientDrawable(setup.pressedOrientation, setup.pressedColors));
    background.addState(new int[] {}, new GradientDrawable(setup.normalOrientation, setup.noramlColors));
    tab.addView(imageContainer);
    tab.addView(title);
    tab.setBackgroundDrawable(background);
    return tab;
}
Also used : FrameLayout(android.widget.FrameLayout) ColorStateList(android.content.res.ColorStateList) TextView(android.widget.TextView) ImageView(android.widget.ImageView) StateListDrawable(android.graphics.drawable.StateListDrawable) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout) GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 84 with ProgressBar

use of android.widget.ProgressBar in project android_frameworks_base by AOSPA.

the class ActionBarView method initIndeterminateProgress.

public void initIndeterminateProgress() {
    mIndeterminateProgressView = new ProgressBar(mContext, null, 0, mIndeterminateProgressStyle);
    mIndeterminateProgressView.setId(R.id.progress_circular);
    mIndeterminateProgressView.setVisibility(GONE);
    addView(mIndeterminateProgressView);
}
Also used : ProgressBar(android.widget.ProgressBar)

Example 85 with ProgressBar

use of android.widget.ProgressBar in project android_frameworks_base by AOSPA.

the class ActionBarView method initProgress.

public void initProgress() {
    mProgressView = new ProgressBar(mContext, null, 0, mProgressStyle);
    mProgressView.setId(R.id.progress_horizontal);
    mProgressView.setMax(10000);
    mProgressView.setVisibility(GONE);
    addView(mProgressView);
}
Also used : ProgressBar(android.widget.ProgressBar)

Aggregations

ProgressBar (android.widget.ProgressBar)193 TextView (android.widget.TextView)66 View (android.view.View)63 ImageView (android.widget.ImageView)41 LinearLayout (android.widget.LinearLayout)30 Context (android.content.Context)18 ViewGroup (android.view.ViewGroup)16 WindowManager (android.view.WindowManager)14 FrameLayout (android.widget.FrameLayout)14 Drawable (android.graphics.drawable.Drawable)13 Dialog (android.app.Dialog)12 Button (android.widget.Button)12 RelativeLayout (android.widget.RelativeLayout)12 LayoutInflater (android.view.LayoutInflater)11 SuppressLint (android.annotation.SuppressLint)10 LayoutParams (android.widget.LinearLayout.LayoutParams)9 Intent (android.content.Intent)8 LayoutParams (android.view.ViewGroup.LayoutParams)8 AlertDialog (android.app.AlertDialog)7 TypedArray (android.content.res.TypedArray)7