当前位置: 首页>>代码示例>>Java>>正文


Java SendMessagesHelper类代码示例

本文整理汇总了Java中org.telegram.messenger.SendMessagesHelper的典型用法代码示例。如果您正苦于以下问题:Java SendMessagesHelper类的具体用法?Java SendMessagesHelper怎么用?Java SendMessagesHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SendMessagesHelper类属于org.telegram.messenger包,在下文中一共展示了SendMessagesHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shareMyContact

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
public void shareMyContact(final MessageObject messageObject) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
    builder.setTitle(LocaleController.getString("ShareYouPhoneNumberTitle", R.string.ShareYouPhoneNumberTitle));
    if (currentUser != null) {
        if (currentUser.bot) {
            builder.setMessage(LocaleController.getString("AreYouSureShareMyContactInfoBot", R.string.AreYouSureShareMyContactInfoBot));
        } else {
            builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AreYouSureShareMyContactInfoUser", R.string.AreYouSureShareMyContactInfoUser, PhoneFormat.getInstance().format("+" + UserConfig.getCurrentUser().phone), ContactsController.formatName(currentUser.first_name, currentUser.last_name))));
        }
    } else {
        builder.setMessage(LocaleController.getString("AreYouSureShareMyContactInfo", R.string.AreYouSureShareMyContactInfo));
    }
    builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            SendMessagesHelper.getInstance().sendMessage(UserConfig.getCurrentUser(), dialog_id, messageObject, null, null);
            moveScrollToLastMessage();
            showReplyPanel(false, null, null, null, false, true);
        }
    });
    builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
    showDialog(builder.create());
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:24,代码来源:ChatActivity.java

示例2: unblockUser

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
private void unblockUser(Context context) {
    if (isOnline(context)) {
        Toast.makeText(context, context.getResources().getString(R.string.wait), Toast.LENGTH_LONG).show();
        TLRPC.User user = MessagesController.getInstance().getUser("SpamBot");
        if (user == null) {
            MessagesController.getInstance().openByUserNameasHidden("SpamBot", (Activity) context);
            return;
        }

        long id = 0;
        MessageObject.blockMode = true;
        if (user != null) {
            MessageObject.spamBotId = (long) user.id;
            id = (long) user.id;
        } else {
            MessageObject.spamBotId = constant.REPORT_BOT_ID;
            id = constant.REPORT_BOT_ID;
        }

        MessageObject.context = (Activity) context;
        SendMessagesHelper.getInstance().sendMessage("/start", (long) id, null, null, false, false, null, null, null);
        return;
    }
    Toast.makeText(context, context.getResources().getString(R.string.CheckInternet), Toast.LENGTH_LONG).show();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:26,代码来源:DialogsActivity.java

示例3: shareMyContact

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
public void shareMyContact(final MessageObject messageObject) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
    builder.setTitle(LocaleController.getString("ShareYouPhoneNumberTitle", R.string.ShareYouPhoneNumberTitle));
    if (currentUser != null) {
        if (currentUser.bot) {
            builder.setMessage(LocaleController.getString("AreYouSureShareMyContactInfoBot", R.string.AreYouSureShareMyContactInfoBot));
        } else {
            builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AreYouSureShareMyContactInfoUser", R.string.AreYouSureShareMyContactInfoUser, PhoneFormat.getInstance().format("+" + UserConfig.getCurrentUser().phone), ContactsController.formatName(currentUser.first_name, currentUser.last_name))));
        }
    } else {
        builder.setMessage(LocaleController.getString("AreYouSureShareMyContactInfo", R.string.AreYouSureShareMyContactInfo));
    }
    builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            SendMessagesHelper.getInstance().sendMessage(UserConfig.getCurrentUser(), dialog_id, messageObject, null, null);
            moveScrollToLastMessage();
            showReplyPanel(false, null, null, null, false);
        }
    });
    builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
    showDialog(builder.create());
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:24,代码来源:ChatActivity.java

示例4: sendMedia

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
public void sendMedia(MediaController.PhotoEntry photoEntry, VideoEditedInfo videoEditedInfo) {
    if (photoEntry.isVideo) {
        if (videoEditedInfo != null) {
            SendMessagesHelper.prepareSendingVideo(photoEntry.path, videoEditedInfo.estimatedSize, videoEditedInfo.estimatedDuration, videoEditedInfo.resultWidth, videoEditedInfo.resultHeight, videoEditedInfo, dialog_id, replyingMessageObject, photoEntry.caption != null ? photoEntry.caption.toString() : null, photoEntry.ttl);
        } else {
            SendMessagesHelper.prepareSendingVideo(photoEntry.path, 0, 0, 0, 0, null, dialog_id, replyingMessageObject, photoEntry.caption != null ? photoEntry.caption.toString() : null, photoEntry.ttl);
        }
        showReplyPanel(false, null, null, null, false);
        DraftQuery.cleanDraft(dialog_id, true);
    } else {
        if (photoEntry.imagePath != null) {
            SendMessagesHelper.prepareSendingPhoto(photoEntry.imagePath, null, dialog_id, replyingMessageObject, photoEntry.caption, photoEntry.stickers, null, photoEntry.ttl);
            showReplyPanel(false, null, null, null, false);
            DraftQuery.cleanDraft(dialog_id, true);
        } else if (photoEntry.path != null) {
            SendMessagesHelper.prepareSendingPhoto(photoEntry.path, null, dialog_id, replyingMessageObject, photoEntry.caption, photoEntry.stickers, null, photoEntry.ttl);
            showReplyPanel(false, null, null, null, false);
            DraftQuery.cleanDraft(dialog_id, true);
        }
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:22,代码来源:ChatActivity.java

示例5: didSelectDialogs

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
@Override
public void didSelectDialogs(DialogsActivity fragment, ArrayList<Long> dids, CharSequence message, boolean param) {
    long did = dids.get(0);
    Bundle args = new Bundle();
    args.putBoolean("scrollToTopOnResume", true);
    int lower_part = (int) did;
    if (lower_part != 0) {
        if (lower_part > 0) {
            args.putInt("user_id", lower_part);
        } else if (lower_part < 0) {
            args.putInt("chat_id", -lower_part);
        }
    } else {
        args.putInt("enc_id", (int) (did >> 32));
    }
    if (!MessagesController.checkCanOpenChat(args, fragment)) {
        return;
    }

    NotificationCenter.getInstance().removeObserver(this, NotificationCenter.closeChats);
    NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats);
    presentFragment(new ChatActivity(args), true);
    removeSelfFromStack();
    TLRPC.User user = MessagesController.getInstance().getUser(user_id);
    SendMessagesHelper.getInstance().sendMessage(user, did, null, null, null);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:27,代码来源:ProfileActivity.java

示例6: forwardMessages

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
public void forwardMessages(ArrayList<MessageObject> arrayList, boolean fromMyName) {
    if (arrayList == null || arrayList.isEmpty()) {
        return;
    }
    if (!fromMyName) {
        SendMessagesHelper.getInstance().sendMessage(arrayList, dialog_id);
    } else {
        for (MessageObject object : arrayList) {
            SendMessagesHelper.getInstance().processForwardFromMyName(object, dialog_id);
        }
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:13,代码来源:ChatActivity.java

示例7: sendPhoto

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
public void sendPhoto(MediaController.PhotoEntry photoEntry) {
    if (photoEntry.imagePath != null) {
        SendMessagesHelper.prepareSendingPhoto(photoEntry.imagePath, null, dialog_id, replyingMessageObject, photoEntry.caption);
        showReplyPanel(false, null, null, null, false, true);
        DraftQuery.cleanDraft(dialog_id, true);
    } else if (photoEntry.path != null) {
        SendMessagesHelper.prepareSendingPhoto(photoEntry.path, null, dialog_id, replyingMessageObject, photoEntry.caption);
        showReplyPanel(false, null, null, null, false, true);
        DraftQuery.cleanDraft(dialog_id, true);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:12,代码来源:ChatActivity.java

示例8: didSelectDialog

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
@Override
public void didSelectDialog(DialogsActivity fragment, long dialog_id, boolean param) {
    if (dialog_id != 0) {
        Bundle args = new Bundle();
        args.putBoolean("scrollToTopOnResume", true);
        int lower_part = (int) dialog_id;
        if (lower_part != 0) {
            if (lower_part > 0) {
                args.putInt("user_id", lower_part);
            } else if (lower_part < 0) {
                args.putInt("chat_id", -lower_part);
            }
        } else {
            args.putInt("enc_id", (int) (dialog_id >> 32));
        }
        if (!MessagesController.checkCanOpenChat(args, fragment)) {
            return;
        }

        NotificationCenter.getInstance().removeObserver(this, NotificationCenter.closeChats);
        NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats);
        presentFragment(new ChatActivity(args), true);
        removeSelfFromStack();
        TLRPC.User user = MessagesController.getInstance().getUser(user_id);
        SendMessagesHelper.getInstance().sendMessage(user, dialog_id, null, null, null);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:28,代码来源:ProfileActivity.java

示例9: doneEditingMessage

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
public void doneEditingMessage() {
    if (editingMessageObject != null) {
        delegate.onMessageEditEnd(true);
        editingMessageReqId = SendMessagesHelper.getInstance().editMessage(editingMessageObject, messageEditText.getText().toString(), messageWebPageSearch, parentFragment, MessagesQuery.getEntities(messageEditText.getText()), new Runnable() {
            @Override
            public void run() {
                editingMessageReqId = 0;
                setEditingMessageObject(null, false);
            }
        });
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:13,代码来源:ChatActivityEnterView.java

示例10: processSendingText

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
public boolean processSendingText(CharSequence text) {
    text = AndroidUtilities.getTrimmedString(text);
    if (text.length() != 0) {
        int count = (int) Math.ceil(text.length() / 4096.0f);
        for (int a = 0; a < count; a++) {
            CharSequence mess = text.subSequence(a * 4096, Math.min((a + 1) * 4096, text.length()));
            SendMessagesHelper.getInstance().sendMessage(mess.toString(), dialog_id, replyingMessageObject, messageWebPage, messageWebPageSearch, MessagesQuery.getEntities(mess), null, null);
        }
        return true;
    }
    return false;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:13,代码来源:ChatActivityEnterView.java

示例11: onStickerSelected

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
@Override
public void onStickerSelected(TLRPC.Document sticker) {
    SendMessagesHelper.getInstance().sendSticker(sticker, dialog_id, replyingMessageObject);
    if (delegate != null) {
        delegate.onMessageSend(null);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:8,代码来源:ChatActivityEnterView.java

示例12: onRequestPermissionsResultFragment

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) {
    if (requestCode == 2) {
        if (pendingLocationButton != null) {
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                SendMessagesHelper.getInstance().sendCurrentLocation(pendingMessageObject, pendingLocationButton);
            }
            pendingLocationButton = null;
            pendingMessageObject = null;
        }
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:12,代码来源:ChatActivityEnterView.java

示例13: sendBotInlineResult

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
private void sendBotInlineResult(TLRPC.BotInlineResult result) {
    int uid = mentionsAdapter.getContextBotId();
    HashMap<String, String> params = new HashMap<>();
    params.put("id", result.id);
    params.put("query_id", "" + result.query_id);
    params.put("bot", "" + uid);
    params.put("bot_name", mentionsAdapter.getContextBotName());
    SendMessagesHelper.prepareSendingBotContextResult(result, params, dialog_id, replyingMessageObject);
    chatActivityEnterView.setFieldText("");
    showReplyPanel(false, null, null, null, false, true);
    SearchQuery.increaseInlineRaiting(uid);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:13,代码来源:ChatActivity.java

示例14: forwardMessages

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
private void forwardMessages(ArrayList<MessageObject> arrayList, boolean fromMyName) {
    if (arrayList == null || arrayList.isEmpty()) {
        return;
    }
    if (!fromMyName) {
        SendMessagesHelper.getInstance().sendMessage(arrayList, dialog_id);
    } else {
        for (MessageObject object : arrayList) {
            SendMessagesHelper.getInstance().processForwardFromMyName(object, dialog_id, true);
        }
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:13,代码来源:ChatActivity.java

示例15: doneEditingMessage

import org.telegram.messenger.SendMessagesHelper; //导入依赖的package包/类
public void doneEditingMessage() {
    if (editingMessageObject != null) {
        delegate.onMessageEditEnd(true);
        CharSequence[] message = new CharSequence[] {messageEditText.getText()};
        ArrayList<TLRPC.MessageEntity> entities = MessagesQuery.getEntities(message);
        editingMessageReqId = SendMessagesHelper.getInstance().editMessage(editingMessageObject, message[0].toString(), messageWebPageSearch, parentFragment, entities, new Runnable() {
            @Override
            public void run() {
                editingMessageReqId = 0;
                setEditingMessageObject(null, false);
            }
        });
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:15,代码来源:ChatActivityEnterView.java


注:本文中的org.telegram.messenger.SendMessagesHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。