Git Product home page Git Product logo

imagepicker's Introduction

Hi, I'm Dhaval 👋


I'm a software engineer 👨‍💻 who is passionate about mobile technologies and open source.

  • 🔭 I’m currently working on Android and Flutter Apps
  • 🌱 Learning more about and studying: Open Source, Spring Boot, CS Algorithms
  • 💬 Ask me about: Android, Kotlin, Flutter, Java
  • 📫 Reach me asap: Twitter or [email protected]

imagepicker's People

Contributors

armandditto avatar benjaminlefevre avatar dhaval2404 avatar douglas-srs avatar linx64 avatar lotuxpunk avatar marchuck avatar mateusandreatta avatar mdxdave avatar onuryurtturk avatar soareseneves avatar terence-codigo avatar tobiaskaminsky avatar torkelv avatar yamin8000 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

imagepicker's Issues

Version Bump

Hey there,

I think you forgot to bump the version after your last commit, I can't get the new features using version 1.1

ActivityNotFoundException: android.intent.action.OPEN_DOCUMENT

ActivityNotFoundException: android.intent.action.OPEN_DOCUMENT

Fatal Exception: java.lang.RuntimeException
:Unable to start activity ComponentInfo{com.github.dhaval2404.imagepicker.ImagePickerActivity}
:android.content.ActivityNotFoundException
:No Activity found to handle Intent { act=android.intent.action.OPEN_DOCUMENT cat=[android.intent.category.OPENABLE] typ=image/* }

I face this issue only in android 8 (oreo)

Get Image form gallery not work in andorid Q

https://developer.android.com/training/data-storage/files/external-scoped

Warning: Apps will be required to use scoped storage in next year's major platform release for all apps, independent of target SDK level. Therefore, you should ensure that your app works with scoped storage well in advance. To do so, make sure that the behavior is enabled for devices that run Android 10 (API level 29) and higher.

I add this to manifest and everything work perfect.
`<manifest ... >

<application android:requestLegacyExternalStorage="true" ... >
...

`

Logo design

Hi, I'm a logo designer, I design free logos for open source project and I can make a logo for your project. So, what do you think?

Ucrop crash

 ImagePicker.with(this@FromProyekActivity)
        .galleryOnly()    //User can only select image from Gallery
        .cropSquare()
        .compress(1024)
        .start { resultCode, data ->
            if (resultCode == Activity.RESULT_OK) {
                val fileUri = data?.data
                if (fileUri != null) {
                    mViewmodel.renderUpload(fileUri)
                }

                //You can get File object from intent
                val file: File? = ImagePicker.getFile(data)

                //You can also get File Path from intent
                val filePath: String? = ImagePicker.getFilePath(data)
            } else if (resultCode == ImagePicker.RESULT_ERROR) {
                Toast.makeText(
                    this@FromProyekActivity,
                    ImagePicker.getError(data),
                    Toast.LENGTH_SHORT
                ).show()
            } else {
                Toast.makeText(
                    this@FromProyekActivity,
                    "Task Cancelled",
                    Toast.LENGTH_SHORT
                )
                    .show()
            }

        }
Error Code : 
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.zerojump.a18app, PID: 14965
    java.lang.NoSuchMethodError: No virtual method start(Landroid/app/Activity;I)V in class Lcom/yalantis/ucrop/UCrop; or its super classes (declaration of 'com.yalantis.ucrop.UCrop' appears in /data/app/com.zerojump.a18app-to7xY13CNXQhLWgsLJMHvg==/base.apk!classes3.dex)
        at com.github.dhaval2404.imagepicker.provider.CropProvider.cropImage(CropProvider.kt:91)
        at com.github.dhaval2404.imagepicker.provider.CropProvider.startIntent(CropProvider.kt:61)
        at com.github.dhaval2404.imagepicker.ImagePickerActivity.setImage(ImagePickerActivity.kt:116)
        at com.github.dhaval2404.imagepicker.provider.GalleryProvider.handleResult(GalleryProvider.kt:104)
        at com.github.dhaval2404.imagepicker.provider.GalleryProvider.onActivityResult(GalleryProvider.kt:89)
        at com.github.dhaval2404.imagepicker.ImagePickerActivity.onActivityResult(ImagePickerActivity.kt:97)
        at android.app.Activity.dispatchActivityResult(Activity.java:7741)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4724)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4773)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2034)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:226)
        at android.app.ActivityThread.main(ActivityThread.java:7179)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)

Failed to create Camera image file !

Hello i am getting Failed to create Camera image file in Error. !
device : PIXEL 3A API 29 Android Q
targetSdkVersion:29

Suggestion:

  1. You can not get public directory at API 29 LEVEL.. it is deprecated..

private fun getCameraDirectory(): File {
val dir = context.getExternalFilesDir(null)!!.absolutePath
return File(dir, "Camera")
}

  1. Change the targetSdkVersion to 28 from build.gradle file.

Camera permission is redundant and decreases supported devices count

Hi,
Thanks a lot for this component, it saved me a lot of work!
I'm using v1.3 and when I try to publish my new bundle, Google Play Store tells me that some devices will not be compatible with the new version, it occurs because of this library.

In the readme file you've mentioned:

<!--
If Not using Camera feature, Add following line in app manifest.
This will remove permission while manifest merge
-->
<uses-permission android:name="android.permission.CAMERA" tools:node="remove"/> 

But, there's no actual need for this permission, unless of course you're presenting an embedded camera preview. If I'm not mistaking there's no embedded camera preview here, for now.

So:

  1. Can we remove it?
  2. We can add an option to your API that will ignore camera permissions, because when I'm using tools:node="remove" in the manifest this library simply ignores my request due to "missing permissions", which is wrong (that's the actual issue here).
  3. However, if you like, you can use activity.packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY) to prevent camera usage when it is not available.

LMK what you think, I'll be glad to help :)

Images clicked in portrait mode are rotated.

When I take a picture from the camera in portrait mode the picture gets rotated. When the picture is taken by the camera in landscape mode the picture doesn't get rotated and looks the way it was clicked.

Translate text

Is there any way to translate edit photo title text and alert choose?

[Feature Request] Allow multiple image selection from gallery

Hello @Dhaval2404
Everything good to me, but how can i select 3 photos from gallery? It seems no method for setting this right?

ImagePicker.with(this)
	    .galleryOnly()     //User can only select image from Gallery
            .limit(3)               //need method like this
	    .start()		      //Default Request Code is ImagePicker.REQUEST_CODE

Thanks.

Camera opens twice when "Don't keep activities" option is ON

Doing some tests while having the developer option "Don't keep activities" turned on (that simulates what could happen when low on memory). After taking a picture, the camera is started again. Taking a second picture, it now behave like it should. Please note that I'm using the cameraOnly() option.

I think the problem is that ImagePickerActivity, in its onCreate method, is not considering the savedInstanceState Bundle (which is not null if the activity has been destroyed and is being re-created). What I'm not sure is why it's working the second time, and not going on a loop.

Anyone else has this problem or can reproduce it?

ImagePicker crash while capturing Camera Image and Camera Permission is Defined in Manifest

Today, I discover a very strange crash issue. When Camera Permission is declared in Manifest and android.media.action.IMAGE_CAPTURE intent is called then the app must request CAMERA runtime permission. Otherwise, app will be crashed.

And if we remove permission from manifest then an error will no longer be reproduced.

Found below StackOverflow link which has this kind of similar issue:
https://stackoverflow.com/questions/43042725/revoked-permission-android-permission-camera/43070198

java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=4282, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.github.dhaval2404.imagepicker.sample/com.github.dhaval2404.imagepicker.ImagePickerActivity}: java.lang.SecurityException: Permission Denial: starting Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 cmp=com.android.camera2/com.android.camera.CaptureActivity clip={text/uri-list U:content://com.github.dhaval2404.imagepicker.sample.provider/external_files/DCIM/Camera/IMG_20190930_230312575.jpg} (has extras) } from ProcessRecord{bfa62b 30120:com.github.dhaval2404.imagepicker.sample/u0a134} (pid=30120, uid=10134) with revoked permission android.permission.CAMERA
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4845)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4886)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
        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(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
     Caused by: java.lang.SecurityException: Permission Denial: starting Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 cmp=com.android.camera2/com.android.camera.CaptureActivity clip={text/uri-list U:content://com.github.dhaval2404.imagepicker.sample.provider/external_files/DCIM/Camera/IMG_20190930_230312575.jpg} (has extras) } from ProcessRecord{bfa62b 30120:com.github.dhaval2404.imagepicker.sample/u0a134} (pid=30120, uid=10134) with revoked permission android.permission.CAMERA
        at android.os.Parcel.createException(Parcel.java:2071)
        at android.os.Parcel.readException(Parcel.java:2039)
        at android.os.Parcel.readException(Parcel.java:1987)
        at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:3851)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1705)
        at android.app.Activity.startActivityForResult(Activity.java:5192)
        at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676)
        at android.app.Activity.startActivityForResult(Activity.java:5150)
        at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:663)
        at com.github.dhaval2404.imagepicker.provider.CameraProvider.startCameraIntent(CameraProvider.kt:82)
        at com.github.dhaval2404.imagepicker.provider.CameraProvider.onRequestPermissionsResult(CameraProvider.kt:96)
        at com.github.dhaval2404.imagepicker.ImagePickerActivity.onRequestPermissionsResult(ImagePickerActivity.kt:87)
        at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:8264)
        at android.app.Activity.dispatchActivityResult(Activity.java:8114)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4838)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4886) 
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) 
        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(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 
     Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1043)
        at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:760)
        at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:583)
        at com.android.server.wm.ActivityStarter.startActivityMayWait(ActivityStarter.java:1288)
        at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:514)

Memory Leak

When use providerBoth, leakcanary warn memory leak in ImageBuider picker....

FileProvider of the library clashes with the FileProvider of the app

Hi! Thanks for this library, I have been using it for a while without any issues.

However recently, when I added a FileProvider to my app, it clashed with the FileProvider of the library. It failed to merge the manifest, telling that there is already a FileProvider for the same authority.

I found this thread on StackOverflow helpful:
https://stackoverflow.com/questions/43175014/possible-to-use-multiple-authorities-with-fileprovider

As discussed there, adding suffixes to the authority name didn't help. Instead, creating a custom FileProvider class (an empty implementation, just a wrapper) solved the issue.

My problem is solved, but I think it would be better if the library itself uses this solution. Instead of adapting all client apps for the library, it would be more efficient to only adjust the library.

The solution is simple:
-Create a class that extends from FileProvider (an empty class, no code needed)
-In the manifest of the library, give this class as the name of the provider instead of FileProvider

If you wish, I can make a PR as well.

Best regards,

Oya Canli

Could not find com.github.yalantis:ucrop:2.2.2 again

Could not find com.github.yalantis:ucrop:2.2.2.
Searched in the following locations:

my gradle
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }

}

i am url - https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.2/ucrop-2.2.2.jar
{
"errors" : [ {
"status" : 404,
"message" : "Could not find resource"
} ]
}

please update

Multiple FileProvider causing manifest merge failed issue

Hi,

My project is in java and I never added any kotlin library or file. Also my project is not on android X.
When I use this implementation 'com.github.dhaval2404:imagepicker-support:1.5' in gradle I am getting the following error

java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
	at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:558)
	at com.android.build.gradle.tasks.ProcessApplicationManifest.doFullTaskAction(ProcessApplicationManifest.java:208)
	at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:46)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
	at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:404)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:393)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:376)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:80)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:213)
	at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:32)
	at java.util.Optional.map(Optional.java:215)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:32)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
	at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
	at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:201)
	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
	at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
	at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
	at java.util.Optional.map(Optional.java:215)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:77)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
	at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:120)
	at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
	at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
	at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:748)

`

Implement Inline Activity Result

Hello,

First of all thanks for this great library!

I was wondering if you could please make the ImagePicker class open so I can override it, I want to add some way to open activity and get response with lambda which is way more convenient for me.

When I'm choosing camera, I'm getting crash below Android 8.0.0 Samsung S7

com.github.dhaval2404.imagepicker.ImagePickerActivity}: java.lang.IllegalArgumentException: Missing android.support.FILE_PROVIDER_PATHS meta-data
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2957)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) Caused by: java.lang.IllegalArgumentException: Missing android.support.FILE_PROVIDER_PATHS meta-data
at androidx.core.content.FileProvider.parsePathStrategy(FileProvider.java:613)
at androidx.core.content.FileProvider.getPathStrategy(FileProvider.java:579)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:417)
at com.github.dhaval2404.imagepicker.util.IntentUtils.getCameraIntent(IntentUtils.kt:75)
at com.github.dhaval2404.imagepicker.provider.CameraProvider.startCameraIntent(CameraProvider.kt:119)
at com.github.dhaval2404.imagepicker.provider.CameraProvider.checkPermission(CameraProvider.kt:100)
at com.github.dhaval2404.imagepicker.provider.CameraProvider.startIntent(CameraProvider.kt:89)
at com.github.dhaval2404.imagepicker.ImagePickerActivity.loadBundle(ImagePickerActivity.kt:104)
at com.github.dhaval2404.imagepicker.ImagePickerActivity.onCreate(ImagePickerActivity.kt:56)
at android.app.Activity.performCreate(Activity.java:7183)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)

How to save img path/name

Hi, the title is pretty self explanatory :

I got a local database and I want to get the the full path (name of the pic included) in a String to save it.

Receiving "Failed To Create Camera Image File"

`
2019-12-01 14:00:05.865 16921-16921/com.irondigitalmedia.keep W/System.err: at com.github.dhaval2404.imagepicker.util.FileUtil.getImageFile(FileUtil.kt:46)

2019-12-01 14:00:05.865 16921-16921/com.irondigitalmedia.keep W/System.err: at com.github.dhaval2404.imagepicker.util.FileUtil.getImageFile$default(FileUtil.kt:30)

2019-12-01 14:00:05.865 16921-16921/com.irondigitalmedia.keep W/System.err: at com.github.dhaval2404.imagepicker.provider.CameraProvider.startCameraIntent(CameraProvider.kt:86)

2019-12-01 14:00:05.865 16921-16921/com.irondigitalmedia.keep W/System.err: at com.github.dhaval2404.imagepicker.provider.CameraProvider.checkPermission(CameraProvider.kt:72)

2019-12-01 14:00:05.865 16921-16921/com.irondigitalmedia.keep W/System.err: at com.github.dhaval2404.imagepicker.provider.CameraProvider.startIntent(CameraProvider.kt:61)

2019-12-01 14:00:05.865 16921-16921/com.irondigitalmedia.keep W/System.err: at com.github.dhaval2404.imagepicker.ImagePickerActivity.loadBundle(ImagePickerActivity.kt:68)

2019-12-01 14:00:05.865 16921-16921/com.irondigitalmedia.keep W/System.err: at com.github.dhaval2404.imagepicker.ImagePickerActivity.onCreate(ImagePickerActivity.kt:47)`

Your code says this shouldn't ever happen.

else -> {
Log.e(TAG, "Image provider can not be null")
// Something went Wrong! This case should never happen
setError(getString(R.string.error_task_cancelled))
}

line 72. I'm not sure what's going on. Would you need anything else to help figure out what's going on? The permission is given i checked the app permissions it settings.

This works great on a physical device (note 9), but doesn't work on a virtual device.

Silent Failure to Pick - ClassNotFound vs ClassCast and AppCompatActivity

In ImagePicker.kt startActivity, around line 299, there is the following code:

if (e is ClassNotFoundException) {

However, running Kotlin 1.3.61 and Java 1.8 the excption caught here is not a ClassNotFoundException it's a ClassCastException.

Because there is no other test for any other exception type in this handler, this method fails silently. To the developer, it appears that the picker fails without running the inline result handler.

Also, in the READ.ME it says:

If you are yet to Migrate on AndroidX, Use support build artifact: imagepicker-support:1.5

I am using several AndroidX components, however I had not yet migrated my Activity to AppCompatActivity. (I'm actually writing a Tasker plugin and the Tasker sample library doesn't use that super class). Even after changing to use imagepicker-support:1.5, it appears the library still does a cast to AppCompatActivity.

I'm a bit unclear what support:1.5 is supposed to change if the library still depends on AppCompatActivity. If AppCompatActivity is in fact a requirement, please consider updating the READ.ME to make this requirement clear.

Thanks!

Localization

Hello. How i can localization your lib? I need change "Edit Photo" to my language
Screenshot_20190607-172329

Not working in fragment

Hello Dhaval,

Hope you are doing well, I found that using your library and example it does not work in the fragment, it did not receive in fragment onActivityResult method.

Unable to start activity ComponentInfo{com.github.dhaval2404.imagepicker.ImagePickerActivity

I received this error using this library:
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.github.dhaval2404.imagepicker.ImagePickerActivity}: kotlin.TypeCastException: null cannot be cast to non-null type com.github.dhaval2404.imagepicker.constant.ImageProvider
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2419)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2479)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5420)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by kotlin.TypeCastException: null cannot be cast to non-null type com.github.dhaval2404.imagepicker.constant.ImageProvider
at com.github.dhaval2404.imagepicker.ImagePickerActivity.loadBundle(ImagePickerActivity.kt:49)
at com.github.dhaval2404.imagepicker.ImagePickerActivity.onCreate(ImagePickerActivity.kt:38)
at android.app.Activity.performCreate(Activity.java:6280)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2372)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2479)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5420)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

How can I resolve this issue?
Thanks

Feature Request: Bottom picker with Camera View and image list in grid view

Thank you for your great library with nice Kotlin. To make it the best, i would like to propose a feature request.

When set provider(ImageProvider.BOTH), there is config to display a bottom sheet fragment which is a grid view include camera view and images. You can see TedBottomPicker to get the idea, but that lib is not good enough.

Failed to pick Gallery Image

Library is awesome. But when i tried to pick an image from Downloads folder then it gives me the above error(Title) and the path was content://downloads/public_downloads/1511 Using this path am setting this to imageview like this Imageview.setImageURI

Android 10 permission issue

Hi there!

Thanks for making this great library! I ran into some issues when using the library for Android 10. It's related to the file permission and the changes that have been made to it. The latest version uses scoped permissions for data storage: https://developer.android.com/training/data-storage/files/external-scoped

I'm not 100% sure if I need to update something on the caller side or if the library needs some changes. I was able to temporarily getting the library working by adding android:requestLegacyExternalStorage="true" to my manifest.

Performing pause of activity that is not resumed

I'm using this library for tablet app. I'm opening the camera by your method and clicking on back button it throwing the exception. and unable to go back.
`Performing pause of activity that is not resumed: {com.xxx/com.github.dhaval2404.imagepicker.ImagePickerActivity}
java.lang.RuntimeException: Performing pause of activity that is not resumed: {com.xxx/com.github.dhaval2404.imagepicker.ImagePickerActivity}

Add option to set Storage Directory

In the current version, All images are stored in the camera folder(Environment.DIRECTORY_DCIM).

Need to add an option to allow developers to set a storage directory path along with crop and compress options.

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.