/** * Configures the call icon drawables. * A single white call arrow which points down and left is used as a basis for all of the * call arrow icons, applying rotation and colors as needed. * * @param context The current context. */ public Resources(Context context) { final android.content.res.Resources r = context.getResources(); incoming = r.getDrawable(R.drawable.ic_call_arrow); incoming.setColorFilter(r.getColor(R.color.answered_call), PorterDuff.Mode.MULTIPLY); // Create a rotated instance of the call arrow for outgoing calls. outgoing = BitmapUtil.getRotatedDrawable(r, R.drawable.ic_call_arrow, 180f); outgoing.setColorFilter(r.getColor(R.color.answered_call), PorterDuff.Mode.MULTIPLY); // Need to make a copy of the arrow drawable, otherwise the same instance colored // above will be recolored here. missed = r.getDrawable(R.drawable.ic_call_arrow).mutate(); missed.setColorFilter(r.getColor(R.color.missed_call), PorterDuff.Mode.MULTIPLY); voicemail = r.getDrawable(R.drawable.ic_call_voicemail_holo_dark); blocked = getScaledBitmap(context, R.drawable.ic_block_24dp); blocked.setColorFilter(r.getColor(R.color.blocked_call), PorterDuff.Mode.MULTIPLY); videoCall = getScaledBitmap(context, R.drawable.ic_videocam_24dp); videoCall.setColorFilter(r.getColor(R.color.dialtacts_secondary_text_color), PorterDuff.Mode.MULTIPLY); iconMargin = r.getDimensionPixelSize(R.dimen.call_log_icon_margin); }
BitmapUtil.findOptimalSampleSize(holder.originalSmallerExtent, requestedExtent); byte[] bytes = holder.bytes; if (bytes == null || bytes.length == 0) { Bitmap bitmap = BitmapUtil.decodeBitmapFromBytes(bytes, sampleSize);
/** * Maintains the state of a particular photo. */ private static class BitmapHolder { final byte[] bytes; final int originalSmallerExtent; volatile boolean fresh; Bitmap bitmap; Reference<Bitmap> bitmapRef; int decodedSampleSize; public BitmapHolder(byte[] bytes, int originalSmallerExtent) { this.bytes = bytes; this.fresh = true; this.originalSmallerExtent = originalSmallerExtent; } }