當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。