本文整理汇总了Java中org.telegram.tgnet.TLRPC.User方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.User方法的具体用法?Java TLRPC.User怎么用?Java TLRPC.User使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.User方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatUserSearchName
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private String formatUserSearchName(TLRPC.User user) {
StringBuilder str = new StringBuilder("");
if (user.first_name != null && user.first_name.length() > 0) {
str.append(user.first_name);
}
if (user.last_name != null && user.last_name.length() > 0) {
if (str.length() > 0) {
str.append(" ");
}
str.append(user.last_name);
}
str.append(";;;");
if (user.username != null && user.username.length() > 0) {
str.append(user.username);
}
return str.toString().toLowerCase();
}
示例2: hideReportSpam
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void hideReportSpam(final long dialogId, TLRPC.User currentUser, TLRPC.Chat currentChat) {
if (currentUser == null && currentChat == null) {
return;
}
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("spam3_" + dialogId, 1);
editor.commit();
TLRPC.TL_messages_hideReportSpam req = new TLRPC.TL_messages_hideReportSpam();
if (currentUser != null) {
req.peer = MessagesController.getInputPeer(currentUser.id);
} else if (currentChat != null) {
req.peer = MessagesController.getInputPeer(-currentChat.id);
}
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
}
});
}
示例3: checkNeedDrawShareButton
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private boolean checkNeedDrawShareButton(MessageObject messageObject) {
if (messageObject.type == 13) {
return false;
} else if (messageObject.messageOwner.fwd_from != null && messageObject.messageOwner.fwd_from.channel_id != 0 && !messageObject.isOut()) {
return true;
} else if (messageObject.isFromUser()) {
if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty || messageObject.messageOwner.media == null || messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage && !(messageObject.messageOwner.media.webpage instanceof TLRPC.TL_webPage)) {
return false;
}
TLRPC.User user = MessagesController.getInstance().getUser(messageObject.messageOwner.from_id);
if (user != null && user.bot) {
return true;
}
if (messageObject.isMegagroup() && !messageObject.isOut()) {
TLRPC.Chat chat = MessagesController.getInstance().getChat(messageObject.messageOwner.to_id.channel_id);
return chat != null && chat.username != null && chat.username.length() > 0 && !(messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaContact) && !(messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGeo);
}
} else if (messageObject.messageOwner.from_id < 0 || messageObject.messageOwner.post) {
if (messageObject.messageOwner.to_id.channel_id != 0 && (messageObject.messageOwner.via_bot_id == 0 && messageObject.messageOwner.reply_to_msg_id == 0 || messageObject.type != 13)) {
return true;
}
}
return false;
}
示例4: putUsersAndChats
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void putUsersAndChats(final ArrayList<TLRPC.User> users, final ArrayList<TLRPC.Chat> chats, final boolean withTransaction, boolean useQueue) {
if (users != null && users.isEmpty() && chats != null && chats.isEmpty()) {
return;
}
if (useQueue) {
storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
putUsersAndChatsInternal(users, chats, withTransaction);
}
});
} else {
putUsersAndChatsInternal(users, chats, withTransaction);
}
}
示例5: 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, false, name);
}
示例6: updateSearchResults
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void updateSearchResults(final ArrayList<TLRPC.User> users, final ArrayList<CharSequence> names) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
searchResult = users;
searchResultNames = names;
notifyDataSetChanged();
}
});
}
示例7: saveAbout
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void saveAbout() {
TLRPC.User currentUser = UserConfig.getCurrentUser();
String about = MessagesController.getInstance().getUserAbout(currentUser.id);
if (aboutField.getText() == null) {
return;
}
String newAbout = aboutField.getText().toString();
if (about != null && about.equals(newAbout)) {
return;
}
TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile();
req.flags |= 4;
req.about = newAbout;
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
if(error != null){
Log.e("ChangeNameAbout","error " + error.toString());
}
if(response != null){
Log.e("ChangeNameAbout","response " + response.toString());
MessagesController.getInstance().loadFullUser(UserConfig.getCurrentUser(), classGuid, true);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.userInfoDidLoaded, UserConfig.getCurrentUser().id);
UserConfig.saveConfig(true);
}
});
}
}
});
}
示例8: addspecefic
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void addspecefic(final TLRPC.User finalUser, final Context context) {
if (finalUser != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
//builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setTitle(context.getResources().getString(R.string.AddSpecific));
final Boolean[] items = {true, true, true, false};
builder.setMultiChoiceItems(new CharSequence[]{context.getResources().getString(R.string.picup),
context.getResources().getString(R.string.statusup),
context.getResources().getString(R.string.phoneup),
context.getResources().getString(R.string.isonetime)},
new boolean[]{true, true, true, false},
new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
items[which] = isChecked;
}
});
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
userDBAdapter db = new userDBAdapter(context);
db.open();
db.updateIsSpecific(finalUser.id, 1);
db.updatePicUp(finalUser.id, items[0] ? 1 : 0);
db.updateStatusUp(finalUser.id, items[1] ? 1 : 0);
db.updatePhoneUp(finalUser.id, items[2] ? 1 : 0);
db.updateIsOneTime(finalUser.id, items[3] ? 1 : 0);
db.close();
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
}
示例9: showOpenGameAlert
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void showOpenGameAlert(final TLRPC.TL_game game, final MessageObject messageObject, final String urlStr, boolean ask, final int uid) {
TLRPC.User user = MessagesController.getInstance().getUser(uid);
if (ask) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
String name;
if (user != null) {
name = ContactsController.formatName(user.first_name, user.last_name);
} else {
name = "";
}
builder.setMessage(LocaleController.formatString("BotPermissionGameAlert", R.string.BotPermissionGameAlert, name));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
showOpenGameAlert(game, messageObject, urlStr, false, uid);
ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE).edit().putBoolean("askgame_" + uid, false).commit();
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
} else {
if (Build.VERSION.SDK_INT >= 21 && !AndroidUtilities.isTablet() && WebviewActivity.supportWebview()) {
if (parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 1) == this) {
presentFragment(new WebviewActivity(urlStr, user != null && !TextUtils.isEmpty(user.username) ? user.username : "", game.title, game.short_name, messageObject));
}
} else {
WebviewActivity.openGameInBrowser(urlStr, messageObject, getParentActivity(), game.short_name, user != null && user.username != null ? user.username : "");
}
}
}
示例10: getMusicAuthor
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public String getMusicAuthor() {
TLRPC.Document document;
if (type == 0) {
document = messageOwner.media.webpage.document;
} else {
document = messageOwner.media.document;
}
for (int a = 0; a < document.attributes.size(); a++) {
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
if (attribute.voice) {
if (isOutOwner() || messageOwner.fwd_from != null && messageOwner.fwd_from.from_id == UserConfig.getClientUserId()) {
return LocaleController.getString("FromYou", R.string.FromYou);
}
TLRPC.User user = null;
TLRPC.Chat chat = null;
if (messageOwner.fwd_from != null && messageOwner.fwd_from.channel_id != 0) {
chat = MessagesController.getInstance().getChat(messageOwner.fwd_from.channel_id);
} else if (messageOwner.fwd_from != null && messageOwner.fwd_from.from_id != 0) {
user = MessagesController.getInstance().getUser(messageOwner.fwd_from.from_id);
} else if (messageOwner.from_id < 0) {
chat = MessagesController.getInstance().getChat(-messageOwner.from_id);
} else {
user = MessagesController.getInstance().getUser(messageOwner.from_id);
}
if (user != null) {
return UserObject.getUserName(user);
} else if (chat != null) {
return chat.title;
}
}
String performer = attribute.performer;
if (performer == null || performer.length() == 0) {
performer = LocaleController.getString("AudioUnknownArtist", R.string.AudioUnknownArtist);
}
return performer;
}
}
return "";
}
示例11: sendMessage
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendMessage(TLRPC.User user, long peer, MessageObject reply_to_msg, TLRPC.ReplyMarkup replyMarkup, HashMap<String, String> params) {
sendMessage(null, null, null, null, user, null, peer, null, reply_to_msg, null, true, null, null, replyMarkup, params);
}
示例12: getInputUser
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static TLRPC.InputUser getInputUser(int user_id) {
TLRPC.User user = getInstance().getUser(user_id);
return getInputUser(user);
}
示例13: putEncryptedChat
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void putEncryptedChat(final TLRPC.EncryptedChat chat, final TLRPC.User user, final TLRPC.TL_dialog dialog) {
if (chat == null) {
return;
}
storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
try {
if ((chat.key_hash == null || chat.key_hash.length < 16) && chat.auth_key != null) {
chat.key_hash = AndroidUtilities.calcAuthKeyHash(chat.auth_key);
}
SQLitePreparedStatement state = database.executeFast("REPLACE INTO enc_chats VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
NativeByteBuffer data = new NativeByteBuffer(chat.getObjectSize());
NativeByteBuffer data2 = new NativeByteBuffer(chat.a_or_b != null ? chat.a_or_b.length : 1);
NativeByteBuffer data3 = new NativeByteBuffer(chat.auth_key != null ? chat.auth_key.length : 1);
NativeByteBuffer data4 = new NativeByteBuffer(chat.future_auth_key != null ? chat.future_auth_key.length : 1);
NativeByteBuffer data5 = new NativeByteBuffer(chat.key_hash != null ? chat.key_hash.length : 1);
chat.serializeToStream(data);
state.bindInteger(1, chat.id);
state.bindInteger(2, user.id);
state.bindString(3, formatUserSearchName(user));
state.bindByteBuffer(4, data);
if (chat.a_or_b != null) {
data2.writeBytes(chat.a_or_b);
}
if (chat.auth_key != null) {
data3.writeBytes(chat.auth_key);
}
if (chat.future_auth_key != null) {
data4.writeBytes(chat.future_auth_key);
}
if (chat.key_hash != null) {
data5.writeBytes(chat.key_hash);
}
state.bindByteBuffer(5, data2);
state.bindByteBuffer(6, data3);
state.bindInteger(7, chat.ttl);
state.bindInteger(8, chat.layer);
state.bindInteger(9, chat.seq_in);
state.bindInteger(10, chat.seq_out);
state.bindInteger(11, (int) chat.key_use_count_in << 16 | chat.key_use_count_out);
state.bindLong(12, chat.exchange_id);
state.bindInteger(13, chat.key_create_date);
state.bindLong(14, chat.future_key_fingerprint);
state.bindByteBuffer(15, data4);
state.bindByteBuffer(16, data5);
state.step();
state.dispose();
data.reuse();
data2.reuse();
data3.reuse();
data4.reuse();
data5.reuse();
if (dialog != null) {
state = database.executeFast("REPLACE INTO dialogs VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
state.bindLong(1, dialog.id);
state.bindInteger(2, dialog.last_message_date);
state.bindInteger(3, dialog.unread_count);
state.bindInteger(4, dialog.top_message);
state.bindInteger(5, dialog.read_inbox_max_id);
state.bindInteger(6, dialog.read_outbox_max_id);
state.bindInteger(7, 0);
state.bindInteger(8, 0);
state.bindInteger(9, dialog.pts);
state.bindInteger(10, 0);
state.step();
state.dispose();
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
});
}
示例14: getUsers
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public ConcurrentHashMap<Integer, TLRPC.User> getUsers() {
return users;
}
示例15: MessageObject
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public MessageObject(TLRPC.Message message, AbstractMap<Integer, TLRPC.User> users, boolean generateLayout) {
this(message, users, null, generateLayout);
}