Don't create a canonical id for every character typed.

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-07-14 14:31:03 -07:00
parent 2ef0054840
commit 410ec57f80
4 changed files with 9 additions and 4 deletions

View file

@ -33,7 +33,7 @@
android:layout_marginLeft="5dp"
android:hint="Enter name or number"
android:inputType="textPersonName"
android:theme="@style/TextSecure.TitleTextStyle"
style="@style/TextSecure.TitleTextStyle"
android:background="@android:color/transparent"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"/>

View file

@ -9,6 +9,7 @@ import android.widget.TextView;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.components.AvatarImageView;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientFactory;
import org.thoughtcrime.securesms.recipients.Recipients;
@ -50,7 +51,10 @@ public class ContactSelectionListItem extends RelativeLayout implements Recipien
this.id = id;
this.number = number;
if (number != null) {
if (type == ContactsDatabase.NEW_TYPE) {
this.recipients = null;
this.contactPhotoImage.setAvatar(Recipient.getUnknownRecipient(), false);
} else if (number != null) {
this.recipients = RecipientFactory.getRecipientsFromString(getContext(), number, true);
this.recipients.addListener(this);
}

View file

@ -60,6 +60,7 @@ public class ContactsDatabase {
public static final int NORMAL_TYPE = 0;
public static final int PUSH_TYPE = 1;
public static final int NEW_TYPE = 2;
private final Context context;
@ -226,7 +227,7 @@ public class ContactsDatabase {
MatrixCursor newNumberCursor = new MatrixCursor(new String[] {ID_COLUMN, NAME_COLUMN, NUMBER_COLUMN, NUMBER_TYPE_COLUMN, LABEL_COLUMN, CONTACT_TYPE_COLUMN}, 1);
newNumberCursor.addRow(new Object[]{-1L, context.getString(R.string.contact_selection_list__unknown_contact),
filter, ContactsContract.CommonDataKinds.Phone.TYPE_CUSTOM,
"\u21e2", NORMAL_TYPE});
"\u21e2", NEW_TYPE});
return newNumberCursor;
}

View file

@ -142,7 +142,7 @@ public class Recipient {
public static Recipient getUnknownRecipient() {
return new Recipient(-1, new RecipientDetails("Unknown", "Unknown", null,
ContactPhotoFactory.getDefaultContactPhoto("Unknown"), null));
ContactPhotoFactory.getDefaultContactPhoto(null), null));
}
@Override