From 609a8f8f239bab063d43ad65a2570e92bc1a8279 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Wed, 17 Jun 2020 15:17:54 -0500 Subject: [PATCH] Move notifyChange to RefreshReceiver --- .../com/todoroo/astrid/provider/Astrid2TaskProvider.kt | 10 +--------- .../main/java/org/tasks/receivers/RefreshReceiver.java | 7 ++++++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/todoroo/astrid/provider/Astrid2TaskProvider.kt b/app/src/main/java/com/todoroo/astrid/provider/Astrid2TaskProvider.kt index 933e84677..3a5893ed4 100644 --- a/app/src/main/java/com/todoroo/astrid/provider/Astrid2TaskProvider.kt +++ b/app/src/main/java/com/todoroo/astrid/provider/Astrid2TaskProvider.kt @@ -45,7 +45,7 @@ class Astrid2TaskProvider : ContentProvider() { companion object { private const val AUTHORITY = BuildConfig.APPLICATION_ID + ".tasksprovider" - private val CONTENT_URI = Uri.parse("content://$AUTHORITY") + @JvmField val CONTENT_URI: Uri = Uri.parse("content://$AUTHORITY") private val URI_MATCHER = UriMatcher(UriMatcher.NO_MATCH) private const val NAME = "name" private const val IMPORTANCE_COLOR = "importance_color" @@ -68,14 +68,6 @@ class Astrid2TaskProvider : ContentProvider() { private const val URI_TASKS = 0 private const val URI_TAGS = 1 private const val TAG_SEPARATOR = "|" - @JvmStatic - fun notifyDatabaseModification(context: Context) { - try { - context.contentResolver.notifyChange(CONTENT_URI, null) - } catch (e: Exception) { - Timber.e(e) - } - } private fun getPriorityColor(context: Context?, priority: Int): Int { return context!!.getColor(getPriorityResId(priority)) diff --git a/app/src/main/java/org/tasks/receivers/RefreshReceiver.java b/app/src/main/java/org/tasks/receivers/RefreshReceiver.java index 29a5cc5fd..d66c4e14a 100644 --- a/app/src/main/java/org/tasks/receivers/RefreshReceiver.java +++ b/app/src/main/java/org/tasks/receivers/RefreshReceiver.java @@ -13,6 +13,7 @@ import org.tasks.R; import org.tasks.injection.InjectingJobIntentService; import org.tasks.preferences.DefaultFilterProvider; import org.tasks.preferences.Preferences; +import timber.log.Timber; @AndroidEntryPoint public class RefreshReceiver extends InjectingJobIntentService { @@ -29,6 +30,10 @@ public class RefreshReceiver extends InjectingJobIntentService { ShortcutBadger.applyCount(context, taskDao.count(badgeFilter)); } - Astrid2TaskProvider.notifyDatabaseModification(context); + try { + context.getContentResolver().notifyChange(Astrid2TaskProvider.CONTENT_URI, null); + } catch (Exception e) { + Timber.e(e); + } } }