@Override
public void displayRaw(@NonNull ImageView img, @NonNull String absPath, int width, int height, final IBoxingCallback callback) {
String path = "file://" + absPath;
RequestCreator creator = Picasso.with(img.getContext())
.load(path);
if (width > 0 && height > 0) {
creator.transform(new BitmapTransform(width, height));
}
creator.into(img, new Callback() {
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
@Override
public void onError() {
if (callback != null) {
callback.onFail(null);
}
}
});
}
java类com.squareup.picasso.Callback的实例源码
BoxingPicassoLoader.java 文件源码
项目:GitHub
阅读 17
收藏 0
点赞 0
评论 0
PicassoFragmentB.java 文件源码
项目:shared-element-transitions
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ImageView imageView = (ImageView) view.findViewById(R.id.picasso_fragment_b_image);
Picasso.with(getContext())
.load(PicassoFragmentA.GIRAFFE_PIC_URL)
.fit()
.noFade()
.centerCrop()
.into(imageView, new Callback() {
@Override
public void onSuccess() {
startPostponedEnterTransition();
}
@Override
public void onError() {
startPostponedEnterTransition();
}
});
}
AnimalDetailActivity.java 文件源码
项目:shared-element-transitions
阅读 20
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_animal_detail);
supportPostponeEnterTransition();
Bundle extras = getIntent().getExtras();
AnimalItem animalItem = extras.getParcelable(RecyclerViewActivity.EXTRA_ANIMAL_ITEM);
ImageView imageView = (ImageView) findViewById(R.id.animal_detail_image_view);
TextView textView = (TextView) findViewById(R.id.animal_detail_text);
textView.setText(animalItem.detail);
String imageUrl = animalItem.imageUrl;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
String imageTransitionName = extras.getString(RecyclerViewActivity.EXTRA_ANIMAL_IMAGE_TRANSITION_NAME);
imageView.setTransitionName(imageTransitionName);
}
Picasso.with(this)
.load(imageUrl)
.noFade()
.into(imageView, new Callback() {
@Override
public void onSuccess() {
supportStartPostponedEnterTransition();
}
@Override
public void onError() {
supportStartPostponedEnterTransition();
}
});
}
AnimalDetailFragment.java 文件源码
项目:shared-element-transitions
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
AnimalItem animalItem = getArguments().getParcelable(EXTRA_ANIMAL_ITEM);
String transitionName = getArguments().getString(EXTRA_TRANSITION_NAME);
TextView detailTextView = (TextView) view.findViewById(R.id.animal_detail_text);
detailTextView.setText(animalItem.detail);
ImageView imageView = (ImageView) view.findViewById(R.id.animal_detail_image_view);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
imageView.setTransitionName(transitionName);
}
Picasso.with(getContext())
.load(animalItem.imageUrl)
.noFade()
.into(imageView, new Callback() {
@Override
public void onSuccess() {
startPostponedEnterTransition();
}
@Override
public void onError() {
startPostponedEnterTransition();
}
});
}
PicassoActivityB.java 文件源码
项目:shared-element-transitions
阅读 21
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.picasso_activity_b);
ImageView imageView = (ImageView) findViewById(R.id.picasso_activity_b_image);
supportPostponeEnterTransition();
Picasso.with(this)
.load(PicassoActivityA.TIGER_PIC_URL)
.fit()
.noFade()
.centerCrop()
.into(imageView, new Callback() {
@Override
public void onSuccess() {
supportStartPostponedEnterTransition();
}
@Override
public void onError() {
supportStartPostponedEnterTransition();
}
});
}
ImageLoaderManager.java 文件源码
项目:MADBike
阅读 26
收藏 0
点赞 0
评论 0
@Override
public void loadImage(String path, ImageView imageView) {
if (path == null || path.equalsIgnoreCase("") || imageView == null) {
//TODO:ERROR LOADING IMAGE
}else{
Picasso.with(context).load(path).into(imageView, new Callback() {
@Override
public void onSuccess() {
listener.onImageLoaded();
}
@Override
public void onError() {
listener.onImageError();
}
});
}
}
PokeQuizPickName.java 文件源码
项目:pokequest
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void startLoading() {
picasso.load(PokeQuestApp.BASE_URL + mChoices.get(mCorrectNo).getImageUrl())
.placeholder(me.datvu.pokequest.R.drawable.pokeball_padding)
.error(me.datvu.pokequest.R.drawable.pokeball)
.into(mImPoke, new Callback() {
@Override
public void onSuccess() {
if (mListener != null) {
if (!mIsFinish) mListener.onQuizReady();
}
}
@Override
public void onError() {
if (mListener != null) {
mListener.onQuizLoadingError(new Exception("Error when loading poke " +
"image at id=" + mChoices.get(mCorrectNo).getId()));
}
}
});
}
PokeQuizPickImage.java 文件源码
项目:pokequest
阅读 18
收藏 0
点赞 0
评论 0
private Completable loadImageInto(ImageView im, Pokemon pk) {
return Completable.create(e -> picasso.load(PokeQuestApp.BASE_URL + pk.getImageUrl())
.placeholder(R.drawable.pokeball_padding)
.error(R.drawable.pokeball)
.into(im, new Callback() {
@Override
public void onSuccess() {
e.onComplete();
}
@Override
public void onError() {
e.onError(new Throwable("Error when loading poke image at id=" + pk.getId()));
}
}));
}
ViewEntertainmentActivity.java 文件源码
项目:furry-sniffle
阅读 19
收藏 0
点赞 0
评论 0
void setPhotoUrl(String image, ViewHolder vh){
ImageView event_image = vh.cardview.findViewById(R.id.commentorProfileImageView);
final ProgressBar progressBar = vh.cardview.findViewById(R.id.progressBar2);
Picasso.with(event_image.getContext())
.load(image)
.into(event_image, new Callback() {
@Override
public void onSuccess() {
progressBar.setVisibility(View.GONE);
}
@Override
public void onError() {
Toast.makeText(getApplicationContext(), "Network error: failed to load image", Toast.LENGTH_SHORT).show();
}
});
}
MainActivity.java 文件源码
项目:furry-sniffle
阅读 23
收藏 0
点赞 0
评论 0
void setPhotoUrl(String image){
ImageView event_image = mView.findViewById(R.id.photoImageView);
final ProgressBar progressBar = mView.findViewById(R.id.imageProgressBar);
Picasso.with(event_image.getContext())
.load(image)
.into(event_image, new Callback() {
@Override
public void onSuccess() {
progressBar.setVisibility(View.GONE);
}
@Override
public void onError() {
}
});
}
SearchableActivity.java 文件源码
项目:furry-sniffle
阅读 22
收藏 0
点赞 0
评论 0
void setPhotoUrl(String image, ViewHolder vh){
ImageView event_image = vh.cardview.findViewById(R.id.photoImageView);
final ProgressBar progressBar = vh.cardview.findViewById(R.id.imageProgressBar);
Picasso.with(event_image.getContext())
.load(image)
.into(event_image, new Callback() {
@Override
public void onSuccess() {
progressBar.setVisibility(View.GONE);
}
@Override
public void onError() {
}
});
}
nearbyAreasActivity.java 文件源码
项目:furry-sniffle
阅读 19
收藏 0
点赞 0
评论 0
void setPhotoUrl(String image, ViewHolder vh){
ImageView event_image = vh.cardview.findViewById(R.id.photoImageView);
final ProgressBar progressBar = vh.cardview.findViewById(R.id.imageProgressBar);
Picasso.with(event_image.getContext())
.load(image)
.into(event_image, new Callback() {
@Override
public void onSuccess() {
progressBar.setVisibility(View.GONE);
}
@Override
public void onError() {
}
});
}
BookmarkActivity.java 文件源码
项目:furry-sniffle
阅读 19
收藏 0
点赞 0
评论 0
void setPhotoUrl(String image){
ImageView event_image = mView.findViewById(R.id.photoImageView);
final ProgressBar progressBar = mView.findViewById(R.id.imageProgressBar);
Picasso.with(event_image.getContext())
.load(image)
.into(event_image, new Callback() {
@Override
public void onSuccess() {
progressBar.setVisibility(View.GONE);
}
@Override
public void onError() {
}
});
}
ProfilePageFragment.java 文件源码
项目:Profiler
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void setProfilePhotoURL(String profilePhotoUrl) {
Picasso.with(getActivity())
.load(Uri.parse(profilePhotoUrl))
.noFade()
.into(thumbnail, new Callback() {
@Override
public void onSuccess() {
presenter.onThumbnailLoaded();
}
@Override
public void onError() {
setDefaultProfilePhoto();
}
});
//CircleImageView requires noFade() to be set
}
ProfilePageFragment.java 文件源码
项目:Profiler
阅读 18
收藏 0
点赞 0
评论 0
@Override
public void setDefaultProfilePhoto() {
Picasso.with(getActivity())
.load(R.drawable.default_profile_pic)
.noFade()
.into(thumbnail, new Callback() {
@Override
public void onSuccess() {
presenter.onThumbnailLoaded();
}
@Override
public void onError() {
Toast.makeText(
getActivity(),
getString(R.string.error_loading_image),
Toast.LENGTH_SHORT).show();
}
});
}
PhotoDetailFragment.java 文件源码
项目:Profiler
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void setBitmap() {
Picasso.with(getActivity())
.load(photoURL)
.fit()
.into(photo, new Callback() {
@Override
public void onSuccess() {
presenter.onImageLoaded();
}
@Override
public void onError() {
presenter.onImageLoadFailure();
}
});
}
BoxingPicassoLoader.java 文件源码
项目:boxing
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void displayRaw(@NonNull ImageView img, @NonNull String absPath, int width, int height, final IBoxingCallback callback) {
String path = "file://" + absPath;
RequestCreator creator = Picasso.with(img.getContext())
.load(path);
if (width > 0 && height > 0) {
creator.transform(new BitmapTransform(width, height));
}
creator.into(img, new Callback() {
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
@Override
public void onError() {
if (callback != null) {
callback.onFail(null);
}
}
});
}
DemoRecyclerPagerAdapterViewHolder.java 文件源码
项目:RecyclerPagerAdapter
阅读 16
收藏 0
点赞 0
评论 0
public void setPictureUrl(final String imageUrl) {
progressBar.setVisibility(View.VISIBLE);
Picasso.with(image.getContext())
.load(imageUrl)
.into(image, new Callback() {
@Override
public void onSuccess() {
progressBar.setVisibility(View.GONE);
}
@Override
public void onError() {
progressBar.setVisibility(View.GONE);
image.setImageResource(android.R.drawable.ic_menu_gallery);
}
});
}
ActivityUtils.java 文件源码
项目:MovieGuide
阅读 34
收藏 0
点赞 0
评论 0
/**
* Loads an image into a target view.
* @param context context
* @param image image
* @param centerCrop boolean
* @param errorResourceId image of error
* @param target imageView
* @param callback callback
*/
public static void loadImage(final Context context, final String image,
final boolean centerCrop, final int errorResourceId,
final ImageView target, final Callback callback) {
Picasso pic = Picasso.with(context);
RequestCreator request;
int errorRId = errorResourceId;
if (image != null )
request = pic.load(image).fit();
else {
request = pic.load(errorResourceId).fit();
errorRId = 0;
}
if (centerCrop)
request = request.centerCrop();
if (errorRId != 0)
request = request.error(errorResourceId);
if (callback != null)
request.into(target, callback);
else
request.into(target);
}
TVShowActivity.java 文件源码
项目:MovieGuide
阅读 31
收藏 0
点赞 0
评论 0
/**
* Fills the TV Show Details in screen.
* @param container TVShowData
*/
private void populateDetails(final TVShowData container) {
if (container == null) {
return;
}
final Palette.PaletteAsyncListener paletteAsyncListener =
ActivityUtils.definePaletteAsyncListener(this, title, textRating, rating, starRating);
Callback callback =
ActivityUtils.defineCallback(paletteAsyncListener, backgroundPoster, tvShowPoster);
PopulateDetailsTitle(container);
PopulateDetailsPoster(container, callback);
PopulateDetailsGenresCountries(container);
PopulateDetailsProdCompanies(container);
PopulateDetailsStatus(container);
PopulateDetailsDates(container);
defineClickFavoriteButtons(container);
ActivityUtils.firebaseAnalyticsLogEventViewItem(
mFirebaseAnalytics, "" + tvShowId, tvShowTitle[0], TV_SHOWS);
}
TVShowActivity.java 文件源码
项目:MovieGuide
阅读 31
收藏 0
点赞 0
评论 0
/**
* Populates poster in screen.
* @param container TVShowData
* @param callback callback
*/
private void PopulateDetailsPoster(final TVShowData container, Callback callback) {
ActivityUtils.loadImage(this, TMDB_IMAGE_URL + SIZE_W342 + container.getPosterPath(), true,
R.drawable.disk_reel, tvShowPoster, null);
String backgroundPosterPath = container.getBackgroundPath();
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
ActivityUtils.loadImage(this, BACKGROUND_BASE_URI + backgroundPosterPath, true,
R.drawable.no_background_poster, backgroundPoster, callback);
} else {
ActivityUtils.loadImage(this, BACKGROUND_BASE_URI + backgroundPosterPath, false,
R.drawable.no_background_poster, backgroundPoster, callback);
}
// Save background movie image poster to use in PersonProfile page.
ActivityUtils.saveStringToPreferences(this, KNOWN_FOR_BACKGROUND_POSTER,
container.getBackgroundPath());
}
PersonActivity.java 文件源码
项目:MovieGuide
阅读 21
收藏 0
点赞 0
评论 0
/**
* Populates poster in screen.
* @param profilePosterPath image path
* @param backgroundPosterPath image path
* @param callback callback
*/
private void PopulateBackgroundPoster(final String profilePosterPath,
final String backgroundPosterPath,
Callback callback) {
ActivityUtils.loadImage(this, TMDB_IMAGE_URL + SIZE_W342 + profilePosterPath, true,
R.drawable.disk_reel, personalProfImage, null);
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
ActivityUtils.loadImage(this, BACKGROUND_BASE_URI + backgroundPosterPath, true,
R.drawable.no_background_poster, backgroundPoster, callback);
} else {
ActivityUtils.loadImage(this, BACKGROUND_BASE_URI + backgroundPosterPath, false,
R.drawable.no_background_poster, backgroundPoster, callback);
}
}
MovieActivity.java 文件源码
项目:MovieGuide
阅读 20
收藏 0
点赞 0
评论 0
/**
* Fills the Movie Details in screen.
* @param container MovieData
*/
private void populateDetails(final MovieData container) {
if (container == null) {
return;
}
final Palette.PaletteAsyncListener paletteAsyncListener =
ActivityUtils.definePaletteAsyncListener(this, title, textRating, rating, starRating);
Callback callback =
ActivityUtils.defineCallback(paletteAsyncListener, backgroundPoster, moviePoster);
PopulateDetailsTitle(container);
PopulateDetailsPoster(container, callback);
PopulateDetailsDateDurationRating(container);
PopulateDetailsLanguage(container);
PopulateDetailsGenres(container);
PopulateDetailsCountries(container);
PopulateDetailsProdCompanies(container);
PopulateDetailsStatus(container);
PopulateDetailsPlot(container);
defineClickFavoriteButtons(container);
ActivityUtils.firebaseAnalyticsLogEventViewItem(
mFirebaseAnalytics, "" + movieID, container.getTitle(), MOVIES);
}
MovieActivity.java 文件源码
项目:MovieGuide
阅读 21
收藏 0
点赞 0
评论 0
/**
* Populates poster in screen.
* @param container MovieData
* @param callback callback
*/
private void PopulateDetailsPoster(final MovieData container, Callback callback) {
ActivityUtils.loadImage(this, TMDB_IMAGE_URL + SIZE_W342 + container.getPosterPath(), true,
R.drawable.disk_reel, moviePoster, null);
String backgroundPosterPath = container.getBackgroundPath();
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
ActivityUtils.loadImage(this, BACKGROUND_BASE_URI + backgroundPosterPath, true,
R.drawable.no_background_poster, backgroundPoster, callback);
} else {
ActivityUtils.loadImage(this, BACKGROUND_BASE_URI + backgroundPosterPath, false,
R.drawable.no_background_poster, backgroundPoster, callback);
}
// Save background movie image poster to use in PersonProfile page.
ActivityUtils.saveStringToPreferences(this, KNOWN_FOR_BACKGROUND_POSTER,
container.getBackgroundPath());
}
MainActivity.java 文件源码
项目:MeteorView
阅读 18
收藏 0
点赞 0
评论 0
private void initView() {
Picasso.with(this).load(R.drawable.star).resize(900, 1600).centerCrop().into(imgBackgroundStar, new Callback() {
@Override
public void onSuccess() {
AnimationDrawable frameAnimation = (AnimationDrawable) imgBackgroundFire.getDrawable();
frameAnimation.start();
showButtonStartChat();
}
@Override
public void onError() {
}
});
Picasso.with(this).load(R.drawable.icon_light_moon).resize(100, 100).centerCrop().into(imgBackgroundMoon);
Picasso.with(this).load(R.drawable.background_main_back).resize(500, 322).centerCrop().into(imgBackgroundTree);
Picasso.with(this).load(R.drawable.icon_meteor).into(imgMeteor0);
Picasso.with(this).load(R.drawable.icon_meteor).into(imgMeteor1);
Picasso.with(this).load(R.drawable.icon_meteor).into(imgMeteor2);
Picasso.with(this).load(R.drawable.icon_meteor).into(imgMeteor3);
}
SearchResultHandler.java 文件源码
项目:DeepImagePreview-Project
阅读 43
收藏 0
点赞 0
评论 0
private void saveResultAndLoadPreview(final SearchResultContainer container, final String text) {
// If i don't have items then just save it into the config, it will be ignored on the screen
if (container != null && !container.getImages().isEmpty()) {
container.setCreatedAt(System.currentTimeMillis());
// Load first image as bitmap and save search results
Picasso.with(mContext)
.load(container.getFirstThumbnailLink())
.resize(50, 50)
.centerCrop()
.fetch(new Callback() {
@Override
public void onSuccess() {
saveSearchResultAndRemoveFromLoadingDetections(container, text);
}
@Override
public void onError() {
saveSearchResultAndRemoveFromLoadingDetections(container, text);
}
});
} else {
saveSearchResultAndRemoveFromLoadingDetections(new SearchResultContainer(), text);
}
}
PublishActivity.java 文件源码
项目:instamaterial
阅读 25
收藏 0
点赞 0
评论 0
private void loadThumbnailPhoto() {
ivPhoto.setScaleX(0);
ivPhoto.setScaleY(0);
Picasso.with(this)
.load(photoUri)
.centerCrop()
.resize(photoSize, photoSize)
.into(ivPhoto, new Callback() {
@Override
public void onSuccess() {
ivPhoto.animate()
.scaleX(1.f).scaleY(1.f)
.setInterpolator(new OvershootInterpolator())
.setDuration(400)
.setStartDelay(200)
.start();
}
@Override
public void onError() {
}
});
}
ViewMediaFragment.java 文件源码
项目:Tusky
阅读 18
收藏 0
点赞 0
评论 0
private void loadImageFromNetwork(String url, ImageView photoView) {
Picasso.with(getContext())
.load(url)
.noPlaceholder()
.into(photoView, new Callback() {
@Override
public void onSuccess() {
finishLoadingSuccessfully();
}
@Override
public void onError() {
rootView.findViewById(R.id.view_media_progress).setVisibility(View.GONE);
}
});
}
PhotoFragment.java 文件源码
项目:humaniq-android
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Callback callback = new Callback() {
@Override
public void onSuccess() {
final Bitmap bitmap = ((BitmapDrawable) mask.getDrawable()).getBitmap();
detectMaskHeight(bitmap);
detectMaskWidth(bitmap);
}
@Override
public void onError() {
}
};
// Picasso.with(getContext())
// .load(R.drawable.mask)
// .centerCrop()
// .fit()
// .into(mask, callback);
}
Drishti.java 文件源码
项目:SVNITChapters
阅读 17
收藏 0
点赞 0
评论 0
public void setimg(final Context ctx, final String postimag)
{
final ImageView postimage = (ImageView)view.findViewById(R.id.postimage);
Picasso.with(ctx).load(postimag).networkPolicy(NetworkPolicy.OFFLINE).into(postimage, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
Picasso.with(ctx).load(postimag).into(postimage);
}
});
}