當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageContainer類代碼示例

本文整理匯總了Java中com.android.volley.toolbox.ImageLoader.ImageContainer的典型用法代碼示例。如果您正苦於以下問題:Java ImageContainer類的具體用法?Java ImageContainer怎麽用?Java ImageContainer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ImageContainer類屬於com.android.volley.toolbox.ImageLoader包,在下文中一共展示了ImageContainer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMovedToScrapHeap

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
@Override
public void onMovedToScrapHeap(View view) {
    // cancel image fetch requests if the view has been moved to recycler.

    NetworkImageView niv = (NetworkImageView) view.findViewById(R.id.theme_grid_item_image);
    if (niv != null) {
        // this tag is set in the ThemeTabAdapter class
        ScreenshotHolder tag =  (ScreenshotHolder) niv.getTag();
        if (tag != null && tag.requestURL != null) {
            // need a listener to cancel request, even if the listener does nothing
            ImageContainer container = WordPress.imageLoader.get(tag.requestURL, new ImageListener() {
                @Override
                public void onErrorResponse(VolleyError error) { }

                @Override
                public void onResponse(ImageContainer response, boolean isImmediate) { }

            });
            container.cancelRequest();
        }
    }
}
 
開發者ID:ldsddn,項目名稱:wordpress_app_android,代碼行數:23,代碼來源:ThemeTabFragment.java

示例2: getDrawable

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
@Override
public Drawable getDrawable(String source) {
    source = checkUrl(source);
    UrlDrawable urlDrawable = new UrlDrawable();

    ImageContainer ic = mImageLoader.getForImageSpan(this, source, mTextView, new ImageCallback(mCtx.getResources(), urlDrawable));
    // TODO 當帖子滾動屏幕外的時候 如何和ImageView一樣 取消前麵沒用的下載請求???
    if (ic != null && ic.getBitmap() != null) {
        BitmapDrawable drawable = new BitmapDrawable(mCtx.getResources(), ic.getBitmap());
        drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
        return drawable;
    }
    if (ic != null) {
        mImageContainers.add(ic);
    }
    // get the actual source
    // ImageGetterAsyncTask asyncTask = new ImageGetterAsyncTask(urlDrawable);
    // asyncTask.execute(source);

    // return reference to URLDrawable where I will change with actual image from
    // the src tag
    return urlDrawable;
}
 
開發者ID:goodev,項目名稱:android-discourse,代碼行數:24,代碼來源:UrlImageGetter.java

示例3: imagePromise

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
public static Promise<ImageResult> imagePromise(ImageLoader imageLoader, final String url, int maxWidth, int maxHeight) {
    final DeferredObject<ImageResult> promise = new DeferredObject<ImageResult>();

    imageLoader.get(url, new ImageListener() {
        @Override
        public void onResponse(ImageContainer imageContainer, boolean isImmediate) {
            if (imageContainer.getBitmap() != null) {
                promise.success(new ImageResult(imageContainer, isImmediate));
            }
        }

        @Override
        public void onErrorResponse(VolleyError volleyError) {
            promise.failure(volleyError);
        }
    }, maxWidth, maxHeight);

    return promise;
}
 
開發者ID:CodeAndMagic,項目名稱:android-promise-volley,代碼行數:20,代碼來源:VolleyImagePromise.java

示例4: fetchCover

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
private void fetchCover() {
	fetching_cover = true;
	updateProgress();
	
	App.getImageLoader().get( API.getCoverUrl( manga.getCover() ),
		new ImageListener() {
			@Override
			public void onResponse( ImageContainer container, boolean something ) {
				TransitionDrawable cover_transition = new TransitionDrawable( new Drawable[]{
				cover_view.getDrawable(),
				new BitmapDrawable( getResources(), container.getBitmap() ) } );
				cover_view.setImageDrawable( cover_transition );
				cover_transition.startTransition( 200 );
				fetching_cover = false;
				updateProgress();
			}

			@Override public void onErrorResponse( VolleyError error ) {
				Log.e( "MJ", "Failed to fetch cover for " + manga.getSysName() );
				fetching_cover = false;
				updateProgress();
			}
		}
	);
}
 
開發者ID:Alexander-Prime,項目名稱:MangaJunkie-Android,代碼行數:26,代碼來源:MangaActivity.java

示例5: ChildViewBuffer

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
ChildViewBuffer(View v) {
	mImageView = (NetworkImageView) v.findViewById(R.id.ImageView);
	mImageView.setErrorImageResId(R.drawable.logo);
	mTitleText = (TextView) v.findViewById(R.id.Title);
	mNumText = (TextView) v.findViewById(R.id.Num);
	iImageLoader = VolleyLoader.getInstance().getImageLoader();
	iImageListener = new ImageListener() {

		@Override
		public void onErrorResponse(VolleyError error) {
			Log.d("TAG", "onErrorResponse():" + error);

		}

		@Override
		public void onResponse(ImageContainer response,
				boolean isImmediate) {
			Log.d("TAG", "onResponse():" + isImmediate);

		}
	};
}
 
開發者ID:ruiyuLee,項目名稱:UnionListView,代碼行數:23,代碼來源:TwoUnionView.java

示例6: onBindViewHolder

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
@SuppressLint("ResourceAsColor")
@Override
public void onBindViewHolder(final ContactViewHolder contactViewHolder,
                             int i) {

    contactViewHolder.playername.setText(list.get(i).getfName());

    String player = playerimage.replace("myplayerid", list.get(i).getId());

    mImageLoader.get(player, new ImageListener() {

        @Override
        public void onErrorResponse(VolleyError error) {

        }

        @Override
        public void onResponse(ImageContainer response, boolean arg1) {
            if (response.getBitmap() != null) {
                contactViewHolder.player
                        .setImageBitmap(getRoundedCornerBitmap(
                                response.getBitmap(), 100));
            }
        }
    });

}
 
開發者ID:pd130,項目名稱:CricketBuzz,代碼行數:28,代碼來源:MatchSquadAdapter.java

示例7: loadLoResImage

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
private void loadLoResImage() {
    if (!hasLayout() || TextUtils.isEmpty(mLoResImageUrl)) {
        return;
    }

    // skip if this same image url is already being loaded
    if (isRequestingUrl(mLoResContainer, mLoResImageUrl)) {
        AppLog.d(AppLog.T.READER, "reader photo > already requesting lo-res");
        return;
    }

    Point pt = DisplayUtils.getDisplayPixelSize(this.getContext());
    int maxSize = Math.min(pt.x, pt.y);

    showProgress();

    mLoResContainer = WordPress.imageLoader.get(mLoResImageUrl,
            new ImageLoader.ImageListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    AppLog.e(AppLog.T.READER, error);
                    hideProgress();
                    showError();
                }

                @Override
                public void onResponse(final ImageContainer response, boolean isImmediate) {
                    post(new Runnable() {
                        @Override
                        public void run() {
                            handleResponse(response.getBitmap(), true);
                        }
                    });
                }
            }, maxSize, maxSize);
}
 
開發者ID:ldsddn,項目名稱:wordpress_app_android,代碼行數:37,代碼來源:ReaderPhotoView.java

示例8: loadHiResImage

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
private void loadHiResImage() {
    if (!hasLayout() || TextUtils.isEmpty(mHiResImageUrl)) {
        return;
    }

    if (isRequestingUrl(mHiResContainer, mHiResImageUrl)) {
        AppLog.d(AppLog.T.READER, "reader photo > already requesting hi-res");
        return;
    }

    Point pt = DisplayUtils.getDisplayPixelSize(this.getContext());
    int maxSize = Math.max(pt.x, pt.y);

    mHiResContainer = WordPress.imageLoader.get(mHiResImageUrl,
            new ImageLoader.ImageListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    AppLog.e(AppLog.T.READER, error);
                }

                @Override
                public void onResponse(final ImageContainer response, boolean isImmediate) {
                    post(new Runnable() {
                        @Override
                        public void run() {
                            handleResponse(response.getBitmap(), false);
                        }
                    });
                }
            }, maxSize, maxSize);
}
 
開發者ID:ldsddn,項目名稱:wordpress_app_android,代碼行數:32,代碼來源:ReaderPhotoView.java

示例9: onMovedToScrapHeap

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
@Override
public void onMovedToScrapHeap(View view) {
    // cancel image fetch requests if the view has been moved to recycler.

    View imageView = view.findViewById(R.id.media_grid_item_image);
    if (imageView != null) {
        // this tag is set in the MediaGridAdapter class
        String tag = (String) imageView.getTag();
        if (tag != null && tag.startsWith("http")) {
            // need a listener to cancel request, even if the listener does nothing
            ImageContainer container = WordPress.imageLoader.get(tag, new ImageListener() {
                @Override
                public void onErrorResponse(VolleyError error) { }

                @Override
                public void onResponse(ImageContainer response, boolean isImmediate) { }

            });
            container.cancelRequest();
        }
    }

    CheckableFrameLayout layout = (CheckableFrameLayout) view.findViewById(R.id.media_grid_frame_layout);
    if (layout != null) {
        layout.setOnCheckedChangeListener(null);
    }
}
 
開發者ID:ldsddn,項目名稱:wordpress_app_android,代碼行數:28,代碼來源:MediaGridFragment.java

示例10: testVolleyImageLoaderGetNullHost

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
public void testVolleyImageLoaderGetNullHost() throws InterruptedException {
    Handler mainLooperHandler = new Handler(WordPress.getContext().getMainLooper());
    final CountDownLatch countDownLatch = new CountDownLatch(1);
    final boolean success[] = new boolean[1];
    Runnable getImage = new Runnable() {
        @Override
        public void run() {
            try {
                // This call crash on old volley versions
                WordPress.imageLoader.get("http;///hello/null/host", new ImageListener() {
                    @Override
                    public void onResponse(ImageContainer imageContainer, boolean b) {}

                    @Override
                    public void onErrorResponse(VolleyError volleyError) {}
                }, 1, 1);
                success[0] = true;
            } catch (Exception e) {
                AppLog.e(T.TESTS, e);
                success[0] = false;
            } finally {
                countDownLatch.countDown();
            }
        }
    };
    mainLooperHandler.post(getImage);
    countDownLatch.await(1, TimeUnit.SECONDS);
    assertTrue("Invalid Volley library version", success[0]);
}
 
開發者ID:ldsddn,項目名稱:wordpress_app_android,代碼行數:30,代碼來源:WPNetworkImageViewTest.java

示例11: onResponse

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
@Override
public void onResponse(ImageContainer response, boolean isImmediate) {
	if(isCancel)return;
	if (response.getBitmap() != null) {
		imgView.setImageBitmap(response.getBitmap());
	} else if (defaultImageResId != 0) {
		imgView.setImageResource(defaultImageResId);
	}
	mImageMaps.remove(this);
}
 
開發者ID:simplelifetian,項目名稱:GomeOnline,代碼行數:11,代碼來源:ImageLoader.java

示例12: onDestroy

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
@Override
public void onDestroy() {
	super.onDestroy();
       
	getActivity().unregisterReceiver( update_receiver );
	for ( ImageContainer request : cover_requests.values() ) request.cancelRequest();
}
 
開發者ID:Alexander-Prime,項目名稱:MangaJunkie-Android,代碼行數:8,代碼來源:CollectionFragment.java

示例13: showProgressNotification

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
private void showProgressNotification( Chapter chapter ) {
	final NotificationManager manager = (NotificationManager)getSystemService( NOTIFICATION_SERVICE );
	
	// Only show the chapter title if there is one
	String content_text = chapter.getManga().getTitle() + " " + chapter.toString();
	if ( chapter.hasTitle() ) content_text += ": " + chapter.getTitle();
	
	final Notification.Builder builder = new Notification.Builder( this )
		.setSmallIcon( R.drawable.ic_notification )
		.setContentTitle( "Saving pinned chapters" )
		.setContentText( content_text )
		.setProgress( 0, 0, true );
	
	App.getImageLoader().get( API.getCoverUrl( chapter.getManga().getCover() ), new ImageListener() {

		@Override
		public void onResponse( ImageContainer container, boolean immediate ) {
			if ( queue_task == null || queue_task.isCancelled() ) return;
			builder.setLargeIcon( container.getBitmap() );
			manager.notify( NOTIFICATION_ID, builder.getNotification() );
		}

		@Override public void onErrorResponse( VolleyError volleyError ) {
			if ( queue_task == null || queue_task.isCancelled() ) return;
			manager.notify( NOTIFICATION_ID, builder.getNotification() );
		}
	} );
	
}
 
開發者ID:Alexander-Prime,項目名稱:MangaJunkie-Android,代碼行數:30,代碼來源:PinService.java

示例14: loadImageIfNecessary

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
void loadImageIfNecessary(final boolean isInLayoutPass) {
    int width = getWidth();
    int height = getHeight();
    ScaleType scaleType = getScaleType();
    boolean wrapWidth = false;
    boolean wrapHeight = false;
    if (getLayoutParams() != null) {
        if (getLayoutParams().width == -2) {
            wrapWidth = true;
        } else {
            wrapWidth = false;
        }
        if (getLayoutParams().height == -2) {
            wrapHeight = true;
        } else {
            wrapHeight = false;
        }
    }
    boolean isFullyWrapContent;
    if (wrapWidth && wrapHeight) {
        isFullyWrapContent = true;
    } else {
        isFullyWrapContent = false;
    }
    if (width != 0 || height != 0 || isFullyWrapContent) {
        if (TextUtils.isEmpty(this.mUrl)) {
            if (this.mImageContainer != null) {
                this.mImageContainer.cancelRequest();
                this.mImageContainer = null;
            }
            setDefaultImageOrNull();
            return;
        }
        int maxWidth;
        int maxHeight;
        if (!(this.mImageContainer == null || this.mImageContainer.getRequestUrl() == null)) {
            if (!this.mImageContainer.getRequestUrl().equals(this.mUrl)) {
                this.mImageContainer.cancelRequest();
                setDefaultImageOrNull();
            } else {
                return;
            }
        }
        if (wrapWidth) {
            maxWidth = 0;
        } else {
            maxWidth = width;
        }
        if (wrapHeight) {
            maxHeight = 0;
        } else {
            maxHeight = height;
        }
        this.mImageContainer = this.mImageLoader.get(this.mUrl, new ImageListener() {
            public void onErrorResponse(VolleyError error) {
                if (NetworkImageView.this.mErrorImageId != 0) {
                    NetworkImageView.this.setImageResource(NetworkImageView.this.mErrorImageId);
                }
            }

            public void onResponse(final ImageContainer response, boolean isImmediate) {
                if (isImmediate && isInLayoutPass) {
                    NetworkImageView.this.post(new Runnable() {
                        public void run() {
                            AnonymousClass1.this.onResponse(response, false);
                        }
                    });
                } else if (response.getBitmap() != null) {
                    NetworkImageView.this.setImageBitmap(response.getBitmap());
                } else if (NetworkImageView.this.mDefaultImageId != 0) {
                    NetworkImageView.this.setImageResource(NetworkImageView.this.mDefaultImageId);
                }
            }
        }, maxWidth, maxHeight, scaleType);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:77,代碼來源:NetworkImageView.java

示例15: isRequestingUrl

import com.android.volley.toolbox.ImageLoader.ImageContainer; //導入依賴的package包/類
private boolean isRequestingUrl(ImageContainer container, String url) {
    return (container != null
         && container.getRequestUrl() != null
         && container.getRequestUrl().equals(url));
}
 
開發者ID:ldsddn,項目名稱:wordpress_app_android,代碼行數:6,代碼來源:ReaderPhotoView.java


注:本文中的com.android.volley.toolbox.ImageLoader.ImageContainer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。