Search in sources :

Example 1 with Rotate

use of com.transitionseverywhere.Rotate in project Transitions-Everywhere by andkulikov.

the class RotateSample method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_rotate, container, false);
    final ViewGroup transitionsContainer = (ViewGroup) view.findViewById(R.id.transitions_container);
    final View icon = transitionsContainer.findViewById(R.id.icon);
    icon.setOnClickListener(new View.OnClickListener() {

        boolean mRotated;

        @Override
        public void onClick(View v) {
            TransitionManager.beginDelayedTransition(transitionsContainer, new Rotate());
            mRotated = !mRotated;
            icon.setRotation(mRotated ? 135 : 0);
        }
    });
    return view;
}
Also used : Rotate(com.transitionseverywhere.Rotate) ViewGroup(android.view.ViewGroup) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 2 with Rotate

use of com.transitionseverywhere.Rotate in project Remindy by abicelis.

the class EditImageAttachmentActivity method onClick.

@Override
public void onClick(View v) {
    int id = v.getId();
    switch(id) {
        case R.id.activity_edit_image_attachment_crop:
            applyPendingRotation();
            File imageFile = new File(FileUtil.getImageAttachmentDir(this), mImageAttachment.getImageFilename());
            Uri imageUri = FileProvider.getUriForFile(this, "ve.com.abicelis.remindy.fileprovider", imageFile);
            CropImage.activity(imageUri).setAllowFlipping(false).setAllowRotation(false).start(this);
            break;
        case R.id.activity_edit_image_attachment_rotate:
            mRotation += 90;
            TransitionManager.beginDelayedTransition(mContainer, new Rotate());
            mImage.setRotation(mRotation);
            break;
        case R.id.activity_edit_image_attachment_camera:
            handleShowCameraGalleryDialog();
            break;
        case R.id.activity_edit_image_attachment_ok:
            applyPendingRotation();
            updateImageAttachmentThumbnail();
            Intent returnData = new Intent();
            returnData.putExtra(HOLDER_POSITION_EXTRA, mHolderPosition);
            returnData.putExtra(IMAGE_ATTACHMENT_EXTRA, mImageAttachment);
            setResult(RESULT_OK, returnData);
            finish();
            break;
        case R.id.activity_edit_image_attachment_cancel:
            if (mEditingExistingImageAttachment)
                restoreImageFromBackup();
            setResult(RESULT_CANCELED);
            finish();
            break;
    }
}
Also used : Rotate(com.transitionseverywhere.Rotate) Intent(android.content.Intent) File(java.io.File) Uri(android.net.Uri)

Aggregations

Rotate (com.transitionseverywhere.Rotate)2 Intent (android.content.Intent)1 Uri (android.net.Uri)1 Nullable (android.support.annotation.Nullable)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 File (java.io.File)1