本文整理汇总了Java中com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.setMinimumTileDpi方法的典型用法代码示例。如果您正苦于以下问题:Java SubsamplingScaleImageView.setMinimumTileDpi方法的具体用法?Java SubsamplingScaleImageView.setMinimumTileDpi怎么用?Java SubsamplingScaleImageView.setMinimumTileDpi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
的用法示例。
在下文中一共展示了SubsamplingScaleImageView.setMinimumTileDpi方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: instantiateItem
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入方法依赖的package包/类
/**
* Instantiate an item. Therefor a {@link SubsamplingScaleImageView} with special decoders is
* initialized and rendered.
*
* @param container isn't used here
* @param position the current pdf page position
*/
public Object instantiateItem(ViewGroup container, int position) {
SubsamplingScaleImageView imageView = new SubsamplingScaleImageView(context);
// the smaller this number, the smaller the chance to get an "outOfMemoryException"
// still, values lower than 100 really do affect the quality of the pdf picture
int minimumTileDpi = 120;
imageView.setMinimumTileDpi(minimumTileDpi);
//sets the PDFDecoder for the imageView
imageView.setBitmapDecoderFactory(() -> new PDFDecoder(position, file, scale));
//sets the PDFRegionDecoder for the imageView
imageView.setRegionDecoderFactory(() -> new PDFRegionDecoder(position, file, scale));
ImageSource source = ImageSource.uri(file.getAbsolutePath());
imageView.setImage(source);
container.addView(imageView);
return imageView;
}
示例2: BigImageView
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入方法依赖的package包/类
public BigImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mImageView = new SubsamplingScaleImageView(context, attrs);
addView(mImageView);
LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
mImageView.setLayoutParams(params);
mImageView.setMinimumTileDpi(160);
mImageView.setOnImageEventListener(new DisplayOptimizeListener(mImageView));
mImageLoader = BigImageViewer.imageLoader();
mTempImages = new ArrayList<>();
}
示例3: displayImage
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; //导入方法依赖的package包/类
private void displayImage(final ImageViewerLayout imageLayout, String imageUrl) {
imageLayout.getProgressBar().setVisibility(View.GONE);
final SubsamplingScaleImageView scaleImageView = imageLayout.getScaleImageView();
final GlideImageView glideImageView = imageLayout.getGlideImageView();
//imageView could be null if display image on GlideImageEvent
if (scaleImageView == null || glideImageView == null)
return;
ImageInfo imageInfo = ImageContainer.getImageInfo(imageUrl);
if (!imageInfo.isReady()) {
glideImageView.setVisibility(View.VISIBLE);
scaleImageView.setVisibility(View.GONE);
glideImageView.setImageDrawable(ContextCompat.getDrawable(mActivity, R.drawable.image_broken));
} else {
if (imageInfo.isGif()) {
glideImageView.setVisibility(View.VISIBLE);
scaleImageView.setVisibility(View.GONE);
if (GlideHelper.isOkToLoad(mActivity)) {
Glide.with(mActivity)
.load(imageUrl)
.asBitmap()
.priority(Priority.IMMEDIATE)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.transform(new GifTransformation(mActivity))
.error(R.drawable.image_broken)
.into(new GlideBitmapTarget(glideImageView, imageInfo.getDisplayWidth(), imageInfo.getDisplayHeight()));
}
glideImageView.setUrl(imageUrl);
glideImageView.setSingleClickListener();
} else {
scaleImageView.setMinimumDpi(36);
scaleImageView.setMinimumTileDpi(160);
scaleImageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_USE_EXIF);
scaleImageView.setImage(ImageSource.uri(imageInfo.getPath()));
scaleImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mActivity.finish();
}
});
scaleImageView.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() {
@Override
public void onImageLoaded() {
Glide.clear(glideImageView);
glideImageView.setVisibility(View.GONE);
scaleImageView.setVisibility(View.VISIBLE);
}
@Override
public void onImageLoadError(Exception e) {
Glide.clear(glideImageView);
glideImageView.setVisibility(View.GONE);
scaleImageView.setImage(ImageSource.resource(R.drawable.image_broken));
}
});
}
}
}