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

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

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

origin: davemorrissey/subsampling-scale-image-view

/**
 * Creates a scale animation builder, that when started will animate a zoom in or out. If this would move the image
 * beyond the panning limits, the image is automatically panned during the animation.
 * @param scale Target scale.
 * @return {@link AnimationBuilder} instance. Call {@link SubsamplingScaleImageView.AnimationBuilder#start()} to start the anim.
 */
@Nullable
public AnimationBuilder animateScale(float scale) {
  if (!isReady()) {
    return null;
  }
  return new AnimationBuilder(scale);
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Creates a scale animation builder, that when started will animate a zoom in or out. If this would move the image
 * beyond the panning limits, the image is automatically panned during the animation.
 * @param scale Target scale.
 * @param sCenter Target source center.
 * @return {@link AnimationBuilder} instance. Call {@link SubsamplingScaleImageView.AnimationBuilder#start()} to start the anim.
 */
@Nullable
public AnimationBuilder animateScaleAndCenter(float scale, PointF sCenter) {
  if (!isReady()) {
    return null;
  }
  return new AnimationBuilder(scale, sCenter);
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Creates a panning animation builder, that when started will animate the image to place the given coordinates of
 * the image in the center of the screen. If doing this would move the image beyond the edges of the screen, the
 * image is instead animated to move the center point as near to the center of the screen as is allowed - it's
 * guaranteed to be on screen.
 * @param sCenter Target center point
 * @return {@link AnimationBuilder} instance. Call {@link SubsamplingScaleImageView.AnimationBuilder#start()} to start the anim.
 */
@Nullable
public AnimationBuilder animateCenter(PointF sCenter) {
  if (!isReady()) {
    return null;
  }
  return new AnimationBuilder(sCenter);
}
origin: davemorrissey/subsampling-scale-image-view

@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
  if (imageView.isReady()) {
    PointF sCoord = imageView.viewToSourceCoord(e.getX(), e.getY());
    Toast.makeText(getApplicationContext(), "Single tap: " + ((int)sCoord.x) + ", " + ((int)sCoord.y), Toast.LENGTH_SHORT).show();
  } else {
    Toast.makeText(getApplicationContext(), "Single tap: Image not ready", Toast.LENGTH_SHORT).show();
  }
  return true;
}
@Override
origin: davemorrissey/subsampling-scale-image-view

  @Override
  public boolean onDoubleTap(MotionEvent e) {
    if (imageView.isReady()) {
      PointF sCoord = imageView.viewToSourceCoord(e.getX(), e.getY());
      Toast.makeText(getApplicationContext(), "Double tap: " + ((int)sCoord.x) + ", " + ((int)sCoord.y), Toast.LENGTH_SHORT).show();
    } else {
      Toast.makeText(getApplicationContext(), "Double tap: Image not ready", Toast.LENGTH_SHORT).show();
    }
    return true;
  }
});
origin: davemorrissey/subsampling-scale-image-view

@Override
public void onLongPress(MotionEvent e) {
  if (imageView.isReady()) {
    PointF sCoord = imageView.viewToSourceCoord(e.getX(), e.getY());
    Toast.makeText(getApplicationContext(), "Long press: " + ((int)sCoord.x) + ", " + ((int)sCoord.y), Toast.LENGTH_SHORT).show();
  } else {
    Toast.makeText(getApplicationContext(), "Long press: Image not ready", Toast.LENGTH_SHORT).show();
  }
}
@Override
origin: davemorrissey/subsampling-scale-image-view

/**
 * Set the pan limiting style. See static fields. Normally {@link #PAN_LIMIT_INSIDE} is best, for image galleries.
 * @param panLimit a pan limit constant. See static fields.
 */
public final void setPanLimit(int panLimit) {
  if (!VALID_PAN_LIMITS.contains(panLimit)) {
    throw new IllegalArgumentException("Invalid pan limit: " + panLimit);
  }
  this.panLimit = panLimit;
  if (isReady()) {
    fitToBounds(true);
    invalidate();
  }
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Set the minimum scale type. See static fields. Normally {@link #SCALE_TYPE_CENTER_INSIDE} is best, for image galleries.
 * @param scaleType a scale type constant. See static fields.
 */
public final void setMinimumScaleType(int scaleType) {
  if (!VALID_SCALE_TYPES.contains(scaleType)) {
    throw new IllegalArgumentException("Invalid scale type: " + scaleType);
  }
  this.minimumScaleType = scaleType;
  if (isReady()) {
    fitToBounds(true);
    invalidate();
  }
}
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

/**
 * Fully zoom out and return the image to the middle of the screen. This might be useful if you have a view pager
 * and want images to be reset when the user has moved to another page.
 */
public final void resetScaleAndCenter() {
  this.anim = null;
  this.pendingScale = limitedScale(0);
  if (isReady()) {
    this.sPendingCenter = new PointF(sWidth()/2, sHeight()/2);
  } else {
    this.sPendingCenter = new PointF(0, 0);
  }
  invalidate();
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Calculate how much further the image can be panned in each direction. The results are set on
 * the supplied {@link RectF} and expressed as screen pixels. For example, if the image cannot be
 * panned any further towards the left, the value of {@link RectF#left} will be set to 0.
 * @param vTarget target object for results. Re-use for efficiency.
 */
public final void getPanRemaining(RectF vTarget) {
  if (!isReady()) {
    return;
  }
  float scaleWidth = scale * sWidth();
  float scaleHeight = scale * sHeight();
  if (panLimit == PAN_LIMIT_CENTER) {
    vTarget.top = Math.max(0, -(vTranslate.y - (getHeight() / 2)));
    vTarget.left = Math.max(0, -(vTranslate.x - (getWidth() / 2)));
    vTarget.bottom = Math.max(0, vTranslate.y - ((getHeight() / 2) - scaleHeight));
    vTarget.right = Math.max(0, vTranslate.x - ((getWidth() / 2) - scaleWidth));
  } else if (panLimit == PAN_LIMIT_OUTSIDE) {
    vTarget.top = Math.max(0, -(vTranslate.y - getHeight()));
    vTarget.left = Math.max(0, -(vTranslate.x - getWidth()));
    vTarget.bottom = Math.max(0, vTranslate.y + scaleHeight);
    vTarget.right = Math.max(0, vTranslate.x + scaleWidth);
  } else {
    vTarget.top = Math.max(0, -vTranslate.y);
    vTarget.left = Math.max(0, -vTranslate.x);
    vTarget.bottom = Math.max(0, (scaleHeight + vTranslate.y) - getHeight());
    vTarget.right = Math.max(0, (scaleWidth + vTranslate.x) - getWidth());
  }
}
origin: davemorrissey/subsampling-scale-image-view

if (panLimit == PAN_LIMIT_OUTSIDE && isReady()) {
  center = false;
float scaleHeight = scale * sHeight();
if (panLimit == PAN_LIMIT_CENTER && isReady()) {
  vTranslate.x = Math.max(vTranslate.x, getWidth()/2 - scaleWidth);
  vTranslate.y = Math.max(vTranslate.y, getHeight()/2 - scaleHeight);
if (panLimit == PAN_LIMIT_CENTER && isReady()) {
  maxTx = Math.max(0, getWidth()/2);
  maxTy = Math.max(0, getHeight()/2);
origin: davemorrissey/subsampling-scale-image-view

/**
 * Enable or disable pan gesture detection. Disabling pan causes the image to be centered. Pan
 * can still be changed from code.
 * @param panEnabled true to enable panning, false to disable.
 */
public final void setPanEnabled(boolean panEnabled) {
  this.panEnabled = panEnabled;
  if (!panEnabled && vTranslate != null) {
    vTranslate.x = (getWidth()/2) - (scale * (sWidth()/2));
    vTranslate.y = (getHeight()/2) - (scale * (sHeight()/2));
    if (isReady()) {
      refreshRequiredTiles(true);
      invalidate();
    }
  }
}
origin: mozilla-tw/Rocket

/**
 * Creates a scale animation builder, that when started will animate a zoom in or out. If this would move the image
 * beyond the panning limits, the image is automatically panned during the animation.
 * @param scale Target scale.
 * @return {@link AnimationBuilder} instance. Call {@link SubsamplingScaleImageView.AnimationBuilder#start()} to start the anim.
 */
public AnimationBuilder animateScale(float scale) {
  if (!isReady()) {
    return null;
  }
  return new AnimationBuilder(scale);
}
origin: mozilla-tw/Rocket

/**
 * Creates a scale animation builder, that when started will animate a zoom in or out. If this would move the image
 * beyond the panning limits, the image is automatically panned during the animation.
 * @param scale Target scale.
 * @return {@link AnimationBuilder} instance. Call {@link SubsamplingScaleImageView.AnimationBuilder#start()} to start the anim.
 */
public AnimationBuilder animateScaleAndCenter(float scale, PointF sCenter) {
  if (!isReady()) {
    return null;
  }
  return new AnimationBuilder(scale, sCenter);
}
origin: mozilla-tw/Rocket

/**
 * Creates a panning animation builder, that when started will animate the image to place the given coordinates of
 * the image in the center of the screen. If doing this would move the image beyond the edges of the screen, the
 * image is instead animated to move the center point as near to the center of the screen as is allowed - it's
 * guaranteed to be on screen.
 * @param sCenter Target center point
 * @return {@link AnimationBuilder} instance. Call {@link SubsamplingScaleImageView.AnimationBuilder#start()} to start the anim.
 */
public AnimationBuilder animateCenter(PointF sCenter) {
  if (!isReady()) {
    return null;
  }
  return new AnimationBuilder(sCenter);
}
origin: mozilla-tw/Rocket

/**
 * Set the pan limiting style. See static fields. Normally {@link #PAN_LIMIT_INSIDE} is best, for image galleries.
 */
public final void setPanLimit(int panLimit) {
  if (!VALID_PAN_LIMITS.contains(panLimit)) {
    throw new IllegalArgumentException("Invalid pan limit: " + panLimit);
  }
  this.panLimit = panLimit;
  if (isReady()) {
    fitToBounds(true);
    invalidate();
  }
}
origin: mozilla-tw/Rocket

/**
 * Set the minimum scale type. See static fields. Normally {@link #SCALE_TYPE_CENTER_INSIDE} is best, for image galleries.
 */
public final void setMinimumScaleType(int scaleType) {
  if (!VALID_SCALE_TYPES.contains(scaleType)) {
    throw new IllegalArgumentException("Invalid scale type: " + scaleType);
  }
  this.minimumScaleType = scaleType;
  if (isReady()) {
    fitToBounds(true);
    invalidate();
  }
}
origin: mozilla-tw/Rocket

/**
 * Fully zoom out and return the image to the middle of the screen. This might be useful if you have a view pager
 * and want images to be reset when the user has moved to another page.
 */
public final void resetScaleAndCenter() {
  this.anim = null;
  this.pendingScale = limitedScale(0);
  if (isReady()) {
    this.sPendingCenter = new PointF(sWidth()/2, sHeight()/2);
  } else {
    this.sPendingCenter = new PointF(0, 0);
  }
  invalidate();
}
origin: mozilla-tw/Rocket

/**
 * Enable or disable pan gesture detection. Disabling pan causes the image to be centered.
 */
public final void setPanEnabled(boolean panEnabled) {
  this.panEnabled = panEnabled;
  if (!panEnabled && vTranslate != null) {
    vTranslate.x = (getWidth()/2) - (scale * (sWidth()/2));
    vTranslate.y = (getHeight()/2) - (scale * (sHeight()/2));
    if (isReady()) {
      refreshRequiredTiles(true);
      invalidate();
    }
  }
}
com.davemorrissey.labs.subscaleviewSubsamplingScaleImageViewisReady

Javadoc

Call to find whether the view is initialised, has dimensions, and will display an image on the next draw. If a preview has been provided, it may be the preview that will be displayed and the full size image may still be loading. If no preview was provided, this is called once the base layer tiles of the full size image are loaded.

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,
  • onDraw,
  • onImageLoaded

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • scheduleAtFixedRate (Timer)
  • onRequestPermissionsResult (Fragment)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Path (java.nio.file)
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Top Vim 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