use of fr.neamar.kiss.ui.ImprovedQuickContactBadge in project KISS by Neamar.
the class ContactsResult method display.
@Override
public View display(Context context, int position, View v) {
if (v == null)
v = inflateFromId(context, R.layout.item_contact);
// Contact name
TextView contactName = (TextView) v.findViewById(R.id.item_contact_name);
contactName.setText(enrichText(contactPojo.displayName, context));
// Contact phone
TextView contactPhone = (TextView) v.findViewById(R.id.item_contact_phone);
contactPhone.setText(contactPojo.phone);
// Contact photo
ImprovedQuickContactBadge contactIcon = (ImprovedQuickContactBadge) v.findViewById(R.id.item_contact_icon);
contactIcon.setImageDrawable(getDrawable(context));
contactIcon.assignContactUri(Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, String.valueOf(contactPojo.lookupKey)));
contactIcon.setExtraOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
recordLaunch(v.getContext());
queryInterface.launchOccurred(-1, ContactsResult.this);
}
});
int primaryColor = Color.parseColor(UiTweaks.getPrimaryColor(context));
// Phone action
ImageButton phoneButton = (ImageButton) v.findViewById(R.id.item_contact_action_phone);
phoneButton.setColorFilter(primaryColor);
// Message action
ImageButton messageButton = (ImageButton) v.findViewById(R.id.item_contact_action_message);
messageButton.setColorFilter(primaryColor);
PackageManager pm = context.getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
phoneButton.setVisibility(View.VISIBLE);
messageButton.setVisibility(View.VISIBLE);
phoneButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
launchCall(v.getContext());
}
});
messageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
launchMessaging(v.getContext());
}
});
if (contactPojo.homeNumber)
messageButton.setVisibility(View.INVISIBLE);
else
messageButton.setVisibility(View.VISIBLE);
} else {
phoneButton.setVisibility(View.INVISIBLE);
messageButton.setVisibility(View.INVISIBLE);
}
return v;
}
Aggregations