本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_dialog方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_dialog方法的具体用法?Java TLRPC.TL_dialog怎么用?Java TLRPC.TL_dialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.TL_dialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkUnreadCounter
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void checkUnreadCounter(int mask) {
if (mask != 0 && (mask & MessagesController.UPDATE_MASK_READ_DIALOG_MESSAGE) == 0 && (mask & MessagesController.UPDATE_MASK_NEW_MESSAGE) == 0) {
return;
}
TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs_dict.get(dialog_id);
if (dialog != null && dialog.unread_count != 0) {
if (lastUnreadCount != dialog.unread_count) {
lastUnreadCount = dialog.unread_count;
String countString = String.format("%d", dialog.unread_count);
countWidth = Math.max(AndroidUtilities.dp(7), (int) Math.ceil(countPaint.measureText(countString)));
countLayout = new StaticLayout(countString, countPaint, countWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
if (mask != 0) {
invalidate();
}
}
} else if (countLayout != null) {
if (mask != 0) {
invalidate();
}
lastUnreadCount = 0;
countLayout = null;
}
}
示例2: checkCurrentDialogIndex
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void checkCurrentDialogIndex() {
if (index < getDialogsArray().size()) {
TLRPC.TL_dialog dialog = getDialogsArray().get(index);
TLRPC.DraftMessage newDraftMessage = DraftQuery.getDraft(currentDialogId);
MessageObject newMessageObject = MessagesController.getInstance().dialogMessage.get(dialog.id);
if (currentDialogId != dialog.id ||
message != null && message.getId() != dialog.top_message ||
newMessageObject != null && newMessageObject.messageOwner.edit_date != currentEditDate ||
unreadCount != dialog.unread_count ||
message != newMessageObject ||
message == null && newMessageObject != null || newDraftMessage != draftMessage) {
currentDialogId = dialog.id;
update(0);
}
}
}
示例3: checkUnreadCounter
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void checkUnreadCounter(int mask) {
if (mask != 0 && (mask & MessagesController.UPDATE_MASK_READ_DIALOG_MESSAGE) == 0 && (mask & MessagesController.UPDATE_MASK_NEW_MESSAGE) == 0) {
return;
}
TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs_dict.get(dialog_id);
if (dialog != null && dialog.unread_count != 0) {
if (lastUnreadCount != dialog.unread_count) {
lastUnreadCount = dialog.unread_count;
String countString = String.format("%d", dialog.unread_count);
countWidth = Math.max(AndroidUtilities.dp(12), (int) Math.ceil(countPaint.measureText(countString)));
countLayout = new StaticLayout(countString, countPaint, countWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
if (mask != 0) {
invalidate();
}
}
} else if (countLayout != null) {
if (mask != 0) {
invalidate();
}
lastUnreadCount = 0;
countLayout = null;
}
}
示例4: ShareDialogsAdapter
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public ShareDialogsAdapter(Context context) {
this.context = context;
for (int a = 0; a < MessagesController.getInstance().dialogsServerOnly.size(); a++) {
TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogsServerOnly.get(a);
int lower_id = (int) dialog.id;
int high_id = (int) (dialog.id >> 32);
if (lower_id != 0 && high_id != 1) {
if (lower_id > 0) {
dialogs.add(dialog);
} else {
TLRPC.Chat chat = MessagesController.getInstance().getChat(-lower_id);
if (!(chat == null || ChatObject.isNotInChat(chat) || ChatObject.isChannel(chat) && !chat.creator && !chat.editor && !chat.megagroup)) {
dialogs.add(dialog);
}
}
}
}
}
示例5: compare
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public int compare(TLRPC.TL_dialog dialog1, TLRPC.TL_dialog dialog2) {
TLRPC.DraftMessage draftMessage = DraftQuery.getDraft(dialog1.id);
int date1 = draftMessage != null && draftMessage.date >= dialog1.last_message_date ? draftMessage.date : dialog1.last_message_date;
draftMessage = DraftQuery.getDraft(dialog2.id);
int date2 = draftMessage != null && draftMessage.date >= dialog2.last_message_date ? draftMessage.date : dialog2.last_message_date;
if (date1 < date2) {
return 1;
} else if (date1 > date2) {
return -1;
}
return 0;
}
示例6: onBindViewHolder
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
CustomHintDialogCell cell = (CustomHintDialogCell) holder.itemView;
TLRPC.TL_dialog dialog = dialogs.get(position);
TLRPC.Chat chat = null;
TLRPC.User user = null;
int did = 0;
did = (int) dialog.id;
if (dialog.id < 0) {
chat = MessagesController.getInstance().getChat(-(int) dialog.id);
} else {
chat = MessagesController.getInstance().getChat((int) dialog.id);
user = MessagesController.getInstance().getUser((int) dialog.id);
}
cell.setTag(did);
String name = "";
if (user != null) {
name = ContactsController.formatName(user.first_name, user.last_name);
} else if (chat != null) {
name = chat.title;
}
cell.setDialog(did, true, name);
}
示例7: getItem
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public TLRPC.TL_dialog getItem(int i) {
ArrayList<TLRPC.TL_dialog> arrayList = getDialogsArray();
if (i < 0 || i >= arrayList.size()) {
return null;
}
return arrayList.get(i);
}
示例8: onBindViewHolder
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
HintDialogCell cell = (HintDialogCell) holder.itemView;
TLRPC.TL_topPeer peer = SearchQuery.hints.get(position);
TLRPC.TL_dialog dialog = new TLRPC.TL_dialog();
TLRPC.Chat chat = null;
TLRPC.User user = null;
int did = 0;
if (peer.peer.user_id != 0) {
did = peer.peer.user_id;
user = MessagesController.getInstance().getUser(peer.peer.user_id);
} else if (peer.peer.channel_id != 0) {
did = -peer.peer.channel_id;
chat = MessagesController.getInstance().getChat(peer.peer.channel_id);
} else if (peer.peer.chat_id != 0) {
did = -peer.peer.chat_id;
chat = MessagesController.getInstance().getChat(peer.peer.chat_id);
}
cell.setTag(did);
String name = "";
if (user != null) {
name = ContactsController.formatName(user.first_name, user.last_name);
} else if (chat != null) {
name = chat.title;
}
cell.setDialog(did, true, name);
}
示例9: setDialog
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setDialog(TLRPC.TL_dialog dialog, boolean checked, CharSequence name) {
int lower_id = (int) dialog.id;
TLRPC.FileLocation photo = null;
if (lower_id > 0) {
TLRPC.User user = MessagesController.getInstance().getUser(lower_id);
if (name != null) {
nameTextView.setText(name);
} else if (user != null) {
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
} else {
nameTextView.setText("");
}
avatarDrawable.setInfo(user);
if (user != null && user.photo != null) {
photo = user.photo.photo_small;
}
} else {
TLRPC.Chat chat = MessagesController.getInstance().getChat(-lower_id);
if (name != null) {
nameTextView.setText(name);
} else if (chat != null) {
nameTextView.setText(chat.title);
} else {
nameTextView.setText("");
}
avatarDrawable.setInfo(chat);
if (chat != null && chat.photo != null) {
photo = chat.photo.photo_small;
}
}
imageView.setImage(photo, "50_50", avatarDrawable);
checkBox.setChecked(checked, false);
}
示例10: getDialogsArray
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private ArrayList<TLRPC.TL_dialog> getDialogsArray() {
//:ramin
/*if (dialogsType == 0) {
return MessagesController.getInstance().dialogs;
} else if (dialogsType == 1) {
return MessagesController.getInstance().dialogsServerOnly;
} else if (dialogsType == 2) {
return MessagesController.getInstance().dialogsGroupsOnly;
}*/
return DialogAdapterH.getDialogsArray(dialogsType);
}
示例11: getDialogsArray
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private ArrayList<TLRPC.TL_dialog> getDialogsArray() {
if (dialogsType == 0) {
return MessagesController.getInstance().dialogs;
} else if (dialogsType == 1) {
return MessagesController.getInstance().dialogsServerOnly;
} else if (dialogsType == 2) {
return MessagesController.getInstance().dialogsGroupsOnly;
}
//Telegram
else if (dialogsType == 3) {
return MessagesController.getInstance().dialogsUsers;
} else if (dialogsType == 4) {
return MessagesController.getInstance().dialogsGroups;
} else if (dialogsType == 5) {
return MessagesController.getInstance().dialogsChannels;
} else if (dialogsType == 6) {
return MessagesController.getInstance().dialogsBots;
} else if (dialogsType == 7) {
return MessagesController.getInstance().dialogsMegaGroups;
} else if (dialogsType == 8) {
return MessagesController.getInstance().dialogsFavs;
} else if (dialogsType == 9) {
return MessagesController.getInstance().dialogsGroupsAll;
}
//
return null;
}
示例12: getDialogsArray
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private ArrayList<TLRPC.TL_dialog> getDialogsArray() {
//:ramin
/*if (dialogsType == 0) {
return MessagesController.getInstance().dialogs;
} else if (dialogsType == 1) {
return MessagesController.getInstance().dialogsServerOnly;
} else if (dialogsType == 2) {
return MessagesController.getInstance().dialogsGroupsOnly;
}*/
return DialogAdapterH.getDialogsArray(dialogsType);
}
示例13: sortDefault
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void sortDefault(ArrayList<TLRPC.TL_dialog> dialogs){
Collections.sort(dialogs, new Comparator<TLRPC.TL_dialog>() {
@Override
public int compare(TLRPC.TL_dialog dialog, TLRPC.TL_dialog dialog2) {
if (dialog.last_message_date == dialog2.last_message_date) {
return 0;
} else if (dialog.last_message_date < dialog2.last_message_date) {
return 1;
} else {
return -1;
}
}
});
}
示例14: setDialog
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setDialog(TLRPC.TL_dialog dialog, int i, int type) {
currentDialogId = dialog.id;
isDialogCell = true;
index = i;
dialogsType = type;
update(0);
}
示例15: processNewChannelDifferenceParams
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
protected void processNewChannelDifferenceParams(int pts, int pts_count, int channelId) {
FileLog.e("tmessages", "processNewChannelDifferenceParams pts = " + pts + " pts_count = " + pts_count + " channeldId = " + channelId);
TLRPC.TL_dialog dialog = dialogs_dict.get((long) -channelId);
if (!DialogObject.isChannel(dialog)) {
return;
}
Integer channelPts = channelsPts.get(channelId);
if (channelPts == null) {
channelPts = MessagesStorage.getInstance().getChannelPtsSync(channelId);
if (channelPts == 0) {
channelPts = 1;
}
channelsPts.put(channelId, channelPts);
}
if (channelPts + pts_count == pts) {
FileLog.e("tmessages", "APPLY CHANNEL PTS");
channelsPts.put(channelId, pts);
MessagesStorage.getInstance().saveChannelPts(channelId, pts);
} else if (channelPts != pts) {
Long updatesStartWaitTime = updatesStartWaitTimeChannels.get(channelId);
Boolean gettingDifferenceChannel = gettingDifferenceChannels.get(channelId);
if (gettingDifferenceChannel == null) {
gettingDifferenceChannel = false;
}
if (gettingDifferenceChannel || updatesStartWaitTime == null || Math.abs(System.currentTimeMillis() - updatesStartWaitTime) <= 1500) {
FileLog.e("tmessages", "ADD CHANNEL UPDATE TO QUEUE pts = " + pts + " pts_count = " + pts_count);
if (updatesStartWaitTime == null) {
updatesStartWaitTimeChannels.put(channelId, System.currentTimeMillis());
}
UserActionUpdatesPts updates = new UserActionUpdatesPts();
updates.pts = pts;
updates.pts_count = pts_count;
updates.chat_id = channelId;
ArrayList<TLRPC.Updates> arrayList = updatesQueueChannels.get(channelId);
if (arrayList == null) {
arrayList = new ArrayList<>();
updatesQueueChannels.put(channelId, arrayList);
}
arrayList.add(updates);
} else {
getChannelDifference(channelId);
}
}
}