List of usage examples for android.widget ProgressBar setTag
public void setTag(final Object tag)
From source file:com.uzmap.pkg.uzmodules.photoBrowser.ImageBrowserAdapter.java
@Override public Object instantiateItem(ViewGroup container, final int position) { mViewContainer = container;/* ww w. j a v a 2s . c om*/ int item_view_id = UZResourcesIDFinder.getResLayoutID("photo_browser_item_layout"); View itemView = View.inflate(mContext, item_view_id, null); itemView.setTag(position); int photo_view_id = UZResourcesIDFinder.getResIdID("photoView"); final PhotoView imageView = (PhotoView) itemView.findViewById(photo_view_id); imageView.setZoomable(this.zoomEnable); int load_progress_id = UZResourcesIDFinder.getResIdID("loadProgress"); final ProgressBar progress = (ProgressBar) itemView.findViewById(load_progress_id); progress.setTag(position); mImageLoader.load(imageView, progress, mImagePaths.get(position)); mImageLoader.setOnLoadCompleteListener(new OnLoadCompleteListener() { @Override public void onLoadComplete(ProgressBar bar) { PhotoBrowser.callback(mUZContext, PhotoBrowser.EVENT_TYPE_LOADSUCCESSED, (Integer) bar.getTag()); } @Override public void onLoadFailed(final ProgressBar bar) { PhotoBrowser.callback(mUZContext, PhotoBrowser.EVENT_TYPE_LOADFAILED, (Integer) bar.getTag()); new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { bar.setVisibility(View.GONE); } }); } }); imageView.setOnViewTapListener(new OnViewTapListener() { @Override public void onViewTap(View arg0, float arg1, float arg2) { PhotoBrowser.callback(mUZContext, PhotoBrowser.EVENT_TYPE_CLICK, position); } }); imageView.setOnPhotoTapListener(new OnPhotoTapListener() { @Override public void onPhotoTap(View arg0, float arg1, float arg2) { PhotoBrowser.callback(mUZContext, PhotoBrowser.EVENT_TYPE_CLICK, position); } }); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PhotoBrowser.callback(mUZContext, PhotoBrowser.EVENT_TYPE_CLICK, position); } }); imageView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { PhotoBrowser.callback(mUZContext, PhotoBrowser.EVENT_TYPE_LONG_CLICK, position); return false; } }); container.addView(itemView); return itemView; }
From source file:com.ndn.menurandom.ImageDownloader.java
private void makeFrameLayout(ImageView imageView) { boolean isExist = false; ViewGroup vg = (ViewGroup) imageView.getParent(); if (vg instanceof FrameLayout) { FrameLayout frameLayout = (FrameLayout) vg; String tag = (String) frameLayout.getTag(); if (tag != null && tag.equals("fl_imagedownloader")) { isExist = true;//from w w w. j a v a2 s .c o m } } if (!isExist) { int childCount = vg.getChildCount(); int index = 0; while (index < childCount) { if (imageView == vg.getChildAt(index)) { break; } index++; } vg.removeViewAt(index); FrameLayout frameLayout = new FrameLayout(vg.getContext().getApplicationContext()); frameLayout.setTag("fl_imagedownloader"); ViewGroup.LayoutParams lpImageView = (ViewGroup.LayoutParams) imageView.getLayoutParams(); frameLayout.setLayoutParams(lpImageView); imageView.setLayoutParams(new LayoutParams(lpImageView.width, lpImageView.height)); frameLayout.setPadding(imageView.getPaddingLeft(), imageView.getPaddingTop(), imageView.getPaddingRight(), imageView.getPaddingBottom()); imageView.setPadding(0, 0, 0, 0); frameLayout.addView(imageView); vg.addView(frameLayout, index); ProgressBar progressBar = new ProgressBar(frameLayout.getContext()); progressBar.setTag("pb_imagedownloader"); int leftRightPadding = (imageView.getLayoutParams().width - 50) / 2; int topBottomPadding = (imageView.getLayoutParams().height - 50) / 2; progressBar.setPadding(leftRightPadding, topBottomPadding, leftRightPadding, topBottomPadding); frameLayout.addView(progressBar); } }