use of uk.co.senab.photoview.PhotoViewAttacher in project glimmr by brk3.
the class PhotoViewerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (BuildConfig.DEBUG)
Log.d(getLogTag(), "onCreateView");
mLayout = (RelativeLayout) inflater.inflate(R.layout.photoviewer_fragment, container, false);
mVideoButton = (ImageView) mLayout.findViewById(R.id.play_video_overlay);
mImageView = (ImageView) mLayout.findViewById(R.id.image);
mAttacher = new PhotoViewAttacher(mImageView);
mTextViewTitle = (TextView) mLayout.findViewById(R.id.textViewTitle);
mTextViewAuthor = (TextView) mLayout.findViewById(R.id.textViewAuthor);
mProgress = (ProgressBar) mLayout.findViewById(R.id.progress);
mAttacher.setOnPhotoTapListener(new OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
BusProvider.getInstance().post(new PhotoViewerVisibilityChangeEvent(!mActionBar.isShowing(), PhotoViewerFragment.this));
}
});
/* If this fragment is new as part of a set, update it's overlay
* visibility based on the state of the actionbar */
setOverlayVisibility(mActionBar.isShowing());
displayImage();
return mLayout;
}
use of uk.co.senab.photoview.PhotoViewAttacher in project LookLook by xinghongfei.
the class MeiziPhotoDescribeActivity method getData.
private void getData() {
Glide.with(this).load(mImageUrl).centerCrop().listener(loadListener).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(mShot);
mPhotoViewAttacher = new PhotoViewAttacher(mShot);
mToolbar.setNavigationIcon(R.drawable.ic_arrow_back);
mToolbar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
expandImageAndFinish();
}
});
}
use of uk.co.senab.photoview.PhotoViewAttacher in project Hummingbird-for-Android by xiprox.
the class FullscreenImageActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
int black = Color.parseColor("#000000");
getWindow().setBackgroundDrawable(new ColorDrawable(black));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
Transition sharedElem = TransitionInflater.from(this).inflateTransition(R.transition.move_transition);
getWindow().setSharedElementEnterTransition(sharedElem);
getWindow().setSharedElementExitTransition(sharedElem);
getWindow().setStatusBarColor(black);
}
super.onCreate(savedInstanceState);
ImageView mImageView = new ImageView(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
mImageView.setTransitionName(TRANSITION_NAME_IMAGE);
setContentView(mImageView);
Bundle bundle = getIntent().getExtras();
if (bundle != null && bundle.getString(ARG_IMAGE_URL) != null)
mImageUrl = bundle.getString(ARG_IMAGE_URL);
if (mImageUrl != null) {
Picasso.with(this).load(mImageUrl).into(mImageView);
} else {
Toast.makeText(this, R.string.error_cant_load_image, Toast.LENGTH_SHORT).show();
finish();
}
new PhotoViewAttacher(mImageView);
}
use of uk.co.senab.photoview.PhotoViewAttacher in project BookReader by JustWayward.
the class PDFPagerAdapter method instantiateItem.
@Override
@SuppressWarnings("NewApi")
public Object instantiateItem(ViewGroup container, int position) {
View v = inflater.inflate(R.layout.view_pdf_page, container, false);
ImageView iv = (ImageView) v.findViewById(R.id.imageView);
if (renderer == null || getCount() < position) {
return v;
}
PdfRenderer.Page page = getPDFPage(renderer, position);
Bitmap bitmap = bitmapContainer.get(position);
page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
page.close();
PhotoViewAttacher attacher = new PhotoViewAttacher(iv);
attacher.setScale(scale.getScale(), scale.getCenterX(), scale.getCenterY(), true);
attacher.setOnMatrixChangeListener(this);
attachers.put(position, new WeakReference<PhotoViewAttacher>(attacher));
iv.setImageBitmap(bitmap);
attacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
if (pageClickListener != null) {
pageClickListener.onPageTap(view, x, y);
}
}
});
attacher.update();
container.addView(v, 0);
return v;
}
use of uk.co.senab.photoview.PhotoViewAttacher in project bdcodehelper by boredream.
the class ImageBrowserAdapter method instantiateItem.
@Override
public View instantiateItem(final ViewGroup container, int position) {
final View rootView = View.inflate(context, R.layout.item_image_browser, null);
int index = position % picUrls.size();
final ProgressBar pb_loading = (ProgressBar) rootView.findViewById(R.id.pb_loading);
final ImageView iv_image_browser = (ImageView) rootView.findViewById(R.id.iv_image_browser);
final PhotoViewAttacher pva = new PhotoViewAttacher(iv_image_browser);
String url = picUrls.get(index).getImageUrl();
Glide.with(context).load(url).diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop().crossFade().into(new SimpleTarget<GlideDrawable>() {
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
pb_loading.setVisibility(View.GONE);
iv_image_browser.setVisibility(View.VISIBLE);
}
@Override
public void onLoadStarted(Drawable placeholder) {
super.onLoadStarted(placeholder);
pb_loading.setVisibility(View.VISIBLE);
iv_image_browser.setVisibility(View.GONE);
}
@Override
public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
pb_loading.setVisibility(View.GONE);
iv_image_browser.setVisibility(View.VISIBLE);
iv_image_browser.setImageDrawable(resource);
pva.update();
}
});
pva.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
context.onBackPressed();
}
});
container.addView(rootView);
return rootView;
}
Aggregations