当前位置: 首页>>代码示例>>Java>>正文


Java ImageLoader.get方法代码示例

本文整理汇总了Java中com.android.volley.toolbox.ImageLoader.get方法的典型用法代码示例。如果您正苦于以下问题:Java ImageLoader.get方法的具体用法?Java ImageLoader.get怎么用?Java ImageLoader.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.volley.toolbox.ImageLoader的用法示例。


在下文中一共展示了ImageLoader.get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: savePrepared

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
public static void savePrepared() {
    if (prepared == null)
        throw new RuntimeException("No ImageItem prepared");
    Toast.makeText(Global.baseActivity, "Saving...", Toast.LENGTH_SHORT).show();
    System.out.println("Proceeding to save item " + prepared.getId() + " " + prepared.getTitle());
    ImageLoader loader = VolleySingleton.getInstance(null).getImageLoader();
    loader.get(prepared.getRequestUrl(), new ImageLoader.ImageListener() {
        @Override
        public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {
            if (response.getBitmap() == null)
                makeError();
            else {
                saveBitmapOnLocal(response.getBitmap());
            }
        }

        @Override
        public void onErrorResponse(VolleyError error) {
            makeError();
        }
    });
}
 
开发者ID:timitoc,项目名称:groupicture,代码行数:23,代码来源:SaveLocalManager.java

示例2: VolleyDataSource

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
public VolleyDataSource(
    final ImageLoader imageLoader,
    final Uri imageRequest,
    final AbstractDraweeControllerBuilder.CacheLevel cacheLevel) {

  String uriString = imageRequest.toString();
  int maxWidth = 0;
  int maxHeight = 0;

  if (cacheLevel != AbstractDraweeControllerBuilder.CacheLevel.FULL_FETCH) {
    if (!imageLoader.isCached(uriString, maxWidth, maxHeight)) {
      mImageContainer = null;
      setFailure(new NullPointerException("Image not found in bitmap-cache."));
      return;
    }
  }

  mImageContainer = imageLoader.get(
      uriString,
      new ImageLoader.ImageListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
          setFailure(error.getCause());
        }
        @Override
        public void onResponse(final ImageLoader.ImageContainer response, boolean isImmediate) {
          if (response.getBitmap() != null) {
            setResult(response.getBitmap(), true);
          }
        }
      },
      maxWidth,
      maxHeight);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:VolleyDataSource.java

示例3: setNonExistingUserImage

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
private void setNonExistingUserImage(final String createdUsername, final TextView textView) {
    Drawable profileRoundedDrawableImage = mCachedImages.get(createdUsername);

    if (profileRoundedDrawableImage == null) {
        ImageLoader imageLoader = VolleyRequestQueue.getInstance().getImageLoader();
        imageLoader.get(RESTGetPhoto.getURL(createdUsername), new ImageLoader.ImageListener() {
            @Override
            public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {
                if (response.getBitmap() != null) {
                    Drawable profileDrawableImage = convertProfileImageToRoundedDrawable(response.getBitmap());
                    textView.setCompoundDrawablesWithIntrinsicBounds(null, profileDrawableImage, null, null);
                    mCachedImages.put(createdUsername, profileDrawableImage);
                } else {
                    textView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_profile_default_small, 0, 0);
                    mCachedImages.put(createdUsername, textView.getCompoundDrawables()[1]);
                }
            }

            @Override
            public void onErrorResponse(VolleyError error) {
                textView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_profile_default_small, 0, 0);
                mCachedImages.put(createdUsername, textView.getCompoundDrawables()[1]);
            }
        });
    } else {
        textView.setCompoundDrawablesWithIntrinsicBounds(null, profileRoundedDrawableImage, null, null);
    }
}
 
开发者ID:Q115,项目名称:Goalie_Android,代码行数:29,代码来源:FeedsRecycler.java

示例4: completeBaseInfo

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
public void completeBaseInfo(String data)  {
    if(data != null) {
        Map<String,String> map = Utils.cutDoubanData(data);
        if(map.size() > 0 ) {
            try{
                //得到了正确的图书信息
                etDescription.setText(map.get("summary"));
                etAuthor.setText(map.get("author"));
                String originPrice = map.get("price");
                originPrice = originPrice.replace("元","");
                etOPrice.setText(originPrice);
                etBookName.setText(map.get("title"));
                etPublisher.setText(map.get("publisher"));
                ImageLoader loader = Mysingleton.getInstance(context).getImageLoader();
                int w  = getResources().getDimensionPixelSize(R.dimen.img_cover_width);
                int h  = getResources().getDimensionPixelSize(R.dimen.img_cover_height);
                coverDouBanUrl = map.get("image").replaceAll("\\\\","");
                loader.get(coverDouBanUrl,ImageLoader.getImageListener(imgCover,R.drawable.def,R.drawable.def),w,h);
                if(!btnAddCover.getText().toString().equals("更改封面"))
                    btnAddCover.setText("更改封面");
                loader = null;
            }catch (NullPointerException e) {
                Log.e("SellFragment","error in completeBaseInfo",e);
                //没有查到该图书信息
                Toast.makeText(context,"查询图书信息失败!lalal",Toast.LENGTH_SHORT).show();
            }
        }
        map =  null;
    }
    data = null;
}
 
开发者ID:rantianhua,项目名称:ShuTuier,代码行数:32,代码来源:CommitFragment.java

示例5: loadImage

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
/**
 * 限制图片的宽高,如果w,h的参数为0,则不压缩
 * @param imageView
 * @param url
 * @param w
 * @param h
 */
public static void loadImage(ImageView imageView, String url,int w,int h) {

    ImageLoader.ImageListener listener = ImageLoader.getImageListener(imageView,
            R.drawable.default_avatar_ori, R.drawable.default_avatar_ori);
    ImageLoader imageLoader = new ImageLoader(queue, new BitmapCache());

    if (w<=0||h<=0){
        imageLoader.get(url, listener);
    }else{
        imageLoader.get(url, listener,w,h);
    }
}
 
开发者ID:chenjunqian,项目名称:here,代码行数:20,代码来源:HttpRequest.java

示例6: get_imageloader

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
private void get_imageloader()
{
    textview.setText("获取图片开始了");
    networkImageView.setImageBitmap(null);
    imageView.setImageBitmap(null);
    String url = "http://g.hiphotos.baidu.com/image/pic/item/21a4462309f790521631d9e908f3d7ca7bcbd53f.jpg";

    ImageLoader loader = new ImageLoader(MyApplication.getHttpQueues(), new BitmapCache());
    ImageLoader.ImageListener listener = ImageLoader.getImageListener(imageView, R.drawable.default_icon , R.drawable.error );

    loader.get(url, listener);

}
 
开发者ID:Tim9Liu9,项目名称:volley_demo,代码行数:14,代码来源:ImagesActivity.java

示例7: getImage

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
public static void getImage(String imgUrl, ImageView view) {
    initRequestQueue();
    ImageLoader imageLoader = new ImageLoader(mRequestQueue, new BitmapCache());
    ImageLoader.ImageListener listener = ImageLoader.getImageListener(view, R.mipmap.loading, R.mipmap.email);
    imageLoader.get(imgUrl,listener);
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:7,代码来源:RequestManager.java

示例8: getUserPhoto

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
public static void getUserPhoto(String imgUrl, ImageView view) {
    initRequestQueue();
    ImageLoader imageLoader = new ImageLoader(mRequestQueue, new BitmapCache());
    ImageLoader.ImageListener listener = ImageLoader.getImageListener(view, R.mipmap.profile_picture, R.mipmap.profile_picture);
    imageLoader.get(imgUrl,listener);
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:7,代码来源:RequestManager.java

示例9: UseImageLoader

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
private void UseImageLoader() {
    ImageLoader imageLoader = new ImageLoader(mQueue, new BitmapCache());
    ImageLoader.ImageListener listener = ImageLoader.getImageListener(iv_image, R.drawable.ico_default, R.drawable.ico_default);
    imageLoader.get("http://img.my.csdn.net/uploads/201603/26/1458988468_5804.jpg", listener);
}
 
开发者ID:henrymorgen,项目名称:android-advanced-light,代码行数:6,代码来源:MainActivity.java

示例10: getImage

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
public void getImage(ImageView imageView, String url) {
    ImageLoader imageLoader = new ImageLoader(mRequestQueue, new BitmapCache());
    ImageLoader.ImageListener listener = ImageLoader.getImageListener(imageView,
            R.drawable.default_picture, R.drawable.default_picture);
    imageLoader.get(url, listener);
}
 
开发者ID:yuchenfw,项目名称:QuickNews,代码行数:7,代码来源:NewsAdapter.java

示例11: onCreate

import com.android.volley.toolbox.ImageLoader; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mJokeTextView = (TextView) findViewById(R.id.joke);

    // this is only for the sake of this example. Is common practice to use
    // a singleton to instantiate this once on a global scope
    mRequestQueue = Volley.newRequestQueue(this.getApplicationContext());

    mHttpUrlConnectionImageView = (ImageView) findViewById(R.id.httpurlconnection_image_view);
    new HttpURLConnectionImageAsyncTask(mHttpUrlConnectionImageView).execute(IMAGE_URL);

    mVolleyImageView = (ImageView) findViewById(R.id.volley_image_request_view);

    // you can use an image request and set the downloaded image on the onResponse callback
    // or set an error image or placeholder when the call fails
    ImageRequest imageRequest = new ImageRequest(IMAGE_URL, new Response.Listener<Bitmap>() {
        @Override
        public void onResponse(Bitmap response) {

            mVolleyImageView.setImageBitmap(response);
        }
    },
    0,
    0,
    ImageView.ScaleType.CENTER_CROP,
    null,
    new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            // show an error drawable
            mVolleyImageView.setImageDrawable(getDrawable(R.drawable.error));
        }
    }){
        @Override
        public Priority getPriority(){
            return Priority.LOW;
        }
    };

    // add the ImageRequest to the Volleys request queue
    mRequestQueue.add(imageRequest);

    // You can also user an ImageLoader with your custom ImageCache implementation
    mVolleyImageLoaderImageView = (ImageView) findViewById(R.id.volley_imageloader_view);
    mImageLoader = new ImageLoader(mRequestQueue, new LruBitmapCache(LruBitmapCache.getCacheSize(this)));
    mImageLoader.get(IMAGE_URL, ImageLoader.getImageListener(mVolleyImageLoaderImageView, R.mipmap.ic_launcher, R.drawable.error));

    // for super lazy programmers, you can use NetworkImageView in your View hierarchy that handles
    // request lifecycle for you
    mNetworkImageView = (NetworkImageView) findViewById(R.id.network_image_view);
    mNetworkImageView.setImageUrl(IMAGE_URL, mImageLoader);
    mNetworkImageView.setDefaultImageResId(R.mipmap.ic_launcher);
    mNetworkImageView.setErrorImageResId(R.drawable.error);

}
 
开发者ID:nico-gonzalez,项目名称:volley-it,代码行数:59,代码来源:MainActivity.java


注:本文中的com.android.volley.toolbox.ImageLoader.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。