mirror of
https://github.com/gsantner/dandelion
synced 2024-09-28 02:39:35 +02:00
fix: shortcut to launch urls
This commit is contained in:
parent
a558a463ef
commit
b0bf78dffc
|
@ -1161,11 +1161,12 @@ public class MainActivity extends ThemedActivity
|
||||||
|
|
||||||
case R.id.nav_shortcut: {
|
case R.id.nav_shortcut: {
|
||||||
Intent shortcutIntent = new Intent(MainActivity.this, MainActivity.class);
|
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
|
// The intent responsible for creating the shortcut
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
|
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));
|
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(MainActivity.this, R.drawable.ic_launcher));
|
||||||
// To install shortcut
|
// To install shortcut
|
||||||
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
|
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
|
||||||
|
|
|
@ -73,6 +73,10 @@
|
||||||
android:icon="@drawable/ic_cancel_black_48px"
|
android:icon="@drawable/ic_cancel_black_48px"
|
||||||
android:title="@string/action_exit_app"
|
android:title="@string/action_exit_app"
|
||||||
android:visible="false" />
|
android:visible="false" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_shortcut"
|
||||||
|
android:title="@string/nav_add_shortcut" />
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group android:checkableBehavior="none">
|
<group android:checkableBehavior="none">
|
||||||
|
@ -91,9 +95,6 @@
|
||||||
android:icon="@drawable/ic_info_black_48px"
|
android:icon="@drawable/ic_info_black_48px"
|
||||||
android:title="@string/nav_help_license" />
|
android:title="@string/nav_help_license" />
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/nav_shortcut"
|
|
||||||
android:title="@string/nav_add_shortcut" />
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
Loading…
Reference in a new issue