diff --git a/astrid/AndroidManifest.xml b/astrid/AndroidManifest.xml
index eddcde765..a491a72ee 100644
--- a/astrid/AndroidManifest.xml
+++ b/astrid/AndroidManifest.xml
@@ -395,48 +395,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/astrid/astrid.launch b/astrid/astrid.launch
index 35549a40e..18a0852f5 100644
--- a/astrid/astrid.launch
+++ b/astrid/astrid.launch
@@ -5,7 +5,7 @@
-
+
diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksDetailExposer.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksDetailExposer.java
index eacbe1855..9c17880e0 100644
--- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksDetailExposer.java
+++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksDetailExposer.java
@@ -33,6 +33,7 @@ public class GtasksDetailExposer extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
ContextManager.setContext(context);
+ DependencyInjectionService.getInstance().inject(this);
// if we aren't logged in, don't expose features
if(!gtasksPreferenceService.isLoggedIn())
@@ -59,17 +60,14 @@ public class GtasksDetailExposer extends BroadcastReceiver {
if(extended)
return null;
- DependencyInjectionService.getInstance().inject(this);
-
Metadata metadata = gtasksMetadataService.getTaskMetadata(id);
if(metadata == null)
return null;
StringBuilder builder = new StringBuilder();
- long listId = metadata.getValue(GtasksMetadata.LIST_ID);
+ String listId = metadata.getValue(GtasksMetadata.LIST_ID);
String listName = gtasksListService.getListName(listId);
- // RTM list is out of date. don't display RTM stuff
if(listName == GtasksListService.LIST_NOT_FOUND)
return null;
diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListService.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListService.java
index 69eca6f83..1c1d0014b 100644
--- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListService.java
+++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListService.java
@@ -53,7 +53,7 @@ public class GtasksListService {
* @param listId
* @return NOT_FOUND if no list by this id exists, otherwise list name
*/
- public String getListName(long listId) {
+ public String getListName(String listId) {
readLists();
for(StoreObject list : lists)
if(list.getValue(GtasksList.REMOTE_ID).equals(listId))
@@ -63,6 +63,7 @@ public class GtasksListService {
@SuppressWarnings("nls")
public void updateLists(JSONArray newLists) throws JSONException {
+ readLists();
for(int i = 0; i < newLists.length(); i++) {
JSONObject remote = newLists.getJSONObject(i);
diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadata.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadata.java
index cc31c0307..551e2abb0 100644
--- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadata.java
+++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadata.java
@@ -2,6 +2,7 @@ package com.todoroo.astrid.gtasks;
import com.todoroo.andlib.data.Property.IntegerProperty;
import com.todoroo.andlib.data.Property.LongProperty;
+import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.utility.Preferences;
@@ -21,7 +22,7 @@ public class GtasksMetadata {
public static final LongProperty ID = new LongProperty(Metadata.TABLE,
Metadata.VALUE1.name);
- public static final LongProperty LIST_ID = new LongProperty(Metadata.TABLE,
+ public static final StringProperty LIST_ID = new StringProperty(Metadata.TABLE,
Metadata.VALUE2.name);
public static final LongProperty OWNER_ID = new LongProperty(Metadata.TABLE,
@@ -37,8 +38,7 @@ public class GtasksMetadata {
Metadata metadata = new Metadata();
metadata.setValue(Metadata.KEY, GtasksMetadata.METADATA_KEY);
metadata.setValue(ID, (long)VALUE_UNSET);
- metadata.setValue(LIST_ID, Preferences.getLong(GtasksPreferenceService.PREF_DEFAULT_LIST,
- VALUE_UNSET));
+ metadata.setValue(LIST_ID, Preferences.getStringValue(GtasksPreferenceService.PREF_DEFAULT_LIST));
metadata.setValue(OWNER_ID, (long)VALUE_UNSET);
metadata.setValue(INDENTATION, 0);
metadata.setValue(ORDERING, VALUE_UNSET);
diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferences.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferences.java
new file mode 100644
index 000000000..bb17a7e9d
--- /dev/null
+++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferences.java
@@ -0,0 +1,45 @@
+package com.todoroo.astrid.gtasks;
+
+import com.timsu.astrid.R;
+import com.todoroo.andlib.service.Autowired;
+import com.todoroo.andlib.service.DependencyInjectionService;
+import com.todoroo.astrid.sync.SyncProviderPreferences;
+import com.todoroo.astrid.sync.SyncProviderUtilities;
+
+/**
+ * Displays synchronization preferences and an action panel so users can
+ * initiate actions from the menu.
+ *
+ * @author Tim Su
+ *
+ */
+public class GtasksPreferences extends SyncProviderPreferences {
+
+ @Autowired private GtasksPreferenceService gtasksPreferenceService;
+
+ public GtasksPreferences() {
+ super();
+ DependencyInjectionService.getInstance().inject(this);
+ }
+
+ @Override
+ public int getPreferenceResource() {
+ return R.xml.preferences_gtasks;
+ }
+
+ @Override
+ public void startSync() {
+ //
+ }
+
+ @Override
+ public void logOut() {
+ //
+ }
+
+ @Override
+ public SyncProviderUtilities getUtilities() {
+ return gtasksPreferenceService;
+ }
+
+}
\ No newline at end of file
diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksSyncActionExposer.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksSyncActionExposer.java
new file mode 100644
index 000000000..fc53ecf23
--- /dev/null
+++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksSyncActionExposer.java
@@ -0,0 +1,75 @@
+/**
+ * See the file "LICENSE" for the full license governing this code.
+ */
+package com.todoroo.astrid.gtasks;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.timsu.astrid.R;
+import com.todoroo.andlib.service.Autowired;
+import com.todoroo.andlib.service.ContextManager;
+import com.todoroo.andlib.service.DependencyInjectionService;
+import com.todoroo.astrid.api.AstridApiConstants;
+import com.todoroo.astrid.api.SyncAction;
+
+/**
+ * Exposes sync action
+ *
+ */
+public class GtasksSyncActionExposer extends BroadcastReceiver {
+
+ @Autowired private GtasksPreferenceService gtasksPreferenceService;
+
+ @Autowired private GtasksListService gtasksListService;
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ ContextManager.setContext(context);
+ DependencyInjectionService.getInstance().inject(this);
+
+ if(intent.getBooleanExtra("setup", false)) {
+ gtasksPreferenceService.setToken("haha");
+ try {
+ JSONArray newLists = new JSONArray();
+ JSONObject list = new JSONObject();
+ list.put("id", "1");
+ list.put("title", "Tim's Tasks");
+ newLists.put(list);
+ list = new JSONObject();
+ list.put("id", "2");
+ list.put("title", "Travel");
+ newLists.put(list);
+ gtasksListService.updateLists(newLists);
+ } catch (JSONException e) {
+ throw new RuntimeException(e);
+ }
+ System.err.println("you've ben set up the bomb.");
+ return;
+ }
+
+
+ // if we aren't logged in, don't expose sync action
+ //if(!gtasksPreferenceService.isLoggedIn())
+ // return;
+
+ Intent syncIntent = new Intent(intent.getAction(), null,
+ context, GtasksSyncActionExposer.class);
+ syncIntent.putExtra("setup", true);
+ PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, syncIntent, 0);
+ SyncAction syncAction = new SyncAction(context.getString(R.string.gtasks_GPr_header),
+ pendingIntent);
+
+ Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_SEND_SYNC_ACTIONS);
+ broadcastIntent.putExtra(AstridApiConstants.EXTRAS_ADDON, GtasksPreferenceService.IDENTIFIER);
+ broadcastIntent.putExtra(AstridApiConstants.EXTRAS_RESPONSE, syncAction);
+ context.sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
+ }
+
+}
diff --git a/astrid/res/drawable/silk_folder.png b/astrid/res/drawable/silk_folder.png
index 3c4724da2..003d4546c 100644
Binary files a/astrid/res/drawable/silk_folder.png and b/astrid/res/drawable/silk_folder.png differ
diff --git a/astrid/res/layout/notification_control.xml b/astrid/res/layout/notification_control.xml
index d76c37b10..39e3d015d 100644
--- a/astrid/res/layout/notification_control.xml
+++ b/astrid/res/layout/notification_control.xml
@@ -12,6 +12,7 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
+ android:visibility="gone"
android:orientation="vertical">