本文整理汇总了Java中com.squareup.picasso.Callback类的典型用法代码示例。如果您正苦于以下问题:Java Callback类的具体用法?Java Callback怎么用?Java Callback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Callback类属于com.squareup.picasso包,在下文中一共展示了Callback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayRaw
import com.squareup.picasso.Callback; //导入依赖的package包/类
@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);
}
}
});
}
示例2: onViewCreated
import com.squareup.picasso.Callback; //导入依赖的package包/类
@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();
}
});
}
示例3: onCreate
import com.squareup.picasso.Callback; //导入依赖的package包/类
@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();
}
});
}
示例4: onViewCreated
import com.squareup.picasso.Callback; //导入依赖的package包/类
@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();
}
});
}
示例5: onCreate
import com.squareup.picasso.Callback; //导入依赖的package包/类
@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();
}
});
}
示例6: loadImage
import com.squareup.picasso.Callback; //导入依赖的package包/类
@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();
}
});
}
}
示例7: startLoading
import com.squareup.picasso.Callback; //导入依赖的package包/类
@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()));
}
}
});
}
示例8: loadImageInto
import com.squareup.picasso.Callback; //导入依赖的package包/类
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()));
}
}));
}
示例9: setPhotoUrl
import com.squareup.picasso.Callback; //导入依赖的package包/类
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();
}
});
}
示例10: setPhotoUrl
import com.squareup.picasso.Callback; //导入依赖的package包/类
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() {
}
});
}
示例11: setPhotoUrl
import com.squareup.picasso.Callback; //导入依赖的package包/类
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() {
}
});
}
示例12: setProfilePhotoURL
import com.squareup.picasso.Callback; //导入依赖的package包/类
@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
}
示例13: setDefaultProfilePhoto
import com.squareup.picasso.Callback; //导入依赖的package包/类
@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();
}
});
}
示例14: setBitmap
import com.squareup.picasso.Callback; //导入依赖的package包/类
@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();
}
});
}
示例15: setPictureUrl
import com.squareup.picasso.Callback; //导入依赖的package包/类
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);
}
});
}