Java Code Examples for uk.co.senab.photoview.PhotoViewAttacher#setRotatable()

The following examples show how to use uk.co.senab.photoview.PhotoViewAttacher#setRotatable() . 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 File: ViewPagerPhotoViewFragment.java    From RotatePhotoView with Apache License 2.0 6 votes vote down vote up
@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 2
Source File: BoxingRawImageFragment.java    From boxing with 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 3
Source File: SinglePhotoViewFragment.java    From RotatePhotoView with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    mPhotoView = (PhotoView) view.findViewById(R.id.photoview);
    mAttacher = new PhotoViewAttacher(mPhotoView);
    mAttacher.setRotatable(true);
    mAttacher.setToRightAngle(true);
    mPhotoView.setOnRotateListener(new PhotoViewAttacher.OnRotateListener() {
        @Override
        public void onRotate(int degree) {
            //do something
        }
    });
}