diff --git a/app/src/main/java/com/orgzly/android/SharingShortcutsManager.kt b/app/src/main/java/com/orgzly/android/SharingShortcutsManager.kt index a10725af8..d3e905b3b 100644 --- a/app/src/main/java/com/orgzly/android/SharingShortcutsManager.kt +++ b/app/src/main/java/com/orgzly/android/SharingShortcutsManager.kt @@ -24,13 +24,20 @@ class SharingShortcutsManager { } fun replaceDynamicShortcuts(context: Context) { - val shortcuts = createShortcuts(context) - .take(ShortcutManagerCompat.getMaxShortcutCountPerActivity(context)) + App.EXECUTORS.diskIO().execute { + val t1 = System.currentTimeMillis() - ShortcutManagerCompat.removeAllDynamicShortcuts(context) - ShortcutManagerCompat.addDynamicShortcuts(context, shortcuts) + val shortcuts = createShortcuts(context) + .take(ShortcutManagerCompat.getMaxShortcutCountPerActivity(context)) - if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, "Published ${shortcuts.size} shortcuts") + ShortcutManagerCompat.removeAllDynamicShortcuts(context) + ShortcutManagerCompat.addDynamicShortcuts(context, shortcuts) + + if (BuildConfig.LOG_DEBUG) { + val t2 = System.currentTimeMillis() + LogUtils.d(TAG, "Published ${shortcuts.size} shortcuts in ${t2 - t1}ms") + } + } } private fun createShortcuts(context: Context): List {