blob: 32dbfa77ed04ddde428a85a695cb1a2359e4b939 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package de.pixart.messenger.android;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.text.TextUtils;
public abstract class AbstractPhoneContact {
private final Uri lookupUri;
private final String displayName;
private final String photoUri;
AbstractPhoneContact(Cursor cursor) {
int phoneId = cursor.getInt(cursor.getColumnIndex(ContactsContract.Data._ID));
String lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Data.LOOKUP_KEY));
this.lookupUri = ContactsContract.Contacts.getLookupUri(phoneId, lookupKey);
this.displayName = cursor.getString(cursor.getColumnIndex(ContactsContract.Data.DISPLAY_NAME));
this.photoUri = cursor.getString(cursor.getColumnIndex(ContactsContract.Data.PHOTO_URI));
}
public Uri getLookupUri() {
return lookupUri;
}
public String getDisplayName() {
return displayName;
}
public String getPhotoUri() {
return photoUri;
}
public int rating() {
return (TextUtils.isEmpty(displayName) ? 0 : 2) + (TextUtils.isEmpty(photoUri) ? 0 : 1);
}
}
|