turtlebody / android-image-preview Goto Github PK
View Code? Open in Web Editor NEWA simple and easy to use image-preview android library.
License: MIT License
A simple and easy to use image-preview android library.
License: MIT License
Hi @wangsun6 ,
in the preview when you take portrait pictures, these are rotated the wrong way. Could you implement the rotation? Do you need help?
As you can see the thumbnail looks good but not the preview itself.
Cheers
73k05
Hi,
I have another crash from the community. If you'd like to merge my previous PR #9 I would gladly investigate this issue.
Fatal Exception: java.lang.IllegalStateException: preview_fragment_parent_fl must not be null
at com.greentoad.turtlebody.imagepreview.ImagePreview$PreviewFragment.show(ImagePreview.java:320)
at com.greentoad.turtlebody.imagepreview.ImagePreview$PreviewFragment.access$setMAdapterRecycler$p(ImagePreview.java:211)
at com.greentoad.turtlebody.imagepreview.ImagePreview$PreviewFragment$initAdapter$2.onViewPagerClick(ImagePreview.java:379)
at com.greentoad.turtlebody.imagepreview.ui.components.ViewPagerAdapter$getItem$1.onImageClick(ViewPagerAdapter.java:28)
at com.greentoad.turtlebody.imagepreview.ui.components.ImageFragmentViewer$onViewCreated$1.onClick(ImageFragmentViewer.java:50)
at android.view.View.performClick(View.java:7259)
at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$2.onSingleTapConfirmed(SubsamplingScaleImageView.java:565)
at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:323)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
It would be this part of the code
private fun show() {
mUiVisibilityFlag?.let {
preview_fragment_parent_fl.systemUiVisibility = it
...
preview_fragment_parent_fl seems to be null.
Hi,
I've got this crash from the community:
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'int android.view.View.getSystemUiVisibility()' on a null object reference
com.greentoad.turtlebody.imagepreview.ImagePreview$PreviewFragment.hide (ImagePreview.java:336)
com.greentoad.turtlebody.imagepreview.ImagePreview$PreviewFragment.access$hide (ImagePreview.java:211)
com.greentoad.turtlebody.imagepreview.ImagePreview$PreviewFragment$initAdapter$2.onViewPagerClick (ImagePreview.java:374)
com.greentoad.turtlebody.imagepreview.ui.components.ViewPagerAdapter$getItem$1.onImageClick (ViewPagerAdapter.java:28)
com.greentoad.turtlebody.imagepreview.ui.components.ImageFragmentViewer.onViewCreated$lambda-0 (ImageFragmentViewer.java:66)
com.greentoad.turtlebody.imagepreview.ui.components.ImageFragmentViewer.lambda$RLwMrkVqeHGudG0blsm2jYqcBfU (ImageFragmentViewer.java)
com.greentoad.turtlebody.imagepreview.ui.components.-$$Lambda$ImageFragmentViewer$RLwMrkVqeHGudG0blsm2jYqcBfU.onClick (-.java:2)
android.view.View.performClick (View.java:6897)
com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$2.onSingleTapConfirmed (SubsamplingScaleImageView.java:565)
android.view.GestureDetector$GestureHandler.handleMessage (GestureDetector.java:312)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
I fixed it in this PR #15
Regards
73k05
Hi, I created an Activity using your example, but the image is only displaying on the Preview Boxes.
Hi,
thank you very much for the lib, looks neat!
When I add the last version of the lib as a dependency in my project, I have this error:
.../.gradle/caches/transforms-2/files-2.1/.../image-preview-1.0.2/res/values/values.xml:251:5-255:13: AAPT: error: resource color/tb_media_picker_accent (aka ...:color/tb_media_picker_accent) not found.
Indeed, the color resource is included in the picker. So, if I add media picker as a dependency then it works:
implementation 'com.greentoad.turtlebody:media-picker:1.0.8'
I should not add a whole lib for just a color, should I? If yes at least change your Read.me
But I might do something wrong anyway, let me know if anybody already faced this issue.
Thanks!
73k05
Hi @wangsun6 thank you for the great work and wonderful lib you have been creating here,
I got a crash from my community, I don't know how to reproduce it yet but here is the error I get.
Platform: android 7 & android 10
Device: Galaxy Note10 & ZenFone AR
BG: Not in background task
Crash:
Fatal Exception: java.lang.IllegalStateException: preview_fragment_parent_fl must not be null
at com.greentoad.turtlebody.imagepreview.ImagePreview$PreviewFragment.show(ImagePreview.java:320)
at com.greentoad.turtlebody.imagepreview.ImagePreview$PreviewFragment.access$show(ImagePreview.java:211)
at com.greentoad.turtlebody.imagepreview.ImagePreview$PreviewFragment$initAdapter$2.onViewPagerClick(ImagePreview.java:379)
at com.greentoad.turtlebody.imagepreview.ui.components.ViewPagerAdapter$getItem$1.onImageClick(ViewPagerAdapter.java:28)
at com.greentoad.turtlebody.imagepreview.ui.components.ImageFragmentViewer$onViewCreated$1.onClick(ImageFragmentViewer.java:50)
at android.view.View.performClick(View.java:7865)
at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView$2.onSingleTapConfirmed(SubsamplingScaleImageView.java:565)
at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:345)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8034)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Here is the peace of code that is producing the error:
private fun show() {
mUiVisibilityFlag?.let {
preview_fragment_parent_fl.systemUiVisibility = it
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
preview_fragment_app_bar.setPadding(0,getStatusBarHeight(),0,0)
preview_fragment_bottom_ll.setPadding(0,0,0,getNavigationBarSize(context!!).y)
}
preview_fragment_activity_toolbar.visibility = View.VISIBLE
if(mPreviewConfig.mUriList.size>1) {
preview_fragment_bottom_ll.visibility = View.VISIBLE
}
}
}
It seems to be the line preview_fragment_parent_fl.systemUiVisibility = it
. Shall we wrap it in null test and exit in that case?
Hi @wangsun6 thank you for this wonderful open source project!
I found a new crash on the lib.
This could be reproduced if you click/touch many times with two hands and quickly on the picture after you have selected one and it is displayed with the mini thumbnail...
Enclosed the stack
2020-07-17 15:19:21.486 27796-27796/com.greentoad.turtlebody.imagepreview.sample E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.greentoad.turtlebody.imagepreview.sample, PID: 27796
java.lang.IllegalArgumentException: pointerIndex out of range
at android.view.MotionEvent.nativeGetAxisValue(Native Method)
at android.view.MotionEvent.getX(MotionEvent.java:2367)
at androidx.viewpager.widget.ViewPager.onInterceptTouchEvent(ViewPager.java:2072)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2609)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:465)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1849)
at android.app.Activity.dispatchTouchEvent(Activity.java:3993)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:423)
at android.view.View.dispatchPointerEvent(View.java:13675)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5483)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5286)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4789)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4842)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4808)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4948)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4816)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5005)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4789)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4842)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4808)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4816)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4789)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7512)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7481)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7442)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7637)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:189)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:179)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:7588)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:7661)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1041)
at android.view.Choreographer.doCallbacks(Choreographer.java:864)
at android.view.Choreographer.doFrame(Choreographer.java:792)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1026)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
2020-07-17 15:19:21.486 27796-27796/com.greentoad.turtlebody.imagepreview.sample E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
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.