import android.provider.ContactsContract.Intents.UI;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
+import android.util.DisplayMetrics;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextThemeWrapper;
private Bitmap generatePhoneNumberIcon(long contactId, int type, int actionResId) {
final Resources r = getResources();
boolean drawPhoneOverlay = true;
+ final float scaleDensity = getResources().getDisplayMetrics().scaledDensity;
Bitmap photo = loadContactPhoto(contactId, null);
if (photo == null) {
}
if (overlay != null) {
Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);
- textPaint.setTextSize(20.0f);
+ textPaint.setTextSize(20.0f * scaleDensity);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
textPaint.setColor(r.getColor(R.color.textColorIconOverlay));
textPaint.setShadowLayer(3f, 1, 1, r.getColor(R.color.textColorIconOverlayShadow));
- canvas.drawText(overlay, 2, 16, textPaint);
+ canvas.drawText(overlay, 2 * scaleDensity, 16 * scaleDensity, textPaint);
}
// Draw the phone action icon as an overlay
if (phoneIcon != null) {
src.set(0, 0, phoneIcon.getWidth(), phoneIcon.getHeight());
int iconWidth = icon.getWidth();
- dst.set(iconWidth - 20, -1, iconWidth, 19);
+ dst.set(iconWidth - ((int) (20 * scaleDensity)), -1,
+ iconWidth, ((int) (19 * scaleDensity)));
canvas.drawBitmap(phoneIcon, src, dst, photoPaint);
}
}
@Override
public boolean areAllItemsEnabled() {
- return mMode != MODE_STARRED
+ return mMode != MODE_STARRED
&& (mMode & MODE_MASK_SHOW_NUMBER_OF_CONTACTS) == 0
&& mSuggestionsCursorCount == 0;
}
}
position--;
}
-
+
if (mSuggestionsCursorCount > 0) {
return position != 0 && position != mSuggestionsCursorCount + 1;
}