Java Code Examples for org.telegram.ui.ActionBar.Theme#key_chat_attachGalleryIcon()

The following examples show how to use org.telegram.ui.ActionBar.Theme#key_chat_attachGalleryIcon() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SharedDocumentCell.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public void setTextAndValueAndTypeAndThumb(String text, String value, String type, String thumb, int resId, boolean divider) {
    nameTextView.setText(text);
    dateTextView.setText(value);
    if (type != null) {
        extTextView.setVisibility(VISIBLE);
        extTextView.setText(type.toLowerCase());
    } else {
        extTextView.setVisibility(INVISIBLE);
    }
    needDivider = divider;
    if (resId == 0) {
        placeholderImageView.setImageResource(AndroidUtilities.getThumbForNameOrMime(text, type, false));
        placeholderImageView.setVisibility(VISIBLE);
    } else {
        placeholderImageView.setVisibility(INVISIBLE);
    }
    if (thumb != null || resId != 0) {
        if (thumb != null) {
            thumbImageView.setImage(thumb, "42_42", null);
        } else {
            Drawable drawable = Theme.createCircleDrawableWithIcon(AndroidUtilities.dp(42), resId);
            String iconKey;
            String backKey;
            if (resId == R.drawable.files_storage) {
                backKey = Theme.key_chat_attachLocationBackground;
                iconKey = Theme.key_chat_attachLocationIcon;
            } else if (resId == R.drawable.files_gallery) {
                backKey = Theme.key_chat_attachContactBackground;
                iconKey = Theme.key_chat_attachContactIcon;
            } else if (resId == R.drawable.files_music) {
                backKey = Theme.key_chat_attachAudioBackground;
                iconKey = Theme.key_chat_attachAudioIcon;
            } else if (resId == R.drawable.files_internal) {
                backKey = Theme.key_chat_attachGalleryBackground;
                iconKey = Theme.key_chat_attachGalleryIcon;
            } else {
                backKey = Theme.key_files_folderIconBackground;
                iconKey = Theme.key_files_folderIcon;
            }
            Theme.setCombinedDrawableColor(drawable, Theme.getColor(backKey), false);
            Theme.setCombinedDrawableColor(drawable, Theme.getColor(iconKey), true);
            thumbImageView.setImageDrawable(drawable);
        }
        thumbImageView.setVisibility(VISIBLE);
    } else {
        extTextView.setAlpha(1.0f);
        placeholderImageView.setAlpha(1.0f);
        thumbImageView.setImageBitmap(null);
        thumbImageView.setVisibility(INVISIBLE);
    }
    setWillNotDraw(!needDivider);
}
 
Example 2
Source File: SharedDocumentCell.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public void setTextAndValueAndTypeAndThumb(String text, String value, String type, String thumb, int resId, boolean divider) {
    nameTextView.setText(text);
    dateTextView.setText(value);
    if (type != null) {
        extTextView.setVisibility(VISIBLE);
        extTextView.setText(type.toLowerCase());
    } else {
        extTextView.setVisibility(INVISIBLE);
    }
    needDivider = divider;
    if (resId == 0) {
        placeholderImageView.setImageResource(AndroidUtilities.getThumbForNameOrMime(text, type, false));
        placeholderImageView.setVisibility(VISIBLE);
    } else {
        placeholderImageView.setVisibility(INVISIBLE);
    }
    if (thumb != null || resId != 0) {
        if (thumb != null) {
            thumbImageView.setImage(thumb, "42_42", null);
        } else {
            Drawable drawable = Theme.createCircleDrawableWithIcon(AndroidUtilities.dp(42), resId);
            String iconKey;
            String backKey;
            if (resId == R.drawable.files_storage) {
                backKey = Theme.key_chat_attachLocationBackground;
                iconKey = Theme.key_chat_attachLocationIcon;
            } else if (resId == R.drawable.files_gallery) {
                backKey = Theme.key_chat_attachContactBackground;
                iconKey = Theme.key_chat_attachContactIcon;
            } else if (resId == R.drawable.files_music) {
                backKey = Theme.key_chat_attachAudioBackground;
                iconKey = Theme.key_chat_attachAudioIcon;
            } else if (resId == R.drawable.files_internal) {
                backKey = Theme.key_chat_attachGalleryBackground;
                iconKey = Theme.key_chat_attachGalleryIcon;
            } else {
                backKey = Theme.key_files_folderIconBackground;
                iconKey = Theme.key_files_folderIcon;
            }
            Theme.setCombinedDrawableColor(drawable, Theme.getColor(backKey), false);
            Theme.setCombinedDrawableColor(drawable, Theme.getColor(iconKey), true);
            thumbImageView.setImageDrawable(drawable);
        }
        thumbImageView.setVisibility(VISIBLE);
    } else {
        extTextView.setAlpha(1.0f);
        placeholderImageView.setAlpha(1.0f);
        thumbImageView.setImageBitmap(null);
        thumbImageView.setVisibility(INVISIBLE);
    }
    setWillNotDraw(!needDivider);
}