From 71630d4e0b73322143baa9fc9758b11c3f6942a3 Mon Sep 17 00:00:00 2001 From: Gabor Keszthelyi Date: Wed, 26 Jul 2017 11:55:12 +0200 Subject: [PATCH] Move TaskContract to separte module. #354 (#377) --- opentasks-contract/.gitignore | 1 + opentasks-contract/build.gradle | 23 ++++ .../src/main/AndroidManifest.xml | 5 + .../dmfs/tasks/contract}/TaskContract.java | 114 ++++-------------- .../org/dmfs/tasks/contract}/UriFactory.java | 18 +-- opentasks-provider/build.gradle | 1 + .../dmfs/provider/tasks/AuthorityUtil.java | 100 +++++++++++++++ .../dmfs/provider/tasks/ContentOperation.java | 7 +- .../provider/tasks/FTSDatabaseHelper.java | 7 +- .../provider/tasks/ProviderOperationsLog.java | 2 + .../provider/tasks/TaskDatabaseHelper.java | 11 +- .../org/dmfs/provider/tasks/TaskProvider.java | 27 +++-- .../java/org/dmfs/provider/tasks/Utils.java | 13 +- .../provider/tasks/handler/AlarmHandler.java | 2 +- .../tasks/handler/CategoryHandler.java | 8 +- .../tasks/handler/PropertyHandler.java | 2 +- .../tasks/handler/PropertyHandlerFactory.java | 6 +- .../tasks/handler/RelationHandler.java | 6 +- .../tasks/model/AbstractListAdapter.java | 2 +- .../tasks/model/AbstractTaskAdapter.java | 2 +- .../tasks/model/ContentValuesListAdapter.java | 2 +- .../tasks/model/ContentValuesTaskAdapter.java | 2 +- .../model/CursorContentValuesListAdapter.java | 2 +- .../model/CursorContentValuesTaskAdapter.java | 2 +- .../provider/tasks/model/ListAdapter.java | 2 +- .../provider/tasks/model/TaskAdapter.java | 6 +- .../lists/ListExecutionProcessor.java | 2 +- .../processors/tasks/AutoUpdateProcessor.java | 4 +- .../processors/tasks/ChangeListProcessor.java | 2 +- .../processors/tasks/RelationProcessor.java | 4 +- .../tasks/TaskExecutionProcessor.java | 4 +- .../tasks/TaskInstancesProcessor.java | 4 +- .../tasks/TaskValidatorProcessor.java | 4 +- .../java/org/dmfs/tasks/EditTaskActivity.java | 6 +- .../java/org/dmfs/tasks/EditTaskFragment.java | 11 +- .../org/dmfs/tasks/ManageListActivity.java | 4 +- .../dmfs/tasks/QuickAddDialogFragment.java | 9 +- .../org/dmfs/tasks/SettingsListFragment.java | 5 +- .../org/dmfs/tasks/SyncSettingsActivity.java | 2 +- .../java/org/dmfs/tasks/TaskListActivity.java | 6 +- .../java/org/dmfs/tasks/TaskListFragment.java | 9 +- .../java/org/dmfs/tasks/ViewTaskFragment.java | 2 +- .../dmfs/tasks/dashclock/TasksExtension.java | 11 +- .../groupings/AbstractGroupingFactory.java | 2 +- .../org/dmfs/tasks/groupings/ByDueDate.java | 2 +- .../java/org/dmfs/tasks/groupings/ByList.java | 4 +- .../org/dmfs/tasks/groupings/ByPriority.java | 8 +- .../org/dmfs/tasks/groupings/ByProgress.java | 2 +- .../org/dmfs/tasks/groupings/BySearch.java | 4 +- .../org/dmfs/tasks/groupings/ByStartDate.java | 2 +- .../homescreen/TaskListSelectionFragment.java | 7 +- .../homescreen/TaskListWidgetProvider.java | 8 +- .../TaskListWidgetProviderLegacy.java | 7 +- .../TaskListWidgetUpdaterService.java | 9 +- .../org/dmfs/tasks/model/DefaultModel.java | 2 +- .../main/java/org/dmfs/tasks/model/Model.java | 6 +- .../java/org/dmfs/tasks/model/Sources.java | 5 +- .../dmfs/tasks/model/TaskFieldAdapters.java | 4 +- .../java/org/dmfs/tasks/model/XmlModel.java | 2 +- .../constraints/AdjustPercentComplete.java | 2 +- .../constraints/ChecklistConstraint.java | 2 +- .../notification/AlarmBroadcastReceiver.java | 2 +- .../NotificationUpdaterService.java | 9 +- .../notification/TaskNotificationHandler.java | 6 +- .../utils/DatabaseInitializedReceiver.java | 7 +- .../tasks/utils/SearchChildDescriptor.java | 2 +- .../tasks/utils/TasksListCursorAdapter.java | 2 +- .../utils/TasksListCursorSpinnerAdapter.java | 2 +- .../dmfs/tasks/widget/AbstractFieldView.java | 2 +- settings.gradle | 2 +- 70 files changed, 327 insertions(+), 247 deletions(-) create mode 100644 opentasks-contract/.gitignore create mode 100644 opentasks-contract/build.gradle create mode 100644 opentasks-contract/src/main/AndroidManifest.xml rename {opentasks-provider/src/main/java/org/dmfs/provider/tasks => opentasks-contract/src/main/java/org/dmfs/tasks/contract}/TaskContract.java (92%) rename {opentasks-provider/src/main/java/org/dmfs/provider/tasks => opentasks-contract/src/main/java/org/dmfs/tasks/contract}/UriFactory.java (78%) create mode 100644 opentasks-provider/src/main/java/org/dmfs/provider/tasks/AuthorityUtil.java diff --git a/opentasks-contract/.gitignore b/opentasks-contract/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/opentasks-contract/.gitignore @@ -0,0 +1 @@ +/build diff --git a/opentasks-contract/build.gradle b/opentasks-contract/build.gradle new file mode 100644 index 000000000..0f1a3a1d8 --- /dev/null +++ b/opentasks-contract/build.gradle @@ -0,0 +1,23 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion COMPILE_SDK_VERSION.toInteger() + buildToolsVersion BUILD_TOOLS_VERSION + + defaultConfig { + minSdkVersion MIN_SDK_VERSION.toInteger() + targetSdkVersion TARGET_SDK_VERSION.toInteger() + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { +} diff --git a/opentasks-contract/src/main/AndroidManifest.xml b/opentasks-contract/src/main/AndroidManifest.xml new file mode 100644 index 000000000..6506a14f9 --- /dev/null +++ b/opentasks-contract/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskContract.java b/opentasks-contract/src/main/java/org/dmfs/tasks/contract/TaskContract.java similarity index 92% rename from opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskContract.java rename to opentasks-contract/src/main/java/org/dmfs/tasks/contract/TaskContract.java index c789fd217..95ebf4528 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskContract.java +++ b/opentasks-contract/src/main/java/org/dmfs/tasks/contract/TaskContract.java @@ -14,21 +14,15 @@ * limitations under the License. */ -package org.dmfs.provider.tasks; +package org.dmfs.tasks.contract; import android.content.ContentResolver; -import android.content.Context; import android.content.Intent; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; -import android.content.pm.ProviderInfo; import android.net.Uri; import android.provider.BaseColumns; import android.provider.SyncStateContract; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -53,10 +47,6 @@ */ public final class TaskContract { - /** - * The task authority cache. - */ - private static Map sAuthorities = Collections.synchronizedMap(new HashMap(4)); private static Map sUriFactories = new HashMap(4); @@ -169,7 +159,7 @@ private TaskContract() */ public static class SyncState implements SyncStateContract.Columns, BaseColumns { - final static String CONTENT_URI_PATH = "syncstate"; + public final static String CONTENT_URI_PATH = "syncstate"; /** @@ -180,7 +170,7 @@ public static class SyncState implements SyncStateContract.Columns, BaseColumns * * @return A {@link Uri}. */ - public final static Uri getContentUri(String authority) + public static Uri getContentUri(String authority) { return getUriFactory(authority).getUri(CONTENT_URI_PATH); } @@ -196,7 +186,7 @@ public final static Uri getContentUri(String authority) * * @return A {@link Uri}. */ - public final static Uri getContentUri(String authority) + public static Uri getContentUri(String authority) { return getUriFactory(authority).getUri(); } @@ -434,7 +424,7 @@ public interface TaskListColumns */ public static final class TaskLists implements TaskListColumns, TaskListSyncColumns, CommonSyncColumns { - static final String CONTENT_URI_PATH = "tasklists"; + public static final String CONTENT_URI_PATH = "tasklists"; /** * The default sort order. @@ -457,7 +447,7 @@ public static final class TaskLists implements TaskListColumns, TaskListSyncColu * * @return A {@link Uri}. */ - public final static Uri getContentUri(String authority) + public static Uri getContentUri(String authority) { return getUriFactory(authority).getUri(CONTENT_URI_PATH); } @@ -944,11 +934,11 @@ public static final class Tasks implements TaskColumns, CommonSyncColumns, TaskS */ public static final String VISIBLE = "visible"; - static final String CONTENT_URI_PATH = "tasks"; + public static final String CONTENT_URI_PATH = "tasks"; - static final String SEARCH_URI_PATH = "tasks_search"; + public static final String SEARCH_URI_PATH = "tasks_search"; - static final String SEARCH_QUERY_PARAMETER = "q"; + public static final String SEARCH_QUERY_PARAMETER = "q"; public static final String DEFAULT_SORT_ORDER = DUE; @@ -965,13 +955,13 @@ public static final class Tasks implements TaskColumns, CommonSyncColumns, TaskS * * @return A {@link Uri}. */ - public final static Uri getContentUri(String authority) + public static Uri getContentUri(String authority) { return getUriFactory(authority).getUri(CONTENT_URI_PATH); } - public final static Uri getSearchUri(String authority, String query) + public static Uri getSearchUri(String authority, String query) { Uri.Builder builder = getUriFactory(authority).getUri(SEARCH_URI_PATH).buildUpon(); builder.appendQueryParameter(SEARCH_QUERY_PARAMETER, Uri.encode(query)); @@ -1141,7 +1131,7 @@ public static final class Instances implements TaskColumns, InstanceColumns */ public static final String VISIBLE = "visible"; - static final String CONTENT_URI_PATH = "instances"; + public static final String CONTENT_URI_PATH = "instances"; public static final String DEFAULT_SORT_ORDER = INSTANCE_DUE_SORTING; @@ -1154,7 +1144,7 @@ public static final class Instances implements TaskColumns, InstanceColumns * * @return A {@link Uri}. */ - public final static Uri getContentUri(String authority) + public static Uri getContentUri(String authority) { return getUriFactory(authority).getUri(CONTENT_URI_PATH); } @@ -1187,7 +1177,7 @@ public interface CategoriesColumns public static final class Categories implements CategoriesColumns { - static final String CONTENT_URI_PATH = "categories"; + public static final String CONTENT_URI_PATH = "categories"; public static final String DEFAULT_SORT_ORDER = NAME; @@ -1200,7 +1190,7 @@ public static final class Categories implements CategoriesColumns * * @return A {@link Uri}. */ - public final static Uri getContentUri(String authority) + public static Uri getContentUri(String authority) { return getUriFactory(authority).getUri(CONTENT_URI_PATH); } @@ -1221,7 +1211,7 @@ public interface AlarmsColumns public static final class Alarms implements AlarmsColumns { - static final String CONTENT_URI_PATH = "alarms"; + public static final String CONTENT_URI_PATH = "alarms"; /** @@ -1232,7 +1222,7 @@ public static final class Alarms implements AlarmsColumns * * @return A {@link Uri}. */ - public final static Uri getContentUri(String authority) + public static Uri getContentUri(String authority) { return getUriFactory(authority).getUri(CONTENT_URI_PATH); } @@ -1308,7 +1298,7 @@ public interface PropertyColumns public static final class Properties implements PropertySyncColumns, PropertyColumns { - static final String CONTENT_URI_PATH = "properties"; + public static final String CONTENT_URI_PATH = "properties"; public static final String DEFAULT_SORT_ORDER = DATA0; @@ -1321,7 +1311,7 @@ public static final class Properties implements PropertySyncColumns, PropertyCol * * @return A {@link Uri}. */ - public final static Uri getContentUri(String authority) + public static Uri getContentUri(String authority) { return getUriFactory(authority).getUri(CONTENT_URI_PATH); } @@ -1634,7 +1624,7 @@ public static interface Alarm extends PropertyColumns public final static String MINUTES_BEFORE = DATA0; /** - * The reference date for the alarm. Either {@link ALARM_REFERENCE_DUE_DATE} or {@link ALARM_REFERENCE_START_DATE}. + * The reference date for the alarm. Either {@link #ALARM_REFERENCE_DUE_DATE} or {@link #ALARM_REFERENCE_START_DATE}. *

* Value: Integer *

@@ -1650,8 +1640,8 @@ public static interface Alarm extends PropertyColumns public final static String MESSAGE = DATA2; /** - * The type of the alarm. Use the provided alarm types {@link ALARM_TYPE_MESSAGE}, {@link ALARM_TYPE_SOUND}, {@link ALARM_TYPE_NOTHING}, - * {@link ALARM_TYPE_EMAIL} and {@link ALARM_TYPE_SMS}. + * The type of the alarm. Use the provided alarm types {@link #ALARM_TYPE_MESSAGE}, {@link #ALARM_TYPE_SOUND}, {@link #ALARM_TYPE_NOTHING}, + * {@link #ALARM_TYPE_EMAIL} and {@link #ALARM_TYPE_SMS}. *

* Value: Integer *

@@ -1682,64 +1672,4 @@ private static synchronized UriFactory getUriFactory(String authority) return uriFactory; } - - /** - * Returns the authority of the {@link TaskProvider} in the given {@link Context}. - *

- * TODO: create an Authority class instead that handles everything about authorities. It could replace {@link UriFactory} as well. The Authority class could - * have a generic parameter that identifies the authority provider or contract class. - * - * @param context - * A {@link Context} of an app that contains a {@link TaskProvider}. - * - * @return The authority. - * - * @throws RuntimeException - * if there is no {@link TaskProvider} in that {@link Context}. - */ - public static synchronized String taskAuthority(Context context) - { - String packageName = context.getPackageName(); - if (sAuthorities.containsKey(packageName)) - { - return sAuthorities.get(packageName); - } - - PackageManager packageManager = context.getPackageManager(); - - // first get the PackageInfo of this app. - PackageInfo packageInfo; - try - { - packageInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_PROVIDERS); - } - catch (NameNotFoundException e) - { - throw new RuntimeException("Could not find TaskProvider!", e); - } - - // next scan all providers for TaskProvider - for (ProviderInfo provider : packageInfo.providers) - { - Class providerClass; - try - { - providerClass = Class.forName(provider.name); - } - catch (ClassNotFoundException e) - { - continue; - } - - if (!TaskProvider.class.isAssignableFrom(providerClass)) - { - continue; - } - - sAuthorities.put(packageName, provider.authority); - return provider.authority; - } - throw new RuntimeException("Could not find TaskProvider! Make sure you added it to your AndroidManifest.xml."); - } - } diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/UriFactory.java b/opentasks-contract/src/main/java/org/dmfs/tasks/contract/UriFactory.java similarity index 78% rename from opentasks-provider/src/main/java/org/dmfs/provider/tasks/UriFactory.java rename to opentasks-contract/src/main/java/org/dmfs/tasks/contract/UriFactory.java index a13f51e50..8efbd7fc0 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/UriFactory.java +++ b/opentasks-contract/src/main/java/org/dmfs/tasks/contract/UriFactory.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.dmfs.provider.tasks; +package org.dmfs.tasks.contract; import android.net.Uri; @@ -22,33 +22,35 @@ import java.util.Map; -public class UriFactory +/** + * TODO + */ +public final class UriFactory { - public final String authority; - + private final String mAuthority; private final Map mUriMap = new HashMap(16); UriFactory(String authority) { - this.authority = authority; + mAuthority = authority; mUriMap.put((String) null, Uri.parse("content://" + authority)); } void addUri(String path) { - mUriMap.put(path, Uri.parse("content://" + authority + "/" + path)); + mUriMap.put(path, Uri.parse("content://" + mAuthority + "/" + path)); } - public Uri getUri() + Uri getUri() { return mUriMap.get(null); } - public Uri getUri(String path) + Uri getUri(String path) { return mUriMap.get(path); } diff --git a/opentasks-provider/build.gradle b/opentasks-provider/build.gradle index 7206bd7ab..f9c174d79 100644 --- a/opentasks-provider/build.gradle +++ b/opentasks-provider/build.gradle @@ -22,5 +22,6 @@ android { dependencies { compile('org.dmfs:rfc5545-datetime:0.2.4') compile('org.dmfs:lib-recur:0.9.6') + compile project(':opentasks-contract') testCompile 'junit:junit:4.12' } diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/AuthorityUtil.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/AuthorityUtil.java new file mode 100644 index 000000000..efb67afcd --- /dev/null +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/AuthorityUtil.java @@ -0,0 +1,100 @@ +/* + * Copyright 2017 dmfs GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.dmfs.provider.tasks; + +import android.content.Context; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.ProviderInfo; + +import org.dmfs.tasks.contract.UriFactory; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + + +/** + * TODO + */ +public final class AuthorityUtil +{ + /** + * The task authority cache. + */ + private static Map sAuthorities = Collections.synchronizedMap(new HashMap(4)); + + + /** + * Returns the authority of the {@link TaskProvider} in the given {@link Context}. + *

+ * TODO: create an Authority class instead that handles everything about authorities. It could replace {@link UriFactory} as well. The Authority class could + * have a generic parameter that identifies the authority provider or contract class. + * + * @param context + * A {@link Context} of an app that contains a {@link TaskProvider}. + * + * @return The authority. + * + * @throws RuntimeException + * if there is no {@link TaskProvider} in that {@link Context}. + */ + public static synchronized String taskAuthority(Context context) + { + String packageName = context.getPackageName(); + if (sAuthorities.containsKey(packageName)) + { + return sAuthorities.get(packageName); + } + + PackageManager packageManager = context.getPackageManager(); + + // first get the PackageInfo of this app. + PackageInfo packageInfo; + try + { + packageInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_PROVIDERS); + } + catch (PackageManager.NameNotFoundException e) + { + throw new RuntimeException("Could not find TaskProvider!", e); + } + + // next scan all providers for TaskProvider + for (ProviderInfo provider : packageInfo.providers) + { + Class providerClass; + try + { + providerClass = Class.forName(provider.name); + } + catch (ClassNotFoundException e) + { + continue; + } + + if (!TaskProvider.class.isAssignableFrom(providerClass)) + { + continue; + } + + sAuthorities.put(packageName, provider.authority); + return provider.authority; + } + throw new RuntimeException("Could not find TaskProvider! Make sure you added it to your AndroidManifest.xml."); + } +} diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/ContentOperation.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/ContentOperation.java index 37c961d6e..96d05d38d 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/ContentOperation.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/ContentOperation.java @@ -30,12 +30,13 @@ import android.os.Handler; import android.util.Log; -import org.dmfs.provider.tasks.TaskContract.Instances; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.model.CursorContentValuesTaskAdapter; import org.dmfs.provider.tasks.model.TaskAdapter; import org.dmfs.provider.tasks.processors.tasks.TaskInstancesProcessor; import org.dmfs.rfc5545.DateTime; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.Tasks; import java.util.TimeZone; @@ -338,7 +339,7 @@ private ContentOperation(OperationHandler handler) */ public void fire(Context context, ContentValues values) { - context.getContentResolver().update(uri(TaskContract.taskAuthority(context)), values == null ? new ContentValues() : values, null, null); + context.getContentResolver().update(uri(AuthorityUtil.taskAuthority(context)), values == null ? new ContentValues() : values, null, null); } diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/FTSDatabaseHelper.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/FTSDatabaseHelper.java index 32e797b3f..b31af8993 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/FTSDatabaseHelper.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/FTSDatabaseHelper.java @@ -22,11 +22,12 @@ import android.text.TextUtils; import org.dmfs.ngrams.NGramGenerator; -import org.dmfs.provider.tasks.TaskContract.Properties; -import org.dmfs.provider.tasks.TaskContract.TaskColumns; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables; import org.dmfs.provider.tasks.model.TaskAdapter; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Properties; +import org.dmfs.tasks.contract.TaskContract.TaskColumns; +import org.dmfs.tasks.contract.TaskContract.Tasks; import java.util.HashSet; import java.util.Set; diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/ProviderOperationsLog.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/ProviderOperationsLog.java index 7b7b451d5..d04191963 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/ProviderOperationsLog.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/ProviderOperationsLog.java @@ -19,6 +19,8 @@ import android.net.Uri; import android.os.Bundle; +import org.dmfs.tasks.contract.TaskContract; + import java.util.ArrayList; diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskDatabaseHelper.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskDatabaseHelper.java index 9ce22f2dc..01b855273 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskDatabaseHelper.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskDatabaseHelper.java @@ -22,11 +22,12 @@ import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; -import org.dmfs.provider.tasks.TaskContract.Properties; -import org.dmfs.provider.tasks.TaskContract.Property.Alarm; -import org.dmfs.provider.tasks.TaskContract.Property.Category; -import org.dmfs.provider.tasks.TaskContract.TaskLists; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Properties; +import org.dmfs.tasks.contract.TaskContract.Property.Alarm; +import org.dmfs.tasks.contract.TaskContract.Property.Category; +import org.dmfs.tasks.contract.TaskContract.TaskLists; +import org.dmfs.tasks.contract.TaskContract.Tasks; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskProvider.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskProvider.java index 50608a0fb..4cde853c1 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskProvider.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/TaskProvider.java @@ -44,18 +44,6 @@ import android.os.HandlerThread; import android.text.TextUtils; -import org.dmfs.provider.tasks.TaskContract.Alarms; -import org.dmfs.provider.tasks.TaskContract.Categories; -import org.dmfs.provider.tasks.TaskContract.CategoriesColumns; -import org.dmfs.provider.tasks.TaskContract.Instances; -import org.dmfs.provider.tasks.TaskContract.Properties; -import org.dmfs.provider.tasks.TaskContract.PropertyColumns; -import org.dmfs.provider.tasks.TaskContract.SyncState; -import org.dmfs.provider.tasks.TaskContract.TaskColumns; -import org.dmfs.provider.tasks.TaskContract.TaskListColumns; -import org.dmfs.provider.tasks.TaskContract.TaskListSyncColumns; -import org.dmfs.provider.tasks.TaskContract.TaskLists; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.TaskDatabaseHelper.OnDatabaseOperationListener; import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables; import org.dmfs.provider.tasks.handler.PropertyHandler; @@ -76,6 +64,19 @@ import org.dmfs.provider.tasks.processors.tasks.TaskExecutionProcessor; import org.dmfs.provider.tasks.processors.tasks.TaskInstancesProcessor; import org.dmfs.provider.tasks.processors.tasks.TaskValidatorProcessor; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Alarms; +import org.dmfs.tasks.contract.TaskContract.Categories; +import org.dmfs.tasks.contract.TaskContract.CategoriesColumns; +import org.dmfs.tasks.contract.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.Properties; +import org.dmfs.tasks.contract.TaskContract.PropertyColumns; +import org.dmfs.tasks.contract.TaskContract.SyncState; +import org.dmfs.tasks.contract.TaskContract.TaskColumns; +import org.dmfs.tasks.contract.TaskContract.TaskListColumns; +import org.dmfs.tasks.contract.TaskContract.TaskListSyncColumns; +import org.dmfs.tasks.contract.TaskContract.TaskLists; +import org.dmfs.tasks.contract.TaskContract.Tasks; import java.util.ArrayList; import java.util.Arrays; @@ -758,7 +759,7 @@ public int deleteInTransaction(final SQLiteDatabase db, Uri uri, String selectio } /* - * Task won't be removed, just marked as deleted if the caller isn't a sync adapter. Sync adapters can remove tasks immediately. + * Task won't be removed, just marked as deleted if the caller isn't a sync adapter. Sync adapters can remove tasks immediately. */ case TASK_ID: // add id to selection and fall through diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/Utils.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/Utils.java index 3ed1b9ffe..1298e53db 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/Utils.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/Utils.java @@ -23,13 +23,14 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract.Instances; -import org.dmfs.provider.tasks.TaskContract.SyncState; -import org.dmfs.provider.tasks.TaskContract.TaskListColumns; -import org.dmfs.provider.tasks.TaskContract.TaskListSyncColumns; -import org.dmfs.provider.tasks.TaskContract.TaskLists; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.SyncState; +import org.dmfs.tasks.contract.TaskContract.TaskListColumns; +import org.dmfs.tasks.contract.TaskContract.TaskListSyncColumns; +import org.dmfs.tasks.contract.TaskContract.TaskLists; +import org.dmfs.tasks.contract.TaskContract.Tasks; import java.util.ArrayList; import java.util.Arrays; diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/AlarmHandler.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/AlarmHandler.java index 410aa20ee..4882d2199 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/AlarmHandler.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/AlarmHandler.java @@ -20,7 +20,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract.Property; +import org.dmfs.tasks.contract.TaskContract.Property; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/CategoryHandler.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/CategoryHandler.java index 8a4afb8ed..8c129cb04 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/CategoryHandler.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/CategoryHandler.java @@ -20,12 +20,12 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract.Categories; -import org.dmfs.provider.tasks.TaskContract.Properties; -import org.dmfs.provider.tasks.TaskContract.Property.Category; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.TaskDatabaseHelper.CategoriesMapping; import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables; +import org.dmfs.tasks.contract.TaskContract.Categories; +import org.dmfs.tasks.contract.TaskContract.Properties; +import org.dmfs.tasks.contract.TaskContract.Property.Category; +import org.dmfs.tasks.contract.TaskContract.Tasks; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/PropertyHandler.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/PropertyHandler.java index 9a5a8a405..39d8875d1 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/PropertyHandler.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/PropertyHandler.java @@ -21,8 +21,8 @@ import android.database.sqlite.SQLiteDatabase; import org.dmfs.provider.tasks.FTSDatabaseHelper; -import org.dmfs.provider.tasks.TaskContract.Properties; import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables; +import org.dmfs.tasks.contract.TaskContract.Properties; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/PropertyHandlerFactory.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/PropertyHandlerFactory.java index efa10d2f1..0e1946338 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/PropertyHandlerFactory.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/PropertyHandlerFactory.java @@ -16,9 +16,9 @@ package org.dmfs.provider.tasks.handler; -import org.dmfs.provider.tasks.TaskContract.Property.Alarm; -import org.dmfs.provider.tasks.TaskContract.Property.Category; -import org.dmfs.provider.tasks.TaskContract.Property.Relation; +import org.dmfs.tasks.contract.TaskContract.Property.Alarm; +import org.dmfs.tasks.contract.TaskContract.Property.Category; +import org.dmfs.tasks.contract.TaskContract.Property.Relation; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/RelationHandler.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/RelationHandler.java index baca89eac..5ae791275 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/RelationHandler.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/handler/RelationHandler.java @@ -20,10 +20,10 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract.Property.Relation; -import org.dmfs.provider.tasks.TaskContract.Property.Relation.RelType; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.TaskDatabaseHelper; +import org.dmfs.tasks.contract.TaskContract.Property.Relation; +import org.dmfs.tasks.contract.TaskContract.Property.Relation.RelType; +import org.dmfs.tasks.contract.TaskContract.Tasks; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/AbstractListAdapter.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/AbstractListAdapter.java index cdd897d98..80478e3e7 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/AbstractListAdapter.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/AbstractListAdapter.java @@ -20,8 +20,8 @@ import android.content.ContentValues; import android.net.Uri; -import org.dmfs.provider.tasks.TaskContract; import org.dmfs.provider.tasks.model.adapters.FieldAdapter; +import org.dmfs.tasks.contract.TaskContract; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/AbstractTaskAdapter.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/AbstractTaskAdapter.java index 8e2a80043..5fc1e7330 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/AbstractTaskAdapter.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/AbstractTaskAdapter.java @@ -20,8 +20,8 @@ import android.content.ContentValues; import android.net.Uri; -import org.dmfs.provider.tasks.TaskContract; import org.dmfs.provider.tasks.model.adapters.FieldAdapter; +import org.dmfs.tasks.contract.TaskContract; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ContentValuesListAdapter.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ContentValuesListAdapter.java index 3be90239f..c194a4170 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ContentValuesListAdapter.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ContentValuesListAdapter.java @@ -19,9 +19,9 @@ import android.content.ContentValues; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract; import org.dmfs.provider.tasks.TaskDatabaseHelper; import org.dmfs.provider.tasks.model.adapters.FieldAdapter; +import org.dmfs.tasks.contract.TaskContract; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ContentValuesTaskAdapter.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ContentValuesTaskAdapter.java index c73687ce1..7957d30ba 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ContentValuesTaskAdapter.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ContentValuesTaskAdapter.java @@ -19,9 +19,9 @@ import android.content.ContentValues; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract; import org.dmfs.provider.tasks.TaskDatabaseHelper; import org.dmfs.provider.tasks.model.adapters.FieldAdapter; +import org.dmfs.tasks.contract.TaskContract; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/CursorContentValuesListAdapter.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/CursorContentValuesListAdapter.java index 256396234..b4cf04408 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/CursorContentValuesListAdapter.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/CursorContentValuesListAdapter.java @@ -20,9 +20,9 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract; import org.dmfs.provider.tasks.TaskDatabaseHelper; import org.dmfs.provider.tasks.model.adapters.FieldAdapter; +import org.dmfs.tasks.contract.TaskContract; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/CursorContentValuesTaskAdapter.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/CursorContentValuesTaskAdapter.java index 18789874f..711ae945d 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/CursorContentValuesTaskAdapter.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/CursorContentValuesTaskAdapter.java @@ -20,9 +20,9 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract; import org.dmfs.provider.tasks.TaskDatabaseHelper; import org.dmfs.provider.tasks.model.adapters.FieldAdapter; +import org.dmfs.tasks.contract.TaskContract; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ListAdapter.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ListAdapter.java index dcac94463..b2c8bca38 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ListAdapter.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/ListAdapter.java @@ -19,10 +19,10 @@ import android.content.ContentValues; import android.database.Cursor; -import org.dmfs.provider.tasks.TaskContract.TaskLists; import org.dmfs.provider.tasks.model.adapters.IntegerFieldAdapter; import org.dmfs.provider.tasks.model.adapters.LongFieldAdapter; import org.dmfs.provider.tasks.model.adapters.StringFieldAdapter; +import org.dmfs.tasks.contract.TaskContract.TaskLists; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/TaskAdapter.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/TaskAdapter.java index 772b018dd..536d04e73 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/TaskAdapter.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/model/TaskAdapter.java @@ -19,9 +19,6 @@ import android.content.ContentValues; import android.database.Cursor; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Instances; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.model.adapters.BinaryFieldAdapter; import org.dmfs.provider.tasks.model.adapters.BooleanFieldAdapter; import org.dmfs.provider.tasks.model.adapters.DateTimeArrayFieldAdapter; @@ -32,6 +29,9 @@ import org.dmfs.provider.tasks.model.adapters.RRuleFieldAdapter; import org.dmfs.provider.tasks.model.adapters.StringFieldAdapter; import org.dmfs.provider.tasks.model.adapters.UrlFieldAdapter; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.Tasks; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/lists/ListExecutionProcessor.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/lists/ListExecutionProcessor.java index bb528f6c4..e0a6b4af4 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/lists/ListExecutionProcessor.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/lists/ListExecutionProcessor.java @@ -18,10 +18,10 @@ import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract; import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables; import org.dmfs.provider.tasks.model.ListAdapter; import org.dmfs.provider.tasks.processors.AbstractEntityProcessor; +import org.dmfs.tasks.contract.TaskContract; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/AutoUpdateProcessor.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/AutoUpdateProcessor.java index 8c2a0cc24..f8bca0b74 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/AutoUpdateProcessor.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/AutoUpdateProcessor.java @@ -20,13 +20,13 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.TaskDatabaseHelper; import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables; import org.dmfs.provider.tasks.model.TaskAdapter; import org.dmfs.provider.tasks.processors.AbstractEntityProcessor; import org.dmfs.rfc5545.DateTime; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Tasks; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/ChangeListProcessor.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/ChangeListProcessor.java index 7c303dcf6..fa91dc4ed 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/ChangeListProcessor.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/ChangeListProcessor.java @@ -20,11 +20,11 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract; import org.dmfs.provider.tasks.TaskDatabaseHelper; import org.dmfs.provider.tasks.model.CursorContentValuesTaskAdapter; import org.dmfs.provider.tasks.model.TaskAdapter; import org.dmfs.provider.tasks.processors.AbstractEntityProcessor; +import org.dmfs.tasks.contract.TaskContract; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/RelationProcessor.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/RelationProcessor.java index 3f35d1fa9..6c1e1bcdb 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/RelationProcessor.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/RelationProcessor.java @@ -19,11 +19,11 @@ import android.content.ContentValues; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract.Property.Relation; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.TaskDatabaseHelper; import org.dmfs.provider.tasks.model.TaskAdapter; import org.dmfs.provider.tasks.processors.AbstractEntityProcessor; +import org.dmfs.tasks.contract.TaskContract.Property.Relation; +import org.dmfs.tasks.contract.TaskContract.Tasks; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskExecutionProcessor.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskExecutionProcessor.java index cafa2f6a5..b6d39e2a9 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskExecutionProcessor.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskExecutionProcessor.java @@ -18,11 +18,11 @@ import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.TaskColumns; import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables; import org.dmfs.provider.tasks.model.TaskAdapter; import org.dmfs.provider.tasks.processors.AbstractEntityProcessor; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.TaskColumns; /** diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskInstancesProcessor.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskInstancesProcessor.java index c604df47a..8e974f3ec 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskInstancesProcessor.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskInstancesProcessor.java @@ -20,14 +20,14 @@ import android.database.sqlite.SQLiteDatabase; import android.net.Uri; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Instances; import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables; import org.dmfs.provider.tasks.model.TaskAdapter; import org.dmfs.provider.tasks.model.adapters.BooleanFieldAdapter; import org.dmfs.provider.tasks.processors.AbstractEntityProcessor; import org.dmfs.rfc5545.DateTime; import org.dmfs.rfc5545.Duration; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Instances; import java.sql.RowId; import java.util.TimeZone; diff --git a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskValidatorProcessor.java b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskValidatorProcessor.java index d5008c457..c86eda6a9 100644 --- a/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskValidatorProcessor.java +++ b/opentasks-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/TaskValidatorProcessor.java @@ -19,12 +19,12 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import org.dmfs.provider.tasks.TaskContract.TaskLists; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables; import org.dmfs.provider.tasks.model.TaskAdapter; import org.dmfs.provider.tasks.processors.AbstractEntityProcessor; import org.dmfs.rfc5545.Duration; +import org.dmfs.tasks.contract.TaskContract.TaskLists; +import org.dmfs.tasks.contract.TaskContract.Tasks; /** diff --git a/opentasks/src/main/java/org/dmfs/tasks/EditTaskActivity.java b/opentasks/src/main/java/org/dmfs/tasks/EditTaskActivity.java index 9172dced9..6776d502c 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/EditTaskActivity.java +++ b/opentasks/src/main/java/org/dmfs/tasks/EditTaskActivity.java @@ -25,8 +25,8 @@ import android.view.Menu; import android.view.MenuItem; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.ContentSet; import org.dmfs.tasks.utils.ActionBarActivity; @@ -62,7 +62,7 @@ protected void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.activity_task_editor); - mAuthority = TaskContract.taskAuthority(this); + mAuthority = AuthorityUtil.taskAuthority(this); if (android.os.Build.VERSION.SDK_INT >= 11) { diff --git a/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java b/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java index ff5e91ad3..f26304be3 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/EditTaskFragment.java @@ -50,9 +50,10 @@ import org.dmfs.android.retentionmagic.SupportFragment; import org.dmfs.android.retentionmagic.annotations.Parameter; import org.dmfs.android.retentionmagic.annotations.Retain; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.TaskLists; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.TaskLists; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.CheckListItem; import org.dmfs.tasks.model.ContentSet; import org.dmfs.tasks.model.Model; @@ -207,7 +208,7 @@ public void onCreate(Bundle savedInstanceState) public void onAttach(Activity activity) { super.onAttach(activity); - mAuthority = TaskContract.taskAuthority(activity); + mAuthority = AuthorityUtil.taskAuthority(activity); Bundle bundle = getArguments(); // check for supplied task information from intent @@ -569,7 +570,7 @@ public void onContentLoaded(ContentSet contentSet) } /* - * Don't start the model loader here, let onItemSelected do that. + * Don't start the model loader here, let onItemSelected do that. */ setListUri(TaskLists.getContentUri(mAuthority), LIST_LOADER_VISIBLE_LISTS_FILTER); } diff --git a/opentasks/src/main/java/org/dmfs/tasks/ManageListActivity.java b/opentasks/src/main/java/org/dmfs/tasks/ManageListActivity.java index 212e90804..f2f6e22f8 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/ManageListActivity.java +++ b/opentasks/src/main/java/org/dmfs/tasks/ManageListActivity.java @@ -35,9 +35,9 @@ import org.dmfs.android.colorpicker.ColorPickerActivity; import org.dmfs.android.colorpicker.palettes.RandomPalette; import org.dmfs.android.retentionmagic.annotations.Retain; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.TaskLists; import org.dmfs.tasks.InputTextDialogFragment.InputTextListener; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.TaskLists; import org.dmfs.tasks.utils.ActionBarActivity; diff --git a/opentasks/src/main/java/org/dmfs/tasks/QuickAddDialogFragment.java b/opentasks/src/main/java/org/dmfs/tasks/QuickAddDialogFragment.java index 20ffbf596..738c093e6 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/QuickAddDialogFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/QuickAddDialogFragment.java @@ -51,9 +51,10 @@ import org.dmfs.android.retentionmagic.SupportDialogFragment; import org.dmfs.android.retentionmagic.annotations.Parameter; import org.dmfs.android.retentionmagic.annotations.Retain; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.TaskLists; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.TaskLists; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.ContentSet; import org.dmfs.tasks.model.TaskFieldAdapters; import org.dmfs.tasks.utils.RecentlyUsedLists; @@ -254,7 +255,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa mSaveAndNextButton.setOnClickListener(this); view.findViewById(android.R.id.edit).setOnClickListener(this); - mAuthority = TaskContract.taskAuthority(getActivity()); + mAuthority = AuthorityUtil.taskAuthority(getActivity()); afterTextChanged(mEditText.getEditableText()); diff --git a/opentasks/src/main/java/org/dmfs/tasks/SettingsListFragment.java b/opentasks/src/main/java/org/dmfs/tasks/SettingsListFragment.java index 7b7efca0e..001ca1b09 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/SettingsListFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/SettingsListFragment.java @@ -47,7 +47,8 @@ import android.widget.Toast; import org.dmfs.android.widgets.ColoredShapeCheckBox; -import org.dmfs.provider.tasks.TaskContract; +import org.dmfs.provider.tasks.AuthorityUtil; +import org.dmfs.tasks.contract.TaskContract; import org.dmfs.tasks.model.Model; import org.dmfs.tasks.model.Sources; @@ -239,7 +240,7 @@ public void onAttach(Activity activity) super.onAttach(activity); mSources = Sources.getInstance(activity); mContext = activity.getBaseContext(); - mAuthority = TaskContract.taskAuthority(activity); + mAuthority = AuthorityUtil.taskAuthority(activity); } diff --git a/opentasks/src/main/java/org/dmfs/tasks/SyncSettingsActivity.java b/opentasks/src/main/java/org/dmfs/tasks/SyncSettingsActivity.java index 596eb26cc..8ad1ef40a 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/SyncSettingsActivity.java +++ b/opentasks/src/main/java/org/dmfs/tasks/SyncSettingsActivity.java @@ -24,7 +24,7 @@ import android.view.View; import android.widget.Button; -import org.dmfs.provider.tasks.TaskContract; +import org.dmfs.tasks.contract.TaskContract; /** diff --git a/opentasks/src/main/java/org/dmfs/tasks/TaskListActivity.java b/opentasks/src/main/java/org/dmfs/tasks/TaskListActivity.java index 2757b4c50..8ff9f3dd8 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/TaskListActivity.java +++ b/opentasks/src/main/java/org/dmfs/tasks/TaskListActivity.java @@ -51,8 +51,8 @@ import android.view.WindowManager; import org.dmfs.android.retentionmagic.annotations.Retain; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.groupings.AbstractGroupingFactory; import org.dmfs.tasks.groupings.ByDueDate; import org.dmfs.tasks.groupings.ByList; @@ -225,7 +225,7 @@ protected void onCreate(Bundle savedInstanceState) Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); - mAuthority = TaskContract.taskAuthority(this); + mAuthority = AuthorityUtil.taskAuthority(this); mSearchHistoryHelper = new SearchHistoryHelper(this); if (findViewById(R.id.task_detail_container) != null) diff --git a/opentasks/src/main/java/org/dmfs/tasks/TaskListFragment.java b/opentasks/src/main/java/org/dmfs/tasks/TaskListFragment.java index 9ba4df69f..abf15a25d 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/TaskListFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/TaskListFragment.java @@ -54,9 +54,10 @@ import org.dmfs.android.retentionmagic.SupportFragment; import org.dmfs.android.retentionmagic.annotations.Parameter; import org.dmfs.android.retentionmagic.annotations.Retain; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Instances; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.groupings.ByDueDate; import org.dmfs.tasks.groupings.ByList; import org.dmfs.tasks.groupings.filters.AbstractFilter; @@ -245,7 +246,7 @@ public TaskListFragment() public void onAttach(Activity activity) { super.onAttach(activity); - mAuthority = TaskContract.taskAuthority(activity); + mAuthority = AuthorityUtil.taskAuthority(activity); mAppContext = activity.getBaseContext(); diff --git a/opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java b/opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java index abb117fb3..f788d5cfa 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java @@ -52,7 +52,7 @@ import org.dmfs.android.retentionmagic.SupportFragment; import org.dmfs.android.retentionmagic.annotations.Parameter; import org.dmfs.android.retentionmagic.annotations.Retain; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.ContentSet; import org.dmfs.tasks.model.Model; import org.dmfs.tasks.model.OnContentChangeListener; diff --git a/opentasks/src/main/java/org/dmfs/tasks/dashclock/TasksExtension.java b/opentasks/src/main/java/org/dmfs/tasks/dashclock/TasksExtension.java index 2943d0734..a814cac6f 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/dashclock/TasksExtension.java +++ b/opentasks/src/main/java/org/dmfs/tasks/dashclock/TasksExtension.java @@ -26,11 +26,12 @@ import com.google.android.apps.dashclock.api.DashClockExtension; import com.google.android.apps.dashclock.api.ExtensionData; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Instances; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; import org.dmfs.tasks.EditTaskActivity; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.TaskFieldAdapters; import org.dmfs.tasks.model.adapters.TimeFieldAdapter; import org.dmfs.tasks.utils.DateFormatter; @@ -86,7 +87,7 @@ public class TasksExtension extends DashClockExtension protected void onInitialize(boolean isReconnect) { // enable automatic dashclock updates on task changes - addWatchContentUris(new String[] { TaskContract.getContentUri(TaskContract.taskAuthority(this)).toString() }); + addWatchContentUris(new String[] { TaskContract.getContentUri(AuthorityUtil.taskAuthority(this)).toString() }); super.onInitialize(isReconnect); mDateFormatter = new DateFormatter(this); @@ -97,7 +98,7 @@ protected void onInitialize(boolean isReconnect) protected void onUpdateData(int reason) { mNow = System.currentTimeMillis(); - mAuthority = TaskContract.taskAuthority(this); + mAuthority = AuthorityUtil.taskAuthority(this); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); mDisplayMode = Integer.valueOf(sharedPref.getString(DashClockPreferenceActivity.KEY_PREF_DISPLAY_MODE, "1")); publishRecentTaskUpdate(); diff --git a/opentasks/src/main/java/org/dmfs/tasks/groupings/AbstractGroupingFactory.java b/opentasks/src/main/java/org/dmfs/tasks/groupings/AbstractGroupingFactory.java index e377d4038..d37d2b0f7 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/groupings/AbstractGroupingFactory.java +++ b/opentasks/src/main/java/org/dmfs/tasks/groupings/AbstractGroupingFactory.java @@ -16,7 +16,7 @@ package org.dmfs.tasks.groupings; -import org.dmfs.provider.tasks.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.Instances; import org.dmfs.tasks.model.adapters.TimeFieldAdapter; import org.dmfs.tasks.utils.ExpandableChildDescriptor; import org.dmfs.tasks.utils.ExpandableGroupDescriptor; diff --git a/opentasks/src/main/java/org/dmfs/tasks/groupings/ByDueDate.java b/opentasks/src/main/java/org/dmfs/tasks/groupings/ByDueDate.java index 9a0d697ae..223c034e5 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/groupings/ByDueDate.java +++ b/opentasks/src/main/java/org/dmfs/tasks/groupings/ByDueDate.java @@ -27,8 +27,8 @@ import android.widget.BaseExpandableListAdapter; import android.widget.TextView; -import org.dmfs.provider.tasks.TaskContract.Instances; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract.Instances; import org.dmfs.tasks.groupings.cursorloaders.TimeRangeCursorFactory; import org.dmfs.tasks.groupings.cursorloaders.TimeRangeCursorLoaderFactory; import org.dmfs.tasks.groupings.cursorloaders.TimeRangeShortCursorFactory; diff --git a/opentasks/src/main/java/org/dmfs/tasks/groupings/ByList.java b/opentasks/src/main/java/org/dmfs/tasks/groupings/ByList.java index 8f4a60304..8deaeec09 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/groupings/ByList.java +++ b/opentasks/src/main/java/org/dmfs/tasks/groupings/ByList.java @@ -28,10 +28,10 @@ import android.widget.BaseExpandableListAdapter; import android.widget.TextView; -import org.dmfs.provider.tasks.TaskContract.Instances; -import org.dmfs.provider.tasks.TaskContract.TaskLists; import org.dmfs.tasks.QuickAddDialogFragment; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.TaskLists; import org.dmfs.tasks.groupings.cursorloaders.CursorLoaderFactory; import org.dmfs.tasks.model.TaskFieldAdapters; import org.dmfs.tasks.utils.ExpandableChildDescriptor; diff --git a/opentasks/src/main/java/org/dmfs/tasks/groupings/ByPriority.java b/opentasks/src/main/java/org/dmfs/tasks/groupings/ByPriority.java index 5927fccc8..dda414ae3 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/groupings/ByPriority.java +++ b/opentasks/src/main/java/org/dmfs/tasks/groupings/ByPriority.java @@ -28,11 +28,11 @@ import android.widget.BaseExpandableListAdapter; import android.widget.TextView; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Instances; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; import org.dmfs.tasks.QuickAddDialogFragment; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.groupings.cursorloaders.PriorityCursorFactory; import org.dmfs.tasks.groupings.cursorloaders.PriorityCursorLoaderFactory; import org.dmfs.tasks.model.ContentSet; @@ -263,7 +263,7 @@ public void onClick(View v) Integer tag = (Integer) v.getTag(); if (tag != null) { - ContentSet content = new ContentSet(Tasks.getContentUri(TaskContract.taskAuthority(v.getContext()))); + ContentSet content = new ContentSet(Tasks.getContentUri(AuthorityUtil.taskAuthority(v.getContext()))); TaskFieldAdapters.PRIORITY.set(content, tag); QuickAddDialogFragment.newInstance(content).show(((FragmentActivity) v.getContext()).getSupportFragmentManager(), null); } diff --git a/opentasks/src/main/java/org/dmfs/tasks/groupings/ByProgress.java b/opentasks/src/main/java/org/dmfs/tasks/groupings/ByProgress.java index bbbd5df90..3d86bfe76 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/groupings/ByProgress.java +++ b/opentasks/src/main/java/org/dmfs/tasks/groupings/ByProgress.java @@ -26,8 +26,8 @@ import android.widget.BaseExpandableListAdapter; import android.widget.TextView; -import org.dmfs.provider.tasks.TaskContract.Instances; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract.Instances; import org.dmfs.tasks.groupings.cursorloaders.ProgressCursorFactory; import org.dmfs.tasks.groupings.cursorloaders.ProgressCursorLoaderFactory; import org.dmfs.tasks.model.TaskFieldAdapters; diff --git a/opentasks/src/main/java/org/dmfs/tasks/groupings/BySearch.java b/opentasks/src/main/java/org/dmfs/tasks/groupings/BySearch.java index 49e314501..b7ac86f4c 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/groupings/BySearch.java +++ b/opentasks/src/main/java/org/dmfs/tasks/groupings/BySearch.java @@ -31,9 +31,9 @@ import android.widget.TextView; import android.widget.Toast; -import org.dmfs.provider.tasks.TaskContract.Instances; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.groupings.cursorloaders.SearchHistoryCursorLoaderFactory; import org.dmfs.tasks.model.TaskFieldAdapters; import org.dmfs.tasks.utils.ExpandableChildDescriptor; diff --git a/opentasks/src/main/java/org/dmfs/tasks/groupings/ByStartDate.java b/opentasks/src/main/java/org/dmfs/tasks/groupings/ByStartDate.java index e00f49924..ff08c50f2 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/groupings/ByStartDate.java +++ b/opentasks/src/main/java/org/dmfs/tasks/groupings/ByStartDate.java @@ -29,8 +29,8 @@ import android.widget.ImageView; import android.widget.TextView; -import org.dmfs.provider.tasks.TaskContract.Instances; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract.Instances; import org.dmfs.tasks.groupings.cursorloaders.TimeRangeCursorFactory; import org.dmfs.tasks.groupings.cursorloaders.TimeRangeStartCursorFactory; import org.dmfs.tasks.groupings.cursorloaders.TimeRangeStartCursorLoaderFactory; diff --git a/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListSelectionFragment.java b/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListSelectionFragment.java index d47e74dd8..279b1d47d 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListSelectionFragment.java +++ b/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListSelectionFragment.java @@ -32,9 +32,10 @@ import android.widget.ListView; import android.widget.TextView; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.TaskLists; +import org.dmfs.provider.tasks.AuthorityUtil; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.TaskLists; import org.dmfs.tasks.utils.TasksListCursorAdapter; import org.dmfs.tasks.utils.TasksListCursorAdapter.SelectionEnabledListener; @@ -76,7 +77,7 @@ public void onAttach(Activity activity) super.onAttach(activity); mActivity = activity; mListener = (OnSelectionListener) activity; - mAuthority = TaskContract.taskAuthority(activity); + mAuthority = AuthorityUtil.taskAuthority(activity); } diff --git a/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetProvider.java b/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetProvider.java index 392d35434..3ed3559fe 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetProvider.java +++ b/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetProvider.java @@ -32,12 +32,12 @@ import android.util.Log; import android.widget.RemoteViews; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.TaskLists; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; import org.dmfs.tasks.EditTaskActivity; import org.dmfs.tasks.R; import org.dmfs.tasks.TaskListActivity; +import org.dmfs.tasks.contract.TaskContract.TaskLists; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.ContentSet; import org.dmfs.tasks.utils.RecentlyUsedLists; import org.dmfs.tasks.utils.WidgetConfigurationDatabaseHelper; @@ -83,7 +83,7 @@ else if (action.equals(ACTION_CREATE_TASK)) ArrayList widgetLists = WidgetConfigurationDatabaseHelper.loadTaskLists(db, widgetId); db.close(); ArrayList writableLists = new ArrayList<>(); - String authority = TaskContract.taskAuthority(context); + String authority = AuthorityUtil.taskAuthority(context); if (!widgetLists.isEmpty()) { Cursor cursor = context.getContentResolver().query( diff --git a/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetProviderLegacy.java b/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetProviderLegacy.java index f90654396..0aeb31f98 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetProviderLegacy.java +++ b/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetProviderLegacy.java @@ -31,10 +31,11 @@ import android.text.format.Time; import android.widget.RemoteViews; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; import org.dmfs.tasks.R; import org.dmfs.tasks.TaskListActivity; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.TaskFieldAdapters; import org.dmfs.tasks.utils.DateFormatter; import org.dmfs.tasks.utils.DateFormatter.DateFormatContext; @@ -89,7 +90,7 @@ protected ComponentName getComponentName(Context context) @SuppressWarnings("deprecation") public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { - String authority = TaskContract.taskAuthority(context); + String authority = AuthorityUtil.taskAuthority(context); RemoteViews widget = new RemoteViews(context.getPackageName(), R.layout.task_list_widget); widget.removeAllViews(android.R.id.list); diff --git a/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetUpdaterService.java b/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetUpdaterService.java index d829e0fd7..8c9060f4b 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetUpdaterService.java +++ b/opentasks/src/main/java/org/dmfs/tasks/homescreen/TaskListWidgetUpdaterService.java @@ -31,10 +31,11 @@ import android.widget.RemoteViews; import android.widget.RemoteViewsService; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Instances; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Instances; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.TaskFieldAdapters; import org.dmfs.tasks.utils.DateFormatter; import org.dmfs.tasks.utils.DateFormatter.DateFormatContext; @@ -140,7 +141,7 @@ public TaskListViewsFactory(Context context, Intent intent) mResources = context.getResources(); mDueDateFormatter = new DateFormatter(context); new TimeChangeObserver(context, this); - mAuthority = TaskContract.taskAuthority(context); + mAuthority = AuthorityUtil.taskAuthority(context); } diff --git a/opentasks/src/main/java/org/dmfs/tasks/model/DefaultModel.java b/opentasks/src/main/java/org/dmfs/tasks/model/DefaultModel.java index e44bf1919..060942e37 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/model/DefaultModel.java +++ b/opentasks/src/main/java/org/dmfs/tasks/model/DefaultModel.java @@ -19,8 +19,8 @@ import android.content.Context; import android.text.util.Linkify; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.layout.LayoutDescriptor; diff --git a/opentasks/src/main/java/org/dmfs/tasks/model/Model.java b/opentasks/src/main/java/org/dmfs/tasks/model/Model.java index 1df4943fc..326c9e345 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/model/Model.java +++ b/opentasks/src/main/java/org/dmfs/tasks/model/Model.java @@ -25,9 +25,9 @@ import android.support.v4.util.SparseArrayCompat; import android.text.TextUtils; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.TaskLists; +import org.dmfs.provider.tasks.AuthorityUtil; import org.dmfs.tasks.ManageListActivity; +import org.dmfs.tasks.contract.TaskContract.TaskLists; import java.util.ArrayList; import java.util.List; @@ -69,7 +69,7 @@ protected Model(Context context, String accountType) { mContext = context; mAccountType = accountType; - mAuthority = TaskContract.taskAuthority(context); + mAuthority = AuthorityUtil.taskAuthority(context); } diff --git a/opentasks/src/main/java/org/dmfs/tasks/model/Sources.java b/opentasks/src/main/java/org/dmfs/tasks/model/Sources.java index a8e9bffde..929e97e04 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/model/Sources.java +++ b/opentasks/src/main/java/org/dmfs/tasks/model/Sources.java @@ -29,7 +29,8 @@ import android.text.TextUtils; import android.util.Log; -import org.dmfs.provider.tasks.TaskContract; +import org.dmfs.provider.tasks.AuthorityUtil; +import org.dmfs.tasks.contract.TaskContract; import org.dmfs.tasks.utils.AsyncModelLoader; import org.dmfs.tasks.utils.OnModelLoadedListener; @@ -123,7 +124,7 @@ private Sources(Context context) { mContext = context.getApplicationContext(); - mAuthority = TaskContract.taskAuthority(context); + mAuthority = AuthorityUtil.taskAuthority(context); // register to receive package changes IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED); diff --git a/opentasks/src/main/java/org/dmfs/tasks/model/TaskFieldAdapters.java b/opentasks/src/main/java/org/dmfs/tasks/model/TaskFieldAdapters.java index edc552292..631c4a337 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/model/TaskFieldAdapters.java +++ b/opentasks/src/main/java/org/dmfs/tasks/model/TaskFieldAdapters.java @@ -18,8 +18,8 @@ import android.text.format.Time; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.adapters.BooleanFieldAdapter; import org.dmfs.tasks.model.adapters.ChecklistFieldAdapter; import org.dmfs.tasks.model.adapters.ColorFieldAdapter; diff --git a/opentasks/src/main/java/org/dmfs/tasks/model/XmlModel.java b/opentasks/src/main/java/org/dmfs/tasks/model/XmlModel.java index 3e40feb31..48a734fde 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/model/XmlModel.java +++ b/opentasks/src/main/java/org/dmfs/tasks/model/XmlModel.java @@ -26,8 +26,8 @@ import android.content.res.XmlResourceParser; import android.util.Log; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.adapters.BooleanFieldAdapter; import org.dmfs.tasks.model.adapters.FieldAdapter; import org.dmfs.tasks.model.adapters.StringFieldAdapter; diff --git a/opentasks/src/main/java/org/dmfs/tasks/model/constraints/AdjustPercentComplete.java b/opentasks/src/main/java/org/dmfs/tasks/model/constraints/AdjustPercentComplete.java index e16a0b1d3..3666fbd7f 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/model/constraints/AdjustPercentComplete.java +++ b/opentasks/src/main/java/org/dmfs/tasks/model/constraints/AdjustPercentComplete.java @@ -16,7 +16,7 @@ package org.dmfs.tasks.model.constraints; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.ContentSet; import org.dmfs.tasks.model.adapters.IntegerFieldAdapter; diff --git a/opentasks/src/main/java/org/dmfs/tasks/model/constraints/ChecklistConstraint.java b/opentasks/src/main/java/org/dmfs/tasks/model/constraints/ChecklistConstraint.java index 0255854fb..87ca28406 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/model/constraints/ChecklistConstraint.java +++ b/opentasks/src/main/java/org/dmfs/tasks/model/constraints/ChecklistConstraint.java @@ -16,7 +16,7 @@ package org.dmfs.tasks.model.constraints; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.CheckListItem; import org.dmfs.tasks.model.ContentSet; import org.dmfs.tasks.model.adapters.IntegerFieldAdapter; diff --git a/opentasks/src/main/java/org/dmfs/tasks/notification/AlarmBroadcastReceiver.java b/opentasks/src/main/java/org/dmfs/tasks/notification/AlarmBroadcastReceiver.java index e1f9cf16a..271c08be0 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/notification/AlarmBroadcastReceiver.java +++ b/opentasks/src/main/java/org/dmfs/tasks/notification/AlarmBroadcastReceiver.java @@ -23,7 +23,7 @@ import android.content.SharedPreferences; import android.net.Uri; -import org.dmfs.provider.tasks.TaskContract; +import org.dmfs.tasks.contract.TaskContract; /** diff --git a/opentasks/src/main/java/org/dmfs/tasks/notification/NotificationUpdaterService.java b/opentasks/src/main/java/org/dmfs/tasks/notification/NotificationUpdaterService.java index 744d75659..065e0326f 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/notification/NotificationUpdaterService.java +++ b/opentasks/src/main/java/org/dmfs/tasks/notification/NotificationUpdaterService.java @@ -47,11 +47,12 @@ import android.text.format.Time; import android.util.Log; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; import org.dmfs.rfc5545.DateTime; import org.dmfs.rfc5545.Duration; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.ContentSet; import org.dmfs.tasks.model.TaskFieldAdapters; import org.dmfs.tasks.notification.NotificationActionUtils.NotificationAction; @@ -119,7 +120,7 @@ public NotificationUpdaterService() @Override public void onCreate() { - mAuthority = TaskContract.taskAuthority(this); + mAuthority = AuthorityUtil.taskAuthority(this); super.onCreate(); updateNextDayAlarm(); } @@ -309,7 +310,7 @@ private ArrayList queryTasksToPin() ArrayList tasksToPin = new ArrayList(20); final ContentResolver resolver = this.getContentResolver(); - final Uri contentUri = Tasks.getContentUri(TaskContract.taskAuthority(this)); + final Uri contentUri = Tasks.getContentUri(AuthorityUtil.taskAuthority(this)); final Cursor cursor = resolver.query(contentUri, new String[] { Tasks._ID, Tasks.TITLE, Tasks.DESCRIPTION, Tasks.DTSTART, Tasks.DUE, Tasks.IS_ALLDAY, Tasks.STATUS, Tasks.PRIORITY, Tasks.IS_CLOSED }, Tasks.PINNED + "= 1", null, diff --git a/opentasks/src/main/java/org/dmfs/tasks/notification/TaskNotificationHandler.java b/opentasks/src/main/java/org/dmfs/tasks/notification/TaskNotificationHandler.java index 5b1268c6d..c23f1a348 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/notification/TaskNotificationHandler.java +++ b/opentasks/src/main/java/org/dmfs/tasks/notification/TaskNotificationHandler.java @@ -25,8 +25,8 @@ import android.net.Uri; import android.preference.PreferenceManager; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.provider.tasks.AuthorityUtil; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.ContentSet; import org.dmfs.tasks.model.TaskFieldAdapters; @@ -105,7 +105,7 @@ private static void startPinnedTaskService(Context context, Uri taskUri, String private static int getPinnedTaskCount(Context context) { - final Cursor countCursor = context.getContentResolver().query(Tasks.getContentUri(TaskContract.taskAuthority(context)), + final Cursor countCursor = context.getContentResolver().query(Tasks.getContentUri(AuthorityUtil.taskAuthority(context)), new String[] { "count(*) AS count" }, Tasks.PINNED + " is not null", null, null); try { diff --git a/opentasks/src/main/java/org/dmfs/tasks/utils/DatabaseInitializedReceiver.java b/opentasks/src/main/java/org/dmfs/tasks/utils/DatabaseInitializedReceiver.java index 8fdcf5aa2..9db6b5021 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/utils/DatabaseInitializedReceiver.java +++ b/opentasks/src/main/java/org/dmfs/tasks/utils/DatabaseInitializedReceiver.java @@ -22,9 +22,10 @@ import android.content.Intent; import android.graphics.Color; -import org.dmfs.provider.tasks.TaskContract; -import org.dmfs.provider.tasks.TaskContract.TaskLists; +import org.dmfs.provider.tasks.AuthorityUtil; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract; +import org.dmfs.tasks.contract.TaskContract.TaskLists; public class DatabaseInitializedReceiver extends BroadcastReceiver @@ -43,7 +44,7 @@ public void onReceive(Context context, Intent intent) listValues.put(TaskLists.OWNER, ""); context.getContentResolver().insert( - TaskContract.TaskLists.getContentUri(TaskContract.taskAuthority(context)).buildUpon() + TaskContract.TaskLists.getContentUri(AuthorityUtil.taskAuthority(context)).buildUpon() .appendQueryParameter(TaskContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryParameter(TaskContract.ACCOUNT_NAME, TaskContract.LOCAL_ACCOUNT_NAME) .appendQueryParameter(TaskContract.ACCOUNT_TYPE, TaskContract.LOCAL_ACCOUNT_TYPE).build(), listValues); diff --git a/opentasks/src/main/java/org/dmfs/tasks/utils/SearchChildDescriptor.java b/opentasks/src/main/java/org/dmfs/tasks/utils/SearchChildDescriptor.java index 8cdfa0b58..5a3114e5d 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/utils/SearchChildDescriptor.java +++ b/opentasks/src/main/java/org/dmfs/tasks/utils/SearchChildDescriptor.java @@ -21,7 +21,7 @@ import android.net.Uri; import android.support.v4.content.CursorLoader; -import org.dmfs.provider.tasks.TaskContract.Tasks; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.groupings.filters.AbstractFilter; diff --git a/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorAdapter.java b/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorAdapter.java index d56e9022d..51d098dd4 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorAdapter.java +++ b/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorAdapter.java @@ -26,8 +26,8 @@ import android.widget.TextView; import org.dmfs.android.widgets.ColoredShapeCheckBox; -import org.dmfs.provider.tasks.TaskContract; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract; import java.util.ArrayList; diff --git a/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorSpinnerAdapter.java b/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorSpinnerAdapter.java index b71daef8a..fc4ac41b2 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorSpinnerAdapter.java +++ b/opentasks/src/main/java/org/dmfs/tasks/utils/TasksListCursorSpinnerAdapter.java @@ -25,8 +25,8 @@ import android.widget.SpinnerAdapter; import android.widget.TextView; -import org.dmfs.provider.tasks.TaskContract; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract; import org.dmfs.tasks.model.TaskFieldAdapters; diff --git a/opentasks/src/main/java/org/dmfs/tasks/widget/AbstractFieldView.java b/opentasks/src/main/java/org/dmfs/tasks/widget/AbstractFieldView.java index 7cbd6300b..733a66a89 100644 --- a/opentasks/src/main/java/org/dmfs/tasks/widget/AbstractFieldView.java +++ b/opentasks/src/main/java/org/dmfs/tasks/widget/AbstractFieldView.java @@ -25,8 +25,8 @@ import android.widget.LinearLayout; import android.widget.TextView; -import org.dmfs.provider.tasks.TaskContract.Tasks; import org.dmfs.tasks.R; +import org.dmfs.tasks.contract.TaskContract.Tasks; import org.dmfs.tasks.model.ContentSet; import org.dmfs.tasks.model.FieldDescriptor; import org.dmfs.tasks.model.OnContentChangeListener; diff --git a/settings.gradle b/settings.gradle index 2099e3f06..7ef7f7a09 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':opentasks', ':opentasks-provider' +include ':opentasks', ':opentasks-provider', ':opentasks-contract'