mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
Merge pull request #3222 from Isira-Seneviratne/Report_shortcuts
Report selected shortcut to the system.
This commit is contained in:
commit
51de20cbbd
@ -13,6 +13,7 @@ import android.view.ViewGroup
|
|||||||
import android.widget.ScrollView
|
import android.widget.ScrollView
|
||||||
import androidx.activity.addCallback
|
import androidx.activity.addCallback
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
|
import androidx.core.content.pm.ShortcutManagerCompat
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.core.view.children
|
import androidx.core.view.children
|
||||||
import androidx.core.widget.NestedScrollView
|
import androidx.core.widget.NestedScrollView
|
||||||
@ -411,17 +412,18 @@ class MainActivity : BaseActivity() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
when (intent?.getStringExtra("fragmentToOpen")) {
|
intent?.getStringExtra("fragmentToOpen")?.let {
|
||||||
"home" ->
|
if (it != "downloads") { // Not a shortcut
|
||||||
navController.navigate(R.id.homeFragment)
|
ShortcutManagerCompat.reportShortcutUsed(this, it)
|
||||||
"trends" ->
|
}
|
||||||
navController.navigate(R.id.trendsFragment)
|
|
||||||
"subscriptions" ->
|
when (it) {
|
||||||
navController.navigate(R.id.subscriptionsFragment)
|
"home" -> navController.navigate(R.id.homeFragment)
|
||||||
"library" ->
|
"trends" -> navController.navigate(R.id.trendsFragment)
|
||||||
navController.navigate(R.id.libraryFragment)
|
"subscriptions" -> navController.navigate(R.id.subscriptionsFragment)
|
||||||
"downloads" ->
|
"library" -> navController.navigate(R.id.libraryFragment)
|
||||||
navController.navigate(R.id.downloadsFragment)
|
"downloads" -> navController.navigate(R.id.downloadsFragment)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (intent?.getBooleanExtra(IntentData.downloading, false) == true) {
|
if (intent?.getBooleanExtra(IntentData.downloading, false) == true) {
|
||||||
(supportFragmentManager.fragments.find { it is NavHostFragment })
|
(supportFragmentManager.fragments.find { it is NavHostFragment })
|
||||||
|
Loading…
Reference in New Issue
Block a user