Android-WYSIWYG-Editor icon indicating copy to clipboard operation
Android-WYSIWYG-Editor copied to clipboard

imagepicker wont work with fragment

Open abfist opened this issue 7 years ago • 2 comments

the imagepicker uses startActivityForResult from editorCore which uses the context of the view and therefor the activity. when used inside a fragment the fragment wont recieve the onActivityResult call. i added 2 methods for this :

//my addition for fragment handle
        public void OpenFragmentImagePicker(Fragment fragment) {
            getImageExtensions().OpenFragmentImageGallery(fragment);
        }

/my extention for fragment handling
    public void OpenFragmentImageGallery(Fragment fragment) {
        int Index=this.editorCore.determineIndex(EditorType.none);
        EditorContent state= editorCore.getContent();
        Intent intent = new Intent();
// Show only images, no videos or anything else
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
    // Always show the chooser (if there are multiple options available)
        fragment.startActivityForResult(Intent.createChooser(intent, "Select an image"), editorCore.PICK_IMAGE_REQUEST);
    }

my method is crude and this probably needs to be handled in the project

abfist avatar May 02 '17 12:05 abfist

noted @abfist , will release a patch for the Fragment compatibility ASAP.

irshu355 avatar May 05 '17 12:05 irshu355

Is it patched?

lovish888 avatar Jul 16 '19 13:07 lovish888