Java Code Examples for com.android.messaging.ui.ConversationDrawables

Following code examples demonstrate how to use com.android.messaging.ui.ConversationDrawablesfrom android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.android.messaging.ui.ConversationDrawablesand various code implementation of this class.

    public GalleryGridAdapter(final Context context, final Cursor cursor) {
        super(context, cursor, 0);
        mAccentColor = ConversationDrawables.get().getDefaultAccentColor();
    } 


    private void updateImageView() {
        if (mData.isDocumentPickerItem()) {
            mImageView.setScaleType(ScaleType.CENTER);
            setBackgroundColor(ConversationDrawables.get().getConversationThemeColor());
            mImageView.setImageResourceId(null);
            mImageView.setImageResource(R.drawable.ic_photo_library_light);
            mImageView.setContentDescription(getResources().getString(
                    R.string.pick_image_from_document_library_content_description));
        } else {
            mImageView.setScaleType(ScaleType.CENTER_CROP);
            setBackgroundColor(getResources().getColor(R.color.gallery_image_default_background));
            mImageView.setImageResourceId(mData.getImageRequestDescriptor());
            final long dateSeconds = mData.getDateSeconds();
            final boolean isValidDate = (dateSeconds > 0);
            final int templateId = isValidDate ?
                    R.string.mediapicker_gallery_image_item_description :
                    R.string.mediapicker_gallery_image_item_description_no_date;
            String contentDescription = String.format(getResources().getString(templateId),
                    dateSeconds * TimeUnit.SECONDS.toMillis(1));
            mImageView.setContentDescription(contentDescription);
        }
    } 

Advertisement
Javadoc
A singleton cache that holds tinted drawable resources for displaying messages, such as message bubb

les, audio attachments etc.

Read More
Advertisement