Java Code Examples for uk.co.senab.photoview.PhotoViewAttacher

The following examples show how to use uk.co.senab.photoview.PhotoViewAttacher. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: star-zone-android   Source File: PhotoBrowseActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void preInitData() {
    photoBrowseInfo = getIntent().getParcelableExtra("photoinfo");
    viewBuckets = new LinkedList<>();
    final int photoCount = photoBrowseInfo.getPhotosCount();
    for (int i = 0; i < photoCount; i++) {
        GalleryPhotoView photoView = new GalleryPhotoView(this);
        photoView.setCleanOnDetachedFromWindow(false);
        photoView.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
            @Override
            public void onViewTap(View view, float x, float y) {
                finish();
            }
        });
        viewBuckets.add(photoView);
    }
}
 
Example 2
Source Project: MediaGallery   Source File: ViewPagerAdapter.java    License: Apache License 2.0 6 votes vote down vote up
private void onTap() {
    mPhotoViewAttacher = new PhotoViewAttacher(imageView);

    mPhotoViewAttacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            if (isShowing) {
                isShowing = false;
                toolbar.animate().translationY(-toolbar.getBottom()).setInterpolator(new AccelerateInterpolator()).start();
                imagesHorizontalList.animate().translationY(imagesHorizontalList.getBottom()).setInterpolator(new AccelerateInterpolator()).start();
            } else {
                isShowing = true;
                toolbar.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
                imagesHorizontalList.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
            }
        }

        @Override
        public void onOutsidePhotoTap() {

        }
    });
}
 
Example 3
Source Project: boxing   Source File: BoxingRawImageFragment.java    License: Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example 4
Source Project: AndroidPickPhotoDialog   Source File: ImgShowDialog.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dialog_photo_show_layout);
    photoView = (PhotoView) findViewById(R.id.photoview);
    Glide.with(context).load(imgpath).into(photoView);
    mAttacher = new PhotoViewAttacher(photoView);
    mAttacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {

        @Override
        public void onPhotoTap(View view, float x, float y) {

        }

        @Override
        public void onOutsidePhotoTap() {

        }
    });
}
 
Example 5
Source Project: talk-android   Source File: ImageReviewActivity.java    License: MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_image_review);
    ButterKnife.inject(this);

    attacher = new PhotoViewAttacher(image);
    attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
        @Override
        public void onViewTap(View view, float v, float v2) {
            finish();
        }
    });
    final String path = getIntent().getExtras().getString("path");
    displayImage("file://" + path, image);

}
 
Example 6
Source Project: GankLock   Source File: PhotoActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //如果没有虚拟按键则设置为全屏
    if (!UIUtil.isHasNavigationBar(this)) {
        getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LOW_PROFILE |
                View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
                View.SYSTEM_UI_FLAG_FULLSCREEN);
    }
    if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(R.color.black);
    }
    mAttacher = new PhotoViewAttacher(mPhoto);
    mAttacher.setOnViewTapListener(new OnViewTapListener() {
        @Override public void onViewTap(View view, float x, float y) {
            hideBottomOption();
        }
    });
}
 
Example 7
Source Project: Android-Application-ZJB   Source File: PhotoActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void initView() {
    Intent intent = getIntent();
    String imagePath = intent.getStringExtra(KEY_IMAGE_PATH);
    mImageView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            PhotoActivity.this.finish();
        }

        @Override
        public void onOutsidePhotoTap() {

        }
    });
    ViewUtils.showImage(mImageView, imagePath);
}
 
Example 8
Source Project: myapplication   Source File: MeAvatarShowerAty.java    License: Apache License 2.0 6 votes vote down vote up
private void eventDeal() {
    AppUser appUser = BmobUser.getCurrentUser(AppUser.class);
    String avatarUrl = appUser.getUserAvatarUrl();

    Glide.with(MeAvatarShowerAty.this)
            .load(avatarUrl)
            .error(R.drawable.app_icon)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(avatarImv);

    photoViewAttacher = new PhotoViewAttacher(avatarImv);
    photoViewAttacher.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            String[] choices = {"保存至本地"};
            //包含多个选项的对话框
            AlertDialog dialog = new AlertDialog.Builder(MeAvatarShowerAty.this)
                    .setItems(choices, onselect).create();
            dialog.show();
            return true;
        }
    });
}
 
Example 9
@SuppressWarnings("ConstantConditions")
private void showPhotoView() {
	mShowPhotoView = true;
	binding.photoView.setImageDrawable(viewModel.clickedImageView.getDrawable());
	binding.photoView.setVisibility(View.VISIBLE);
	binding.photoView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
	mToolbarOffset = binding.appbar.getOffset();
	appBarLayout.setExpanded(false, false);
	reply.hide();
	binding.photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
		@Override
		public void onPhotoTap(View view, float x, float y) {

		}

		@Override
		public void onOutsidePhotoTap() {
			hidePhotoView();
		}
	});
}
 
Example 10
Source Project: ZZShow   Source File: NewsPhotoDetailActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, int position) {

    PhotoView photoView = new PhotoView(NewsPhotoDetailActivity.this);
    Glide.with(NewsPhotoDetailActivity.this).load(mPictureList.get(position).getImgPath())
            .placeholder(R.mipmap.ic_loading)
            .error(R.mipmap.ic_load_fail)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(photoView);
    photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float v, float v1) {
            hideToolBarAndTextView();
            hideOrShowStatusBar();
        }

        @Override
        public void onOutsidePhotoTap() {

        }
    });
    container.addView(photoView, ViewPager.LayoutParams.MATCH_PARENT, ViewPager.LayoutParams.MATCH_PARENT);
    return photoView;
}
 
Example 11
Source Project: FamilyChat   Source File: ImagePickerPagerAdapter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, int position)
{
    PhotoView photoView = new PhotoView(mActivity);
    photoView.setScaleType(ImageView.ScaleType.FIT_CENTER);
    photoView.setEnabled(true);
    ImageBean imageItem = mAllmageList.get(position);
    mImagePicker.getOptions().getDisplayer().display(mActivity, photoView, imageItem.getImagePath(), mScreenWidth, mScreenHeight);
    photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener()
    {
        @Override
        public void onPhotoTap(View view, float x, float y)
        {
            if (mListener != null)
                mListener.OnPhotoTapListener(view, x, y);
        }
    });
    container.addView(photoView);
    return photoView;
}
 
Example 12
Source Project: SimplifyReader   Source File: ImagesDetailActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void initViewsAndEvents() {
    mSmoothImageView.setOriginalInfo(mWidth, mHeight, mLocationX, mLocationY);
    mSmoothImageView.transformIn();

    ImageLoader.getInstance().displayImage(mImageUrl, mSmoothImageView);

    mSmoothImageView.setOnTransformListener(new SmoothImageView.TransformListener() {
        @Override
        public void onTransformComplete(int mode) {
            if (mode == 2) {
                finish();
            }
        }
    });

    mSmoothImageView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float v, float v2) {
            mSmoothImageView.transformOut();
        }
    });
}
 
Example 13
Source Project: Gank.io   Source File: MeizhiActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void initMeizhiView() {
  setTitle(DateUtil.toDateTimeStr(meizi.publishedAt));
  ivMeizhi.setImageDrawable(ShareElement.shareDrawable);
  ViewCompat.setTransitionName(ivMeizhi, PanConfig.TRANSLATE_GIRL_VIEW);
  attacher = new PhotoViewAttacher(ivMeizhi);
  Glide.with(this).load(meizi.url).asBitmap().into(new SimpleTarget<Bitmap>() {
    @Override
    public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
      ivMeizhi.setImageBitmap(resource);
      attacher.update();
      girl = resource;
    }

    @Override
    public void onLoadFailed(Exception e, Drawable errorDrawable) {
      ivMeizhi.setImageDrawable(errorDrawable);
    }
  });
  attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
    @Override
    public void onPhotoTap(View view, float x, float y) {
      hideOrShowToolBar();
    }
  });
}
 
Example 14
Source Project: KJGallery   Source File: SamplePagerAdapter.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 加载普通图片
 */
private void displayImage(PhotoView photoView, byte[] res) {
    photoView.setVisibility(View.VISIBLE);

    Bitmap bitmap = byteArrayToBitmap(res);
    if (bitmap == null) {
        photoView.setImageResource(R.mipmap.default_img_rect);
    } else {
        photoView.setImageBitmap(bitmap);
    }

    photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            aty.finish();
        }
    });
}
 
Example 15
@Override
public Object instantiateItem(ViewGroup container, int position) {
    PhotoView photoView = new PhotoView(container.getContext());
    photoView.setImageResource(sDrawables[position]);
    PhotoViewAttacher attacher = new PhotoViewAttacher(photoView);
    attacher.setRotatable(true);
    attacher.setToRightAngle(true);
    attacher.setOnRotateListener(new PhotoViewAttacher.OnRotateListener() {
        @Override
        public void onRotate(int degree) {
            //do something
        }
    });
    attacher.update();
    // Now just add PhotoView to ViewPager and return it
    container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

    return photoView;
}
 
Example 16
Source Project: KJFrameForAndroid   Source File: ImageActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void initWidget() {
    super.initWidget();
    kjb.display(mImg, url, new BitmapCallBack() {
        @Override
        public void onPreLoad() {
            super.onPreLoad();
            mProgressBar.setVisibility(View.VISIBLE);
        }

        @Override
        public void onFinish() {
            super.onFinish();
            mProgressBar.setVisibility(View.GONE);
        }
    });
    mImg.setOnFinishListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            ImageActivity.this.finish();
        }
    });
}
 
Example 17
Source Project: candybar   Source File: CandyBarWallpaperActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void onWallpaperLoaded() {
    mAttacher = new PhotoViewAttacher(mImageView);
    mAttacher.setScaleType(ImageView.ScaleType.CENTER_CROP);

    AnimationHelper.fade(mProgress).start();
    mRunnable = null;
    mHandler = null;
    mIsResumed = false;

    if (this.getResources().getBoolean(R.bool.show_intro)) {
        TapIntroHelper.showWallpaperPreviewIntro(this, mWallpaper.getColor());
    }
}
 
Example 18
Source Project: youqu_master   Source File: PhotosDetailActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void setPhotoViewClickEvent() {
    photoTouchIv.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float v, float v1) {
            hideOrShowToolbar();
            hideOrShowStatusBar();
        }
    });
}
 
Example 19
Source Project: fangzhuishushenqi   Source File: PDFPagerAdapter.java    License: Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 20
Source Project: o2oa   Source File: ImagePageAdapter.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public Object instantiateItem(ViewGroup container, int position) {
    PhotoView photoView = new PhotoView(mActivity);
    ImageItem imageItem = images.get(position);
    imagePicker.getImageLoader().displayImages(mActivity, imageItem.path, photoView, screenWidth, screenHeight);
    photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float x, float y) {
            if (listener != null) listener.OnPhotoTapListener(view, x, y);
        }
    });
    container.addView(photoView);
    return photoView;
}
 
Example 21
Source Project: AndroidDemo   Source File: ImageActivity.java    License: MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_image);
    ImageView imageView = (ImageView) findViewById(R.id.image);
    PhotoViewAttacher attacher = new PhotoViewAttacher(imageView);
}
 
Example 22
Source Project: boxing   Source File: BoxingRawImageFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mProgress = (ProgressBar) view.findViewById(R.id.loading);
    mImageView = (PhotoView) view.findViewById(R.id.photo_view);
    mAttacher = new PhotoViewAttacher(mImageView);
    mAttacher.setRotatable(true);
    mAttacher.setToRightAngle(true);
}
 
Example 23
Source Project: Camera-Roll-Android-App   Source File: GifViewHolder.java    License: Apache License 2.0 5 votes vote down vote up
public void setAttacher(ImageView imageView) {
    attacher = new PhotoViewAttacher(imageView);
    attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
        @Override
        public void onViewTap(View view, float x, float y) {
            imageOnClick(view);
        }
    });
}
 
Example 24
Source Project: STUer-client   Source File: PhotoActivity.java    License: MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_photo);
    ButterKnife.inject(this);
    final String picName = getIntent().getStringExtra("picName");
    RequestCreator requestCreator = Picasso.with(this)
            .load(IMAGE_HOST + picName + ".jpg");
    requestCreator.into(mImageView);
    requestCreator.fetch(new Callback() {
        @Override
        public void onSuccess() {
            // 一开始为wrap_content使其居中,成功加载后match_parent使其放缩效果更佳
            mImageView.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
        }

        @Override
        public void onError() {
            Toast.makeText(PhotoActivity.this, "加载图片失败", Toast.LENGTH_SHORT).show();
        }
    });


    mAttacher = new PhotoViewAttacher(mImageView);
    mAttacher.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            AlertDialog.Builder builder = new AlertDialog.Builder(PhotoActivity.this);
            builder.setItems(new String[]{"保存"}, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    savePhoto(picName);
                }
            });
            builder.create().show();
            return false;
        }
    });

}
 
Example 25
private void onWallpaperLoaded() {
    mAttacher = new PhotoViewAttacher(mImageView);
    mAttacher.setScaleType(ImageView.ScaleType.CENTER_CROP);

    AnimationHelper.fade(mProgress).start();
    mRunnable = null;
    mHandler = null;
    mIsResumed = false;

    TapIntroHelper.showWallpaperPreviewIntro(this, mWallpaper.getColor());
}
 
Example 26
Source Project: narrate-android   Source File: ViewPhotoActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_photo);

    Bundle extras = getIntent().getExtras();

    if ( extras == null ) {
        finish();
        return;
    }

    Photo photo = extras.getParcelable("photo");
    LogUtil.log(ViewPhotoActivity.class.getSimpleName(), "Photo Path: " + photo.path);

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize = 1;

    mImage = BitmapFactory.decodeFile(photo.path, options);

    if ( mImage.getWidth() > 4096 || mImage.getHeight() > 4096 ) {
        float ratio = (float) mImage.getHeight() / (float) mImage.getWidth();
        int width = mImage.getWidth();
        int height = 0;

        if ( width > 4096 ) {
            width = 4096;
            height = Math.round(width * ratio);
        } else {
            height = 4096;
            width = Math.round(height / ratio);
        }

        mImage = Bitmap.createScaledBitmap(mImage, width, height, false);
    }


    mImageView.setImageBitmap(mImage);
    mAttacher = new PhotoViewAttacher(mImageView);
}
 
Example 27
Source Project: talk-android   Source File: PhotoViewActivity.java    License: MIT License 5 votes vote down vote up
PhotoPagerAdapter(final PhotoViewActivity aty, List<Message> messages) {
    this.messages.addAll(messages);
    tapListener = new PhotoViewAttacher.OnPhotoTapListener() {
        @Override
        public void onPhotoTap(View view, float v, float v2) {
            aty.finish();
        }
    };
}
 
Example 28
Source Project: monolog-android   Source File: PhotoViewActivity.java    License: MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        mUrl = savedInstanceState.getString("url");
    } else {
        mUrl = getIntent().getStringExtra("url");
    }
    //toolbar
    setContentView(R.layout.activity_photo_view);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
   // toolbar.setTitle("图片浏览");
    setSupportActionBar(toolbar);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(true);

    // Any implementation of ImageView can be used!
    mImageView = (ImageView) findViewById(R.id.iv_photo);

    // Set the Drawable displayed
    AppContext.getInstance().loadImg(mImageView, mUrl);

    // Attach a PhotoViewAttacher, which takes care of all of the zooming functionality.
    mAttacher = new PhotoViewAttacher(mImageView);
}
 
Example 29
Source Project: MoeQuest   Source File: MeiziDetailsFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean onResourceReady(GlideDrawable resource, String model,
                               Target<GlideDrawable> target, boolean
                                   isFromMemoryCache, boolean isFirstResource) {

  mImageView.setImageDrawable(resource);
  mPhotoViewAttacher = new PhotoViewAttacher(mImageView);
  mImageError.setVisibility(View.GONE);
  setPhotoViewAttacher();
  return false;
}
 
Example 30
Source Project: BigApp_Discuz_Android   Source File: GifView.java    License: Apache License 2.0 5 votes vote down vote up
public GifView(Context context, AttributeSet attr, int defStyle) {
    super(context, attr, defStyle);
    super.setScaleType(ImageView.ScaleType.MATRIX);
    mAttacher = new PhotoViewAttacher(this);

    if (null != mPendingScaleType) {
        setScaleType(mPendingScaleType);
        mPendingScaleType = null;
    }
}