Use application ID from gradle build config

pull/253/head
Alex Baker 10 years ago
parent 13ec8d027f
commit 1c9c44ce34

@ -5,6 +5,8 @@
*/
package com.todoroo.astrid.api;
import org.tasks.BuildConfig;
/**
* Constants for interfacing with Astrid.
*
@ -14,25 +16,15 @@ public class AstridApiConstants {
// --- General Constants
/**
* Astrid broadcast base package name
*/
public static final String API_PACKAGE = "org.tasks";
/**
* Astrid app base package name
*/
public static final String ASTRID_PACKAGE = "org.tasks";
/**
* Permission for reading tasks and receiving to GET_FILTERS intent
*/
public static final String PERMISSION_READ = API_PACKAGE + ".READ";
public static final String PERMISSION_READ = BuildConfig.APPLICATION_ID + ".READ";
/**
* Permission for writing and creating tasks
*/
public static final String PERMISSION_WRITE = API_PACKAGE + ".WRITE";
public static final String PERMISSION_WRITE = BuildConfig.APPLICATION_ID + ".WRITE";
/**
* Name of Astrid's publicly readable preference store
@ -73,7 +65,7 @@ public class AstridApiConstants {
/**
* Action name for a broadcast intent requesting custom filter criteria (e.g. "Due by, Tagged, Tag contains", etc.)
*/
public static final String BROADCAST_REQUEST_CUSTOM_FILTER_CRITERIA = API_PACKAGE + ".REQUEST_CUSTOM_FILTER_CRITERIA";
public static final String BROADCAST_REQUEST_CUSTOM_FILTER_CRITERIA = BuildConfig.APPLICATION_ID + ".REQUEST_CUSTOM_FILTER_CRITERIA";
/**
@ -81,29 +73,20 @@ public class AstridApiConstants {
* <li> EXTRAS_ADDON you add-on identifier
* <li> EXTRAS_RESPONSE an array of {@link CustomFilterCriterion} </li>
*/
public static final String BROADCAST_SEND_CUSTOM_FILTER_CRITERIA = API_PACKAGE + ".SEND_CUSTOM_FILTER_CRITERIA";
// --- Actions API
/**
* Action name for intents to be displayed in Astrid's settings. By default,
* your application will be put into the category named by your application,
* but you can add a string meta-data with name "category" to override this.
*/
public static final String ACTION_SETTINGS = API_PACKAGE + ".SETTINGS";
public static final String BROADCAST_SEND_CUSTOM_FILTER_CRITERIA = BuildConfig.APPLICATION_ID + ".SEND_CUSTOM_FILTER_CRITERIA";
// --- Events API
/**
* Action name for broadcast intent notifying Astrid task list to refresh
*/
public static final String BROADCAST_EVENT_REFRESH = API_PACKAGE + ".REFRESH";
public static final String BROADCAST_EVENT_REFRESH = BuildConfig.APPLICATION_ID + ".REFRESH";
/**
* Action name for broadcast intent notifying that task was completed
* <li> EXTRAS_TASK_ID id of the task
*/
public static final String BROADCAST_EVENT_TASK_COMPLETED = API_PACKAGE + ".TASK_COMPLETED";
public static final String BROADCAST_EVENT_TASK_COMPLETED = BuildConfig.APPLICATION_ID + ".TASK_COMPLETED";
/**
* Action name for broadcast intent notifying that task was created from repeating template
@ -111,7 +94,7 @@ public class AstridApiConstants {
* <li> EXTRAS_OLD_DUE_DATE task old due date (could be 0)
* <li> EXTRAS_NEW_DUE_DATE task new due date (will not be 0)
*/
public static final String BROADCAST_EVENT_TASK_REPEATED = API_PACKAGE + ".TASK_REPEATED";
public static final String BROADCAST_EVENT_TASK_REPEATED = BuildConfig.APPLICATION_ID + ".TASK_REPEATED";
/**
* Action name for broadcast intent notifying that a repeating task has passed its repeat_until value
@ -119,18 +102,18 @@ public class AstridApiConstants {
* <li> EXTRAS_OLD_DUE_DATE task old due date (could be 0)
* <li> EXTRAS_NEW_DUE_DATE task new due date (will not be 0)
*/
public static final String BROADCAST_EVENT_TASK_REPEAT_FINISHED = API_PACKAGE + ".TASK_REPEAT_FINISHED";
public static final String BROADCAST_EVENT_TASK_REPEAT_FINISHED = BuildConfig.APPLICATION_ID + ".TASK_REPEAT_FINISHED";
/**
* Action name for broadcast intent notifying that tag was deleted
*/
public static final String BROADCAST_EVENT_TAG_DELETED = API_PACKAGE + ".TAG_DELETED";
public static final String BROADCAST_EVENT_TAG_DELETED = BuildConfig.APPLICATION_ID + ".TAG_DELETED";
/**
* Action name for broadcast intent notifying that tag was renamed
*/
public static final String BROADCAST_EVENT_TAG_RENAMED = API_PACKAGE + ".TAG_RENAMED";
public static final String BROADCAST_EVENT_TAG_RENAMED = BuildConfig.APPLICATION_ID + ".TAG_RENAMED";
public static final String BROADCAST_EVENT_FILTER_DELETED = API_PACKAGE + ".FILTER_DELETED";
public static final String BROADCAST_EVENT_FILTER_DELETED = BuildConfig.APPLICATION_ID + ".FILTER_DELETED";
}

@ -17,6 +17,8 @@ import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.astrid.actfm.TagViewFragment;
import com.todoroo.astrid.subtasks.SubtasksTagListFragment;
import org.tasks.BuildConfig;
public class FilterWithCustomIntent extends Filter {
/**
@ -46,7 +48,7 @@ public class FilterWithCustomIntent extends Filter {
public Intent getCustomIntent() {
Intent intent = new Intent();
intent.putExtra("filter", this); //$NON-NLS-1$
intent.setComponent(new ComponentName(AstridApiConstants.ASTRID_PACKAGE, "com.todoroo.astrid.activity.TaskListActivity")); //$NON-NLS-1$
intent.setComponent(new ComponentName(BuildConfig.APPLICATION_ID, "com.todoroo.astrid.activity.TaskListActivity")); //$NON-NLS-1$
if(customExtras != null) {
intent.putExtras(customExtras);
}

@ -14,7 +14,8 @@ import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.data.Table;
import com.todoroo.astrid.api.AstridApiConstants;
import org.tasks.BuildConfig;
/**
* Data Model which represents a piece of metadata associated with a task
@ -30,7 +31,7 @@ public class Metadata extends AbstractModel {
public static final Table TABLE = new Table("metadata", Metadata.class);
/** content uri for this model */
public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
public static final Uri CONTENT_URI = Uri.parse("content://" + BuildConfig.APPLICATION_ID + "/" +
TABLE.name);
// --- properties

@ -14,7 +14,8 @@ import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.data.Table;
import com.todoroo.astrid.api.AstridApiConstants;
import org.tasks.BuildConfig;
/**
* Data Model which represents a piece of data unrelated to a task
@ -30,7 +31,7 @@ public class StoreObject extends AbstractModel {
public static final Table TABLE = new Table("store", StoreObject.class);
/** content uri for this model */
public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
public static final Uri CONTENT_URI = Uri.parse("content://" + BuildConfig.APPLICATION_ID + "/" +
TABLE.name);
// --- properties

@ -17,8 +17,8 @@ import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.data.Table;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.api.AstridApiConstants;
import org.tasks.BuildConfig;
import org.tasks.R;
import java.util.Date;
@ -38,7 +38,7 @@ public class Task extends RemoteModel {
/** table for this model */
public static final Table TABLE = new Table("tasks", Task.class);
public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
public static final Uri CONTENT_URI = Uri.parse("content://" + BuildConfig.APPLICATION_ID + "/" +
TABLE.name);
// --- properties

@ -7,7 +7,8 @@ import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.data.Table;
import com.todoroo.astrid.api.AstridApiConstants;
import org.tasks.BuildConfig;
public class UserActivity extends RemoteModel {
@ -17,7 +18,7 @@ public class UserActivity extends RemoteModel {
public static final Table TABLE = new Table("userActivity", UserActivity.class);
/** content uri for this model */
public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.API_PACKAGE + "/" +
public static final Uri CONTENT_URI = Uri.parse("content://" + BuildConfig.APPLICATION_ID + "/" +
TABLE.name);
// --- properties

@ -3,15 +3,14 @@ package com.todoroo.astrid.gcal;
import android.content.Context;
import android.content.Intent;
import com.todoroo.astrid.api.AstridApiConstants;
import org.tasks.BuildConfig;
import org.tasks.injection.InjectingBroadcastReceiver;
import javax.inject.Inject;
public class CalendarStartupReceiver extends InjectingBroadcastReceiver {
public static final String BROADCAST_RESCHEDULE_CAL_ALARMS = AstridApiConstants.API_PACKAGE + ".SCHEDULE_CAL_REMINDERS"; //$NON-NLS-1$
public static final String BROADCAST_RESCHEDULE_CAL_ALARMS = BuildConfig.APPLICATION_ID + ".SCHEDULE_CAL_REMINDERS"; //$NON-NLS-1$
@Inject CalendarAlarmScheduler calendarAlarmScheduler;

@ -26,6 +26,7 @@ import com.todoroo.astrid.data.StoreObject;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.UserActivity;
import org.tasks.BuildConfig;
import org.tasks.injection.InjectingContentProvider;
import java.util.HashSet;
@ -87,7 +88,7 @@ public class Astrid3ContentProvider extends InjectingContentProvider {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
for(Uri uri : new Uri[] { Task.CONTENT_URI, Metadata.CONTENT_URI, StoreObject.CONTENT_URI, UserActivity.CONTENT_URI }) {
String authority = AstridApiConstants.API_PACKAGE;
String authority = BuildConfig.APPLICATION_ID;
String table = uri.toString();
table = table.substring(table.indexOf('/', 11) + 1);

@ -13,6 +13,7 @@ import android.net.Uri;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.Database;
import org.tasks.BuildConfig;
import org.tasks.injection.InjectingContentProvider;
import javax.inject.Inject;
@ -38,7 +39,7 @@ public class SqlContentProvider extends InjectingContentProvider {
static {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI(AstridApiConstants.API_PACKAGE + ".private",
uriMatcher.addURI(BuildConfig.APPLICATION_ID + ".private",
"sql", 0);
}

Loading…
Cancel
Save