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

whenAvailable callback for saveToFile(FIle file) #24

Closed
bsin1 opened this issue May 18, 2017 · 1 comment
Closed

whenAvailable callback for saveToFile(FIle file) #24

bsin1 opened this issue May 18, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@bsin1
Copy link

bsin1 commented May 18, 2017

Hey guys, is it possible to trigger a callback when saveToFile has finished execution? I've been trying to create a new PendingResult.Callback but can't seem to figure out the proper Callback type.

   PhotoResult photoResult = fotoapparat.takePicture();

    File f = new File(
            getActivity().getExternalFilesDir("photos"),
            "newImage.jpg"
    );

    PendingResult.Callback<?> callback = new PendingResult.Callback<Void>() {
        @Override
        public void onResult(Void v) {
            Log.d(TAG,"SAVE FILE CALLBACK");
        }
    };

    photoResult.saveToFile(f).whenAvailable(callback);
@dmitry-zaitsev dmitry-zaitsev self-assigned this May 18, 2017
@dmitry-zaitsev dmitry-zaitsev added this to the 1.0.0 milestone May 18, 2017
@dmitry-zaitsev
Copy link
Member

This is something I overlooked while writing saveToFile(). Fixed.

Now saveToFile expects Callback<Void> instead of Callback<?>. Moreover, I added new method - .whenDone which is exactly the same as whenAvailable but has a name better suited for Void callbacks.

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

No branches or pull requests

2 participants