mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-04-18 03:47:18 +02:00
Pin shortcuts only on successful accept
This commit is contained in:
parent
6766e46c37
commit
b15673b8a2
@ -234,7 +234,7 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||||||
if (resultCode == Activity.RESULT_OK && resultData != null) {
|
if (resultCode == Activity.RESULT_OK && resultData != null) {
|
||||||
val launcherApps = applicationContext.getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
val launcherApps = applicationContext.getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||||
val item = launcherApps.getPinItemRequest(resultData)
|
val item = launcherApps.getPinItemRequest(resultData)
|
||||||
item.accept()
|
if (item.accept()) {
|
||||||
val shortcutId = item.shortcutInfo?.id!!
|
val shortcutId = item.shortcutInfo?.id!!
|
||||||
val label = item.shortcutInfo.getLabel()
|
val label = item.shortcutInfo.getLabel()
|
||||||
val icon = launcherApps.getShortcutBadgedIconDrawable(item.shortcutInfo!!, resources.displayMetrics.densityDpi)
|
val icon = launcherApps.getShortcutBadgedIconDrawable(item.shortcutInfo!!, resources.displayMetrics.densityDpi)
|
||||||
@ -243,6 +243,7 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
super.onConfigurationChanged(newConfig)
|
super.onConfigurationChanged(newConfig)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user