use of uk.co.senab.photoview.PhotoViewAttacher in project Meizhi by drakeet.
the class PictureActivity method setupPhotoAttacher.
private void setupPhotoAttacher() {
mPhotoViewAttacher = new PhotoViewAttacher(mImageView);
mPhotoViewAttacher.setOnViewTapListener((view, v, v1) -> hideOrShowToolbar());
// @formatter:off
mPhotoViewAttacher.setOnLongClickListener(v -> {
new AlertDialog.Builder(PictureActivity.this).setMessage(getString(R.string.ask_saving_picture)).setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss()).setPositiveButton(android.R.string.ok, (dialog, which) -> {
saveImageToGallery();
dialog.dismiss();
}).show();
return true;
});
}
use of uk.co.senab.photoview.PhotoViewAttacher in project 9GAG by Mixiaoxiao.
the class MxxScaleImageView method initAttacher.
public void initAttacher() {
mPhotoViewAttacher = new PhotoViewAttacher(this);
mPhotoViewAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View arg0, float arg1, float arg2) {
// ((View)getParent()).setBackgroundColor(Color.argb(0, 0, 0, 0));
if (imageViewListener != null)
imageViewListener.onSingleTap();
}
});
mPhotoViewAttacher.setScaleType(ScaleType.FIT_CENTER);
mPhotoViewAttacher.update();
}
use of uk.co.senab.photoview.PhotoViewAttacher in project Talon-for-Twitter by klinker24.
the class PhotoFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
activity = getActivity();
Bundle args = getArguments();
url = args.getString("url");
final View root = inflater.inflate(R.layout.photo_dialog_layout, container, false);
picture = (NetworkedCacheableImageView) root.findViewById(R.id.picture);
PhotoViewAttacher mAttacher = new PhotoViewAttacher(picture);
picture.loadImage(url, false, new NetworkedCacheableImageView.OnImageLoadedListener() {
@Override
public void onImageLoaded(CacheableBitmapDrawable result) {
LinearLayout spinner = (LinearLayout) root.findViewById(R.id.list_progress);
spinner.setVisibility(View.GONE);
}
}, 0, // no transform
true);
mAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View view, float x, float y) {
try {
activity.finish();
} catch (Exception e) {
// activity is null
}
}
});
return root;
}
use of uk.co.senab.photoview.PhotoViewAttacher in project Talon-for-Twitter by klinker24.
the class PhotoViewerActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = this;
try {
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
} catch (Exception e) {
Log.e(LOGGER_TAG, "", e);
}
if (Build.VERSION.SDK_INT > 18) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
url = getIntent().getStringExtra("url");
if (url == null) {
finish();
return;
}
// get higher quality imgur pictures
if (url.contains("imgur")) {
url = url.replace("t.jpg", ".jpg");
}
if (url.contains("insta")) {
url = url.substring(0, url.length() - 1) + "l";
}
boolean fromCache = getIntent().getBooleanExtra("from_cache", true);
boolean doRestart = getIntent().getBooleanExtra("restart", true);
final boolean fromLauncher = getIntent().getBooleanExtra("from_launcher", false);
AppSettings settings = new AppSettings(context);
if (Build.VERSION.SDK_INT > 18 && settings.uiExtras) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
setContentView(R.layout.photo_dialog_layout);
if (!doRestart || getIntent().getBooleanExtra("config_changed", false)) {
LinearLayout spinner = (LinearLayout) findViewById(R.id.list_progress);
spinner.setVisibility(View.GONE);
}
picture = (NetworkedCacheableImageView) findViewById(R.id.picture);
PhotoViewAttacher mAttacher = new PhotoViewAttacher(picture);
picture.loadImage(url, false, new NetworkedCacheableImageView.OnImageLoadedListener() {
@Override
public void onImageLoaded(CacheableBitmapDrawable result) {
LinearLayout spinner = (LinearLayout) findViewById(R.id.list_progress);
spinner.setVisibility(View.GONE);
}
}, 0, // no transform
fromCache);
mAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() {
@Override
public void onViewTap(View view, float x, float y) {
((Activity) context).finish();
}
});
ActionBar ab = getActionBar();
if (ab != null) {
ColorDrawable transparent = new ColorDrawable(getResources().getColor(android.R.color.transparent));
ab.setBackgroundDrawable(transparent);
ab.setDisplayHomeAsUpEnabled(false);
ab.setDisplayShowHomeEnabled(false);
ab.setTitle("");
ab.setIcon(transparent);
}
}
use of uk.co.senab.photoview.PhotoViewAttacher in project 9GAG by stormzhang.
the class ImageViewActivity method onCreate.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_imageview);
ButterKnife.inject(this);
setTitle(R.string.view_big_image);
mAttacher = new PhotoViewAttacher(photoView);
mAttacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
finish();
}
});
String imageUrl = getIntent().getStringExtra(IMAGE_URL);
DisplayImageOptions options = new DisplayImageOptions.Builder().cacheOnDisc(true).considerExifParams(true).build();
ImageLoader.getInstance().displayImage(imageUrl, photoView, options, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
progressWheel.setVisibility(View.GONE);
mAttacher.update();
}
}, new ImageLoadingProgressListener() {
@Override
public void onProgressUpdate(String imageUri, View view, int current, int total) {
progressWheel.setProgress(360 * current / total);
}
});
}
Aggregations