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

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

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

origin: davemorrissey/subsampling-scale-image-view

/**
 * Measures the width and height of the view, preserving the aspect ratio of the image displayed if wrap_content is
 * used. The image will scale within this box, not resizing the view as it is zoomed.
 */
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
  int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
  int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
  int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
  boolean resizeWidth = widthSpecMode != MeasureSpec.EXACTLY;
  boolean resizeHeight = heightSpecMode != MeasureSpec.EXACTLY;
  int width = parentWidth;
  int height = parentHeight;
  if (sWidth > 0 && sHeight > 0) {
    if (resizeWidth && resizeHeight) {
      width = sWidth();
      height = sHeight();
    } else if (resizeHeight) {
      height = (int)((((double)sHeight()/(double)sWidth()) * width));
    } else if (resizeWidth) {
      width = (int)((((double)sWidth()/(double)sHeight()) * height));
    }
  }
  width = Math.max(width, getSuggestedMinimumWidth());
  height = Math.max(height, getSuggestedMinimumHeight());
  setMeasuredDimension(width, height);
}
origin: mozilla-tw/Rocket

/**
 * Measures the width and height of the view, preserving the aspect ratio of the image displayed if wrap_content is
 * used. The image will scale within this box, not resizing the view as it is zoomed.
 */
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
  int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
  int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
  int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
  boolean resizeWidth = widthSpecMode != MeasureSpec.EXACTLY;
  boolean resizeHeight = heightSpecMode != MeasureSpec.EXACTLY;
  int width = parentWidth;
  int height = parentHeight;
  if (sWidth > 0 && sHeight > 0) {
    if (resizeWidth && resizeHeight) {
      width = sWidth();
      height = sHeight();
    } else if (resizeHeight) {
      height = (int)((((double)sHeight()/(double)sWidth()) * width));
    } else if (resizeWidth) {
      width = (int)((((double)sWidth()/(double)sHeight()) * height));
    }
  }
  width = Math.max(width, getSuggestedMinimumWidth());
  height = Math.max(height, getSuggestedMinimumHeight());
  setMeasuredDimension(width, height);
}
com.davemorrissey.labs.subscaleviewSubsamplingScaleImageViewsetMeasuredDimension

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
  • setMaxScale
    Set the maximum scale allowed. A value of 1 means 1:1 pixels at maximum scale. You may wish to set t
  • 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>
  • setZoomEnabled,
  • <init>,
  • getCenter,
  • getContext,
  • getHeight,
  • getOrientation,
  • getScale,
  • isReady,
  • onDraw,
  • onImageLoaded

Popular in Java

  • Reading from database using SQL prepared statement
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Top Sublime Text plugins
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