Giter VIP home page Giter VIP logo

photoview's Introduction

PhotoView

PhotoView aims to help produce an easily usable implementation of a zooming Android ImageView.

[

Dependency

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
    repositories {
        maven { url "https://www.jitpack.io" }
    }
}

buildscript {
    repositories {
        maven { url "https://www.jitpack.io" }
    }	
}

Then, add the library to your module build.gradle

dependencies {
    implementation 'com.github.chrisbanes:PhotoView:latest.release.here'
}

Features

  • Out of the box zooming, using multi-touch and double-tap.
  • Scrolling, with smooth scrolling fling.
  • Works perfectly when used in a scrolling parent (such as ViewPager).
  • Allows the application to be notified when the displayed Matrix has changed. Useful for when you need to update your UI based on the current zoom/scroll position.
  • Allows the application to be notified when the user taps on the Photo.

Usage

There is a sample provided which shows how to use the library in a more advanced way, but for completeness, here is all that is required to get PhotoView working:

<com.github.chrisbanes.photoview.PhotoView
    android:id="@+id/photo_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
PhotoView photoView = (PhotoView) findViewById(R.id.photo_view);
photoView.setImageResource(R.drawable.image);

That's it!

Issues With ViewGroups

There are some ViewGroups (ones that utilize onInterceptTouchEvent) that throw exceptions when a PhotoView is placed within them, most notably ViewPager and DrawerLayout. This is a framework issue that has not been resolved. In order to prevent this exception (which typically occurs when you zoom out), take a look at HackyDrawerLayout and you can see the solution is to simply catch the exception. Any ViewGroup which uses onInterceptTouchEvent will also need to be extended and exceptions caught. Use the HackyDrawerLayout as a template of how to do so. The basic implementation is:

public class HackyProblematicViewGroup extends ProblematicViewGroup {

    public HackyProblematicViewGroup(Context context) {
        super(context);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        try {
            return super.onInterceptTouchEvent(ev);
        } catch (IllegalArgumentException e) {
						//uncomment if you really want to see these errors
            //e.printStackTrace();
            return false;
        }
    }
}

Usage with Fresco

Due to the complex nature of Fresco, this library does not currently support Fresco. See this project as an alternative solution.

Subsampling Support

This library aims to keep the zooming implementation simple. If you are looking for an implementation that supports subsampling, check out this project

License

Copyright 2018 Chris Banes

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

photoview's People

Contributors

andrew8er avatar atifniyaz avatar bhullnatik avatar christiankatzmann avatar dalinaum avatar ddihanov avatar hipercube avatar jawnnypoo avatar jwbadoo avatar laurencedawson avatar libtastic avatar martijn00 avatar matoso avatar mazzonem avatar mickamy avatar phantomch avatar phil-brown avatar raullg98 avatar rexee avatar saikorobot avatar simonrolin avatar smarek avatar tanglie1993 avatar terrakok avatar tonyjs avatar veyndan avatar xd720p avatar xeodou avatar yangshiliang avatar yanniks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

photoview's Issues

Distortion during fling on right and bottom edges on Gingerbread devices

There is a subtle flicker/distortion on many Gingerbread phones when the user scrolls right into the right or bottom edge and lifts their finger causing the fling animation.

This can be observed in the demo app. If you enable the logging in the run() method of FlingRunnable and watch the new x and y values returned by the Scroller you will see something like this when scrolling into the bottom edge:

06-24 09:12:04.589: D/PhotoViewAttacher(1260): fling run(). CurrentX:252 CurrentY:151 NewX:252 NewY:151
06-24 09:12:04.609: D/PhotoViewAttacher(1260): fling run(). CurrentX:252 CurrentY:151 NewX:251 NewY:151
06-24 09:12:05.319: D/PhotoViewAttacher(1260): fling run(). CurrentX:259 CurrentY:151 NewX:259 NewY:0
06-24 09:12:05.349: D/PhotoViewAttacher(1260): fling run(). CurrentX:259 CurrentY:0 NewX:261 NewY:151
06-24 09:12:05.369: D/PhotoViewAttacher(1260): fling run(). CurrentX:261 CurrentY:151 NewX:262 NewY:151
06-24 09:12:05.399: D/PhotoViewAttacher(1260): fling run(). CurrentX:262 CurrentY:151 NewX:263 NewY:151

See how those values jump to zero? There's a visible flicker when that happens. It has been observed on the following phones:
Samsung Galaxy Gio (2.3.3)
Samsung Galaxy Pocket (2.3.7)
HTC Nexus One (2.3.6)
Tecno N3 (2.3.5)

For some reason, though, it does not occur on the Galaxy S2 (2.3.4). I've tracked the problem down to the implementation of OverScroller in Gingerbread. It seems to return 0 for the edge (if any) it hits on the first call to computeScrollOffset(). It is not documented but there were major changes to the internal workings of OverScroller in ICS (probably first showed up in Honeycomb but I can't view the source so can't tell for sure). These changes seem to fix this problem.

I'll post a pull request soon with a workaround for this problem on Gingerbread.

PhotoView + Viewpager memory leak

When PhotoView is used inside ViewPager and page changes allocated memory isn't released even if System.gc() is called. This doesn't happen with standard ImageView.

ViewPager memory issues and dev branch sample not working

I was having the memory leak issues using a ViewPager, so I switched over to the dev branch to try out those changes. However, after trying for a while to get it to work, it never seemed to register to be able to zoom and tap the photo. So I decided to try the sample app from this repo (on the dev branch). That app wasn't working for me either.

Could someone else please verify that I'm not crazy or missing something?

In the meantime, I've gone back to the master branch and just implemented the cleanup function in the attacher myself for now.

Zoom to a Center Crop Fullscreen image size

Any hints in how to pull off a zoom to the Center crop size of the image on double tap so the smaller edge (either top/bottom or left/right) is shown fully and the other sides are cropped.

The idea is to have this when you double tap on the image for example rather than just doing the hardcoded scale level for the mid level.

Diagonal slide when zoomed-in isn't linear

When you slide the image diagonally, the end of the slide seems to make a small curve.
This works best with a slide at an angle between 0° and 45° (or similar).

Without having looked at the code, it seems that the vertical deceleration finishes before the horizontal one, so the slide ends in an horizontal taper.

HackyViewPager need to use it

In the POC of PhotoView there is a class HackyViewPager which extends Viewpager. I like to used this because I have bump bug http://code.google.com/p/android/issues/detail?id=18990. but the problem is I always get java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pindak.sarito/com.pindak.sarito.ui.ws.MagazineReaderActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class com.pindak.sarito.util.HackyViewPager.

this is my layout

<com.pindak.sarito.util.HackyViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/magazinepager"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

this is the some of the code of my onCreate in activity

HackyViewPager pager = (HackyViewPager) findViewById(R.id.magazinepager);
pager.setAdapter(new ImagePagerAdapter(SharedPrefsConfig.URL_MEDIA+"magazine/"+pk+"/page_"));

and In com.pindak.sarito.util I have HackyViewPager.java

package com.pindak.sarito.util;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.view.MotionEvent;

public class HackyViewPager extends ViewPager {

public HackyViewPager(Context context) {
    super(context);
}

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    try {
        return super.onInterceptTouchEvent(ev);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
        return false;
    }
}

}

Any Ideas Why I am gettting this error?

crash occured in sample app

Steps to reproduce:

  1. open pager sample.
  2. zomm out
  3. keep one finger on screen
  4. move
  5. ?!!!
  6. PROFIT

device: Desire HD, os - 4.1

Zoom Out is janky

When zooming in, using a focus point makes sense. But when using a user-supplied focus point for zoom out, the zoom ends up being chunky because it invariably hits a boundary.

I think using a carefully calculated focus point when zooming out would eliminate the jank.

Struck with activatin n'th image by default.

i wish to go to n'th image once the user activates the ViewPager activity. I am passing the image index via putExtra. How can i activate the specific photoview once the activity launches?

Move and zoom using gamepad

I would like to control the PhotoView using my Xbox gamepad. The zoomTo method does not work well because it is animated and once the picture is zoomed in I cannot move until I zoom out again.

Basically I want to use the left shoulder button to zoom (axis value 0.0 is totally zoomed out and axis value 1.0 is totally zoomed in) and the right analog stick to move. ( axis value x -1.0 and axis value y -1.0 is the upper left corner and axis value x 1.0 and axis value y 1.0 the bottom right)

Could please someone provide a method so I could just send these axis values to zoom and move in the picture?

Example of extraction of selected bitmap

It is not clear how to extract the 'selected' bitmap. We have attacher.getDisplayRect(), but its values are not defined well. Why are they floats? Why are they sometimes negative?

It seems like top and right are relative to the original image, scaled by attacher.getScale(). bottom and right are the scaled width and height of the selection.

Seems like with the current code, we need to do something like (and this is probably wrong):

RectF rect = attacher.getVisibleRect();
float scale = attacher.getScale();
Bitmap.createBitmap(source, -rect.left / scale, -rect.top / scale, rect.right / scale, rect.bottom / scale) 

Can we get a clear example? I'd also love for the library to either provide a Rect in source coordinates of what is visible, or to output a bitmap of the same.

Lastly, if all that is a bad idea, then perhaps you should just recommend a fix like this to extract the image: http://stackoverflow.com/a/4858154/719763

setDisplayRect()

I would like to request the addition of a setDisplayRect( .. ) to be able to save and restore the state of PhotoView

ArrayIndexOutOfBoundsException

PhotoView crashes when zoom fast using two fingers in ViewPage Sample.How to fix it?

03-05 20:36:46.019: E/AndroidRuntime(27763): java.lang.ArrayIndexOutOfBoundsException
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.view.MotionEvent.getX(MotionEvent.java:889)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.support.v4.view.MotionEventCompatEclair.getX(MotionEventCompatEclair.java:32)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getX(MotionEventCompat.java:91)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.support.v4.view.MotionEventCompat.getX(MotionEventCompat.java:219)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1768)
03-05 20:36:46.019: E/AndroidRuntime(27763): at uk.co.senab.photoview.sample.HackyViewPager.onInterceptTouchEvent(HackyViewPager.java:29)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:914)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:948)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:948)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:948)
03-05 20:36:46.019: E/AndroidRuntime(27763): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1796)
03-05 20:36:46.019: E/AndroidRuntime(27763): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1132)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.app.Activity.dispatchTouchEvent(Activity.java:2120)
03-05 20:36:46.019: E/AndroidRuntime(27763): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1780)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2210)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.view.ViewRoot.handleMessage(ViewRoot.java:1894)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.os.Handler.dispatchMessage(Handler.java:99)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.os.Looper.loop(Looper.java:130)
03-05 20:36:46.019: E/AndroidRuntime(27763): at android.app.ActivityThread.main(ActivityThread.java:3703)
03-05 20:36:46.019: E/AndroidRuntime(27763): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 20:36:46.019: E/AndroidRuntime(27763): at java.lang.reflect.Method.invoke(Method.java:507)
03-05 20:36:46.019: E/AndroidRuntime(27763): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
03-05 20:36:46.019: E/AndroidRuntime(27763): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
03-05 20:36:46.019: E/AndroidRuntime(27763): at dalvik.system.NativeStart.main(Native Method)

How to scroll to a given coordinate in image

When the image is zoomed, I want PhotoViewer to scroll to a given coordinate (x,y) of the image if that coordinate is not visible.

Is there a method in the library to achieve this?

I tried to use zoomTo() function but it didn't work or I didn't use it with proper parameters.

more sample

You have written a couple of features but not give us how to use them. Sample app does nothing for example.

Set min and max zoom/scale level

First: great library!

Is there a possibility to set the min and max zoom level? Currently it reverts to a min zoom level defined by the views bounds.

copy imageview status

how copy this imageview status to another that meams this imageview size and other

Screen flicker on Android 2.3

Nice component! One issue I have noticed is when flinging horizontally (especially if the image does not fill the screen vertically) you see a brief flash of the screen shifted vertically and overlaid on the image, looks a bit disconcerting. Doesn't happen on Android 4.1

Horizontal multi-touch doesn't work with ViewPager

In the sample app, with the ViewPager an horizontal multi-touch gesture is very difficult to accomplish.
If the two fingers are vertical to each other, then it's easy. I suppose that the ViewPager is "stealing" any horizontal drags.

Perhaps a simple solution would be to disable the pager when two fingers are detected.

SetScale does not work

Hi,
I set images using android query instead of imageView.setImageResource(..); and images are too big to fit into the tablet resolution. When I try to scale the images with imageView.setScaleType(.. );
It does not do any change. How can I change the size of the images that do not fit in the screen?

Thanks in advance.

java.lang.NullPointerException

PhotoVIew Last version (05b1c2a)
Android 2.2 - 4.2.2

java.lang.NullPointerException
at uk.co.senab.photoview.PhotoViewAttacher.cleanup(PhotoViewAttacher.java:180)
at uk.co.senab.photoview.PhotoViewAttacher.getImageView(PhotoViewAttacher.java:208)
at uk.co.senab.photoview.PhotoViewAttacher.onGlobalLayout(PhotoViewAttacher.java:311)
at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:682)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1848)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1110)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4470)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)

ImageView no longer exists. You should not use this PhotoViewAttacher any more.

05-02 17:21:59.583: E/AndroidRuntime(6325): FATAL EXCEPTION: main
05-02 17:21:59.583: E/AndroidRuntime(6325): java.lang.IllegalStateException: ImageView no longer exists. You should not use this PhotoViewAttacher any more.
05-02 17:21:59.583: E/AndroidRuntime(6325): at com.yijian.app.view.photoview.PhotoViewAttacher.getImageView(PhotoViewAttacher.java:210)
05-02 17:21:59.583: E/AndroidRuntime(6325): at com.yijian.app.view.photoview.PhotoViewAttacher.update(PhotoViewAttacher.java:482)
05-02 17:21:59.583: E/AndroidRuntime(6325): at com.yijian.app.view.photoview.PhotoView.setImageDrawable(PhotoView.java:114)
05-02 17:21:59.583: E/AndroidRuntime(6325): at android.widget.ImageView.setImageBitmap(ImageView.java:377)
05-02 17:21:59.583: E/AndroidRuntime(6325): at com.yijian.app.activity.GalleryActivity$TestAdapter$1.onLoadingComplete(GalleryActivity.java:287)
05-02 17:21:59.583: E/AndroidRuntime(6325): at com.nostra13.universalimageloader.core.DisplayBitmapTask.run(DisplayBitmapTask.java:64)
05-02 17:21:59.583: E/AndroidRuntime(6325): at android.os.Handler.handleCallback(Handler.java:605)
05-02 17:21:59.583: E/AndroidRuntime(6325): at android.os.Handler.dispatchMessage(Handler.java:92)
05-02 17:21:59.583: E/AndroidRuntime(6325): at android.os.Looper.loop(Looper.java:137)
05-02 17:21:59.583: E/AndroidRuntime(6325): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-02 17:21:59.583: E/AndroidRuntime(6325): at java.lang.reflect.Method.invokeNative(Native Method)
05-02 17:21:59.583: E/AndroidRuntime(6325): at java.lang.reflect.Method.invoke(Method.java:511)
05-02 17:21:59.583: E/AndroidRuntime(6325): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
05-02 17:21:59.583: E/AndroidRuntime(6325): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
05-02 17:21:59.583: E/AndroidRuntime(6325): at dalvik.system.NativeStart.main(Native Method)

Fully zoomed image scroll and viewpager flip not smooth

Just tried you demo and it is very impressive. Can you please confirm such issue.
Viewpager demo:

  • Zoom image fully (better in landscape)
  • scroll it to the right (not till the end but leave some space suppose 100 dp)
  • put the thinger to the right part of the screen and start to scroll to the left so the viewpager flip will be activated once you scroll all the image.
  • When the image fully scrolled and viewpager starts to flip view jumps to the left for a 100 or so dp. So the viewpager work become not so smooth as in the native gallery application.

My system is ICS 4.0.3

Is it possible to disable the ViewPage while in zoom?

Hi, I would like to know if you can help me.
I have a ViewPager working with the PhotoView, but I would like to disable the ViewPager Scroll while the PhotoView is in the zoom mode.
Could you please show me the path?
Thanks in advance.

Problem with Small Sized Images

Hello,

Your library is very good for images which has high resolution. But how can I show small images without stretching the image on my app?

Thanks

dev branch: NPE in VersionedGestureDetector

This code causes NPE on android version above froyo

if (sdkVersion < 5) {
            detector = new CupcakeDetector(context);
        } else if (sdkVersion < Build.VERSION_CODES.ECLAIR) {
            detector = new CupcakeDetector(context);
        } else if (sdkVersion < Build.VERSION_CODES.FROYO) {
            detector = new FroyoDetector(context);
        }

        detector.mListener = listener;

android:windowBackground @null causes kaleidoscope effect

A custom theme.xml with a null windowBackground style causes a kaleidoscope effect when zooming out and in.

<style name="Theme.NoBackground" parent="android:Theme.NoTitleBar">
    <item name="android:windowBackground">@null</item>
</style>

This was a recommended way to speed up the UI on the android developers blog:
http://android-developers.blogspot.com/2009/03/window-backgrounds-ui-speed.html

Easy work around is to not have this theme for the activity with PhotoView being used.

Way to reproduce:
In the sample project, change AndroidManifest.xml View Pager Activity to:
<activity android:name=".ViewPagerActivity" android:theme="@style/Theme.NoBackground"/>

Add a theme.xml in res/values folder with this in the file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.NoBackground" parent="android:Theme.NoTitleBar">
<item name="android:windowBackground">@null</item>
</style>
</resources>

Timing on zoom does not feel natural

Refactoring to use a TimeInterpolator with the animation would help, so that it could be easily replaced with an AccelerateDecelerateInterpolator.

Cant scroll through images when the image is loading

I used an image loader and a progressbar when the image is loading.
The problem i face is that, while the image is loading, I cant swipe left and right to other images (Even when the other images are loaded). The only way out is back button.

Lets say i have images 1,2,3,4
Images 1,2 loaded and 3,4 are very big images and are taking time to load.
when i swipe from 1->2 then 2->3 , i am struck. I cant swipe back from 3->2.

ponterIndex out of range

I am yet to confirm whether this is the PhotoView or the ACL. I have only seen it a couple of times, where if you keep randomly zooming out (two figures) on a view pager, you will rarely see this exception.

I am going to investigate a bit more and see if I can find out how to forcefully reproduce it.

java.lang.IllegalArgumentException: pointerIndex out of range
at android.view.MotionEvent.nativeGetAxisValue(Native Method)
at android.view.MotionEvent.getX(MotionEvent.java:1981)
at android.support.v4.view.MotionEventCompatEclair.getX(MotionEventCompatEclair.java:32)
at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getX(MotionEventCompat.java:91)
at android.support.v4.view.MotionEventCompat.getX(MotionEventCompat.java:219)
at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1768)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1817)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1405)
at android.app.Activity.dispatchTouchEvent(Activity.java:2410)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1901)
at android.view.View.dispatchPointerEvent(View.java:7419)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3220)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3165)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4292)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4271)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4363)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:125)
at android.os.Looper.loop(Looper.java:124)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)

Lazy Downloaded Images does not Fit the screen in ViewPager

Hi,
I'm lazy loading pictures using yours great NetworkCacheImageView (Android-BitmapMemoryCache), and there's no way I can make the image to fit the screen once loaded in the ViewPager.

here's the InstatiateItem() {
NetworkedCacheableImageView imageView = new NetworkedCacheableImageView(container.getContext(), mCache);
PhotoViewAttacher attacher = new PhotoViewAttacher(imageView);
imageView.loadImage(mCache, imageUrl[position]);
attacher.update();

        // Now just add ImageView to ViewPager and return it
        container.addView(imageView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

        return imageView;

}

what's interesting is that after scrolling to the end of the viewpager, and starting to go back, the images starts to be centered and fitted to the size of the screen. (which I presume they're being loaded from the cache with known width / height).

any hints on how to make this working?

With hardware acceleration enabled GL10.GL_MAX_TEXTURE_SIZE gets sometimes exceeded.

When the device supports hardware acceleration and it's on, then maximum size of image supported by the library is restricted to value of GL10.GL_MAX_TEXTURE_SIZE.
It's only 2048x2048 both in Galaxy Nexus and Galaxy S2.

That's the real problem, which makes the library useless in most of applications.
http://stackoverflow.com/questions/15313807/android-maximum-allowed-width-height-of-bitmap

I have read that the way to go around it is to cut image into tails, but I think it's not easy to add such functionality to this library. Do you have any other suggestion how to go around it or maybe do you know similar library without this problem?

Nexus 10 error: Bitmap too large to be uploaded into a texture (6667x667, max=4096x4096)

Google Market, but release supports zero device.I configured the manifest file is: <uses-sdk android: minSdkVersion = "8"           android: targetSdkVersion = "15" />

I released the software to Google Market, but release supports zero device.I configured the manifest file is: <uses-sdk android: minSdkVersion = "8"
          android: targetSdkVersion = "15" />
I use Android version 4.1 compiler. Tried many ways or zero device. I hope someone can help solve the problem. Really thank you

Support of UniversalImageLoader

Hi, I would like to ask if is UniversalImageLoader supported by PhotoView. I try to simply use PhotoView instead of ImageView for loader as its extends ImageView, but gets null pointer in measuring views methods.
Thanks for answer.

IllegalArgumentException (pointerIndex out of range) while using many fingers to zoom in and out

(Android 4.2.1 - Samsung Galaxy Nexus)

java.lang.IllegalArgumentException: pointerIndex out of range
at android.view.MotionEvent.nativeGetAxisValue(Native Method)
at android.view.MotionEvent.getX(MotionEvent.java:1981)
at android.support.v4.view.MotionEventCompatEclair.getX(MotionEventCompatEclair.java:32)
at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getX(MotionEventCompat.java:86)
at android.support.v4.view.MotionEventCompat.getX(MotionEventCompat.java:184)
at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1339)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1817)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1405)
at android.app.Activity.dispatchTouchEvent(Activity.java:2410)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1901)
at android.view.View.dispatchPointerEvent(View.java:7419)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3220)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3165)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4292)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4271)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4363)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:171)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4342)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4382)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:530)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5191)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
at dalvik.system.NativeStart.main(Native Method)

The app is slow with PhotoView

The library is great, I want to use it but it seems it has a problem. Let me explain.

I am using viewpager with a cursor. Cursor has like 500 items. Since I am using viewpager it should load 2 pages at once.

I have used PagerAdapter and FragmentStatePagerAdapter both and the result is the same with your PhotoView. It is too darn slow.

When I use normal ImageView it is fast. When I use PhotoView with only 3 pages in viewpager, it is fast again.

What could be the problem??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.