Java Code Examples for com.android.volley.toolbox.NetworkImageView#setImageUrl()
The following examples show how to use
com.android.volley.toolbox.NetworkImageView#setImageUrl() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CircleOf6Application.java From OpenCircle with GNU General Public License v3.0 | 6 votes |
public void setUpLogo(NetworkImageView logo, DBHelper dbHelper){ //Get the set college String college_id = AppPreferences.getInstance(this).getCollegeLocation(); if (!college_id.equals("")) { CollegeCountry collegeCountry; if (college_id.startsWith("c_")) { //this is campus, find parent collegeCountry = dbHelper.getParentCollege(college_id.replace("c_", "")); } else { collegeCountry = dbHelper.getCollege(college_id); } if (!isUniversalFlavor()) { logo.setVisibility(View.VISIBLE); ImageLoader imageLoader = getImageLoader(); logo.setImageUrl(collegeCountry.getLogoUrl(), imageLoader); } } }
Example 2
Source File: CarouselImageFragment.java From Android-SDK with MIT License | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.fragment_carousel_dialog, container, false); image = (NetworkImageView) rootView.findViewById(R.id.carousel_image); String url = getArguments().getString("url"); ImageLoader imgLoader = MyVolley.getInstance(getActivity().getApplicationContext()) .getImageLoader(); image.setImageUrl(url, imgLoader); return rootView; }
Example 3
Source File: PhotoDetailFragment.java From soas with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_photo_detail, container, false); if (mPhoto != null) { NetworkImageView photo = (NetworkImageView) rootView.findViewById(R.id.photo); photo.setImageUrl(mPhoto.photoFileUrl, SoasApplication.getImageLoader(getActivity())); photo.setDefaultImageResId(R.drawable.default_photo); TextView photoName = (TextView) rootView.findViewById(R.id.photoName); photoName.setText(mPhoto.photoTitle); TextView photoOwner = (TextView) rootView.findViewById(R.id.photoOwner); photoOwner.setText(mPhoto.ownerName); } return rootView; }
Example 4
Source File: HaikuFragment.java From gplus-haiku-client-android with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_haiku, container, false); VolleyContainer volley = VolleyContainer.getInstance(getActivity()); if (mHaiku != null) { NetworkImageView profile = ((NetworkImageView) v.findViewById(R.id.haiku_profile_pic)); profile.setImageUrl(mHaiku.author.googlePhotoUrl, volley.getImageLoader()); ((TextView) v.findViewById(R.id.haiku_title)).setText(mHaiku.title); ((TextView) v.findViewById(R.id.haiku_line_one)).setText(mHaiku.lineOne); ((TextView) v.findViewById(R.id.haiku_line_two)).setText(mHaiku.lineTwo); ((TextView) v.findViewById(R.id.haiku_line_three)).setText(mHaiku.lineThree); ((TextView) v.findViewById(R.id.haiku_user_display_name)) .setText(mHaiku.author.googleDisplayName); ((TextView) v.findViewById(R.id.haiku_date)).setText(mHaiku.getFormattedDate()); ((TextView) v.findViewById(R.id.haiku_vote_count)).setText(mHaiku.votes + " votes"); ((Button) v.findViewById(R.id.button_promote)).setOnClickListener(this); ((Button) v.findViewById(R.id.button_vote)).setOnClickListener(this); } return v; }
Example 5
Source File: CloudDetailActivity.java From TraceByAmap with MIT License | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater layoutInflater = LayoutInflater.from(context); convertView = layoutInflater.inflate(R.layout.photo_layout, null); NetworkImageView imagev = (NetworkImageView) convertView .findViewById(R.id.ItemImage); imagev.setDefaultImageResId(R.drawable.ic_launcher); imagev.setImageUrl(mImageitem.get(position).getPreurl(), mImageLoader); return convertView; }
Example 6
Source File: NetworkImageViewAdapter.java From android-open-project-demo with Apache License 2.0 | 5 votes |
@Override void setImage(ImageView imageView, String imageUrl) { NetworkImageView networkImageView=(NetworkImageView)imageView; networkImageView.setDefaultImageResId(R.drawable.ic_empty); networkImageView.setErrorImageResId(R.drawable.ic_empty); networkImageView.setImageUrl(StringUtil.preUrl(imageUrl), imageLoader); }
Example 7
Source File: NetworkImageViewActivity.java From android-opensource-library-56 with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_network_image_view); RequestQueue queue = Volley.newRequestQueue(this); ImageLoader loader = new ImageLoader(queue, new NoImageCache()); String url = "http://farm6.staticflickr.com/5026/5735032857_68a332481e_z.jpg"; NetworkImageView imageView = (NetworkImageView) findViewById(R.id.image); imageView.setDefaultImageResId(R.drawable.ic_launcher); imageView.setErrorImageResId(R.drawable.ic_launcher); imageView.setImageUrl(url, loader); }
Example 8
Source File: BaseLearningActivity.java From allenglish with Apache License 2.0 | 4 votes |
private void addView(List<LeanCloudApiBean.ResultsEntity> list) { LayoutInflater inflater = LayoutInflater.from(mContext); //实例化一个LinearLayout LinearLayout linear = new LinearLayout(this); //设置LinearLayout属性(宽和高) LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 120); //将以上的属性赋给LinearLayout linear.setLayoutParams(layoutParams); ImageLoader imageLoader = new ImageLoader(VolleySingleton.getInstance().getRequestQueue(), BaseApplication.getInstance().getBitmapCache()); for (final LeanCloudApiBean.ResultsEntity lc : list) { // 获取需要添加的布局 CardView layout = (CardView) inflater.inflate( R.layout.item_article_list, linear).findViewById(R.id.card_view); if (layout.getParent() != null) ((LinearLayout) layout.getParent()).removeView(layout); // <- fix // 将布局加入到当前布局中 linearLayout.addView(layout); TextView title = (TextView) layout.findViewById(R.id.title); TextView source = (TextView) layout.findViewById(R.id.source); NetworkImageView picture = (NetworkImageView) layout.findViewById(R.id.picture); if (lc.type == 0) { title.setText(lc.title); try { source.setText(lc.source + " " + TimeUtils.DATE_FORMAT_DATE.format(TimeUtils.FULL_DATE_FORMAT_DATE.parse(lc.postTime.iso))); } catch (ParseException e) { e.printStackTrace(); } if (isShowPicture) { if (lc.imageUrl.isEmpty()) { picture.setVisibility(View.GONE); } else { picture.setVisibility(View.VISIBLE); picture.setDefaultImageResId(R.drawable.ic_default); picture.setErrorImageResId(R.drawable.ic_default); picture.setImageUrl(lc.imageUrl, imageLoader); } } else { picture.setVisibility(View.GONE); } layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = getIntent(); intent.putExtra("BEAN", lc); intent.putExtra("TABLE_NAME", tableName); intent.putExtra("BILINGUAL_READING_TAG", bilingualReadingTag); finish(); startActivity(intent); } }); } else { NativeADDataRef nativeADDataRef = lc.nativeADDataRef; title.setText(nativeADDataRef.getTitle() != null ? nativeADDataRef.getTitle() : nativeADDataRef.getSubTitle()); source.setText("广告"); if (isShowPicture) { picture.setImageUrl(nativeADDataRef.getImage(), imageLoader); picture.setDefaultImageResId(R.drawable.ic_default); picture.setErrorImageResId(R.drawable.ic_default); } else { picture.setVisibility(View.GONE); } CommonUtils.setAds(layout, lc.iflyNativeAd, nativeADDataRef); adCardView = layout; nativeADDataRef2 = nativeADDataRef; } } }
Example 9
Source File: ImageRequester.java From material-components-android with Apache License 2.0 | 4 votes |
public void setImageFromUrl(NetworkImageView networkImageView, String url) { networkImageView.setImageUrl(url, imageLoader); }
Example 10
Source File: ImageRequester.java From material-components-android with Apache License 2.0 | 4 votes |
public void setImageFromUrl(NetworkImageView networkImageView, String url) { networkImageView.setImageUrl(url, imageLoader); }
Example 11
Source File: HorizontalImageRecyclerViewAdapter.java From Netease with GNU General Public License v3.0 | 4 votes |
private void setNetworkImageView(NetworkImageView networkImageView, String url) { networkImageView.setDefaultImageResId(defaultImage); networkImageView.setErrorImageResId(defaultImage); networkImageView.setImageUrl(url, MySingleton.getInstance(mContext.getApplicationContext()).getImageLoader()); }
Example 12
Source File: NormalRecyclerViewAdapter.java From Netease with GNU General Public License v3.0 | 4 votes |
private void setNetworkImageView(NetworkImageView networkImageView, String url) { networkImageView.setDefaultImageResId(defaultImage); networkImageView.setErrorImageResId(defaultImage); networkImageView.setImageUrl(url, MySingleton.getInstance(mContext.getApplicationContext()).getImageLoader()); }
Example 13
Source File: NetworkFragment.java From okulus with Apache License 2.0 | 4 votes |
private void loadImage(final ImageView imageView, final int position) { final String imageurl = (String) getItem(position); switch (getItemViewType(position)) { //Volley - ImageRequest case 0: { final ImageRequest request = new ImageRequest( imageurl, new Response.Listener<Bitmap>() { @Override public void onResponse(Bitmap response) { imageView.setImageBitmap(response); } }, dpToPx(128), dpToPx(96), null, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } } ); mRequestQueue.add(request); break; } //Volley - NetworkImageView - In this case, NetworkImageView has been modified to extend OkulusImageView case 1: { final NetworkImageView networkImageView = (NetworkImageView) imageView; networkImageView.setImageUrl(imageurl, mImageLoader); break; } //Picasso case 2: { Picasso.with(imageView.getContext()) .load(imageurl) .resize(dpToPx(128), dpToPx(96)) .centerCrop() .into(new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { imageView.setImageBitmap(bitmap); } @Override public void onBitmapFailed(Drawable errorDrawable) { } @Override public void onPrepareLoad(Drawable placeHolderDrawable) { } }); break; } //Glide case 3: { Glide.with(imageView.getContext()) .load(imageurl) .asBitmap() //.override(dpToPx(128), dpToPx(96)) .centerCrop() .into(new ViewTarget<ImageView, Bitmap>(imageView) { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { imageView.setImageBitmap(resource); } }); break; } // Universal Image Loader case 4: { ImageSize targetSize = new ImageSize(dpToPx(96), dpToPx(128)); mUniversalImageLoader.loadImage(imageurl, targetSize, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { imageView.setImageBitmap(loadedImage); } }); break; } } }
Example 14
Source File: HaikuArrayAdapter.java From gplus-haiku-client-android with Apache License 2.0 | 4 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { final int type = getItemViewType(position); if (type == ViewTypes.EMPTY_ITEM.ordinal()) { if (convertView == null) { convertView = mInflater.inflate(R.layout.haiku_empty, parent, false); } } else if (type == ViewTypes.FILTER_ITEM.ordinal()) { if (convertView == null) { convertView = mInflater.inflate(R.layout.list_header, parent, false); } if (mListener != null) { convertView.findViewById(R.id.button_create_haiku).setOnClickListener(mListener); convertView.findViewById(R.id.radio_everyone).setOnClickListener(mListener); convertView.findViewById(R.id.radio_friends).setOnClickListener(mListener); } ((RadioButton) convertView.findViewById(R.id.radio_everyone)) .setChecked(HaikuClient.StreamMode.ALL.equals(mCurrentMode)); ((RadioButton) convertView.findViewById(R.id.radio_friends)) .setChecked(HaikuClient.StreamMode.FRIENDS.equals(mCurrentMode)); } else { if (convertView == null) { convertView = mInflater.inflate(R.layout.haiku_item, parent, false); } Haiku item = getItem(position - (mDisplayHeader ? 1 : 0)); NetworkImageView profile = ((NetworkImageView) convertView.findViewById(R.id.haiku_profile_pic)); profile.setImageUrl(item.author.googlePhotoUrl, mVolley.getImageLoader()); ((TextView) convertView.findViewById(R.id.haiku_title)) .setText(item.title); ((TextView) convertView.findViewById(R.id.haiku_user_display_name)) .setText(item.author.googleDisplayName); ((TextView) convertView.findViewById(R.id.haiku_date)).setText(item.getFormattedDate()); ((TextView) convertView.findViewById(R.id.haiku_vote_count)) .setText(item.votes + " Votes"); } return convertView; }
Example 15
Source File: VolleyHelper.java From AndroidLinkup with GNU General Public License v2.0 | 3 votes |
/** * 加载网络图片到NetworkImageView * * @param niv * NetworkImageView实例 * @param url * url地址 */ public void loadNetImage(NetworkImageView niv, String url) { ImageLoader imageLoader = new ImageLoader(requestQueue, new BitmapCache()); niv.setTag("url"); niv.setImageUrl(url, imageLoader); }
Example 16
Source File: ImageRequester.java From material-components-android-codelabs with Apache License 2.0 | 2 votes |
/** * Sets the image on the given {@link NetworkImageView} to the image at the given URL * * @param networkImageView {@link NetworkImageView} to set image on * @param url URL of the image */ public void setImageFromUrl(NetworkImageView networkImageView, String url) { networkImageView.setImageUrl(url, imageLoader); }