Java Code Examples for org.telegram.tgnet.TLRPC#TL_photoEmpty

The following examples show how to use org.telegram.tgnet.TLRPC#TL_photoEmpty . 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: ChatActionCell.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void buildLayout() {
    CharSequence text;
    if (currentMessageObject != null) {
        if (currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.media != null && currentMessageObject.messageOwner.media.ttl_seconds != 0) {
            if (currentMessageObject.messageOwner.media.photo instanceof TLRPC.TL_photoEmpty) {
                text = LocaleController.getString("AttachPhotoExpired", R.string.AttachPhotoExpired);
            } else if (currentMessageObject.messageOwner.media.document instanceof TLRPC.TL_documentEmpty) {
                text = LocaleController.getString("AttachVideoExpired", R.string.AttachVideoExpired);
            } else {
                text = currentMessageObject.messageText;
            }
        } else {
            text = currentMessageObject.messageText;
        }
    } else {
        text = customText;
    }
    createLayout(text, previousWidth);
    if (currentMessageObject != null && currentMessageObject.type == 11) {
        imageReceiver.setImageCoords((previousWidth - AndroidUtilities.dp(64)) / 2, textHeight + AndroidUtilities.dp(15), AndroidUtilities.dp(64), AndroidUtilities.dp(64));
    }
}
 
Example 2
Source File: ChatActionCell.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void buildLayout() {
    CharSequence text;
    if (currentMessageObject != null) {
        if (currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.media != null && currentMessageObject.messageOwner.media.ttl_seconds != 0) {
            if (currentMessageObject.messageOwner.media.photo instanceof TLRPC.TL_photoEmpty) {
                text = LocaleController.getString("AttachPhotoExpired", R.string.AttachPhotoExpired);
            } else if (currentMessageObject.messageOwner.media.document instanceof TLRPC.TL_documentEmpty) {
                text = LocaleController.getString("AttachVideoExpired", R.string.AttachVideoExpired);
            } else {
                text = currentMessageObject.messageText;
            }
        } else {
            text = currentMessageObject.messageText;
        }
    } else {
        text = customText;
    }
    createLayout(text, previousWidth);
    if (currentMessageObject != null && currentMessageObject.type == 11) {
        imageReceiver.setImageCoords((previousWidth - AndroidUtilities.dp(64)) / 2, textHeight + AndroidUtilities.dp(15), AndroidUtilities.dp(64), AndroidUtilities.dp(64));
    }
}
 
Example 3
Source File: ChatActionCell.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
    if (currentMessageObject == null && customText == null)
    {
        setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), textHeight + AndroidUtilities.dp(14));
        return;
    }
    int width = Math.max(AndroidUtilities.dp(30), MeasureSpec.getSize(widthMeasureSpec));
    if (width != previousWidth)
    {
        CharSequence text;
        if (currentMessageObject != null)
        {
            if (currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.media != null && currentMessageObject.messageOwner.media.ttl_seconds != 0)
            {
                if (currentMessageObject.messageOwner.media.photo instanceof TLRPC.TL_photoEmpty)
                {
                    text = LocaleController.getString("AttachPhotoExpired", R.string.AttachPhotoExpired);
                }
                else if (currentMessageObject.messageOwner.media.document instanceof TLRPC.TL_documentEmpty)
                {
                    text = LocaleController.getString("AttachVideoExpired", R.string.AttachVideoExpired);
                }
                else
                {
                    text = currentMessageObject.messageText;
                }
            }
            else
            {
                text = currentMessageObject.messageText;
            }
        }
        else
        {
            text = customText;
        }
        previousWidth = width;
        createLayout(text, width);
        if (currentMessageObject != null && currentMessageObject.type == 11)
        {
            imageReceiver.setImageCoords((width - AndroidUtilities.dp(64)) / 2, textHeight + AndroidUtilities.dp(15), AndroidUtilities.dp(64), AndroidUtilities.dp(64));
        }
    }
    setMeasuredDimension(width, textHeight + AndroidUtilities.dp(14 + (currentMessageObject != null && currentMessageObject.type == 11 ? 70 : 0)));
}
 
Example 4
Source File: ChatActionCell.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
    if (currentMessageObject == null && customText == null)
    {
        setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), textHeight + AndroidUtilities.dp(14));
        return;
    }
    int width = Math.max(AndroidUtilities.dp(30), MeasureSpec.getSize(widthMeasureSpec));
    if (width != previousWidth)
    {
        CharSequence text;
        if (currentMessageObject != null)
        {
            if (currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.media != null && currentMessageObject.messageOwner.media.ttl_seconds != 0)
            {
                if (currentMessageObject.messageOwner.media.photo instanceof TLRPC.TL_photoEmpty)
                {
                    text = LocaleController.getString("AttachPhotoExpired", R.string.AttachPhotoExpired);
                }
                else if (currentMessageObject.messageOwner.media.document instanceof TLRPC.TL_documentEmpty)
                {
                    text = LocaleController.getString("AttachVideoExpired", R.string.AttachVideoExpired);
                }
                else
                {
                    text = currentMessageObject.messageText;
                }
            }
            else
            {
                text = currentMessageObject.messageText;
            }
        }
        else
        {
            text = customText;
        }
        previousWidth = width;
        createLayout(text, width);
        if (currentMessageObject != null && currentMessageObject.type == 11)
        {
            imageReceiver.setImageCoords((width - AndroidUtilities.dp(64)) / 2, textHeight + AndroidUtilities.dp(15), AndroidUtilities.dp(64), AndroidUtilities.dp(64));
        }
    }
    setMeasuredDimension(width, textHeight + AndroidUtilities.dp(14 + (currentMessageObject != null && currentMessageObject.type == 11 ? 70 : 0)));
}