|
|
|
@ -5,6 +5,10 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
package com.todoroo.astrid.activity;
|
|
|
|
package com.todoroo.astrid.activity;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.json.JSONArray;
|
|
|
|
|
|
|
|
import org.json.JSONException;
|
|
|
|
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
|
import android.animation.LayoutTransition;
|
|
|
|
import android.animation.LayoutTransition;
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.app.SearchManager;
|
|
|
|
import android.app.SearchManager;
|
|
|
|
@ -47,6 +51,7 @@ import com.todoroo.astrid.api.AstridApiConstants;
|
|
|
|
import com.todoroo.astrid.api.Filter;
|
|
|
|
import com.todoroo.astrid.api.Filter;
|
|
|
|
import com.todoroo.astrid.api.FilterListItem;
|
|
|
|
import com.todoroo.astrid.api.FilterListItem;
|
|
|
|
import com.todoroo.astrid.core.CustomFilterExposer;
|
|
|
|
import com.todoroo.astrid.core.CustomFilterExposer;
|
|
|
|
|
|
|
|
import com.todoroo.astrid.dao.TagMetadataDao;
|
|
|
|
import com.todoroo.astrid.data.TagData;
|
|
|
|
import com.todoroo.astrid.data.TagData;
|
|
|
|
import com.todoroo.astrid.data.Task;
|
|
|
|
import com.todoroo.astrid.data.Task;
|
|
|
|
import com.todoroo.astrid.people.PeopleFilterMode;
|
|
|
|
import com.todoroo.astrid.people.PeopleFilterMode;
|
|
|
|
@ -94,6 +99,8 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired private ABTestEventReportingService abTestEventReportingService;
|
|
|
|
@Autowired private ABTestEventReportingService abTestEventReportingService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired private TagMetadataDao tagMetadataDao;
|
|
|
|
|
|
|
|
|
|
|
|
private View listsNav;
|
|
|
|
private View listsNav;
|
|
|
|
private ImageView listsNavDisclosure;
|
|
|
|
private ImageView listsNavDisclosure;
|
|
|
|
private TextView lists;
|
|
|
|
private TextView lists;
|
|
|
|
@ -679,68 +686,65 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void checkAddTagMember(final TaskListFragment tlf, final String assignedDisplay, String assignedEmail, String assignedId) {
|
|
|
|
private void checkAddTagMember(final TaskListFragment tlf, final String assignedDisplay, String assignedEmail, final String assignedId) {
|
|
|
|
throw new RuntimeException("Hey Sam! You should reimplement this");
|
|
|
|
final TagData td = tlf.getActiveTagData();
|
|
|
|
// final TagData td = tlf.getActiveTagData();
|
|
|
|
if (td != null) {
|
|
|
|
// if (td != null) {
|
|
|
|
String members = td.getValue(TagData.MEMBERS);
|
|
|
|
// String members = td.getValue(TagData.MEMBERS);
|
|
|
|
|
|
|
|
// if (members == null)
|
|
|
|
boolean memberFound = false;
|
|
|
|
// members = ""; //$NON-NLS-1$
|
|
|
|
if (TextUtils.isEmpty(members))
|
|
|
|
// if (TextUtils.isEmpty(members) || TextUtils.isEmpty(assignedEmail) || !members.contains(assignedEmail)) {
|
|
|
|
memberFound = td.getValue(TagData.USER_ID).equals(assignedId) || tagMetadataDao.memberOfTagData(assignedEmail, assignedId);
|
|
|
|
// // show dialog to ask if user should be added to the tag-members
|
|
|
|
else {
|
|
|
|
// JSONObject user = new JSONObject();
|
|
|
|
JSONObject user = new JSONObject();
|
|
|
|
// JSONArray membersArray = null;
|
|
|
|
JSONArray membersArray = null;
|
|
|
|
// boolean memberFound = false;
|
|
|
|
try {
|
|
|
|
// try {
|
|
|
|
if (!TextUtils.isEmpty(assignedEmail))
|
|
|
|
// if (!TextUtils.isEmpty(assignedEmail))
|
|
|
|
user.put("email", assignedEmail); //$NON-NLS-1$
|
|
|
|
// user.put("email", assignedEmail); //$NON-NLS-1$
|
|
|
|
if (Task.isRealUserId(assignedId))
|
|
|
|
// if (assignedId > 0)
|
|
|
|
user.put("id", assignedId); //$NON-NLS-1$
|
|
|
|
// user.put("id", assignedId); //$NON-NLS-1$
|
|
|
|
membersArray = new JSONArray(members);
|
|
|
|
// membersArray = new JSONArray(members);
|
|
|
|
|
|
|
|
//
|
|
|
|
for (int i = 0; i < membersArray.length(); i++) {
|
|
|
|
// for (int i = 0; i < membersArray.length(); i++) {
|
|
|
|
JSONObject member = membersArray.getJSONObject(i);
|
|
|
|
// JSONObject member = membersArray.getJSONObject(i);
|
|
|
|
String memberId = Long.toString(member.optLong("id", -3)); //$NON-NLS-1$
|
|
|
|
// long memberId = member.optLong("id", Task.USER_ID_IGNORE); //$NON-NLS-1$
|
|
|
|
if (Task.isRealUserId(memberId) && memberId.equals(assignedId)) {
|
|
|
|
// if (memberId > 0 && memberId == assignedId) {
|
|
|
|
memberFound = true;
|
|
|
|
// memberFound = true;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (!memberFound) {
|
|
|
|
if (!memberFound) {
|
|
|
|
// String ownerString = td.getValue(TagData.USER);
|
|
|
|
String ownerString = td.getValue(TagData.USER);
|
|
|
|
// JSONObject owner = new JSONObject(ownerString);
|
|
|
|
if (!TextUtils.isEmpty(ownerString)) {
|
|
|
|
// long ownerId = owner.optLong("id", Task.USER_ID_IGNORE); //$NON-NLS-1$
|
|
|
|
JSONObject owner = new JSONObject(ownerString);
|
|
|
|
// if (ownerId > 0 && assignedId == ownerId)
|
|
|
|
String ownerId = Long.toString(owner.optLong("id", -3)); //$NON-NLS-1$
|
|
|
|
// memberFound = true;
|
|
|
|
if (Task.isRealUserId(ownerId) && assignedId.equals(ownerId))
|
|
|
|
// }
|
|
|
|
memberFound = true;
|
|
|
|
// } catch (JSONException e) {
|
|
|
|
}
|
|
|
|
// return;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
} catch (JSONException e) {
|
|
|
|
//
|
|
|
|
return;
|
|
|
|
// if (memberFound)
|
|
|
|
}
|
|
|
|
// return;
|
|
|
|
}
|
|
|
|
//
|
|
|
|
|
|
|
|
// membersArray.put(user);
|
|
|
|
if (memberFound)
|
|
|
|
//
|
|
|
|
return;
|
|
|
|
// final JSONArray finalArray = membersArray;
|
|
|
|
|
|
|
|
// DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
|
|
|
|
DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
|
|
|
|
// @Override
|
|
|
|
@Override
|
|
|
|
// public void onClick(DialogInterface d, int which) {
|
|
|
|
public void onClick(DialogInterface d, int which) {
|
|
|
|
// td.setValue(TagData.MEMBERS, finalArray.toString());
|
|
|
|
tagMetadataDao.createMemberLink(td.getId(), td.getUuid(), assignedId, false);
|
|
|
|
// td.setValue(TagData.MEMBER_COUNT, finalArray.length());
|
|
|
|
tlf.refresh();
|
|
|
|
// PluginServices.getTagDataService().save(td);
|
|
|
|
}
|
|
|
|
// tlf.refresh();
|
|
|
|
};
|
|
|
|
// }
|
|
|
|
DialogUtilities.okCancelCustomDialog(this,
|
|
|
|
// };
|
|
|
|
getString(R.string.actfm_EPA_add_person_to_list_title),
|
|
|
|
// DialogUtilities.okCancelCustomDialog(this,
|
|
|
|
getString(R.string.actfm_EPA_add_person_to_list, assignedDisplay, assignedDisplay),
|
|
|
|
// getString(R.string.actfm_EPA_add_person_to_list_title),
|
|
|
|
R.string.actfm_EPA_add_person_to_list_ok,
|
|
|
|
// getString(R.string.actfm_EPA_add_person_to_list, assignedDisplay, assignedDisplay),
|
|
|
|
R.string.actfm_EPA_add_person_to_list_cancel,
|
|
|
|
// R.string.actfm_EPA_add_person_to_list_ok,
|
|
|
|
android.R.drawable.ic_dialog_alert,
|
|
|
|
// R.string.actfm_EPA_add_person_to_list_cancel,
|
|
|
|
okListener, null);
|
|
|
|
// android.R.drawable.ic_dialog_alert,
|
|
|
|
}
|
|
|
|
// okListener, null);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void incrementFilterCount(Filter filter) {
|
|
|
|
public void incrementFilterCount(Filter filter) {
|
|
|
|
|