Esempio n. 1
0
        public void Cleanup()
        {
            if (null == mImageView)
            {
                return;                 // cleanup already done
            }
            ImageView imageView = (ImageView)(((Reference)mImageView).Get());

            if (null != imageView)
            {
                // Remove this as a global layout listener
                ViewTreeObserver observer = imageView.ViewTreeObserver;
                if (null != observer && observer.IsAlive)
                {
                    observer.RemoveGlobalOnLayoutListener(this);
                }

                // Remove the ImageView's reference to this
                imageView.SetOnTouchListener(null);

                // make sure a pending fling runnable won't be run
                CancelFling();
            }
            if (null != mGestureDetector)
            {
                mGestureDetector.SetOnDoubleTapListener(null);
            }
            // Clear listeners too
            mMatrixChangeListener = null;
            mPhotoTapListener     = null;
            mViewTapListener      = null;

            // Finally, clear ImageView
            mImageView = null;
        }
Esempio n. 2
0
        public PhotoViewDroidAttacher(ImageView imageView)
        {
            mImageView = new Java.Lang.Ref.WeakReference(imageView);
            imageView.DrawingCacheEnabled = true;
            imageView.SetOnTouchListener(this);
            ViewTreeObserver observer = imageView.ViewTreeObserver;

            if (null != observer)
            {
                observer.AddOnGlobalLayoutListener(this);
            }

            // Make sure we using MATRIX Scale Type
            SetImageViewScaleTypeMatrix(imageView);

            if (imageView.IsInEditMode)
            {
                return;
            }

            // Create Gesture Detectors...
            mScaleDragDetector = VersionedGestureDetector.NewInstance(
                imageView.Context, this);
            mGestureDetector = new GestureDetector(imageView.Context, new MSimpleOnGestureListener(this));


            mGestureDetector.SetOnDoubleTapListener(new DefaultOnDoubleTapListener(this));

            SetZoomable(true);
        }
        public PhotoViewDroidAttacher(ImageView imageView)
        {
            mImageView = new Java.Lang.Ref.WeakReference(imageView);
            imageView.DrawingCacheEnabled = true;
            imageView.SetOnTouchListener (this);
            ViewTreeObserver observer = imageView.ViewTreeObserver;
            if (null != observer)
                observer.AddOnGlobalLayoutListener(this);

            // Make sure we using MATRIX Scale Type
            SetImageViewScaleTypeMatrix (imageView);

            if (imageView.IsInEditMode) {
                return;
            }

            // Create Gesture Detectors...
            mScaleDragDetector = VersionedGestureDetector.NewInstance(
                imageView.Context, this);
            mGestureDetector = new GestureDetector (imageView.Context, new MSimpleOnGestureListener (this));

            mGestureDetector.SetOnDoubleTapListener (new DefaultOnDoubleTapListener (this));

            SetZoomable (true);
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="WF.Player.AsyncImageTask"/> class.
		/// </summary>
		/// <param name="imageView">Image view to show the loaded bitmap.</param>
		/// <param name="pSampleSize">Sample size.</param>
		/// <param name="pReqWidth">Requested width.</param>
		/// <param name="pReqHeight">Requested height.</param>
		public AsyncImageTask(ImageView imageView, int pSampleSize, int pReqWidth, int pReqHeight)
		{
			// Use a WeakReference to ensure the ImageView can be garbage collected
			_imageViewReference = new Java.Lang.Ref.WeakReference(imageView);

			_reqHeight = pReqHeight;
			_reqWidth = pReqWidth;
			_sampleSize = pSampleSize;
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="WF.Player.AsyncImageTask"/> class.
        /// </summary>
        /// <param name="imageView">Image view to show the loaded bitmap.</param>
        /// <param name="pSampleSize">Sample size.</param>
        /// <param name="pReqWidth">Requested width.</param>
        /// <param name="pReqHeight">Requested height.</param>
        public AsyncImageTask(ImageView imageView, int pSampleSize, int pReqWidth, int pReqHeight)
        {
            // Use a WeakReference to ensure the ImageView can be garbage collected
            _imageViewReference = new Java.Lang.Ref.WeakReference(imageView);

            _reqHeight  = pReqHeight;
            _reqWidth   = pReqWidth;
            _sampleSize = pSampleSize;
        }
        public void Cleanup()
        {
            if (null == mImageView) {
                return; // cleanup already done
            }
            ImageView imageView = (ImageView)(((Reference)mImageView).Get());

            if (null != imageView) {
                // Remove this as a global layout listener
                ViewTreeObserver observer = imageView.ViewTreeObserver;
                if (null != observer && observer.IsAlive) {
                    observer.RemoveGlobalOnLayoutListener(this);
                }

                // Remove the ImageView's reference to this
                imageView.SetOnTouchListener(null);

                // make sure a pending fling runnable won't be run
                CancelFling();
            }
            if (null != mGestureDetector) {
                mGestureDetector.SetOnDoubleTapListener(null);
            }
            // Clear listeners too
            mMatrixChangeListener = null;
            mPhotoTapListener = null;
            mViewTapListener = null;

            // Finally, clear ImageView
            mImageView = null;
        }