Java 类com.squareup.picasso.NetworkPolicy 实例源码
项目:Watermark
文件:PicassoImageLoader.java
@Override
public void displayImage(Context context, String path, FixImageView imageView, Drawable defaultDrawable, Bitmap.Config config, boolean resize, boolean isGif, int width, int height, int rotate) {
RequestCreator creator = Picasso.with(context)
.load(new File(path))
.placeholder(defaultDrawable)
.error(defaultDrawable)
.rotate(rotate)
.networkPolicy(NetworkPolicy.NO_STORE)
.config(config)
.tag(context);
if (resize) {
creator = creator.resize(width, height)
.centerCrop();
}
creator.into(imageView);
}
项目:SVNITChapters
文件:Drishti.java
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);
}
});
}
项目:SVNITChapters
文件:Announcements.java
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);
}
});
}
项目:SVNITChapters
文件:ACM.java
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);
}
});
}
项目:SVNITChapters
文件:SAE.java
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);
}
});
}
项目:SVNITChapters
文件:GDG.java
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);
}
});
}
项目:SVNITChapters
文件:LAC.java
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);
}
});
}
项目:SVNITChapters
文件:Announcement.java
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);
}
});
}
项目:SVNITChapters
文件:CHRD.java
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);
}
});
}
项目:PhotoDiscovery
文件:FullScreenImageFragment.java
private void loadImage(final ImageView imageView, final String url,
final NetworkPolicy networkPolicy) {
Picasso.with(context)
.load(url)
.placeholder(circularLoaderDrawable)
.networkPolicy(networkPolicy)
.into(imageView, new com.squareup.picasso.Callback() {
@Override public void onSuccess() {
//
circularLoaderDrawable.clearAnimation();
}
@Override public void onError() {
if (!networkPolicy.equals(NetworkPolicy.OFFLINE)) {
circularLoaderDrawable.setError();
} else {
loadImage(imageView, url, NetworkPolicy.NO_CACHE);
}
}
});
}
项目:yApp
文件:HttpFactory.java
@Override
public Response load(Uri uri, int networkPolicy) throws IOException {
CacheControl.Builder builder = new CacheControl.Builder();
if (networkPolicy != 0) {
if (NetworkPolicy.isOfflineOnly(networkPolicy)) {
builder.onlyIfCached();
} else {
if (!NetworkPolicy.shouldReadFromDiskCache(networkPolicy)) {
builder.noCache();
}
if (!NetworkPolicy.shouldWriteToDiskCache(networkPolicy)) {
builder.noStore();
}
}
}
Request request = new Request.Builder()
.cacheControl(builder.build())
.url(uri.toString())
.build();
okhttp3.Response response = mClient.newCall(request).execute();
return new Response(response.body().byteStream(), false, response.body().contentLength());
}
项目:AppsFeed
文件:DetailsActivity.java
@Override
public void showDetails(Application application) {
textViewName.setText(application.name.label);
textViewSummary.setText(application.summary.label);
if(picasso !=null
&& application.images.size()>0
&& !application.images.get(0).label.isEmpty()){
final String imagePath = application.images.get(0).label;
picasso.load(imagePath)
.networkPolicy(NetworkPolicy.OFFLINE)
.into(mImageViewIcon, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
// Try to get image online
picasso.load(imagePath).into(mImageViewIcon);
}
});
}
}
项目:MoonlightNote
文件:OkHttpDownloader.java
@Override
public Response load(Uri uri, int networkPolicy) throws IOException
{
CacheControl.Builder builder = new CacheControl.Builder();
if (networkPolicy != 0) {
if (NetworkPolicy.isOfflineOnly(networkPolicy)) {
builder.onlyIfCached();
} else {
if (!NetworkPolicy.shouldReadFromDiskCache(networkPolicy)) {
builder.noCache();
}
if (!NetworkPolicy.shouldWriteToDiskCache(networkPolicy)) {
builder.noStore();
}
}
}
Request request = new Request.Builder()
.cacheControl(builder.build())
.url(uri.toString())
.build();
okhttp3.Response response = mClient.newCall(request).execute();
return new Response(response.body().byteStream(),response.cacheResponse()!=null,response.body().contentLength());
}
项目:BitFrames
文件:ImageShading.java
@Override
public void callNextCycle(String lastImagePath) {
if(!TextUtils.isEmpty(lastImagePath)) currentFramePicasso.invalidate(lastImagePath);
if(beanImages != null && beanImages.size() > 0) beanImages.remove(0);
//because targets are also running sequential, in case of parallel need to shift it to respective class
if(targets != null && targets.size() > 0) targets.remove(0);
if(beanImages.size() == 0) return;
BeanImage beanImage = beanImages.get(0);
if(Utils.isLocalPath(beanImage.getImageLink())){
Utils.logVerbose("LADING AS : "+"local image " + beanImage.getImageLink());
new UnframedLocalTask(this).execute(beanImage);
} else {
Utils.logVerbose("LADING AS : "+"server image " + beanImage.getImageLink());
UnframedPicassoTargetNew target = new UnframedPicassoTargetNew(this, beanImage);
targets.add(target);
currentFramePicasso.load(beanImage.getImageLink()).memoryPolicy(MemoryPolicy.NO_STORE)
.networkPolicy(NetworkPolicy.NO_STORE)
.noPlaceholder()
.transform(new ScaleTransformation(frameModel.getMaxContainerWidth(),
frameModel.getMaxContainerHeight(), totalImages, beanImage.getImageLink(),
beanImage, this))
.into(target);
}
}
项目:ratebeer
文件:PhotoActivity.java
private void showPhoto(boolean refresh) {
// Load high res photo into the single image view
ImageView photoImage = (ImageView) findViewById(R.id.photo_image);
String url = null;
if (getIntent().hasExtra("userName")) {
url = ImageUrls.getUserPhotoHighResUrl(getIntent().getStringExtra("userName"));
} else if (getIntent().hasExtra("beerId")) {
url = ImageUrls.getBeerPhotoHighResUrl(getIntent().getLongExtra("beerId", 0));
}
if (refresh) {
Picasso.with(this).invalidate(url);
Picasso.with(this).load(url).networkPolicy(NetworkPolicy.NO_CACHE).into(photoImage);
} else {
Picasso.with(this).load(url).into(photoImage);
}
}
项目:FaceT
文件:FavouriteProductFragment.java
public void setImage(final Context ctx, final String image) {
final ImageView favourite_post_image = (ImageView) mFavouriteProductView.findViewById(R.id.favourite_product_image);
Picasso.with(ctx).load(image).networkPolicy(NetworkPolicy.OFFLINE).into(favourite_post_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
Picasso.with(ctx)
.load(image)
.fit()
.centerCrop()
.into(favourite_post_image);
}
});
}
项目:FaceT
文件:OwnProductFragment.java
public void setImage(final Context ctx, final String image) {
final ImageView own_post_image = (ImageView) mOwnProductView.findViewById(R.id.own_product_image);
Picasso.with(ctx).load(image).networkPolicy(NetworkPolicy.OFFLINE).into(own_post_image, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
Picasso.with(ctx)
.load(image)
.fit()
.centerCrop()
.into(own_post_image);
}
});
}
项目:FaceT
文件:MakeupProductFragment.java
public void setImage(final Context ctx, final String image) {
final ImageView makeup_apply_product_image = (ImageView) mView.findViewById(R.id.makeup_apply_product_image);
Picasso.with(ctx).load(image).networkPolicy(NetworkPolicy.OFFLINE).into(makeup_apply_product_image, new Callback() {
@Override
public void onSuccess() {
Log.d(TAG, "image loading success !");
}
@Override
public void onError() {
Log.d(TAG, "image loading error !");
Picasso.with(ctx)
.load(image)
.resize(100, 100)
.centerCrop()
.into(makeup_apply_product_image);
}
});
}
项目:FaceT
文件:ColorizeFaceActivity.java
public void setImage(final Context ctx, final String image) {
final ImageView makeup_product_image = (ImageView) mView.findViewById(R.id.makeup_product_image);
Picasso.with(ctx).load(image).networkPolicy(NetworkPolicy.OFFLINE).into(makeup_product_image, new Callback() {
@Override
public void onSuccess() {
Log.d(TAG, "image loading success !");
}
@Override
public void onError() {
Log.d(TAG, "image loading error !");
Picasso.with(ctx)
.load(image)
.resize(100, 100)
.centerCrop()
.into(makeup_product_image);
}
});
}
项目:FaceT
文件:ProductRecommentationActivity.java
public void setImage(final Context ctx, final String image) {
final ImageView post_image = (ImageView) mView.findViewById(R.id.product_image);
Picasso.with(ctx).load(image).networkPolicy(NetworkPolicy.OFFLINE).into(post_image, new Callback() {
@Override
public void onSuccess() {
Log.d(TAG, "image loading success !");
}
@Override
public void onError() {
Log.d(TAG, "image loading error !");
Picasso.with(ctx)
.load(image)
.resize(100, 100)
.centerCrop()
.into(post_image);
}
});
}
项目:FaceT
文件:ProfileActivity.java
public void setImage(final Context ctx, final String image) {
final ImageView product_image = (ImageView) mView.findViewById(R.id.product_image);
Picasso.with(ctx).load(image).networkPolicy(NetworkPolicy.OFFLINE).into(product_image, new Callback() {
@Override
public void onSuccess() {
Log.d(TAG, "image loading success !");
}
@Override
public void onError() {
Log.d(TAG, "image loading error !");
Picasso.with(ctx)
.load(image)
.resize(90, 90)
.centerCrop()
.into(product_image);
}
});
}
项目:FaceT
文件:MainActivity.java
public void setImage(final Context ctx, final String image) {
final ImageView post_image = (ImageView) mView.findViewById(R.id.product_image);
Picasso.with(ctx).load(image).networkPolicy(NetworkPolicy.OFFLINE).into(post_image, new Callback() {
@Override
public void onSuccess() {
Log.d(TAG, "image loading success !");
}
@Override
public void onError() {
Log.d(TAG, "image loading error !");
Picasso.with(ctx)
.load(image)
.resize(100, 100)
.centerCrop()
.into(post_image);
}
});
}
项目:FaceT
文件:ProductDetailActivity.java
public void setUserImage(final Context ctx, final String userImage) {
if (userImage != null && userImage.length() > 0) {
Log.d(TAG + "userImage", userImage);
Picasso.with(ctx).load(userImage).networkPolicy(NetworkPolicy.OFFLINE).into(user_image, new Callback() {
@Override
public void onSuccess() {
Log.d(TAG, "image loading success !");
}
@Override
public void onError() {
Log.d(TAG, "image loading error !");
Picasso.with(ctx)
.load(userImage)
.resize(50, 50)
.centerCrop()
.into(user_image);
}
});
}
}
项目:Stedroids
文件:PicassoPlugableGlobalComponent.java
@Override
public void loadImage(final ImageView imageView, final String imageUrl, Drawable drawable, final boolean offlineCacheOnError) {
if(canLoad(imageUrl)) {
Picasso.with(imageView.getContext()).load(imageUrl).placeholder(drawable)
.into(imageView, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
if(offlineCacheOnError) {
Picasso.with(imageView.getContext())
.load(imageUrl)
.networkPolicy(NetworkPolicy.OFFLINE)
.into(imageView);
}
}
});
} else {
imageView.setImageDrawable(drawable);
}
}
项目:GalleryPicker
文件:PicassoImageLoader.java
@Override
public void display(Context context, String path, ImageView imageView, Drawable defaultDrawable,
Bitmap.Config config, boolean resize, int width, int height) {
RequestCreator creator = Picasso.with(context)
.load(new File(path))
.placeholder(defaultDrawable)
.error(defaultDrawable)
// .rotate(rotate)
.networkPolicy(NetworkPolicy.NO_STORE)
.config(config)
.tag(context);
if (resize) {
creator = creator.resize(width, height);
}
creator.into(imageView);
}
项目:GalleryPicker
文件:PicassoImageLoader.java
@Override
public void displayCenterCrop(Context context, String path, ImageView imageView, Drawable defaultDrawable,
Bitmap.Config config, boolean resize, int width, int height) {
RequestCreator creator = Picasso.with(context)
.load(new File(path))
.placeholder(defaultDrawable)
.error(defaultDrawable)
// .rotate(rotate)
.networkPolicy(NetworkPolicy.NO_STORE)
.config(config)
.tag(context);
if (resize) {
creator = creator.resize(width, height);
}
creator.centerCrop();
creator.into(imageView);
}
项目:dhis2-android-dashboard
文件:PullImageController.java
private void downloadImages(DhisController.ImageNetworkPolicy imageNetworkPolicy,
final List<String> requestUrlList, final Context context) {
for (int i = 0; i < requestUrlList.size(); i++) {
final String request = requestUrlList.get(i);
if (imageNetworkPolicy == DhisController.ImageNetworkPolicy.NO_CACHE) {
PicassoProvider.getInstance(context, false)
.load(request).networkPolicy(NetworkPolicy.NO_CACHE)
.memoryPolicy(MemoryPolicy.NO_CACHE).fetch();
} else {
PicassoProvider.getInstance(context, false)
.load(request).fetch();
}
}
}
项目:dhis2-android-dashboard
文件:InterpretationAdapter.java
public void bind(String request, Interpretation item){
if (request != null) {
this.request = request;
this.item = item;
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
if (request.contains("maps")){
showMapImage(modeWithBaseMap);
}else{
modeButton.setVisibility(View.GONE);
mImageLoader.load(request)
.networkPolicy(NetworkPolicy.OFFLINE)
.placeholder(R.mipmap.ic_stub_dashboard_item)
.into(imageView);
}
}
}
项目:dhis2-android-dashboard
文件:InterpretationAdapter.java
private void showMapImage(boolean modeWithBaseMap) {
modeButton.setVisibility(View.VISIBLE);
modeButton.setSelected(modeWithBaseMap);
if (modeWithBaseMap){
Log.d(this.getClass().getSimpleName(), "Loading transform map: " + request);
mImageLoader.load(request)
.networkPolicy(NetworkPolicy.OFFLINE)
.placeholder(R.mipmap.ic_stub_dashboard_item)
.transform(
new BaseMapLayerDhisTransformation(rootView.getContext(),
item.getDataMap()))
.into(imageView);
}else{
Log.d(this.getClass().getSimpleName(), "Loading transform map: " + request);
mImageLoader.load(request)
.networkPolicy(NetworkPolicy.OFFLINE)
.placeholder(R.mipmap.ic_stub_dashboard_item)
.into(imageView);
}
}
项目:dhis2-android-dashboard
文件:DashboardItemAdapter.java
public void bind(String request, DashboardItem item){
if (request != null) {
this.request = request;
this.item = item;
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
if (request.contains("maps")){
showMapImage(modeWithBaseMap);
}else{
modeButton.setVisibility(View.GONE);
mImageLoader.load(request)
.networkPolicy(NetworkPolicy.OFFLINE)
.placeholder(R.mipmap.ic_stub_dashboard_item)
.into(imageView);
}
}
}
项目:dhis2-android-dashboard
文件:DashboardItemAdapter.java
private void showMapImage(boolean modeWithBaseMap) {
modeButton.setVisibility(View.VISIBLE);
modeButton.setSelected(modeWithBaseMap);
if (modeWithBaseMap){
Log.d(this.getClass().getSimpleName(), "Loading transform map: " + request);
mImageLoader.load(request)
.networkPolicy(NetworkPolicy.OFFLINE)
.placeholder(R.mipmap.ic_stub_dashboard_item)
.transform(
new BaseMapLayerDhisTransformation(rootView.getContext(),
item.getDataMap()))
.into(imageView);
}else{
Log.d(this.getClass().getSimpleName(), "Loading transform map: " + request);
mImageLoader.load(request)
.networkPolicy(NetworkPolicy.OFFLINE)
.placeholder(R.mipmap.ic_stub_dashboard_item)
.into(imageView);
}
}
项目:FxcnBeta
文件:DetailsFragment.java
@Override
public void addImageToContent(String link) {
final ImageView view = (ImageView) getActivity().getLayoutInflater().inflate(R.layout.article_content_img_item, mContentLayout, false);
mContentLayout.addView(view);
view.setTag(link);
final ImageListener l = new ImageListener(view, link);
view.setOnClickListener(l);
RequestCreator r = Picasso.with(getActivity()).load(link).placeholder(R.drawable.default_content_image_loading);
if (PreferenceHelper.getInstance().inSafeDataMode()) {
l.setLoadCacheForFirst(true);
r.networkPolicy(NetworkPolicy.OFFLINE);
}
r.into(view, l);
}
项目:TPondof
文件:NetworkUtil.java
@Nullable
public static Bitmap fromCache (Context context, String url) {
RequestCreator creator = buildPicasso(context, url)
.networkPolicy(NetworkPolicy.OFFLINE, NetworkPolicy.OFFLINE)
.memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE);
try {
return creator.get();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
项目:DeepImagePreview-Project
文件:ImageLoaderHelper.java
public static void loadImagePreviewFromCache(Context context, SearchResultContainer container, int imageSize, Target target){
Picasso.with(context)
.load(container.getFirstThumbnailLink())
.resize(imageSize, imageSize)
.transform(new CircleTransform())
.networkPolicy(NetworkPolicy.OFFLINE)
.into(target);
}
项目:superglue
文件:MockRequestHandler.java
@Override public Result load(Request request, int networkPolicy) throws IOException {
String imagePath = request.uri.getPath().substring(1); // Grab only the path sans leading slash.
// Check the disk cache for the image. A non-null return value indicates a hit.
boolean cacheHit = emulatedDiskCache.get(imagePath) != null;
// If there's a hit, grab the image stream and return it.
if (cacheHit) {
return new Result(loadBitmap(imagePath), Picasso.LoadedFrom.DISK);
}
// If we are not allowed to hit the network and the cache missed return a big fat nothing.
if (NetworkPolicy.isOfflineOnly(networkPolicy)) {
return null;
}
// If we got this far there was a cache miss and hitting the network is required. See if we need
// to fake an network error.
if (behavior.calculateIsFailure()) {
SystemClock.sleep(behavior.calculateDelay(MILLISECONDS));
throw new IOException("Fake network error!");
}
// We aren't throwing a network error so fake a round trip delay.
SystemClock.sleep(behavior.calculateDelay(MILLISECONDS));
// Since we cache missed put it in the LRU.
AssetFileDescriptor fileDescriptor = assetManager.openFd(imagePath);
long size = fileDescriptor.getLength();
fileDescriptor.close();
emulatedDiskCache.put(imagePath, size);
// Grab the image stream and return it.
return new Result(loadBitmap(imagePath), Picasso.LoadedFrom.NETWORK);
}
项目:superglue
文件:MockRequestHandler.java
@Override public Result load(Request request, int networkPolicy) throws IOException {
String imagePath = request.uri.getPath().substring(1); // Grab only the path sans leading slash.
// Check the disk cache for the image. A non-null return value indicates a hit.
boolean cacheHit = emulatedDiskCache.get(imagePath) != null;
// If there's a hit, grab the image stream and return it.
if (cacheHit) {
return new Result(loadBitmap(imagePath), Picasso.LoadedFrom.DISK);
}
// If we are not allowed to hit the network and the cache missed return a big fat nothing.
if (NetworkPolicy.isOfflineOnly(networkPolicy)) {
return null;
}
// If we got this far there was a cache miss and hitting the network is required. See if we need
// to fake an network error.
if (behavior.calculateIsFailure()) {
SystemClock.sleep(behavior.calculateDelay(MILLISECONDS));
throw new IOException("Fake network error!");
}
// We aren't throwing a network error so fake a round trip delay.
SystemClock.sleep(behavior.calculateDelay(MILLISECONDS));
// Since we cache missed put it in the LRU.
AssetFileDescriptor fileDescriptor = assetManager.openFd(imagePath);
long size = fileDescriptor.getLength();
fileDescriptor.close();
emulatedDiskCache.put(imagePath, size);
// Grab the image stream and return it.
return new Result(loadBitmap(imagePath), Picasso.LoadedFrom.NETWORK);
}
项目:PhotoDiscovery
文件:FullScreenImageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_detail, container, false);
ButterKnife.bind(this, rootView);
Photo photo = Parcels.unwrap(getArguments().getParcelable(ARG_GALLERY_PHOTO));
circularLoaderDrawable = new CircularLoaderDrawable();
circularLoaderDrawable.animate();
Log.d(getClass().getSimpleName(), " photo.getUrl() " + photo.getUrl());
loadImage(imageView, photo.getUrl(), NetworkPolicy.OFFLINE);
return rootView;
}
项目:PhotoDiscovery
文件:GalleryRecyclerViewAdapter.java
private void loadImage(final ViewHolder holder, final int position,
final NetworkPolicy networkPolicy) {
final WeakReference<CircularLoaderDrawable> xx =
new WeakReference<>(holder.getCircularLoaderDrawable());
Picasso.with(holder.getImageView().getContext())
.load(photoList.get(position).getUrl())
.resize(mColumnWidth, (int) (photoList.get(position).getAspectRatio() * mColumnWidth))
.placeholder(xx.get())
.noFade()
.networkPolicy(networkPolicy)
.into(holder.getImageView(), new com.squareup.picasso.Callback() {
@Override public void onSuccess() {
//
xx.get().clearAnimation();
//
AnimationUtils.fadeIn(holder.getImageView());
}
@Override public void onError() {
if (!networkPolicy.equals(NetworkPolicy.OFFLINE)) {
holder.getCircularLoaderDrawable().setError();
} else {
loadImage(holder, position, NetworkPolicy.NO_CACHE);
}
}
});
}
项目:commitstrip-reader
文件:StripRemoteDataSource.java
@Override
public RequestCreator fetchImageStrip(String url) {
if (!AIRPLANE_MODE) {
return mPicasso.load(url);
} else {
return mPicasso.load(url)
.memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
.networkPolicy(NetworkPolicy.NO_CACHE);
}
}
项目:commitstrip-reader
文件:StripImageCacheDataSource.java
@Override
public RequestCreator fetchImageStrip(@NonNull Long id) {
if (id == null) {
throw new IllegalArgumentException();
}
File file = getImageCacheForStrip(id);
return mPicasso
.load(file)
.networkPolicy(NetworkPolicy.OFFLINE, NetworkPolicy.NO_STORE);
}