use of com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView in project Slide by ccrama.
the class Image method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.submission_imagecard, container, false);
final SubsamplingScaleImageView image = (SubsamplingScaleImageView) rootView.findViewById(R.id.image);
TextView title = (TextView) rootView.findViewById(R.id.title);
TextView desc = (TextView) rootView.findViewById(R.id.desc);
title.setVisibility(View.GONE);
desc.setVisibility(View.GONE);
((Reddit) getContext().getApplicationContext()).getImageLoader().loadImage(url, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
image.setImage(ImageSource.bitmap(loadedImage));
}
});
return rootView;
}
use of com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView in project Camera-Roll-Android-App by kollerlukas.
the class SetWallpaperActivity method setWallpaper.
private void setWallpaper(int which) {
try {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
InputStream inputStream = getContentResolver().openInputStream(imageUri);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Rect croppedRect = getCroppedRect();
switch(which) {
case HOME_SCREEN:
wallpaperManager.setStream(inputStream, croppedRect, true, WallpaperManager.FLAG_SYSTEM);
break;
case LOCK_SCREEN:
wallpaperManager.setStream(inputStream, croppedRect, true, WallpaperManager.FLAG_LOCK);
break;
case BOTH:
wallpaperManager.setStream(inputStream, croppedRect, true);
break;
}
} else {
wallpaperManager.setStream(inputStream);
}
SubsamplingScaleImageView imageView = findViewById(R.id.imageView);
imageView.recycle();
this.finish();
} catch (IOException | IllegalArgumentException e) {
e.printStackTrace();
Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show();
}
}
use of com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView in project Camera-Roll-Android-App by kollerlukas.
the class SetWallpaperActivity method getCroppedRect.
private Rect getCroppedRect() {
SubsamplingScaleImageView imageView = findViewById(R.id.imageView);
PointF center = imageView.getCenter();
if (center != null) {
int left = (int) (center.x - imageView.getWidth() / 2);
return new Rect(left, 0, imageView.getSWidth(), imageView.getSHeight());
}
return new Rect(0, 0, imageView.getSWidth(), imageView.getSHeight());
}
use of com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView in project Camera-Roll-Android-App by kollerlukas.
the class PhotoViewHolder method bindImageView.
void bindImageView(View view, final View transitionView) {
if (albumItem.error) {
transitionView.setVisibility(View.VISIBLE);
ItemViewUtil.bindTransitionView((ImageView) transitionView, albumItem);
return;
}
if (imageViewWasBound) {
return;
}
final SubsamplingScaleImageView imageView = (SubsamplingScaleImageView) view;
// use custom decoders
imageView.setBitmapDecoderClass(getImageDecoderClass());
imageView.setRegionDecoderClass(getBitmapRegionDecoderClass());
imageView.setMinimumTileDpi(196);
imageView.setMinimumDpi(80);
// imageView.setDoubleTapZoomDpi(196);
imageView.setDoubleTapZoomScale(1.0f);
// imageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_USE_EXIF);
int orientation = ExifUtil.getExifOrientationAngle(view.getContext(), albumItem);
imageView.setOrientation(orientation);
final GestureDetector gestureDetector = new GestureDetector(imageView.getContext(), new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapUp(MotionEvent e) {
PhotoViewHolder.super.imageOnClick(imageView);
return super.onSingleTapUp(e);
}
});
view.setOnTouchListener(new View.OnTouchListener() {
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
return gestureDetector.onTouchEvent(motionEvent);
}
});
ItemViewUtil.bindSubsamplingImageView(imageView, (Photo) albumItem, new SubsamplingScaleImageView.DefaultOnImageEventListener() {
@Override
public void onImageLoaded() {
super.onImageLoaded();
transitionView.setVisibility(View.INVISIBLE);
imageViewWasBound = true;
PhotoViewHolder.this.onImageLoaded();
}
});
}
use of com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView in project Camera-Roll-Android-App by kollerlukas.
the class PhotoViewHolder method onDestroy.
@Override
public void onDestroy() {
final SubsamplingScaleImageView imageView = itemView.findViewById(R.id.subsampling);
if (imageView != null) {
imageView.recycle();
}
super.onDestroy();
}
Aggregations