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


Java ImageDownloader.downloadAsync方法代码示例

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


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

示例1: sendImageRequest

import com.facebook.internal.ImageDownloader; //导入方法依赖的package包/类
private void sendImageRequest(boolean paramBoolean)
{
  try
  {
    ImageRequest localImageRequest = new ImageRequest.Builder(getContext(), ImageRequest.getProfilePictureUrl(this.profileId, this.queryWidth, this.queryHeight)).setAllowCachedRedirects(paramBoolean).setCallerTag(this).setCallback(new ImageRequest.Callback()
    {
      public void onCompleted(ImageResponse paramAnonymousImageResponse)
      {
        ProfilePictureView.this.processResponse(paramAnonymousImageResponse);
      }
    }).build();
    if (this.lastRequest != null)
      ImageDownloader.cancelRequest(this.lastRequest);
    this.lastRequest = localImageRequest;
    ImageDownloader.downloadAsync(localImageRequest);
    return;
  }
  catch (URISyntaxException localURISyntaxException)
  {
    Logger.log(LoggingBehavior.REQUESTS, 6, TAG, localURISyntaxException.toString());
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:23,代码来源:ProfilePictureView.java

示例2: downloadProfilePicture

import com.facebook.internal.ImageDownloader; //导入方法依赖的package包/类
private void downloadProfilePicture(final String profileId, URI pictureURI, final ImageView imageView) {
    if (pictureURI == null) {
        return;
    }

    // If we don't have an imageView, we are pre-fetching this image to store in-memory because we
    // think the user might scroll to its corresponding list row. If we do have an imageView, we
    // only want to queue a download if the view's tag isn't already set to the URL (which would mean
    // it's already got the correct picture).
    boolean prefetching = imageView == null;
    if (prefetching || !pictureURI.equals(imageView.getTag())) {
        if (!prefetching) {
            // Setting the tag to the profile ID indicates that we're currently downloading the
            // picture for this profile; we'll set it to the actual picture URL when complete.
            imageView.setTag(profileId);
            imageView.setImageResource(getDefaultPicture());
        }

        ImageRequest.Builder builder = new ImageRequest.Builder(context.getApplicationContext(), pictureURI)
                .setCallerTag(this)
                .setCallback(
                        new ImageRequest.Callback() {
                            @Override
                            public void onCompleted(ImageResponse response) {
                                processImageResponse(response, profileId, imageView);
                            }
                        });

        ImageRequest newRequest = builder.build();
        pendingRequests.put(profileId, newRequest);

        ImageDownloader.downloadAsync(newRequest);
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:35,代码来源:GraphObjectAdapter.java

示例3: sendImageRequest

import com.facebook.internal.ImageDownloader; //导入方法依赖的package包/类
private void sendImageRequest(boolean allowCachedResponse) {
    try {
        ImageRequest.Builder requestBuilder = new ImageRequest.Builder(
                getContext(),
                ImageRequest.getProfilePictureUrl(profileId, queryWidth,  queryHeight));

        ImageRequest request = requestBuilder.setAllowCachedRedirects(allowCachedResponse)
                .setCallerTag(this)
                .setCallback(
                new ImageRequest.Callback() {
                    @Override
                    public void onCompleted(ImageResponse response) {
                        processResponse(response);
                    }
                })
                .build();

        // Make sure to cancel the old request before sending the new one to prevent
        // accidental cancellation of the new request. This could happen if the URL and
        // caller tag stayed the same.
        if (lastRequest != null) {
            ImageDownloader.cancelRequest(lastRequest);
        }
        lastRequest = request;

        ImageDownloader.downloadAsync(request);
    } catch (URISyntaxException e) {
        Logger.log(LoggingBehavior.REQUESTS, Log.ERROR, TAG, e.toString());
    }
}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:31,代码来源:ProfilePictureView.java

示例4: updateUI

import com.facebook.internal.ImageDownloader; //导入方法依赖的package包/类
private void updateUI() {
    if (!isAdded()) {
        return;
    }
    if (isSessionOpen()) {
        connectedStateLabel.setTextColor(getResources().getColor(R.color.com_facebook_usersettingsfragment_connected_text_color));
        connectedStateLabel.setShadowLayer(1f, 0f, -1f,
                getResources().getColor(R.color.com_facebook_usersettingsfragment_connected_shadow_color));
        
        if (user != null) {
            ImageRequest request = getImageRequest();
            if (request != null) {
                URI requestUrl = request.getImageUri();
                // Do we already have the right picture? If so, leave it alone.
                if (!requestUrl.equals(connectedStateLabel.getTag())) {
                    if (user.getId().equals(userProfilePicID)) {
                        connectedStateLabel.setCompoundDrawables(null, userProfilePic, null, null);
                        connectedStateLabel.setTag(requestUrl);
                    } else {
                        ImageDownloader.downloadAsync(request);
                    }
                }
            }
            connectedStateLabel.setText(user.getName());
        } else {
            connectedStateLabel.setText(getResources().getString(
                    R.string.com_facebook_usersettingsfragment_logged_in));
            Drawable noProfilePic = getResources().getDrawable(R.drawable.com_facebook_profile_default_icon);
            noProfilePic.setBounds(0, 0,
                    getResources().getDimensionPixelSize(R.dimen.com_facebook_usersettingsfragment_profile_picture_width),
                    getResources().getDimensionPixelSize(R.dimen.com_facebook_usersettingsfragment_profile_picture_height));
            connectedStateLabel.setCompoundDrawables(null, noProfilePic, null, null);
        }
    } else {
        int textColor = getResources().getColor(R.color.com_facebook_usersettingsfragment_not_connected_text_color);
        connectedStateLabel.setTextColor(textColor);
        connectedStateLabel.setShadowLayer(0f, 0f, 0f, textColor);
        connectedStateLabel.setText(getResources().getString(
                R.string.com_facebook_usersettingsfragment_not_logged_in));
        connectedStateLabel.setCompoundDrawables(null, null, null, null);
        connectedStateLabel.setTag(null);
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:44,代码来源:UserSettingsFragment.java

示例5: sendImageRequest

import com.facebook.internal.ImageDownloader; //导入方法依赖的package包/类
private void sendImageRequest(boolean allowCachedResponse)
{
	try
	{
		ImageRequest.Builder requestBuilder =
				new ImageRequest.Builder(	getContext(),
											ImageRequest
													.getProfilePictureUrl(
															profileId,
															queryWidth,
															queryHeight));

		ImageRequest request =
				requestBuilder.setAllowCachedRedirects(
						allowCachedResponse).setCallerTag(
						this).setCallback(
						new ImageRequest.Callback()
						{
							@Override
							public void onCompleted(ImageResponse response)
							{
								processResponse(response);
							}
						}).build();

		// Make sure to cancel the old request before sending the new one to
		// prevent
		// accidental cancellation of the new request. This could happen if
		// the URL and
		// caller tag stayed the same.
		if (lastRequest != null)
		{
			ImageDownloader.cancelRequest(lastRequest);
		}
		lastRequest = request;

		ImageDownloader.downloadAsync(request);
	}
	catch (URISyntaxException e)
	{
		Logger.log(LoggingBehavior.REQUESTS, Log.ERROR, TAG,
				e.toString());
	}
}
 
开发者ID:netanelkl,项目名称:guitar_guy,代码行数:45,代码来源:ProfilePictureView.java


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