Loading opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskProvider.java +20 −1 Original line number Original line Diff line number Diff line Loading @@ -151,6 +151,11 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou */ */ Handler mAsyncHandler; Handler mAsyncHandler; /** * Boolean to track if there are changes within a transaction. */ private boolean mChanged = false; /** /** * This is a per transaction/thread flag which indicates whether new lists with an unknown account have been added. * This is a per transaction/thread flag which indicates whether new lists with an unknown account have been added. * If this holds true at the end of a transaction a window should be shown to ask the user for access to that account. * If this holds true at the end of a transaction a window should be shown to ask the user for access to that account. Loading Loading @@ -757,6 +762,7 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou final ListAdapter list = new CursorContentValuesListAdapter(ListAdapter._ID.getFrom(cursor), cursor, new ContentValues()); final ListAdapter list = new CursorContentValuesListAdapter(ListAdapter._ID.getFrom(cursor), cursor, new ContentValues()); mListProcessorChain.delete(db, list, isSyncAdapter); mListProcessorChain.delete(db, list, isSyncAdapter); mChanged = true; count++; count++; } } } } Loading Loading @@ -798,6 +804,7 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou mTaskProcessorChain.delete(db, task, isSyncAdapter); mTaskProcessorChain.delete(db, task, isSyncAdapter); mChanged = true; count++; count++; } } } } Loading Loading @@ -916,6 +923,7 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou list.set(ListAdapter.ACCOUNT_TYPE, accountType); list.set(ListAdapter.ACCOUNT_TYPE, accountType); mListProcessorChain.insert(db, list, isSyncAdapter); mListProcessorChain.insert(db, list, isSyncAdapter); mChanged = true; rowId = list.id(); rowId = list.id(); result_uri = TaskContract.TaskLists.getContentUri(mAuthority); result_uri = TaskContract.TaskLists.getContentUri(mAuthority); Loading @@ -935,6 +943,8 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou mTaskProcessorChain.insert(db, task, isSyncAdapter); mTaskProcessorChain.insert(db, task, isSyncAdapter); mChanged = true; rowId = task.id(); rowId = task.id(); result_uri = TaskContract.Tasks.getContentUri(mAuthority); result_uri = TaskContract.Tasks.getContentUri(mAuthority); Loading Loading @@ -1059,6 +1069,7 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou final ListAdapter list = new CursorContentValuesListAdapter(listId, cursor, cursor.getCount() > 1 ? new ContentValues(values) : values); final ListAdapter list = new CursorContentValuesListAdapter(listId, cursor, cursor.getCount() > 1 ? new ContentValues(values) : values); mListProcessorChain.update(db, list, isSyncAdapter); mListProcessorChain.update(db, list, isSyncAdapter); mChanged = true; count++; count++; } } } } Loading Loading @@ -1086,6 +1097,10 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou final TaskAdapter task = new CursorContentValuesTaskAdapter(cursor, cursor.getCount() > 1 ? new ContentValues(values) : values); final TaskAdapter task = new CursorContentValuesTaskAdapter(cursor, cursor.getCount() > 1 ? new ContentValues(values) : values); mTaskProcessorChain.update(db, task, isSyncAdapter); mTaskProcessorChain.update(db, task, isSyncAdapter); if (task.hasUpdates()) { mChanged = true; } count++; count++; } } } } Loading Loading @@ -1298,7 +1313,11 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou { { super.onEndTransaction(callerIsSyncAdapter); super.onEndTransaction(callerIsSyncAdapter); Intent providerChangedIntent = new Intent(Intent.ACTION_PROVIDER_CHANGED, TaskContract.getContentUri(mAuthority)); Intent providerChangedIntent = new Intent(Intent.ACTION_PROVIDER_CHANGED, TaskContract.getContentUri(mAuthority)); if (mChanged) { updateNotifications(); updateNotifications(); mChanged = false; } if (Build.VERSION.SDK_INT >= 26) if (Build.VERSION.SDK_INT >= 26) { { // for now we only notify our own package // for now we only notify our own package Loading opentasks/build.gradle +1 −1 Original line number Original line Diff line number Diff line Loading @@ -90,7 +90,7 @@ dependencies { androidTestImplementation(deps.support_test_rules) { androidTestImplementation(deps.support_test_rules) { exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations' } } compile project(path: ':opentaskspal') implementation project(path: ':opentaskspal') } } if (project.hasProperty('PLAY_STORE_SERVICE_ACCOUNT_CREDENTIALS')) { if (project.hasProperty('PLAY_STORE_SERVICE_ACCOUNT_CREDENTIALS')) { Loading Loading
opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskProvider.java +20 −1 Original line number Original line Diff line number Diff line Loading @@ -151,6 +151,11 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou */ */ Handler mAsyncHandler; Handler mAsyncHandler; /** * Boolean to track if there are changes within a transaction. */ private boolean mChanged = false; /** /** * This is a per transaction/thread flag which indicates whether new lists with an unknown account have been added. * This is a per transaction/thread flag which indicates whether new lists with an unknown account have been added. * If this holds true at the end of a transaction a window should be shown to ask the user for access to that account. * If this holds true at the end of a transaction a window should be shown to ask the user for access to that account. Loading Loading @@ -757,6 +762,7 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou final ListAdapter list = new CursorContentValuesListAdapter(ListAdapter._ID.getFrom(cursor), cursor, new ContentValues()); final ListAdapter list = new CursorContentValuesListAdapter(ListAdapter._ID.getFrom(cursor), cursor, new ContentValues()); mListProcessorChain.delete(db, list, isSyncAdapter); mListProcessorChain.delete(db, list, isSyncAdapter); mChanged = true; count++; count++; } } } } Loading Loading @@ -798,6 +804,7 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou mTaskProcessorChain.delete(db, task, isSyncAdapter); mTaskProcessorChain.delete(db, task, isSyncAdapter); mChanged = true; count++; count++; } } } } Loading Loading @@ -916,6 +923,7 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou list.set(ListAdapter.ACCOUNT_TYPE, accountType); list.set(ListAdapter.ACCOUNT_TYPE, accountType); mListProcessorChain.insert(db, list, isSyncAdapter); mListProcessorChain.insert(db, list, isSyncAdapter); mChanged = true; rowId = list.id(); rowId = list.id(); result_uri = TaskContract.TaskLists.getContentUri(mAuthority); result_uri = TaskContract.TaskLists.getContentUri(mAuthority); Loading @@ -935,6 +943,8 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou mTaskProcessorChain.insert(db, task, isSyncAdapter); mTaskProcessorChain.insert(db, task, isSyncAdapter); mChanged = true; rowId = task.id(); rowId = task.id(); result_uri = TaskContract.Tasks.getContentUri(mAuthority); result_uri = TaskContract.Tasks.getContentUri(mAuthority); Loading Loading @@ -1059,6 +1069,7 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou final ListAdapter list = new CursorContentValuesListAdapter(listId, cursor, cursor.getCount() > 1 ? new ContentValues(values) : values); final ListAdapter list = new CursorContentValuesListAdapter(listId, cursor, cursor.getCount() > 1 ? new ContentValues(values) : values); mListProcessorChain.update(db, list, isSyncAdapter); mListProcessorChain.update(db, list, isSyncAdapter); mChanged = true; count++; count++; } } } } Loading Loading @@ -1086,6 +1097,10 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou final TaskAdapter task = new CursorContentValuesTaskAdapter(cursor, cursor.getCount() > 1 ? new ContentValues(values) : values); final TaskAdapter task = new CursorContentValuesTaskAdapter(cursor, cursor.getCount() > 1 ? new ContentValues(values) : values); mTaskProcessorChain.update(db, task, isSyncAdapter); mTaskProcessorChain.update(db, task, isSyncAdapter); if (task.hasUpdates()) { mChanged = true; } count++; count++; } } } } Loading Loading @@ -1298,7 +1313,11 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou { { super.onEndTransaction(callerIsSyncAdapter); super.onEndTransaction(callerIsSyncAdapter); Intent providerChangedIntent = new Intent(Intent.ACTION_PROVIDER_CHANGED, TaskContract.getContentUri(mAuthority)); Intent providerChangedIntent = new Intent(Intent.ACTION_PROVIDER_CHANGED, TaskContract.getContentUri(mAuthority)); if (mChanged) { updateNotifications(); updateNotifications(); mChanged = false; } if (Build.VERSION.SDK_INT >= 26) if (Build.VERSION.SDK_INT >= 26) { { // for now we only notify our own package // for now we only notify our own package Loading
opentasks/build.gradle +1 −1 Original line number Original line Diff line number Diff line Loading @@ -90,7 +90,7 @@ dependencies { androidTestImplementation(deps.support_test_rules) { androidTestImplementation(deps.support_test_rules) { exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations' } } compile project(path: ':opentaskspal') implementation project(path: ':opentaskspal') } } if (project.hasProperty('PLAY_STORE_SERVICE_ACCOUNT_CREDENTIALS')) { if (project.hasProperty('PLAY_STORE_SERVICE_ACCOUNT_CREDENTIALS')) { Loading