Java Code Examples for org.telegram.tgnet.TLRPC#TL_messageMediaEmpty
The following examples show how to use
org.telegram.tgnet.TLRPC#TL_messageMediaEmpty .
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: PrivacyControlActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public MessageCell(Context context) { super(context); setWillNotDraw(false); setClipToPadding(false); shadowDrawable = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); setPadding(0, AndroidUtilities.dp(11), 0, AndroidUtilities.dp(11)); int date = (int) (System.currentTimeMillis() / 1000) - 60 * 60; TLRPC.User currentUser = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()); TLRPC.Message message = new TLRPC.TL_message(); message.message = LocaleController.getString("PrivacyForwardsMessageLine", R.string.PrivacyForwardsMessageLine); message.date = date + 60; message.dialog_id = 1; message.flags = 257 + TLRPC.MESSAGE_FLAG_FWD; message.from_id = 0; message.id = 1; message.fwd_from = new TLRPC.TL_messageFwdHeader(); message.fwd_from.from_name = ContactsController.formatName(currentUser.first_name, currentUser.last_name); message.media = new TLRPC.TL_messageMediaEmpty(); message.out = false; message.to_id = new TLRPC.TL_peerUser(); message.to_id.user_id = UserConfig.getInstance(currentAccount).getClientUserId(); messageObject = new MessageObject(currentAccount, message, true); messageObject.eventId = 1; messageObject.resetLayout(); cell = new ChatMessageCell(context); cell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() { }); cell.isChat = false; cell.setFullyDraw(true); cell.setMessageObject(messageObject, null, false, false); addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); hintView = new HintView(context, 1, true); addView(hintView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 19, 0, 19, 0)); }
Example 2
Source File: ThemePreviewMessagesCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public ThemePreviewMessagesCell(Context context, ActionBarLayout layout, int type) { super(context); parentLayout = layout; setWillNotDraw(false); setOrientation(LinearLayout.VERTICAL); setPadding(0, AndroidUtilities.dp(11), 0, AndroidUtilities.dp(11)); shadowDrawable = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); int date = (int) (System.currentTimeMillis() / 1000) - 60 * 60; TLRPC.Message message = new TLRPC.TL_message(); if (type == 0) { message.message = LocaleController.getString("FontSizePreviewReply", R.string.FontSizePreviewReply); } else { message.message = LocaleController.getString("NewThemePreviewReply", R.string.NewThemePreviewReply); } message.date = date + 60; message.dialog_id = 1; message.flags = 259; message.from_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); message.id = 1; message.media = new TLRPC.TL_messageMediaEmpty(); message.out = true; message.to_id = new TLRPC.TL_peerUser(); message.to_id.user_id = 0; MessageObject replyMessageObject = new MessageObject(UserConfig.selectedAccount, message, true); message = new TLRPC.TL_message(); if (type == 0) { message.message = LocaleController.getString("FontSizePreviewLine2", R.string.FontSizePreviewLine2); } else { String text = LocaleController.getString("NewThemePreviewLine3", R.string.NewThemePreviewLine3); StringBuilder builder = new StringBuilder(text); int index1 = text.indexOf('*'); int index2 = text.lastIndexOf('*'); if (index1 != -1 && index2 != -1) { builder.replace(index2, index2 + 1, ""); builder.replace(index1, index1 + 1, ""); TLRPC.TL_messageEntityTextUrl entityUrl = new TLRPC.TL_messageEntityTextUrl(); entityUrl.offset = index1; entityUrl.length = index2 - index1 - 1; entityUrl.url = "https://telegram.org"; message.entities.add(entityUrl); } message.message = builder.toString(); } message.date = date + 960; message.dialog_id = 1; message.flags = 259; message.from_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); message.id = 1; message.media = new TLRPC.TL_messageMediaEmpty(); message.out = true; message.to_id = new TLRPC.TL_peerUser(); message.to_id.user_id = 0; MessageObject message1 = new MessageObject(UserConfig.selectedAccount, message, true); message1.resetLayout(); message1.eventId = 1; message = new TLRPC.TL_message(); if (type == 0) { message.message = LocaleController.getString("FontSizePreviewLine1", R.string.FontSizePreviewLine1); } else { message.message = LocaleController.getString("NewThemePreviewLine1", R.string.NewThemePreviewLine1); } message.date = date + 60; message.dialog_id = 1; message.flags = 257 + 8; message.from_id = 0; message.id = 1; message.reply_to_msg_id = 5; message.media = new TLRPC.TL_messageMediaEmpty(); message.out = false; message.to_id = new TLRPC.TL_peerUser(); message.to_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); MessageObject message2 = new MessageObject(UserConfig.selectedAccount, message, true); if (type == 0) { message2.customReplyName = LocaleController.getString("FontSizePreviewName", R.string.FontSizePreviewName); } else { message2.customReplyName = LocaleController.getString("NewThemePreviewName", R.string.NewThemePreviewName); } message2.eventId = 1; message2.resetLayout(); message2.replyMessageObject = replyMessageObject; for (int a = 0; a < cells.length; a++) { cells[a] = new ChatMessageCell(context); cells[a].setDelegate(new ChatMessageCell.ChatMessageCellDelegate() { }); cells[a].isChat = false; cells[a].setFullyDraw(true); cells[a].setMessageObject(a == 0 ? message2 : message1, null, false, false); addView(cells[a], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } }
Example 3
Source File: PrivacyControlActivity.java From Telegram with GNU General Public License v2.0 | 4 votes |
public MessageCell(Context context) { super(context); setWillNotDraw(false); setClipToPadding(false); shadowDrawable = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); setPadding(0, AndroidUtilities.dp(11), 0, AndroidUtilities.dp(11)); int date = (int) (System.currentTimeMillis() / 1000) - 60 * 60; TLRPC.User currentUser = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()); TLRPC.Message message = new TLRPC.TL_message(); message.message = LocaleController.getString("PrivacyForwardsMessageLine", R.string.PrivacyForwardsMessageLine); message.date = date + 60; message.dialog_id = 1; message.flags = 257 + TLRPC.MESSAGE_FLAG_FWD; message.from_id = 0; message.id = 1; message.fwd_from = new TLRPC.TL_messageFwdHeader(); message.fwd_from.from_name = ContactsController.formatName(currentUser.first_name, currentUser.last_name); message.media = new TLRPC.TL_messageMediaEmpty(); message.out = false; message.to_id = new TLRPC.TL_peerUser(); message.to_id.user_id = UserConfig.getInstance(currentAccount).getClientUserId(); messageObject = new MessageObject(currentAccount, message, true); messageObject.eventId = 1; messageObject.resetLayout(); cell = new ChatMessageCell(context); cell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() { }); cell.isChat = false; cell.setFullyDraw(true); cell.setMessageObject(messageObject, null, false, false); addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); hintView = new HintView(context, 1, true); addView(hintView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 19, 0, 19, 0)); }
Example 4
Source File: ThemePreviewMessagesCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
public ThemePreviewMessagesCell(Context context, ActionBarLayout layout, int type) { super(context); parentLayout = layout; setWillNotDraw(false); setOrientation(LinearLayout.VERTICAL); setPadding(0, AndroidUtilities.dp(11), 0, AndroidUtilities.dp(11)); shadowDrawable = Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow); int date = (int) (System.currentTimeMillis() / 1000) - 60 * 60; TLRPC.Message message = new TLRPC.TL_message(); if (type == 0) { message.message = LocaleController.getString("FontSizePreviewReply", R.string.FontSizePreviewReply); } else { message.message = LocaleController.getString("NewThemePreviewReply", R.string.NewThemePreviewReply); } message.date = date + 60; message.dialog_id = 1; message.flags = 259; message.from_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); message.id = 1; message.media = new TLRPC.TL_messageMediaEmpty(); message.out = true; message.to_id = new TLRPC.TL_peerUser(); message.to_id.user_id = 0; MessageObject replyMessageObject = new MessageObject(UserConfig.selectedAccount, message, true); message = new TLRPC.TL_message(); if (type == 0) { message.message = LocaleController.getString("FontSizePreviewLine2", R.string.FontSizePreviewLine2); } else { String text = LocaleController.getString("NewThemePreviewLine3", R.string.NewThemePreviewLine3); StringBuilder builder = new StringBuilder(text); int index1 = text.indexOf('*'); int index2 = text.lastIndexOf('*'); if (index1 != -1 && index2 != -1) { builder.replace(index2, index2 + 1, ""); builder.replace(index1, index1 + 1, ""); TLRPC.TL_messageEntityTextUrl entityUrl = new TLRPC.TL_messageEntityTextUrl(); entityUrl.offset = index1; entityUrl.length = index2 - index1 - 1; entityUrl.url = "https://telegram.org"; message.entities.add(entityUrl); } message.message = builder.toString(); } message.date = date + 960; message.dialog_id = 1; message.flags = 259; message.from_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); message.id = 1; message.media = new TLRPC.TL_messageMediaEmpty(); message.out = true; message.to_id = new TLRPC.TL_peerUser(); message.to_id.user_id = 0; MessageObject message1 = new MessageObject(UserConfig.selectedAccount, message, true); message1.resetLayout(); message1.eventId = 1; message = new TLRPC.TL_message(); if (type == 0) { message.message = LocaleController.getString("FontSizePreviewLine1", R.string.FontSizePreviewLine1); } else { message.message = LocaleController.getString("NewThemePreviewLine1", R.string.NewThemePreviewLine1); } message.date = date + 60; message.dialog_id = 1; message.flags = 257 + 8; message.from_id = 0; message.id = 1; message.reply_to_msg_id = 5; message.media = new TLRPC.TL_messageMediaEmpty(); message.out = false; message.to_id = new TLRPC.TL_peerUser(); message.to_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); MessageObject message2 = new MessageObject(UserConfig.selectedAccount, message, true); if (type == 0) { message2.customReplyName = LocaleController.getString("FontSizePreviewName", R.string.FontSizePreviewName); } else { message2.customReplyName = LocaleController.getString("NewThemePreviewName", R.string.NewThemePreviewName); } message2.eventId = 1; message2.resetLayout(); message2.replyMessageObject = replyMessageObject; for (int a = 0; a < cells.length; a++) { cells[a] = new ChatMessageCell(context); cells[a].setDelegate(new ChatMessageCell.ChatMessageCellDelegate() { }); cells[a].isChat = false; cells[a].setFullyDraw(true); cells[a].setMessageObject(a == 0 ? message2 : message1, null, false, false); addView(cells[a], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } }