use of com.davemorrissey.labs.subscaleview.decoder.ImageRegionDecoder in project subsampling-scale-image-view by davemorrissey.
the class ImageDisplayRegionFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(layout.imagedisplay_region_fragment, container, false);
final SubsamplingScaleImageView imageView = rootView.findViewById(id.imageView);
imageView.setBitmapDecoderFactory(new CompatDecoderFactory<ImageDecoder>(SkiaImageDecoder.class, Bitmap.Config.ARGB_8888));
imageView.setRegionDecoderFactory(new CompatDecoderFactory<ImageRegionDecoder>(SkiaImageRegionDecoder.class, Bitmap.Config.ARGB_8888));
imageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_90);
imageView.setImage(ImageSource.asset("card.png").region(new Rect(5200, 651, 8200, 3250)));
final ImageDisplayActivity activity = (ImageDisplayActivity) getActivity();
if (activity != null) {
rootView.findViewById(id.previous).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
activity.previous();
}
});
}
rootView.findViewById(id.rotate).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
imageView.setOrientation((imageView.getOrientation() + 90) % 360);
}
});
return rootView;
}
Aggregations