canelmas / let
posted
Category: IDE Plugins
Minimum SDK Level: None (1 | 1.0)

Badge

View in Github Github project information
Starred: 504
Forks: 37
Watchers: 14
Open Issues: 11

Snapshot pictures

No snapshot for this library yet.

Description

Annotation based simple API flavoured with AOP to handle new Android runtime permission model.

If you check Google's Samples
about the new permission model, you'll see a lot of boiler plate code for requesting, handling
and retrying the request for required permissions.

Let will minimize the boiler plate code you have to write for requesting and handling permissions and hence
help you keep your code more readable.

Let let Handle

Annotate your methods requiring permissions with @AskPermission and let Let handle the rest.

@AskPermission(ACCESS_FINE_LOCATION)
private void getUserLocationAndDoSomething() {
    Toast.makeText(
        SampleActivity.this, 
        "Now that I have the permission, I'll get your location and do something with it", 
        Toast.LENGTH_SHORT
    ).show();
    ...
}
@AskPermission({
            Manifest.permission.READ_CONTACTS,
            Manifest.permission.CALL_PHONE,
            Manifest.permission.CAMERA
})
private void skipTutorial() {
    // permissions needed for best experience are granted; let' go to the app's home screen
    startActivity(new Intent(this, HomeActivity.class));
}