baseflow / photoview Goto Github PK
View Code? Open in Web Editor NEWImplementation of ImageView for Android that supports zooming, by various touch gestures.
Home Page: https://baseflow.com
License: Apache License 2.0
Implementation of ImageView for Android that supports zooming, by various touch gestures.
Home Page: https://baseflow.com
License: Apache License 2.0
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)
Lets say there are 10 images, and i scrolled through first 5 and i am now on 6th image, Once i rotate the screen, the index gets resset to 0, and i am back on first image
Steps to reproduce:
device: Desire HD, os - 4.1
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.
If PhotoView fits the screen (match_parent) but image takes only part of it when OnPhotoTapListener doesn't work if to click outside the picture. Can it be fixed in some way?
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?
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)
Thanks for the wonderful library. Will there be any support for animated gif in the near future?
(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)
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?
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>
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.
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.
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;
Padding although can be set, and looks ok, for top left corner, image is scaled as if it was not set. After resize, scrolling also doesn't take padding into account.
The full error is:
java.lang.IllegalStateException: ImageView no longer exists. You should not use this PhotoViewAttacher any more.
uk.co.senab.photoview.PhotoViewAttacher.getImageView(PhotoViewAttacher.java:209)
uk.co.senab.photoview.PhotoViewAttacher.onSingleTapConfirmed(PhotoViewAttacher.java:351)
android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:320)
Please provide view tap listener because OnClickListener is not good for such purposes because of conflict with double tap zoom
Why it is 8 if the project can be compilled and run on below versions?
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.
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.
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
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.
Add pom.xml and upload to Maven central.
Just tried you demo and it is very impressive. Can you please confirm such issue.
Viewpager demo:
My system is ICS 4.0.3
I am currently using the BitmapFun (Google) ImageCache system inside my app, along with the PhotoView library.
Using these together, when I attach the PhotoAttacher to the ImageView, the Bitmap (when loaded) appears in the top left of the ImageView unti a gesture is recognised, upon which the ImageView displays the Bitmap correctly.
how copy this imageview status to another that meams this imageview size and other
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)
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.
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.
When I try to use the ontouchlistener the zoom doesn't work, is there any way i can fix this?
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)
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?
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.
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.
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??
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?
Hi, could you provide an example of how to use your great project with images pulled down from a server.
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)
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.
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
I would like to request the addition of a setDisplayRect( .. )
to be able to save and restore the state of PhotoView
Hello there.
I've downloaded the sample project and all I can say is that this is what I was looking for.
Is it possible to implement PhotoView with UIL project?(where the ViewPager is)
Thanks in advance,
harris21
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
Why it is there?
You have written a couple of features but not give us how to use them. Sample app does nothing for example.
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
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.
Refactoring to use a TimeInterpolator with the animation would help, so that it could be easily replaced with an AccelerateDecelerateInterpolator.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.