1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-16 01:12:08 +01:00

fix: shortcut to launch urls

This commit is contained in:
chizoba 2017-10-05 17:25:33 +01:00
parent a558a463ef
commit b0bf78dffc
2 changed files with 7 additions and 5 deletions

View file

@ -1161,11 +1161,12 @@ public class MainActivity extends ThemedActivity
case R.id.nav_shortcut: {
Intent shortcutIntent = new Intent(MainActivity.this, MainActivity.class);
shortcutIntent.setAction(Intent.ACTION_MAIN);
shortcutIntent.setAction(Intent.ACTION_VIEW);
shortcutIntent.setData(Uri.parse(urls.getStreamUrl()));
// The intent responsible for creating the shortcut
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, _appSettings.getPod().getName());
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(MainActivity.this, R.drawable.ic_launcher));
// To install shortcut
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");

View file

@ -73,6 +73,10 @@
android:icon="@drawable/ic_cancel_black_48px"
android:title="@string/action_exit_app"
android:visible="false" />
<item
android:id="@+id/nav_shortcut"
android:title="@string/nav_add_shortcut" />
</group>
<group android:checkableBehavior="none">
@ -91,9 +95,6 @@
android:icon="@drawable/ic_info_black_48px"
android:title="@string/nav_help_license" />
<item
android:id="@+id/nav_shortcut"
android:title="@string/nav_add_shortcut" />
</group>
</menu>