ImageViewZoomExtender implements ZoomableComponent { @Override public void restore(ZoomInfo zoomInfo) { if (isImageEmpty()) { return; } zoomInfo = createZoomInfoIfNull(zoomInfo); resetZoomLevel(); resetImageMatrix(); saveCurrentSizes(); initializeScaleSize(); restoreActualZoomPosition(zoomInfo); } ImageViewZoomExtender(ImageView imageView); @Override float getZoomLevel(); @Override void restore(ZoomInfo zoomInfo); @Override ZoomInfo save(); void zoomTo(float targetLevel); void zoomTo(float targetLevel, PointF zoomPoint); @Override void zoomTo(float targetLevel, float zoomX, float zoomY); void panTo(PointF difference); @Override void panTo(float dx, float dy); static final int DEFAULT_MATRIX_SIZE; static final int NONE_DEF_STYLE; static final float ORIGINAL_LEVEL; }
@Test public void extenderShouldCheckDrawableExistsWhenExtenderRestores() { float zoomLevel = 7.0f; ZoomInfo zoomInfo = new ZoomInfo(zoomLevel); ImageView imageView = mock(ImageView.class); imageView.setImageBitmap(createTestBitmap()); ZoomableComponent extender = new ImageViewZoomExtender(imageView); extender.restore(zoomInfo); verify(imageView).getDrawable(); }