MatthiasRobbers / shortbread

Android library that creates app shortcuts from annotations
Apache License 2.0
1.78k stars 149 forks source link

Is there a method call back when a shortcut is received by an activity? #23

Closed Akshshr closed 6 years ago

Akshshr commented 6 years ago

Hey!

Is there/there should be a method that gets a call back declared in the activity in case one wants to further handle intent from the shortcut, so you can post process that from the call back method.

Would be really cool!

For example:

public onShortcutCalled(String shortcutId){ if(shortcutId == "profile"){ //Open profile } if(shortcutId == "cats"){ //Open cats } }

MatthiasRobbers commented 6 years ago

Hey! It should be possible but actually that is exactly what the method annotations are for.

@Shortcut(id = "profile")
public openProfile() {
    // Open profile
}

@Shortcut(id = "cats")
public openCats() {
    // Open cats
}