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


Java Callback类代码示例

本文整理汇总了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);
            }
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:BoxingPicassoLoader.java

示例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();
                }
            });
}
 
开发者ID:mikescamell,项目名称:shared-element-transitions,代码行数:23,代码来源:PicassoFragmentB.java

示例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();
                }
            });
}
 
开发者ID:mikescamell,项目名称:shared-element-transitions,代码行数:35,代码来源:AnimalDetailActivity.java

示例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();
                }
            });
}
 
开发者ID:mikescamell,项目名称:shared-element-transitions,代码行数:31,代码来源:AnimalDetailFragment.java

示例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();
                }
            });
}
 
开发者ID:mikescamell,项目名称:shared-element-transitions,代码行数:26,代码来源:PicassoActivityB.java

示例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();
            }
        });
    }
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:19,代码来源:ImageLoaderManager.java

示例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()));
                    }
                }
            });
}
 
开发者ID:datdescartes,项目名称:pokequest,代码行数:24,代码来源:PokeQuizPickName.java

示例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()));
                }
            }));

}
 
开发者ID:datdescartes,项目名称:pokequest,代码行数:18,代码来源:PokeQuizPickImage.java

示例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();
                }
            });
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:18,代码来源:ViewEntertainmentActivity.java

示例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() {

                }
            });
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:18,代码来源:MainActivity.java

示例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() {

                }
            });
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:18,代码来源:SearchableActivity.java

示例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
}
 
开发者ID:BracketCove,项目名称:Profiler,代码行数:19,代码来源:ProfilePageFragment.java

示例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();
                }
            });
}
 
开发者ID:BracketCove,项目名称:Profiler,代码行数:21,代码来源:ProfilePageFragment.java

示例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();
                }
            });
}
 
开发者ID:BracketCove,项目名称:Profiler,代码行数:18,代码来源:PhotoDetailFragment.java

示例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);
				}
			});
}
 
开发者ID:Nyentek,项目名称:RecyclerPagerAdapter,代码行数:18,代码来源:DemoRecyclerPagerAdapterViewHolder.java


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