Java Code Examples for it.sephiroth.android.library.imagezoom.ImageViewTouchBase

The following examples show how to use it.sephiroth.android.library.imagezoom.ImageViewTouchBase. 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: Matisse   Source File: PreviewItemFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final Item item = getArguments().getParcelable(ARGS_ITEM);
    if (item == null) {
        return;
    }

    View videoPlayButton = view.findViewById(R.id.video_play_button);
    if (item.isVideo()) {
        videoPlayButton.setVisibility(View.VISIBLE);
        videoPlayButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setDataAndType(item.uri, "video/*");
                try {
                    startActivity(intent);
                } catch (ActivityNotFoundException e) {
                    Toast.makeText(getContext(), R.string.error_no_video_activity, Toast.LENGTH_SHORT).show();
                }
            }
        });
    } else {
        videoPlayButton.setVisibility(View.GONE);
    }

    ImageViewTouch image = (ImageViewTouch) view.findViewById(R.id.image_view);
    image.setDisplayType(ImageViewTouchBase.DisplayType.FIT_TO_SCREEN);

    Point size = PhotoMetadataUtils.getBitmapSize(item.getContentUri(), getActivity());
    if (item.isGif()) {
        SelectionSpec.getInstance().imageEngine.loadGifImage(getContext(), size.x, size.y, image,
                item.getContentUri());
    } else {
        SelectionSpec.getInstance().imageEngine.loadImage(getContext(), size.x, size.y, image,
                item.getContentUri());
    }
}
 
Example 2
Source Project: oversec   Source File: ImageDecryptActivity.java    License: GNU General Public License v3.0 4 votes vote down vote up
private void zoomIn() {
    mVgMain.setVisibility(View.GONE);
    mIvFull.setVisibility(View.VISIBLE);
    mIvFull.setImageBitmap(mBitmapRef, null, 0.1f, 100f);
    mIvFull.setDisplayType(ImageViewTouchBase.DisplayType.FIT_TO_SCREEN);
}
 
Example 3
Source Project: AlbumCameraRecorder   Source File: PreviewItemFragment.java    License: MIT License 4 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final MultiMedia item = getArguments().getParcelable(ARGS_ITEM);
    if (item == null) {
        return;
    }

    View videoPlayButton = view.findViewById(R.id.video_play_button);
    if (item.isVideo()) {
        videoPlayButton.setVisibility(View.VISIBLE);
        videoPlayButton.setOnClickListener(v -> {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            Uri uri = null;
            if (item.getMediaUri() != null) {
                uri = item.getMediaUri();
            }else if(item.getUri() != null) {
                item.setMediaUri(FileUtil.getFileUri(getContext(),item.getType(),new File(item.getPath())));
                uri = item.getMediaUri();
            }
            intent.setDataAndType(uri, "video/*");
            try {
                startActivity(intent);
            } catch (ActivityNotFoundException e) {
                Toast.makeText(getContext(), R.string.error_no_video_activity, Toast.LENGTH_SHORT).show();
            }
        });
    } else {
        videoPlayButton.setVisibility(View.GONE);
    }

    ImageViewTouch image = view.findViewById(R.id.image_view);
    image.setDisplayType(ImageViewTouchBase.DisplayType.FIT_TO_SCREEN);

    if (item.getMediaUri() != null) {
        Point size = PhotoMetadataUtils.getBitmapSize(item.getMediaUri(), getActivity());
        if (item.isGif()) {
            GlobalSpec.getInstance().imageEngine.loadGifImage(getContext(), size.x, size.y, image,
                    item.getMediaUri());
        } else {
            GlobalSpec.getInstance().imageEngine.loadImage(getContext(), size.x, size.y, image,
                    item.getMediaUri());

        }
    } else if (item.getUri() != null) {
        GlobalSpec.getInstance().imageEngine.loadUriImage(getContext(), image,
                item.getUri());
    } else if (item.getUrl() != null) {
        GlobalSpec.getInstance().imageEngine.loadUrlImage(getContext(), image,
                item.getUrl());
    } else if (item.getDrawableId() != -1) {
        GlobalSpec.getInstance().imageEngine.loadDrawableImage(getContext(), image,
                item.getDrawableId());
    }


}
 
Example 4
Source Project: Matisse   Source File: PreviewItemFragment.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final Item item = getArguments().getParcelable(ARGS_ITEM);
    if (item == null) {
        return;
    }

    View videoPlayButton = view.findViewById(R.id.video_play_button);
    if (item.isVideo()) {
        videoPlayButton.setVisibility(View.VISIBLE);
        videoPlayButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setDataAndType(item.uri, "video/*");
                try {
                    startActivity(intent);
                } catch (ActivityNotFoundException e) {
                    Toast.makeText(getContext(), R.string.error_no_video_activity, Toast.LENGTH_SHORT).show();
                }
            }
        });
    } else {
        videoPlayButton.setVisibility(View.GONE);
    }

    ImageViewTouch image = (ImageViewTouch) view.findViewById(R.id.image_view);
    image.setDisplayType(ImageViewTouchBase.DisplayType.FIT_TO_SCREEN);

    image.setSingleTapListener(new ImageViewTouch.OnImageViewTouchSingleTapListener() {
        @Override
        public void onSingleTapConfirmed() {
            if (mListener != null) {
                mListener.onClick();
            }
        }
    });

    Point size = PhotoMetadataUtils.getBitmapSize(item.getContentUri(), getActivity());
    if (item.isGif()) {
        SelectionSpec.getInstance().imageEngine.loadGifImage(getContext(), size.x, size.y, image,
                item.getContentUri());
    } else {
        SelectionSpec.getInstance().imageEngine.loadImage(getContext(), size.x, size.y, image,
                item.getContentUri());
    }
}