first version of notifiers for producteev-worklog to show acitivites/shownotifications since last sync

pull/14/head
Arne Jans 14 years ago
commit 8b084c286f

@ -54,7 +54,7 @@
<supports-screens /> <supports-screens />
<application android:icon="@drawable/icon" <application android:icon="@drawable/icon"
android:label="@string/app_name"> android:label="@string/app_name" android:debuggable="true">
<!-- ====================================================== Activities = --> <!-- ====================================================== Activities = -->
@ -337,11 +337,7 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.todoroo.astrid.producteev.ProducteevLoginActivity" <activity android:name="com.todoroo.astrid.producteev.ProducteevLoginActivity"
android:theme="@style/Theme"> android:theme="@style/Theme" />
<intent-filter> <!-- temporary -->
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<service android:name="com.todoroo.astrid.producteev.ProducteevBackgroundService"/> <service android:name="com.todoroo.astrid.producteev.ProducteevBackgroundService"/>
<receiver android:name="com.todoroo.astrid.producteev.ProducteevStartupReceiver"> <receiver android:name="com.todoroo.astrid.producteev.ProducteevStartupReceiver">
<intent-filter> <intent-filter>

@ -338,7 +338,12 @@ public abstract class AbstractModel implements Parcelable {
public synchronized void save(Property<?> property, ContentValues newStore, Object value) { public synchronized void save(Property<?> property, ContentValues newStore, Object value) {
this.store = newStore; this.store = newStore;
property.accept(this, value);
// we don't allow null values, as they indicate unset properties
// when the database was written
if(value != null)
property.accept(this, value);
} }
public Void visitDouble(Property<Double> property, Object value) { public Void visitDouble(Property<Double> property, Object value) {

@ -59,6 +59,8 @@ public class ProducteevControlSet implements TaskEditControlSet {
@Autowired @Autowired
MetadataService metadataService; MetadataService metadataService;
private int lastDashboardSelection = 0;
public ProducteevControlSet(final Activity activity, ViewGroup parent) { public ProducteevControlSet(final Activity activity, ViewGroup parent) {
DependencyInjectionService.getInstance().inject(this); DependencyInjectionService.getInstance().inject(this);
@ -92,10 +94,10 @@ public class ProducteevControlSet implements TaskEditControlSet {
dialog.cancel(); dialog.cancel();
} else { } else {
// create the real dashboard, select it in the spinner and refresh responsiblespinner // create the real dashboard, select it in the spinner and refresh responsiblespinner
ProgressDialog progressDialog = null; ProgressDialog progressDialog = dialogUtilites.progressDialog(context,
context.getString(R.string.DLG_wait));
try { try {
progressDialog = dialogUtilites.progressDialog(context, progressDialog.show();
context.getString(R.string.DLG_wait));
JSONObject newDashJSON = ProducteevSyncProvider.getInvoker().dashboardsCreate(newDashboardName).getJSONObject("dashboard"); JSONObject newDashJSON = ProducteevSyncProvider.getInvoker().dashboardsCreate(newDashboardName).getJSONObject("dashboard");
StoreObject local = ProducteevDataService.getInstance().updateDashboards(newDashJSON, true); StoreObject local = ProducteevDataService.getInstance().updateDashboards(newDashJSON, true);
if (local != null) { if (local != null) {
@ -127,6 +129,7 @@ public class ProducteevControlSet implements TaskEditControlSet {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
dialog.cancel(); dialog.cancel();
dashboardSelector.setSelection(lastDashboardSelection);
} }
}; };
dialogUtilites.viewDialog(ProducteevControlSet.this.activity, dialogUtilites.viewDialog(ProducteevControlSet.this.activity,
@ -136,6 +139,7 @@ public class ProducteevControlSet implements TaskEditControlSet {
cancelListener); cancelListener);
} else { } else {
refreshResponsibleSpinner(dashboard.getUsers()); refreshResponsibleSpinner(dashboard.getUsers());
lastDashboardSelection = position;
} }
} }

@ -7,6 +7,7 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import com.timsu.astrid.R;
import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.astrid.adapter.TaskAdapter; import com.todoroo.astrid.adapter.TaskAdapter;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
@ -64,6 +65,9 @@ public class ProducteevDetailExposer extends BroadcastReceiver implements Detail
long responsibleId = -1; long responsibleId = -1;
if(metadata.containsNonNullValue(ProducteevTask.RESPONSIBLE_ID)) if(metadata.containsNonNullValue(ProducteevTask.RESPONSIBLE_ID))
responsibleId = metadata.getValue(ProducteevTask.RESPONSIBLE_ID); responsibleId = metadata.getValue(ProducteevTask.RESPONSIBLE_ID);
long creatorId = -1;
if(metadata.containsNonNullValue(ProducteevTask.CREATOR_ID))
creatorId = metadata.getValue(ProducteevTask.CREATOR_ID);
// display dashboard if not "no sync" or "default" // display dashboard if not "no sync" or "default"
StoreObject ownerDashboard = null; StoreObject ownerDashboard = null;
@ -86,14 +90,21 @@ public class ProducteevDetailExposer extends BroadcastReceiver implements Detail
// display responsible user if not current one // display responsible user if not current one
if(responsibleId > 0 && ownerDashboard != null && responsibleId != if(responsibleId > 0 && ownerDashboard != null && responsibleId !=
Preferences.getLong(ProducteevUtilities.PREF_USER_ID, 0L)) { Preferences.getLong(ProducteevUtilities.PREF_USER_ID, 0L)) {
String users = ";" + ownerDashboard.getValue(ProducteevDashboard.USERS); //$NON-NLS-1$ String user = getUserFromDashboard(ownerDashboard, responsibleId);
int index = users.indexOf(";" + responsibleId + ","); //$NON-NLS-1$ //$NON-NLS-2$ if(user != null)
if(index > -1) {
String user = users.substring(users.indexOf(',', index) + 1,
users.indexOf(';', index + 1));
builder.append("<img src='silk_user_gray'/> ").append(user).append(TaskAdapter.DETAIL_SEPARATOR); //$NON-NLS-1$ builder.append("<img src='silk_user_gray'/> ").append(user).append(TaskAdapter.DETAIL_SEPARATOR); //$NON-NLS-1$
}
} }
// display creator user if not the current one
if(creatorId > 0 && ownerDashboard != null && creatorId !=
Preferences.getLong(ProducteevUtilities.PREF_USER_ID, 0L)) {
String user = getUserFromDashboard(ownerDashboard, creatorId);
if(user != null)
builder.append("<img src='silk_user_orange'/> ").append( //$NON-NLS-1$
context.getString(R.string.producteev_PDE_task_from, user)).
append(TaskAdapter.DETAIL_SEPARATOR);
}
} else { } else {
TodorooCursor<Metadata> notesCursor = ProducteevDataService.getInstance().getTaskNotesCursor(id); TodorooCursor<Metadata> notesCursor = ProducteevDataService.getInstance().getTaskNotesCursor(id);
try { try {
@ -112,6 +123,16 @@ public class ProducteevDetailExposer extends BroadcastReceiver implements Detail
return result.substring(0, result.length() - TaskAdapter.DETAIL_SEPARATOR.length()); return result.substring(0, result.length() - TaskAdapter.DETAIL_SEPARATOR.length());
} }
/** Try and find user in the dashboard. return null if un-findable */
private String getUserFromDashboard(StoreObject dashboard, long userId) {
String users = ";" + dashboard.getValue(ProducteevDashboard.USERS); //$NON-NLS-1$
int index = users.indexOf(";" + userId + ","); //$NON-NLS-1$ //$NON-NLS-2$
if(index > -1)
return users.substring(users.indexOf(',', index) + 1,
users.indexOf(';', index + 1));
return null;
}
@Override @Override
public String getPluginIdentifier() { public String getPluginIdentifier() {
return ProducteevUtilities.IDENTIFIER; return ProducteevUtilities.IDENTIFIER;

@ -3,8 +3,8 @@
*/ */
package com.todoroo.astrid.producteev; package com.todoroo.astrid.producteev;
import java.util.Map.Entry;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.Map.Entry;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ContentValues; import android.content.ContentValues;
@ -39,7 +39,7 @@ public class ProducteevFilterExposer extends BroadcastReceiver {
/** /**
* @param context * @param context
*/ */
private Filter filterFromList(Context context, ProducteevDashboard dashboard) { public static Filter filterFromList(Context context, ProducteevDashboard dashboard) {
String dashboardTitle = dashboard.getName(); String dashboardTitle = dashboard.getName();
String title = dashboard.getName(); String title = dashboard.getName();
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();

@ -41,6 +41,10 @@ public class ProducteevUtilities extends SyncProviderUtilities {
public static final String PREF_SERVER_LAST_SYNC = IDENTIFIER + "_last_server"; //$NON-NLS-1$ public static final String PREF_SERVER_LAST_SYNC = IDENTIFIER + "_last_server"; //$NON-NLS-1$
public static final String PREF_SERVER_LAST_NOTIFICATION = IDENTIFIER + "_last_notification"; //$NON-NLS-1$
public static final String PREF_SERVER_LAST_ACTIVITY = IDENTIFIER + "_last_activity"; //$NON-NLS-1$
/** Producteev user's default dashboard. This is different from the /** Producteev user's default dashboard. This is different from the
* preference key, which indicates where user wants to put new tasks */ * preference key, which indicates where user wants to put new tasks */
public static final String PREF_DEFAULT_DASHBOARD = IDENTIFIER + "_defaultdash"; //$NON-NLS-1$ public static final String PREF_DEFAULT_DASHBOARD = IDENTIFIER + "_defaultdash"; //$NON-NLS-1$

@ -111,6 +111,31 @@ public class ProducteevInvoker {
"since", since), "dashboards"); "since", since), "dashboards");
} }
/**
* create a dasbhoard
*
* @param name
* @return the new created dashboard as JSONObject
*/
public JSONObject dashboardsCreate(String name) throws ApiServiceException, IOException {
return callAuthenticated("dashboards/create.json",
"token", token,
"title", name);
}
/**
* return the list of users who can access a specific dashboard
*
* @param idDashboard
* @param dashboard array-information about the dashboard, if this ...
*/
public JSONArray dashboardsAccess(long idDashboard, String dashboard) throws ApiServiceException, IOException {
return getResponse(callAuthenticated("dashboards/access.json",
"token", token,
"id_dashboard", idDashboard,
"dashboard", dashboard),"dashboard");
}
// --- tasks // --- tasks
/** /**
@ -374,44 +399,49 @@ public class ProducteevInvoker {
"title", title); "title", title);
} }
// --- users // --- notifications/activities
/** /**
* get a user * get every activities
* *
* @param idColleague * @param dashboardId (optional) if not null, this function only returns notifications for this specific dashboard
* * @param lastId (optional) this function returns only activities later than this id
* @return array information about the user
*/ */
public JSONObject usersView(Long idColleague) throws ApiServiceException, IOException { public JSONArray activitiesShowActivities(Long dashboardId, Long lastId) throws ApiResponseParseException, ApiServiceException, IOException {
return callAuthenticated("users/view.json", return getResponse(callAuthenticated("activities/show_activities.json",
"token", token, "token", token,
"id_colleague", idColleague); "id_dashboard", dashboardId,
"last_id", lastId), "activities");
} }
/** /**
* create a dasbhoard * get every notification for the current user
* * @param dashboardId
* @param name * @param lastId
* @return the new created dashboard as JSONObject * @return
* @throws ApiResponseParseException
* @throws ApiServiceException
* @throws IOException
*/ */
public JSONObject dashboardsCreate(String name) throws ApiServiceException, IOException { public JSONArray activitiesShowNotifications(Long dashboardId, Long lastId) throws ApiResponseParseException, ApiServiceException, IOException {
return callAuthenticated("dashboards/create.json", return getResponse(callAuthenticated("activities/show_notifications.json",
"token", token, "token", token,
"title", name); "id_dashboard", dashboardId,
"last_id", lastId), "activities");
} }
// --- users
/** /**
* return the list of users who can access a specific dashboard * get a user
* *
* @param idDashboard * @param idColleague
* @param dashboard array-information about the dashboard, if this ... *
* @return array information about the user
*/ */
public JSONArray dashboardsAccess(long idDashboard, String dashboard) throws ApiServiceException, IOException { public JSONObject usersView(Long idColleague) throws ApiServiceException, IOException {
return getResponse(callAuthenticated("dashboards/access.json", return callAuthenticated("users/view.json",
"token", token, "token", token,
"id_dashboard", idDashboard, "id_colleague", idColleague);
"dashboard", dashboard),"dashboard");
} }
// --- invocation // --- invocation

@ -27,15 +27,19 @@ import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService; import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.service.NotificationManager;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.activity.ShortcutActivity;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.TaskContainer; import com.todoroo.astrid.api.TaskContainer;
import com.todoroo.astrid.common.SyncProvider; import com.todoroo.astrid.common.SyncProvider;
import com.todoroo.astrid.model.Metadata; import com.todoroo.astrid.model.Metadata;
import com.todoroo.astrid.model.StoreObject; import com.todoroo.astrid.model.StoreObject;
import com.todoroo.astrid.model.Task; import com.todoroo.astrid.model.Task;
import com.todoroo.astrid.producteev.ProducteevFilterExposer;
import com.todoroo.astrid.producteev.ProducteevLoginActivity; import com.todoroo.astrid.producteev.ProducteevLoginActivity;
import com.todoroo.astrid.producteev.ProducteevPreferences; import com.todoroo.astrid.producteev.ProducteevPreferences;
import com.todoroo.astrid.producteev.ProducteevUtilities; import com.todoroo.astrid.producteev.ProducteevUtilities;
@ -46,6 +50,7 @@ import com.todoroo.astrid.producteev.api.ProducteevInvoker;
import com.todoroo.astrid.rmilk.data.MilkNote; import com.todoroo.astrid.rmilk.data.MilkNote;
import com.todoroo.astrid.service.AstridDependencyInjector; import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.tags.TagService; import com.todoroo.astrid.tags.TagService;
import com.todoroo.astrid.utility.Constants;
import com.todoroo.astrid.utility.Preferences; import com.todoroo.astrid.utility.Preferences;
@SuppressWarnings("nls") @SuppressWarnings("nls")
@ -85,6 +90,9 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
preferences.setToken(null); preferences.setToken(null);
Preferences.setString(R.string.producteev_PPr_email, null); Preferences.setString(R.string.producteev_PPr_email, null);
Preferences.setString(R.string.producteev_PPr_password, null); Preferences.setString(R.string.producteev_PPr_password, null);
Preferences.setString(ProducteevUtilities.PREF_SERVER_LAST_SYNC, null);
Preferences.setStringFromInteger(R.string.producteev_PPr_defaultdash_key,
ProducteevUtilities.DASHBOARD_DEFAULT);
preferences.clearLastSyncDate(); preferences.clearLastSyncDate();
dataService = ProducteevDataService.getInstance(); dataService = ProducteevDataService.getInstance();
@ -203,9 +211,11 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
long userId = user.getLong("id_user"); long userId = user.getLong("id_user");
String lastServerSync = Preferences.getStringValue(ProducteevUtilities.PREF_SERVER_LAST_SYNC); String lastServerSync = Preferences.getStringValue(ProducteevUtilities.PREF_SERVER_LAST_SYNC);
String lastNotificationId = Preferences.getStringValue(ProducteevUtilities.PREF_SERVER_LAST_NOTIFICATION);
String lastActivityId = Preferences.getStringValue(ProducteevUtilities.PREF_SERVER_LAST_ACTIVITY);
// read dashboards // read dashboards
JSONArray dashboards = invoker.dashboardsShowList(lastServerSync); JSONArray dashboards = invoker.dashboardsShowList(null);
dataService.updateDashboards(dashboards); dataService.updateDashboards(dashboards);
// read labels and tasks for each dashboard // read labels and tasks for each dashboard
@ -247,6 +257,65 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH); Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH);
ContextManager.getContext().sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ); ContextManager.getContext().sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
// notification/activities stuff
JSONArray notifications = invoker.activitiesShowNotifications(null, (lastNotificationId == null ? null : new Long(lastNotificationId)));
ArrayList<String> notificationsList = parseActivities(notifications);
// update lastIds
if (notifications.length() > 0) {
lastNotificationId = ""+notifications.getJSONObject(0).getJSONObject("activity").getLong("id_activity");
}
// JSONArray activities = invoker.activitiesShowActivities(null, (lastActivityId == 0 ? null : new Long(lastActivityId)));
// int activitiesCount = (activities == null ? 0 : activities.length());
// ArrayList<String> activitiesList = parseActivities(activities);
// // update lastIds
// if (activities.length() > 0) {
// lastActivityId = activities.getJSONObject(0).getJSONObject("activity").getLong("id_activity");
// }
// display notifications from producteev-log
Context context = ContextManager.getContext();
final NotificationManager nm = new NotificationManager.AndroidNotificationManager(context);
for (int i = 0; i< notificationsList.size(); i++) {
long id_dashboard = notifications.getJSONObject(i).getJSONObject("activity").getLong("id_dashboard");
String dashboardName = null;
StoreObject[] dashboardsData = ProducteevDataService.getInstance().getDashboards();
ProducteevDashboard dashboard = null;
if (dashboardsData != null) {
for (int j=0; i<dashboardsData.length;i++) {
long id = dashboardsData[j].getValue(ProducteevDashboard.REMOTE_ID);
if (id == id_dashboard) {
dashboardName = dashboardsData[j].getValue(ProducteevDashboard.NAME);
dashboard = new ProducteevDashboard(id, dashboardName, null);
break;
}
}
}
// it seems dashboard is null if we get a notification about an unknown dashboard, just filter it.
if (dashboard != null) {
// initialize notification
int icon = R.drawable.ic_producteev_notification;
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, null, when);
CharSequence contentTitle = context.getString(R.string.producteev_notification_title)+" Workspace \""+dashboard.getName()+"\"";
// CharSequence contentText = context.getString(R.string.producteev_notification_text, notificationsCount);
Filter filter = ProducteevFilterExposer.filterFromList(context, dashboard);
Intent notificationIntent = ShortcutActivity.createIntent(filter);
// filter the tags from the message
String message = notificationsList.get(i).replaceAll("<[^>]+>", "");
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, message, contentIntent);
nm.notify(Constants.NOTIFICATION_PRODUCTEEV_NOTIFICATIONS-i, notification);
}
}
// store lastIds in Preferences
Preferences.setString(ProducteevUtilities.PREF_SERVER_LAST_NOTIFICATION, lastNotificationId);
Preferences.setString(ProducteevUtilities.PREF_SERVER_LAST_ACTIVITY, lastActivityId);
FlurryAgent.onEvent("pdv-sync-finished"); //$NON-NLS-1$ FlurryAgent.onEvent("pdv-sync-finished"); //$NON-NLS-1$
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
// occurs when application was closed // occurs when application was closed
@ -255,6 +324,21 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
} }
} }
/**
* @param actvities
* @return
* @throws JSONException
*/
private ArrayList parseActivities(JSONArray actvities) throws JSONException {
int count = (actvities == null ? 0 : actvities.length());
ArrayList activitiesList = new ArrayList(count);
for(int i = 0; i < actvities.length(); i++) {
String message = actvities.getJSONObject(i).getJSONObject("activity").getString("message");
activitiesList.add(message);
}
return activitiesList;
}
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// ------------------------------------------------------------ sync data // ------------------------------------------------------------ sync data
@ -265,6 +349,12 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
long userId = user.getLong("id_user"); long userId = user.getLong("id_user");
Preferences.setLong(ProducteevUtilities.PREF_DEFAULT_DASHBOARD, defaultDashboard); Preferences.setLong(ProducteevUtilities.PREF_DEFAULT_DASHBOARD, defaultDashboard);
Preferences.setLong(ProducteevUtilities.PREF_USER_ID, userId); Preferences.setLong(ProducteevUtilities.PREF_USER_ID, userId);
// save the default dashboard preference if unset
int defaultDashSetting = Preferences.getIntegerFromString(R.string.producteev_PPr_defaultdash_key,
ProducteevUtilities.DASHBOARD_DEFAULT);
if(defaultDashSetting == ProducteevUtilities.DASHBOARD_DEFAULT)
Preferences.setStringFromInteger(R.string.producteev_PPr_defaultdash_key, (int) defaultDashboard);
} }
// all synchronized properties // all synchronized properties
@ -389,6 +479,7 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
protected void push(ProducteevTaskContainer local, ProducteevTaskContainer remote) throws IOException { protected void push(ProducteevTaskContainer local, ProducteevTaskContainer remote) throws IOException {
long idTask = local.pdvTask.getValue(ProducteevTask.ID); long idTask = local.pdvTask.getValue(ProducteevTask.ID);
long idDashboard = local.pdvTask.getValue(ProducteevTask.DASHBOARD_ID); long idDashboard = local.pdvTask.getValue(ProducteevTask.DASHBOARD_ID);
long idResponsible = local.pdvTask.getValue(ProducteevTask.RESPONSIBLE_ID);
// if local is marked do not sync, handle accordingly // if local is marked do not sync, handle accordingly
if(idDashboard == ProducteevUtilities.DASHBOARD_NO_SYNC) { if(idDashboard == ProducteevUtilities.DASHBOARD_NO_SYNC) {
@ -423,6 +514,12 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
remote = create(local); remote = create(local);
} }
// responsible
if(remote != null && idResponsible !=
remote.pdvTask.getValue(ProducteevTask.RESPONSIBLE_ID)) {
invoker.tasksSetResponsible(idTask, idResponsible);
}
// core properties // core properties
if(shouldTransmit(local, Task.TITLE, remote)) if(shouldTransmit(local, Task.TITLE, remote))
invoker.tasksSetTitle(idTask, local.task.getValue(Task.TITLE)); invoker.tasksSetTitle(idTask, local.task.getValue(Task.TITLE));

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

@ -81,8 +81,8 @@
android:background="@android:drawable/divider_horizontal_dark" /> android:background="@android:drawable/divider_horizontal_dark" />
<!-- notes --> <!-- notes -->
<TextView <TextView android:id="@+id/notes_label"
android:paddingTop="5dip" android:paddingTop="5dip"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/TEA_note_label" android:text="@string/TEA_note_label"

@ -3,8 +3,8 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- ====================== Plugin Boilerplate ========================= --> <!-- ====================== Plugin Boilerplate ========================= -->
<!-- filters header: Producteev --> <!-- filters header: Producteev -->
<string name="producteev_FEx_header">Producteev</string> <string name="producteev_FEx_header">Producteev</string>
<!-- filter category for Producteev dashboards --> <!-- filter category for Producteev dashboards -->
@ -15,6 +15,12 @@
<!-- Producteev dashboard filter title (%s => dashboardname) --> <!-- Producteev dashboard filter title (%s => dashboardname) -->
<string name="producteev_FEx_responsible_title">Assigned To \'%s\'</string> <string name="producteev_FEx_responsible_title">Assigned To \'%s\'</string>
<!-- detail for showing tasks created by someone else (%s => person name) -->
<string name="producteev_PDE_task_from">from %s</string>
<!-- replacement string for task edit "Notes" when using Producteev -->
<string name="producteev_TEA_notes">Add a Comment</string>
<!-- ==================================================== Preferences == --> <!-- ==================================================== Preferences == -->
@ -33,10 +39,7 @@
<!-- dashboard spinner entry on TEA for adding a new dashboard --> <!-- dashboard spinner entry on TEA for adding a new dashboard -->
<string name="producteev_create_dashboard_name">Name for new Workspace</string> <string name="producteev_create_dashboard_name">Name for new Workspace</string>
<!-- dashboard sufffix for local new unsynced dashboards --> <!-- preference title for default dashboard -->
<string name="producteev_create_dashboard_name_suffix">new</string>
<!-- preference title for default dashboard -->
<string name="producteev_PPr_defaultdash_title">Default Workspace</string> <string name="producteev_PPr_defaultdash_title">Default Workspace</string>
<!-- preference description for default dashboard (%s -> setting) --> <!-- preference description for default dashboard (%s -> setting) -->
@ -89,9 +92,12 @@
<!-- ================================================ Synchronization == --> <!-- ================================================ Synchronization == -->
<!-- title for notification tray when synchronizing --> <!-- title for notification tray after synchronizing -->
<string name="producteev_notification_title">Astrid: Producteev</string> <string name="producteev_notification_title">Astrid: Producteev</string>
<!-- text for notification tray when synchronizing -->
<string name="producteev_notification_text">%s tasks updated / click for more details</string>
<!-- Error msg when io exception --> <!-- Error msg when io exception -->
<string name="producteev_ioerror">Connection Error! Check your Internet connection.</string> <string name="producteev_ioerror">Connection Error! Check your Internet connection.</string>

@ -58,6 +58,7 @@ import android.widget.LinearLayout;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TabHost; import android.widget.TabHost;
import android.widget.TextView;
import android.widget.TimePicker; import android.widget.TimePicker;
import android.widget.Toast; import android.widget.Toast;
import android.widget.ToggleButton; import android.widget.ToggleButton;
@ -253,6 +254,8 @@ public final class TaskEditActivity extends TabActivity {
AddOn producteevAddon = addOnService.getAddOn(AddOnService.PRODUCTEEV_PACKAGE, "Producteev"); //$NON-NLS-1$ AddOn producteevAddon = addOnService.getAddOn(AddOnService.PRODUCTEEV_PACKAGE, "Producteev"); //$NON-NLS-1$
if (addOnService.isInstalled(producteevAddon) && ProducteevUtilities.INSTANCE.isLoggedIn()) { if (addOnService.isInstalled(producteevAddon) && ProducteevUtilities.INSTANCE.isLoggedIn()) {
controls.add(new ProducteevControlSet(this, addonsAddons)); controls.add(new ProducteevControlSet(this, addonsAddons));
((TextView)findViewById(R.id.notes)).setHint(R.string.producteev_TEA_notes);
((TextView)findViewById(R.id.notes_label)).setHint(R.string.producteev_TEA_notes);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("astrid-error", "loading-control-set", e); //$NON-NLS-1$ //$NON-NLS-2$ Log.e("astrid-error", "loading-control-set", e); //$NON-NLS-1$ //$NON-NLS-2$
@ -790,7 +793,7 @@ public final class TaskEditActivity extends TabActivity {
Task.URGENCY_TOMORROW); Task.URGENCY_TOMORROW);
String dayAfterTomorrow = DateUtils.getDayOfWeekString( String dayAfterTomorrow = DateUtils.getDayOfWeekString(
new Date(DateUtilities.now() + 2 * DateUtilities.ONE_DAY).getDay() + new Date(DateUtilities.now() + 2 * DateUtilities.ONE_DAY).getDay() +
Calendar.SUNDAY, 0); Calendar.SUNDAY, DateUtils.FORMAT_ABBREV_ALL);
urgencyValues[3] = new UrgencyValue(dayAfterTomorrow, urgencyValues[3] = new UrgencyValue(dayAfterTomorrow,
Task.URGENCY_DAY_AFTER); Task.URGENCY_DAY_AFTER);
urgencyValues[4] = new UrgencyValue(labels[4], urgencyValues[4] = new UrgencyValue(labels[4],

@ -78,6 +78,7 @@ import com.todoroo.astrid.reminders.ReminderService;
import com.todoroo.astrid.reminders.ReminderService.AlarmScheduler; import com.todoroo.astrid.reminders.ReminderService.AlarmScheduler;
import com.todoroo.astrid.rmilk.MilkPreferences; import com.todoroo.astrid.rmilk.MilkPreferences;
import com.todoroo.astrid.service.AddOnService; import com.todoroo.astrid.service.AddOnService;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.MetadataService; import com.todoroo.astrid.service.MetadataService;
import com.todoroo.astrid.service.StartupService; import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.service.TaskService; import com.todoroo.astrid.service.TaskService;
@ -161,6 +162,10 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
* ======================================================= initialization * ======================================================= initialization
* ====================================================================== */ * ====================================================================== */
static {
AstridDependencyInjector.initialize();
}
public TaskListActivity() { public TaskListActivity() {
DependencyInjectionService.getInstance().inject(this); DependencyInjectionService.getInstance().inject(this);
} }

@ -53,4 +53,7 @@ public final class Constants {
/** Notification Manager id for locale */ /** Notification Manager id for locale */
public static final int NOTIFICATION_LOCALE = -3; public static final int NOTIFICATION_LOCALE = -3;
/** Notification Manager id for producteev notifications*/
public static final int NOTIFICATION_PRODUCTEEV_NOTIFICATIONS = -4;
} }

@ -51,12 +51,13 @@ public class TasksWidget extends AppWidgetProvider {
int[] appWidgetIds) { int[] appWidgetIds) {
try { try {
ContextManager.setContext(context);
super.onUpdate(context, appWidgetManager, appWidgetIds); super.onUpdate(context, appWidgetManager, appWidgetIds);
// Start in service to prevent Application Not Responding timeout // Start in service to prevent Application Not Responding timeout
updateWidgets(context); updateWidgets(context);
} catch (SecurityException e) { } catch (Exception e) {
// :( Log.e("astrid-update-widget", "widget update error", e); //$NON-NLS-1$
} }
} }
@ -65,7 +66,7 @@ public class TasksWidget extends AppWidgetProvider {
* @param id * @param id
*/ */
public static void updateWidgets(Context context) { public static void updateWidgets(Context context) {
context.startService(new Intent(ContextManager.getContext(), context.startService(new Intent(context,
TasksWidget.UpdateService.class)); TasksWidget.UpdateService.class));
} }
@ -178,7 +179,7 @@ public class TasksWidget extends AppWidgetProvider {
} }
Intent listIntent = new Intent(context, TaskListActivity.class); Intent listIntent = new Intent(context, TaskListActivity.class);
listIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); listIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
if(filter != null) { if(filter != null) {
listIntent.putExtra(TaskListActivity.TOKEN_FILTER, filter); listIntent.putExtra(TaskListActivity.TOKEN_FILTER, filter);
listIntent.setType(filter.sqlQuery); listIntent.setType(filter.sqlQuery);
@ -188,7 +189,7 @@ public class TasksWidget extends AppWidgetProvider {
views.setOnClickPendingIntent(R.id.taskbody, pendingIntent); views.setOnClickPendingIntent(R.id.taskbody, pendingIntent);
Intent editIntent = new Intent(context, TaskEditActivity.class); Intent editIntent = new Intent(context, TaskEditActivity.class);
editIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); editIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
if(filter != null && filter.valuesForNewTasks != null) { if(filter != null && filter.valuesForNewTasks != null) {
String values = AndroidUtilities.contentValuesToSerializedString(filter.valuesForNewTasks); String values = AndroidUtilities.contentValuesToSerializedString(filter.valuesForNewTasks);
editIntent.putExtra(TaskEditActivity.TOKEN_VALUES, values); editIntent.putExtra(TaskEditActivity.TOKEN_VALUES, values);

Loading…
Cancel
Save