Loading app/src/main/java/at/bitfire/davdroid/settings/AccountSettings.kt +29 −26 Original line number Original line Diff line number Diff line Loading @@ -128,7 +128,8 @@ class AccountSettings( val taskAuthority = TaskUtils.currentProvider(context)?.authority val taskAuthority = TaskUtils.currentProvider(context)?.authority val am = AccountManager.get(context) val am = AccountManager.get(context) for (account in am.getAccountsByType(context.getString(R.string.account_type))) { for (account in am.getAccountsByType(context.getString(R.string.account_type))) try { val settings = AccountSettings(context, account) val settings = AccountSettings(context, account) // repair address book sync // repair address book sync Loading Loading @@ -160,6 +161,8 @@ class AccountSettings( settings.setSyncInterval(taskAuthority, shouldBe) settings.setSyncInterval(taskAuthority, shouldBe) } } } } } catch (ignored: InvalidAccountException) { // account doesn't exist (anymore) } } } } Loading app/src/main/java/at/bitfire/davdroid/ui/UiUtils.kt +13 −7 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,8 @@ import android.os.Build import android.widget.Toast import android.widget.Toast import androidx.core.content.getSystemService import androidx.core.content.getSystemService import at.bitfire.davdroid.R import at.bitfire.davdroid.R import at.bitfire.davdroid.log.Logger import java.util.logging.Level object UiUtils { object UiUtils { Loading @@ -27,6 +29,7 @@ object UiUtils { fun updateShortcuts(context: Context) { fun updateShortcuts(context: Context) { if (Build.VERSION.SDK_INT >= 25) if (Build.VERSION.SDK_INT >= 25) context.getSystemService<ShortcutManager>()?.let { shortcutManager -> context.getSystemService<ShortcutManager>()?.let { shortcutManager -> try { shortcutManager.dynamicShortcuts = listOf( shortcutManager.dynamicShortcuts = listOf( ShortcutInfo.Builder(context, SHORTCUT_SYNC_ALL) ShortcutInfo.Builder(context, SHORTCUT_SYNC_ALL) .setIcon(Icon.createWithResource(context, R.drawable.ic_sync_shortcut)) .setIcon(Icon.createWithResource(context, R.drawable.ic_sync_shortcut)) Loading @@ -34,6 +37,9 @@ object UiUtils { .setIntent(Intent(Intent.ACTION_SYNC, null, context, AccountsActivity::class.java)) .setIntent(Intent(Intent.ACTION_SYNC, null, context, AccountsActivity::class.java)) .build() .build() ) ) } catch(e: Exception) { Logger.log.log(Level.WARNING, "Couldn't update dynamic shortcut(s)", e) } } } } } Loading Loading
app/src/main/java/at/bitfire/davdroid/settings/AccountSettings.kt +29 −26 Original line number Original line Diff line number Diff line Loading @@ -128,7 +128,8 @@ class AccountSettings( val taskAuthority = TaskUtils.currentProvider(context)?.authority val taskAuthority = TaskUtils.currentProvider(context)?.authority val am = AccountManager.get(context) val am = AccountManager.get(context) for (account in am.getAccountsByType(context.getString(R.string.account_type))) { for (account in am.getAccountsByType(context.getString(R.string.account_type))) try { val settings = AccountSettings(context, account) val settings = AccountSettings(context, account) // repair address book sync // repair address book sync Loading Loading @@ -160,6 +161,8 @@ class AccountSettings( settings.setSyncInterval(taskAuthority, shouldBe) settings.setSyncInterval(taskAuthority, shouldBe) } } } } } catch (ignored: InvalidAccountException) { // account doesn't exist (anymore) } } } } Loading
app/src/main/java/at/bitfire/davdroid/ui/UiUtils.kt +13 −7 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,8 @@ import android.os.Build import android.widget.Toast import android.widget.Toast import androidx.core.content.getSystemService import androidx.core.content.getSystemService import at.bitfire.davdroid.R import at.bitfire.davdroid.R import at.bitfire.davdroid.log.Logger import java.util.logging.Level object UiUtils { object UiUtils { Loading @@ -27,6 +29,7 @@ object UiUtils { fun updateShortcuts(context: Context) { fun updateShortcuts(context: Context) { if (Build.VERSION.SDK_INT >= 25) if (Build.VERSION.SDK_INT >= 25) context.getSystemService<ShortcutManager>()?.let { shortcutManager -> context.getSystemService<ShortcutManager>()?.let { shortcutManager -> try { shortcutManager.dynamicShortcuts = listOf( shortcutManager.dynamicShortcuts = listOf( ShortcutInfo.Builder(context, SHORTCUT_SYNC_ALL) ShortcutInfo.Builder(context, SHORTCUT_SYNC_ALL) .setIcon(Icon.createWithResource(context, R.drawable.ic_sync_shortcut)) .setIcon(Icon.createWithResource(context, R.drawable.ic_sync_shortcut)) Loading @@ -34,6 +37,9 @@ object UiUtils { .setIntent(Intent(Intent.ACTION_SYNC, null, context, AccountsActivity::class.java)) .setIntent(Intent(Intent.ACTION_SYNC, null, context, AccountsActivity::class.java)) .build() .build() ) ) } catch(e: Exception) { Logger.log.log(Level.WARNING, "Couldn't update dynamic shortcut(s)", e) } } } } } Loading