Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Want to pass custom request request code as shown in git document #38

Closed
karteekthati opened this issue Sep 25, 2021 · 2 comments
Closed
Assignees
Labels
help wanted Extra attention is needed

Comments

@karteekthati
Copy link

karteekthati commented Sep 25, 2021

Hi

what I am trying to do is in same page got 3 different images to capture,in latest version I am unable to pass request code in

   ImagePicker.Companion.with(this)
                        .crop()
                        .cropOval()
                        .maxResultSize(512, 512, true)
                        .createIntentFromDialog((Function1) (new Function1() {
                            public Object invoke(Object var1) {
                                this.invoke((Intent) var1);
                                return Unit.INSTANCE;
                            }
                            public final void invoke(@NotNull Intent it) {
                                Intrinsics.checkNotNullParameter(it, "it");
                                launcher.launch(it);
                            }
                        }));

I want to pass custom request code as show in your git document and on launcher I can capture as per request code shown below

 ActivityResultLauncher<Intent> launcher =
            registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), (ActivityResult result) -> {
                if (result.getResultCode() == RESULT_OK) {
                    //here I want to check request code so that I can use my logic
                } else if (result.getResultCode() == ImagePicker.RESULT_ERROR) {
                    // Use ImagePicker.Companion.getError(result.getData()) to show an error
                }
            });

image

@karteekthati
Copy link
Author

.start()

this command is not available in new version

@Drjacky Drjacky self-assigned this Sep 25, 2021
@Drjacky
Copy link
Owner

Drjacky commented Oct 20, 2021

I'm gonna edit the Readme. With the new ActivityResultContracts API, it is not possible to pass the request code.
You need different launchers for your desire; For example, when one picking up and cropping has been finished, open the next one, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants