Shortcut Helper

Additional

Language
Java
Version
1.0.3 (Sep 17, 2017)
Created
May 2, 2017
Updated
Sep 17, 2017
Owner
Marcos Calvo García (marcoscgdev)
Contributor
Marcos Calvo García (marcoscgdev)
1
Activity
Badge
Generate
Download
Source code
APK file

Advertisement

Shortcut Helper  

An android library to create the new Android 7.1 shortcuts easily.


Now add the dependency to your app build.gradle file:

compile 'com.github.marcoscgdev:shortcut-helper:1.0.3'

Creating the shortcuts

You can follow this snippet:

Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/marcoscgdev/shortcut-helper"));
Intent activityIntent = new Intent(Intent.ACTION_MAIN, Uri.EMPTY, this, ShortcutActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

ShortcutHelper.with(this)
    .createShortcut(
        "Short Label",
        "Long Label",
        R.drawable.ic_shortcut_android,
        webIntent)
    .createShortcut(
        "Short Label 2",
        "Long Label 2",
        R.drawable.ic_shortcut_android,
        activityIntent)
    .go();

Shortcut list:

List<Shortcut> shortcutList = new ArrayList<Shortcut>();
shortcutList.add(new Shortcut("Short Label", "Long Label", R.drawable.ic_shortcut_android, activityIntent));
...
ShortcutHelper.with(this)
    .createShortcutList(shortcutList)
    .go();

See the


sample project to clarify any queries you may have.