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


Java MemoryPolicy类代码示例

本文整理汇总了Java中com.squareup.picasso.MemoryPolicy的典型用法代码示例。如果您正苦于以下问题:Java MemoryPolicy类的具体用法?Java MemoryPolicy怎么用?Java MemoryPolicy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onBindViewHolder

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    final LocalPhoto photo = data.get(position);
    holder.attachPhoto(photo);

    PicassoInstance.with()
            .load(LocalPhoto.buildUriForPicasso(photo.getImageId()))
            .tag(TAG)
            .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
            .placeholder(R.drawable.background_gray)
            .into(holder.photoImageView);

    resolveSelectionVisibility(photo, holder);
    resolveIndexText(photo, holder);

    View.OnClickListener listener = v -> {
        if (clickListener != null) {
            clickListener.onPhotoClick(holder, photo);
        }
    };

    holder.photoImageView.setOnClickListener(listener);
    holder.selectedRoot.setOnClickListener(listener);
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:25,代码来源:LocalPhotosAdapter.java

示例2: onBindViewHolder

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
@Override
public void onBindViewHolder(Holder holder, int position) {
    final LocalImageAlbum album = data.get(position);

    Uri uri = LocalPhoto.buildUriForPicasso(album.getCoverImageId());
    PicassoInstance.with()
            .load(uri)
            .tag(PICASSO_TAG)
            .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
            .placeholder(R.drawable.background_gray)
            .into(holder.image);

    holder.title.setText(album.getName());
    holder.subtitle.setText(holder.itemView.getContext().getString(R.string.photos_count, album.getPhotoCount()));

    holder.itemView.setOnClickListener(v -> {
        if(clickListener != null){
            clickListener.onClick(album);
        }
    });
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:22,代码来源:LocalPhotoAlbumsAdapter.java

示例3: updateImage

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
/**
 * Update image path text and image views.
 */
private void updateImage() {
    mImagePathText.setText(TextUtils.isEmpty(mImagePath) ? "-" : mImagePath);
    if (TextUtils.isEmpty(mImagePath)) {
        // if there is no selected image, load image placeholder
        Picasso.with(getActivity())
                .load(R.drawable.image_placeholder)
                .into(mImageView);
    } else {
        // It is important to be very careful loading this image because it can be
        // high resolution, very heavy and cause application memory problems
        // (there is no danger of out of memory thanks to picasso)
        Picasso.with(getActivity())
                .load(new File(mImagePath))
                .placeholder(R.drawable.image_placeholder)
                .memoryPolicy(MemoryPolicy.NO_CACHE)
                .resize(IMAGE_MAX_WIDTH_PX, IMAGE_MAX_HEIGHT_PX)
                .centerInside()
                .onlyScaleDown()
                .into(mImageView);
    }
}
 
开发者ID:nfdz,项目名称:foco,代码行数:25,代码来源:EditDocCoverDialog.java

示例4: onActivityResult

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.e("请求码和结果码",requestCode + ".........." + resultCode);
    if (requestCode == SELECT_PIC && resultCode == RESULT_OK) {
        Log.e("onActivityResult方法", "执行了");
        ArrayList<String> resultList = data.getStringArrayListExtra("resultList");
        String imagePath = resultList.get(0);

        Picasso.with(this)
                .load(new File(imagePath))
                .memoryPolicy(MemoryPolicy.NO_CACHE)
                .resize(800, 600)
                .centerCrop()
                .error(R.drawable.place_holder)
                .into(imageview);

    }

}
 
开发者ID:BittleDragon,项目名称:MyRepository,代码行数:21,代码来源:PicturePickerActivity.java

示例5: instantiateItem

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
    final View itemView = mLayoutInflater.inflate(R.layout.layout_image_slider_item, container, false);

    ImageView imageView = (ImageView) itemView.findViewById(R.id.img_pager_slider);

    Picasso.with(App.getContext()).
            load(getUrl(position)).
            error(R.drawable.ic_broken_image).
            memoryPolicy(MemoryPolicy.NO_CACHE).
            into(imageView, new Callback() {
                @Override
                public void onSuccess() {
                    itemView.findViewById(R.id.pb_fullscreen_loading).setVisibility(View.GONE);
                }

                @Override
                public void onError() {
                }
            });

    container.addView(itemView);
    return itemView;
}
 
开发者ID:Sar777,项目名称:onliner_old,代码行数:25,代码来源:ImageSliderAdapter.java

示例6: display

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
/**
 * 单图展示
 *
 * @param url
 */
@Override
public void display(String url) {
    mIvContent.setVisibility(View.VISIBLE);
    mViewPager.setVisibility(View.GONE);
    int w = mIvContent.getMeasuredWidth() > 0 ? mIvContent.getMeasuredWidth() : 400;
    int h = mIvContent.getMeasuredHeight() > 0 ? mIvContent.getMeasuredHeight() : 400;
    // TODO 根据需要调整
    url = (url.indexOf(AppConsts.AppConfig.PATH_HTTP) != -1 || url.indexOf(AppConsts.AppConfig.PATH_HTTPS) != -1) ? url : AppConsts.AppConfig.PATH_FILE + url;
    Picasso.with(getContext())
            .load(url)
            .memoryPolicy(MemoryPolicy.NO_STORE, MemoryPolicy.NO_CACHE)
            .config(Bitmap.Config.RGB_565)
            .resize(w, h)
            .placeholder(R.drawable.pic_load)
            .error(R.drawable.pic_load_error)
            .centerInside()
            .into(mIvContent);
}
 
开发者ID:Jay-Y,项目名称:yApp,代码行数:24,代码来源:ImageDetailPresenter.java

示例7: callNextCycle

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:deepaktwr,项目名称:BitFrames,代码行数:26,代码来源:ImageShading.java

示例8: getView

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
    ActivityData actD = arrayList.get(position);

    LayoutInflater inflater = ((Activity)context).getLayoutInflater();
    convertView = inflater.inflate(R.layout.grid_layout_item, parent, false);
    TextView tv = (TextView) convertView.findViewById(R.id.myImageViewText);
    TextView dv = (TextView) convertView.findViewById(R.id.myImageViewDate);
    ImageView iv = (ImageView) convertView.findViewById(R.id.myImageView);
    if(tv != null) {
        tv.setText(actD.getTitle());
        iv.setImageResource(R.drawable.placeholder);
        Long time = new Long((actD.getStartTime().toString()));
        dv.setText(readableTimeStamp(time));
        Picasso.with(context)
                .load(actD.getImageUrl())
                .noFade()
                .memoryPolicy(MemoryPolicy.NO_CACHE)
                .into(iv);
        iv.setScaleType(ImageView.ScaleType.FIT_XY);
    }
    return convertView;

}
 
开发者ID:dkzeb,项目名称:studdyDokky,代码行数:24,代码来源:ActivitiesAdapter.java

示例9: newRelativeLayout

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
protected ImageView newRelativeLayout(final bind mBind, int size) {
    ImageView imview = new ImageView(getActivity());
    imview.setLayoutParams(findBoxWidth(mBind, size));
    getPicassoClient()
            .load(mBind.image)
            .memoryPolicy(MemoryPolicy.NO_STORE, MemoryPolicy.NO_CACHE)
            .into(imview);
    imview.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            trigger_link(mBind);
        }
    });
    imview.setScaleType(ImageView.ScaleType.CENTER_CROP);
    return imview;
}
 
开发者ID:jjhesk,项目名称:KickAssSlidingMenu,代码行数:17,代码来源:template_automatic_ll.java

示例10: updateImage

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
private void updateImage(){
    Picasso.with(this)
            .load(currentPicture.getUrl())
            //Reduces memory usage by 50%, we likely won't use images after refresh.
            .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
            .into(imageView, new Callback() {
                @Override
                public void onSuccess() {
                    Log.d("Succeeded", "Loaded image");
                    hideProgress();
                }

                @Override
                public void onError() {
                    Log.d("Failed", "Didn't load image");
                    hideProgress();
                }
            });
}
 
开发者ID:kokhouser,项目名称:NAPOD,代码行数:20,代码来源:MainActivity.java

示例11: loadImageBitmapFromDisk

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
/**
 * Just like the loadImageBitmapFromMemory() method, we first call fetch() to load the image in our caches.
 * In order to make sure this image does not come from the memory cache, we specifically set the request to ignore the memory cache with .memoryPolicy().
 * This should result in 99% of the cases that the image loads from the disk cache.
 */
private void loadImageBitmapFromDisk() {
    Picasso.with(context).load(UsageExampleListView.eatFoodyImages[1]).fetch(new Callback() {
        @Override
        public void onSuccess() {
            Picasso
                    .with(context)
                    .load(UsageExampleListView.eatFoodyImages[1])
                    .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
                    .into(imageViewFromDisk);
        }

        @Override
        public void onError() {

        }
    });
}
 
开发者ID:fs-opensource,项目名称:android-tutorials-picasso,代码行数:23,代码来源:UsageExampleLoggingAndStats.java

示例12: downloadImages

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
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();
        }

    }
}
 
开发者ID:dhis2,项目名称:dhis2-android-dashboard,代码行数:17,代码来源:PullImageController.java

示例13: picassoImplementation

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
public static void picassoImplementation(String u, final ImageView target, Context context, final Runnable callback) {
    Picasso.with(context)
            .load(u)
            .memoryPolicy(MemoryPolicy.NO_STORE, MemoryPolicy.NO_CACHE)
            .into(target, new Callback() {
                @Override
                public void onSuccess() {
                    callback.run();
                }

                @Override
                public void onError() {

                }
            });
}
 
开发者ID:jjhesk,项目名称:LoyalNativeSlider,代码行数:17,代码来源:LoyalUtil.java

示例14: onImagePickedFromDevice

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
@Override
protected void onImagePickedFromDevice(Uri imageUri, int requestCode) {
	if (requestCode == REQUEST_PICK_AVATAR) {
		with(getContext())
				.load(imageUri)
				.resize(MAX_WIDTH, 0)
				.memoryPolicy(MemoryPolicy.NO_CACHE)
				.into(new Target() {
					@Override
					public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
						setAvatarBitmap(bitmap);
					}

					@Override
					public void onBitmapFailed(Drawable errorDrawable) {
						showAlert("Error", "Failed to load image");
					}

					@Override
					public void onPrepareLoad(Drawable placeHolderDrawable) {

					}
				});
	}
}
 
开发者ID:getsocial-im,项目名称:getsocial-android-sdk,代码行数:26,代码来源:UserManagementFragment.java

示例15: onBind

import com.squareup.picasso.MemoryPolicy; //导入依赖的package包/类
@Override
public void onBind(ImageView view, String url) {
    Picasso.with(view.getContext())
            .load(url)
            .memoryPolicy(MemoryPolicy.NO_CACHE)
            .into(view);
}
 
开发者ID:sedstrom,项目名称:Witch-Android,代码行数:8,代码来源:PicassoOnBind.java


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