本文整理汇总了Java中org.telegram.messenger.ChatObject类的典型用法代码示例。如果您正苦于以下问题:Java ChatObject类的具体用法?Java ChatObject怎么用?Java ChatObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChatObject类属于org.telegram.messenger包,在下文中一共展示了ChatObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: leaveChatPressed
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
private void leaveChatPressed() {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
if (ChatObject.isChannel(chat_id) && !currentChat.megagroup) {
builder.setMessage(ChatObject.isChannel(chat_id) ? LocaleController.getString("ChannelLeaveAlert", R.string.ChannelLeaveAlert) : LocaleController.getString("AreYouSureDeleteAndExit", R.string.AreYouSureDeleteAndExit));
} else {
builder.setMessage(LocaleController.getString("AreYouSureDeleteAndExit", R.string.AreYouSureDeleteAndExit));
}
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
kickUser(0);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
示例2: setDialogId
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
public void setDialogId(long id) {
dialog_id = id;
if ((int) dialog_id < 0) {
TLRPC.Chat currentChat = MessagesController.getInstance().getChat(-(int) dialog_id);
silent = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE).getBoolean("silent_" + dialog_id, false);
canWriteToChannel = ChatObject.isChannel(currentChat) && (currentChat.creator || currentChat.editor) && !currentChat.megagroup;
if (notifyButton != null) {
notifyButton.setVisibility(canWriteToChannel ? VISIBLE : GONE);
notifyButton.setImageResource(silent ? R.drawable.notify_members_off : R.drawable.notify_members_on);
attachButton.setPivotX(AndroidUtilities.dp((botButton == null || botButton.getVisibility() == GONE) && (notifyButton == null || notifyButton.getVisibility() == GONE) ? 48 : 96));
}
if (attachButton != null) {
updateFieldRight(attachButton.getVisibility() == VISIBLE ? 1 : 0);
}
}
}
示例3: updateFieldHint
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
private void updateFieldHint() {
boolean isChannel = false;
if ((int) dialog_id < 0) {
TLRPC.Chat chat = MessagesController.getInstance().getChat(-(int) dialog_id);
isChannel = ChatObject.isChannel(chat) && !chat.megagroup;
}
if (isChannel) {
if (editingMessageObject != null) {
messageEditText.setHint(editingCaption ? LocaleController.getString("Caption", R.string.Caption) : LocaleController.getString("TypeMessage", R.string.TypeMessage));
} else {
if (silent) {
messageEditText.setHint(LocaleController.getString("ChannelSilentBroadcast", R.string.ChannelSilentBroadcast));
} else {
messageEditText.setHint(LocaleController.getString("ChannelBroadcast", R.string.ChannelBroadcast));
}
}
} else {
messageEditText.setHint(LocaleController.getString("TypeMessage", R.string.TypeMessage));
}
}
示例4: ShareDialogsAdapter
import org.telegram.messenger.ChatObject; //导入依赖的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: ShareDialogsAdapter
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
public ShareDialogsAdapter(Context context) {
mContext = 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);
}
}
}
}
}
示例6: getSwipeDirs
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
@Override
public int getSwipeDirs(RecyclerView recyclerView,RecyclerView.ViewHolder viewHolder) {
if (viewHolder.itemView instanceof ChatMessageCell) {
int type = getMessageType(message);
boolean allowChatActions = true;
message = ((ChatMessageCell) viewHolder.itemView).getMessageObject();
boolean isVoiceMsg = MessageObject.isVoiceDocument(this.message.getDocument());
if ((currentEncryptedChat != null && AndroidUtilities.getPeerLayerVersion(ChatActivity.this.currentEncryptedChat.layer) < 46) || ((type == ChatActivity.attach_gallery && this.message.getDialogId() == ChatActivity.this.mergeDialogId) || ((ChatActivity.this.currentEncryptedChat == null && this.message.getId() < 0) || ChatActivity.this.isBroadcast || ((ChatActivity.this.currentChat != null && (ChatObject.isNotInChat(ChatActivity.this.currentChat) || !(!ChatObject.isChannel(ChatActivity.this.currentChat) || ChatActivity.this.currentChat.creator || ChatActivity.this.currentChat.editor || ChatActivity.this.currentChat.megagroup))) || isVoiceMsg)))) {
allowChatActions = false;
}
if (allowChatActions) {
ChatActivity.this.chatListView.cancelClickRunnables(true);
return super.getSwipeDirs(recyclerView, viewHolder);
}
}
return ChatActivity.attach_photo;
}
示例7: createActionBar
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
@Override
protected ActionBar createActionBar(Context context) {
ActionBar actionBar = new ActionBar(context) {
@Override
public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event); //TODO
}
};
actionBar.setItemsBackgroundColor(AvatarDrawable.getButtonColorForId(user_id != 0 || ChatObject.isChannel(chat_id) && !currentChat.megagroup ? 5 : chat_id));
//actionBar.setBackButtonDrawable(new BackDrawable(false));
SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
actionBar.setBackgroundColor(AvatarDrawable.getProfileBackColorForId(user_id != 0 || ChatObject.isChannel(chat_id) && !currentChat.megagroup ? 5 : chat_id));
//actionBar.setItemsBackground(AvatarDrawable.getButtonColorForId(user_id != 0 || ChatObject.isChannel(chat_id) && !currentChat.megagroup ? 5 : chat_id));
Drawable back = new BackDrawable(false);
((BackDrawable) back).setColor(themePrefs.getInt("profileHeaderIconsColor", 0xffffffff));
actionBar.setBackButtonDrawable(back);
actionBar.setCastShadows(false);
actionBar.setAddToContainer(false);
actionBar.setOccupyStatusBar(!AndroidUtilities.isTablet());
return actionBar;
}
示例8: setDialogId
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
public void setDialogId(long id) {
dialog_id = id;
if ((int) dialog_id < 0) {
TLRPC.Chat currentChat = MessagesController.getInstance().getChat(-(int) dialog_id);
silent = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE).getBoolean("silent_" + dialog_id, false);
canWriteToChannel = ChatObject.isChannel(currentChat) && (currentChat.creator || currentChat.editor) && !currentChat.megagroup;
if (notifyButton != null) {
notifyButton.setVisibility(canWriteToChannel ? VISIBLE : GONE);
notifyButton.setImageResource(silent ? R.drawable.notify_members_off : R.drawable.notify_members_on);
attachButton.setPivotX(AndroidUtilities.dp((botButton == null || botButton.getVisibility() == GONE) && (notifyButton == null || notifyButton.getVisibility() == GONE) ? 48 : 96));
}
if (attachButton != null) {
updateFieldRight(attachButton.getVisibility() == VISIBLE ? 1 : 0);
}
}
updateFieldHint();
}
示例9: updateFieldHint
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
private void updateFieldHint() {
boolean isChannel = false;
if ((int) dialog_id < 0) {
TLRPC.Chat chat = MessagesController.getInstance().getChat(-(int) dialog_id);
isChannel = ChatObject.isChannel(chat) && !chat.megagroup;
}
if (isChannel) {
if (editingMessageObject != null) {
messageEditText.setHint(editingCaption ? LocaleController.getString("Caption", R.string.Caption) : LocaleController.getString("TypeMessage", R.string.TypeMessage));
} else {
if (silent) {
messageEditText.setHint(LocaleController.getString("ChannelSilentBroadcast", R.string.ChannelSilentBroadcast));
} else {
messageEditText.setHint(LocaleController.getString("ChannelBroadcast", R.string.ChannelBroadcast));
}
}
} else {
messageEditText.setHint("");
}
}
示例10: generateShareList
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
private void generateShareList(ArrayList<TLRPC.TL_dialog> share_list) {
for (int a = 0; a < share_list.size(); a++) {
TLRPC.TL_dialog dialog = share_list.get(a);
if (favsFirst && Favourite.isFavourite(dialog.id)) {
continue;
}
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);
}
}
}
}
}
示例11: jumpToDate
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
private void jumpToDate(int date) {
if (messages.isEmpty()) {
return;
}
MessageObject firstMessage = messages.get(0);
MessageObject lastMessage = messages.get(messages.size() - 1);
if (firstMessage.messageOwner.date >= date && lastMessage.messageOwner.date <= date) {
for (int a = messages.size() - 1; a >= 0; a--) {
MessageObject message = messages.get(a);
if (message.messageOwner.date >= date && message.getId() != 0) {
scrollToMessageId(message.getId(), 0, false, message.getDialogId() == mergeDialogId ? 1 : 0, false);
break;
}
}
} else if ((int) dialog_id != 0) {
clearChatData();
waitingForLoad.add(lastLoadIndex);
MessagesController.getInstance().loadMessages(dialog_id, 30, 0, date, true, 0, classGuid, 4, 0, ChatObject.isChannel(currentChat), lastLoadIndex++);
floatingDateView.setAlpha(0.0f);
floatingDateView.setTag(null);
}
}
示例12: checkActionBarMenu
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
private void checkActionBarMenu() {
if (currentEncryptedChat != null && !(currentEncryptedChat instanceof TLRPC.TL_encryptedChat) ||
currentChat != null && ChatObject.isNotInChat(currentChat) ||
currentUser != null && UserObject.isDeleted(currentUser)) {
if (timeItem2 != null) {
timeItem2.setVisibility(View.GONE);
}
if (avatarContainer != null) {
avatarContainer.hideTimeItem();
}
} else {
if (timeItem2 != null) {
timeItem2.setVisibility(View.VISIBLE);
}
if (avatarContainer != null) {
avatarContainer.showTimeItem();
}
}
if (avatarContainer != null && currentEncryptedChat != null) {
avatarContainer.setTime(currentEncryptedChat.ttl);
}
checkAndUpdateAvatar();
}
示例13: createActionBar
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
@Override
protected ActionBar createActionBar(Context context) {
ActionBar actionBar = new ActionBar(context) {
@Override
public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);
}
};
actionBar.setItemsBackgroundColor(AvatarDrawable.getButtonColorForId(user_id != 0 || ChatObject.isChannel(chat_id) && !currentChat.megagroup ? 5 : chat_id), false);
actionBar.setItemsColor(Theme.getColor(Theme.key_actionBarDefaultIcon), false);
actionBar.setItemsColor(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon), true);
actionBar.setBackButtonDrawable(new BackDrawable(false));
actionBar.setCastShadows(false);
actionBar.setAddToContainer(false);
actionBar.setOccupyStatusBar(Build.VERSION.SDK_INT >= 21 && !AndroidUtilities.isTablet());
return actionBar;
}
示例14: setChatInfo
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
public void setChatInfo(TLRPC.ChatFull chatInfo) {
info = chatInfo;
if (!inlineMediaEnabled && foundContextBot != null && parentFragment != null) {
TLRPC.Chat chat = parentFragment.getCurrentChat();
if (chat != null) {
inlineMediaEnabled = ChatObject.canSendStickers(chat);
if (inlineMediaEnabled) {
searchResultUsernames = null;
notifyDataSetChanged();
delegate.needChangePanelVisibility(false);
processFoundUser(foundContextBot);
}
}
}
if (lastText != null) {
searchUsernameOrHashtag(lastText, lastPosition, messages, lastUsernameOnly);
}
}
示例15: setDialogId
import org.telegram.messenger.ChatObject; //导入依赖的package包/类
public void setDialogId(long id) {
dialog_id = id;
int lower_id = (int) dialog_id;
int high_id = (int) (dialog_id >> 32);
if ((int) dialog_id < 0) {
TLRPC.Chat currentChat = MessagesController.getInstance().getChat(-(int) dialog_id);
silent = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE).getBoolean("silent_" + dialog_id, false);
canWriteToChannel = ChatObject.isChannel(currentChat) && (currentChat.creator || currentChat.admin_rights != null && currentChat.admin_rights.post_messages) && !currentChat.megagroup;
if (notifyButton != null) {
notifyButton.setVisibility(canWriteToChannel ? VISIBLE : GONE);
notifyButton.setImageResource(silent ? R.drawable.notify_members_off : R.drawable.notify_members_on);
attachLayout.setPivotX(AndroidUtilities.dp((botButton == null || botButton.getVisibility() == GONE) && (notifyButton == null || notifyButton.getVisibility() == GONE) ? 48 : 96));
}
if (attachLayout != null) {
updateFieldRight(attachLayout.getVisibility() == VISIBLE ? 1 : 0);
}
}
checkRoundVideo();
updateFieldHint();
}