mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Added app icon shortcuts. Closes #1738.
This commit is contained in:
parent
10c6e8610a
commit
093e138fa5
@ -67,6 +67,9 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data android:name="android.app.shortcuts"
|
||||||
|
android:resource="@xml/shortcuts" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity-alias
|
<activity-alias
|
||||||
|
@ -108,6 +108,17 @@ class MainActivity : BaseActivity() {
|
|||||||
// navigate to the default fragment
|
// navigate to the default fragment
|
||||||
navController.navigate(startFragmentId)
|
navController.navigate(startFragmentId)
|
||||||
|
|
||||||
|
// open appropriate fragment from shortcut
|
||||||
|
when (intent.extras?.getString("fragmentToOpen")) {
|
||||||
|
"subscriptions" ->
|
||||||
|
navController.navigate(R.id.subscriptionsFragment)
|
||||||
|
"library" ->
|
||||||
|
navController.navigate(R.id.libraryFragment)
|
||||||
|
else -> {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
binding.bottomNav.setOnApplyWindowInsetsListener(null)
|
binding.bottomNav.setOnApplyWindowInsetsListener(null)
|
||||||
|
|
||||||
binding.bottomNav.setOnItemSelectedListener {
|
binding.bottomNav.setOnItemSelectedListener {
|
||||||
|
39
app/src/main/res/xml/shortcuts.xml
Normal file
39
app/src/main/res/xml/shortcuts.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:targetApi="25">
|
||||||
|
<shortcut
|
||||||
|
android:shortcutId="home"
|
||||||
|
android:enabled="true"
|
||||||
|
android:icon="@drawable/ic_home"
|
||||||
|
android:shortcutShortLabel="@string/startpage">
|
||||||
|
<intent
|
||||||
|
android:action="android.intent.action.VIEW"
|
||||||
|
android:targetPackage="com.github.libretube.debug"
|
||||||
|
android:targetClass="com.github.libretube.ui.activities.MainActivity" />
|
||||||
|
</shortcut>
|
||||||
|
<shortcut
|
||||||
|
android:shortcutId="subscriptions"
|
||||||
|
android:enabled="true"
|
||||||
|
android:icon="@drawable/ic_subscriptions"
|
||||||
|
android:shortcutShortLabel="@string/subscriptions">
|
||||||
|
<intent
|
||||||
|
android:action="android.intent.action.VIEW"
|
||||||
|
android:targetPackage="com.github.libretube.debug"
|
||||||
|
android:targetClass="com.github.libretube.ui.activities.MainActivity">
|
||||||
|
<extra android:name="fragmentToOpen" android:value="subscriptions"/>
|
||||||
|
</intent>
|
||||||
|
</shortcut>
|
||||||
|
<shortcut
|
||||||
|
android:shortcutId="library"
|
||||||
|
android:enabled="true"
|
||||||
|
android:icon="@drawable/ic_library"
|
||||||
|
android:shortcutShortLabel="@string/library">
|
||||||
|
<intent
|
||||||
|
android:action="android.intent.action.VIEW"
|
||||||
|
android:targetPackage="com.github.libretube.debug"
|
||||||
|
android:targetClass="com.github.libretube.ui.activities.MainActivity">
|
||||||
|
<extra android:name="fragmentToOpen" android:value="library"/>
|
||||||
|
</intent>
|
||||||
|
</shortcut>
|
||||||
|
</shortcuts>
|
Loading…
Reference in New Issue
Block a user