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

Allow custom functionality on the TedImagePickerActivity by opening some classes and functions #95

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

arqlz
Copy link

@arqlz arqlz commented Nov 27, 2021

For some applications the default camera intent is not functional enough, those projects, will need extra control on the camera (image recognition, video annotation, resolution adjustments, filtering, etc), so while adding custom buttons for TedImagePicker can be a reasonable solution a middle term (a way to add tiles to the gallery), another solution can be to allow the extension of the already built clases, witch can be a faster way to solve this issue.

How can this be done?:

  1. By overriding the TedImagePicker.Bundle, then adding a new function getIntent(context) that will return the custom intent discussed on point 2
  2. A custom TedImagePickerActivity with an open function onCameraTileClick that will allow the call of a custom camera activity
  3. The override of the onActivityResult to get the images, and then call loadMedia(true) and onMediaClick(uri) to notify the base Gallery activity

The TedImagePickerActivity and onCameraTileClick can be overriden
The Builder class can be extended
Allow the use of custom activity intent
@arqlz arqlz changed the title Allow custom functionality on the TedImagePickerActivity by opening some clases and funciones Allow custom functionality on the TedImagePickerActivity by opening some clases and functions Apr 26, 2022
@arqlz arqlz changed the title Allow custom functionality on the TedImagePickerActivity by opening some clases and functions Allow custom functionality on the TedImagePickerActivity by opening some classes and functions Apr 26, 2022
Copy link
Owner

@ParkSangGwon ParkSangGwon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thinks this is not good solution.

If you need custom camera pick intent, you can provide custom camera intent listener

interface OnCameraTileClickListener {
    fun onCameraTileClick(completeListener: () -> Uri)
}

And you can use this listener

private fun onCameraTileClick() {
    if(onCameraTileClickListener!=null){
        onCameraTileClickListener.onCameraTileClick {
            MediaUtil.scanMedia(this, uri)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe {
                    loadMedia(true)
                    onMediaClick(uri)
                }
        }
    }
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants