Skip to content

Commit

Permalink
Bug fix for custom type labels. 1.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
broakenmedia committed Oct 2, 2018
1 parent c35eef9 commit ccc00c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ static void mapEmail (Cursor cursor, Contact contact, int columnIndex) {
}
}

static void mapPhoneNumber (Context con, Cursor cursor, Contact contact, int noColumnIndex, int typeColIndex) {
static void mapPhoneNumber (Context con, Cursor cursor, Contact contact, int noColumnIndex, int typeColIndex, int labelColIndex) {
String phoneNumber = cursor.getString(noColumnIndex);
int phonetype = cursor.getInt(typeColIndex);
String customLabel = cursor.getString(typeColIndex);
String customLabel = cursor.getString(labelColIndex);
String phoneLabel = (String) ContactsContract.CommonDataKinds.Phone.getTypeLabel(con.getResources(), phonetype, customLabel);
if (phoneNumber != null && !phoneNumber.isEmpty()) {
// Remove all whitespaces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public class RxContacts {
private static final String[] NUMBER_PROJECTION = {
ContactsContract.CommonDataKinds.Phone.CONTACT_ID,
ContactsContract.CommonDataKinds.Phone.NUMBER,
ContactsContract.CommonDataKinds.Phone.TYPE
ContactsContract.CommonDataKinds.Phone.TYPE,
ContactsContract.CommonDataKinds.Phone.LABEL
};


Expand Down Expand Up @@ -158,8 +159,9 @@ private void getPhoneNumber(long id, Cursor cursor, Contact contact, int hasPhon
phoneCursor.moveToFirst();
int phoneNumberColumnIndex = phoneCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
int phoneNumberTypeIndex = phoneCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE);
int labelColIndex = phoneCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.LABEL);
while (!phoneCursor.isAfterLast()) {
ColumnMapper.mapPhoneNumber(mContext, phoneCursor, contact, phoneNumberColumnIndex, phoneNumberTypeIndex);
ColumnMapper.mapPhoneNumber(mContext, phoneCursor, contact, phoneNumberColumnIndex, phoneNumberTypeIndex, labelColIndex);
phoneCursor.moveToNext();
}
phoneCursor.close();
Expand Down

0 comments on commit ccc00c5

Please sign in to comment.