Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Detect when User starts to zoom

More
IP: 192.168.0.71 11 years 6 months ago #7205 by custompdf
Is there any callback we can use to detect when the user starts to zoom a pdf?
More
IP: 192.168.0.71 11 years 6 months ago #7208 by radaee
no callback for this, but you can add codes in PDFView.motionNormal()
switch case ACTION_POINTER_DOWN, for ZoomStart.
and add codes in PDFView.motionZoom() switch case ACTION_UP for ZoomEnd

this need source codes of PDFView class, which professional or premium license can get this file.
More
IP: 192.168.0.71 11 years 5 months ago #7324 by custompdf
Found a solution myself, maybe someone else could need it:

I created a SimpleOnScaleGestureListener:
Code:
public class PDFSimpleOnScaleGestureListener extends SimpleOnScaleGestureListener { @Override public boolean onScale(ScaleGestureDetector detector) { return true; } @Override public boolean onScaleBegin(ScaleGestureDetector detector) { mActivityViewScaleCallback.onPDFViewScaleCallback(); return false; } @Override public void onScaleEnd(ScaleGestureDetector detector) { } } //With an Interface for callback: /** * Callback for PDFViewerActivity */ public interface OnPDFViewScaleCallback { /** * Callback when user starts to zoom pdf view */ public void onPDFViewScaleCallback(); } //i use pdfview in a fragment so my activty implements the interface and to set the callback @Override public void onAttach(Activity activity) { super.onAttach(activity); mActivityViewScaleCallback = (OnPDFViewScaleCallback) activity; scaleGestureDetector = new ScaleGestureDetector(activity, new PDFSimpleOnScaleGestureListener()); } //and then i set the scaleGestureDetector to readercontroller (when view is drawn) mPdfView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { scaleGestureDetector.onTouchEvent(event); return false; } }); } //and in my activity I implement the interface and every time the user starts to scale the callback method is called @Override public void onPDFViewScaleCallback() { //TODO -> Your stuff }
Time to create page: 0.620 seconds
Powered by Kunena Forum