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


Java SubsamplingScaleImageView.setMinimumTileDpi方法代码示例

本文整理汇总了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;
}
 
开发者ID:num42,项目名称:subsampling-pdf-decoder,代码行数:30,代码来源:PDFPagerAdapter.java

示例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<>();
}
 
开发者ID:love-311,项目名称:BigImageViewer-master,代码行数:16,代码来源:BigImageView.java

示例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));
                }
            });
        }
    }
}
 
开发者ID:GreenSkinMonster,项目名称:hipda,代码行数:65,代码来源:ImageViewerAdapter.java


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