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