diff --git a/src/org/thoughtcrime/securesms/SmsSendtoActivity.java b/src/org/thoughtcrime/securesms/SmsSendtoActivity.java index 5b63b2def8..e36f161560 100644 --- a/src/org/thoughtcrime/securesms/SmsSendtoActivity.java +++ b/src/org/thoughtcrime/securesms/SmsSendtoActivity.java @@ -38,7 +38,7 @@ public class SmsSendtoActivity extends Activity { destination = getDestinationForView(original); } - Recipients recipients = RecipientFactory.getRecipientsFromString(this, destination.getDestination(), false); + Recipients recipients = RecipientFactory.getRecipientsFromString(this, destination.getDestination(), true); long threadId = DatabaseFactory.getThreadDatabase(this).getThreadIdIfExistsFor(recipients); final Intent nextIntent; diff --git a/src/org/thoughtcrime/securesms/components/PushRecipientsPanel.java b/src/org/thoughtcrime/securesms/components/PushRecipientsPanel.java index 3efd39b226..30ff3dbd9e 100644 --- a/src/org/thoughtcrime/securesms/components/PushRecipientsPanel.java +++ b/src/org/thoughtcrime/securesms/components/PushRecipientsPanel.java @@ -36,6 +36,7 @@ import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientFactory; import org.thoughtcrime.securesms.recipients.RecipientFormattingException; import org.thoughtcrime.securesms.recipients.Recipients; +import org.thoughtcrime.securesms.recipients.Recipients.RecipientsModifiedListener; import java.util.HashSet; import java.util.Iterator; @@ -49,7 +50,7 @@ import java.util.Set; * * @author Moxie Marlinspike */ -public class PushRecipientsPanel extends RelativeLayout { +public class PushRecipientsPanel extends RelativeLayout implements RecipientsModifiedListener { private final String TAG = PushRecipientsPanel.class.getSimpleName(); private RecipientsPanelChangedListener panelChangeListener; @@ -90,7 +91,7 @@ public class PushRecipientsPanel extends RelativeLayout { public Recipients getRecipients() throws RecipientFormattingException { String rawText = recipientsText.getText().toString(); - Recipients recipients = RecipientFactory.getRecipientsFromString(getContext(), rawText, false); + Recipients recipients = RecipientFactory.getRecipientsFromString(getContext(), rawText, true); if (recipients.isEmpty()) throw new RecipientFormattingException("Recipient List Is Empty!"); @@ -129,6 +130,7 @@ public class PushRecipientsPanel extends RelativeLayout { } catch (RecipientFormattingException e) { recipients = RecipientFactory.getRecipientsFor(getContext(), new LinkedList(), true); } + recipients.addListener(this); recipientsText.setAdapter(new RecipientsAdapter(this.getContext())); recipientsText.populate(recipients); @@ -149,6 +151,10 @@ public class PushRecipientsPanel extends RelativeLayout { }); } + @Override public void onModified(Recipients recipients) { + recipientsText.populate(recipients); + } + private class FocusChangedListener implements View.OnFocusChangeListener { public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus && (panelChangeListener != null)) { diff --git a/src/org/thoughtcrime/securesms/components/SingleRecipientPanel.java b/src/org/thoughtcrime/securesms/components/SingleRecipientPanel.java index 9d9662c00b..1685ad75c3 100644 --- a/src/org/thoughtcrime/securesms/components/SingleRecipientPanel.java +++ b/src/org/thoughtcrime/securesms/components/SingleRecipientPanel.java @@ -17,7 +17,6 @@ package org.thoughtcrime.securesms.components; import android.content.Context; -import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; @@ -33,6 +32,7 @@ import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientFactory; import org.thoughtcrime.securesms.recipients.RecipientFormattingException; import org.thoughtcrime.securesms.recipients.Recipients; +import org.thoughtcrime.securesms.recipients.Recipients.RecipientsModifiedListener; import java.util.Iterator; import java.util.LinkedList; @@ -44,7 +44,7 @@ import java.util.List; * * @author Moxie Marlinspike */ -public class SingleRecipientPanel extends RelativeLayout { +public class SingleRecipientPanel extends RelativeLayout implements RecipientsModifiedListener { private final String TAG = SingleRecipientPanel.class.getSimpleName(); private RecipientsPanelChangedListener panelChangeListener; @@ -94,7 +94,7 @@ public class SingleRecipientPanel extends RelativeLayout { public Recipients getRecipients() throws RecipientFormattingException { String rawText = recipientsText.getText().toString(); - Recipients recipients = RecipientFactory.getRecipientsFromString(getContext(), rawText, false); + Recipients recipients = RecipientFactory.getRecipientsFromString(getContext(), rawText, true); if (recipients.isEmpty()) throw new RecipientFormattingException("Recipient List Is Empty!"); @@ -132,6 +132,7 @@ public class SingleRecipientPanel extends RelativeLayout { } catch (RecipientFormattingException e) { recipients = RecipientFactory.getRecipientsFor(getContext(), new LinkedList(), true); } + recipients.addListener(this); recipientsText.setAdapter(new RecipientsAdapter(this.getContext())); recipientsText.populate(recipients); @@ -152,6 +153,10 @@ public class SingleRecipientPanel extends RelativeLayout { }); } + @Override public void onModified(Recipients recipients) { + recipientsText.populate(recipients); + } + private class FocusChangedListener implements OnFocusChangeListener { public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus && (panelChangeListener != null)) {