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

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

Best Java code snippets using com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.getResources (Showing top 12 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: davemorrissey/subsampling-scale-image-view

/**
 * A density aware alternative to {@link #setDoubleTapZoomScale(float)}; this allows you to express the scale the
 * image will zoom in to when double tapped in terms of the image pixel density. Values lower than the max scale will
 * be ignored. A sensible starting point is 160 - the default used by this view.
 * @param dpi New value for double tap gesture zoom scale.
 */
public final void setDoubleTapZoomDpi(int dpi) {
  DisplayMetrics metrics = getResources().getDisplayMetrics();
  float averageDpi = (metrics.xdpi + metrics.ydpi)/2;
  setDoubleTapZoomScale(averageDpi/dpi);
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * This is a screen density aware alternative to {@link #setMinScale(float)}; it allows you to express the minimum
 * allowed scale in terms of the maximum pixel density.
 * @param dpi Source image pixel density at minimum zoom.
 */
public final void setMaximumDpi(int dpi) {
  DisplayMetrics metrics = getResources().getDisplayMetrics();
  float averageDpi = (metrics.xdpi + metrics.ydpi)/2;
  setMinScale(averageDpi / dpi);
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * By default, image tiles are at least as high resolution as the screen. For a retina screen this may not be
 * necessary, and may increase the likelihood of an OutOfMemoryError. This method sets a DPI at which higher
 * resolution tiles should be loaded. Using a lower number will on average use less memory but result in a lower
 * quality image. 160-240dpi will usually be enough. This should be called before setting the image source,
 * because it affects which tiles get loaded. When using an untiled source image this method has no effect.
 * @param minimumTileDpi Tile loading threshold.
 */
public void setMinimumTileDpi(int minimumTileDpi) {
  DisplayMetrics metrics = getResources().getDisplayMetrics();
  float averageDpi = (metrics.xdpi + metrics.ydpi)/2;
  this.minimumTileDpi = (int)Math.min(averageDpi, minimumTileDpi);
  if (isReady()) {
    reset(false);
    invalidate();
  }
}
origin: davemorrissey/subsampling-scale-image-view

public SubsamplingScaleImageView(Context context, AttributeSet attr) {
  super(context, attr);
  density = getResources().getDisplayMetrics().density;
  setMinimumDpi(160);
  setDoubleTapZoomDpi(160);
origin: davemorrissey/subsampling-scale-image-view

DisplayMetrics metrics = getResources().getDisplayMetrics();
float averageDpi = (metrics.xdpi + metrics.ydpi)/2;
scale = (minimumTileDpi/averageDpi) * scale;
origin: mozilla-tw/Rocket

/**
 * A density aware alternative to {@link #setDoubleTapZoomScale(float)}; this allows you to express the scale the
 * image will zoom in to when double tapped in terms of the image pixel density. Values lower than the max scale will
 * be ignored. A sensible starting point is 160 - the default used by this view.
 * @param dpi New value for double tap gesture zoom scale.
 */
public final void setDoubleTapZoomDpi(int dpi) {
  DisplayMetrics metrics = getResources().getDisplayMetrics();
  float averageDpi = (metrics.xdpi + metrics.ydpi)/2;
  setDoubleTapZoomScale(averageDpi/dpi);
}
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: mozilla-tw/Rocket

/**
 * This is a screen density aware alternative to {@link #setMinScale(float)}; it allows you to express the minimum
 * allowed scale in terms of the maximum pixel density.
 * @param dpi Source image pixel density at minimum zoom.
 */
public final void setMaximumDpi(int dpi) {
  DisplayMetrics metrics = getResources().getDisplayMetrics();
  float averageDpi = (metrics.xdpi + metrics.ydpi)/2;
  setMinScale(averageDpi / dpi);
}
origin: mozilla-tw/Rocket

/**
 * By default, image tiles are at least as high resolution as the screen. For a retina screen this may not be
 * necessary, and may increase the likelihood of an OutOfMemoryError. This method sets a DPI at which higher
 * resolution tiles should be loaded. Using a lower number will on average use less memory but result in a lower
 * quality image. 160-240dpi will usually be enough. This should be called before setting the image source,
 * because it affects which tiles get loaded. When using an untiled source image this method has no effect.
 * @param minimumTileDpi Tile loading threshold.
 */
public void setMinimumTileDpi(int minimumTileDpi) {
  DisplayMetrics metrics = getResources().getDisplayMetrics();
  float averageDpi = (metrics.xdpi + metrics.ydpi)/2;
  this.minimumTileDpi = (int)Math.min(averageDpi, minimumTileDpi);
  if (isReady()) {
    reset(false);
    invalidate();
  }
}
origin: mozilla-tw/Rocket

public SubsamplingScaleImageView(Context context, AttributeSet attr) {
  super(context, attr);
  density = getResources().getDisplayMetrics().density;
  setMinimumDpi(160);
  setDoubleTapZoomDpi(160);
origin: mozilla-tw/Rocket

DisplayMetrics metrics = getResources().getDisplayMetrics();
float averageDpi = (metrics.xdpi + metrics.ydpi)/2;
scale = (minimumTileDpi/averageDpi) * scale;
com.davemorrissey.labs.subscaleviewSubsamplingScaleImageViewgetResources

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

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onCreateOptionsMenu (Activity)
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • JList (javax.swing)
  • From CI to AI: The AI layer in your organization
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