本文整理汇总了Java中uk.co.senab.photoview.PhotoViewAttacher.setScale方法的典型用法代码示例。如果您正苦于以下问题:Java PhotoViewAttacher.setScale方法的具体用法?Java PhotoViewAttacher.setScale怎么用?Java PhotoViewAttacher.setScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uk.co.senab.photoview.PhotoViewAttacher
的用法示例。
在下文中一共展示了PhotoViewAttacher.setScale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSuccess
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override
public void onSuccess() {
if (mWr.get() == null || mWr.get().mImageView == null) {
return;
}
mWr.get().dismissProgressDialog();
Drawable drawable = mWr.get().mImageView.getDrawable();
PhotoViewAttacher attacher = mWr.get().mAttacher;
if (attacher != null) {
if (drawable.getIntrinsicHeight() > (drawable.getIntrinsicWidth() << 2)) {
// handle the super height image.
int scale = drawable.getIntrinsicHeight() / drawable.getIntrinsicWidth();
scale = Math.min(MAX_SCALE, scale);
attacher.setMaximumScale(scale);
attacher.setScale(scale, true);
}
attacher.update();
}
BoxingViewActivity activity = mWr.get().getThisActivity();
if (activity != null && activity.mGallery != null) {
activity.mGallery.setVisibility(View.VISIBLE);
}
}
示例2: instantiateItem
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override
@SuppressWarnings("NewApi")
public Object instantiateItem(ViewGroup container, int position) {
View v = inflater.inflate(R.layout.view_pdf_page, container, false);
ImageView iv = (ImageView) v.findViewById(R.id.imageView);
if (renderer == null || getCount() < position) {
return v;
}
PdfRenderer.Page page = getPDFPage(renderer, position);
Bitmap bitmap = bitmapContainer.get(position);
page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
page.close();
PhotoViewAttacher attacher = new PhotoViewAttacher(iv);
attacher.setScale(scale.getScale(), scale.getCenterX(), scale.getCenterY(), true);
attacher.setOnMatrixChangeListener(this);
attachers.put(position, new WeakReference<PhotoViewAttacher>(attacher));
iv.setImageBitmap(bitmap);
attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
if (pageClickListener != null) {
pageClickListener.onPageTap(view, x, y);
}
}
});
attacher.update();
container.addView(v, 0);
return v;
}
示例3: instantiateItem
import uk.co.senab.photoview.PhotoViewAttacher; //导入方法依赖的package包/类
@Override
@SuppressWarnings("NewApi")
public Object instantiateItem(ViewGroup container, int position) {
View v = inflater.inflate(R.layout.view_pdf_page, container, false);
ImageView iv = (ImageView) v.findViewById(R.id.imageView);
if (renderer == null || getCount() < position) {
return v;
}
PdfRenderer.Page page = getPDFPage(renderer, position);
Bitmap bitmap = bitmapContainer.get(position);
page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
page.close();
PhotoViewAttacher attacher = new PhotoViewAttacher(iv);
attacher.setScale(scale.getScale(), scale.getCenterX(), scale.getCenterY(), true);
attacher.setOnMatrixChangeListener(this);
attachers.put(position, new WeakReference<PhotoViewAttacher>(attacher));
iv.setImageBitmap(bitmap);
attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
pageClickListener.onClick(view);
}
});
attacher.update();
((ViewPager) container).addView(v, 0);
return v;
}