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;
}
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;
}
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;
}
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);
}
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);
}
Aggregations