Fixed most other compilation errors related to user_id

pull/14/head
Sam Bosley 13 years ago
parent c7d7167763
commit 2127f81faf

@ -104,10 +104,6 @@ public class EditPeopleControlSet extends PopupControlSet {
private final Fragment fragment; private final Fragment fragment;
private final CheckBox cbFacebook;
private final CheckBox cbTwitter;
private final View sharedWithRow; private final View sharedWithRow;
private final View sharedWithView; private final View sharedWithView;

@ -21,6 +21,7 @@ import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.TaskListActivity; import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.adapter.UpdateAdapter; import com.todoroo.astrid.adapter.UpdateAdapter;
import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.Update; import com.todoroo.astrid.data.Update;
import com.todoroo.astrid.helper.AsyncImageView; import com.todoroo.astrid.helper.AsyncImageView;
import com.todoroo.astrid.service.StatisticsConstants; import com.todoroo.astrid.service.StatisticsConstants;
@ -117,7 +118,7 @@ public class TagCommentsFragment extends CommentsFragment {
Update update = new Update(); Update update = new Update();
update.setValue(Update.MESSAGE, addCommentField.getText().toString()); update.setValue(Update.MESSAGE, addCommentField.getText().toString());
update.setValue(Update.ACTION_CODE, "tag_comment"); update.setValue(Update.ACTION_CODE, "tag_comment");
update.setValue(Update.USER_ID, 0L); update.setValue(Update.USER_ID, Task.USER_ID_SELF);
update.setValue(Update.TAGS, "," + tagData.getValue(TagData.REMOTE_ID) + ","); update.setValue(Update.TAGS, "," + tagData.getValue(TagData.REMOTE_ID) + ",");
update.setValue(Update.TAGS_LOCAL, "," + tagData.getId() + ","); update.setValue(Update.TAGS_LOCAL, "," + tagData.getId() + ",");
update.setValue(Update.CREATION_DATE, DateUtilities.now()); update.setValue(Update.CREATION_DATE, DateUtilities.now());

@ -107,7 +107,7 @@ public class TagViewFragment extends TaskListFragment {
private boolean dataLoaded = false; private boolean dataLoaded = false;
private long currentId = Task.USER_ID_IGNORE; private String currentId = Task.USER_ID_IGNORE;
protected AtomicBoolean isBeingFiltered = new AtomicBoolean(false); protected AtomicBoolean isBeingFiltered = new AtomicBoolean(false);
@ -361,7 +361,7 @@ public class TagViewFragment extends TaskListFragment {
} }
// Handle creator // Handle creator
JSONObject owner; JSONObject owner;
if(tagData.getValue(TagData.USER_ID) != 0) { if(!Task.USER_ID_SELF.equals(tagData.getValue(TagData.USER_ID))) {
owner = new JSONObject(tagData.getValue(TagData.USER)); owner = new JSONObject(tagData.getValue(TagData.USER));
} else { } else {
owner = ActFmPreferenceService.thisUser(); owner = ActFmPreferenceService.thisUser();
@ -396,13 +396,13 @@ public class TagViewFragment extends TaskListFragment {
(int)(43 * displayMetrics.density))); (int)(43 * displayMetrics.density)));
image.setDefaultImageResource(R.drawable.icn_default_person_image); image.setDefaultImageResource(R.drawable.icn_default_person_image);
if (member.optLong("id", Task.USER_ID_SELF) == Task.USER_ID_UNASSIGNED) if (Task.USER_ID_UNASSIGNED.equals(Long.toString(member.optLong("id", 0))))
image.setDefaultImageResource(R.drawable.icn_anyone); image.setDefaultImageResource(R.drawable.icn_anyone);
image.setScaleType(ImageView.ScaleType.FIT_CENTER); image.setScaleType(ImageView.ScaleType.FIT_CENTER);
try { try {
final long id = member.optLong("id", Task.USER_ID_EMAIL); final String id = Long.toString(member.optLong("id", -2));
if (id == ActFmPreferenceService.userId()) if (ActFmPreferenceService.userId().equals(id))
member = ActFmPreferenceService.thisUser(); member = ActFmPreferenceService.thisUser();
final JSONObject memberToUse = member; final JSONObject memberToUse = member;
@ -419,22 +419,22 @@ public class TagViewFragment extends TaskListFragment {
membersView.addView(image); membersView.addView(image);
} }
private OnClickListener listenerForImage(final JSONObject member, final long id, final String displayName) { private OnClickListener listenerForImage(final JSONObject member, final String id, final String displayName) {
return new OnClickListener() { return new OnClickListener() {
final String email = member.optString("email"); //$NON-NLS-1$ final String email = member.optString("email"); //$NON-NLS-1$
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (currentId == id) { if (currentId.equals(id)) {
// Back to all // Back to all
resetAssignedFilter(); resetAssignedFilter();
} else { } else {
// New filter // New filter
currentId = id; currentId = id;
Criterion assignedCriterion; Criterion assignedCriterion;
if (currentId == ActFmPreferenceService.userId()) if (ActFmPreferenceService.userId().equals(currentId))
assignedCriterion = Criterion.or(Task.USER_ID.eq(0), Task.USER_ID.eq(id)); assignedCriterion = Criterion.or(Task.USER_ID.eq(0), Task.USER_ID.eq(id));
else if (currentId == Task.USER_ID_EMAIL && !TextUtils.isEmpty(email)) else if (Task.USER_ID_EMAIL.equals(currentId) && !TextUtils.isEmpty(email))
assignedCriterion = Task.USER.like("%" + email + "%"); //$NON-NLS-1$ //$NON-NLS-2$ assignedCriterion = Criterion.or(Task.USER_EMAIL.eq(email), Task.USER.like("%" + email + "%")); //$NON-NLS-1$ //$NON-NLS-2$
else else
assignedCriterion = Task.USER_ID.eq(id); assignedCriterion = Task.USER_ID.eq(id);
Criterion assigned = Criterion.and(TaskCriteria.activeAndVisible(), assignedCriterion); Criterion assigned = Criterion.and(TaskCriteria.activeAndVisible(), assignedCriterion);

@ -87,9 +87,9 @@ public class TaskCommentsFragment extends CommentsFragment {
Update update = new Update(); Update update = new Update();
update.setValue(Update.MESSAGE, addCommentField.getText().toString()); update.setValue(Update.MESSAGE, addCommentField.getText().toString());
update.setValue(Update.ACTION_CODE, UpdateAdapter.UPDATE_TASK_COMMENT); update.setValue(Update.ACTION_CODE, UpdateAdapter.UPDATE_TASK_COMMENT);
update.setValue(Update.USER_ID, 0L); update.setValue(Update.USER_ID, Task.USER_ID_SELF);
if (task.containsNonNullValue(Task.REMOTE_ID)) if (task.containsNonNullValue(Task.REMOTE_ID))
update.setValue(Update.TASK, task.getValue(Task.REMOTE_ID)); update.setValue(Update.TASK_UUID, task.getValue(Task.UUID));
update.setValue(Update.TASK_LOCAL, task.getId()); update.setValue(Update.TASK_LOCAL, task.getId());
update.setValue(Update.CREATION_DATE, DateUtilities.now()); update.setValue(Update.CREATION_DATE, DateUtilities.now());
update.setValue(Update.TARGET_NAME, task.getValue(Task.TITLE)); update.setValue(Update.TARGET_NAME, task.getValue(Task.TITLE));

@ -209,7 +209,7 @@ public class ReminderDialog extends Dialog {
for (int i = 0; i < array.length(); i++) { for (int i = 0; i < array.length(); i++) {
JSONObject person = array.getJSONObject(i); JSONObject person = array.getJSONObject(i);
if (person.has("picture")) { //$NON-NLS-1$ if (person.has("picture")) { //$NON-NLS-1$
if (person.optLong("id") == ActFmPreferenceService.userId()) //$NON-NLS-1$ if (ActFmPreferenceService.userId().equals(Long.toString(person.optLong("id")))) //$NON-NLS-1$
continue; continue;
isSharedTask.set(true); isSharedTask.set(true);
String pictureUrl = person.getString("picture"); //$NON-NLS-1$ String pictureUrl = person.getString("picture"); //$NON-NLS-1$

@ -271,7 +271,7 @@ public class PeopleContainer extends LinearLayout {
JSONObject person = people.getJSONObject(i); JSONObject person = people.getJSONObject(i);
TextView textView = null; TextView textView = null;
String imageURL = person.optString("picture", ""); String imageURL = person.optString("picture", "");
if(person.has("id") && person.getLong("id") == ActFmPreferenceService.userId()) if(person.has("id") && ActFmPreferenceService.userId().equals(Long.toString(person.getLong("id"))))
textView = addPerson(Preferences.getStringValue(ActFmPreferenceService.PREF_NAME), imageURL); textView = addPerson(Preferences.getStringValue(ActFmPreferenceService.PREF_NAME), imageURL);
else if(!TextUtils.isEmpty(person.optString("name")) && !"null".equals(person.optString("name"))) else if(!TextUtils.isEmpty(person.optString("name")) && !"null".equals(person.optString("name")))
textView = addPerson(person.getString("name"), imageURL); textView = addPerson(person.getString("name"), imageURL);

Loading…
Cancel
Save