Remove list sharing

pull/14/head
Alex Baker 11 years ago
parent 3902f967ee
commit 71965c0a5f

@ -104,7 +104,6 @@ public class TagSettingsActivity extends SherlockFragmentActivity {
@Autowired TagMetadataDao tagMetadataDao; @Autowired TagMetadataDao tagMetadataDao;
private PeopleContainer tagMembers;
private AsyncImageView picture; private AsyncImageView picture;
private EditText tagName; private EditText tagName;
private EditText tagDescription; private EditText tagDescription;
@ -213,7 +212,6 @@ public class TagSettingsActivity extends SherlockFragmentActivity {
}); });
} }
tagMembers = (PeopleContainer) findViewById(R.id.members_container);
tagName = (EditText) findViewById(R.id.tag_name); tagName = (EditText) findViewById(R.id.tag_name);
tagDescription = (EditText) findViewById(R.id.tag_description); tagDescription = (EditText) findViewById(R.id.tag_description);
picture = (AsyncImageView) findViewById(R.id.picture); picture = (AsyncImageView) findViewById(R.id.picture);
@ -314,33 +312,14 @@ public class TagSettingsActivity extends SherlockFragmentActivity {
} }
} }
JSONArray members; JSONArray members = new JSONArray();
try {
members = tagMembers.parseSharedWithAndTags(this, true).optJSONArray("p");
} catch (JSONException e) {
exceptionService.displayAndReportError(this, "save-people", e);
return;
} catch (ParseSharedException e) {
if(e.view != null) {
e.view.setTextColor(Color.RED);
e.view.requestFocus();
}
DialogUtilities.okDialog(this, e.message, null);
return;
}
if (members == null) {
members = new JSONArray();
}
if(members.length() > 0 && !actFmPreferenceService.isLoggedIn()) { if(members.length() > 0 && !actFmPreferenceService.isLoggedIn()) {
if(newName.length() > 0 && oldName.length() == 0) { if(newName.length() > 0 && oldName.length() == 0) {
tagDataService.save(tagData); tagDataService.save(tagData);
} }
tagMembers.removeAllViews();
tagMembers.addPerson("", "", false); //$NON-NLS-1$
return; return;
} }
int oldMemberCount = tagData.getValue(TagData.MEMBER_COUNT); int oldMemberCount = tagData.getValue(TagData.MEMBER_COUNT);
@ -436,7 +415,6 @@ public class TagSettingsActivity extends SherlockFragmentActivity {
@SuppressWarnings("nls") @SuppressWarnings("nls")
private void updateMembers(String peopleJson, String tagUuid) { private void updateMembers(String peopleJson, String tagUuid) {
tagMembers.removeAllViews();
JSONArray people = null; JSONArray people = null;
try { try {
people = new JSONArray(peopleJson); people = new JSONArray(peopleJson);
@ -499,25 +477,6 @@ public class TagSettingsActivity extends SherlockFragmentActivity {
} }
} }
if (people != null) {
try {
tagMembers.fromJSONArray(people);
} catch (JSONException e) {
Log.e("tag-settings", "Error parsing tag members: " + people, e);
}
}
tagMembers.addPerson("", "", false); //$NON-NLS-1$
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if(tagMembers.getChildCount() > 1) {
JSONArray members = tagMembers.toJSONArray();
outState.putString(MEMBERS_IN_PROGRESS, members.toString());
}
} }
@Override @Override

@ -102,31 +102,6 @@
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<TextView
style="@style/TextAppearance"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="1dip"
android:layout_marginTop="10dip"
android:paddingBottom="5dip"
android:text="@string/actfm_TVA_members_label" />
<com.todoroo.astrid.ui.PeopleContainer
android:id="@+id/members_container"
style="@style/EditRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<TextView
style="@style/TextAppearance"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="1dip"
android:paddingBottom="5dip"
android:textSize="14sp"
android:text="@string/actfm_TVA_members_hint" />
<TextView <TextView
android:id="@+id/description_label" android:id="@+id/description_label"
style="@style/TextAppearance" style="@style/TextAppearance"

@ -227,7 +227,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
private ImageButton voiceAddNoteButton; private ImageButton voiceAddNoteButton;
private EditPeopleControlSet peopleControlSet = null;
private EditNotesControlSet notesControlSet = null; private EditNotesControlSet notesControlSet = null;
private HideUntilControlSet hideUntilControls = null; private HideUntilControlSet hideUntilControls = null;
private TagsControlSet tagsControlSet = null; private TagsControlSet tagsControlSet = null;
@ -470,17 +469,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
controlSetMap.put(getString(R.string.TEA_ctrl_lists_pref), controlSetMap.put(getString(R.string.TEA_ctrl_lists_pref),
tagsControlSet); tagsControlSet);
// EditPeopleControlSet relies on the "tags" transitory created by the
// TagsControlSet, so we put the tags control before the people control
peopleControlSet = new EditPeopleControlSet(getActivity(), this,
R.layout.control_set_assigned,
R.layout.control_set_default_display,
R.string.actfm_EPA_assign_label_long, REQUEST_LOG_IN);
controls.add(peopleControlSet);
controlSetMap.put(getString(R.string.TEA_ctrl_who_pref),
peopleControlSet);
RepeatControlSet repeatControls = new RepeatControlSet(getActivity(), RepeatControlSet repeatControls = new RepeatControlSet(getActivity(),
R.layout.control_set_repeat, R.layout.control_set_repeat,
R.layout.control_set_repeat_display, R.string.repeat_enabled); R.layout.control_set_repeat_display, R.string.repeat_enabled);
@ -958,39 +946,21 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
} }
} }
String processedToast = addDueTimeToToast(toast.toString()); addDueTimeToToast(toast.toString());
boolean cancelFinish = peopleControlSet != null
&& !peopleControlSet.saveSharingSettings(processedToast) && !onPause;
boolean tagsChanged = Flags.check(Flags.TAGS_CHANGED); boolean tagsChanged = Flags.check(Flags.TAGS_CHANGED);
model.putTransitory(TaskService.TRANS_EDIT_SAVE, true); model.putTransitory(TaskService.TRANS_EDIT_SAVE, true);
taskService.save(model); taskService.save(model);
if (!onPause && !cancelFinish) { if (!onPause) {
boolean taskEditActivity = (getActivity() instanceof TaskEditActivity); boolean taskEditActivity = (getActivity() instanceof TaskEditActivity);
boolean isAssignedToMe = peopleControlSet.isAssignedToMe();
boolean showRepeatAlert = model.getTransitory(TaskService.TRANS_REPEAT_CHANGED) != null boolean showRepeatAlert = model.getTransitory(TaskService.TRANS_REPEAT_CHANGED) != null
&& !TextUtils.isEmpty(model.getValue(Task.RECURRENCE)); && !TextUtils.isEmpty(model.getValue(Task.RECURRENCE));
String assignedTo = peopleControlSet.getAssignedToString();
String assignedEmail = ""; //$NON-NLS-1$
String assignedId = Task.USER_ID_IGNORE;
if (Task.userIdIsEmail(model.getValue(Task.USER_ID))) { if (Task.userIdIsEmail(model.getValue(Task.USER_ID))) {
assignedEmail = model.getValue(Task.USER_ID);
} }
if (taskEditActivity) { if (taskEditActivity) {
Intent data = new Intent(); Intent data = new Intent();
if (!isAssignedToMe) {
data.putExtra(TOKEN_TASK_WAS_ASSIGNED, true);
data.putExtra(TOKEN_ASSIGNED_TO_DISPLAY, assignedTo);
if (!TextUtils.isEmpty(assignedEmail)) {
data.putExtra(TOKEN_ASSIGNED_TO_EMAIL, assignedEmail);
}
if (Task.isRealUserId(assignedId)) {
;
}
data.putExtra(TOKEN_ASSIGNED_TO_ID, assignedId);
}
if (showRepeatAlert) { if (showRepeatAlert) {
data.putExtra(TOKEN_NEW_REPEATING_TASK, model); data.putExtra(TOKEN_NEW_REPEATING_TASK, model);
} }
@ -1001,9 +971,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
// Notify task list fragment in multi-column case // Notify task list fragment in multi-column case
// since the activity isn't actually finishing // since the activity isn't actually finishing
TaskListActivity tla = (TaskListActivity) getActivity(); TaskListActivity tla = (TaskListActivity) getActivity();
if (!isAssignedToMe) { if (showRepeatAlert) {
tla.taskAssignedTo(assignedTo, assignedEmail, assignedId);
} else if (showRepeatAlert) {
DateChangedAlerts.showRepeatChangedDialog(tla, model); DateChangedAlerts.showRepeatChangedDialog(tla, model);
} }
@ -1022,11 +990,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
public boolean onKeyDown(int keyCode) { public boolean onKeyDown(int keyCode) {
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {
if (title.getText().length() == 0 || !peopleControlSet.hasLoadedUI()) { discardButtonClick();
discardButtonClick();
} else {
saveButtonClick();
}
return true; return true;
} }
return false; return false;
@ -1370,9 +1334,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
} }
}); });
// respond to sharing logoin
peopleControlSet.onActivityResult(requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
} }

Loading…
Cancel
Save