List of usage examples for android.widget ImageView setTag
public void setTag(final Object tag)
From source file:es.ubiqua.atractivas.ArticlePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rss = ((ArticleActivity) getActivity()).m_parts.get(mPageNumber); // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_article_page, container, false); FontLoader.overrideFonts(rootView, "bold"); NoAutoScrollView scroll = (NoAutoScrollView) rootView.findViewById(R.id.content); if (((ArticleActivity) getActivity()).m_parts.size() <= 1) { ((ArticleActivity) getActivity()).hideButtons(); } else {/*w ww . ja v a 2s. c om*/ scroll.setOnEndScrollListener(new NoAutoScrollView.OnEndScrollListener() { @Override public void onEndScroll(boolean home, boolean end) { if (home || end) { ((ArticleActivity) getActivity()).showButtons(); } else { ((ArticleActivity) getActivity()).hideButtons(); } } }); } // Set the title view to show the page number. ((TextView) rootView.findViewById(R.id.DetalleCategoria)).setText(rss.getCategory()); ImageView favorito = (ImageView) rootView.findViewById(R.id.DetalleFavorito); favorito.setTag(rss); if (rss.getFavorito()) { favorito.setImageDrawable(ApplicationApp.getDrawable("favoritos_selected")); } else { favorito.setImageDrawable(ApplicationApp.getDrawable("favoritos")); } ((TextView) rootView.findViewById(R.id.DetalleTitulo)).setText(rss.getTitle()); favorito.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ImageView imagen = (ImageView) view; RssDataSource _rssDataSource = new RssDataSource(getActivity().getApplicationContext()); try { _rssDataSource.open(); } catch (SQLException e) { // Log.d( "action fragment_category", "Enter: handleMessage -> " + e.getMessage() ); } Rss rss = (Rss) imagen.getTag(); rss.setFavorito(!rss.getFavorito()); _rssDataSource.updateFavorito(rss.getId(), rss.getFavorito()); if (rss.getFavorito()) { imagen.setImageDrawable(ApplicationApp.getDrawable("favoritos_selected")); } else { imagen.setImageDrawable(ApplicationApp.getDrawable("favoritos")); } _rssDataSource.close(); } }); // whenever you want to load an image from url // call DisplayImage function // url - image url to load // loader - loader image, will be displayed before getting image // image - ImageView imgLoader.DisplayImage(rss.getImage(), R.drawable.placeholder_detalle, (ImageView) rootView.findViewById(R.id.DetalleImagen)); ((WebView) rootView.findViewById(R.id.DestalleFulltext)).loadData(HEADER + rss.getFullText() + FOOTER, "text/html; charset=UTF-8", null); yocAdBannerViewb = (YocAdViewContainer) rootView.findViewById(R.id.baner_publicidad); if (rss.getParentCategory().equals(new String("En Forma"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_ENFORMA_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Salud"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_SALUD_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Moda"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_MODA_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Nutricin"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_NUTRI_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else if (rss.getParentCategory().equals(new String("Belleza"))) { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_BELLEZA_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } else { _yocAdManagerb = new YocAdManager(getActivity(), ApplicationApp.YOC_TAG_GENERAL_BANNER, AdSize.BANNER_SMARTPHONE_480x80, new AdBanner()); } createLigAdView(ApplicationApp.LigatusId, rootView); return rootView; }
From source file:com.ayo.opensource.zlayout.MainPagerAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { View itemView;/* w ww . j a va2s.c o m*/ Girl girl = mAllGirlList.get(position); if (mAllImageMap.containsKey(position)) { View oldView = mAllImageMap.get(position); Object tag = oldView.getTag(); if (null != tag && tag instanceof Girl) { if (tag.equals(girl)) { itemView = oldView; container.addView(itemView); return itemView; } } container.removeView(oldView); mAllImageMap.remove(position); } ImageView imageView = new ImageView(mContext); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); VanGogh.paper(imageView).paintMiddleImage(girl.getImageUrl(), null, null); //Glide.with(mContext).load(girl.getImageUrl()).into(imageView); imageView.setTag(girl); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); imageView.setLayoutParams(layoutParams); mAllImageMap.put(position, imageView); itemView = imageView; itemView.setOnClickListener(this); container.addView(itemView); return itemView; }
From source file:com.blogspot.marioboehmer.thingibrowse.fragments.ThingDetailsFragment.java
private void showFiles(Map<String, String[]> files) { if (files.isEmpty()) { thingFilesSectionContainer.setVisibility(View.GONE); } else {/* www . j ava2s. com*/ thingFilesContainer.removeAllViews(); Iterator<Entry<String, String[]>> filesIterator = files.entrySet().iterator(); while (filesIterator.hasNext()) { Entry<String, String[]> file = filesIterator.next(); String[] fileDetails = file.getValue(); String name = fileDetails[0]; String size = fileDetails[1]; String imageUrl = fileDetails[2]; View fileView = layoutInflater.inflate(R.layout.thing_file_view, null); ImageView fileImage = (ImageView) fileView.findViewById(R.id.thing_file_image); ImageTag tag = imageTagFactory.build(imageUrl); fileImage.setTag(tag); imageLoader.load(fileImage); TextView fileName = (TextView) fileView.findViewById(R.id.thing_file_name); fileName.setText(name); TextView fileSize = (TextView) fileView.findViewById(R.id.thing_file_size); fileSize.setText(size); thingFilesContainer.addView(fileView); } thingFilesSectionContainer.setVisibility(View.VISIBLE); } }
From source file:com.scigames.slidegame.ProfileActivity.java
public void onResultsSucceeded(String[] serverResponseStrings, JSONObject serverResponseJSON) throws JSONException { //download photo ImageView profilePhoto = (ImageView) findViewById(R.id.imageView1); profilePhoto.setTag(photoUrl); photoTask.cancel(true);/* w ww . j ava2 s. co m*/ photoTask = new DownloadProfilePhoto(ProfileActivity.this, photoUrl); //AsyncTask<ImageView, Void, Bitmap> pPhoto = photoTask.execute(profilePhoto); //update all text fields Resources res = getResources(); TextView greets = (TextView) findViewById(R.id.greeting); greets.setText(String.format(res.getString(R.string.greeting), serverResponseStrings[2], serverResponseStrings[3])); TextView fname = (TextView) findViewById(R.id.first_name); fname.setText(String.format(res.getString(R.string.profile_first_name), serverResponseStrings[2])); TextView lname = (TextView) findViewById(R.id.last_name); lname.setText(String.format(res.getString(R.string.profile_last_name), serverResponseStrings[3])); TextView school = (TextView) findViewById(R.id.school_name); school.setText(String.format(res.getString(R.string.profile_school_name), "from DB")); TextView teacher = (TextView) findViewById(R.id.teacher_name); teacher.setText(String.format(res.getString(R.string.profile_teacher_name), "from DB")); TextView classid = (TextView) findViewById(R.id.class_id); classid.setText(String.format(res.getString(R.string.profile_classid), serverResponseStrings[7])); TextView mmass = (TextView) findViewById(R.id.mass); mmass.setText(String.format(res.getString(R.string.profile_mass), serverResponseStrings[5])); TextView memail = (TextView) findViewById(R.id.email); memail.setText(String.format(res.getString(R.string.profile_email), serverResponseStrings[6])); TextView mpass = (TextView) findViewById(R.id.password); mpass.setText(String.format(res.getString(R.string.profile_password), serverResponseStrings[8])); TextView mRfid = (TextView) findViewById(R.id.rfid); mRfid.setText(String.format(res.getString(R.string.profile_rfid), serverResponseStrings[9])); Log.d(TAG, "...Profile Info"); }
From source file:com.yanzhenjie.album.task.LocalImageLoader.java
/** * According to the specified width high loading pictures, wide high, the greater the picture clearer, more memory. * * @param imageView {@link ImageView}. * @param imagePath path from local SDCard. * @param width target width.//from w w w . j av a 2s . c o m * @param height target height. * @param loadListener {@link LoadListener}. */ public void loadImage(ImageView imageView, String imagePath, int width, int height, LoadListener loadListener) { imageView.setTag(imagePath); Bitmap bitmap = getImageFromCache(imagePath, width, height); if (bitmap == null) { imageView.setImageDrawable(DEFAULT_DRAWABLE); mExecutorService.execute(new TaskThread(this, imageView, imagePath, width, height, loadListener)); } else { ImgBeanHolder holder = new ImgBeanHolder(); holder.imageView = imageView; holder.imagePath = imagePath; holder.bitmap = bitmap; holder.loadListener = loadListener; getHandler().post(holder); } }
From source file:im.neon.util.VectorUtils.java
/** * Set the user avatar in an imageView.// w ww . j a v a 2 s . c o m * * @param context the context * @param session the session * @param imageView the image view * @param avatarUrl the avatar url * @param userId the user id * @param displayName the user display name */ public static void loadUserAvatar(final Context context, final MXSession session, final ImageView imageView, final String avatarUrl, final String userId, final String displayName) { // sanity check if ((null == session) || (null == imageView) || !session.isAlive()) { return; } // reset the imageView tag imageView.setTag(null); if (session.getMediasCache().isAvatarThumbnailCached(avatarUrl, context.getResources().getDimensionPixelSize(R.dimen.profile_avatar_size))) { session.getMediasCache().loadAvatarThumbnail(session.getHomeserverConfig(), imageView, avatarUrl, context.getResources().getDimensionPixelSize(R.dimen.profile_avatar_size)); } else { if (null == mImagesThread) { mImagesThread = new HandlerThread("ImagesThread", Thread.MIN_PRIORITY); mImagesThread.start(); mImagesThreadHandler = new android.os.Handler(mImagesThread.getLooper()); mUIHandler = new Handler(Looper.getMainLooper()); } final Bitmap bitmap = VectorUtils.getAvatar(imageView.getContext(), VectorUtils.getAvatarColor(userId), TextUtils.isEmpty(displayName) ? userId : displayName, false); // test if the default avatar has been computed if (null != bitmap) { imageView.setImageBitmap(bitmap); final String tag = avatarUrl + userId + displayName; imageView.setTag(tag); if (!MXMediasCache.isMediaUrlUnreachable(avatarUrl)) { mImagesThreadHandler.post(new Runnable() { @Override public void run() { if (TextUtils.equals(tag, (String) imageView.getTag())) { session.getMediasCache().loadAvatarThumbnail(session.getHomeserverConfig(), imageView, avatarUrl, context.getResources().getDimensionPixelSize(R.dimen.profile_avatar_size), bitmap); } } }); } } else { final String tmpTag0 = "00" + avatarUrl + "-" + userId + "--" + displayName; imageView.setTag(tmpTag0); // create the default avatar in the background thread mImagesThreadHandler.post(new Runnable() { @Override public void run() { if (TextUtils.equals(tmpTag0, (String) imageView.getTag())) { imageView.setTag(null); setDefaultMemberAvatar(imageView, userId, displayName); if (!MXMediasCache.isMediaUrlUnreachable(avatarUrl)) { final String tmpTag1 = "11" + avatarUrl + "-" + userId + "--" + displayName; imageView.setTag(tmpTag1); // wait that it is rendered to load the right one mUIHandler.post(new Runnable() { @Override public void run() { // test if the imageView tag has not been updated if (TextUtils.equals(tmpTag1, (String) imageView.getTag())) { final String tmptag2 = "22" + avatarUrl + userId + displayName; imageView.setTag(tmptag2); mImagesThreadHandler.post(new Runnable() { @Override public void run() { // test if the imageView tag has not been updated if (TextUtils.equals(tmptag2, (String) imageView.getTag())) { final Bitmap bitmap = VectorUtils.getAvatar( imageView.getContext(), VectorUtils.getAvatarColor(userId), TextUtils.isEmpty(displayName) ? userId : displayName, false); session.getMediasCache().loadAvatarThumbnail( session.getHomeserverConfig(), imageView, avatarUrl, context.getResources().getDimensionPixelSize( R.dimen.profile_avatar_size), bitmap); } } }); } } }); } } } }); } } }
From source file:com.aprz.easy_iosched.ui.widget.CustomRatingBar.java
/** * Creates ({@link ImageView}s) used to submit a rating using unfilled drawables and adds them to * the layout./*from www . j a v a2 s . c o m*/ */ private void createRatingViews() { for (int i = 0; i < mMaxRating; i++) { ImageView imageView = new ImageView(getContext()); imageView.setLayoutParams( new android.view.ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); int tagValue = i + 1; imageView.setTag(tagValue); imageView.setContentDescription(getContext().getString(R.string.feedback_rating_value, tagValue)); imageView.setImageDrawable(mUnfilledDrawable); imageView.setOnClickListener(this); addView(imageView); } }
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); 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//from ww w. j ava 2 s . com 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.scigames.registration.ProfileActivity.java
public void onResultsSucceeded(String[] serverResponseStrings, JSONObject serverResponseJSON) throws JSONException { //for debugging: // alertDialog.setTitle("incoming:"); // alertDialog.setMessage("active: " + serverResponseStrings[2] + // " mass: " + serverResponseStrings[5] + // " firstName: " + serverResponseStrings[2] + // " lastName: " + serverResponseStrings[3] + // " pw: " + serverResponseStrings[8] + // " classId: " + serverResponseStrings[14] + // " rfid: " + serverResponseStrings[9] // ); // alertDialog.show(); //download photo ImageView profilePhoto = (ImageView) findViewById(R.id.imageView1); profilePhoto.setTag(photoUrl); profilePhoto.setScaleX(1.4f);//from www . j a v a 2s .c o m profilePhoto.setScaleY(1.4f); profilePhoto.setX(120f); profilePhoto.setY(123f); photoTask.cancel(true); photoTask = new DownloadProfilePhoto(ProfileActivity.this, photoUrl); //AsyncTask<ImageView, Void, Bitmap> pPhoto = photoTask.execute(profilePhoto); //update all text fields Resources res = getResources(); //TextView greets = (TextView)findViewById(R.id.greeting); greets.setText(String.format(res.getString(R.string.profile_name), serverResponseStrings[2], serverResponseStrings[3])); //TextView fname = (TextView)findViewById(R.id.first_name); // fname.setText(String.format(res.getString(R.string.profile_first_name), serverResponseStrings[2])); // // //TextView lname = (TextView)findViewById(R.id.last_name); // lname.setText(String.format(res.getString(R.string.profile_last_name), serverResponseStrings[3])); //TextView school = (TextView)findViewById(R.id.school_name); //schoolname.setText(String.format(res.getString(R.string.profile_school_name), serverResponseStrings[14])); //TextView teacher = (TextView)findViewById(R.id.teacher_name); teachername.setText(String.format(res.getString(R.string.profile_teacher_name), serverResponseStrings[13])); //TextView classid = (TextView)findViewById(R.id.class_id); classid.setText(String.format(res.getString(R.string.profile_classid), serverResponseStrings[14])); // TextView mmass = (TextView)findViewById(R.id.mass); classname.setText(String.format(res.getString(R.string.profile_classname), serverResponseStrings[12])); //TextView mpass = (TextView)findViewById(R.id.password); mpass.setText(String.format(res.getString(R.string.profile_password), serverResponseStrings[8])); // TextView mRfid = (TextView)findViewById(R.id.rfid); // mRfid.setText(String.format(res.getString(R.string.profile_rfid), serverResponseStrings[9])); setTextViewFont(Museo500Regular, teachername, classid, mpass, classname); setTextViewFont(Museo700Regular, greets); Log.d(TAG, "...Profile Info"); }
From source file:com.dnielfe.manager.adapters.BrowserListAdapter.java
private final void setIcon(final File file, final ImageView icon) { final boolean isImage = MimeTypes.isPicture(file); final boolean isVideo = MimeTypes.isVideo(file); final boolean isApk = file.getName().endsWith(".apk"); // you can set a placeholder // IconPreview.INSTANCE.setPlaceholder(bitmap); if (isImage || isVideo) { icon.setTag(file.getAbsolutePath()); IconPreview.INSTANCE.loadBitmap(file, icon); } else if (isApk) { icon.setTag(file.getAbsolutePath()); IconPreview.INSTANCE.loadApk(file, icon, mContext); } else {/* w ww .j a v a 2 s .c om*/ loadFromRes(file, icon); } }