本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_account_updateProfile方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_account_updateProfile方法的具体用法?Java TLRPC.TL_account_updateProfile怎么用?Java TLRPC.TL_account_updateProfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.TL_account_updateProfile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveName
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void saveName() {
TLRPC.User currentUser = UserConfig.getCurrentUser();
if (currentUser == null || lastNameField.getText() == null || firstNameField.getText() == null) {
return;
}
String newFirst = firstNameField.getText().toString();
String newLast = lastNameField.getText().toString();
if (currentUser.first_name != null && currentUser.first_name.equals(newFirst) && currentUser.last_name != null && currentUser.last_name.equals(newLast)) {
return;
}
TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile();
req.flags = 3;
currentUser.first_name = req.first_name = newFirst;
currentUser.last_name = req.last_name = newLast;
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
if (user != null) {
user.first_name = req.first_name;
user.last_name = req.last_name;
}
UserConfig.saveConfig(true);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.mainUserInfoChanged);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME);
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
}
});
}
示例2: 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);
}
});
}
}
});
}
示例3: saveName
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void saveName() {
TLRPC.User currentUser = UserConfig.getCurrentUser();
if (currentUser == null || lastNameField.getText() == null || firstNameField.getText() == null) {
return;
}
String newFirst = firstNameField.getText().toString();
String newLast = lastNameField.getText().toString();
if (currentUser.first_name != null && currentUser.first_name.equals(newFirst) && currentUser.last_name != null && currentUser.last_name.equals(newLast)) {
return;
}
TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile();
req.flags = 7;//3;
currentUser.first_name = req.first_name = newFirst;
currentUser.last_name = req.last_name = newLast;
//req.about = "Esto es un test desde HastiGram";
req.about = "This is a test from HastiGram";
TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
if (user != null) {
user.first_name = req.first_name;
user.last_name = req.last_name;
}
UserConfig.saveConfig(true);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.mainUserInfoChanged);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME);
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
if(response != null) Log.e("saveName","response " + response.toString());
if(error != null)Log.e("saveName","error " + error.text);
}
});
}