Tabnine Logo
SubsamplingScaleImageView.setMaxScale
Code IndexAdd Tabnine to your IDE (free)

How to use
setMaxScale
method
in
com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView

Best Java code snippets using com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.setMaxScale (Showing top 6 results out of 315)

origin: davemorrissey/subsampling-scale-image-view

/**
 * This is a screen density aware alternative to {@link #setMaxScale(float)}; it allows you to express the maximum
 * allowed scale in terms of the minimum pixel density. This avoids the problem of 1:1 scale still being
 * too small on a high density screen. A sensible starting point is 160 - the default used by this view.
 * @param dpi Source image pixel density at maximum zoom.
 */
public final void setMinimumDpi(int dpi) {
  DisplayMetrics metrics = getResources().getDisplayMetrics();
  float averageDpi = (metrics.xdpi + metrics.ydpi)/2;
  setMaxScale(averageDpi/dpi);
}
origin: Piasy/BigImageViewer

  mImageView.setMaxScale(Math.max(defaultMaxScale, maxScale * 1.2F));
} else {
origin: davemorrissey/subsampling-scale-image-view

  view.setMinimumDpi(50);
} else {
  view.setMaxScale(2F);
origin: mozilla-tw/Rocket

/**
 * This is a screen density aware alternative to {@link #setMaxScale(float)}; it allows you to express the maximum
 * allowed scale in terms of the minimum pixel density. This avoids the problem of 1:1 scale still being
 * too small on a high density screen. A sensible starting point is 160 - the default used by this view.
 * @param dpi Source image pixel density at maximum zoom.
 */
public final void setMinimumDpi(int dpi) {
  DisplayMetrics metrics = getResources().getDisplayMetrics();
  float averageDpi = (metrics.xdpi + metrics.ydpi)/2;
  setMaxScale(averageDpi/dpi);
}
origin: Awent/PhotoPick-Master

private SubsamplingScaleImageView getLongImageView(ImageSource imageSource, File file, int orientation, float hScale) {
  SubsamplingScaleImageView imageView = new SubsamplingScaleImageView(this);
  if (orientation == 1) {//纵向图
    imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
    imageView.setImage(imageSource, new ImageViewState(0, new PointF(0, 0), SubsamplingScaleImageView.ORIENTATION_0));
  } else {//横向长图
    if (file != null) {
      //因为这里展示的是原图,不是经过fresco压缩的bitmap,这里拿到图片的原始宽高,从新计算最大缩放比
      hScale = screenHeight / BitmapUtil.getImageSize(file.getAbsolutePath())[1];
    }
    imageView.setMaxScale(hScale);
    imageView.setImage(imageSource);
  }
  imageView.setOnClickListener(onClickListener);
  //图片下载完成并且开启图片保存才给长按保存
  imageView.setOnLongClickListener(this);
  return imageView;
}
origin: Awent/PhotoPick-Master

/**
 * 加载超长图
 */
private SubsamplingScaleImageView loadLongPhoto(File file, int orientation, int hScale) {
  SubsamplingScaleImageView imageView = new SubsamplingScaleImageView(this);
  imageView.setOnClickListener(onClickListener);
  imageView.setBackgroundColor(getResources().getColor(android.R.color.black));
  if (file != null && file.exists()) {
    if (orientation == 1) {//纵向图
      imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
      imageView.setImage(ImageSource.uri(file.getAbsolutePath()), new ImageViewState(0, new PointF(0, 0), SubsamplingScaleImageView.ORIENTATION_0));
    } else {
      imageView.setMaxScale(hScale);
      imageView.setImage(ImageSource.uri(file.getAbsolutePath()));
    }
  } else {
    imageView.setImage(ImageSource.resource(R.mipmap.failure_image));
  }
  return imageView;
}
com.davemorrissey.labs.subscaleviewSubsamplingScaleImageViewsetMaxScale

Javadoc

Set the maximum scale allowed. A value of 1 means 1:1 pixels at maximum scale. You may wish to set this according to screen density - on a retina screen, 1:1 may still be too small. Consider using #setMinimumDpi(int), which is density aware.

Popular methods of SubsamplingScaleImageView

  • setImage
    Set the image source from a bitmap, resource, asset, file or other URI, starting with a given orient
  • setDoubleTapZoomScale
    Set the scale the image will zoom in to when double tapped. This also the scale point where a double
  • setMinimumDpi
    This is a screen density aware alternative to #setMaxScale(float); it allows you to express the maxi
  • setScaleAndCenter
    Externally change the scale and translation of the source image. This may be used with getCenter() a
  • getWidth
  • setDoubleTapZoomDpi
    A density aware alternative to #setDoubleTapZoomScale(float); this allows you to express the scale t
  • setMinimumScaleType
    Set the minimum scale type. See static fields. Normally #SCALE_TYPE_CENTER_INSIDE is best, for image
  • setMinimumTileDpi
    By default, image tiles are at least as high resolution as the screen. For a retina screen this may
  • setPanEnabled
    Enable or disable pan gesture detection. Disabling pan causes the image to be centered.
  • setZoomEnabled
    Enable or disable zoom gesture detection. Disabling zoom locks the the current scale.
  • <init>
  • getCenter
    Returns the source point at the center of the view.
  • <init>,
  • getCenter,
  • getContext,
  • getHeight,
  • getOrientation,
  • getScale,
  • isReady,
  • onDraw,
  • onImageLoaded

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • putExtra (Intent)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now